Java 类org.apache.commons.collections4.iterators.SingletonIterator 实例源码

项目:gatk    文件:QNameFinder.java   
@Override
public Iterator<QNameAndInterval> apply( final GATKRead read ) {
    if ( !filter.isMapped(read) ) return Collections.emptyIterator();

    final int readContigId = metadata.getContigID(read.getContig());
    final int readStart = read.getUnclippedStart();
    final int intervalsSize = intervals.size();
    while ( intervalsIndex < intervalsSize ) {
        final SVInterval interval = intervals.get(intervalsIndex);
        if ( interval.getContig() > readContigId ) break;
        if ( interval.getContig() == readContigId && interval.getEnd() > read.getStart() ) break;
        intervalsIndex += 1;
    }
    if ( intervalsIndex >= intervalsSize ) return noName;
    final SVInterval indexedInterval = intervals.get(intervalsIndex);
    final SVInterval readInterval = new SVInterval(readContigId, readStart, read.getUnclippedEnd()+1);
    if ( indexedInterval.isDisjointFrom(readInterval) ) return noName;
    return new SingletonIterator<>(new QNameAndInterval(read.getName(), intervalsIndex));
}
项目:gatk    文件:BreakpointEvidenceClusterer.java   
@Override
public Iterator<BreakpointEvidence> apply( final BreakpointEvidence evidence ) {
    if ( partitionCrossingChecker.onBoundary(evidence.getLocation()) ) {
        if ( curInterval == null ) {
            return new SingletonIterator<>(evidence);
        }
        List<BreakpointEvidence> evList = new ArrayList<>(2);
        evList.add(new BreakpointEvidence(curInterval,curWeight,true));
        evList.add(evidence);
        curInterval = null;
        return evList.iterator();
    }
    Iterator<BreakpointEvidence> result = EMPTY_ITERATOR;
    final SVInterval interval = evidence.getLocation();
    final int weight = evidence.getWeight();
    if ( curInterval == null ) {
        curInterval = interval;
        curWeight = weight;
    } else if ( curInterval.gapLen(interval) < gapSize ) {
        curInterval = curInterval.join(interval);
        curWeight += weight;
    } else {
        result = new SingletonIterator<>(new BreakpointEvidence(curInterval,curWeight,true));
        curInterval = interval;
        curWeight = weight;
    }
    return result;
}
项目:HCFCore    文件:SingletonMap.java   
@Override
public Iterator<V> iterator() {
    return new SingletonIterator<V>(parent.getValue(), false);
}
项目:HCFCore    文件:SingletonMap.java   
@Override
public Iterator<V> iterator() {
    return new SingletonIterator<V>(parent.getValue(), false);
}
项目:tcases    文件:Disjunction.java   
/**
 * Returns the disjuncts in this conjunction.
 */
public Iterator<IDisjunct> getDisjuncts()
  {
  return new SingletonIterator<IDisjunct>( this);
  }
项目:tcases    文件:AbstractAssertion.java   
/**
 * Returns the assertions for this disjunction.
 */
public Iterator<IAssertion> getAssertions()
  {
  return new SingletonIterator<IAssertion>( this);
  }
项目:tcases    文件:AbstractAssertion.java   
/**
 * Returns the disjuncts in this conjunction.
 */
public Iterator<IDisjunct> getDisjuncts()
  {
  return new SingletonIterator<IDisjunct>( this);
  }
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets a singleton iterator.
 * <p>
 * This iterator is a valid iterator object that will iterate over
 * the specified object.
 *
 * @param <E> the element type
 * @param object  the single object over which to iterate
 * @return a singleton iterator over the object
 */
public static <E> ResettableIterator<E> singletonIterator(final E object) {
    return new SingletonIterator<E>(object);
}
项目:HCFCore    文件:FluentIterable.java   
/**
 * Creates a new FluentIterable of the single provided element.
 * <p>
 * The returned iterable's iterator does not support {@code remove()}.
 *
 * @param <T>  the element type
 * @param singleton  the singleton element
 * @return a new FluentIterable containing the singleton
 */
public static <T> FluentIterable<T> of(final T singleton) {
    return of(IteratorUtils.asIterable(new SingletonIterator<T>(singleton, false)));
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets a singleton iterator.
 * <p>
 * This iterator is a valid iterator object that will iterate over
 * the specified object.
 *
 * @param <E> the element type
 * @param object  the single object over which to iterate
 * @return a singleton iterator over the object
 */
public static <E> ResettableIterator<E> singletonIterator(final E object) {
    return new SingletonIterator<E>(object);
}
项目:HCFCore    文件:FluentIterable.java   
/**
 * Creates a new FluentIterable of the single provided element.
 * <p>
 * The returned iterable's iterator does not support {@code remove()}.
 *
 * @param <T>  the element type
 * @param singleton  the singleton element
 * @return a new FluentIterable containing the singleton
 */
public static <T> FluentIterable<T> of(final T singleton) {
    return of(IteratorUtils.asIterable(new SingletonIterator<T>(singleton, false)));
}