Interface Element
-
- All Known Subinterfaces:
Edge
,Vertex
,VertexProperty<V>
- All Known Implementing Classes:
ComputerGraph.ComputerAdjacentVertex
,ComputerGraph.ComputerEdge
,ComputerGraph.ComputerElement
,ComputerGraph.ComputerVertex
,ComputerGraph.ComputerVertexProperty
,DetachedEdge
,DetachedElement
,DetachedVertex
,DetachedVertexProperty
,EmptyVertexProperty
,KeyedVertexProperty
,ReferenceEdge
,ReferenceElement
,ReferenceVertex
,ReferenceVertexProperty
,StarGraph.StarAdjacentVertex
,StarGraph.StarEdge
,StarGraph.StarElement
,StarGraph.StarInEdge
,StarGraph.StarOutEdge
,StarGraph.StarVertex
,StarGraph.StarVertexProperty
,TinkerEdge
,TinkerElement
,TinkerVertex
,TinkerVertexProperty
public interface Element
AnElement
is the base class for bothVertex
andEdge
. AnElement
has an identifier that must be unique to its inheriting classes (Vertex
orEdge
). AnElement
can maintain a collection ofProperty
objects. Typically, objects are Java primitives (e.g. String, long, int, boolean, etc.)- Author:
- Marko A. Rodriguez (http://markorodriguez.com), Stephen Mallette (http://stephen.genoprime.com)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Element.Exceptions
Common exceptions to use with an element.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Graph
graph()
Get the graph that this element is within.Object
id()
Gets the unique identifier for the graphElement
.default Set<String>
keys()
Get the keys of the properties associated with this element.String
label()
Gets the label for the graphElement
which helps categorize it.<V> Iterator<? extends Property<V>>
properties(String... propertyKeys)
Get anIterator
of properties where thepropertyKeys
is meant to be a filter on the available keys.default <V> Property<V>
property(String key)
Get aProperty
for theElement
given its key.<V> Property<V>
property(String key, V value)
Add or set a property value for theElement
given its key.void
remove()
Removes theElement
from the graph.default <V> V
value(String key)
Get the value of aProperty
given it's key.default <V> Iterator<V>
values(String... propertyKeys)
Get the values of properties as anIterator
.
-
-
-
Method Detail
-
id
Object id()
Gets the unique identifier for the graphElement
.- Returns:
- The id of the element
-
label
String label()
Gets the label for the graphElement
which helps categorize it.- Returns:
- The label of the element
-
graph
Graph graph()
Get the graph that this element is within.- Returns:
- the graph of this element
-
keys
default Set<String> keys()
Get the keys of the properties associated with this element. The default implementation iterators the properties and stores the keys into aHashSet
.- Returns:
- The property key set
-
property
default <V> Property<V> property(String key)
Get aProperty
for theElement
given its key. The default implementation calls the rawproperties(java.lang.String...)
.
-
property
<V> Property<V> property(String key, V value)
Add or set a property value for theElement
given its key.
-
value
default <V> V value(String key) throws NoSuchElementException
Get the value of aProperty
given it's key. The default implementation callsproperty(java.lang.String)
and then returns the associated value.- Throws:
NoSuchElementException
- if the property does not exist on theElement
.
-
remove
void remove()
Removes theElement
from the graph.
-
values
default <V> Iterator<V> values(String... propertyKeys)
Get the values of properties as anIterator
.
-
-