diff --git a/src/main/java/com/syncleus/dann/graph/AbstractAdjacencyGraph.java b/src/main/java/com/syncleus/dann/graph/AbstractAdjacencyGraph.java index ab117ccbb156b8aecc040dce67b93148c81290a8..2a9dc2f3302a5ce8b804d3638b6e3450e5486996 100644 --- a/src/main/java/com/syncleus/dann/graph/AbstractAdjacencyGraph.java +++ b/src/main/java/com/syncleus/dann/graph/AbstractAdjacencyGraph.java @@ -39,7 +39,7 @@ public abstract class AbstractAdjacencyGraph< E extends Cloud<N,? extends Cloud.Endpoint<? extends N>>, NEP extends Graph.NodeEndpoint<N, E>, EEP extends Graph.EdgeEndpoint<N, E> - > extends AbstractCloud<Object,Graph.Endpoint<N,E,?>> implements Graph<N, E, NEP, EEP> + > extends AbstractCloud<Object,Graph.Endpoint<?, N,E>> implements Graph<N, E, NEP, EEP> { private static final Logger LOGGER = Logger.getLogger(AbstractAdjacencyGraph.class); // private Set<E> edges; @@ -132,8 +132,8 @@ public abstract class AbstractAdjacencyGraph< // lets see if this ContextEdge will allow itself to join the graph if(this.contextEnabled - && (attemptNode instanceof ContextGraphElement) - && !((ContextGraphElement)attemptNode).joiningGraph(this) ) + && (attemptNode instanceof ContextGraphNode) + && !((ContextGraphNode)attemptNode).joiningGraph(this) ) continue; this.adjacentNodes.put(attemptNode, new ArrayList<N>()); @@ -148,8 +148,8 @@ public abstract class AbstractAdjacencyGraph< { // lets see if this ContextEdge will allow itself to join the graph if(this.contextEnabled - && (attemptEdge instanceof ContextGraphElement) - && !((ContextGraphElement)attemptEdge).joiningGraph(this) ) + && (attemptEdge instanceof ContextGraphNode) + && !((ContextGraphNode)attemptEdge).joiningGraph(this) ) continue; @@ -303,8 +303,8 @@ public abstract class AbstractAdjacencyGraph< throw new IllegalArgumentException("newEdge has a node as an end point that is not part of the graph"); // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newEdge instanceof ContextGraphElement) - && !((ContextGraphElement)newEdge).joiningGraph(this) ) + if( this.isContextEnabled() && (newEdge instanceof ContextGraphNode) + && !((ContextGraphNode)newEdge).joiningGraph(this) ) return false; if( this.getInternalEdges().add(newEdge) ) @@ -333,8 +333,8 @@ public abstract class AbstractAdjacencyGraph< return false; // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newNode instanceof ContextGraphElement) - && !((ContextGraphElement)newNode).joiningGraph(this) ) + if( this.isContextEnabled() && (newNode instanceof ContextGraphNode) + && !((ContextGraphNode)newNode).joiningGraph(this) ) return false; this.getInternalAdjacencyEdges().put(newNode, new HashSet<E>()); @@ -352,8 +352,8 @@ public abstract class AbstractAdjacencyGraph< // if context is enabled lets check if it can join if( this.isContextEnabled() - && (edgeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)edgeToRemove).leavingGraph(this) ) + && (edgeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)edgeToRemove).leavingGraph(this) ) return false; if( !this.getInternalEdges().remove(edgeToRemove) ) @@ -381,8 +381,8 @@ public abstract class AbstractAdjacencyGraph< // if context is enabled lets check if it can join if( this.isContextEnabled() - && (nodeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)nodeToRemove).leavingGraph(this) ) + && (nodeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)nodeToRemove).leavingGraph(this) ) return false; final Set<E> removeEdges = this.getInternalAdjacencyEdges().get(nodeToRemove); @@ -467,8 +467,8 @@ public abstract class AbstractAdjacencyGraph< { // lets see if this ContextEdge will allow itself to join the graph if(this.contextEnabled - && (attemptNode instanceof ContextGraphElement) - && !((ContextGraphElement)attemptNode).joiningGraph(cloneGraph) ) + && (attemptNode instanceof ContextGraphNode) + && !((ContextGraphNode)attemptNode).joiningGraph(cloneGraph) ) continue; cloneGraph.adjacentNodes.put(attemptNode, new ArrayList<N>()); @@ -483,8 +483,8 @@ public abstract class AbstractAdjacencyGraph< { // lets see if this ContextEdge will allow itself to join the graph if(this.contextEnabled - && (attemptEdge instanceof ContextGraphElement) - && !((ContextGraphElement)attemptEdge).joiningGraph(cloneGraph) ) + && (attemptEdge instanceof ContextGraphNode) + && !((ContextGraphNode)attemptEdge).joiningGraph(cloneGraph) ) continue; cloneGraph.edges.add(attemptEdge); @@ -606,12 +606,12 @@ public abstract class AbstractAdjacencyGraph< } @Override - public Set<Graph.Endpoint<N, E, ?>> getEndpoints() + public Set<Graph.Endpoint<?, N, E>> getEndpoints() { - final Set<Graph.Endpoint<N,E,?>> endpoints = new HashSet<Graph.Endpoint<N,E,?>>(); + final Set<Graph.Endpoint<?, N,E>> endpoints = new HashSet<Graph.Endpoint<?, N,E>>(); endpoints.addAll(this.getNodeEndpoints()); endpoints.addAll(this.getEdgeEndpoints()); - return Collections.<Graph.Endpoint<N, E, ?>>unmodifiableSet(endpoints); + return Collections.<Graph.Endpoint<?, N, E>>unmodifiableSet(endpoints); } @Override @@ -978,7 +978,7 @@ public abstract class AbstractAdjacencyGraph< } */ - protected abstract class AbstractNodeEndpoint extends AbstractCloud<? super N,Graph.Endpoint<N,E,? super N>>.AbstractEndpoint<N> implements Graph.NodeEndpoint<N,E> + protected abstract class AbstractNodeEndpoint extends AbstractCloud<? super N,Graph.Endpoint<? super N, N,E>>.AbstractEndpoint<N> implements Graph.NodeEndpoint<N,E> { protected AbstractNodeEndpoint() { @@ -1074,7 +1074,7 @@ public abstract class AbstractAdjacencyGraph< } }; - protected abstract class AbstractEdgeEndpoint extends AbstractCloud<? super E,Graph.Endpoint<N,E,? super E>>.AbstractEndpoint<E> implements Graph.EdgeEndpoint<N,E> + protected abstract class AbstractEdgeEndpoint extends AbstractCloud<? super E,Graph.Endpoint<? super E, N,E>>.AbstractEndpoint<E> implements Graph.EdgeEndpoint<N,E> { protected AbstractEdgeEndpoint() { diff --git a/src/main/java/com/syncleus/dann/graph/AbstractBidirectedEdge.java b/src/main/java/com/syncleus/dann/graph/AbstractBidirectedEdge.java index 4a30fc853eb213fe1cc2cfcd91361362871a46d4..fb697df6ff9361fa39f416ab120539dd9a6b5783 100644 --- a/src/main/java/com/syncleus/dann/graph/AbstractBidirectedEdge.java +++ b/src/main/java/com/syncleus/dann/graph/AbstractBidirectedEdge.java @@ -24,7 +24,7 @@ import com.syncleus.dann.xml.NamedValueXml; import com.syncleus.dann.xml.Namer; import com.syncleus.dann.xml.XmlSerializable; -public abstract class AbstractBidirectedEdge<N, LN extends N, RN extends N> extends AbstractCloud<N> implements MixableBidirectedEdge<N, LN,RN> +public abstract class AbstractBidirectedEdge<N, LN extends N, RN extends N> extends AbstractEdge<N> implements MixableBidirectedEdge<N, LN,RN> { @Override public abstract AbstractEndpoint<LN,RN> getLeftEndPoint(); @@ -322,7 +322,7 @@ public abstract class AbstractBidirectedEdge<N, LN extends N, RN extends N> exte }; } - protected abstract class AbstractEndpoint<EN extends N, ON extends N> extends AbstractCloud<N>.AbstractEndpoint<EN> implements MixableBidirectedEdge.Endpoint<N, EN,ON> + protected abstract class AbstractEndpoint<EN extends N, ON extends N> extends AbstractEdge<N>.AbstractEndpoint<EN> implements MixableBidirectedEdge.Endpoint<N, EN,ON> { private EN node = null; private Direction direction; diff --git a/src/main/java/com/syncleus/dann/graph/AbstractEdge.java b/src/main/java/com/syncleus/dann/graph/AbstractEdge.java new file mode 100644 index 0000000000000000000000000000000000000000..a74d04627950e71cca24a9e89f3b1b940e442835 --- /dev/null +++ b/src/main/java/com/syncleus/dann/graph/AbstractEdge.java @@ -0,0 +1,29 @@ +/****************************************************************************** + * * + * Copyright: (c) Syncleus, Inc. * + * * + * You may redistribute and modify this source code under the terms and * + * conditions of the Open Source Community License - Type C version 1.0 * + * or any later version as published by Syncleus, Inc. at www.syncleus.com. * + * There should be a copy of the license included with this file. If a copy * + * of the license is not included you are granted no right to distribute or * + * otherwise use this file except through a legal and valid license. You * + * should also contact Syncleus, Inc. at the information below if you cannot * + * find a license: * + * * + * Syncleus, Inc. * + * 2604 South 12th Street * + * Philadelphia, PA 19148 * + * * + ******************************************************************************/ +package com.syncleus.dann.graph; + +public abstract class AbstractEdge< + T, + EP extends Edge.Endpoint<? extends T> + > extends AbstractCloud<T,EP> implements Edge<T,EP> +{ + protected abstract class AbstractEndpoint<T> implements AbstractCloud.Endpoint<T> + { + } +} diff --git a/src/main/java/com/syncleus/dann/graph/AbstractHyperEdge.java b/src/main/java/com/syncleus/dann/graph/AbstractHyperEdge.java index b2283cd29eb5b6d0c99a7b08df1d7e3240a62867..671f103c61c0d5623056ae55c337cfaf7e3c76fd 100644 --- a/src/main/java/com/syncleus/dann/graph/AbstractHyperEdge.java +++ b/src/main/java/com/syncleus/dann/graph/AbstractHyperEdge.java @@ -18,7 +18,7 @@ ******************************************************************************/ package com.syncleus.dann.graph; -public abstract class AbstractHyperEdge<N> extends AbstractCloud<N> implements HyperEdge<N> +public abstract class AbstractHyperEdge<N> extends AbstractEdge<N> implements HyperEdge<N> { private static final long serialVersionUID = -3657973823101515199L; @@ -153,7 +153,7 @@ public abstract class AbstractHyperEdge<N> extends AbstractCloud<N> implements H */ } - protected abstract class AbstractEndpoint<EN extends N, ON extends N> extends AbstractCloud.AbstractEndpoint<EN> implements HyperEdge.Endpoint<N, EN> + protected abstract class AbstractEndpoint<EN extends N, ON extends N> extends AbstractEdge.AbstractEndpoint<EN> implements HyperEdge.Endpoint<N, EN> { private EN node = null; diff --git a/src/main/java/com/syncleus/dann/graph/AbstractMutableAdjacencyGraph.java b/src/main/java/com/syncleus/dann/graph/AbstractMutableAdjacencyGraph.java index 2c268fb9e947d20b61bc29c0cff8993c8c569f94..3ca4cc2cfbe03fb1f84e7839eecbbdd3bea916a6 100644 --- a/src/main/java/com/syncleus/dann/graph/AbstractMutableAdjacencyGraph.java +++ b/src/main/java/com/syncleus/dann/graph/AbstractMutableAdjacencyGraph.java @@ -200,12 +200,12 @@ public abstract class AbstractMutableAdjacencyGraph< } @Override - public Map<?, Graph.Endpoint<N, E, ?>> reconfigure(Set<? extends N> addNodes, Set<? extends E> addEdges, Set<? extends Graph.Endpoint<?, ?, ?>> disconnectEndpoints) throws InvalidGraphException + public Map<?, Graph.Endpoint<?, N, E>> reconfigure(Set<? extends N> addNodes, Set<? extends E> addEdges, Set<? extends Graph.Endpoint<?, ?, ?>> disconnectEndpoints) throws InvalidGraphException { - for(final Graph.Endpoint<?,?,?> disconnectEndpoint : disconnectEndpoints) + for(final Graph.Endpoint<?, ?,?> disconnectEndpoint : disconnectEndpoints) this.adjacency.remove(disconnectEndpoint.getTarget()); - Map<Object, Graph.Endpoint<N,E,?>> newEndpoints = new HashMap<Object, Graph.Endpoint<N, E, ?>>(); + Map<Object, Graph.Endpoint<?, N,E>> newEndpoints = new HashMap<Object, Graph.Endpoint<?, N, E>>(); newEndpoints.putAll(this.joinNodes(addNodes)); newEndpoints.putAll(this.joinEdges(addEdges)); return newEndpoints; diff --git a/src/main/java/com/syncleus/dann/graph/AssignableGraph.java b/src/main/java/com/syncleus/dann/graph/AssignableGraph.java index f35d4f4f455f2ec2e5f3a98c1c553deebefb1695..02d28d21964db6724c2664eb967151bcf41a2129 100644 --- a/src/main/java/com/syncleus/dann/graph/AssignableGraph.java +++ b/src/main/java/com/syncleus/dann/graph/AssignableGraph.java @@ -23,7 +23,7 @@ public interface AssignableGraph< E extends Cloud<N,? extends Cloud.Endpoint<? extends N>>, NEP extends AssignableGraph.NodeEndpoint<N, E>, EEP extends AssignableGraph.EdgeEndpoint<N, E> - > extends Graph<N,E,NEP,EEP>, MutableEdge<Object,Graph.Endpoint<N,E,?>> + > extends Graph<N,E,NEP,EEP>, MutableEdge<Object,Graph.Endpoint<?, N,E>> //public interface AssignableGraph<P extends Cloud<N>, N extends P, E extends P> extends Graph<N,E>, Cloud<P>, MutableEdge<P> //public interface AssignableGraph<P extends AssignableGraph.Foo, N extends P, E extends Cloud<N> & AssignableGraph.Foo> extends Graph<N,E>, Cloud<P>, MutableEdge<P> { diff --git a/src/main/java/com/syncleus/dann/graph/Edge.java b/src/main/java/com/syncleus/dann/graph/Edge.java index 81cc3acb67f31339aa04caa8888604dc5e004e15..5885c9068570a946d0230d6a395ea017f45a8111 100644 --- a/src/main/java/com/syncleus/dann/graph/Edge.java +++ b/src/main/java/com/syncleus/dann/graph/Edge.java @@ -20,7 +20,7 @@ package com.syncleus.dann.graph; public interface Edge< T, - EP extends Cloud.Endpoint<? extends T> + EP extends Edge.Endpoint<? extends T> > extends Cloud<T,EP> { interface Endpoint<T> extends Cloud.Endpoint<T> diff --git a/src/main/java/com/syncleus/dann/graph/Graph.java b/src/main/java/com/syncleus/dann/graph/Graph.java index 091b9ebc38568d364f0b56ef42e43fa2e1c3be56..16484623ae7828b98e2e10470983865b7797fa6f 100644 --- a/src/main/java/com/syncleus/dann/graph/Graph.java +++ b/src/main/java/com/syncleus/dann/graph/Graph.java @@ -18,8 +18,6 @@ ******************************************************************************/ package com.syncleus.dann.graph; -import com.syncleus.dann.graph.context.ContextReporter; -import java.io.Serializable; import java.util.Set; /** @@ -38,48 +36,49 @@ import java.util.Set; public interface Graph< N, E extends Cloud<N,? extends Cloud.Endpoint<? extends N>>, - NEP extends Graph.NodeEndpoint<N, E>, - EEP extends Graph.EdgeEndpoint<N, E> - > extends Cloud<Object,Graph.Endpoint<N,E,?>> + NE extends Graph.NodeEndpoint<N, E>, + EE extends Graph.EdgeEndpoint<N, E> + > extends Cloud<Object,Graph.Endpoint<?, N,E>> { interface Endpoint< - ON, - OE extends Cloud<ON,? extends Cloud.Endpoint<? extends ON>>, - T - > extends Cloud.Endpoint<T> + T, + N, + E extends Cloud<N,? extends Cloud.Endpoint<? extends N>> + > + extends Cloud.Endpoint<T> { - Set<? extends Graph.Endpoint<ON,OE,?>> getAdjacent(); - Set<? extends Graph.Endpoint<ON,OE,?>> getTraversableAdjacentTo(); - Set<? extends Graph.Endpoint<ON,OE,?>> getTraversableAdjacentFrom(); + Set<? extends Graph.Endpoint<?, N,E>> getAdjacent(); + Set<? extends Graph.Endpoint<?, N,E>> getTraversableAdjacentTo(); + Set<? extends Graph.Endpoint<?, N,E>> getTraversableAdjacentFrom(); - Set<? extends Graph.NodeEndpoint<ON, OE>> getAdjacentNodes(); - Set<? extends Graph.NodeEndpoint<ON, OE>> getTraversableAdjacentNodesTo(); - Set<? extends Graph.NodeEndpoint<ON, OE>> getTraversableAdjacentNodesFrom(); + Set<? extends Graph.NodeEndpoint<N, E>> getAdjacentNodes(); + Set<? extends Graph.NodeEndpoint<N, E>> getTraversableAdjacentNodesTo(); + Set<? extends Graph.NodeEndpoint<N, E>> getTraversableAdjacentNodesFrom(); - Set<? extends Graph.EdgeEndpoint<ON, OE>> getAdjacentEdges(); - Set<? extends Graph.EdgeEndpoint<ON, OE>> getTraversableAdjacentEdgesTo(); - Set<? extends Graph.EdgeEndpoint<ON, OE>> getTraversableAdjacentEdgesFrom(); + Set<? extends Graph.EdgeEndpoint<N, E>> getAdjacentEdges(); + Set<? extends Graph.EdgeEndpoint<N, E>> getTraversableAdjacentEdgesTo(); + Set<? extends Graph.EdgeEndpoint<N, E>> getTraversableAdjacentEdgesFrom(); }; interface NodeEndpoint< - ON, - OE extends Cloud<ON,? extends Cloud.Endpoint<? extends ON>> - > extends Graph.Endpoint<ON,OE,ON> + N, + E extends Cloud<N,? extends Cloud.Endpoint<? extends N>> + > extends Graph.Endpoint<N, N, E> { }; interface EdgeEndpoint< - ON, - OE extends Cloud<ON,? extends Cloud.Endpoint<? extends ON>> - > extends Graph.Endpoint<ON,OE,OE> + N, + E extends Cloud<N,? extends Cloud.Endpoint<? extends N>> + > extends Graph.Endpoint<E, N, E> { }; - Set<EEP> getEdgeEndpoints(); - Set<EEP> getEdgeEndpoints(Cloud<?,? extends Cloud.Endpoint<?>> cloud); + Set<EE> getEdgeEndpoints(); + Set<EE> getEdgeEndpoints(Cloud<?,? extends Cloud.Endpoint<?>> cloud); - Set<NEP> getNodeEndpoints(); - Set<NEP> getNodeEndpoints(Object node); + Set<NE> getNodeEndpoints(); + Set<NE> getNodeEndpoints(Object node); /** * Get a set of all nodes in the graph. diff --git a/src/main/java/com/syncleus/dann/graph/MutableAdjacencyGraph.java b/src/main/java/com/syncleus/dann/graph/MutableAdjacencyGraph.java index 405f038313e58c5279ff6be7d4a1df6081f75212..9ee2352d00f290b8a574f776dbe6024a0cc0f72c 100644 --- a/src/main/java/com/syncleus/dann/graph/MutableAdjacencyGraph.java +++ b/src/main/java/com/syncleus/dann/graph/MutableAdjacencyGraph.java @@ -40,6 +40,7 @@ public final class MutableAdjacencyGraph< @Override protected MutableGraph.NodeEndpoint<N, E> createNodeEndpoint(N node) throws InvalidGraphException { + return null; } @Override @@ -47,12 +48,4 @@ public final class MutableAdjacencyGraph< { return null; //To change body of implemented methods use File | Settings | File Templates. } - - private final class NodeEndpoint extends AbstractNodeEndpoint - { - } - - private final class EdgeEndpoint extends AbstractEdgeEndpoint - { - } } diff --git a/src/main/java/com/syncleus/dann/graph/MutableDirectedAdjacencyGraph.java b/src/main/java/com/syncleus/dann/graph/MutableDirectedAdjacencyGraph.java index 3b2c1f631b597b1ae9930e78de57f2c64df25b13..043473fb37622603b2ba2fa7a0a6385618734fcd 100644 --- a/src/main/java/com/syncleus/dann/graph/MutableDirectedAdjacencyGraph.java +++ b/src/main/java/com/syncleus/dann/graph/MutableDirectedAdjacencyGraph.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; -import com.syncleus.dann.graph.context.ContextGraphElement; +import com.syncleus.dann.graph.context.ContextGraphNode; public class MutableDirectedAdjacencyGraph<N, E extends DirectedEdge<N>> extends AbstractDirectedAdjacencyGraph<N, E> implements MutableDirectedGraph<N, E> { @@ -52,8 +52,8 @@ public class MutableDirectedAdjacencyGraph<N, E extends DirectedEdge<N>> extends throw new IllegalArgumentException("newEdge has a node as an end point that is not part of the graph"); // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newEdge instanceof ContextGraphElement) - && !((ContextGraphElement)newEdge).joiningGraph(this) ) + if( this.isContextEnabled() && (newEdge instanceof ContextGraphNode) + && !((ContextGraphNode)newEdge).joiningGraph(this) ) return false; if( this.getInternalEdges().add(newEdge) ) @@ -83,8 +83,8 @@ public class MutableDirectedAdjacencyGraph<N, E extends DirectedEdge<N>> extends return false; // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newNode instanceof ContextGraphElement) - && !((ContextGraphElement)newNode).joiningGraph(this) ) + if( this.isContextEnabled() && (newNode instanceof ContextGraphNode) + && !((ContextGraphNode)newNode).joiningGraph(this) ) return false; this.getInternalAdjacencyEdges().put(newNode, new HashSet<E>()); @@ -103,8 +103,8 @@ public class MutableDirectedAdjacencyGraph<N, E extends DirectedEdge<N>> extends // if context is enabled lets check if it can join if( this.isContextEnabled() - && (edgeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)edgeToRemove).leavingGraph(this) ) + && (edgeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)edgeToRemove).leavingGraph(this) ) return false; if( !this.getInternalEdges().remove(edgeToRemove) ) @@ -133,8 +133,8 @@ public class MutableDirectedAdjacencyGraph<N, E extends DirectedEdge<N>> extends // if context is enabled lets check if it can join if( this.isContextEnabled() - && (nodeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)nodeToRemove).leavingGraph(this) ) + && (nodeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)nodeToRemove).leavingGraph(this) ) return false; final Set<E> removeEdges = this.getInternalAdjacencyEdges().get(nodeToRemove); diff --git a/src/main/java/com/syncleus/dann/graph/MutableGraph.java b/src/main/java/com/syncleus/dann/graph/MutableGraph.java index b042408124cd7d4b3df5dc2455066a7fe8dbc2a6..138243a5077dd448b2cfc1d61513c778c2bef3ef 100644 --- a/src/main/java/com/syncleus/dann/graph/MutableGraph.java +++ b/src/main/java/com/syncleus/dann/graph/MutableGraph.java @@ -24,14 +24,14 @@ import java.util.Set; public interface MutableGraph< N, E extends Cloud<N,? extends Cloud.Endpoint<? extends N>>, - NEP extends MutableGraph.NodeEndpoint<N, E>, - EEP extends MutableGraph.EdgeEndpoint<N, E> - > extends AssignableGraph<N,E,NEP,EEP> + NE extends MutableGraph.NodeEndpoint<N, E>, + EE extends MutableGraph.EdgeEndpoint<N, E> + > extends AssignableGraph<N,E,NE,EE> { interface NodeEndpoint< - ON, - OE extends Cloud<ON,? extends Cloud.Endpoint<? extends ON>> - > extends AssignableGraph.NodeEndpoint<ON,OE> + N, + E extends Cloud<N,? extends Cloud.Endpoint<? extends N>> + > extends AssignableGraph.NodeEndpoint<N,E> { }; @@ -42,20 +42,20 @@ public interface MutableGraph< { }; - NEP joinNode(N node) throws InvalidGraphException; - Map<N, NEP> joinNodes(Set<? extends N> nodes) throws InvalidGraphException; - Map<N, Set<NEP>> joinNodes(Map<? extends N,? extends Integer> nodes) throws InvalidGraphException; - Set<EEP> leaveNode(MutableGraph.NodeEndpoint<?, ? extends Cloud<?,? extends Cloud.Endpoint<?>>> endpoint) throws InvalidGraphException; - Set<EEP> leaveNodes(Set<? extends MutableGraph.NodeEndpoint<?, ? extends Cloud<?,? extends Cloud.Endpoint<?>>>> endpoint) throws InvalidGraphException; + NE joinNode(N node) throws InvalidGraphException; + Map<N, NE> joinNodes(Set<? extends N> nodes) throws InvalidGraphException; + Map<N, Set<NE>> joinNodes(Map<? extends N,? extends Integer> nodes) throws InvalidGraphException; + Set<EE> leaveNode(MutableGraph.NodeEndpoint<?, ? extends Cloud<?,? extends Cloud.Endpoint<?>>> endpoint) throws InvalidGraphException; + Set<EE> leaveNodes(Set<? extends MutableGraph.NodeEndpoint<?, ? extends Cloud<?,? extends Cloud.Endpoint<?>>>> endpoint) throws InvalidGraphException; - EEP joinEdge(E edge) throws InvalidGraphException; - Map<E, EEP> joinEdges(Set<? extends E> edges) throws InvalidGraphException; - Map<E, Set<EEP>> joinEdges(Map<? extends E,? extends Integer> edges) throws InvalidGraphException; + EE joinEdge(E edge) throws InvalidGraphException; + Map<E, EE> joinEdges(Set<? extends E> edges) throws InvalidGraphException; + Map<E, Set<EE>> joinEdges(Map<? extends E,? extends Integer> edges) throws InvalidGraphException; void leaveEdge(MutableGraph.EdgeEndpoint<?, ? extends Cloud<?,? extends Cloud.Endpoint<?>>> endpoint) throws InvalidGraphException; void leaveEdges(Set<? extends MutableGraph.EdgeEndpoint<?, ? extends Cloud<?,? extends Cloud.Endpoint<?>>>> endpoints) throws InvalidGraphException; void clear() throws InvalidGraphException; void clearEdges() throws InvalidGraphException; - Map<?, Graph.Endpoint<N,E,?>> reconfigure(Set<? extends N> addNodes, Set<? extends E> addEdges, final Set<? extends Graph.Endpoint<?,?,?>> disconnectEndpoints) throws InvalidGraphException; + Map<?, Graph.Endpoint<?, N,E>> reconfigure(Set<? extends N> addNodes, Set<? extends E> addEdges, final Set<? extends Graph.Endpoint<?, ?,?>> disconnectEndpoints) throws InvalidGraphException; } diff --git a/src/main/java/com/syncleus/dann/graph/MutableHyperAdjacencyGraph.java b/src/main/java/com/syncleus/dann/graph/MutableHyperAdjacencyGraph.java index b812b7537f4996f80fafd7d8b640a4c3a81b7b3d..b4fba6195aa925889d66a60d4c8cb4dfd76168a4 100644 --- a/src/main/java/com/syncleus/dann/graph/MutableHyperAdjacencyGraph.java +++ b/src/main/java/com/syncleus/dann/graph/MutableHyperAdjacencyGraph.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; -import com.syncleus.dann.graph.context.ContextGraphElement; +import com.syncleus.dann.graph.context.ContextGraphNode; public class MutableHyperAdjacencyGraph<N, E extends HyperEdge<N>> extends AbstractHyperAdjacencyGraph<N, E> implements MutableHyperGraph<N, E> { @@ -52,8 +52,8 @@ public class MutableHyperAdjacencyGraph<N, E extends HyperEdge<N>> extends Abstr throw new IllegalArgumentException("newEdge has a node as an end point that is not part of the graph"); // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newEdge instanceof ContextGraphElement) - && !((ContextGraphElement)newEdge).joiningGraph(this) ) + if( this.isContextEnabled() && (newEdge instanceof ContextGraphNode) + && !((ContextGraphNode)newEdge).joiningGraph(this) ) return false; if( this.getInternalEdges().add(newEdge) ) @@ -83,8 +83,8 @@ public class MutableHyperAdjacencyGraph<N, E extends HyperEdge<N>> extends Abstr return false; // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newNode instanceof ContextGraphElement) - && !((ContextGraphElement)newNode).joiningGraph(this) ) + if( this.isContextEnabled() && (newNode instanceof ContextGraphNode) + && !((ContextGraphNode)newNode).joiningGraph(this) ) return false; this.getInternalAdjacencyEdges().put(newNode, new HashSet<E>()); @@ -103,8 +103,8 @@ public class MutableHyperAdjacencyGraph<N, E extends HyperEdge<N>> extends Abstr // if context is enabled lets check if it can join if( this.isContextEnabled() - && (edgeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)edgeToRemove).leavingGraph(this) ) + && (edgeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)edgeToRemove).leavingGraph(this) ) return false; if( !this.getInternalEdges().remove(edgeToRemove) ) @@ -133,8 +133,8 @@ public class MutableHyperAdjacencyGraph<N, E extends HyperEdge<N>> extends Abstr // if context is enabled lets check if it can join if( this.isContextEnabled() - && (nodeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)nodeToRemove).leavingGraph(this) ) + && (nodeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)nodeToRemove).leavingGraph(this) ) return false; final Set<E> removeEdges = this.getInternalAdjacencyEdges().get(nodeToRemove); diff --git a/src/main/java/com/syncleus/dann/graph/MutableRootedTreeAdjacencyGraph.java b/src/main/java/com/syncleus/dann/graph/MutableRootedTreeAdjacencyGraph.java index 274337c7b58465e374b6f7180d8722c3a8d22d22..d08a6b7a68de8225ad0d160f18a928b15b3b3193 100644 --- a/src/main/java/com/syncleus/dann/graph/MutableRootedTreeAdjacencyGraph.java +++ b/src/main/java/com/syncleus/dann/graph/MutableRootedTreeAdjacencyGraph.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; -import com.syncleus.dann.graph.context.ContextGraphElement; +import com.syncleus.dann.graph.context.ContextGraphNode; public class MutableRootedTreeAdjacencyGraph<N, E extends DirectedEdge<N>> extends AbstractRootedTreeAdjacencyGraph<N, E> implements MutableRootedTreeGraph<N, E> { @@ -52,8 +52,8 @@ public class MutableRootedTreeAdjacencyGraph<N, E extends DirectedEdge<N>> exten throw new IllegalArgumentException("newEdge has a node as an end point that is not part of the graph"); // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newEdge instanceof ContextGraphElement) - && !((ContextGraphElement)newEdge).joiningGraph(this) ) + if( this.isContextEnabled() && (newEdge instanceof ContextGraphNode) + && !((ContextGraphNode)newEdge).joiningGraph(this) ) return false; if( this.getInternalEdges().add(newEdge) ) @@ -83,8 +83,8 @@ public class MutableRootedTreeAdjacencyGraph<N, E extends DirectedEdge<N>> exten return false; // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newNode instanceof ContextGraphElement) - && !((ContextGraphElement)newNode).joiningGraph(this) ) + if( this.isContextEnabled() && (newNode instanceof ContextGraphNode) + && !((ContextGraphNode)newNode).joiningGraph(this) ) return false; this.getInternalAdjacencyEdges().put(newNode, new HashSet<E>()); @@ -103,8 +103,8 @@ public class MutableRootedTreeAdjacencyGraph<N, E extends DirectedEdge<N>> exten // if context is enabled lets check if it can join if( this.isContextEnabled() - && (edgeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)edgeToRemove).leavingGraph(this) ) + && (edgeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)edgeToRemove).leavingGraph(this) ) return false; if( !this.getInternalEdges().remove(edgeToRemove) ) @@ -133,8 +133,8 @@ public class MutableRootedTreeAdjacencyGraph<N, E extends DirectedEdge<N>> exten // if context is enabled lets check if it can join if( this.isContextEnabled() - && (nodeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)nodeToRemove).leavingGraph(this) ) + && (nodeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)nodeToRemove).leavingGraph(this) ) return false; final Set<E> removeEdges = this.getInternalAdjacencyEdges().get(nodeToRemove); diff --git a/src/main/java/com/syncleus/dann/graph/MutableTreeAdjacencyGraph.java b/src/main/java/com/syncleus/dann/graph/MutableTreeAdjacencyGraph.java index bc4a185ea70af52e533f4eb75e21035609353d0e..939d81d6f1337f6fb27a06c94a5f0dd429417498 100644 --- a/src/main/java/com/syncleus/dann/graph/MutableTreeAdjacencyGraph.java +++ b/src/main/java/com/syncleus/dann/graph/MutableTreeAdjacencyGraph.java @@ -18,7 +18,7 @@ ******************************************************************************/ package com.syncleus.dann.graph; -import com.syncleus.dann.graph.context.ContextGraphElement; +import com.syncleus.dann.graph.context.ContextGraphNode; import com.syncleus.dann.graph.tree.Trees; import java.util.ArrayList; import java.util.HashSet; @@ -61,8 +61,8 @@ public class MutableTreeAdjacencyGraph<N, E extends BidirectedEdge<N>> extends A throw new IllegalArgumentException("adding newEdge can not be added because this graph would no longer be a tree"); // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newEdge instanceof ContextGraphElement) - && !((ContextGraphElement)newEdge).joiningGraph(this) ) + if( this.isContextEnabled() && (newEdge instanceof ContextGraphNode) + && !((ContextGraphNode)newEdge).joiningGraph(this) ) return false; if( this.getInternalEdges().add(newEdge) ) @@ -92,8 +92,8 @@ public class MutableTreeAdjacencyGraph<N, E extends BidirectedEdge<N>> extends A return false; // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newNode instanceof ContextGraphElement) - && !((ContextGraphElement)newNode).joiningGraph(this) ) + if( this.isContextEnabled() && (newNode instanceof ContextGraphNode) + && !((ContextGraphNode)newNode).joiningGraph(this) ) return false; this.getInternalAdjacencyEdges().put(newNode, new HashSet<E>()); @@ -112,8 +112,8 @@ public class MutableTreeAdjacencyGraph<N, E extends BidirectedEdge<N>> extends A // if context is enabled lets check if it can join if( this.isContextEnabled() - && (edgeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)edgeToRemove).leavingGraph(this) ) + && (edgeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)edgeToRemove).leavingGraph(this) ) return false; if( !this.getInternalEdges().remove(edgeToRemove) ) @@ -142,8 +142,8 @@ public class MutableTreeAdjacencyGraph<N, E extends BidirectedEdge<N>> extends A // if context is enabled lets check if it can join if( this.isContextEnabled() - && (nodeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)nodeToRemove).leavingGraph(this) ) + && (nodeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)nodeToRemove).leavingGraph(this) ) return false; final Set<E> removeEdges = this.getInternalAdjacencyEdges().get(nodeToRemove); diff --git a/src/main/java/com/syncleus/dann/graph/context/AbstractContextGraphElement.java b/src/main/java/com/syncleus/dann/graph/context/AbstractContextGraphElement.java index 452de7794cad8b1ba7a3bd816fa4915e1b178dd2..4cb385a629becb03d4c464918beaaa21b4ecad3e 100644 --- a/src/main/java/com/syncleus/dann/graph/context/AbstractContextGraphElement.java +++ b/src/main/java/com/syncleus/dann/graph/context/AbstractContextGraphElement.java @@ -24,7 +24,7 @@ import java.util.Set; import java.io.Serializable; import com.syncleus.dann.graph.Graph; -public abstract class AbstractContextGraphElement<G extends Graph<?, ?>> implements ContextGraphElement<G>, Serializable +public abstract class AbstractContextGraphElement<G extends Graph<?, ?>> implements ContextGraphNode<G>, Serializable { private final boolean allowJoiningMultipleGraphs; private final Set<G> joinedGraphs = new HashSet<G>(); diff --git a/src/main/java/com/syncleus/dann/graph/context/ContextElement.java b/src/main/java/com/syncleus/dann/graph/context/ContextCloudElement.java similarity index 80% rename from src/main/java/com/syncleus/dann/graph/context/ContextElement.java rename to src/main/java/com/syncleus/dann/graph/context/ContextCloudElement.java index 7ed6e81fa6b19398058c8931d4053fa6448eeed1..6648630c0b02c9c4245811602e60622910b928a2 100644 --- a/src/main/java/com/syncleus/dann/graph/context/ContextElement.java +++ b/src/main/java/com/syncleus/dann/graph/context/ContextCloudElement.java @@ -21,10 +21,8 @@ package com.syncleus.dann.graph.context; import java.util.Set; import com.syncleus.dann.graph.Cloud; -public interface ContextElement< - E extends Cloud<?, ? extends Cloud.Endpoint<?>> - > +public interface ContextCloudElement< CE extends Cloud.Endpoint<?> > { - void changingContext(Set<? extends E> joiningContexts, Set<? extends Cloud<?,? extends Cloud.Endpoint<?>>> leavingContexts) throws RejectedContextException; - void changedContext(Set<? extends E> joinedContexts, Set<? extends Cloud<?,? extends Cloud.Endpoint<?>>> leftContexts); + void changingCloudContext(Set<? extends CE> joiningContexts, Set<? extends Cloud<?,? extends Cloud.Endpoint<?>>> leavingContexts) throws RejectedContextException; + void changedCloudContext(Set<? extends CE> joinedContexts, Set<? extends Cloud<?,? extends Cloud.Endpoint<?>>> leftContexts); } diff --git a/src/main/java/com/syncleus/dann/graph/context/ContextNode.java b/src/main/java/com/syncleus/dann/graph/context/ContextEdgeElement.java similarity index 83% rename from src/main/java/com/syncleus/dann/graph/context/ContextNode.java rename to src/main/java/com/syncleus/dann/graph/context/ContextEdgeElement.java index 3f6966a029e1b6fe9dbec6f1ffe52308664c358a..4ba14295033f8809157c441989b4c48a70c8cda7 100644 --- a/src/main/java/com/syncleus/dann/graph/context/ContextNode.java +++ b/src/main/java/com/syncleus/dann/graph/context/ContextEdgeElement.java @@ -19,10 +19,10 @@ package com.syncleus.dann.graph.context; import java.util.Set; -import com.syncleus.dann.graph.Cloud; +import com.syncleus.dann.graph.*; -public interface ContextNode<N, E extends Cloud<N>> +public interface ContextEdgeElement< EE extends Edge.Endpoint<?> > { - void changingConnectedEdges(Set<E> connectingEdges, Set<E> disconnectingEdges) throws RejectedContextException; - void changedConnectedEdges(Set<E> connectedEdges, Set<E> disconnectedEdges); -} + void changingEdgeContext( Set<? extends EE> joiningContexts, Set<?> leavingContexts) throws RejectedContextException; + void changedEdgeContext(Set<? extends EE> joinedContexts, Set<?> leftContexts); +} \ No newline at end of file diff --git a/src/main/java/com/syncleus/dann/graph/context/GraphEdgeContextElement.java b/src/main/java/com/syncleus/dann/graph/context/ContextGraphEdge.java similarity index 82% rename from src/main/java/com/syncleus/dann/graph/context/GraphEdgeContextElement.java rename to src/main/java/com/syncleus/dann/graph/context/ContextGraphEdge.java index 7fb749ce66bf386dc827980b4fba12fd9b753ad6..768dbbef8e2d3a39addbc8208b9f35f1587c20b0 100644 --- a/src/main/java/com/syncleus/dann/graph/context/GraphEdgeContextElement.java +++ b/src/main/java/com/syncleus/dann/graph/context/ContextGraphEdge.java @@ -20,9 +20,10 @@ package com.syncleus.dann.graph.context; import java.util.Set; import com.syncleus.dann.graph.Cloud; +import com.syncleus.dann.graph.Graph; -public interface GraphEdgeContextElement +public interface ContextGraphEdge< GEE extends Graph.EdgeEndpoint<?,?> > { - void changingEdgeContext(Set<? extends E> joinedGraphContexts, Set<? extends Cloud<?,? extends Cloud.Endpoint<?>>> leftGraphContexts); - void changedEdgeContext(Set<? extends E> joinedGraphContexts, Set<? extends Cloud<?,? extends Cloud.Endpoint<?>>> leftGraphContexts); + void changingGraphEdgeContext( Set<? extends GEE> joiningContexts, Set<?> leavingContexts) throws RejectedContextException; + void changedGraphEdgeContext(Set<? extends GEE> joinedContexts, Set<?> leftContexts); } diff --git a/src/main/java/com/syncleus/dann/graph/context/ContextGraphElement.java b/src/main/java/com/syncleus/dann/graph/context/ContextGraphElement.java index 0d66b33938355890b56be38bcfa80b0b2d6517d3..88a1498bdf002a10a9d70d28dfb8ecdf85ee7143 100644 --- a/src/main/java/com/syncleus/dann/graph/context/ContextGraphElement.java +++ b/src/main/java/com/syncleus/dann/graph/context/ContextGraphElement.java @@ -21,8 +21,8 @@ package com.syncleus.dann.graph.context; import java.util.Set; import com.syncleus.dann.graph.Graph; -public interface ContextGraphElement<G extends Graph<?, ?>> +public interface ContextGraphElement< GE extends Graph.Endpoint<?, ?,?> > { - void changingJoinedGraphs(Set<G> joiningGraphs, Set<G> leavingGraphs) throws RejectedContextException; - void changedJoinedGraphs(Set<G> joinedGraphs, Set<G> leftGraphs); + void changingGraphContext( Set<? extends GE> joiningAsNode, Set<? extends GE> joiningAsEdge, Set<?> leavingContexts) throws RejectedContextException; + void changedGraphContext(Set<? extends GE> joinedAsNode, Set<? extends GE> joinedAsEdge, Set<?> leftContexts); } diff --git a/src/main/java/com/syncleus/dann/graph/context/GraphContextElement.java b/src/main/java/com/syncleus/dann/graph/context/ContextGraphNode.java similarity index 77% rename from src/main/java/com/syncleus/dann/graph/context/GraphContextElement.java rename to src/main/java/com/syncleus/dann/graph/context/ContextGraphNode.java index 48bd5ebc6ef3b4d19c0619d7cefa97e9bc51fb16..df1bd118ac4cac537d7d5f09293f776f804be884 100644 --- a/src/main/java/com/syncleus/dann/graph/context/GraphContextElement.java +++ b/src/main/java/com/syncleus/dann/graph/context/ContextGraphNode.java @@ -19,18 +19,10 @@ package com.syncleus.dann.graph.context; import java.util.Set; -import com.syncleus.dann.graph.Cloud; import com.syncleus.dann.graph.Graph; -public interface GraphContextElement< - G extends Graph< - ?, - Cloud<?,? extends Cloud.Endpoint<?>>, - ? extends Graph.NodeEndpoint<?,?>, - ? extends Graph.EdgeEndpoint<?,?> - > - > +public interface ContextGraphNode< GNE extends Graph.NodeEndpoint<?,?> > { - void changingNodeContext( Set<? extends G> joiningGraphContexts, Set<?> leavingGraphContexts) throws RejectedContextException; - void changedNodeContext(Set<? extends G> joinedGraphContexts, Set<?> leftGraphContexts); + void changingGraphNodeContext( Set<? extends GNE> joiningContexts, Set<?> leavingContexts) throws RejectedContextException; + void changedGraphNodeContext(Set<? extends GNE> joinedContexts, Set<?> leftContexts); } diff --git a/src/main/java/com/syncleus/dann/graphicalmodel/MutableGraphicalModelAdjacencyGraph.java b/src/main/java/com/syncleus/dann/graphicalmodel/MutableGraphicalModelAdjacencyGraph.java index da3d0ed6dabc6173f44f090ecc6f02e65c27a81d..acff9fb33a0997bd8eee17652f8820776d83486c 100644 --- a/src/main/java/com/syncleus/dann/graphicalmodel/MutableGraphicalModelAdjacencyGraph.java +++ b/src/main/java/com/syncleus/dann/graphicalmodel/MutableGraphicalModelAdjacencyGraph.java @@ -23,7 +23,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; import com.syncleus.dann.graph.BidirectedEdge; -import com.syncleus.dann.graph.context.ContextGraphElement; +import com.syncleus.dann.graph.context.ContextGraphNode; import com.syncleus.dann.graph.Graph; public class MutableGraphicalModelAdjacencyGraph<N extends GraphicalModelNode, E extends BidirectedEdge<N>> extends AbstractGraphicalModelAdjacencyGraph<N, E> implements MutableGraphicalModel<N, E> @@ -54,8 +54,8 @@ public class MutableGraphicalModelAdjacencyGraph<N extends GraphicalModelNode, E throw new IllegalArgumentException("newEdge has a node as an end point that is not part of the graph"); // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newEdge instanceof ContextGraphElement) ) - ((ContextGraphElement)newEdge).joiningGraph(this); + if( this.isContextEnabled() && (newEdge instanceof ContextGraphNode) ) + ((ContextGraphNode)newEdge).joiningGraph(this); if( this.getInternalEdges().add(newEdge) ) { @@ -84,8 +84,8 @@ public class MutableGraphicalModelAdjacencyGraph<N extends GraphicalModelNode, E return false; // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newNode instanceof ContextGraphElement) - && !((ContextGraphElement)newNode).joiningGraph(this) ) + if( this.isContextEnabled() && (newNode instanceof ContextGraphNode) + && !((ContextGraphNode)newNode).joiningGraph(this) ) return false; this.getInternalAdjacencyEdges().put(newNode, new HashSet<E>()); @@ -104,8 +104,8 @@ public class MutableGraphicalModelAdjacencyGraph<N extends GraphicalModelNode, E // if context is enabled lets check if it can join if( this.isContextEnabled() - && (edgeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)edgeToRemove).leavingGraph(this) ) + && (edgeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)edgeToRemove).leavingGraph(this) ) return false; if( !this.getInternalEdges().remove(edgeToRemove) ) @@ -134,8 +134,8 @@ public class MutableGraphicalModelAdjacencyGraph<N extends GraphicalModelNode, E // if context is enabled lets check if it can join if( this.isContextEnabled() - && (nodeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)nodeToRemove).leavingGraph(this) ) + && (nodeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)nodeToRemove).leavingGraph(this) ) return false; final Set<E> removeEdges = this.getInternalAdjacencyEdges().get(nodeToRemove); diff --git a/src/main/java/com/syncleus/dann/graphicalmodel/bayesian/MutableBayesianAdjacencyNetwork.java b/src/main/java/com/syncleus/dann/graphicalmodel/bayesian/MutableBayesianAdjacencyNetwork.java index 4ab5960253590763fccc32fd1931161e4d078037..20a731d5d6b45b644bc71165078035ac62e5dd7d 100644 --- a/src/main/java/com/syncleus/dann/graphicalmodel/bayesian/MutableBayesianAdjacencyNetwork.java +++ b/src/main/java/com/syncleus/dann/graphicalmodel/bayesian/MutableBayesianAdjacencyNetwork.java @@ -23,7 +23,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; import com.syncleus.dann.graph.DirectedEdge; -import com.syncleus.dann.graph.context.ContextGraphElement; +import com.syncleus.dann.graph.context.ContextGraphNode; import com.syncleus.dann.graph.Graph; import com.syncleus.dann.graphicalmodel.GraphicalModelNode; @@ -55,8 +55,8 @@ public class MutableBayesianAdjacencyNetwork<N extends GraphicalModelNode, E ext throw new IllegalArgumentException("newEdge has a node as an end point that is not part of the graph"); // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newEdge instanceof ContextGraphElement) - && !((ContextGraphElement)newEdge).joiningGraph(this) ) + if( this.isContextEnabled() && (newEdge instanceof ContextGraphNode) + && !((ContextGraphNode)newEdge).joiningGraph(this) ) return false; if( this.getInternalEdges().add(newEdge) ) @@ -86,8 +86,8 @@ public class MutableBayesianAdjacencyNetwork<N extends GraphicalModelNode, E ext return false; // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newNode instanceof ContextGraphElement) - && !((ContextGraphElement)newNode).joiningGraph(this) ) + if( this.isContextEnabled() && (newNode instanceof ContextGraphNode) + && !((ContextGraphNode)newNode).joiningGraph(this) ) return false; this.getInternalAdjacencyEdges().put(newNode, new HashSet<E>()); @@ -106,8 +106,8 @@ public class MutableBayesianAdjacencyNetwork<N extends GraphicalModelNode, E ext // if context is enabled lets check if it can join if( this.isContextEnabled() - && (edgeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)edgeToRemove).leavingGraph(this) ) + && (edgeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)edgeToRemove).leavingGraph(this) ) return false; if( !this.getInternalEdges().remove(edgeToRemove) ) @@ -136,8 +136,8 @@ public class MutableBayesianAdjacencyNetwork<N extends GraphicalModelNode, E ext // if context is enabled lets check if it can join if( this.isContextEnabled() - && (nodeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)nodeToRemove).leavingGraph(this) ) + && (nodeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)nodeToRemove).leavingGraph(this) ) return false; final Set<E> removeEdges = this.getInternalAdjacencyEdges().get(nodeToRemove); diff --git a/src/main/java/com/syncleus/dann/graphicalmodel/dynamic/MutableDynamicGraphicalModelAdjacencyGraph.java b/src/main/java/com/syncleus/dann/graphicalmodel/dynamic/MutableDynamicGraphicalModelAdjacencyGraph.java index eb9cc969fd7b03398234a0df15607a03b446c9be..ccc49cf33c42ec03ef5b264e40a8f9061396dcde 100644 --- a/src/main/java/com/syncleus/dann/graphicalmodel/dynamic/MutableDynamicGraphicalModelAdjacencyGraph.java +++ b/src/main/java/com/syncleus/dann/graphicalmodel/dynamic/MutableDynamicGraphicalModelAdjacencyGraph.java @@ -21,7 +21,7 @@ package com.syncleus.dann.graphicalmodel.dynamic; import java.util.*; import com.syncleus.dann.graph.BidirectedEdge; import com.syncleus.dann.graph.Graph; -import com.syncleus.dann.graph.context.ContextGraphElement; +import com.syncleus.dann.graph.context.ContextGraphNode; public class MutableDynamicGraphicalModelAdjacencyGraph<N extends DynamicGraphicalModelNode, E extends BidirectedEdge<N>> extends AbstractDynamicGraphicalModel<N, E> implements MutableDynamicGraphicalModel<N, E> { @@ -51,8 +51,8 @@ public class MutableDynamicGraphicalModelAdjacencyGraph<N extends DynamicGraphic throw new IllegalArgumentException("newEdge has a node as an end point that is not part of the graph"); // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newEdge instanceof ContextGraphElement) - && !((ContextGraphElement)newEdge).joiningGraph(this) ) + if( this.isContextEnabled() && (newEdge instanceof ContextGraphNode) + && !((ContextGraphNode)newEdge).joiningGraph(this) ) return false; if( this.getInternalEdges().add(newEdge) ) @@ -82,8 +82,8 @@ public class MutableDynamicGraphicalModelAdjacencyGraph<N extends DynamicGraphic return false; // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newNode instanceof ContextGraphElement) - && !((ContextGraphElement)newNode).joiningGraph(this) ) + if( this.isContextEnabled() && (newNode instanceof ContextGraphNode) + && !((ContextGraphNode)newNode).joiningGraph(this) ) return false; this.getInternalAdjacencyEdges().put(newNode, new HashSet<E>()); @@ -102,8 +102,8 @@ public class MutableDynamicGraphicalModelAdjacencyGraph<N extends DynamicGraphic // if context is enabled lets check if it can join if( this.isContextEnabled() - && (edgeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)edgeToRemove).leavingGraph(this) ) + && (edgeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)edgeToRemove).leavingGraph(this) ) return false; if( !this.getInternalEdges().remove(edgeToRemove) ) @@ -132,8 +132,8 @@ public class MutableDynamicGraphicalModelAdjacencyGraph<N extends DynamicGraphic // if context is enabled lets check if it can join if( this.isContextEnabled() - && (nodeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)nodeToRemove).leavingGraph(this) ) + && (nodeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)nodeToRemove).leavingGraph(this) ) return false; final Set<E> removeEdges = this.getInternalAdjacencyEdges().get(nodeToRemove); diff --git a/src/main/java/com/syncleus/dann/graphicalmodel/markovrandomfield/MutableMarkovRandomFieldAdjacencyGraph.java b/src/main/java/com/syncleus/dann/graphicalmodel/markovrandomfield/MutableMarkovRandomFieldAdjacencyGraph.java index aa991db69cab71afb5bd3b848916d2a0b3cef674..898a5b407259f896a36dc370581313826f1f1a17 100644 --- a/src/main/java/com/syncleus/dann/graphicalmodel/markovrandomfield/MutableMarkovRandomFieldAdjacencyGraph.java +++ b/src/main/java/com/syncleus/dann/graphicalmodel/markovrandomfield/MutableMarkovRandomFieldAdjacencyGraph.java @@ -21,7 +21,7 @@ package com.syncleus.dann.graphicalmodel.markovrandomfield; import java.util.*; import com.syncleus.dann.graph.UndirectedEdge; import com.syncleus.dann.graph.Graph; -import com.syncleus.dann.graph.context.ContextGraphElement; +import com.syncleus.dann.graph.context.ContextGraphNode; import com.syncleus.dann.graphicalmodel.GraphicalModelNode; public class MutableMarkovRandomFieldAdjacencyGraph<N extends GraphicalModelNode, E extends UndirectedEdge<N>> extends AbstractMarkovRandomFieldAdjacencyGraph<N, E> implements MutableMarkovRandomField<N, E> @@ -52,8 +52,8 @@ public class MutableMarkovRandomFieldAdjacencyGraph<N extends GraphicalModelNode throw new IllegalArgumentException("newEdge has a node as an end point that is not part of the graph"); // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newEdge instanceof ContextGraphElement) - && !((ContextGraphElement)newEdge).joiningGraph(this) ) + if( this.isContextEnabled() && (newEdge instanceof ContextGraphNode) + && !((ContextGraphNode)newEdge).joiningGraph(this) ) return false; if( this.getInternalEdges().add(newEdge) ) @@ -83,8 +83,8 @@ public class MutableMarkovRandomFieldAdjacencyGraph<N extends GraphicalModelNode return false; // if context is enabled lets check if it can join - if( this.isContextEnabled() && (newNode instanceof ContextGraphElement) - && !((ContextGraphElement)newNode).joiningGraph(this) ) + if( this.isContextEnabled() && (newNode instanceof ContextGraphNode) + && !((ContextGraphNode)newNode).joiningGraph(this) ) return false; this.getInternalAdjacencyEdges().put(newNode, new HashSet<E>()); @@ -103,8 +103,8 @@ public class MutableMarkovRandomFieldAdjacencyGraph<N extends GraphicalModelNode // if context is enabled lets check if it can join if( this.isContextEnabled() - && (edgeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)edgeToRemove).leavingGraph(this) ) + && (edgeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)edgeToRemove).leavingGraph(this) ) return false; if( !this.getInternalEdges().remove(edgeToRemove) ) @@ -133,8 +133,8 @@ public class MutableMarkovRandomFieldAdjacencyGraph<N extends GraphicalModelNode // if context is enabled lets check if it can join if( this.isContextEnabled() - && (nodeToRemove instanceof ContextGraphElement) - && !((ContextGraphElement)nodeToRemove).leavingGraph(this) ) + && (nodeToRemove instanceof ContextGraphNode) + && !((ContextGraphNode)nodeToRemove).leavingGraph(this) ) return false; final Set<E> removeEdges = this.getInternalAdjacencyEdges().get(nodeToRemove);