Java 类org.apache.commons.collections15.map.LazyMap 实例源码

项目:cuttlefish    文件:CircleLayout.java   
@Override
public void initAlgo() {
    if (graphModel == null) {
        throw new RuntimeException(
                "The GraphModel for this layout cannot be null!");
    }

    graph = graphModel.getGraphVisible();

    circleNodeDataMap = LazyMap.decorate(
            new HashMap<Node, CircleNodeData>(),
            new Factory<CircleNodeData>() {
                public CircleNodeData create() {
                    return new CircleNodeData();
                }
            });

    nodeOrderedList = new ArrayList<Node>();
    for (Node n : graph.getNodes())
        nodeOrderedList.add(n);

    if (LayoutLoader.VERBOSE_LAYOUT)
        Cuttlefish.debug(this, "Layout initialized.");
}
项目:BfROpenLab    文件:MinimumSpanningForest.java   
/**
 * Creates a minimum spanning forest from the supplied graph, populating the
 * supplied Forest, which must be empty. 
 * If the supplied root is null, or not present in the Graph,
 * then an arbitrary Graph vertex will be selected as the root.
 * If the Minimum Spanning Tree does not include all vertices of the
 * Graph, then a leftover vertex is selected as a root, and another
 * tree is created
 * @param graph the Graph to find MST in
 * @param forest the Forest to populate. Must be empty
 * @param root first Tree root, may be null
 */
@SuppressWarnings("unchecked")
public MinimumSpanningForest(Graph<V, E> graph, Forest<V,E> forest, 
        V root) {

    if(forest.getVertexCount() != 0) {
        throw new IllegalArgumentException("Supplied Forest must be empty");
    }
    this.graph = graph;
    this.forest = forest;
    this.weights = LazyMap.decorate(new HashMap<E,Double>(),
            new ConstantTransformer(1.0));
    Set<E> unfinishedEdges = new HashSet<E>(graph.getEdges());
    if(graph.getVertices().contains(root)) {
        this.forest.addVertex(root);
    }
    updateForest(forest.getVertices(), unfinishedEdges);
}
项目:ODL    文件:MinimumSpanningForest.java   
/**
 * Creates a minimum spanning forest from the supplied graph, populating the
 * supplied Forest, which must be empty. 
 * If the supplied root is null, or not present in the Graph,
 * then an arbitrary Graph vertex will be selected as the root.
 * If the Minimum Spanning Tree does not include all vertices of the
 * Graph, then a leftover vertex is selected as a root, and another
 * tree is created
 * @param graph the Graph to find MST in
 * @param forest the Forest to populate. Must be empty
 * @param root first Tree root, may be null
 */
@SuppressWarnings("unchecked")
public MinimumSpanningForest(Graph<V, E> graph, Forest<V,E> forest, 
        V root) {

    if(forest.getVertexCount() != 0) {
        throw new IllegalArgumentException("Supplied Forest must be empty");
    }
    this.graph = graph;
    this.forest = forest;
    this.weights = LazyMap.decorate(new HashMap<E,Double>(),
            new ConstantTransformer(1.0));
    Set<E> unfinishedEdges = new HashSet<E>(graph.getEdges());
    if(graph.getVertices().contains(root)) {
        this.forest.addVertex(root);
    }
    updateForest(forest.getVertices(), unfinishedEdges);
}
项目:BfROpenLab    文件:PersistentLayoutImpl.java   
/**
 * create an instance with a passed layout
 * create containers for graph components
 * @param layout 
 */
public PersistentLayoutImpl(Layout<V,E> layout) {
    super(layout);
    this.map = LazyMap.decorate(new HashMap<V,Point>(), new RandomPointFactory(getSize()));

    this.dontmove = new HashSet<V>();
}
项目:BfROpenLab    文件:AbstractLayout.java   
@SuppressWarnings("unchecked")
   protected AbstractLayout(Graph<V,E> graph, Transformer<V,Point2D> initializer) {
    this.graph = graph;
    Transformer<V, ? extends Object> chain = 
        ChainedTransformer.getInstance(initializer, CloneTransformer.getInstance());
    this.locations = LazyMap.decorate(new HashMap<V,Point2D>(), (Transformer<V,Point2D>)chain);
    initialized = true;
}
项目:BfROpenLab    文件:AbstractLayout.java   
@SuppressWarnings("unchecked")
   protected AbstractLayout(Graph<V,E> graph, Transformer<V,Point2D> initializer, Dimension size) {
    this.graph = graph;
    Transformer<V, ? extends Object> chain = 
        ChainedTransformer.getInstance(initializer, CloneTransformer.getInstance());
    this.locations = LazyMap.decorate(new HashMap<V,Point2D>(), (Transformer<V,Point2D>)chain);
    this.size = size;
}
项目:BfROpenLab    文件:AbstractLayout.java   
@SuppressWarnings("unchecked")
  public void setInitializer(Transformer<V,Point2D> initializer) {
    if(this.equals(initializer)) {
        throw new IllegalArgumentException("Layout cannot be initialized with itself");
    }
Transformer<V, ? extends Object> chain = 
    ChainedTransformer.getInstance(initializer, CloneTransformer.getInstance());
    this.locations = LazyMap.decorate(new HashMap<V,Point2D>(), (Transformer<V, Point2D>)chain);
    initialized = true;
  }
项目:ODL    文件:AbstractLayout.java   
@SuppressWarnings("unchecked")
   protected AbstractLayout(Graph<V,E> graph, Transformer<V,Point2D> initializer) {
    this.graph = graph;
    Transformer<V, ? extends Object> chain = 
        ChainedTransformer.getInstance(initializer, CloneTransformer.getInstance());
    this.locations = LazyMap.decorate(new HashMap<V,Point2D>(), (Transformer<V,Point2D>)chain);
    initialized = true;
}
项目:ODL    文件:AbstractLayout.java   
@SuppressWarnings("unchecked")
   protected AbstractLayout(Graph<V,E> graph, Transformer<V,Point2D> initializer, Dimension size) {
    this.graph = graph;
    Transformer<V, ? extends Object> chain = 
        ChainedTransformer.getInstance(initializer, CloneTransformer.getInstance());
    this.locations = LazyMap.decorate(new HashMap<V,Point2D>(), (Transformer<V,Point2D>)chain);
    this.size = size;
}
项目:ODL    文件:AbstractLayout.java   
@SuppressWarnings("unchecked")
  public void setInitializer(Transformer<V,Point2D> initializer) {
    if(this.equals(initializer)) {
        throw new IllegalArgumentException("Layout cannot be initialized with itself");
    }
Transformer<V, ? extends Object> chain = 
    ChainedTransformer.getInstance(initializer, CloneTransformer.getInstance());
    this.locations = LazyMap.decorate(new HashMap<V,Point2D>(), (Transformer<V, Point2D>)chain);
    initialized = true;
  }
项目:AmIciTy-Grph    文件:AbstractLayout.java   
@SuppressWarnings("unchecked")
   protected AbstractLayout(Graph graph, Transformer<Node,Point2D> initializer) {
    this.graph = graph;
    Transformer<Node, ? extends Object> chain = 
        ChainedTransformer.getInstance(initializer, CloneTransformer.getInstance());
    this.locations = LazyMap.decorate(new HashMap<Node,Point2D>(), (Transformer<Node,Point2D>)chain);
    initialized = true;
}
项目:AmIciTy-Grph    文件:AbstractLayout.java   
public void setInitializer(Transformer<Node,Point2D> initializer) {
    if(this.equals(initializer)) {
        throw new IllegalArgumentException("Layout cannot be initialized with itself");
    }
    this.locations = LazyMap.decorate(new HashMap<Node,Point2D>(), (Transformer<Node, Point2D>)initializer);
    initialized = true;
}
项目:BfROpenLab    文件:CachingLayout.java   
public CachingLayout(Layout<V, E> delegate) {
    super(delegate);
    this.locationMap = LazyMap.<V,Point2D>decorate(new HashMap<V,Point2D>(), 
            new ChainedTransformer<V, Point2D>(new Transformer[]{delegate, CloneTransformer.<Point2D>getInstance()}));
}
项目:BfROpenLab    文件:ObservableCachingLayout.java   
public ObservableCachingLayout(Layout<V, E> delegate) {
    super(delegate);
    this.locationMap = LazyMap.<V,Point2D>decorate(new HashMap<V,Point2D>(), 
            new ChainedTransformer<V, Point2D>(new Transformer[]{delegate, CloneTransformer.<Point2D>getInstance()}));
}
项目:AmIciTy-Grph    文件:AbstractLayout.java   
protected AbstractLayout(Graph graph, Transformer<Node, Point2D> initializer, Dimension size) {
    this.graph = graph;
    this.locations = LazyMap.decorate(new HashMap<Node,Point2D>(), initializer);
    this.size = size;
}