it.unimi.dsi.fastutil.ints.IntListIterator Java Examples

The following examples show how to use it.unimi.dsi.fastutil.ints.IntListIterator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FixedLifespanScheduler.java    From presto with Apache License 2.0 6 votes vote down vote up
@Override
public void scheduleInitial(SourceScheduler scheduler)
{
    checkState(!initialScheduled);
    initialScheduled = true;

    for (Map.Entry<InternalNode, IntListIterator> entry : nodeToDriverGroupsMap.entrySet()) {
        IntListIterator driverGroupsIterator = entry.getValue();
        int driverGroupsScheduled = 0;
        while (driverGroupsIterator.hasNext()) {
            int driverGroupId = driverGroupsIterator.nextInt();
            scheduler.startLifespan(Lifespan.driverGroup(driverGroupId), partitionHandles.get(driverGroupId));

            totalDriverGroupsScheduled++;
            driverGroupsScheduled++;
            if (concurrentLifespansPerTask.isPresent() && driverGroupsScheduled == concurrentLifespansPerTask.getAsInt()) {
                break;
            }
        }
    }

    verify(totalDriverGroupsScheduled <= driverGroupToNodeMap.size());
    if (totalDriverGroupsScheduled == driverGroupToNodeMap.size()) {
        scheduler.noMoreLifespans();
    }
}
 
Example #2
Source File: IntDictionaryMap.java    From tablesaw with Apache License 2.0 6 votes vote down vote up
@Override
public Iterator<String> iterator() {
  return new Iterator<String>() {

    private final IntListIterator valuesIt = values.iterator();

    @Override
    public boolean hasNext() {
      return valuesIt.hasNext();
    }

    @Override
    public String next() {
      return getValueForKey(valuesIt.nextInt());
    }
  };
}
 
Example #3
Source File: IntDictionaryMap.java    From tablesaw with Apache License 2.0 6 votes vote down vote up
@Override
public Iterator<String> iterator() {
  return new Iterator<String>() {

    private final IntListIterator valuesIt = values.iterator();

    @Override
    public boolean hasNext() {
      return valuesIt.hasNext();
    }

    @Override
    public String next() {
      return getValueForKey(valuesIt.nextInt());
    }
  };
}
 
Example #4
Source File: FixedLifespanScheduler.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public SettableFuture<?> schedule(SourceScheduler scheduler)
{
    // Return a new future even if newDriverGroupReady has not finished.
    // Returning the same SettableFuture instance could lead to ListenableFuture retaining too many listener objects.

    checkState(initialScheduled);

    List<Lifespan> recentlyCompletedDriverGroups;
    synchronized (this) {
        recentlyCompletedDriverGroups = ImmutableList.copyOf(this.recentlyCompletedDriverGroups);
        this.recentlyCompletedDriverGroups.clear();
        newDriverGroupReady = SettableFuture.create();
    }

    for (Lifespan driverGroup : recentlyCompletedDriverGroups) {
        IntListIterator driverGroupsIterator = nodeToDriverGroupsMap.get(driverGroupToNodeMap.get(driverGroup.getId()));
        if (!driverGroupsIterator.hasNext()) {
            continue;
        }
        int driverGroupId = driverGroupsIterator.nextInt();
        scheduler.startLifespan(Lifespan.driverGroup(driverGroupId), partitionHandles.get(driverGroupId));
        totalDriverGroupsScheduled++;
    }

    verify(totalDriverGroupsScheduled <= driverGroupToNodeMap.size());
    if (totalDriverGroupsScheduled == driverGroupToNodeMap.size()) {
        scheduler.noMoreLifespans();
    }

    return newDriverGroupReady;
}
 
Example #5
Source File: IntColumn.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Override
public IntColumn removeMissing() {
  IntColumn result = copy();
  result.clear();
  IntListIterator iterator = data.iterator();
  while (iterator.hasNext()) {
    final int v = iterator.nextInt();
    if (!isMissingValue(v)) {
      result.append(v);
    }
  }
  return result;
}
 
Example #6
Source File: PermutedFrontCodedStringList.java    From database with GNU General Public License v2.0 5 votes vote down vote up
public ObjectListIterator<CharSequence> listIterator( final int k ) { return new AbstractObjectListIterator<CharSequence>() {
		final IntListIterator i = IntIterators.fromTo( 0, frontCodedStringList.size() );
		
		public boolean hasNext() { return i.hasNext(); }
		public boolean hasPrevious() { return i.hasPrevious(); }
		public CharSequence next() { return frontCodedStringList.get( permutation[ i.nextInt() ] ); }
		public CharSequence previous() { return frontCodedStringList.get( permutation[ i.previousInt() ] ); }
		public int nextIndex() { return i.nextIndex(); }
		public int previousIndex() { return i.previousIndex(); }
	};
}
 
Example #7
Source File: IntColumn.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Override
public IntColumn removeMissing() {
  IntColumn result = copy();
  result.clear();
  IntListIterator iterator = data.iterator();
  while (iterator.hasNext()) {
    final int v = iterator.nextInt();
    if (!isMissingValue(v)) {
      result.append(v);
    }
  }
  return result;
}