Java 类org.apache.commons.collections.iterators.TransformIterator 实例源码

项目:BioSolr    文件:XJoinQParserPlugin.java   
@Override
@SuppressWarnings("unchecked")
public Query parse() throws SyntaxError {
  Method method = Method.valueOf(localParams.get(METHOD, Method.termsFilter.name()));
  JoinSpec<T> js = JoinSpec.parse(localParams.get(QueryParsing.V));
  Iterator<T> it = js.iterator(this);
  if (joinField == null) {
    throw new Exception("No XJoin component referenced by query");
  }
  FieldType ft = req.getSchema().getFieldTypeNoEx(joinField);
  Iterator<BytesRef> bytesRefs = new TransformIterator(it, transformer(ft));
  if (! bytesRefs.hasNext()) {
    return new BooleanQuery.Builder().build(); // matches nothing
  }
  Query query = method.makeQuery(joinField, bytesRefs);
  return new SolrConstantScoreQuery(new QueryWrapperFilter(query));
}
项目:BioSolr    文件:XJoinQParserPlugin.java   
@Override
@SuppressWarnings("unchecked")
public Query parse() throws SyntaxError {
  Method method = Method.valueOf(localParams.get(METHOD, Method.termsFilter.name()));
  JoinSpec<T> js = JoinSpec.parse(localParams.get(QueryParsing.V));
  Iterator<T> it = js.iterator(this);
  if (joinField == null) {
    throw new Exception("No XJoin component referenced by query");
  }
  FieldType ft = req.getSchema().getFieldTypeNoEx(joinField);
  Iterator<BytesRef> bytesRefs = new TransformIterator(it, transformer(ft));
  if (! bytesRefs.hasNext()) {
    return new BooleanQuery.Builder().build(); // matches nothing
  }
  Query query = method.makeQuery(joinField, bytesRefs);
  return new SolrConstantScoreQuery(new QueryWrapperFilter(query));
}
项目:BioSolr    文件:XJoinQParserPlugin.java   
@Override
@SuppressWarnings("unchecked")
public Query parse() throws SyntaxError {
  Method method = Method.valueOf(localParams.get(METHOD, Method.termsFilter.name()));
  JoinSpec<T> js = JoinSpec.parse(localParams.get(QueryParsing.V));
  Iterator<T> it = js.iterator(this);
  if (joinField == null) {
    throw new Exception("No XJoin component referenced by query");
  }
  FieldType ft = req.getSchema().getFieldTypeNoEx(joinField);
  Iterator<BytesRef> bytesRefs = new TransformIterator(it, transformer(ft));
  if (! bytesRefs.hasNext()) {
    return new BooleanQuery(); // matches nothing
  }
  return new SolrConstantScoreQuery(method.makeFilter(joinField, bytesRefs));
}
项目:imcms    文件:Utility.java   
public Set entrySet() {
    return new AbstractSet() {
        public int size() {
            return array.length;
        }

        public Iterator iterator() {
            return new TransformIterator(new ObjectArrayIterator(array), transformer);
        }
    };
}
项目:param-sweeper    文件:IntegerSequenceSweep.java   
@SuppressWarnings("unchecked")
@Override
public Iterator<Configuration> iterator() {
    TransformIterator it = new TransformIterator(
            new IntegerSequenceIterator(), new ConfigurationTranformer(
            param));

    return it;
}
项目:param-sweeper    文件:DoubleSequenceSweep.java   
@SuppressWarnings("unchecked")
@Override
public Iterator<Configuration> iterator() {
    TransformIterator it = new TransformIterator(
            new DoubleSequenceIterator(),
            new ConfigurationTranformer(param));

    return it;
}
项目:param-sweeper    文件:ListSweep.java   
@SuppressWarnings("unchecked")
@Override
public Iterator<Configuration> iterator() {
    TransformIterator tIt = new TransformIterator(values.iterator(),
            new ConfigurationTranformer(param));
    return tIt;
}
项目:param-sweeper    文件:SingleValueSweep.java   
@SuppressWarnings("unchecked")
@Override
public Iterator<Configuration> iterator() {
    SingletonIterator it = new SingletonIterator(value, false);
    TransformIterator itConfig = new TransformIterator(it,
            new ConfigurationTranformer(param));

    return itConfig;
}
项目:orbeon-forms    文件:MemoryCacheImpl.java   
public Iterator<CacheKey> iterateCacheKeys() {
    return new TransformIterator(linkedList.iterator(), new Transformer() {
        public Object transform(Object o) {
            return ((CacheEntry) o).key;
        }
    });
}
项目:orbeon-forms    文件:MemoryCacheImpl.java   
public Iterator<Object> iterateCacheObjects() {
    return new TransformIterator(linkedList.iterator(), new Transformer() {
        public Object transform(Object o) {
            return ((CacheEntry) o).cacheable;
        }
    });
}
项目:playweb    文件:Iterators.java   
/**
 * Returns an iterator with elements of an original  <code>iterator</code> transformed by
 * a <code>transformer</code>.
 *
 * @param <T>
 * @param <R>
 * @param <S>
 * @param iterator
 * @param transformer
 * @return
 */
@SuppressWarnings("unchecked")
public static <T, R, S extends T> Iterator<R> transformIterator(Iterator<? extends T> iterator,
        final Transformer<S, ? super R> transformer) {

    return new TransformIterator(iterator, new org.apache.commons.collections.Transformer() {
        public Object transform(Object input) {
            return transformer.transform((S) input);
        }
    });
}