├── .gitignore
├── README.md
├── core
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── jboss
│ │ │ └── gwt
│ │ │ └── circuit
│ │ │ ├── Action.java
│ │ │ ├── Agreement.java
│ │ │ ├── ChangeSupport.java
│ │ │ ├── Dispatcher.java
│ │ │ ├── ErrorHandling.java
│ │ │ ├── NoopChannel.java
│ │ │ ├── PropagatesChange.java
│ │ │ ├── PropagatesError.java
│ │ │ ├── StoreCallback.java
│ │ │ ├── UUID.java
│ │ │ ├── dag
│ │ │ ├── ActionErrorSupport.java
│ │ │ ├── BoundedQueue.java
│ │ │ ├── CompoundDiagnostics.java
│ │ │ ├── CycleDetected.java
│ │ │ ├── DAGDispatcher.java
│ │ │ └── EdgeFactoryImpl.java
│ │ │ └── package-info.java
│ └── module.gwt.xml
│ └── test
│ └── java
│ └── org
│ └── jboss
│ └── gwt
│ └── circuit
│ ├── BarStore.java
│ ├── BoundedQueueTest.java
│ ├── ChangeSupportTest.java
│ ├── DispatcherTest.java
│ ├── FooBarAction.java
│ ├── FooStore.java
│ └── TestDiagnostics.java
├── doc
└── dependencies.png
├── jgrapht
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── org
│ │ └── jgrapht
│ │ ├── DirectedGraph.java
│ │ ├── EdgeFactory.java
│ │ ├── Graph.java
│ │ ├── GraphMapping.java
│ │ ├── GraphPath.java
│ │ ├── Graphs.java
│ │ ├── ListenableGraph.java
│ │ ├── UndirectedGraph.java
│ │ ├── VertexFactory.java
│ │ ├── WeightedGraph.java
│ │ ├── alg
│ │ ├── CycleDetector.java
│ │ └── StrongConnectivityInspector.java
│ │ ├── event
│ │ ├── ConnectedComponentTraversalEvent.java
│ │ ├── EdgeTraversalEvent.java
│ │ ├── GraphChangeEvent.java
│ │ ├── GraphEdgeChangeEvent.java
│ │ ├── GraphListener.java
│ │ ├── GraphVertexChangeEvent.java
│ │ ├── TraversalListener.java
│ │ ├── VertexSetListener.java
│ │ └── VertexTraversalEvent.java
│ │ ├── graph
│ │ ├── AbstractBaseGraph.java
│ │ ├── AbstractGraph.java
│ │ ├── AsUndirectedGraph.java
│ │ ├── ClassBasedEdgeFactory.java
│ │ ├── DefaultDirectedGraph.java
│ │ ├── DefaultEdge.java
│ │ ├── DefaultWeightedEdge.java
│ │ ├── DirectedSubgraph.java
│ │ ├── EdgeReversedGraph.java
│ │ ├── EdgeSetFactory.java
│ │ ├── GraphDelegator.java
│ │ ├── IntrusiveEdge.java
│ │ └── Subgraph.java
│ │ ├── traverse
│ │ ├── AbstractGraphIterator.java
│ │ ├── CrossComponentIterator.java
│ │ ├── DepthFirstIterator.java
│ │ ├── GraphIterator.java
│ │ └── TopologicalOrderIterator.java
│ │ └── util
│ │ ├── ArrayDeque.java
│ │ ├── ArrayUnenforcedSet.java
│ │ ├── Deque.java
│ │ ├── ModifiableInteger.java
│ │ ├── TypeUtil.java
│ │ └── WeightCombiner.java
│ ├── module.gwt.xml
│ └── removed
│ └── org
│ └── jgrapht
│ ├── GraphHelper.java
│ ├── alg
│ ├── AbstractPathElement.java
│ ├── AbstractPathElementList.java
│ ├── BellmanFordIterator.java
│ ├── BellmanFordPathElement.java
│ ├── BellmanFordShortestPath.java
│ ├── BiconnectivityInspector.java
│ ├── BlockCutpointGraph.java
│ ├── BronKerboschCliqueFinder.java
│ ├── ChromaticNumber.java
│ ├── ConnectivityInspector.java
│ ├── DijkstraShortestPath.java
│ ├── DirectedNeighborIndex.java
│ ├── EdmondsBlossomShrinking.java
│ ├── EdmondsKarpMaximumFlow.java
│ ├── EulerianCircuit.java
│ ├── FloydWarshallShortestPaths.java
│ ├── HamiltonianCycle.java
│ ├── HopcroftKarpBipartiteMatching.java
│ ├── KShortestPaths.java
│ ├── KShortestPathsIterator.java
│ ├── KruskalMinimumSpanningTree.java
│ ├── KuhnMunkresMinimalWeightBipartitePerfectMatching.java
│ ├── MinSourceSinkCut.java
│ ├── NaiveLcaFinder.java
│ ├── NeighborIndex.java
│ ├── PrimMinimumSpanningTree.java
│ ├── RankingPathElement.java
│ ├── RankingPathElementList.java
│ ├── StoerWagnerMinimumCut.java
│ ├── TarjanLowestCommonAncestor.java
│ ├── TransitiveClosure.java
│ ├── VertexCovers.java
│ ├── interfaces
│ │ ├── MatchingAlgorithm.java
│ │ ├── MinimumSpanningTree.java
│ │ └── WeightedMatchingAlgorithm.java
│ ├── package.html
│ └── util
│ │ ├── UnionFind.java
│ │ ├── VertexDegreeComparator.java
│ │ └── package.html
│ ├── event
│ ├── TraversalListenerAdapter.java
│ └── package.html
│ ├── experimental
│ ├── GraphSquare.java
│ ├── GraphTests.java
│ ├── PartiteRandomGraphGenerator.java
│ ├── RandomGraphHelper.java
│ ├── UniformRandomGraphGenerator.java
│ ├── alg
│ │ ├── ApproximationAlgorithm.java
│ │ ├── ExactAlgorithm.java
│ │ └── IntArrayGraphAlgorithm.java
│ ├── equivalence
│ │ ├── EquivalenceComparator.java
│ │ ├── EquivalenceComparatorChain.java
│ │ ├── EquivalenceComparatorChainBase.java
│ │ ├── EquivalenceSet.java
│ │ ├── EquivalenceSetCreator.java
│ │ ├── UniformEquivalenceComparator.java
│ │ └── package.html
│ ├── isomorphism
│ │ ├── AbstractExhaustiveIsomorphismInspector.java
│ │ ├── AdaptiveIsomorphismInspectorFactory.java
│ │ ├── EquivalenceIsomorphismInspector.java
│ │ ├── GraphIsomorphismInspector.java
│ │ ├── GraphOrdering.java
│ │ ├── IsomorphismRelation.java
│ │ ├── PermutationIsomorphismInspector.java
│ │ ├── VertexDegreeEquivalenceComparator.java
│ │ └── package.html
│ ├── package.html
│ └── permutation
│ │ ├── ArrayPermutationsIter.java
│ │ ├── CollectionPermutationIter.java
│ │ ├── CompoundPermutationIter.java
│ │ ├── IntegerPermutationIter.java
│ │ ├── PermutationFactory.java
│ │ └── package.html
│ ├── generate
│ ├── CompleteBipartiteGraphGenerator.java
│ ├── CompleteGraphGenerator.java
│ ├── EmptyGraphGenerator.java
│ ├── GraphGenerator.java
│ ├── GridGraphGenerator.java
│ ├── HyperCubeGraphGenerator.java
│ ├── LinearGraphGenerator.java
│ ├── RingGraphGenerator.java
│ ├── ScaleFreeGraphGenerator.java
│ ├── SimpleWeightedBipartiteGraphMatrixGenerator.java
│ ├── SimpleWeightedGraphMatrixGenerator.java
│ ├── StarGraphGenerator.java
│ ├── WeightedGraphGenerator.java
│ ├── WeightedGraphGeneratorAdapter.java
│ ├── WheelGraphGenerator.java
│ └── package.html
│ ├── graph
│ ├── AsUnweightedDirectedGraph.java
│ ├── AsUnweightedGraph.java
│ ├── AsWeightedGraph.java
│ ├── DefaultDirectedWeightedGraph.java
│ ├── DefaultGraphMapping.java
│ ├── DefaultListenableGraph.java
│ ├── DirectedGraphUnion.java
│ ├── DirectedMaskSubgraph.java
│ ├── DirectedMultigraph.java
│ ├── DirectedPseudograph.java
│ ├── DirectedWeightedMultigraph.java
│ ├── DirectedWeightedPseudograph.java
│ ├── DirectedWeightedSubgraph.java
│ ├── GraphPathImpl.java
│ ├── GraphUnion.java
│ ├── ListenableDirectedGraph.java
│ ├── ListenableDirectedWeightedGraph.java
│ ├── ListenableUndirectedGraph.java
│ ├── ListenableUndirectedWeightedGraph.java
│ ├── MaskEdgeSet.java
│ ├── MaskFunctor.java
│ ├── MaskSubgraph.java
│ ├── MaskVertexSet.java
│ ├── Multigraph.java
│ ├── ParanoidGraph.java
│ ├── Pseudograph.java
│ ├── SimpleDirectedGraph.java
│ ├── SimpleDirectedWeightedGraph.java
│ ├── SimpleGraph.java
│ ├── SimpleGraphPath.java
│ ├── SimpleWeightedGraph.java
│ ├── UndirectedGraphUnion.java
│ ├── UndirectedMaskSubgraph.java
│ ├── UndirectedSubgraph.java
│ ├── UndirectedWeightedSubgraph.java
│ ├── UnmodifiableDirectedGraph.java
│ ├── UnmodifiableGraph.java
│ ├── UnmodifiableUndirectedGraph.java
│ ├── WeightedMultigraph.java
│ ├── WeightedPseudograph.java
│ └── package.html
│ ├── package.html
│ ├── traverse
│ ├── BreadthFirstIterator.java
│ ├── ClosestFirstIterator.java
│ └── package.html
│ └── util
│ ├── FibonacciHeap.java
│ ├── FibonacciHeapNode.java
│ ├── MathUtil.java
│ ├── PrefetchIterator.java
│ ├── VertexPair.java
│ └── package.html
├── meta
├── pom.xml
└── src
│ └── main
│ └── java
│ ├── module.gwt.xml
│ └── org
│ └── jboss
│ └── gwt
│ └── circuit
│ └── meta
│ ├── Process.java
│ └── Store.java
├── pom.xml
├── processor
├── .gitignore
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── org
│ │ └── jboss
│ │ └── gwt
│ │ └── circuit
│ │ └── processor
│ │ ├── AbstractGenerator.java
│ │ ├── GenerationException.java
│ │ ├── GenerationUtil.java
│ │ ├── GraphVizGenerator.java
│ │ ├── GraphVizInfo.java
│ │ ├── ProcessInfo.java
│ │ ├── StoreDelegateMetadata.java
│ │ ├── StoreGenerator.java
│ │ └── StoreProcessor.java
│ └── resources
│ └── org
│ └── jboss
│ └── gwt
│ └── circuit
│ └── processor
│ └── templates
│ ├── Store.ftl
│ └── dependencies.ftl
├── samples
├── bookstore
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── org
│ │ │ └── jboss
│ │ │ └── gwt
│ │ │ └── circuit
│ │ │ └── sample
│ │ │ └── bookstore
│ │ │ ├── Book.java
│ │ │ ├── BookStore.java
│ │ │ └── Rate.java
│ │ └── test
│ │ └── java
│ │ └── org
│ │ └── jboss
│ │ └── gwt
│ │ └── circuit
│ │ └── sample
│ │ └── bookstore
│ │ └── BookStoreTest.java
├── calculator
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── org
│ │ │ └── jboss
│ │ │ └── gwt
│ │ │ └── circuit
│ │ │ └── sample
│ │ │ └── calculator
│ │ │ ├── Calculator.java
│ │ │ ├── CalculatorStore.java
│ │ │ ├── NoopAction.java
│ │ │ ├── SequentialDispatcher.java
│ │ │ ├── Term.java
│ │ │ └── views
│ │ │ ├── InputView.java
│ │ │ ├── StatsView.java
│ │ │ ├── TermsView.java
│ │ │ └── View.java
│ │ └── test
│ │ └── java
│ │ └── org
│ │ └── jboss
│ │ └── gwt
│ │ └── circuit
│ │ └── sample
│ │ └── calculator
│ │ └── CalculatorTest.java
├── pom.xml
├── wardrobe
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── org
│ │ │ └── jboss
│ │ │ └── gwt
│ │ │ └── circuit
│ │ │ └── sample
│ │ │ └── wardrobe
│ │ │ ├── actions
│ │ │ ├── Dress.java
│ │ │ └── Undress.java
│ │ │ └── stores
│ │ │ ├── CoatStore.java
│ │ │ ├── PulloverStore.java
│ │ │ ├── ShoesStore.java
│ │ │ ├── SocksStore.java
│ │ │ ├── TrousersStore.java
│ │ │ ├── UndershirtStore.java
│ │ │ └── UnderwearStore.java
│ │ └── test
│ │ └── java
│ │ └── org
│ │ └── jboss
│ │ └── gwt
│ │ └── circuit
│ │ └── sample
│ │ └── wardrobe
│ │ ├── OrderRecorder.java
│ │ └── WardrobeTest.java
└── wmm
│ ├── pom.xml
│ └── src
│ ├── main
│ └── java
│ │ └── org
│ │ └── jboss
│ │ └── gwt
│ │ └── circuit
│ │ └── sample
│ │ └── wmm
│ │ ├── actions
│ │ ├── DeployAction.java
│ │ ├── Deployment.java
│ │ ├── StartServerAction.java
│ │ ├── StopServerAction.java
│ │ └── UndeployAction.java
│ │ └── stores
│ │ ├── DeploymentStore.java
│ │ └── HostStore.java
│ └── test
│ └── java
│ └── org
│ └── jboss
│ └── gwt
│ └── circuit
│ └── sample
│ └── wmm
│ └── DomainTest.java
└── versionBump.sh
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 | *.jar
3 | *.war
4 | out
5 | target
6 |
7 | # gwt
8 | .errai
9 | .gwt/
10 | .gwt-tmp/
11 | gwt-unitCache/
12 | www-test/
13 |
14 | # os / ide
15 | nb-configuration.xml
16 | *.iml
17 | .DS_Store
18 | .idea
19 | .settings
20 | .project
21 | .classpath
22 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jboss/gwt/circuit/Action.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit;
23 |
24 | /**
25 | * The action marker interface. An action implementation is typically some kind of POJO.
26 | * Actions must provide a proper {@code equals()} and {@code hashCode()} implementation.
27 | */
28 | public interface Action {
29 | }
30 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jboss/gwt/circuit/Agreement.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit;
23 |
24 | import java.util.Collections;
25 | import java.util.HashSet;
26 | import java.util.Set;
27 |
28 | /**
29 | * Through an agreement stores express their support for specific action types
30 | * dependencies to other stores when processing a particular actions of that type.
31 | * The agreement is part of the voting phase.
32 | *
33 | * @see StoreCallback
34 | */
35 | public class Agreement {
36 |
37 | public final static Agreement NONE = new Agreement(false);
38 | public final static Agreement ANY = new Agreement(true);
39 |
40 | private final boolean approved;
41 | private final Set> dependencies;
42 |
43 | public Agreement(final boolean approved, final Class>... dependencies) {
44 | this.approved = approved;
45 | this.dependencies = new HashSet<>();
46 | if (dependencies != null) {
47 | Collections.addAll(this.dependencies, dependencies);
48 | }
49 | }
50 |
51 | public boolean isApproved() {
52 | return approved;
53 | }
54 |
55 | public boolean hasDependencies() {
56 | return !dependencies.isEmpty();
57 | }
58 |
59 | public Set> getDependencies() {
60 | return dependencies;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jboss/gwt/circuit/ErrorHandling.java:
--------------------------------------------------------------------------------
1 | package org.jboss.gwt.circuit;
2 |
3 | import com.google.web.bindery.event.shared.HandlerRegistration;
4 |
5 | /**
6 | * Interface meant to be implemented by stores in order to handle nacked actions.
7 | */
8 | public interface ErrorHandling {
9 |
10 | interface Handler {
11 |
12 | void onError(Action action);
13 | }
14 |
15 | /**
16 | * Registers a {@link ErrorHandling.Handler} to be notified only when the store was
17 | * modified by the specified action type.
18 | */
19 | HandlerRegistration addChangeHandler(Class extends Action> actionType, Handler handler);
20 |
21 | /**
22 | * Registers a {@link ErrorHandling.Handler} to be notified only when the store was
23 | * modified by the specified action instance.
24 | */
25 | HandlerRegistration addChangeHandler(Action action, Handler handler);
26 | }
27 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jboss/gwt/circuit/NoopChannel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit;
23 |
24 | public class NoopChannel {
25 |
26 | public static Dispatcher.Channel INSTANCE = new Dispatcher.Channel() {
27 |
28 | @Override
29 | public void ack() {
30 | // noop
31 | }
32 |
33 | @Override
34 | public void nack(final Throwable t) {
35 | // noop
36 | }
37 | };
38 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jboss/gwt/circuit/PropagatesChange.java:
--------------------------------------------------------------------------------
1 | package org.jboss.gwt.circuit;
2 |
3 | import com.google.web.bindery.event.shared.HandlerRegistration;
4 |
5 | /**
6 | * Interface meant to be implemented by stores in order to participate in change events.
7 | */
8 | public interface PropagatesChange {
9 |
10 | interface ChangeHandler {
11 |
12 | void onChange(Action action);
13 | }
14 |
15 | /**
16 | * Registers a {@link ChangeHandler} to be notified when the store was modified.
17 | */
18 | HandlerRegistration addChangeHandler(ChangeHandler handler);
19 |
20 | /**
21 | * Registers a {@link ChangeHandler} to be notified only when the store was
22 | * modified by the specified action type.
23 | */
24 | HandlerRegistration addChangeHandler(Class extends Action> actionType, ChangeHandler handler);
25 |
26 | /**
27 | * Registers a {@link ChangeHandler} to be notified only when the store was
28 | * modified by the specified action instance.
29 | */
30 | HandlerRegistration addChangeHandler(Action action, ChangeHandler handler);
31 | }
32 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jboss/gwt/circuit/PropagatesError.java:
--------------------------------------------------------------------------------
1 | package org.jboss.gwt.circuit;
2 |
3 | import com.google.web.bindery.event.shared.HandlerRegistration;
4 |
5 | /**
6 | * Interface meant to be implemented by stores in order to handle nacked actions.
7 | */
8 | public interface PropagatesError {
9 |
10 | interface ErrorHandler {
11 |
12 | void onError(Action action, Throwable throwable);
13 | }
14 |
15 | /**
16 | * Registers a {@link ErrorHandler} to be notified when the store nacked an arbitrary action.
17 | */
18 | HandlerRegistration addErrorHandler(ErrorHandler handler);
19 |
20 | /**
21 | * Registers a {@link ErrorHandler} to be notified only when the store nacked the specified action type.
22 | */
23 | HandlerRegistration addErrorHandler(Class extends Action> actionType, ErrorHandler handler);
24 |
25 | /**
26 | * Registers a {@link ErrorHandler} to be notified only when the store nacked the specified action
27 | * instance.
28 | */
29 | HandlerRegistration addErrorHandler(Action action, ErrorHandler handler);
30 | }
31 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jboss/gwt/circuit/StoreCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit;
23 |
24 | /**
25 | * Callbacks are the contract between the {@link org.jboss.gwt.circuit.Dispatcher} and a store. This contract consists
26 | * of:
27 | *
28 | *
Vote for an action
29 | *
Pass the action to the store
30 | *
Notify handlers that the store has changed or that the action processing failed.
31 | *
32 | */
33 | public interface StoreCallback {
34 |
35 | /**
36 | * Before actually processing an action, each store can vote on specific action types
37 | * and declare dependencies on other stores. Disagreement will prevent that the store will
38 | * be included in the completion phase.
39 | */
40 | Agreement voteFor(Action action);
41 |
42 | /**
43 | * After a successful vote, the dispatcher hands the action to the store for completion.
44 | * It's the stores responsibility to ack / nack the action.
45 | */
46 | void complete(Action action, Dispatcher.Channel channel);
47 |
48 | /**
49 | * After the action was acknowledged by the store, a change event is sent to all
50 | * registered {@link PropagatesChange.ChangeHandler}s.
51 | */
52 | void signalChange(Action action);
53 |
54 | /**
55 | * After the action was nacked by the store, an error event is sent to all
56 | * registered {@link PropagatesError.ErrorHandler}s.
57 | */
58 | void signalError(Action action, Throwable t);
59 | }
60 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jboss/gwt/circuit/dag/CompoundDiagnostics.java:
--------------------------------------------------------------------------------
1 | package org.jboss.gwt.circuit.dag;
2 |
3 | import org.jboss.gwt.circuit.Action;
4 | import org.jboss.gwt.circuit.Dispatcher;
5 |
6 | import java.util.LinkedList;
7 | import java.util.List;
8 |
9 | /**
10 | * @author Heiko Braun
11 | */
12 | public class CompoundDiagnostics implements DAGDispatcher.Diagnostics {
13 |
14 | private final List diagnostics = new LinkedList<>();
15 |
16 | @Override
17 | public void onDispatch(final Action action) {
18 | for (DAGDispatcher.Diagnostics d : diagnostics) { d.onDispatch(action); }
19 | }
20 |
21 | @Override
22 | public void onLock() {
23 | for (DAGDispatcher.Diagnostics d : diagnostics) { d.onLock(); }
24 | }
25 |
26 | @Override
27 | public void onExecute(final Class> store, final Action action) {
28 | for (DAGDispatcher.Diagnostics d : diagnostics) { d.onExecute(store, action); }
29 | }
30 |
31 | @Override
32 | public void onAck(final Class> store, final Action action) {
33 | for (DAGDispatcher.Diagnostics d : diagnostics) { d.onAck(store, action); }
34 | }
35 |
36 | @Override
37 | public void onNack(Class> store, Action action, String reason) {
38 | for (DAGDispatcher.Diagnostics d : diagnostics) { d.onNack(store, action, reason); }
39 | }
40 |
41 | @Override
42 | public void onNack(final Class> store, final Action action, final Throwable throwable) {
43 | for (DAGDispatcher.Diagnostics d : diagnostics) { d.onNack(store, action, throwable); }
44 | }
45 |
46 | @Override
47 | public void onUnlock() {
48 | for (DAGDispatcher.Diagnostics d : diagnostics) { d.onUnlock(); }
49 | }
50 |
51 | void add(final Dispatcher.Diagnostics diagnostics) {
52 | if (!(diagnostics instanceof DAGDispatcher.Diagnostics)) {
53 | throw new IllegalArgumentException("Diagnostics must be of type " + DAGDispatcher.Diagnostics.class);
54 | }
55 | this.diagnostics.add((DAGDispatcher.Diagnostics) diagnostics);
56 | }
57 |
58 | void remove(Dispatcher.Diagnostics diagnostics) {
59 | this.diagnostics.remove(diagnostics);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jboss/gwt/circuit/dag/CycleDetected.java:
--------------------------------------------------------------------------------
1 | package org.jboss.gwt.circuit.dag;
2 |
3 | /**
4 | * @author Heiko Braun
5 | */
6 | public class CycleDetected extends RuntimeException {
7 |
8 | public CycleDetected(String message) {
9 | super(message);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jboss/gwt/circuit/dag/EdgeFactoryImpl.java:
--------------------------------------------------------------------------------
1 | package org.jboss.gwt.circuit.dag;
2 |
3 | import org.jgrapht.EdgeFactory;
4 | import org.jgrapht.graph.DefaultEdge;
5 |
6 | /**
7 | * @author Heiko Braun
8 | */
9 | public class EdgeFactoryImpl implements EdgeFactory, DefaultEdge> {
10 |
11 | @Override
12 | public DefaultEdge createEdge(final Class> sourceVertex, final Class> targetVertex) {
13 | return new DefaultEdge(sourceVertex, targetVertex);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jboss/gwt/circuit/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
Circuit
3 | *
Circuit is an adoption of the Flux architecture as described at http://facebook.github.io/react/docs/flux-overview.html.
4 | *
5 | *
Core Building Blocks
6 | *
7 | *
Dispatcher
8 | *
PENDING
9 | *
10 | *
Stores
11 | *
12 | * A store holds application state and manages segments of the domain model used by an application.
13 | * In to process actions store register callbacks with a {@link org.jboss.gwt.circuit.Dispatcher}.
14 | *
15 | * When actions are dispatched stores run through a voting and a completion phase.
16 | * Voting allows to reject actions or declare dependencies on other stores. The actual processing of the action
17 | * (and all corresponding state changes) is done in the completion phase.
18 | *
19 | * It is mandatory to acknowledge each action through the {@link org.jboss.gwt.circuit.Dispatcher.Channel} after completion.
20 | *
21 | */
22 | package org.jboss.gwt.circuit;
--------------------------------------------------------------------------------
/core/src/main/module.gwt.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jboss/gwt/circuit/BarStore.java:
--------------------------------------------------------------------------------
1 | package org.jboss.gwt.circuit;
2 |
3 | /**
4 | * Sample store used for tests.
5 | */
6 | public class BarStore extends ChangeSupport {
7 |
8 | public BarStore(Dispatcher dispatcher) {
9 | dispatcher.register(BarStore.class, new StoreCallback() {
10 | @Override
11 | public Agreement voteFor(Action action) {
12 | return vote(action);
13 | }
14 |
15 | @Override
16 | public void complete(Action action, Dispatcher.Channel channel) {
17 | process(action, channel);
18 | }
19 |
20 | @Override
21 | public void signalChange(final Action action) {
22 | fireChange(action);
23 | }
24 |
25 | @Override
26 | public void signalError(final Action action, final Throwable throwable) {
27 | fireError(action, throwable);
28 | }
29 | });
30 | }
31 |
32 | protected Agreement vote(Action action) {
33 | return Agreement.ANY;
34 | }
35 |
36 | protected void process(Action action, Dispatcher.Channel channel) {
37 | channel.ack();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jboss/gwt/circuit/BoundedQueueTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit;
23 |
24 | import static org.junit.Assert.*;
25 |
26 | import org.jboss.gwt.circuit.dag.BoundedQueue;
27 | import org.junit.Test;
28 |
29 | public class BoundedQueueTest {
30 |
31 | @Test
32 | public void boundedQueue() {
33 | BoundedQueue queue = new BoundedQueue<>(3);
34 | queue.offer(1);
35 | queue.offer(2);
36 | queue.offer(3);
37 | boolean enqueued = queue.offer(4);
38 |
39 | assertEquals(3, queue.size());
40 | assertFalse("fourth item should not have been enqueued", enqueued);
41 | assertTrue(1 == queue.poll());
42 | assertTrue(2 == queue.poll());
43 | assertTrue(3 == queue.poll());
44 | assertTrue("queue should be empty", queue.isEmpty());
45 | assertTrue(queue.poll() == null);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jboss/gwt/circuit/FooBarAction.java:
--------------------------------------------------------------------------------
1 | package org.jboss.gwt.circuit;
2 |
3 | class FooBarAction implements Action {
4 |
5 | int payload;
6 |
7 | FooBarAction(int payload) {
8 | this.payload = payload;
9 | }
10 |
11 | @Override
12 | public boolean equals(Object o) {
13 | if (this == o) return true;
14 | if (!(o instanceof FooBarAction)) return false;
15 |
16 | FooBarAction that = (FooBarAction) o;
17 |
18 | if (payload != that.payload) return false;
19 |
20 | return true;
21 | }
22 |
23 | @Override
24 | public int hashCode() {
25 | return payload;
26 | }
27 |
28 | @Override
29 | public String toString() {
30 | return "FooBarAction(" + payload + ")";
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jboss/gwt/circuit/FooStore.java:
--------------------------------------------------------------------------------
1 | package org.jboss.gwt.circuit;
2 |
3 | /**
4 | * @author Heiko Braun
5 | * @date 23/06/14
6 | */
7 | public class FooStore extends ChangeSupport {
8 |
9 | public FooStore(Dispatcher dispatcher) {
10 | dispatcher.register(FooStore.class, new StoreCallback() {
11 | @Override
12 | public Agreement voteFor(Action action) {
13 | return vote(action);
14 | }
15 |
16 | @Override
17 | public void complete(Action action, Dispatcher.Channel channel) {
18 | process(action, channel);
19 | }
20 |
21 | @Override
22 | public void signalChange(final Action action) {
23 | fireChange(action);
24 | }
25 |
26 | @Override
27 | public void signalError(final Action action, final Throwable throwable) {
28 | fireError(action, throwable);
29 | }
30 | });
31 | }
32 |
33 | protected Agreement vote(Action action) {
34 | return Agreement.ANY;
35 | }
36 |
37 | protected void process(Action action, Dispatcher.Channel channel) {
38 | channel.ack();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jboss/gwt/circuit/TestDiagnostics.java:
--------------------------------------------------------------------------------
1 | package org.jboss.gwt.circuit;
2 |
3 | import org.jboss.gwt.circuit.dag.DAGDispatcher;
4 |
5 | import java.util.LinkedList;
6 | import java.util.List;
7 |
8 | public class TestDiagnostics implements DAGDispatcher.Diagnostics {
9 |
10 | private boolean locked;
11 | private int numDispatched;
12 | private int numExecuted;
13 | private int numAcked;
14 | private int numNackedByReason;
15 | private int numNackedByThrowable;
16 |
17 | private List> executionOrder;
18 |
19 | public List> getExecutionOrder() {
20 | return executionOrder;
21 | }
22 |
23 | public TestDiagnostics() {
24 | reset();
25 | }
26 |
27 | public boolean isLocked() {
28 | return locked;
29 | }
30 |
31 | public void reset() {
32 | executionOrder = new LinkedList<>();
33 | locked = false;
34 | numDispatched = 0;
35 | numExecuted = 0;
36 | numAcked = 0;
37 | numNackedByReason = 0;
38 | numNackedByThrowable = 0;
39 | }
40 |
41 | public int getNumDispatched() {
42 | return numDispatched;
43 | }
44 |
45 | public int getNumExecuted() {
46 | return numExecuted;
47 | }
48 |
49 | public int getNumAcked() {
50 | return numAcked;
51 | }
52 |
53 | public int getNumNackedByReason() {
54 | return numNackedByReason;
55 | }
56 |
57 | public int getNumNackedByThrowable() {
58 | return numNackedByThrowable;
59 | }
60 |
61 | @Override
62 | public void onDispatch(Action action) {
63 | numDispatched++;
64 | }
65 |
66 | @Override
67 | public void onLock() {
68 | locked = true;
69 | }
70 |
71 | @Override
72 | public void onExecute(Class> store, Action action) {
73 | numExecuted++;
74 | executionOrder.add(store);
75 | }
76 |
77 | @Override
78 | public void onAck(Class> store, Action action) {
79 | numAcked++;
80 | }
81 |
82 | @Override
83 | public void onNack(Class> store, Action action, String reason) {
84 | numNackedByReason++;
85 | }
86 |
87 | @Override
88 | public void onNack(Class> store, Action action, Throwable throwable) {
89 | numNackedByThrowable++;
90 | }
91 |
92 | @Override
93 | public void onUnlock() {
94 | locked = false;
95 | }
96 | }
--------------------------------------------------------------------------------
/doc/dependencies.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hal/circuit/d2c22aa93c5206fd1d9f74ea6b1aef3cb05b9c81/doc/dependencies.png
--------------------------------------------------------------------------------
/jgrapht/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 |
7 | org.jboss.gwt.circuit
8 | circuit-parent
9 | 0.2.0
10 |
11 |
12 | circuit-jgrapht
13 | circuit :: JGraphT
14 | Subset of JGraphT Core API
15 | gwt-lib
16 |
17 |
18 |
19 | GNU Lesser General Public License Version 2.1, February 1999
20 | http://jgrapht.sourceforge.net/LGPL.html
21 | repo
22 |
23 |
24 | Eclipse Public License (EPL) 1.0
25 | http://www.eclipse.org/legal/epl-v10.html
26 | repo
27 |
28 |
29 |
30 |
31 |
32 |
33 | net.ltgt.gwt.maven
34 | gwt-maven-plugin
35 | true
36 |
37 | org.JGraphT
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/EdgeFactory.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ----------------
23 | * EdgeFactory.java
24 | * ----------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 24-Jul-2003 : Initial revision (BN);
35 | * 11-Mar-2004 : Made generic (CH);
36 | *
37 | */
38 | package org.jgrapht;
39 |
40 | /**
41 | * An edge factory used by graphs for creating new edges.
42 | *
43 | * @author Barak Naveh
44 | * @since Jul 14, 2003
45 | */
46 | public interface EdgeFactory
47 | {
48 |
49 |
50 | /**
51 | * Creates a new edge whose endpoints are the specified source and target
52 | * vertices.
53 | *
54 | * @param sourceVertex the source vertex.
55 | * @param targetVertex the target vertex.
56 | *
57 | * @return a new edge whose endpoints are the specified source and target
58 | * vertices.
59 | */
60 | public E createEdge(V sourceVertex, V targetVertex);
61 | }
62 |
63 | // End EdgeFactory.java
64 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/GraphMapping.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -----------------
23 | * GraphMapping.java
24 | * -----------------
25 | * (C) Copyright 2005-2008, by Assaf Lehr and Contributors.
26 | *
27 | * Original Author: Assaf Lehr
28 | * Contributor(s): John V. Sichi
29 | *
30 | * Changes
31 | * -------
32 | */
33 | package org.jgrapht;
34 |
35 | /**
36 | * GraphMapping represents a bidirectional mapping between two graphs (called
37 | * graph1 and graph2), which allows the caller to obtain the matching vertex or
38 | * edge in either direction, from graph1 to graph2, or from graph2 to graph1. It
39 | * does not have to always be a complete bidirectional mapping (it could return
40 | * null for some lookups).
41 | *
42 | * @author Assaf Lehr
43 | * @since Jul 30, 2005
44 | */
45 | public interface GraphMapping
46 | {
47 |
48 |
49 | /**
50 | * Gets the mapped value where the key is vertex
51 | *
52 | * @param vertex vertex in one of the graphs
53 | * @param forward if true, uses mapping from graph1 to graph2; if false, use
54 | * mapping from graph2 to graph1
55 | *
56 | * @return corresponding vertex in other graph, or null if none
57 | */
58 | public V getVertexCorrespondence(V vertex, boolean forward);
59 |
60 | /**
61 | * Gets the mapped value where the key is edge
62 | *
63 | * @param edge edge in one of the graphs
64 | * @param forward if true, uses mapping from graph1 to graph2; if false, use
65 | * mapping from graph2 to graph1
66 | *
67 | * @return corresponding edge in other graph, or null if none
68 | */
69 | public E getEdgeCorrespondence(E edge, boolean forward);
70 | }
71 |
72 | // End GraphMapping.java
73 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/UndirectedGraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* --------------------
23 | * UndirectedGraph.java
24 | * --------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 24-Jul-2003 : Initial revision (BN);
35 | * 11-Mar-2004 : Made generic (CH);
36 | *
37 | */
38 | package org.jgrapht;
39 |
40 | /**
41 | * A graph whose all edges are undirected. This is the root interface of all
42 | * undirected graphs.
43 | *
44 | *
47 | *
48 | * @author Barak Naveh
49 | * @since Jul 14, 2003
50 | */
51 | public interface UndirectedGraph
52 | extends Graph
53 | {
54 |
55 |
56 | /**
57 | * Returns the degree of the specified vertex. A degree of a vertex in an
58 | * undirected graph is the number of edges touching that vertex.
59 | *
60 | * @param vertex vertex whose degree is to be calculated.
61 | *
62 | * @return the degree of the specified vertex.
63 | */
64 | public int degreeOf(V vertex);
65 | }
66 |
67 | // End UndirectedGraph.java
68 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/VertexFactory.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ------------------
23 | * VertexFactory.java
24 | * ------------------
25 | * (C) Copyright 2003-2008, by John V. Sichi and Contributors.
26 | *
27 | * Original Author: John V. Sichi
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 16-Sep-2003 : Initial revision (JVS);
35 | * 11-Mar-2004 : Made generic (CH);
36 | *
37 | */
38 | package org.jgrapht;
39 |
40 | /**
41 | * A vertex factory used by graph algorithms for creating new vertices.
42 | * Normally, vertices are constructed by user code and added to a graph
43 | * explicitly, but algorithms which generate new vertices require a factory.
44 | *
45 | * @author John V. Sichi
46 | * @since Sep 16, 2003
47 | */
48 | public interface VertexFactory
49 | {
50 |
51 |
52 | /**
53 | * Creates a new vertex.
54 | *
55 | * @return the new vertex
56 | */
57 | public V createVertex();
58 | }
59 |
60 | // End VertexFactory.java
61 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/WeightedGraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ------------------
23 | * WeightedGraph.java
24 | * ------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 24-Jul-2003 : Initial revision (BN);
35 | * 13-Aug-2003 : Included weight methods in Edge interface (BN);
36 | * 11-Mar-2004 : Made generic (CH);
37 | *
38 | */
39 | package org.jgrapht;
40 |
41 | /**
42 | * An interface for a graph whose edges have non-uniform weights.
43 | *
44 | * @author Barak Naveh
45 | * @since Jul 23, 2003
46 | */
47 | public interface WeightedGraph
48 | extends Graph
49 | {
50 |
51 |
52 | /**
53 | * The default weight for an edge.
54 | */
55 | public static double DEFAULT_EDGE_WEIGHT = 1.0;
56 |
57 |
58 |
59 | /**
60 | * Assigns a weight to an edge.
61 | *
62 | * @param e edge on which to set weight
63 | * @param weight new weight for edge
64 | */
65 | public void setEdgeWeight(E e, double weight);
66 | }
67 |
68 | // End WeightedGraph.java
69 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/event/EdgeTraversalEvent.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -----------------------
23 | * EdgeTraversalEvent.java
24 | * -----------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 11-Aug-2003 : Initial revision (BN);
35 | * 11-Mar-2004 : Made generic (CH);
36 | *
37 | */
38 | package org.jgrapht.event;
39 |
40 | import java.util.EventObject;
41 |
42 |
43 | /**
44 | * A traversal event for a graph edge.
45 | *
46 | * @author Barak Naveh
47 | * @since Aug 11, 2003
48 | */
49 | public class EdgeTraversalEvent
50 | extends EventObject
51 | {
52 |
53 |
54 | private static final long serialVersionUID = 4050768173789820979L;
55 |
56 |
57 |
58 | /**
59 | * The traversed edge.
60 | */
61 | protected E edge;
62 |
63 |
64 |
65 | /**
66 | * Creates a new EdgeTraversalEvent.
67 | *
68 | * @param eventSource the source of the event.
69 | * @param edge the traversed edge.
70 | */
71 | public EdgeTraversalEvent(Object eventSource, E edge)
72 | {
73 | super(eventSource);
74 | this.edge = edge;
75 | }
76 |
77 |
78 |
79 | /**
80 | * Returns the traversed edge.
81 | *
82 | * @return the traversed edge.
83 | */
84 | public E getEdge()
85 | {
86 | return edge;
87 | }
88 | }
89 |
90 | // End EdgeTraversalEvent.java
91 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/event/GraphChangeEvent.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ---------------------
23 | * GraphChangeEvent.java
24 | * ---------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): -
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 10-Aug-2003 : Initial revision (BN);
35 | *
36 | */
37 | package org.jgrapht.event;
38 |
39 | import java.util.EventObject;
40 |
41 |
42 | /**
43 | * An event which indicates that a graph has changed. This class is a root for
44 | * graph change events.
45 | *
46 | * @author Barak Naveh
47 | * @since Aug 10, 2003
48 | */
49 | public class GraphChangeEvent
50 | extends EventObject
51 | {
52 |
53 |
54 | private static final long serialVersionUID = 3834592106026382391L;
55 |
56 |
57 |
58 | /**
59 | * The type of graph change this event indicates.
60 | */
61 | protected int type;
62 |
63 |
64 |
65 | /**
66 | * Creates a new graph change event.
67 | *
68 | * @param eventSource the source of the event.
69 | * @param type the type of event.
70 | */
71 | public GraphChangeEvent(Object eventSource, int type)
72 | {
73 | super(eventSource);
74 | this.type = type;
75 | }
76 |
77 |
78 |
79 | /**
80 | * Returns the event type.
81 | *
82 | * @return the event type.
83 | */
84 | public int getType()
85 | {
86 | return type;
87 | }
88 | }
89 |
90 | // End GraphChangeEvent.java
91 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/event/GraphListener.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ------------------
23 | * GraphListener.java
24 | * ------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 24-Jul-2003 : Initial revision (BN);
35 | * 10-Aug-2003 : Adaptation to new event model (BN);
36 | * 11-Mar-2004 : Made generic (CH);
37 | *
38 | */
39 | package org.jgrapht.event;
40 |
41 | /**
42 | * A listener that is notified when the graph changes.
43 | *
44 | *
If only notifications on vertex set changes are required it is more
45 | * efficient to use the VertexSetListener.
46 | *
47 | * @author Barak Naveh
48 | * @see VertexSetListener
49 | * @since Jul 18, 2003
50 | */
51 | public interface GraphListener
52 | extends VertexSetListener
53 | {
54 |
55 |
56 | /**
57 | * Notifies that an edge has been added to the graph.
58 | *
59 | * @param e the edge event.
60 | */
61 | public void edgeAdded(GraphEdgeChangeEvent e);
62 |
63 | /**
64 | * Notifies that an edge has been removed from the graph.
65 | *
66 | * @param e the edge event.
67 | */
68 | public void edgeRemoved(GraphEdgeChangeEvent e);
69 | }
70 |
71 | // End GraphListener.java
72 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/event/VertexSetListener.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ----------------------
23 | * VertexSetListener.java
24 | * ----------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 24-Jul-2003 : Initial revision (BN);
35 | * 10-Aug-2003 : Adaptation to new event model (BN);
36 | * 11-Mar-2004 : Made generic (CH);
37 | *
38 | */
39 | package org.jgrapht.event;
40 |
41 | import java.util.EventListener;
42 |
43 |
44 | /**
45 | * A listener that is notified when the graph's vertex set changes. It should be
46 | * used when only notifications on vertex-set changes are of interest. If
47 | * all graph notifications are of interest better use
48 | * GraphListener.
49 | *
50 | * @author Barak Naveh
51 | * @see GraphListener
52 | * @since Jul 18, 2003
53 | */
54 | public interface VertexSetListener
55 | extends EventListener
56 | {
57 |
58 |
59 | /**
60 | * Notifies that a vertex has been added to the graph.
61 | *
62 | * @param e the vertex event.
63 | */
64 | public void vertexAdded(GraphVertexChangeEvent e);
65 |
66 | /**
67 | * Notifies that a vertex has been removed from the graph.
68 | *
69 | * @param e the vertex event.
70 | */
71 | public void vertexRemoved(GraphVertexChangeEvent e);
72 | }
73 |
74 | // End VertexSetListener.java
75 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/event/VertexTraversalEvent.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -------------------------
23 | * VertexTraversalEvent.java
24 | * -------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 11-Aug-2003 : Initial revision (BN);
35 | * 11-Mar-2004 : Made generic (CH);
36 | *
37 | */
38 | package org.jgrapht.event;
39 |
40 | import java.util.EventObject;
41 |
42 |
43 | /**
44 | * A traversal event for a graph vertex.
45 | *
46 | * @author Barak Naveh
47 | * @since Aug 11, 2003
48 | */
49 | public class VertexTraversalEvent
50 | extends EventObject
51 | {
52 |
53 |
54 | private static final long serialVersionUID = 3688790267213918768L;
55 |
56 |
57 |
58 | /**
59 | * The traversed vertex.
60 | */
61 | protected V vertex;
62 |
63 |
64 |
65 | /**
66 | * Creates a new VertexTraversalEvent.
67 | *
68 | * @param eventSource the source of the event.
69 | * @param vertex the traversed vertex.
70 | */
71 | public VertexTraversalEvent(Object eventSource, V vertex)
72 | {
73 | super(eventSource);
74 | this.vertex = vertex;
75 | }
76 |
77 |
78 |
79 | /**
80 | * Returns the traversed vertex.
81 | *
82 | * @return the traversed vertex.
83 | */
84 | public V getVertex()
85 | {
86 | return vertex;
87 | }
88 | }
89 |
90 | // End VertexTraversalEvent.java
91 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/graph/ClassBasedEdgeFactory.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ------------------
23 | * ClassBasedEdgeFactory.java
24 | * ------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 24-Jul-2003 : Initial revision (BN);
35 | * 04-Aug-2003 : Renamed from EdgeFactoryFactory & made utility class (BN);
36 | * 03-Nov-2003 : Made edge factories serializable (BN);
37 | * 11-Mar-2004 : Made generic (CH);
38 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
39 | *
40 | */
41 | package org.jgrapht.graph;
42 |
43 | import java.io.Serializable;
44 |
45 | import org.jgrapht.EdgeFactory;
46 |
47 |
48 | /**
49 | * An {@link EdgeFactory} for producing edges by using a class as a factory.
50 | *
51 | * @author Barak Naveh
52 | * @since Jul 14, 2003
53 | */
54 | public class ClassBasedEdgeFactory
55 | implements EdgeFactory,
56 | Serializable
57 | {
58 |
59 |
60 | private static final long serialVersionUID = 3618135658586388792L;
61 |
62 |
63 |
64 | private final Class extends E> edgeClass;
65 |
66 |
67 |
68 | public ClassBasedEdgeFactory(Class extends E> edgeClass)
69 | {
70 | this.edgeClass = edgeClass;
71 | }
72 |
73 |
74 |
75 | /**
76 | * @see EdgeFactory#createEdge(Object, Object)
77 | */
78 | @SuppressWarnings("unchecked")
79 | public E createEdge(V source, V target)
80 | {
81 | try {
82 | return (E) new DefaultEdge(source, target);
83 | // does not work in GWT: return edgeClass.newInstance();
84 | } catch (Exception ex) {
85 | throw new RuntimeException("Edge factory failed", ex);
86 | }
87 | }
88 | }
89 |
90 | // End ClassBasedEdgeFactory.java
91 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/graph/DefaultDirectedGraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -------------------------
23 | * DefaultDirectedGraph.java
24 | * -------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 11-Mar-2004 : Made generic (CH);
36 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
37 | *
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import org.jgrapht.DirectedGraph;
42 | import org.jgrapht.EdgeFactory;
43 |
44 |
45 | /**
46 | * A directed graph. A default directed graph is a non-simple directed graph in
47 | * which multiple edges between any two vertices are not permitted, but
48 | * loops are.
49 | *
50 | *
prefixed 'Default' to avoid name collision with the DirectedGraph
51 | * interface.
52 | */
53 | public class DefaultDirectedGraph
54 | extends AbstractBaseGraph
55 | implements DirectedGraph
56 | {
57 |
58 |
59 | private static final long serialVersionUID = 3544953246956466230L;
60 |
61 |
62 |
63 | /**
64 | * Creates a new directed graph.
65 | *
66 | * @param edgeClass class on which to base factory for edges
67 | */
68 | public DefaultDirectedGraph(Class extends E> edgeClass)
69 | {
70 | this(new ClassBasedEdgeFactory(edgeClass));
71 | }
72 |
73 | /**
74 | * Creates a new directed graph with the specified edge factory.
75 | *
76 | * @param ef the edge factory of the new graph.
77 | */
78 | public DefaultDirectedGraph(EdgeFactory ef)
79 | {
80 | super(ef, false, true);
81 | }
82 | }
83 |
84 | // End DefaultDirectedGraph.java
85 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/graph/DefaultEdge.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ----------------
23 | * DefaultEdge.java
24 | * ----------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 24-Jul-2003 : Initial revision (BN);
35 | * 10-Aug-2003 : General edge refactoring (BN);
36 | * 11-Mar-2004 : Made generic (CH);
37 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
38 | *
39 | */
40 | package org.jgrapht.graph;
41 |
42 | import org.jgrapht.Graph;
43 |
44 |
45 | /**
46 | * A default implementation for edges in a {@link Graph}.
47 | *
48 | * @author Barak Naveh
49 | * @since Jul 14, 2003
50 | */
51 | public class DefaultEdge
52 | extends IntrusiveEdge
53 | {
54 |
55 | private static final long serialVersionUID = 3258408452177932855L;
56 |
57 | public DefaultEdge() {
58 | }
59 |
60 | public DefaultEdge(Object s, Object t)
61 | {
62 | source = s;
63 | target = t;
64 | }
65 |
66 | /**
67 | * Retrieves the source of this edge. This is protected, for use by
68 | * subclasses only (e.g. for implementing toString).
69 | *
70 | * @return source of this edge
71 | */
72 | protected Object getSource()
73 | {
74 | return source;
75 | }
76 |
77 | /**
78 | * Retrieves the target of this edge. This is protected, for use by
79 | * subclasses only (e.g. for implementing toString).
80 | *
81 | * @return target of this edge
82 | */
83 | protected Object getTarget()
84 | {
85 | return target;
86 | }
87 |
88 | public String toString()
89 | {
90 | return "(" + source + " : " + target + ")";
91 | }
92 | }
93 |
94 | // End DefaultEdge.java
95 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/graph/DefaultWeightedEdge.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ----------------
23 | * DefaultWeightedEdge.java
24 | * ----------------
25 | * (C) Copyright 2006-2008, by John V. Sichi and Contributors.
26 | *
27 | * Original Author: John V. Sichi
28 | * Contributor(s): -
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 29-May-2006 : Initial revision (JVS);
35 | *
36 | */
37 | package org.jgrapht.graph;
38 |
39 | import org.jgrapht.WeightedGraph;
40 |
41 |
42 | /**
43 | * A default implementation for edges in a {@link WeightedGraph}. All access to
44 | * the weight of an edge must go through the graph interface, which is why this
45 | * class doesn't expose any public methods.
46 | *
47 | * @author John V. Sichi
48 | */
49 | public class DefaultWeightedEdge
50 | extends DefaultEdge
51 | {
52 |
53 |
54 | private static final long serialVersionUID = 229708706467350994L;
55 |
56 |
57 |
58 | double weight = WeightedGraph.DEFAULT_EDGE_WEIGHT;
59 |
60 |
61 |
62 | /**
63 | * Retrieves the weight of this edge. This is protected, for use by
64 | * subclasses only (e.g. for implementing toString).
65 | *
66 | * @return weight of this edge
67 | */
68 | protected double getWeight()
69 | {
70 | return weight;
71 | }
72 | }
73 |
74 | // End DefaultWeightedEdge.java
75 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/graph/EdgeSetFactory.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ----------------
23 | * EdgeSetFactory.java
24 | * ----------------
25 | * (C) Copyright 2005-2008, by John V. Sichi and Contributors.
26 | *
27 | * Original Author: John V. Sichi
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 01-Jun-2005 : Initial revision (JVS);
35 | * 06-Aug-2005 : Made generic (CH);
36 | * 07-May-2006 : Renamed and changed from List to Set (JVS);
37 | *
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import java.util.Set;
42 |
43 |
44 | /**
45 | * A factory for edge sets. This interface allows the creator of a graph to
46 | * choose the {@link java.util.Set} implementation used internally by the graph
47 | * to maintain sets of edges. This provides control over performance tradeoffs
48 | * between memory and CPU usage.
49 | *
50 | * @author John V. Sichi
51 | */
52 | public interface EdgeSetFactory
53 | {
54 |
55 |
56 | /**
57 | * Create a new edge set for a particular vertex.
58 | *
59 | * @param vertex the vertex for which the edge set is being created;
60 | * sophisticated factories may be able to use this information to choose an
61 | * optimal set representation (e.g. ArrayUnenforcedSet for a vertex expected
62 | * to have low degree, and LinkedHashSet for a vertex expected to have high
63 | * degree)
64 | *
65 | * @return new set
66 | */
67 | public Set createEdgeSet(V vertex);
68 | }
69 |
70 | // End EdgeSetFactory.java
71 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/graph/IntrusiveEdge.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -------------------
23 | * IntrusiveEdge.java
24 | * -------------------
25 | * (C) Copyright 2006-2008, by John V. Sichi and Contributors.
26 | *
27 | * Original Author: John V. Sichi
28 | * Contributor(s): -
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 28-May-2006 : Initial revision (JVS);
35 | *
36 | */
37 | package org.jgrapht.graph;
38 |
39 | import java.io.Serializable;
40 |
41 |
42 | /**
43 | * IntrusiveEdge encapsulates the internals for the default edge implementation.
44 | * It is not intended to be referenced directly (which is why it's not public);
45 | * use DefaultEdge for that.
46 | *
47 | * @author John V. Sichi
48 | */
49 | class IntrusiveEdge
50 | implements Cloneable,
51 | Serializable
52 | {
53 |
54 |
55 | private static final long serialVersionUID = 3258408452177932855L;
56 |
57 | protected Object source;
58 |
59 | protected Object target;
60 |
61 | }
62 |
63 | // End IntrusiveEdge.java
64 |
--------------------------------------------------------------------------------
/jgrapht/src/main/java/org/jgrapht/util/TypeUtil.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -----------------
23 | * TypeUtil.java
24 | * -----------------
25 | * (C) Copyright 2006-2008, by John V. Sichi and Contributors.
26 | *
27 | * Original Author: John V. Sichi
28 | * Contributor(s): -
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 07-May-2006 : Initial version (JVS);
35 | */
36 | package org.jgrapht.util;
37 |
38 | /**
39 | * TypeUtil isolates type-unsafety so that code which uses it for legitimate
40 | * reasons can stay warning-free.
41 | *
42 | * @author John V. Sichi
43 | */
44 | public class TypeUtil
45 | {
46 |
47 |
48 | /**
49 | * Casts an object to a type.
50 | *
51 | * @param o object to be cast
52 | * @param typeDecl conveys the target type information; the actual value is
53 | * unused and can be null since this is all just stupid compiler tricks
54 | *
55 | * @return the result of the cast
56 | */
57 | @SuppressWarnings("unchecked")
58 | public static T uncheckedCast(Object o, TypeUtil typeDecl)
59 | {
60 | return (T) o;
61 | }
62 | }
63 |
64 | // End TypeUtil.java
65 |
--------------------------------------------------------------------------------
/jgrapht/src/main/module.gwt.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/GraphHelper.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ----------------
23 | * GraphHelper.java
24 | * ----------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | * Mikael Hansen
30 | *
31 | * $Id$
32 | *
33 | * Changes
34 | * -------
35 | * 10-Jul-2003 : Initial revision (BN);
36 | * 06-Nov-2003 : Change edge sharing semantics (JVS);
37 | * 11-Mar-2004 : Made generic (CH);
38 | * 07-May-2006 : Changed from List to Set (JVS);
39 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
40 | *
41 | */
42 | package org.jgrapht;
43 |
44 | /**
45 | * A collection of utilities to assist the working with graphs.
46 | *
47 | * @author Barak Naveh
48 | * @since Jul 31, 2003
49 | * @deprecated Use {@link Graphs} instead.
50 | */
51 | @Deprecated public abstract class GraphHelper
52 | extends Graphs
53 | {
54 | }
55 |
56 | // End GraphHelper.java
57 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/alg/interfaces/MatchingAlgorithm.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://org.org.jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2013, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -------------------------
23 | * MatchingAlgorithm.java
24 | * -------------------------
25 | *
26 | * Original Author: Alexey Kudinkin
27 | * Contributor(s):
28 | *
29 | */
30 | package org.jgrapht.alg.interfaces;
31 |
32 | import java.util.Set;
33 |
34 |
35 | /**
36 | * Allows to derive matching from
38 | * given graph
39 | *
40 | * @param vertex concept type
41 | * @param edge concept type
42 | */
43 | public abstract interface MatchingAlgorithm
44 | {
45 |
46 |
47 | /**
48 | * Returns set of edges making up the matching
49 | */
50 | public Set getMatching();
51 | }
52 |
53 | // End MatchingAlgorithm.java
54 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/alg/interfaces/MinimumSpanningTree.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://org.org.jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2013, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -------------------------
23 | * MinimumSpanningTree.java
24 | * -------------------------
25 | *
26 | * Original Author: Alexey Kudinkin
27 | * Contributor(s):
28 | *
29 | */
30 | package org.jgrapht.alg.interfaces;
31 |
32 | import java.util.Set;
33 |
34 |
35 | /**
36 | * Allows to derive
37 | * minimum spanning tree from given undirected connected graph. In the case
38 | * of disconnected graphs it would rather derive minimum spanning forest
39 | *
40 | * @param vertex concept type
41 | * @param edge concept type
42 | */
43 | public interface MinimumSpanningTree
44 | {
45 |
46 |
47 | /**
48 | * Returns edges set constituting the minimum spanning tree/forest
49 | *
50 | * @return minimum spanning-tree edges set
51 | */
52 | public Set getMinimumSpanningTreeEdgeSet();
53 |
54 | /**
55 | * Returns total weight of the minimum spanning tree/forest.
56 | *
57 | * @return minimum spanning-tree total weight
58 | */
59 | public double getMinimumSpanningTreeTotalWeight();
60 | }
61 |
62 | // End MinimumSpanningTree.java
63 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/alg/interfaces/WeightedMatchingAlgorithm.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://org.org.jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2013, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -------------------------
23 | * MinimumSpanningTree.java
24 | * -------------------------
25 | *
26 | * Original Author: Alexey Kudinkin
27 | * Contributor(s):
28 | *
29 | */
30 | package org.jgrapht.alg.interfaces;
31 |
32 | /**
33 | * Allows to derive weighted matching from general graph
34 | *
35 | * @param
36 | * @param
37 | *
38 | * @see MatchingAlgorithm
39 | */
40 | public interface WeightedMatchingAlgorithm
41 | extends MatchingAlgorithm
42 | {
43 |
44 |
45 | /**
46 | * Returns weight of a matching found
47 | *
48 | * @return weight of a matching found
49 | */
50 | public double getMatchingWeight();
51 | }
52 |
53 | // End WeightedMatchingAlgorithm.java
54 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/alg/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Algorithms provided with JGraphT.
5 |
6 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/alg/util/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Utilities used by JGraphT algorithms.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/event/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Event classes and listener interfaces, used to provide a change
5 | notification mechanism on graph modification events.
6 |
7 |
8 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/experimental/alg/ApproximationAlgorithm.java:
--------------------------------------------------------------------------------
1 | /* This program and the accompanying materials are dual-licensed under
2 | * either
3 | *
4 | * (a) the terms of the GNU Lesser General Public License version 2.1
5 | * as published by the Free Software Foundation, or (at your option) any
6 | * later version.
7 | *
8 | * or (per the licensee's choosing)
9 | *
10 | * (b) the terms of the Eclipse Public License v1.0 as published by
11 | * the Eclipse Foundation.
12 | */
13 | package org.jgrapht.experimental.alg;
14 |
15 | import java.util.Map;
16 |
17 |
18 | public interface ApproximationAlgorithm
19 | {
20 |
21 |
22 | ResultType getUpperBound(Map optionalData);
23 |
24 | ResultType getLowerBound(Map optionalData);
25 |
26 | boolean isExact();
27 | }
28 |
29 | // End ApproximationAlgorithm.java
30 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/experimental/alg/ExactAlgorithm.java:
--------------------------------------------------------------------------------
1 | /* This program and the accompanying materials are dual-licensed under
2 | * either
3 | *
4 | * (a) the terms of the GNU Lesser General Public License version 2.1
5 | * as published by the Free Software Foundation, or (at your option) any
6 | * later version.
7 | *
8 | * or (per the licensee's choosing)
9 | *
10 | * (b) the terms of the Eclipse Public License v1.0 as published by
11 | * the Eclipse Foundation.
12 | */
13 | package org.jgrapht.experimental.alg;
14 |
15 | import java.util.Map;
16 |
17 |
18 | public interface ExactAlgorithm
19 | {
20 |
21 |
22 | ResultType getResult(Map optionalData);
23 | }
24 |
25 | // End ExactAlgorithm.java
26 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/experimental/alg/IntArrayGraphAlgorithm.java:
--------------------------------------------------------------------------------
1 | /* This program and the accompanying materials are dual-licensed under
2 | * either
3 | *
4 | * (a) the terms of the GNU Lesser General Public License version 2.1
5 | * as published by the Free Software Foundation, or (at your option) any
6 | * later version.
7 | *
8 | * or (per the licensee's choosing)
9 | *
10 | * (b) the terms of the Eclipse Public License v1.0 as published by
11 | * the Eclipse Foundation.
12 | */
13 | /**
14 | *
15 | */
16 | package org.jgrapht.experimental.alg;
17 |
18 | import java.util.ArrayList;
19 | import java.util.HashMap;
20 | import java.util.List;
21 | import java.util.Map;
22 |
23 | import org.jgrapht.Graph;
24 | import org.jgrapht.Graphs;
25 |
26 |
27 | /**
28 | * @author micha
29 | */
30 | public abstract class IntArrayGraphAlgorithm
31 | {
32 |
33 |
34 | protected final List _vertices;
35 | protected final int [][] _neighbors;
36 | protected final Map _vertexToPos;
37 |
38 |
39 |
40 | /**
41 | * @param g
42 | */
43 | public IntArrayGraphAlgorithm(final Graph g)
44 | {
45 | final int numVertices = g.vertexSet().size();
46 | _vertices = new ArrayList(numVertices);
47 | _neighbors = new int[numVertices][];
48 | _vertexToPos = new HashMap(numVertices);
49 | for (V vertex : g.vertexSet()) {
50 | _neighbors[_vertices.size()] = new int[g.edgesOf(vertex).size()];
51 | _vertexToPos.put(vertex, _vertices.size());
52 | _vertices.add(vertex);
53 | }
54 | for (int i = 0; i < numVertices; i++) {
55 | int nbIndex = 0;
56 | final V vertex = _vertices.get(i);
57 | for (E e : g.edgesOf(vertex)) {
58 | _neighbors[i][nbIndex++] =
59 | _vertexToPos.get(Graphs.getOppositeVertex(g, e, vertex));
60 | }
61 | }
62 | }
63 | }
64 |
65 | // End IntArrayGraphAlgorithm.java
66 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/experimental/equivalence/EquivalenceComparatorChain.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -----------------
23 | * EquivalenceComparatorChain.java
24 | * -----------------
25 | * (C) Copyright 2005-2008, by Assaf Lehr and Contributors.
26 | *
27 | * Original Author: Assaf Lehr
28 | * Contributor(s): -
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | */
35 | package org.jgrapht.experimental.equivalence;
36 |
37 | /**
38 | * A container of comparators, which are tested in a chain until the first
39 | * result can be supplied. It implements the EquivalenceComparator, so chains
40 | * can include other chains. The first check will use the current comparator and
41 | * not the next one. So, make sure to use the one which has better performance
42 | * first. (This class follows the "Composite" design-pattern).
43 | *
44 | * @param the type of the elements in the set
45 | * @param the type of the context the element is compared against, e.g. a
46 | * Graph
47 | *
48 | * @author Assaf
49 | * @since Jul 22, 2005
50 | */
51 | public interface EquivalenceComparatorChain
52 | extends EquivalenceComparator
53 | {
54 |
55 |
56 | /**
57 | * Adds a comparator which will also test equivalence. For
58 | * equivalenceCompare(), the return value is a logical AND of the two
59 | * comparators. The first check will use the first comparator before the
60 | * next one. Make sure to put the one which has better performance first.
61 | * For equivalenceHashcode(), the resulting hashes will be rehashed
62 | * together. This method may be used multiple times to create a long "chain"
63 | * of comparators.
64 | */
65 | public void appendComparator(EquivalenceComparator comparatorAfter);
66 | }
67 |
68 | // End EquivalenceComparatorChain.java
69 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/experimental/equivalence/UniformEquivalenceComparator.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -----------------
23 | * UniformEquivalenceComparator.java
24 | * -----------------
25 | * (C) Copyright 2005-2008, by Assaf Lehr and Contributors.
26 | *
27 | * Original Author: Assaf Lehr
28 | * Contributor(s): -
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | */
35 | package org.jgrapht.experimental.equivalence;
36 |
37 | /**
38 | * This Equivalence comparator acts as if all elements are in one big global
39 | * equivalence class. Useful when a comparator is needed, but there is no
40 | * important difference between the elements. equivalenceCompare() always return
41 | * true; equivalenceHashcode() always returns 0.
42 | *
43 | * @author Assaf
44 | * @since Jul 21, 2005
45 | */
46 | public class UniformEquivalenceComparator
47 | implements EquivalenceComparator
48 | {
49 |
50 |
51 | /**
52 | * Always returns true.
53 | *
54 | * @see EquivalenceComparator#equivalenceCompare(Object, Object, Object,
55 | * Object)
56 | */
57 | public boolean equivalenceCompare(
58 | E arg1,
59 | E arg2,
60 | C context1,
61 | C context2)
62 | {
63 | return true;
64 | }
65 |
66 | /**
67 | * Always returns 0.
68 | *
69 | * @see EquivalenceComparator#equivalenceHashcode(Object, Object)
70 | */
71 | public int equivalenceHashcode(E arg1, C context)
72 | {
73 | return 0;
74 | }
75 | }
76 |
77 | // End UniformEquivalenceComparator.java
78 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/experimental/equivalence/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Classes which enable working with Equivalence Sets.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/experimental/isomorphism/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Algorithms which provide isomorphism check between two graphs.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/experimental/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
A package that contains experimental work or work-in-progress that
5 | is not yet ready to be included in a release. It may contain classes
6 | that are: incomplete, not yet documented, have not yet reached a
7 | satisfying form, etc.
8 |
9 |
The only requirement for classes included here is to compile.
10 |
11 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/experimental/permutation/ArrayPermutationsIter.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -----------------
23 | * ArrayPermutationsIter.java
24 | * -----------------
25 | * (C) Copyright 2005-2008, by Assaf Lehr and Contributors.
26 | *
27 | * Original Author: Assaf Lehr
28 | * Contributor(s): -
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | */
35 | package org.jgrapht.experimental.permutation;
36 |
37 | /**
38 | * An interface to iterate over array permutations. Similiar to Iterator, but
39 | * with specific return types and without the remove() method.
40 | *
41 | * @author Assaf
42 | * @since Jul 29, 2005
43 | */
44 | public interface ArrayPermutationsIter
45 | {
46 |
47 |
48 | public int [] nextPermutation();
49 |
50 | public boolean hasNextPermutaions();
51 | }
52 |
53 | // End ArrayPermutationsIter.java
54 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/experimental/permutation/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Classes to provide all the possible permutations of arrays or sets.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/generate/EmptyGraphGenerator.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -------------------
23 | * EmptyGraphGenerator.java
24 | * -------------------
25 | * (C) Copyright 2003-2008, by John V. Sichi and Contributors.
26 | *
27 | * Original Author: John V. Sichi
28 | * Contributor(s): -
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 16-Sep-2003 : Initial revision (JVS);
35 | *
36 | */
37 | package org.jgrapht.generate;
38 |
39 | import java.util.Map;
40 |
41 | import org.jgrapht.Graph;
42 | import org.jgrapht.VertexFactory;
43 |
44 |
45 | /**
46 | * Generates an empty
47 | * graph of any size. An empty graph is a graph that has no edges.
48 | *
49 | * @author John V. Sichi
50 | * @since Sep 16, 2003
51 | */
52 | public class EmptyGraphGenerator
53 | implements GraphGenerator
54 | {
55 |
56 |
57 | private int size;
58 |
59 |
60 |
61 | /**
62 | * Construct a new EmptyGraphGenerator.
63 | *
64 | * @param size number of vertices to be generated
65 | *
66 | * @throws IllegalArgumentException if the specified size is negative.
67 | */
68 | public EmptyGraphGenerator(int size)
69 | {
70 | if (size < 0) {
71 | throw new IllegalArgumentException("must be non-negative");
72 | }
73 |
74 | this.size = size;
75 | }
76 |
77 |
78 |
79 | /**
80 | * {@inheritDoc}
81 | */
82 | public void generateGraph(
83 | Graph target,
84 | VertexFactory vertexFactory,
85 | Map resultMap)
86 | {
87 | for (int i = 0; i < size; ++i) {
88 | target.addVertex(vertexFactory.createVertex());
89 | }
90 | }
91 | }
92 |
93 | // End EmptyGraphGenerator.java
94 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/generate/WeightedGraphGenerator.java:
--------------------------------------------------------------------------------
1 | /* This program and the accompanying materials are dual-licensed under
2 | * either
3 | *
4 | * (a) the terms of the GNU Lesser General Public License version 2.1
5 | * as published by the Free Software Foundation, or (at your option) any
6 | * later version.
7 | *
8 | * or (per the licensee's choosing)
9 | *
10 | * (b) the terms of the Eclipse Public License v1.0 as published by
11 | * the Eclipse Foundation.
12 | */
13 | package org.jgrapht.generate;
14 |
15 | import org.jgrapht.EdgeFactory;
16 |
17 |
18 | public abstract class WeightedGraphGenerator
19 | implements GraphGenerator
20 | {
21 |
22 |
23 | protected Class extends E> edgeClass;
24 |
25 | protected EdgeFactory edgeFactory;
26 |
27 | protected double [][] weights;
28 |
29 |
30 |
31 | ///////////////////////////////////////////////////////////////////////////////////////////////
32 |
33 | public WeightedGraphGenerator edgeFactory(
34 | EdgeFactory edgeFactory)
35 | {
36 | this.edgeFactory = edgeFactory;
37 | return this;
38 | }
39 |
40 | public WeightedGraphGenerator edgeClass(Class extends E> edgeClass)
41 | {
42 | this.edgeClass = edgeClass;
43 | return this;
44 | }
45 |
46 | public WeightedGraphGenerator weights(double [][] weights)
47 | {
48 | this.weights = weights;
49 | return this;
50 | }
51 | }
52 |
53 | // End WeightedGraphGenerator.java
54 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/generate/WeightedGraphGeneratorAdapter.java:
--------------------------------------------------------------------------------
1 | /* This program and the accompanying materials are dual-licensed under
2 | * either
3 | *
4 | * (a) the terms of the GNU Lesser General Public License version 2.1
5 | * as published by the Free Software Foundation, or (at your option) any
6 | * later version.
7 | *
8 | * or (per the licensee's choosing)
9 | *
10 | * (b) the terms of the Eclipse Public License v1.0 as published by
11 | * the Eclipse Foundation.
12 | */
13 | package org.jgrapht.generate;
14 |
15 | import java.util.Map;
16 |
17 | import org.jgrapht.Graph;
18 | import org.jgrapht.VertexFactory;
19 | import org.jgrapht.WeightedGraph;
20 |
21 |
22 | /**
23 | * WeightedGraphGenerator defines an interface for generating graph structures
24 | * having edges weighted with real values.
25 | *
26 | * @author Alexey Kudinkin
27 | * @since Aug 1, 2013
28 | */
29 | public abstract class WeightedGraphGeneratorAdapter
30 | implements GraphGenerator
31 | {
32 |
33 |
34 | protected double [][] weights;
35 |
36 |
37 |
38 | ///////////////////////////////////////////////////////////////////////////////////////////////
39 |
40 | public abstract void generateGraph(
41 | WeightedGraph target,
42 | VertexFactory vertexFactory,
43 | Map resultMap);
44 |
45 | ///////////////////////////////////////////////////////////////////////////////////////////////
46 |
47 | public WeightedGraphGeneratorAdapter weights(double [][] weights)
48 | {
49 | this.weights = weights;
50 | return this;
51 | }
52 |
53 | @Override public void generateGraph(
54 | Graph target,
55 | VertexFactory vertexFactory,
56 | Map resultMap)
57 | {
58 | generateGraph((WeightedGraph) target, vertexFactory, resultMap);
59 | }
60 | }
61 |
62 | // End WeightedGraphGeneratorAdapter.java
63 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/generate/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Generators for graphs of various topologies.
5 |
6 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/DefaultDirectedWeightedGraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ---------------------------------
23 | * DefaultDirectedWeightedGraph.java
24 | * ---------------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 06-Jun-2005 : Made generic (CH);
36 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
37 | *
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import org.jgrapht.EdgeFactory;
42 | import org.jgrapht.WeightedGraph;
43 |
44 |
45 | /**
46 | * A directed weighted graph. A directed weighted graph is a non-simple directed
47 | * graph in which multiple edges between any two vertices are not
48 | * permitted, but loops are. The graph has weights on its edges.
49 | *
50 | * @see DefaultDirectedGraph
51 | */
52 | public class DefaultDirectedWeightedGraph
53 | extends DefaultDirectedGraph
54 | implements WeightedGraph
55 | {
56 |
57 |
58 | private static final long serialVersionUID = 3761405317841171513L;
59 |
60 |
61 |
62 | /**
63 | * Creates a new directed weighted graph.
64 | *
65 | * @param edgeClass class on which to base factory for edges
66 | */
67 | public DefaultDirectedWeightedGraph(Class extends E> edgeClass)
68 | {
69 | this(new ClassBasedEdgeFactory(edgeClass));
70 | }
71 |
72 | /**
73 | * Creates a new directed weighted graph with the specified edge factory.
74 | *
75 | * @param ef the edge factory of the new graph.
76 | */
77 | public DefaultDirectedWeightedGraph(EdgeFactory ef)
78 | {
79 | super(ef);
80 | }
81 | }
82 |
83 | // End DefaultDirectedWeightedGraph.java
84 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/DirectedMaskSubgraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -------------------------
23 | * DirectedMaskSubgraph.java
24 | * -------------------------
25 | * (C) Copyright 2007-2008, by France Telecom
26 | *
27 | * Original Author: Guillaume Boulmier and Contributors.
28 | *
29 | * $Id$
30 | *
31 | * Changes
32 | * -------
33 | * 05-Jun-2007 : Initial revision (GB);
34 | *
35 | */
36 | package org.jgrapht.graph;
37 |
38 | import org.jgrapht.DirectedGraph;
39 |
40 |
41 | /**
42 | * A directed graph that is a {@link MaskSubgraph} on another graph.
43 | *
44 | * @author Guillaume Boulmier
45 | * @since July 5, 2007
46 | */
47 | public class DirectedMaskSubgraph
48 | extends MaskSubgraph
49 | implements DirectedGraph
50 | {
51 |
52 |
53 | public DirectedMaskSubgraph(
54 | DirectedGraph base,
55 | MaskFunctor mask)
56 | {
57 | super(base, mask);
58 | }
59 | }
60 |
61 | // End DirectedMaskSubgraph.java
62 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/DirectedMultigraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -----------------------
23 | * DirectedMultigraph.java
24 | * -----------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 11-Mar-2004 : Made generic (CH);
36 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
37 | *
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import org.jgrapht.DirectedGraph;
42 | import org.jgrapht.EdgeFactory;
43 |
44 |
45 | /**
46 | * A directed multigraph. A directed multigraph is a non-simple directed graph
47 | * in which no loops are permitted, but multiple edges between any two vertices
48 | * are.
49 | */
50 | public class DirectedMultigraph
51 | extends AbstractBaseGraph
52 | implements DirectedGraph
53 | {
54 |
55 |
56 | private static final long serialVersionUID = 3258408413590599219L;
57 |
58 |
59 |
60 | /**
61 | * Creates a new directed multigraph.
62 | *
63 | * @param edgeClass class on which to base factory for edges
64 | */
65 | public DirectedMultigraph(Class extends E> edgeClass)
66 | {
67 | this(new ClassBasedEdgeFactory(edgeClass));
68 | }
69 |
70 | /**
71 | * Creates a new directed multigraph with the specified edge factory.
72 | *
73 | * @param ef the edge factory of the new graph.
74 | */
75 | public DirectedMultigraph(EdgeFactory ef)
76 | {
77 | super(ef, true, false);
78 | }
79 | }
80 |
81 | // End DirectedMultigraph.java
82 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/DirectedPseudograph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (barak_naveh@users.sourceforge.net)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ----------------
23 | * DirectedPseudograph.java
24 | * ----------------
25 | * (C) Copyright 2004-2008, by Christian Hammer and Contributors.
26 | *
27 | * Original Author: Christian Hammer
28 | * Contributor(s): -
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 11-Mar-2004 : Initial revision: generic (CH);
35 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
36 | *
37 | */
38 | package org.jgrapht.graph;
39 |
40 | import org.jgrapht.DirectedGraph;
41 | import org.jgrapht.EdgeFactory;
42 |
43 |
44 | /**
45 | * A directed pseudograph. A directed pseudograph is a non-simple directed graph
46 | * in which both graph loops and multiple edges are permitted. If you're unsure
47 | * about pseudographs, see:
49 | * http://mathworld.wolfram.com/Pseudograph.html.
50 | */
51 | public class DirectedPseudograph
52 | extends AbstractBaseGraph
53 | implements DirectedGraph
54 | {
55 |
56 |
57 | private static final long serialVersionUID = -8300409752893486415L;
58 |
59 |
60 |
61 | /**
62 | * @see AbstractBaseGraph
63 | */
64 | public DirectedPseudograph(Class extends E> edgeClass)
65 | {
66 | this(new ClassBasedEdgeFactory(edgeClass));
67 | }
68 |
69 | /**
70 | * @see AbstractBaseGraph
71 | */
72 | public DirectedPseudograph(EdgeFactory ef)
73 | {
74 | super(ef, true, true);
75 | }
76 | }
77 |
78 | // End DirectedPseudograph.java
79 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/DirectedWeightedMultigraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -------------------------------
23 | * DirectedWeightedMultigraph.java
24 | * -------------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 06-Jun-2005 : Made generic (CH);
36 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
37 | *
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import org.jgrapht.EdgeFactory;
42 | import org.jgrapht.WeightedGraph;
43 |
44 |
45 | /**
46 | * A directed weighted multigraph. A directed weighted multigraph is a
47 | * non-simple directed graph in which loops and multiple edges between any two
48 | * vertices are permitted, and edges have weights.
49 | */
50 | public class DirectedWeightedMultigraph
51 | extends DirectedMultigraph
52 | implements WeightedGraph
53 | {
54 |
55 |
56 | private static final long serialVersionUID = 4049071636005206066L;
57 |
58 |
59 |
60 | /**
61 | * Creates a new directed weighted multigraph.
62 | *
63 | * @param edgeClass class on which to base factory for edges
64 | */
65 | public DirectedWeightedMultigraph(Class extends E> edgeClass)
66 | {
67 | this(new ClassBasedEdgeFactory(edgeClass));
68 | }
69 |
70 | /**
71 | * Creates a new directed weighted multigraph with the specified edge
72 | * factory.
73 | *
74 | * @param ef the edge factory of the new graph.
75 | */
76 | public DirectedWeightedMultigraph(EdgeFactory ef)
77 | {
78 | super(ef);
79 | }
80 | }
81 |
82 | // End DirectedWeightedMultigraph.java
83 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/DirectedWeightedPseudograph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2013, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -------------------------------
23 | * DirectedWeightedPseudograph.java
24 | * -------------------------------
25 | * (C) Copyright 2003-2013, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer, Adam Gouge
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 06-Jun-2005 : Made generic (CH);
36 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
37 | * 08-Apr-2013 : Added DirectedWeightedPseudograph (AG)
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import org.jgrapht.EdgeFactory;
42 | import org.jgrapht.WeightedGraph;
43 |
44 |
45 | /**
46 | * A directed weighted pseudograph. A directed weighted pseudograph is a
47 | * non-simple directed graph in which both graph loops and multiple edges are
48 | * permitted, and edges have weights.
49 | */
50 | public class DirectedWeightedPseudograph
51 | extends DirectedPseudograph
52 | implements WeightedGraph
53 | {
54 |
55 |
56 | private static final long serialVersionUID = 8762514879586423517L;
57 |
58 |
59 |
60 | /**
61 | * Creates a new directed weighted pseudograph.
62 | *
63 | * @param edgeClass class on which to base factory for edges
64 | */
65 | public DirectedWeightedPseudograph(Class extends E> edgeClass)
66 | {
67 | this(new ClassBasedEdgeFactory(edgeClass));
68 | }
69 |
70 | /**
71 | * Creates a new directed weighted pseudograph with the specified edge
72 | * factory.
73 | *
74 | * @param ef the edge factory of the new graph.
75 | */
76 | public DirectedWeightedPseudograph(EdgeFactory ef)
77 | {
78 | super(ef);
79 | }
80 | }
81 |
82 | // End DirectedWeightedPseudograph.java
83 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/DirectedWeightedSubgraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -----------------------------
23 | * DirectedWeightedSubgraph.java
24 | * -----------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 06-Aug-2005 : Made generic (CH);
36 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
37 | *
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import java.util.Set;
42 |
43 | import org.jgrapht.DirectedGraph;
44 | import org.jgrapht.WeightedGraph;
45 |
46 |
47 | /**
48 | * A directed weighted graph that is a subgraph on other graph.
49 | *
50 | * @see Subgraph
51 | */
52 | public class DirectedWeightedSubgraph
53 | extends DirectedSubgraph
54 | implements WeightedGraph
55 | {
56 |
57 |
58 | private static final long serialVersionUID = 3905799799168250680L;
59 |
60 |
61 |
62 | /**
63 | * Creates a new weighted directed subgraph.
64 | *
65 | * @param base the base (backing) graph on which the subgraph will be based.
66 | * @param vertexSubset vertices to include in the subgraph. If
67 | * null then all vertices are included.
68 | * @param edgeSubset edges to in include in the subgraph. If
69 | * null then all the edges whose vertices found in the graph
70 | * are included.
71 | */
72 | public DirectedWeightedSubgraph(
73 | WeightedGraph base,
74 | Set vertexSubset,
75 | Set edgeSubset)
76 | {
77 | super((DirectedGraph) base, vertexSubset, edgeSubset);
78 | }
79 | }
80 |
81 | // End DirectedWeightedSubgraph.java
82 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/ListenableDirectedGraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ----------------------------
23 | * ListenableDirectedGraph.java
24 | * ----------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 11-Mar-2004 : Made generic (CH);
36 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
37 | *
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import org.jgrapht.DirectedGraph;
42 |
43 |
44 | /**
45 | * A directed graph which is also {@link org.jgrapht.ListenableGraph}.
46 | *
47 | * @see DefaultListenableGraph
48 | */
49 | public class ListenableDirectedGraph
50 | extends DefaultListenableGraph
51 | implements DirectedGraph
52 | {
53 |
54 |
55 | private static final long serialVersionUID = 3257571698126368824L;
56 |
57 |
58 |
59 | /**
60 | * Creates a new listenable directed graph.
61 | *
62 | * @param edgeClass class on which to base factory for edges
63 | */
64 | public ListenableDirectedGraph(Class extends E> edgeClass)
65 | {
66 | this(new DefaultDirectedGraph(edgeClass));
67 | }
68 |
69 | /**
70 | * Creates a new listenable directed graph.
71 | *
72 | * @param base the backing graph.
73 | */
74 | public ListenableDirectedGraph(DirectedGraph base)
75 | {
76 | super(base);
77 | }
78 | }
79 |
80 | // End ListenableDirectedGraph.java
81 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/ListenableDirectedWeightedGraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ------------------------------------
23 | * ListenableDirectedWeightedGraph.java
24 | * ------------------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id: ListenableDirectedWeightedGraph.java 485 2006-06-26 09:12:14Z
31 | * perfecthash $
32 | *
33 | * Changes
34 | * -------
35 | * 05-Aug-2003 : Initial revision (BN);
36 | * 06-Jun-2005 : Made generic (CH);
37 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
38 | *
39 | */
40 | package org.jgrapht.graph;
41 |
42 | import org.jgrapht.DirectedGraph;
43 | import org.jgrapht.WeightedGraph;
44 |
45 |
46 | /**
47 | * A directed weighted graph which is also {@link org.jgrapht.ListenableGraph}.
48 | *
49 | * @see DefaultListenableGraph
50 | */
51 | public class ListenableDirectedWeightedGraph
52 | extends ListenableDirectedGraph
53 | implements WeightedGraph
54 | {
55 |
56 |
57 | private static final long serialVersionUID = 3977582476627621938L;
58 |
59 |
60 |
61 | /**
62 | * Creates a new listenable directed weighted graph.
63 | *
64 | * @param edgeClass class on which to base factory for edges
65 | */
66 | public ListenableDirectedWeightedGraph(Class extends E> edgeClass)
67 | {
68 | this(new DefaultDirectedWeightedGraph(edgeClass));
69 | }
70 |
71 | /**
72 | * Creates a new listenable directed weighted graph.
73 | *
74 | * @param base the backing graph.
75 | */
76 | public ListenableDirectedWeightedGraph(WeightedGraph base)
77 | {
78 | super((DirectedGraph) base);
79 | }
80 | }
81 |
82 | // End ListenableDirectedWeightedGraph.java
83 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/ListenableUndirectedGraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ------------------------------
23 | * ListenableUndirectedGraph.java
24 | * ------------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 11-Mar-2004 : Made generic (CH);
36 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
37 | *
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import org.jgrapht.UndirectedGraph;
42 |
43 |
44 | /**
45 | * An undirected graph which is also {@link org.jgrapht.ListenableGraph}.
46 | *
47 | * @see DefaultListenableGraph
48 | */
49 | public class ListenableUndirectedGraph
50 | extends DefaultListenableGraph
51 | implements UndirectedGraph
52 | {
53 |
54 |
55 | private static final long serialVersionUID = 3256999969193145905L;
56 |
57 |
58 |
59 | /**
60 | * Creates a new listenable undirected simple graph.
61 | *
62 | * @param edgeClass class on which to base factory for edges
63 | */
64 | public ListenableUndirectedGraph(Class extends E> edgeClass)
65 | {
66 | this(new SimpleGraph(edgeClass));
67 | }
68 |
69 | /**
70 | * Creates a new listenable undirected graph.
71 | *
72 | * @param base the backing graph.
73 | */
74 | public ListenableUndirectedGraph(UndirectedGraph base)
75 | {
76 | super(base);
77 | }
78 | }
79 |
80 | // End ListenableUndirectedGraph.java
81 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/ListenableUndirectedWeightedGraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* --------------------------------------
23 | * ListenableUndirectedWeightedGraph.java
24 | * --------------------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id: ListenableUndirectedWeightedGraph.java 485 2006-06-26 09:12:14Z
31 | * perfecthash $
32 | *
33 | * Changes
34 | * -------
35 | * 05-Aug-2003 : Initial revision (BN);
36 | * 06-Jun-2005 : Made generic (CH);
37 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
38 | *
39 | */
40 | package org.jgrapht.graph;
41 |
42 | import org.jgrapht.UndirectedGraph;
43 | import org.jgrapht.WeightedGraph;
44 |
45 |
46 | /**
47 | * An undirected weighted graph which is also {@link
48 | * org.jgrapht.ListenableGraph}.
49 | *
50 | * @see DefaultListenableGraph
51 | */
52 | public class ListenableUndirectedWeightedGraph
53 | extends ListenableUndirectedGraph
54 | implements WeightedGraph
55 | {
56 |
57 |
58 | private static final long serialVersionUID = 3690762799613949747L;
59 |
60 |
61 |
62 | /**
63 | * Creates a new listenable undirected weighted graph.
64 | *
65 | * @param edgeClass class on which to base factory for edges
66 | */
67 | public ListenableUndirectedWeightedGraph(Class extends E> edgeClass)
68 | {
69 | this(new SimpleWeightedGraph(edgeClass));
70 | }
71 |
72 | /**
73 | * Creates a new listenable undirected weighted graph.
74 | *
75 | * @param base the backing graph.
76 | */
77 | public ListenableUndirectedWeightedGraph(WeightedGraph base)
78 | {
79 | super((UndirectedGraph) base);
80 | }
81 | }
82 |
83 | // End ListenableUndirectedWeightedGraph.java
84 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/MaskFunctor.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -------------------------
23 | * MaskFunctor.java
24 | * -------------------------
25 | * (C) Copyright 2007-2008, by France Telecom
26 | *
27 | * Original Author: Guillaume Boulmier and Contributors.
28 | *
29 | * $Id$
30 | *
31 | * Changes
32 | * -------
33 | * 05-Jun-2007 : Initial revision (GB);
34 | *
35 | */
36 | package org.jgrapht.graph;
37 |
38 | /**
39 | * A functor interface for masking out vertices and edges of a graph.
40 | *
41 | * @author Guillaume Boulmier
42 | * @since July 5, 2007
43 | */
44 | public interface MaskFunctor
45 | {
46 |
47 |
48 | /**
49 | * Returns true if the edge is masked, false
50 | * otherwise.
51 | *
52 | * @param edge edge.
53 | *
54 | * @return .
55 | */
56 | public boolean isEdgeMasked(E edge);
57 |
58 | /**
59 | * Returns true if the vertex is masked, false
60 | * otherwise.
61 | *
62 | * @param vertex vertex.
63 | *
64 | * @return .
65 | */
66 | public boolean isVertexMasked(V vertex);
67 | }
68 |
69 | // End MaskFunctor.java
70 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/Multigraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ---------------
23 | * Multigraph.java
24 | * ---------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 06-Aug-2005 : Made generic (CH);
36 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
37 | *
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import org.jgrapht.EdgeFactory;
42 | import org.jgrapht.UndirectedGraph;
43 |
44 |
45 | /**
46 | * A multigraph. A multigraph is a non-simple undirected graph in which no loops
47 | * are permitted, but multiple edges between any two vertices are. If you're
48 | * unsure about multigraphs, see:
50 | * http://mathworld.wolfram.com/Multigraph.html.
51 | */
52 | public class Multigraph
53 | extends AbstractBaseGraph
54 | implements UndirectedGraph
55 | {
56 |
57 |
58 | private static final long serialVersionUID = 3257001055819871795L;
59 |
60 |
61 |
62 | /**
63 | * Creates a new multigraph.
64 | *
65 | * @param edgeClass class on which to base factory for edges
66 | */
67 | public Multigraph(Class extends E> edgeClass)
68 | {
69 | this(new ClassBasedEdgeFactory(edgeClass));
70 | }
71 |
72 | /**
73 | * Creates a new multigraph with the specified edge factory.
74 | *
75 | * @param ef the edge factory of the new graph.
76 | */
77 | public Multigraph(EdgeFactory ef)
78 | {
79 | super(ef, true, false);
80 | }
81 | }
82 |
83 | // End Multigraph.java
84 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/Pseudograph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ----------------
23 | * Pseudograph.java
24 | * ----------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 11-Mar-2004 : Made generic (CH);
36 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
37 | *
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import org.jgrapht.EdgeFactory;
42 | import org.jgrapht.UndirectedGraph;
43 |
44 |
45 | /**
46 | * A pseudograph. A pseudograph is a non-simple undirected graph in which both
47 | * graph loops and multiple edges are permitted. If you're unsure about
48 | * pseudographs, see:
49 | * http://mathworld.wolfram.com/Pseudograph.html.
50 | */
51 | public class Pseudograph
52 | extends AbstractBaseGraph
53 | implements UndirectedGraph
54 | {
55 |
56 |
57 | private static final long serialVersionUID = 3833183614484755253L;
58 |
59 |
60 |
61 | /**
62 | * Creates a new pseudograph.
63 | *
64 | * @param edgeClass class on which to base factory for edges
65 | */
66 | public Pseudograph(Class extends E> edgeClass)
67 | {
68 | this(new ClassBasedEdgeFactory(edgeClass));
69 | }
70 |
71 | /**
72 | * Creates a new pseudograph with the specified edge factory.
73 | *
74 | * @param ef the edge factory of the new graph.
75 | */
76 | public Pseudograph(EdgeFactory ef)
77 | {
78 | super(ef, true, true);
79 | }
80 | }
81 |
82 | // End Pseudograph.java
83 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/SimpleDirectedGraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ------------------------
23 | * SimpleDirectedGraph.java
24 | * ------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 06-Aug-2005 : Made generic (CH);
36 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
37 | *
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import org.jgrapht.DirectedGraph;
42 | import org.jgrapht.EdgeFactory;
43 |
44 |
45 | /**
46 | * A simple directed graph. A simple directed graph is a directed graph in which
47 | * neither multiple edges between any two vertices nor loops are permitted.
48 | */
49 | public class SimpleDirectedGraph
50 | extends AbstractBaseGraph
51 | implements DirectedGraph
52 | {
53 |
54 |
55 | private static final long serialVersionUID = 4049358608472879671L;
56 |
57 |
58 |
59 | /**
60 | * Creates a new simple directed graph.
61 | *
62 | * @param edgeClass class on which to base factory for edges
63 | */
64 | public SimpleDirectedGraph(Class extends E> edgeClass)
65 | {
66 | this(new ClassBasedEdgeFactory(edgeClass));
67 | }
68 |
69 | /**
70 | * Creates a new simple directed graph with the specified edge factory.
71 | *
72 | * @param ef the edge factory of the new graph.
73 | */
74 | public SimpleDirectedGraph(EdgeFactory ef)
75 | {
76 | super(ef, false, false);
77 | }
78 | }
79 |
80 | // End SimpleDirectedGraph.java
81 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/SimpleDirectedWeightedGraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* --------------------------------
23 | * SimpleDirectedWeightedGraph.java
24 | * --------------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 06-Aug-2005 : Made generic (CH);
36 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
37 | *
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import org.jgrapht.EdgeFactory;
42 | import org.jgrapht.WeightedGraph;
43 |
44 |
45 | /**
46 | * A simple directed weighted graph. A simple directed weighted graph is a
47 | * simple directed graph for which edges are assigned weights.
48 | */
49 | public class SimpleDirectedWeightedGraph
50 | extends SimpleDirectedGraph
51 | implements WeightedGraph
52 | {
53 |
54 |
55 | private static final long serialVersionUID = 3904960841681220919L;
56 |
57 |
58 |
59 | /**
60 | * Creates a new simple directed weighted graph with the specified edge
61 | * factory.
62 | *
63 | * @param ef the edge factory of the new graph.
64 | */
65 | public SimpleDirectedWeightedGraph(EdgeFactory ef)
66 | {
67 | super(ef);
68 | }
69 |
70 | /**
71 | * Creates a new simple directed weighted graph.
72 | *
73 | * @param edgeClass class on which to base factory for edges
74 | */
75 | public SimpleDirectedWeightedGraph(Class extends E> edgeClass)
76 | {
77 | this(new ClassBasedEdgeFactory(edgeClass));
78 | }
79 | }
80 |
81 | // End SimpleDirectedWeightedGraph.java
82 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/SimpleGraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ----------------
23 | * SimpleGraph.java
24 | * ----------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): CHristian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 06-Aug-2005 : Made generic (CH);
36 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
37 | *
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import org.jgrapht.EdgeFactory;
42 | import org.jgrapht.UndirectedGraph;
43 |
44 |
45 | /**
46 | * A simple graph. A simple graph is an undirected graph for which at most one
47 | * edge connects any two vertices, and loops are not permitted. If you're unsure
48 | * about simple graphs, see:
50 | * http://mathworld.wolfram.com/SimpleGraph.html.
51 | */
52 | public class SimpleGraph
53 | extends AbstractBaseGraph
54 | implements UndirectedGraph
55 | {
56 |
57 |
58 | private static final long serialVersionUID = 3545796589454112304L;
59 |
60 |
61 |
62 | /**
63 | * Creates a new simple graph with the specified edge factory.
64 | *
65 | * @param ef the edge factory of the new graph.
66 | */
67 | public SimpleGraph(EdgeFactory ef)
68 | {
69 | super(ef, false, false);
70 | }
71 |
72 | /**
73 | * Creates a new simple graph.
74 | *
75 | * @param edgeClass class on which to base factory for edges
76 | */
77 | public SimpleGraph(Class extends E> edgeClass)
78 | {
79 | this(new ClassBasedEdgeFactory(edgeClass));
80 | }
81 | }
82 |
83 | // End SimpleGraph.java
84 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/SimpleWeightedGraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ------------------------
23 | * SimpleWeightedGraph.java
24 | * ------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 06-Aug-2005 : Made generic (CH);
36 | * 28-May-2006 : Moved connectivity info from edge to graph (JVS);
37 | *
38 | */
39 | package org.jgrapht.graph;
40 |
41 | import org.jgrapht.EdgeFactory;
42 | import org.jgrapht.WeightedGraph;
43 |
44 |
45 | /**
46 | * A simple weighted graph. A simple weighted graph is a simple graph for which
47 | * edges are assigned weights.
48 | */
49 | public class SimpleWeightedGraph
50 | extends SimpleGraph
51 | implements WeightedGraph
52 | {
53 |
54 |
55 | private static final long serialVersionUID = 3906088949100655922L;
56 |
57 |
58 |
59 | /**
60 | * Creates a new simple weighted graph with the specified edge factory.
61 | *
62 | * @param ef the edge factory of the new graph.
63 | */
64 | public SimpleWeightedGraph(EdgeFactory ef)
65 | {
66 | super(ef);
67 | }
68 |
69 | /**
70 | * Creates a new simple weighted graph.
71 | *
72 | * @param edgeClass class on which to base factory for edges
73 | */
74 | public SimpleWeightedGraph(Class extends E> edgeClass)
75 | {
76 | this(new ClassBasedEdgeFactory(edgeClass));
77 | }
78 | }
79 |
80 | // End SimpleWeightedGraph.java
81 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/UndirectedGraphUnion.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2009, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -------------------------
23 | * UndirectedGraphUnion.java
24 | * -------------------------
25 | * (C) Copyright 2009-2009, by Ilya Razenshteyn
26 | *
27 | * Original Author: Ilya Razenshteyn and Contributors.
28 | *
29 | * $Id$
30 | *
31 | * Changes
32 | * -------
33 | * 02-Feb-2009 : Initial revision (IR);
34 | *
35 | */
36 | package org.jgrapht.graph;
37 |
38 | import java.util.Set;
39 |
40 | import org.jgrapht.UndirectedGraph;
41 | import org.jgrapht.util.WeightCombiner;
42 |
43 |
44 | public class UndirectedGraphUnion
45 | extends GraphUnion>
46 | implements UndirectedGraph
47 | {
48 |
49 |
50 | private static final long serialVersionUID = -740199233080172450L;
51 |
52 |
53 |
54 | UndirectedGraphUnion(
55 | UndirectedGraph g1,
56 | UndirectedGraphUnion g2,
57 | WeightCombiner operator)
58 | {
59 | super(g1, g2, operator);
60 | }
61 |
62 | UndirectedGraphUnion(
63 | UndirectedGraph g1,
64 | UndirectedGraphUnion g2)
65 | {
66 | super(g1, g2);
67 | }
68 |
69 |
70 |
71 | public int degreeOf(V vertex)
72 | {
73 | Set res = edgesOf(vertex);
74 | return res.size();
75 | }
76 | }
77 |
78 | // End UndirectedGraphUnion.java
79 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/UndirectedMaskSubgraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -------------------------
23 | * UndirectedMaskSubgraph.java
24 | * -------------------------
25 | * (C) Copyright 2007-2008, by France Telecom
26 | *
27 | * Original Author: Guillaume Boulmier and Contributors.
28 | *
29 | * $Id$
30 | *
31 | * Changes
32 | * -------
33 | * 05-Jun-2007 : Initial revision (GB);
34 | *
35 | */
36 | package org.jgrapht.graph;
37 |
38 | import org.jgrapht.UndirectedGraph;
39 |
40 |
41 | /**
42 | * An undirected graph that is a {@link MaskSubgraph} on another graph.
43 | *
44 | * @author Guillaume Boulmier
45 | * @since July 5, 2007
46 | */
47 | public class UndirectedMaskSubgraph
48 | extends MaskSubgraph
49 | implements UndirectedGraph
50 | {
51 |
52 |
53 | public UndirectedMaskSubgraph(
54 | UndirectedGraph base,
55 | MaskFunctor mask)
56 | {
57 | super(base, mask);
58 | }
59 | }
60 |
61 | // End UndirectedMaskSubgraph.java
62 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/UndirectedWeightedSubgraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -------------------------------
23 | * UndirectedWeightedSubgraph.java
24 | * -------------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 06-Aug-2005 : Made generic (CH);
36 | *
37 | */
38 | package org.jgrapht.graph;
39 |
40 | import java.util.Set;
41 |
42 | import org.jgrapht.UndirectedGraph;
43 | import org.jgrapht.WeightedGraph;
44 |
45 |
46 | /**
47 | * An undirected weighted graph that is a subgraph on other graph.
48 | *
49 | * @see Subgraph
50 | */
51 | public class UndirectedWeightedSubgraph
52 | extends UndirectedSubgraph
53 | implements WeightedGraph
54 | {
55 |
56 |
57 | private static final long serialVersionUID = 3689346615735236409L;
58 |
59 |
60 |
61 | /**
62 | * Creates a new undirected weighted subgraph.
63 | *
64 | * @param base the base (backing) graph on which the subgraph will be based.
65 | * @param vertexSubset vertices to include in the subgraph. If
66 | * null then all vertices are included.
67 | * @param edgeSubset edges to in include in the subgraph. If
68 | * null then all the edges whose vertices found in the graph
69 | * are included.
70 | */
71 | public UndirectedWeightedSubgraph(
72 | WeightedGraph base,
73 | Set vertexSubset,
74 | Set edgeSubset)
75 | {
76 | super((UndirectedGraph) base, vertexSubset, edgeSubset);
77 | }
78 | }
79 |
80 | // End UndirectedWeightedSubgraph.java
81 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/UnmodifiableDirectedGraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* ------------------------------
23 | * UnmodifiableDirectedGraph.java
24 | * ------------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 11-Mar-2004 : Made generic (CH);
36 | *
37 | */
38 | package org.jgrapht.graph;
39 |
40 | import org.jgrapht.DirectedGraph;
41 |
42 |
43 | /**
44 | * A directed graph that cannot be modified.
45 | *
46 | * @see UnmodifiableGraph
47 | */
48 | public class UnmodifiableDirectedGraph
49 | extends UnmodifiableGraph
50 | implements DirectedGraph
51 | {
52 |
53 |
54 | private static final long serialVersionUID = 3978701783725913906L;
55 |
56 |
57 |
58 | /**
59 | * Creates a new unmodifiable directed graph based on the specified backing
60 | * graph.
61 | *
62 | * @param g the backing graph on which an unmodifiable graph is to be
63 | * created.
64 | */
65 | public UnmodifiableDirectedGraph(DirectedGraph g)
66 | {
67 | super(g);
68 | }
69 | }
70 |
71 | // End UnmodifiableDirectedGraph.java
72 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/UnmodifiableUndirectedGraph.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* --------------------------------
23 | * UnmodifiableUndirectedGraph.java
24 | * --------------------------------
25 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
26 | *
27 | * Original Author: Barak Naveh
28 | * Contributor(s): Christian Hammer
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | * 05-Aug-2003 : Initial revision (BN);
35 | * 11-Mar-2004 : Made generic (CH)
36 | *
37 | */
38 | package org.jgrapht.graph;
39 |
40 | import org.jgrapht.UndirectedGraph;
41 |
42 |
43 | /**
44 | * An undirected graph that cannot be modified.
45 | *
46 | * @see UnmodifiableGraph
47 | */
48 | public class UnmodifiableUndirectedGraph
49 | extends UnmodifiableGraph
50 | implements UndirectedGraph
51 | {
52 |
53 |
54 | private static final long serialVersionUID = 3258134639355704624L;
55 |
56 |
57 |
58 | /**
59 | * Creates a new unmodifiable undirected graph based on the specified
60 | * backing graph.
61 | *
62 | * @param g the backing graph on which an unmodifiable graph is to be
63 | * created.
64 | */
65 | public UnmodifiableUndirectedGraph(UndirectedGraph g)
66 | {
67 | super(g);
68 | }
69 | }
70 |
71 | // End UnmodifiableUndirectedGraph.java
72 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/graph/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Implementations of various graphs.
5 |
6 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The front-end API's interfaces and classes, including {@link org.jgrapht.Graph},
5 | {@link org.jgrapht.DirectedGraph} and {@link org.jgrapht.UndirectedGraph}.
6 |
7 |
8 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/traverse/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Graph traversal means.
5 |
6 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/util/MathUtil.java:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | * JGraphT : a free Java graph-theory library
3 | * ==========================================
4 | *
5 | * Project Info: http://jgrapht.sourceforge.net/
6 | * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7 | *
8 | * (C) Copyright 2003-2008, by Barak Naveh and Contributors.
9 | *
10 | * This program and the accompanying materials are dual-licensed under
11 | * either
12 | *
13 | * (a) the terms of the GNU Lesser General Public License version 2.1
14 | * as published by the Free Software Foundation, or (at your option) any
15 | * later version.
16 | *
17 | * or (per the licensee's choosing)
18 | *
19 | * (b) the terms of the Eclipse Public License v1.0 as published by
20 | * the Eclipse Foundation.
21 | */
22 | /* -----------------
23 | * MathUtil.java
24 | * -----------------
25 | * (C) Copyright 2005-2008, by Assaf Lehr and Contributors.
26 | *
27 | * Original Author: Assaf Lehr
28 | * Contributor(s): -
29 | *
30 | * $Id$
31 | *
32 | * Changes
33 | * -------
34 | */
35 | package org.jgrapht.util;
36 |
37 | /**
38 | * Math Utilities. Currently contains the following:
39 | *
factorial(int N) - caclulate the factorial of N (aka N!)
40 | *
41 | * @author Assaf
42 | * @since May 30, 2005
43 | */
44 | public class MathUtil
45 | {
46 |
47 |
48 | public static long factorial(int N)
49 | {
50 | long multi = 1;
51 | for (int i = 1; i <= N; i++) {
52 | multi = multi * i;
53 | }
54 | return multi;
55 | }
56 | }
57 |
58 | // End MathUtil.java
59 |
--------------------------------------------------------------------------------
/jgrapht/src/main/removed/org/jgrapht/util/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Non-graph-specific data structures, algorithms, and utilities used by
5 | JGraphT.
6 |
7 |
8 |
--------------------------------------------------------------------------------
/meta/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
23 |
24 |
27 | 4.0.0
28 |
29 |
30 | org.jboss.gwt.circuit
31 | circuit-parent
32 | 0.2.0
33 |
34 |
35 | circuit-meta
36 | circuit :: Metadata
37 | Metadata annotation to generate circuit stores and dispatcher.
38 | gwt-lib
39 |
40 |
41 |
42 | org.jboss.gwt.circuit
43 | circuit-core
44 |
45 |
46 | com.google.gwt
47 | gwt-user
48 |
49 |
50 |
51 |
52 |
53 |
54 | net.ltgt.gwt.maven
55 | gwt-maven-plugin
56 | true
57 |
58 | org.jboss.gwt.circuit.Meta
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/meta/src/main/java/module.gwt.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/meta/src/main/java/org/jboss/gwt/circuit/meta/Process.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.meta;
23 |
24 | import org.jboss.gwt.circuit.Action;
25 |
26 | import java.lang.annotation.ElementType;
27 | import java.lang.annotation.Retention;
28 | import java.lang.annotation.RetentionPolicy;
29 | import java.lang.annotation.Target;
30 |
31 | /**
32 | * Marks a method within a class annotated with {@link Store} as the method which should receive actions.
33 | * The method must return void and must match one of these signatures:
34 | *
35 | *
Action w/o payload: A single parameter of type {@link org.jboss.gwt.circuit.Dispatcher.Channel} is required
36 | *
Action with payload: Two parameters. The first is the action, the second the
37 | * {@link org.jboss.gwt.circuit.Dispatcher.Channel}
38 | *
39 | */
40 | @Retention(RetentionPolicy.RUNTIME)
41 | @Target({ElementType.METHOD})
42 | public @interface Process {
43 |
44 | Class extends Action> actionType();
45 |
46 | Class>[] dependencies() default {};
47 | }
48 |
--------------------------------------------------------------------------------
/meta/src/main/java/org/jboss/gwt/circuit/meta/Store.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.meta;
23 |
24 | import java.lang.annotation.ElementType;
25 | import java.lang.annotation.Inherited;
26 | import java.lang.annotation.Retention;
27 | import java.lang.annotation.RetentionPolicy;
28 | import java.lang.annotation.Target;
29 |
30 | /**
31 | * Marks a class as a store implementation.
32 | */
33 | @Inherited
34 | @Retention(RetentionPolicy.RUNTIME)
35 | @Target({ElementType.TYPE})
36 | public @interface Store {
37 | }
38 |
--------------------------------------------------------------------------------
/processor/.gitignore:
--------------------------------------------------------------------------------
1 | dependency-reduced-pom.xml
--------------------------------------------------------------------------------
/processor/src/main/java/org/jboss/gwt/circuit/processor/GenerationException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.processor;
23 |
24 | import javax.lang.model.element.Element;
25 |
26 | public class GenerationException extends RuntimeException {
27 |
28 | private final Element element;
29 |
30 | public GenerationException(final String msg) {
31 | this(null, msg);
32 | }
33 |
34 | public GenerationException(final Element element, final String msg) {
35 | super(msg);
36 | this.element = element;
37 | }
38 |
39 | public Element getElement() {
40 | return element;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/processor/src/main/java/org/jboss/gwt/circuit/processor/GraphVizGenerator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.processor;
23 |
24 | import java.util.Collection;
25 | import java.util.HashMap;
26 | import java.util.Map;
27 |
28 | class GraphVizGenerator extends AbstractGenerator {
29 |
30 | StringBuffer generate(final Collection graphVizInfos)
31 | throws GenerationException {
32 |
33 | Map context = new HashMap<>();
34 | context.put("graphVizInfos", graphVizInfos);
35 | return generate(context, "dependencies.ftl");
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/processor/src/main/java/org/jboss/gwt/circuit/processor/GraphVizInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.processor;
23 |
24 | import java.util.ArrayList;
25 | import java.util.HashSet;
26 | import java.util.List;
27 | import java.util.Set;
28 |
29 | public class GraphVizInfo {
30 | private final String payload;
31 | private final Set stores;
32 | private final List dependencies;
33 |
34 | public GraphVizInfo(final String payload) {
35 | this.payload = payload;
36 | this.stores = new HashSet<>();
37 | this.dependencies = new ArrayList<>();
38 | }
39 |
40 | public void addStore(final String store) {
41 | this.stores.add(store);
42 | }
43 |
44 | public void addDependency(final String source, final String sink) {
45 | this.dependencies.add(new String[]{source, sink});
46 | }
47 |
48 | public String getPayload() {
49 | return payload;
50 | }
51 |
52 | public Set getStores() {
53 | return stores;
54 | }
55 |
56 | public List getDependencies() {
57 | return dependencies;
58 | }
59 |
60 | @Override
61 | public boolean equals(final Object o) {
62 | if (this == o) { return true; }
63 | if (!(o instanceof GraphVizInfo)) { return false; }
64 |
65 | GraphVizInfo that = (GraphVizInfo) o;
66 |
67 | if (!payload.equals(that.payload)) { return false; }
68 |
69 | return true;
70 | }
71 |
72 | @Override
73 | public int hashCode() {
74 | return payload.hashCode();
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/processor/src/main/java/org/jboss/gwt/circuit/processor/StoreDelegateMetadata.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.processor;
23 |
24 | import java.util.Collection;
25 |
26 | class StoreDelegateMetadata {
27 |
28 | final String packageName;
29 | final String storeClassName;
30 | final String storeDelegate;
31 | final boolean changeSupport;
32 | final Collection processInfos;
33 |
34 | StoreDelegateMetadata(final String packageName, final String storeClassName, final String storeDelegate,
35 | final boolean changeSupport, final Collection processInfos) {
36 | this.packageName = packageName;
37 | this.storeClassName = storeClassName;
38 | this.storeDelegate = storeDelegate;
39 | this.changeSupport = changeSupport;
40 | this.processInfos = processInfos;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/processor/src/main/java/org/jboss/gwt/circuit/processor/StoreGenerator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.processor;
23 |
24 | import java.util.HashMap;
25 | import java.util.Map;
26 |
27 | class StoreGenerator extends AbstractGenerator {
28 |
29 | public StringBuffer generate(final StoreDelegateMetadata metadata) throws GenerationException {
30 | Map context = new HashMap<>();
31 | context.put("packageName", metadata.packageName);
32 | context.put("storeClassName", metadata.storeClassName);
33 | context.put("storeDelegate", metadata.storeDelegate);
34 | context.put("changeSupport", metadata.changeSupport);
35 | context.put("processInfos", metadata.processInfos);
36 | return generate(context, "Store.ftl");
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/processor/src/main/resources/org/jboss/gwt/circuit/processor/templates/dependencies.ftl:
--------------------------------------------------------------------------------
1 | <#-- @ftlvariable name="graphVizInfos" type="java.util.Set" -->
2 | digraph store_dependencies {
3 |
4 | graph [fontname="Helvetica"];
5 | node [fontname="Helvetica"];
6 | edge [fontname="Helvetica"];
7 |
8 | label="Store Dependencies";
9 | labelloc=top;
10 |
11 | <#list graphVizInfos as graphVizInfo>
12 | subgraph cluster_${graphVizInfo.payload} {
13 | label="Action '${graphVizInfo.payload}'";
14 | <#list graphVizInfo.dependencies as dependency>
15 | ${graphVizInfo.payload}_${dependency[0]} -> ${graphVizInfo.payload}_${dependency[1]};
16 | #list>
17 |
18 | <#list graphVizInfo.stores as store>
19 | ${graphVizInfo.payload}_${store} [label="${store}"];
20 | #list>
21 | }
22 | #list>
23 | }
--------------------------------------------------------------------------------
/samples/bookstore/src/main/java/org/jboss/gwt/circuit/sample/bookstore/Book.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.bookstore;
23 |
24 | public class Book {
25 |
26 | private final String isbn;
27 | private final String title;
28 | private final String author;
29 |
30 | public Book(String isbn, String title, String author) {
31 | this.isbn = isbn;
32 | this.title = title;
33 | this.author = author;
34 | }
35 |
36 | @Override
37 | public boolean equals(Object o) {
38 | if (this == o) return true;
39 | if (!(o instanceof Book)) return false;
40 |
41 | Book book = (Book) o;
42 |
43 | if (!isbn.equals(book.isbn)) return false;
44 |
45 | return true;
46 | }
47 |
48 | @Override
49 | public int hashCode() {
50 | return isbn.hashCode();
51 | }
52 |
53 | @Override
54 | public String toString() {
55 | return "Book(" + isbn + ": " + title + " by " + author + + ')';
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/samples/bookstore/src/main/java/org/jboss/gwt/circuit/sample/bookstore/Rate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.bookstore;
23 |
24 | import org.jboss.gwt.circuit.Action;
25 |
26 | public class Rate implements Action {
27 |
28 | private final Book book;
29 | private final int stars;
30 |
31 | public Rate(Book book, int stars) {
32 | this.book = book;
33 | this.stars = stars;
34 | }
35 |
36 | @Override
37 | public boolean equals(Object o) {
38 | if (this == o) return true;
39 | if (!(o instanceof Rate)) return false;
40 |
41 | Rate rate = (Rate) o;
42 |
43 | if (stars != rate.stars) return false;
44 | if (!book.equals(rate.book)) return false;
45 |
46 | return true;
47 | }
48 |
49 | @Override
50 | public int hashCode() {
51 | int result = book.hashCode();
52 | result = 31 * result + stars;
53 | return result;
54 | }
55 |
56 | @Override
57 | public String toString() {
58 | return "Rate(" + book + ": " + stars + " stars)";
59 | }
60 |
61 | public Book getBook() {
62 | return book;
63 | }
64 |
65 | public int getStars() {
66 | return stars;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/samples/bookstore/src/test/java/org/jboss/gwt/circuit/sample/bookstore/BookStoreTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.bookstore;
23 |
24 | import org.jboss.gwt.circuit.Dispatcher;
25 | import org.jboss.gwt.circuit.dag.DAGDispatcher;
26 | import org.junit.Before;
27 | import org.junit.Test;
28 |
29 | import static org.junit.Assert.assertEquals;
30 | import static org.junit.Assert.assertTrue;
31 |
32 | public class BookStoreTest {
33 |
34 | private Dispatcher dispatcher;
35 | private BookStore store;
36 | private Book book;
37 |
38 | @Before
39 | public void setUp() {
40 | dispatcher = new DAGDispatcher();
41 | store = new BookStore();
42 | new BookStoreAdapter(store, dispatcher);
43 | book = new Book("isbn-978-0345417954", "The Hotel New Hampshire", "John Irving");
44 | }
45 |
46 | @Test
47 | public void rate() {
48 | dispatcher.dispatch(new Rate(book, 1));
49 | dispatcher.dispatch(new Rate(book, 2));
50 | dispatcher.dispatch(new Rate(book, 3));
51 | dispatcher.dispatch(new Rate(book, 4));
52 | dispatcher.dispatch(new Rate(book, 5));
53 |
54 | assertEquals(3.0, store.getRating(book), .01);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/samples/calculator/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
23 |
24 |
27 | 4.0.0
28 |
29 |
30 | org.jboss.gwt.circuit
31 | circuit-samples-parent
32 | 0.2.0
33 |
34 |
35 | circuit-calculator-sample
36 | circuit :: Samples :: Calculator
37 |
38 | Console based circuit sample simulating a calculator. Uses a simple sequential dispatcher implementation without
39 | locking and dependency resolution.
40 |
41 | jar
42 |
43 |
44 |
45 | com.google.gwt
46 | gwt-user
47 |
48 |
49 |
--------------------------------------------------------------------------------
/samples/calculator/src/main/java/org/jboss/gwt/circuit/sample/calculator/Calculator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.calculator;
23 |
24 | import java.util.Random;
25 |
26 | import org.jboss.gwt.circuit.Dispatcher;
27 | import org.jboss.gwt.circuit.sample.calculator.views.InputView;
28 | import org.jboss.gwt.circuit.sample.calculator.views.StatsView;
29 | import org.jboss.gwt.circuit.sample.calculator.views.TermsView;
30 |
31 | public class Calculator {
32 |
33 | public static void main(String[] args) {
34 | int numberOfActions = 5 + new Random().nextInt(5);
35 | System.out.printf("~=~=~=~=~ Dispatching %d actions\n\n", numberOfActions);
36 | new Calculator(numberOfActions).run();
37 | System.out.printf("~=~=~=~=~ Finished with %d actions\n", numberOfActions);
38 | }
39 |
40 | private final int numberOfActions;
41 | private final Dispatcher dispatcher;
42 | private final CalculatorStore store;
43 |
44 | public Calculator(final int numberOfActions) {
45 | this.numberOfActions = numberOfActions;
46 | this.dispatcher = new SequentialDispatcher();
47 | this.store = new CalculatorStore(dispatcher);
48 | }
49 |
50 | public void run() {
51 | new StatsView(store);
52 | new TermsView(store);
53 | new InputView(dispatcher, numberOfActions).dispatch();
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/samples/calculator/src/main/java/org/jboss/gwt/circuit/sample/calculator/NoopAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.calculator;
23 |
24 | import org.jboss.gwt.circuit.Action;
25 |
26 | public class NoopAction implements Action {
27 | }
28 |
--------------------------------------------------------------------------------
/samples/calculator/src/main/java/org/jboss/gwt/circuit/sample/calculator/views/InputView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.calculator.views;
23 |
24 | import org.jboss.gwt.circuit.Action;
25 | import org.jboss.gwt.circuit.Dispatcher;
26 | import org.jboss.gwt.circuit.sample.calculator.NoopAction;
27 | import org.jboss.gwt.circuit.sample.calculator.Term;
28 |
29 | import java.util.ArrayList;
30 | import java.util.List;
31 | import java.util.Random;
32 |
33 | import static org.jboss.gwt.circuit.sample.calculator.Term.Op;
34 |
35 | public class InputView implements View {
36 |
37 | private final Dispatcher dispatcher;
38 | private List actions;
39 |
40 | public InputView(final Dispatcher dispatcher, int numberOfActions) {
41 | this.dispatcher = dispatcher;
42 | this.actions = actionStream(numberOfActions);
43 | }
44 |
45 | public void dispatch() {
46 | for (Action action : actions) {
47 | dispatcher.dispatch(action);
48 | }
49 | }
50 |
51 | private List actionStream(int size) {
52 | Random random = new Random();
53 | List actions = new ArrayList<>(size);
54 |
55 | for (int i = 0; i < size; i++) {
56 | Op op = Op.values()[random.nextInt(Op.values().length)];
57 | boolean noop = 1 + random.nextInt(11) % 4 == 4;
58 | Action action = noop ? new NoopAction() : new Term(1 + random.nextInt(10), op, 1 + random.nextInt(10));
59 | actions.add(action);
60 | }
61 | return actions;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/samples/calculator/src/main/java/org/jboss/gwt/circuit/sample/calculator/views/TermsView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.calculator.views;
23 |
24 | import org.jboss.gwt.circuit.Action;
25 | import org.jboss.gwt.circuit.PropagatesChange;
26 | import org.jboss.gwt.circuit.sample.calculator.CalculatorStore;
27 |
28 | public class TermsView implements View {
29 |
30 | public TermsView(final CalculatorStore store) {
31 | store.addChangeHandler(new PropagatesChange.ChangeHandler() {
32 | @Override
33 | public void onChange(final Action action) {
34 | System.out.printf("Number of terms: %d\n", store.getResults().size());
35 | }
36 | });
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/samples/calculator/src/main/java/org/jboss/gwt/circuit/sample/calculator/views/View.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.calculator.views;
23 |
24 | /**
25 | * Just a marker interface to label something as 'view'.
26 | */
27 | public interface View {
28 | }
29 |
--------------------------------------------------------------------------------
/samples/calculator/src/test/java/org/jboss/gwt/circuit/sample/calculator/CalculatorTest.java:
--------------------------------------------------------------------------------
1 | package org.jboss.gwt.circuit.sample.calculator;
2 |
3 | import java.util.Random;
4 |
5 | import org.junit.Test;
6 |
7 | public class CalculatorTest {
8 |
9 | @Test
10 | public void run() {
11 | int numberOfActions = 5 + new Random().nextInt(5);
12 | new Calculator(numberOfActions).run();
13 | }
14 | }
--------------------------------------------------------------------------------
/samples/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
23 |
24 |
27 | 4.0.0
28 |
29 |
30 | org.jboss.gwt.circuit
31 | circuit-parent
32 | 0.2.0
33 |
34 |
35 | circuit-samples-parent
36 | circuit :: Samples
37 | Standalone and GWT Samples
38 | pom
39 |
40 |
41 | bookstore
42 | calculator
43 | wardrobe
44 | wmm
45 |
46 |
47 |
48 |
49 | org.jboss.gwt.circuit
50 | circuit-core
51 |
52 |
53 |
--------------------------------------------------------------------------------
/samples/wardrobe/src/main/java/org/jboss/gwt/circuit/sample/wardrobe/actions/Dress.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wardrobe.actions;
23 |
24 | import org.jboss.gwt.circuit.Action;
25 |
26 | public class Dress implements Action {}
27 |
--------------------------------------------------------------------------------
/samples/wardrobe/src/main/java/org/jboss/gwt/circuit/sample/wardrobe/actions/Undress.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wardrobe.actions;
23 |
24 | import org.jboss.gwt.circuit.Action;
25 |
26 | public class Undress implements Action{}
27 |
--------------------------------------------------------------------------------
/samples/wardrobe/src/main/java/org/jboss/gwt/circuit/sample/wardrobe/stores/CoatStore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wardrobe.stores;
23 |
24 | import org.jboss.gwt.circuit.Dispatcher;
25 | import org.jboss.gwt.circuit.meta.Process;
26 | import org.jboss.gwt.circuit.meta.Store;
27 | import org.jboss.gwt.circuit.sample.wardrobe.actions.Dress;
28 | import org.jboss.gwt.circuit.sample.wardrobe.actions.Undress;
29 |
30 | @Store
31 | public class CoatStore {
32 |
33 | @Process(actionType = Dress.class, dependencies = {PulloverStore.class, TrousersStore.class})
34 | public void dress(Dispatcher.Channel channel) {
35 | channel.ack();
36 | }
37 |
38 | @Process(actionType = Undress.class)
39 | public void undress(Dispatcher.Channel channel) {
40 | channel.ack();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples/wardrobe/src/main/java/org/jboss/gwt/circuit/sample/wardrobe/stores/PulloverStore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wardrobe.stores;
23 |
24 | import org.jboss.gwt.circuit.Dispatcher;
25 | import org.jboss.gwt.circuit.meta.Process;
26 | import org.jboss.gwt.circuit.meta.Store;
27 | import org.jboss.gwt.circuit.sample.wardrobe.actions.Dress;
28 | import org.jboss.gwt.circuit.sample.wardrobe.actions.Undress;
29 |
30 | @Store
31 | public class PulloverStore {
32 |
33 | @Process(actionType = Dress.class, dependencies = UndershirtStore.class)
34 | public void dress(Dispatcher.Channel channel) {
35 | channel.ack();
36 | }
37 |
38 | @Process(actionType = Undress.class, dependencies = CoatStore.class)
39 | public void undress(Dispatcher.Channel channel) {
40 | channel.ack();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples/wardrobe/src/main/java/org/jboss/gwt/circuit/sample/wardrobe/stores/ShoesStore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wardrobe.stores;
23 |
24 | import org.jboss.gwt.circuit.Dispatcher;
25 | import org.jboss.gwt.circuit.meta.Process;
26 | import org.jboss.gwt.circuit.meta.Store;
27 | import org.jboss.gwt.circuit.sample.wardrobe.actions.Dress;
28 | import org.jboss.gwt.circuit.sample.wardrobe.actions.Undress;
29 |
30 | @Store
31 | public class ShoesStore {
32 |
33 | @Process(actionType = Dress.class, dependencies = {TrousersStore.class, SocksStore.class})
34 | public void dress(Dispatcher.Channel channel) {
35 | channel.ack();
36 | }
37 |
38 | @Process(actionType = Undress.class)
39 | public void undress(Dispatcher.Channel channel) {
40 | channel.ack();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples/wardrobe/src/main/java/org/jboss/gwt/circuit/sample/wardrobe/stores/SocksStore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wardrobe.stores;
23 |
24 | import org.jboss.gwt.circuit.Dispatcher;
25 | import org.jboss.gwt.circuit.meta.Process;
26 | import org.jboss.gwt.circuit.meta.Store;
27 | import org.jboss.gwt.circuit.sample.wardrobe.actions.Dress;
28 | import org.jboss.gwt.circuit.sample.wardrobe.actions.Undress;
29 |
30 | @Store
31 | public class SocksStore {
32 |
33 | @Process(actionType = Dress.class)
34 | public void dress(Dispatcher.Channel channel) {
35 | channel.ack();
36 | }
37 |
38 | @Process(actionType = Undress.class, dependencies = ShoesStore.class)
39 | public void undress(Dispatcher.Channel channel) {
40 | channel.ack();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples/wardrobe/src/main/java/org/jboss/gwt/circuit/sample/wardrobe/stores/TrousersStore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wardrobe.stores;
23 |
24 | import org.jboss.gwt.circuit.Dispatcher;
25 | import org.jboss.gwt.circuit.meta.Process;
26 | import org.jboss.gwt.circuit.meta.Store;
27 | import org.jboss.gwt.circuit.sample.wardrobe.actions.Dress;
28 | import org.jboss.gwt.circuit.sample.wardrobe.actions.Undress;
29 |
30 | @Store
31 | public class TrousersStore {
32 |
33 | @Process(actionType = Dress.class, dependencies = UnderwearStore.class)
34 | public void dress(Dispatcher.Channel channel) {
35 | channel.ack();
36 | }
37 |
38 | @Process(actionType = Undress.class, dependencies = {CoatStore.class, ShoesStore.class})
39 | public void undress(Dispatcher.Channel channel) {
40 | channel.ack();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples/wardrobe/src/main/java/org/jboss/gwt/circuit/sample/wardrobe/stores/UndershirtStore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wardrobe.stores;
23 |
24 | import org.jboss.gwt.circuit.Dispatcher;
25 | import org.jboss.gwt.circuit.meta.Process;
26 | import org.jboss.gwt.circuit.meta.Store;
27 | import org.jboss.gwt.circuit.sample.wardrobe.actions.Dress;
28 | import org.jboss.gwt.circuit.sample.wardrobe.actions.Undress;
29 |
30 | @Store
31 | public class UndershirtStore {
32 |
33 | @Process(actionType = Dress.class)
34 | public void dress(Dispatcher.Channel channel) {
35 | channel.ack();
36 | }
37 |
38 | @Process(actionType = Undress.class, dependencies = PulloverStore.class)
39 | public void undress(Dispatcher.Channel channel) {
40 | channel.ack();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples/wardrobe/src/main/java/org/jboss/gwt/circuit/sample/wardrobe/stores/UnderwearStore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wardrobe.stores;
23 |
24 | import org.jboss.gwt.circuit.Dispatcher;
25 | import org.jboss.gwt.circuit.meta.Process;
26 | import org.jboss.gwt.circuit.meta.Store;
27 | import org.jboss.gwt.circuit.sample.wardrobe.actions.Dress;
28 | import org.jboss.gwt.circuit.sample.wardrobe.actions.Undress;
29 |
30 | @Store
31 | public class UnderwearStore {
32 |
33 | @Process(actionType = Dress.class)
34 | public void dress(Dispatcher.Channel channel) {
35 | channel.ack();
36 | }
37 |
38 | @Process(actionType = Undress.class, dependencies = TrousersStore.class)
39 | public void undress(Dispatcher.Channel channel) {
40 | channel.ack();
41 | }
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/samples/wardrobe/src/test/java/org/jboss/gwt/circuit/sample/wardrobe/OrderRecorder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wardrobe;
23 |
24 | import org.jboss.gwt.circuit.Action;
25 | import org.jboss.gwt.circuit.dag.DAGDispatcher;
26 |
27 | import java.util.ArrayList;
28 | import java.util.Collections;
29 | import java.util.List;
30 |
31 | public class OrderRecorder implements DAGDispatcher.Diagnostics {
32 |
33 | private final List> order;
34 |
35 | public OrderRecorder() {
36 | order = new ArrayList<>();
37 | }
38 |
39 | @Override
40 | public void onDispatch(final Action a) {
41 | // noop
42 | }
43 |
44 | @Override
45 | public void onLock() {
46 | // noop
47 | }
48 |
49 | @Override
50 | public void onExecute(final Class> s, final Action a) {
51 | // noop
52 | }
53 |
54 | @Override
55 | public void onAck(final Class> s, final Action a) {
56 | order.add(s);
57 | }
58 |
59 | @Override
60 | public void onNack(Class> store, Action action, String reason) {
61 | // noop
62 | }
63 |
64 | @Override
65 | public void onNack(final Class> s, final Action a, final Throwable t) {
66 | // noop
67 | }
68 |
69 | @Override
70 | public void onUnlock() {
71 | // noop
72 | }
73 |
74 | public List> getOrder() {
75 | return Collections.unmodifiableList(order);
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/samples/wmm/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
23 |
24 |
27 | 4.0.0
28 |
29 |
30 | org.jboss.gwt.circuit
31 | circuit-samples-parent
32 | 0.2.0
33 |
34 |
35 | circuit-wmm-sample
36 | circuit :: Samples :: WildFly Management Model
37 |
38 | Console based circuit sample simulating parts of the WildFly management Model. Uses the DAG dispatcher without
39 | the meta annotations.
40 |
41 | jar
42 |
43 |
44 |
45 | com.google.guava
46 | guava
47 |
48 |
49 |
--------------------------------------------------------------------------------
/samples/wmm/src/main/java/org/jboss/gwt/circuit/sample/wmm/actions/DeployAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wmm.actions;
23 |
24 | import org.jboss.gwt.circuit.Action;
25 |
26 | public class DeployAction implements Action {
27 |
28 | private final Deployment deployment;
29 |
30 | public DeployAction(final Deployment deployment) {this.deployment = deployment;}
31 |
32 | public Deployment getDeployment() {
33 | return deployment;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/samples/wmm/src/main/java/org/jboss/gwt/circuit/sample/wmm/actions/Deployment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wmm.actions;
23 |
24 | public class Deployment {
25 |
26 | private final String name;
27 | private final String server;
28 |
29 | public Deployment(final String name, final String server) {
30 | this.name = name;
31 | this.server = server;
32 | }
33 |
34 | @Override
35 | public boolean equals(final Object o) {
36 | if (this == o) { return true; }
37 | if (!(o instanceof Deployment)) { return false; }
38 |
39 | Deployment that = (Deployment) o;
40 |
41 | if (!name.equals(that.name)) { return false; }
42 | if (!server.equals(that.server)) { return false; }
43 |
44 | return true;
45 | }
46 |
47 | @Override
48 | public int hashCode() {
49 | int result = name.hashCode();
50 | result = 31 * result + server.hashCode();
51 | return result;
52 | }
53 |
54 | @Override
55 | public String toString() {
56 | return "Deployment(" + name + ", " + server + ")";
57 | }
58 |
59 | public String getName() {
60 | return name;
61 | }
62 |
63 | public String getServer() {
64 | return server;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/samples/wmm/src/main/java/org/jboss/gwt/circuit/sample/wmm/actions/StartServerAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wmm.actions;
23 |
24 | import org.jboss.gwt.circuit.Action;
25 |
26 | public class StartServerAction implements Action {
27 |
28 | private final String server;
29 |
30 | public StartServerAction(final String server) {this.server = server;}
31 |
32 | public String getServer() {
33 | return server;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/samples/wmm/src/main/java/org/jboss/gwt/circuit/sample/wmm/actions/StopServerAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wmm.actions;
23 |
24 | import org.jboss.gwt.circuit.Action;
25 |
26 | public class StopServerAction implements Action {
27 |
28 | private final String server;
29 |
30 | public StopServerAction(final String server) {this.server = server;}
31 |
32 | public String getServer() {
33 | return server;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/samples/wmm/src/main/java/org/jboss/gwt/circuit/sample/wmm/actions/UndeployAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010, Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags. See the copyright.txt file in the
5 | * distribution for a full listing of individual contributors.
6 | *
7 | * This is free software; you can redistribute it and/or modify it
8 | * under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation; either version 2.1 of
10 | * the License, or (at your option) any later version.
11 | *
12 | * This software is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this software; if not, write to the Free
19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 | */
22 | package org.jboss.gwt.circuit.sample.wmm.actions;
23 |
24 | import org.jboss.gwt.circuit.Action;
25 |
26 | public class UndeployAction implements Action {
27 |
28 | private final Deployment deployment;
29 |
30 | public UndeployAction(final Deployment deployment) {this.deployment = deployment;}
31 |
32 | public Deployment getDeployment() {
33 | return deployment;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/versionBump.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Use this script to bump the version accross all POMs.
4 |
5 | PROGNAME=`basename "$0"`
6 |
7 | if [ "$#" -ne 1 ]; then
8 | echo "Illegal number of arguments. Use '$PROGNAME '"
9 | else
10 | mvn versions:set -DnewVersion=$1 -Psamples
11 | find . -name pom.xml.versionsBackup -exec rm {} \;
12 | fi
13 |
--------------------------------------------------------------------------------