Package org.jtool.graph
Class GraphElement
java.lang.Object
org.jtool.graph.GraphElement
An abstract element of a graph.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Creates a new, empty object that represents an element (a node or an edge) of a graph. -
Method Summary
Modifier and TypeMethodDescriptionstatic <E extends GraphElement>
Set<E>difference
(Collection<E> s1, Collection<E> s2) Obtains a difference set of two graph element collections regarded as a set.boolean
static <E extends GraphElement>
booleanequals
(Collection<E> s1, Collection<E> s2) Tests if two graph element collections are equal regarded as a set.abstract boolean
equals
(GraphElement elem) Tests if a given graph element is equal to this graph element.static String
getIdString
(long id) Obtains the printed identification number.static <E extends GraphElement>
Set<E>intersection
(Collection<E> s1, Collection<E> s2) Obtains an intersection set of two graph element collections.static <E extends GraphElement>
booleansubset
(Collection<E> s1, Collection<E> s2) Tests if one graph element collection is contained in and not equal to the other collection.static <E extends GraphElement>
booleansubsetEqual
(Collection<E> s1, Collection<E> s2) Tests if one graph element collection is contained in or equal to the other collection.static <E extends GraphElement>
Set<E>union
(Collection<E> s1, Collection<E> s2) Obtains a union set of two graph element collections.
-
Constructor Details
-
GraphElement
protected GraphElement()Creates a new, empty object that represents an element (a node or an edge) of a graph.
-
-
Method Details
-
equals
-
equals
Tests if a given graph element is equal to this graph element.- Parameters:
elem
- the graph element to be checked- Returns:
- the
true
if the given graph element is equal to this graph element
-
getIdString
Obtains the printed identification number.- Parameters:
id
- the identification number- Returns:
- the printed string of the identification number
-
equals
Tests if two graph element collections are equal regarded as a set.- Type Parameters:
E
- the type of graph elements- Parameters:
s1
- the first collection of graph elementss2
- the second collection of graph elements- Returns:
true
if the two collections are equal, otherwisefalse
-
difference
Obtains a difference set of two graph element collections regarded as a set.- Type Parameters:
E
- the type of graph elements- Parameters:
s1
- the first collection of graph elementss2
- the second collection of graph elements- Returns:
- the set of graph elements that remain after removing the second one from the first one
-
union
Obtains a union set of two graph element collections.- Type Parameters:
E
- the type of graph elements- Parameters:
s1
- the first collection of graph elementss2
- the second collection of graph elements- Returns:
- the set of graph elements that are contained in either the first one or the second one
-
intersection
Obtains an intersection set of two graph element collections.- Type Parameters:
E
- the type of graph elements- Parameters:
s1
- the first collection of graph elementss2
- the second collection of graph elements- Returns:
- the collection of graph elements that are contained in both the first one and the second one
-
subsetEqual
Tests if one graph element collection is contained in or equal to the other collection.- Type Parameters:
E
- the type of graph elements- Parameters:
s1
- the first collection of graph elementss2
- the second collection of graph elements- Returns:
true
if all graph elements of the first one are contained in the second one, otherwisefalse
-
subset
Tests if one graph element collection is contained in and not equal to the other collection.- Type Parameters:
E
- the type of graph elements- Parameters:
s1
- the first set of graph elementss2
- the second set of graph elements- Returns:
true
if all graph elements of the first one are contained in the second one and the two ones are not equal, otherwisefalse
-