Example usage for org.apache.commons.collections15 Factory Factory

List of usage examples for org.apache.commons.collections15 Factory Factory

Introduction

In this page you can find the example usage for org.apache.commons.collections15 Factory Factory.

Prototype

Factory

Source Link

Usage

From source file:cl.ucn.disc.zoome.zui.layout.OrderedSparseGraph.java

/**
 * Returns a {@code Factory} that creates an instance of this graph type.
 * @param <V> the vertex type for the graph factory
 * @param <E> the edge type for the graph factory
 *//*from  ww w .  jav a 2  s. co m*/
public static <V, E> Factory<Graph<V, E>> getFactory() {
    return new Factory<Graph<V, E>>() {
        public Graph<V, E> create() {
            return new OrderedSparseGraph<V, E>();
        }
    };
}

From source file:edu.uci.ics.jung.graph.SetHypergraph.java

/**
 * Returns a <code>Factory</code> which creates instances of this class.
 * @param <V> vertex type of the hypergraph to be created
 * @param <H> edge type of the hypergraph to be created
 * @return a <code>Factory</code> which creates instances of this class
 *///from  w ww  .ja  va 2 s .c  om
public static <V, H> Factory<Hypergraph<V, H>> getFactory() {
    return new Factory<Hypergraph<V, H>>() {
        public Hypergraph<V, H> create() {
            return new SetHypergraph<V, H>();
        }
    };
}

From source file:edu.uci.ics.jung.graph.UndirectedSparseMultigraph.java

/**
 * Returns a {@code Factory} that creates an instance of this graph type.
 * @param <V> the vertex type for the graph factory
 * @param <E> the edge type for the graph factory
 *///from  www .  jav a  2s. c  o  m
public static <V, E> Factory<UndirectedGraph<V, E>> getFactory() {
    return new Factory<UndirectedGraph<V, E>>() {

        public UndirectedGraph<V, E> create() {
            return new UndirectedSparseMultigraph<V, E>();
        }
    };
}

From source file:laystream.SimpleGraphView.java

/**
 * Creates a new instance of SimpleGraphView
 *//*from w  ww  .  ja v  a  2  s . co m*/
public SimpleGraphView() {
    g = new DirectedSparseMultigraph<>();
    vertexFactory = new Factory<LayNode>() {

        @Override
        public LayNode create() {
            return new LayNode("asd", new Point(rnd.nextInt(90), rnd.nextInt(90)));
        }
    };
    edgeFactory = new Factory<LayEdge>() {
        @Override
        public LayEdge create() {
            return new LayEdge("asd", 10);
        }
    };
    for (int i = 0; i < Util.NUMBE_OF_NODES; i++) {
        g.addVertex(new LayNode("" + i, new Point(rnd.nextInt(90), rnd.nextInt(90))));
    }
}

From source file:com.jakemadethis.graphite.graph.OrderedHypergraph.java

/**
 * Returns a <code>Factory</code> which creates instances of this class.
 * @param <V> vertex type of the hypergraph to be created
 * @param <H> edge type of the hypergraph to be created
 * @return a <code>Factory</code> which creates instances of this class
 *///from   w ww .j  a v  a 2  s. co m
public static <V, H> Factory<Hypergraph<V, H>> getFactory() {
    return new Factory<Hypergraph<V, H>>() {
        public Hypergraph<V, H> create() {
            return new OrderedHypergraph<V, H>();
        }
    };
}

From source file:edu.uci.ics.jung.algorithms.importance.TestWeightedNIPaths.java

@Override
protected void setUp() {
    vertexFactory = new Factory<String>() {
        char a = 'A';

        public String create() {
            return Character.toString(a++);
        }/*ww  w .j  av  a 2s  .com*/
    };
    edgeFactory = new Factory<Number>() {
        int count;

        public Number create() {
            return count++;
        }
    };
}

From source file:edu.uci.ics.jung.algorithms.cluster.TestEdgeBetweennessClusterer.java

@Override
protected void setUp() {
    graphFactory = new Factory<Graph<Integer, Number>>() {
        public Graph<Integer, Number> create() {
            return new SparseMultigraph<Integer, Number>();
        }//from   w w  w  .  ja v  a2 s .  c  o  m
    };
    vertexFactory = new Factory<Integer>() {
        int n = 0;

        public Integer create() {
            return n++;
        }
    };
    edgeFactory = new Factory<Number>() {
        int n = 0;

        public Number create() {
            return n++;
        }
    };

}

From source file:JFlap_2.EditingGraphViewer1.java

public EditingGraphViewer1() {
    g = new SparseMultigraph<Integer, String>();
    nodeCount = 0;/*from   w w w .  j  a va2 s.c  om*/
    edgeCount = 0;
    vertexFactory = new Factory<Integer>() {
        public Integer create() {
            return nodeCount++;
        }
    };
    edgeFactory = new Factory<String>() {
        public String create() {
            return "E" + edgeCount++;
        }
    };
}

From source file:edu.uci.ics.jung.algorithms.generators.random.TestEppsteinPowerLawGenerator.java

@Override
protected void setUp() {
    graphFactory = new Factory<Graph<Integer, Number>>() {
        public Graph<Integer, Number> create() {
            return new SparseMultigraph<Integer, Number>();
        }/*from  www. ja  v a  2  s .  com*/
    };
    vertexFactory = new Factory<Integer>() {
        int count;

        public Integer create() {
            return count++;
        }
    };
    edgeFactory = new Factory<Number>() {
        int count;

        public Number create() {
            return count++;
        }
    };
}

From source file:edu.uci.ics.jung.algorithms.scoring.TestPageRank.java

@Override
protected void setUp() {
    edgeWeights = new HashMap<Integer, Number>();
    edgeFactory = new Factory<Integer>() {
        int i = 0;

        public Integer create() {
            return i++;
        }//from  ww w.  jav a2 s  .  co m
    };
}