• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CollectionUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.collections15.CollectionUtils的典型用法代码示例。如果您正苦于以下问题:Java CollectionUtils类的具体用法?Java CollectionUtils怎么用?Java CollectionUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CollectionUtils类属于org.apache.commons.collections15包,在下文中一共展示了CollectionUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: debug

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
/**
 * Return a string representation of this CatalogType handle
 * 
 * @param catalog_item
 * @return
 */
public static String debug(CatalogType catalog_item) {
    Map<String, Object> m = new ListOrderedMap<String, Object>();
    for (String field : CollectionUtils.union(catalog_item.getFields(), catalog_item.getChildFields())) {
        String val_str = null;
        if (catalog_item.getChildFields().contains(field)) {
            val_str = CatalogUtil.debug(catalog_item.getChildren(field));
        } else {
            Object val = catalog_item.getField(field);
            if (val != null) {
                val_str = val.toString();
            } else {
                val_str = "null";
            }
        }
        m.put(field, val_str);
    } // FOR
    return (catalog_item.fullName() + "\n" + StringUtil.formatMaps(m));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:25,代码来源:CatalogUtil.java


示例2: generateTableData

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
/**
 * Load the tuples for the given table name
 * @param tableName
 */
protected void generateTableData(String tableName) {
    LOG.info("*** START " + tableName);
    final AbstractTableGenerator generator = this.generators.get(tableName);
    assert (generator != null);

    // Generate Data
    final VoltTable volt_table = generator.getVoltTable();
    while (generator.hasMore()) {
        generator.generateBatch();
        this.loadVoltTable(generator.getTableName(), volt_table);
        volt_table.clearRowData();
    } // WHILE
    
    // Mark as finished
    generator.markAsFinished();
    this.finished.add(tableName);
    LOG.info(String.format("*** FINISH %s - %d tuples - [%d / %d]", tableName, this.getTableTupleCount(tableName), this.finished.size(), this.generators.size()));
    if (debug.val) {
        LOG.debug("Remaining Tables: " + CollectionUtils.subtract(this.generators.keySet(), this.finished));
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:26,代码来源:AuctionMarkLoader.java


示例3: addComposited

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
/**
 * Add an additional Map to the composite.
 *
 * @param map the Map to be added to the composite
 * @throws IllegalArgumentException if there is a key collision and there is no
 *                                  MapMutator set to handle it.
 */
public synchronized void addComposited(Map<? extends K, ? extends V> map) throws IllegalArgumentException {
    for (int i = composite.length - 1; i >= 0; --i) {
        Collection<K> intersect = (Collection<K>) CollectionUtils.intersection(this.composite[i].keySet(), map.keySet());
        if (intersect.size() != 0) {
            if (this.mutator == null) {
                throw new IllegalArgumentException("Key collision adding Map to CompositeMap");
            } else {
                this.mutator.resolveCollision(this, this.composite[i], map, intersect);
            }
        }
    }
    Map[] temp = new Map[this.composite.length + 1];
    System.arraycopy(this.composite, 0, temp, 0, this.composite.length);
    temp[temp.length - 1] = map;
    this.composite = temp;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:24,代码来源:CompositeMap.java


示例4: addComposited

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
/**
 * Add a Set to this composite
 *
 * @param c Must implement Set
 * @throws IllegalArgumentException      if c does not implement java.util.Set
 *                                       or if a SetMutator is set, but fails to resolve a collision
 * @throws UnsupportedOperationException if there is no SetMutator set, or
 *                                       a CollectionMutator is set instead of a SetMutator
 * @see org.apache.commons.collections15.collection.CompositeCollection.CollectionMutator
 * @see SetMutator
 */
public synchronized void addComposited(Collection<? extends E> c) {
    if (!(c instanceof Set)) {
        throw new IllegalArgumentException("Collections added must implement java.util.Set");
    }

    for (Iterator i = this.getCollections().iterator(); i.hasNext();) {
        Set set = (Set) i.next();
        Collection intersects = CollectionUtils.intersection(set, c);
        if (intersects.size() > 0) {
            if (this.mutator == null) {
                throw new UnsupportedOperationException("Collision adding composited collection with no SetMutator set");
            } else if (!(this.mutator instanceof SetMutator)) {
                throw new UnsupportedOperationException("Collision adding composited collection to a CompositeSet with a CollectionMutator instead of a SetMutator");
            }
            ((SetMutator) this.mutator).resolveCollision(this, set, (Set) c, intersects);
            if (CollectionUtils.intersection(set, c).size() > 0) {
                throw new IllegalArgumentException("Attempt to add illegal entry unresolved by SetMutator.resolveCollision()");
            }
        }
    }
    super.addComposited((Collection<E>[]) new Collection[]{c});
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:34,代码来源:CompositeSet.java


示例5: find

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
public void find() {
		specs = new LinkedHashSet<SubstitutionSubtreeSpecification>();

		Set<ExtendedNode> textTreeNodes = AbstractNodeUtils.treeToLinkedHashSet(textTree.getTree());
		CollectionUtils.filter(textTreeNodes, textNodePredicate);
		if (textTreeNodes.isEmpty()) return;

		Set<ExtendedNode> hypothesisTreeNodes = AbstractNodeUtils.treeToLinkedHashSet(hypothesisTree.getTree());
		CollectionUtils.filter(hypothesisTreeNodes, hypothesisNodePredicate);
		if (hypothesisTreeNodes.isEmpty()) return;

		for (ExtendedNode textNode: textTreeNodes)	{
			for (ExtendedNode hypothesisNode: hypothesisTreeNodes)	{
				specs.add(new SubstitutionSubtreeSpecification(
					description, textNode, hypothesisNode));
			}
		}
}
 
开发者ID:hltfbk,项目名称:Excitement-TDMLEDA,代码行数:19,代码来源:SubstitutionSubtreeFinder.java


示例6: equals

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
public boolean equals(Object o)
{
if (this == o)
	{
	return true;
	}
if (o == null || getClass() != o.getClass())
	{
	return false;
	}

ImmutableSortedSetHierarchyNode<T> that = (ImmutableSortedSetHierarchyNode<T>) o;

if (!CollectionUtils.isEqualCollection(children, that.children))
	{
	return false;
	}
if (contents != null ? !contents.equals(that.contents) : that.contents != null)
	{
	return false;
	}
if (parent != null ? !parent.equals(that.parent) : that.parent != null)
	{
	return false;
	}

return true;
}
 
开发者ID:davidsoergel,项目名称:trees,代码行数:29,代码来源:ImmutableSortedSetHierarchyNode.java


示例7: getCounts

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
/**
    * Returns an array whose ith element (for i in [1,16]) is the number of 
    * occurrences of the corresponding triad type in <code>g</code>.
    * (The 0th element is not meaningful; this array is effectively 1-based.)
 * 
 * @param g
 */
   public static <V,E> long[] getCounts(DirectedGraph<V,E> g) {
       long[] count = new long[MAX_TRIADS];

       List<V> id = new ArrayList<V>(g.getVertices());

	// apply algorithm to each edge, one at at time
	for (int i_v = 0; i_v < g.getVertexCount(); i_v++) {
		V v = id.get(i_v);
		for(V u : g.getNeighbors(v)) {
			int triType = -1;
			if (id.indexOf(u) <= i_v)
				continue;
			Set<V> neighbors = new HashSet<V>(CollectionUtils.union(g.getNeighbors(u), g.getNeighbors(v)));
			neighbors.remove(u);
			neighbors.remove(v);
			if (g.isSuccessor(v,u) && g.isSuccessor(u,v)) {
				triType = 3;
			} else {
				triType = 2;
			}
			count[triType] += g.getVertexCount() - neighbors.size() - 2;
			for (V w : neighbors) {
				if (shouldCount(g, id, u, v, w)) {
					count [ triType ( triCode(g, u, v, w) ) ] ++;
				}
			}
		}
	}
	int sum = 0;
	for (int i = 2; i <= 16; i++) {
		sum += count[i];
	}
	int n = g.getVertexCount();
	count[1] = n * (n-1) * (n-2) / 6 - sum;
	return count;		
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:44,代码来源:TriadicCensus.java


示例8: transform

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
public VertexPartition<V,E> transform(Graph<V,E> g) 
{
    Set<Pair<V>> vertex_pairs = getEquivalentPairs(g);
    
    Set<Set<V>> rv = new HashSet<Set<V>>();
       Map<V, Set<V>> intermediate = new HashMap<V, Set<V>>();
       for (Pair<V> p : vertex_pairs)
       {
           Set<V> res = intermediate.get(p.getFirst());
           if (res == null)
               res = intermediate.get(p.getSecond());
           if (res == null)  // we haven't seen this one before
               res = new HashSet<V>();
           res.add(p.getFirst());
           res.add(p.getSecond());
           intermediate.put(p.getFirst(), res);
           intermediate.put(p.getSecond(), res);
       }
       rv.addAll(intermediate.values());

       // pick up the vertices which don't appear in intermediate; they are
       // singletons (equivalence classes of size 1)
       Collection<V> singletons = CollectionUtils.subtract(g.getVertices(),
               intermediate.keySet());
       for (V v : singletons)
       {
           Set<V> v_set = Collections.singleton(v);
           intermediate.put(v, v_set);
           rv.add(v_set);
       }

       return new VertexPartition<V, E>(g, intermediate, rv);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:34,代码来源:StructurallyEquivalent.java


示例9: getChildEdges

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
/**
 * @see edu.uci.ics.jung.graph.Tree#getChildEdges(java.lang.Object)
 */
public Collection<E> getChildEdges(V vertex) 
{
    if (!containsVertex(vertex)) 
    	return null;
    List<E> edges = vertex_data.get(vertex).child_edges;
    return edges == null ? Collections.<E>emptySet() : 
        CollectionUtils.unmodifiableCollection(edges);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:12,代码来源:OrderedKAryTree.java


示例10: getChildren

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
/**
 * Returns an ordered list of {@code vertex}'s child vertices.
 * If there is no child in position i, then the list will contain
 * {@code null} in position i.  If {@code vertex} has no children
 * then the empty set will be returned.
 * @see edu.uci.ics.jung.graph.Tree#getChildren(java.lang.Object)
 */
public Collection<V> getChildren(V vertex) 
{
    if (!containsVertex(vertex)) 
        return null;
    List<E> edges = vertex_data.get(vertex).child_edges;
    if (edges == null)
    	return Collections.emptySet();
    Collection<V> children = new ArrayList<V>(order);
    for (E edge : edges)
        children.add(this.getOpposite(vertex, edge));
    return CollectionUtils.unmodifiableCollection(children);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:20,代码来源:OrderedKAryTree.java


示例11: removeRedundantEdges

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
private void removeRedundantEdges(Graph graph, final Set<Long> substitutionsMade) {
    CollectionUtils.filter(graph.getGraphEdges(), new Predicate<GraphEdge>() {
        public boolean evaluate(GraphEdge graphEdge) {
            return !(substitutionsMade.contains(graphEdge.getSource()) && substitutionsMade.contains(graphEdge.getTarget()));
        }
    });
}
 
开发者ID:ISA-tools,项目名称:Automacron,代码行数:8,代码来源:CompressedGraphMLCreator.java


示例12: removeRedundantNodes

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
private Map<Macro, Collection<Set<Long>>> removeRedundantNodes(Graph graph, final Set<Long> substitutionsMade) {

        // this is a variable which indicates that a macro can be inserted. It cannot be inserted when one of it's node ids has
        // already been removed.
        Map<Macro, Collection<Set<Long>>> canBeSubstituted = new HashMap<Macro, Collection<Set<Long>>>();

        for (final Macro macro : macrosToBeSubstitutedIn) {

            final Set<Set<Long>> nodeIDsToSubstitute = macro.getNodeIdsInMacro();

            for (Set<Long> macroIds : nodeIDsToSubstitute) {
                if (!CollectionUtils.containsAny(macroIds, substitutionsMade)) {

                    if (CollectionUtils.isSubCollection(macroIds, graph.getNodeIdsToNode().keySet())) {

                        if (!canBeSubstituted.containsKey(macro)) {
                            canBeSubstituted.put(macro, new ArrayList<Set<Long>>());
                        }
                        canBeSubstituted.get(macro).add(macroIds);

                        substitutionsMade.addAll(macroIds);

                        graph.removeNodesFromGraph(macroIds);
                    }

                }
            }
            System.out.println("Graph node size is now " + graph.getGraphNodes().size());
        }

        return canBeSubstituted;
    }
 
开发者ID:ISA-tools,项目名称:Automacron,代码行数:33,代码来源:CompressedGraphMLCreator.java


示例13: equals

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
@Override
public boolean equals(Object obj){
	ExplanationGraph eg ;
	if (obj instanceof ExplanationGraph){
		eg = (ExplanationGraph) obj;
	} else { 
		return false;
	}
	if (!CollectionUtils.isEqualCollection(eg.getVertices(), this.getVertices())) return false;
	if (!CollectionUtils.isEqualCollection(eg.getEdges(), this.getEdges())) return false;
	return true;
}
 
开发者ID:Angerona,项目名称:angerona-framework,代码行数:13,代码来源:ExplanationGraph.java


示例14: removeUnusedFields

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
/**
 * Removes the unused fields.
 * 
 * @param classNode
 *          the class node
 */
public static void removeUnusedFields(final ClassNode classNode) {
  final Set<FieldNode> usedFields = new HashSet<>();
  collectUsedFields(classNode, usedFields);
  final Collection<FieldNode> unusedFields = CollectionUtils.subtract(classNode.fields, usedFields);
  classNode.fields.removeAll(unusedFields);
  correctConstructors(classNode);
}
 
开发者ID:tookar,项目名称:jBOP,代码行数:14,代码来源:RemoveUnusedFields.java


示例15: hasTupleConflict

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
/**
 * Returns true if there is a conflict between the two transactions for the
 * given list of tableIds based on their tracking sets.
 * @param partition
 * @param tableIds
 * @param ts0
 * @param tsTracking0
 * @param ts1
 * @param tsTracking1
 * @return
 */
protected boolean hasTupleConflict(int partition, int tableIds[],
                                   AbstractTransaction ts0, VoltTable tsTracking0,
                                   AbstractTransaction ts1, VoltTable tsTracking1) {
    
    // Check whether the first transaction accessed the same tuple by the second txn
    Set<Integer> tupleIds0 = new HashSet<Integer>();
    Set<Integer> tupleIds1 = new HashSet<Integer>();
    
    if (trace.val)
        LOG.trace("\n"+
                  StringUtil.columns(ts0+"\n"+VoltTableUtil.format(tsTracking0),
                                     ts1+"\n"+VoltTableUtil.format(tsTracking1)));
    
    for (int tableId : tableIds) {
        Table targetTbl = catalogContext.getTableById(tableId);
        
        // Skip if we know that the other transaction hasn't done anything
        // to the table at this partition.
        if (ts0.isTableReadOrWritten(partition, targetTbl) == false) {
            continue;
        }
        
        tupleIds0.clear();
        this.getTupleIds(targetTbl.getName(), tsTracking0, tupleIds0);
        tupleIds1.clear();
        this.getTupleIds(targetTbl.getName(), tsTracking1, tupleIds1);
        
        if (debug.val) {
            Map<String, Object> m = new LinkedHashMap<String, Object>();
            m.put(targetTbl.getName() + " TRACKING SETS", null);
            m.put(ts0.toString(), tupleIds0);
            m.put(ts1.toString(), tupleIds1);
            LOG.debug(StringUtil.formatMaps(m));
        }
        
        if (CollectionUtils.containsAny(tupleIds0, tupleIds1)) {
            if (debug.val)
                LOG.debug(String.format("Found conflict in %s between %s and %s",
                          targetTbl, ts0, ts1));
            return (true);
        }
        
    } // FOR
    return (false);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:57,代码来源:OptimisticConflictChecker.java


示例16: getWritePartitions

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
@Override
public PartitionSet getWritePartitions(EstimationThresholds t) {
    return new PartitionSet(CollectionUtils.subtract(this.partitions, this.readonly));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:5,代码来源:AbstractFixedEstimator.java


示例17: checkWriteWriteConflict

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
/**
     * Calculate whether two Procedures have WRITE-WRITE conflicts
     * @param proc0
     * @param proc1
     * @return
     * @throws Exception
     */
    protected Collection<Conflict> checkWriteWriteConflict(Procedure proc0, Procedure proc1) throws Exception {
        ProcedureInfo pInfo0 = this.procedures.get(proc0);
        assert(pInfo0 != null);
        ProcedureInfo pInfo1 = this.procedures.get(proc1);
        assert(pInfo1 != null);
        Set<Conflict> conflicts = new HashSet<Conflict>();
        
        // Write-Write Conflicts
        // Any INSERT or DELETE is always a conflict
        // For UPDATE, we will check whether their columns intersect
        for (Statement stmt0 : pInfo0.writeQueries) {
            if (this.ignoredStatements.contains(stmt0)) continue;
            Collection<Table> tables0 = CatalogUtil.getReferencedTables(stmt0);
            QueryType type0 = QueryType.get(stmt0.getQuerytype());
            Collection<Column> cols0 = CatalogUtil.getReferencedColumns(stmt0);
            boolean alwaysConflicting0 = this.alwaysWriteConflicting(stmt0, type0, tables0, cols0);
            
            for (Statement stmt1 : pInfo1.writeQueries) {
                if (this.ignoredStatements.contains(stmt1)) continue;
                Collection<Table> tables1 = CatalogUtil.getReferencedTables(stmt1);
                QueryType type1 = QueryType.get(stmt1.getQuerytype());
                Collection<Column> cols1 = CatalogUtil.getReferencedColumns(stmt1);
                boolean alwaysConflicting1 = this.alwaysWriteConflicting(stmt1, type1, tables1, cols1);
                
                Collection<Table> intersectTables = CollectionUtils.intersection(tables0, tables1);
                if (debug.val)
                    LOG.debug(String.format("WW %s <-> %s - Intersection Tables %s",
                              stmt0.fullName(), stmt1.fullName(), intersectTables));
                if (intersectTables.isEmpty()) continue;
                
                // If both queries are INSERTs, then this is always a conflict since
                // there might be a global constraint... 
                if (type0 == QueryType.INSERT && type1 == QueryType.INSERT) {
                    // 2013-07-24
                    // This fails for John's INSERT INTO...SELECT queries.
                    // We need to decide whether we should have a new query type or not...
//                    assert(intersectTables.size() == 1) :
//                        String.format("There are %d intersection tables when we expected only 1: %s <-> %s",
//                                      intersectTables.size(), stmt0.fullName(), stmt1.fullName());
                    alwaysConflicting1 = true;
                }
                    
                Collection<Column> intersectColumns = CollectionUtils.intersection(cols0, cols1);
                if (debug.val)
                    LOG.debug(String.format("WW %s <-> %s - Intersection Columns %s",
                              stmt0.fullName(), stmt1.fullName(), intersectColumns));
                if (alwaysConflicting0 == false && alwaysConflicting1 == false && intersectColumns.isEmpty()) continue;
                Conflict c = new Conflict(stmt0, stmt1, intersectTables, (alwaysConflicting0 || alwaysConflicting1));
                conflicts.add(c);
            } // FOR (proc1)
        } // FOR (proc0)
        return (conflicts);
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:61,代码来源:ConflictSetCalculator.java


示例18: getConstructor

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
/**
 * Grab the constructor for the given target class with the provided input parameters.
 * This method will first try to find an exact match for the parameters, and if that
 * fails then it will be smart and try to find one with the input parameters super classes. 
 * @param <T>
 * @param target_class
 * @param params
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> Constructor<T> getConstructor(Class<T> target_class, Class<?>... params) {
    NoSuchMethodException error = null;
    try {
        return (target_class.getConstructor(params));
    } catch (NoSuchMethodException ex) {
        // The first time we get this it can be ignored
        // We'll try to be nice and find a match for them
        error = ex;
    }
    assert (error != null);

    if (debug.val) {
        LOG.debug("TARGET CLASS:  " + target_class);
        LOG.debug("TARGET PARAMS: " + Arrays.toString(params));
    }

    final int num_params = (params != null ? params.length : 0);
    List<Class<?>> paramSuper[] = (List<Class<?>>[]) new List[num_params];
    for (int i = 0; i < num_params; i++) {
        paramSuper[i] = ClassUtil.getSuperClasses(params[i]);
        if (debug.val)
            LOG.debug("  SUPER[" + params[i].getSimpleName() + "] => " + paramSuper[i]);
    } // FOR

    for (Constructor<?> c : target_class.getConstructors()) {
        Class<?> cTypes[] = c.getParameterTypes();
        if (debug.val) {
            LOG.debug("CANDIDATE: " + c);
            LOG.debug("CANDIDATE PARAMS: " + Arrays.toString(cTypes));
        }
        if (params.length != cTypes.length)
            continue;

        for (int i = 0; i < num_params; i++) {
            List<Class<?>> cSuper = ClassUtil.getSuperClasses(cTypes[i]);
            if (debug.val)
                LOG.debug("  SUPER[" + cTypes[i].getSimpleName() + "] => " + cSuper);
            if (CollectionUtils.intersection(paramSuper[i], cSuper).isEmpty() == false) {
                return ((Constructor<T>) c);
            }
        } // FOR (param)
    } // FOR (constructors)
    throw new RuntimeException("Failed to retrieve constructor for " + target_class.getSimpleName(), error);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:55,代码来源:ClassUtil.java


示例19: getConstructor

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
/**
 * 
 * @param <T>
 * @param target_class
 * @param params
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> Constructor<T> getConstructor(Class<T> target_class, Class<?>...params) {
    NoSuchMethodException error = null;
    try {
        return (target_class.getConstructor(params));
    } catch (NoSuchMethodException ex) {
        // The first time we get this it can be ignored
        // We'll try to be nice and find a match for them
        error = ex;
    }
    assert(error != null);
    
    if (LOG.isDebugEnabled()) {
        LOG.debug("TARGET CLASS:  " + target_class);
        LOG.debug("TARGET PARAMS: " + Arrays.toString(params));
    }
    
    List<Class<?>> paramSuper[] = (List<Class<?>>[])new List[params.length]; 
    for (int i = 0; i < params.length; i++) {
        paramSuper[i] = ClassUtil.getSuperClasses(params[i]);
        if (LOG.isDebugEnabled()) LOG.debug("  SUPER[" + params[i].getSimpleName() + "] => " + paramSuper[i]);
    } // FOR
    
    for (Constructor<?> c : target_class.getConstructors()) {
        Class<?> cTypes[] = c.getParameterTypes();
        if (LOG.isDebugEnabled()) {
            LOG.debug("CANDIDATE: " + c);
            LOG.debug("CANDIDATE PARAMS: " + Arrays.toString(cTypes));
        }
        if (params.length != cTypes.length) continue;
        
        for (int i = 0; i < params.length; i++) {
            List<Class<?>> cSuper = ClassUtil.getSuperClasses(cTypes[i]);
            if (LOG.isDebugEnabled()) LOG.debug("  SUPER[" + cTypes[i].getSimpleName() + "] => " + cSuper);
            if (CollectionUtils.intersection(paramSuper[i], cSuper).isEmpty() == false) {
                return ((Constructor<T>)c);
            }
        } // FOR (param)
    } // FOR (constructors)
    throw new RuntimeException("Failed to retrieve constructor for " + target_class.getSimpleName(), error);
}
 
开发者ID:faclc4,项目名称:HTAPBench,代码行数:49,代码来源:ClassUtil.java


示例20: getEdges

import org.apache.commons.collections15.CollectionUtils; //导入依赖的package包/类
/**
 * @see edu.uci.ics.jung.graph.Hypergraph#getEdges()
 */
public Collection<E> getEdges() 
{
	return CollectionUtils.unmodifiableCollection(edge_vpairs.keySet());
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:8,代码来源:OrderedKAryTree.java



注:本文中的org.apache.commons.collections15.CollectionUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ICompletionListener类代码示例发布时间:2022-05-21
下一篇:
Java Range类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap