Java 类org.apache.commons.collections15.TransformerUtils 实例源码

项目:netTransformer    文件:MyGraphMLWriter.java   
/**
 * 
 */
@SuppressWarnings("unchecked")
public MyGraphMLWriter()
{
    vertex_ids = new Transformer<V,String>()
    { 
        public String transform(V v) 
        { 
            return v.toString(); 
        }
    };
    edge_ids = TransformerUtils.nullTransformer();
    graph_data = Collections.emptyMap();
       vertex_data = Collections.emptyMap();
       edge_data = Collections.emptyMap();
       vertex_desc = TransformerUtils.nullTransformer();
       edge_desc = TransformerUtils.nullTransformer();
       graph_desc = TransformerUtils.nullTransformer();
       nest_level = 0;
}
项目:BfROpenLab    文件:GraphMLWriter.java   
/**
 * 
 */
@SuppressWarnings("unchecked")
public GraphMLWriter() 
{
    vertex_ids = new Transformer<V,String>()
    { 
        public String transform(V v) 
        { 
            return v.toString(); 
        }
    };
    edge_ids = TransformerUtils.nullTransformer();
    graph_data = Collections.emptyMap();
       vertex_data = Collections.emptyMap();
       edge_data = Collections.emptyMap();
       vertex_desc = TransformerUtils.nullTransformer();
       edge_desc = TransformerUtils.nullTransformer();
       graph_desc = TransformerUtils.nullTransformer();
       nest_level = 0;
}
项目:kidneyExchange    文件:APSPSeparator.java   
private Transformer<E,Double> inverseEdgeWeights() {
    Map<E,Double> ans = new HashMap<E,Double>();
    for(E edge: this.nonZeroEdgeWeights.keySet()){
        if(nonZeroEdgeWeights.get(edge).doubleValue() > CplexUtil.epsilon){
            ans.put(edge, Math.max(1-nonZeroEdgeWeights.get(edge),0));
        }           
    }           
    return TransformerUtils.switchTransformer(edgeIsNonZero, 
            TransformerUtils.mapTransformer(ans), 
            TransformerUtils.constantTransformer(Double.valueOf(1.0)));
}
项目:kidneyExchange    文件:APSPPreProcessor.java   
public APSPPreProcessor(KepInstance<V, E> kepInstance,
        Optional<FixedThreadPool> threadPool) {
    this.kepInstance = kepInstance;
    System.out.println("Starting all pairs shortest path");
    long time = System.currentTimeMillis();
    allPairsShortestPath = new ParallelFloydWarshallJung<V, E>(
            kepInstance.getGraph(),
            TransformerUtils.<Integer> constantTransformer(Integer
                    .valueOf(1)), threadPool);
    allPairsShortestPath.solve();
    long elapsed = System.currentTimeMillis() - time;
    System.out
            .println("Finished all pairs shortest path, elapsed time ms: "
                    + elapsed);
    minDistToAnyRoot = Maps.newHashMap();
    for (V vertex : kepInstance.getGraph().getVertices()) {

        if (kepInstance.getRootNodes().contains(vertex)) {
            minDistToAnyRoot.put(vertex, 0.0);
        } else {
            double bestDist = Double.POSITIVE_INFINITY;
            for (V root : kepInstance.getRootNodes()) {
                bestDist = Math.min(bestDist, allPairsShortestPath
                        .getShortestPathLength(root, vertex));
            }
            minDistToAnyRoot.put(vertex, bestDist);
        }
    }
}
项目:VarJ    文件:TestTransformedSortedMap.java   
public Map makeEmptyMap() {
    return TransformedSortedMap.decorate(new TreeMap(), TransformerUtils.nopTransformer(), TransformerUtils.nopTransformer());
}
项目:VarJ    文件:TestTransformedMap.java   
public Map makeEmptyMap() {
    return TransformedMap.decorate(new HashMap(), TransformerUtils.nopTransformer(), TransformerUtils.nopTransformer());
}