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

项目:AvatarMQ    文件:ConsumerContext.java   
public static int getClustersStat(String clusters) {

        Predicate predicate = new Predicate() {
            public boolean evaluate(Object object) {
                String clustersId = ((ClustersState) object).getClusters();
                return clustersId.compareTo(clusters) == 0;
            }
        };

        Iterator iterator = new FilterIterator(stateArray.iterator(), predicate);

        ClustersState state = null;
        while (iterator.hasNext()) {
            state = (ClustersState) iterator.next();
            break;

        }
        return (state != null) ? state.getState() : 0;
    }
项目:AvatarMQ    文件:ConsumerContext.java   
public static ConsumerClusters selectByClusters(String clusters) {
    Predicate predicate = new Predicate() {
        public boolean evaluate(Object object) {
            String id = ((ClustersRelation) object).getId();
            return id.compareTo(clusters) == 0;
        }
    };

    Iterator iterator = new FilterIterator(relationArray.iterator(), predicate);

    ClustersRelation relation = null;
    while (iterator.hasNext()) {
        relation = (ClustersRelation) iterator.next();
        break;
    }

    return (relation != null) ? relation.getClusters() : null;
}
项目:feathers-sdk    文件:MxmlDocument.java   
/**
 * return an iterator over visual children that haven't been marked described.
 */
// TODO visual children are marked described by the descriptor
//      generator, so there is some order-of-codegen sensitivity
//      here. It's the only such dependency, but at some point
//      descriptor codegen and marking-of-isDescribed should be
//      split apart.
public final Iterator getProceduralVisualChildInitializerIterator()
{
    if (root instanceof MovieClip)
    {
        return new FilterIterator(((MovieClip)root).getChildInitializerIterator(), new Predicate()
        {
            public boolean evaluate(Object object)
            {
                ValueInitializer init = (ValueInitializer)object;
                Object value = init.getValue();
                return !(value instanceof Model) || (!((Model)value).isDescribed() && !((Model)value).isStateSpecific());
            }
        });
    }
    else
    {
        return Collections.EMPTY_LIST.iterator();
    }
}
项目:feathers-sdk    文件:Array.java   
/**
 * Note that we do *not* filter out bindings for element initializers.
 */
@SuppressWarnings("unchecked")
public final Iterator<ArrayElementInitializer> getElementInitializerIterator()
{
    return new FilterIterator(list.iterator(), new Predicate()
       {
           public boolean evaluate(Object object)
           {
               return (! (((ArrayElementInitializer) object).getValue() instanceof Reparent));
           }
       });
}
项目:feathers-sdk    文件:MxmlDocument.java   
/**
 * NOTE: suppress declaration of inherited properties
 */
public final Iterator<PropertyDeclaration> getDeclarationIterator()
{
    final Type superType = getSuperClass();

    return new FilterIterator(declarations.values().iterator(), new Predicate()
    {
        public boolean evaluate(Object object)
        {
            return superType.getProperty(((PropertyDeclaration)object).getName()) == null;
        }
    });
}
项目:feathers-sdk    文件:MxmlDocument.java   
/**
 *
 */
private final Iterator<PropertyDeclaration> getTopLevelDeclarationIterator()
{
    return new FilterIterator(declarations.values().iterator(), new Predicate()
    {
        public boolean evaluate(Object object)
        {
            return ((PropertyDeclaration)object).getTopLevel();
        }
    });
}
项目:feathers-sdk    文件:MxmlDocument.java   
/**
 *
 */
public final Iterator<Initializer> getNonStagePropertyInitializerIterator()
{
    return new FilterIterator(new IteratorChain(root.getPropertyInitializerIterator(false),
            getTopLevelInitializerIterator()), new Predicate()
    {
        public boolean evaluate(Object object)
        {
            if (object instanceof NamedInitializer)
                return (!StandardDefs.isStageProperty(((NamedInitializer)object).getName())) &&
                          (!((NamedInitializer)object).isDesignLayer());
            return true;
        }
    });
}
项目:feathers-sdk    文件:MxmlDocument.java   
/**
 *
 */
public final Iterator<Initializer> getDesignLayerPropertyInitializerIterator()
{
 return new FilterIterator(layerDeclarations.iterator(), new Predicate()
    {
        public boolean evaluate(Object object)
        {
            return object instanceof InitializedPropertyDeclaration;
        }
    });
}
项目:feathers-sdk    文件:MxmlDocument.java   
/**
 *
 */
public final Iterator<Initializer> getStagePropertyInitializerIterator()
{
    return new FilterIterator(new IteratorChain(root.getPropertyInitializerIterator(false),
            getTopLevelInitializerIterator()), new Predicate()
    {
        public boolean evaluate(Object object)
        {
            if (object instanceof NamedInitializer)
                return StandardDefs.isStageProperty(((NamedInitializer)object).getName());
            return false;
        }
    });
}
项目:feathers-sdk    文件:MxmlDocument.java   
/**
    *
    */
public final Iterator<Initializer> getTopLevelInitializerIterator()
   {
       return new FilterIterator(getTopLevelDeclarationIterator(), new Predicate()
       {
           public boolean evaluate(Object object)
           {
               return object instanceof InitializedPropertyDeclaration;
           }
       });
   }
项目:feathers-sdk    文件:Model.java   
/**
 *
 */
@SuppressWarnings("unchecked")
protected Iterator<Initializer> bindingFilter(Iterator<? extends Initializer> iter, final boolean include)
{
    return new FilterIterator(iter, new Predicate()
    {
        public boolean evaluate(Object object)
        {
            return (((Initializer) object).isBinding()) == include;
        }
    });
}
项目:OLE-INST    文件:FilteringBalanceIteratorImpl.java   
/**
 * Creates the FilterIterator that underlies this Iterator
 */
protected void initialize() {
    if (!initialized) {
        filteredBalances = new FilterIterator(balancesSource, new Predicate() {
            public boolean evaluate(Object obj) {
                return balancePredicate.select((Balance) obj);
            }
        });
        initialized = true;
    }
}
项目:kfs    文件:FilteringBalanceIteratorImpl.java   
/**
 * Creates the FilterIterator that underlies this Iterator
 */
protected void initialize() {
    if (!initialized) {
        filteredBalances = new FilterIterator(balancesSource, new Predicate() {
            public boolean evaluate(Object obj) {
                return balancePredicate.select((Balance) obj);
            }
        });
        initialized = true;
    }
}
项目:playweb    文件:Iterators.java   
/**
 * Returns an iterator with elements from an original <code>iterator</code> where the
 * given <code>predicate</code> matches removed.
 *
 * @param <T>
 * @param iterator
 * @param predicate
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> Iterator<T> filterIterator(Iterator<? extends T> iterator,
        final Predicate<? super T> predicate) {

    return new FilterIterator(iterator, new org.apache.commons.collections.Predicate() {
        public boolean evaluate(Object object) {
            return predicate.evaluate((T) object);
        }
    });
}