本文整理汇总了Java中org.apache.commons.collections15.map.LazyMap类的典型用法代码示例。如果您正苦于以下问题:Java LazyMap类的具体用法?Java LazyMap怎么用?Java LazyMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LazyMap类属于org.apache.commons.collections15.map包,在下文中一共展示了LazyMap类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initAlgo
import org.apache.commons.collections15.map.LazyMap; //导入依赖的package包/类
@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.");
}
示例2: MinimumSpanningForest
import org.apache.commons.collections15.map.LazyMap; //导入依赖的package包/类
/**
* 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);
}
示例3: PersistentLayoutImpl
import org.apache.commons.collections15.map.LazyMap; //导入依赖的package包/类
/**
* 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>();
}
示例4: AbstractLayout
import org.apache.commons.collections15.map.LazyMap; //导入依赖的package包/类
@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;
}
示例5: setInitializer
import org.apache.commons.collections15.map.LazyMap; //导入依赖的package包/类
@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;
}
示例6: AbstractLayout
import org.apache.commons.collections15.map.LazyMap; //导入依赖的package包/类
@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;
}
示例7: setInitializer
import org.apache.commons.collections15.map.LazyMap; //导入依赖的package包/类
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;
}
示例8: CachingLayout
import org.apache.commons.collections15.map.LazyMap; //导入依赖的package包/类
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()}));
}
示例9: ObservableCachingLayout
import org.apache.commons.collections15.map.LazyMap; //导入依赖的package包/类
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()}));
}