public class Cospan extends Object implements Data, Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Cospan.Type
Enumeration of the different types of implemented cospans.
|
Constructor and Description |
---|
Cospan()
Creates a new (empty) cospan with an empty left interface.
|
Cospan(CospanDecomposition decomposition)
Creates a new cospan by copying the cospan decomposition
decomposition information. |
Cospan(Graph graph,
List<Node> innerInterface,
List<Node> outerInterface)
Creates a new cospan consisting of the middle graph
graph and the
two interfaces innerInterface and outerInterface . |
Cospan(int initialWidth)
Creates a new (empty) cospan with the discrete graph with
width nodes
as inner and outer interface. |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(String edgeName,
String label,
List<Node> incidentNodes)
Adds a labeled edge to this cospan.
|
void |
addNode(String nodeName)
Adds a new node with node name
nodeName and empty label to the cospan. |
void |
addToInnerInterface(String nodeName)
Adds an existing node of the cospan to the last position of the inner
interface.
|
void |
addToInnerInterface(String nodeName,
int position)
Adds an existing node of the cospan to the specified position of the
inner interface.
|
void |
addToOuterInterface(String nodeName)
Adds an existing node of the cospan to the last position of the outer
interface.
|
void |
addToOuterInterface(String nodeName,
int position)
Adds an existing node of the cospan to the specified position of the
outer interface.
|
boolean |
equals(Object o) |
Edge |
getEdge(String edgeName)
Returns the edge with the name
edgeName or null if no
edge with the given name is existing. |
Set<Edge> |
getEdges()
Returns the set of edges of this cospan.
|
Graph |
getGraph()
Returns the graph which can be obtained from this cospan decomposition.
|
List<Node> |
getInnerInterface()
Returns a list of the nodes in the inner interface of this cospan.
|
Node |
getInnerInterfaceNode(int i)
Returns the
i -th node of the inner interface of this cospan. |
List<String> |
getInnerInterfaceNodeNames()
Deprecated.
|
int |
getInnerInterfaceSize()
Returns the size of the inner interface (of the cospan) of this decomposition.
|
Node |
getNode(String nodeName)
Returns the node with the name
nodeName or null if no
node with the given name is existing. |
Set<Node> |
getNodes()
Returns the set of nodes of this cospan.
|
List<Node> |
getOuterInterface()
Returns a list of the nodes in the outer interface of this cospan.
|
Node |
getOuterInterfaceNode(int i)
Returns the
i -th node of the outer interface of this cospan. |
List<String> |
getOuterInterfaceNodeNames()
Deprecated.
|
int |
getOuterInterfaceSize()
Returns the size of the outer interface (of the cospan) of this decomposition.
|
Cospan.Type |
getType()
Returns the type of the data object.
|
boolean |
hasEdge(String edgeName)
Returns
true if and only if this cospan contains
an edge with the name nodeName . |
int |
hashCode() |
boolean |
hasNode(String nodeName)
Returns
true if and only if this cospan contains
a node with the name nodeName . |
public Cospan(int initialWidth)
width
nodes
as inner and outer interface.initialWidth
- the initial width of the cospan and the inner and outer interfacepublic Cospan()
public Cospan(CospanDecomposition decomposition)
decomposition
information.decomposition
- the cospan decomposition to be copiedpublic Cospan(Graph graph, List<Node> innerInterface, List<Node> outerInterface)
graph
and the
two interfaces innerInterface
and outerInterface
.graph
- the middle graphinnerInterface
- the inner interfaceouterInterface
- the outer interfacepublic Graph getGraph()
public int getInnerInterfaceSize()
public int getOuterInterfaceSize()
@Deprecated public List<String> getInnerInterfaceNodeNames()
@Deprecated public List<String> getOuterInterfaceNodeNames()
public List<Node> getInnerInterface()
public Node getInnerInterfaceNode(int i)
i
-th node of the inner interface of this cospan.i
- the position of the interface nodei
-th inner interface nodeIllegalArgumentException
- thrown if the position is out of range,
i.e. if the position is less than zero or greater than or equal to the
size of the inner interface.public List<Node> getOuterInterface()
public Node getOuterInterfaceNode(int i)
i
-th node of the outer interface of this cospan.i
- the position of the interface nodei
-th outer interface nodeIllegalArgumentException
- thrown if the position is out of range,
i.e. if the position is less than zero or greater than or equal to the
size of the outer interface.public boolean hasNode(String nodeName)
true
if and only if this cospan contains
a node with the name nodeName
.nodeName
- the name of the nodetrue
if a node of the given name has
been found, false
otherwiseNullPointerException
- thrown if nodeName
is nullpublic Node getNode(String nodeName)
nodeName
or null
if no
node with the given name is existing.nodeName
- the name of the nodenull
if no node has been foundNullPointerException
- thrown if nodeName
is null
IllegalArgumentException
- thrown if nodeName
is emptypublic Set<Node> getNodes()
public void addNode(String nodeName)
nodeName
and empty label to the cospan.nodeName
- the name of the new nodeNullPointerException
- thrown if nodeName
is nullIllegalArgumentException
- thrown if nodeName
is empty or if
a node with name nodeName
is already existingpublic boolean hasEdge(String edgeName)
true
if and only if this cospan contains
an edge with the name nodeName
.edgeName
- the name of the nodetrue
if an edge of the given name has
been found, false
otherwiseNullPointerException
- thrown if edgeName
is nullpublic Edge getEdge(String edgeName)
edgeName
or null
if no
edge with the given name is existing.edgeName
- the name of the edgenull
if no node has been foundNullPointerException
- thrown if nodeName
is null
IllegalArgumentException
- thrown if edgeName
is emptypublic Set<Edge> getEdges()
public void addEdge(String edgeName, String label, List<Node> incidentNodes)
edgeName
- the name of the new edgelabel
- the label of the new edgeincidentNodes
- the incident nodes of the new edgeNullPointerException
- thrown if edgeName
, edgeLabel
or incidentNodes
is nullIllegalArgumentException
- thrown if edgeName
or edgeLabel
are empty, at least one node of incidentNodes
is not contained in
this graph or if an edge with name edgeName
is already existingpublic void addToInnerInterface(String nodeName)
nodeName
- the name of the nodeNullPointerException
- thrown if nodeName
is nullIllegalArgumentException
- thrown if nodeName
is empty or
if a node with name nodeName
is not existingaddToInnerInterface(String, int)
,
addToOuterInterface(String)
,
addToOuterInterface(String, int)
public void addToInnerInterface(String nodeName, int position)
position
!nodeName
- the name of the nodeposition
- the position of the node in the interfaceNullPointerException
- thrown if nodeName
is nullIllegalArgumentException
- thrown if nodeName
is empty,
if a node with name nodeName
is not existing or if position
is out of range, i.e. position is less than zero or greater than the size
of the inner interface.addToInnerInterface(String)
,
addToOuterInterface(String)
,
addToOuterInterface(String, int)
public void addToOuterInterface(String nodeName)
nodeName
- the name of the nodeNullPointerException
- thrown if nodeName
is nullIllegalArgumentException
- thrown if nodeName
is empty or
if a node with name nodeName
is not existingaddToInnerInterface(String)
,
addToInnerInterface(String, int)
,
addToOuterInterface(String, int)
public void addToOuterInterface(String nodeName, int position)
position
!nodeName
- the name of the nodeposition
- the position of the node in the interfaceNullPointerException
- thrown if nodeName
is nullIllegalArgumentException
- thrown if nodeName
is empty,
if a node with name nodeName
is not existing or if position
is out of range, i.e. position is less than zero or greater than the size
of the outer interface.addToInnerInterface(String)
,
addToInnerInterface(String, int)
,
addToOuterInterface(String)
public Cospan.Type getType()
Data