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
An
Element is the base class for both Vertex and Edge. An Element has an identifier
that must be unique to its inheriting classes (Vertex or Edge). An Element can maintain a
collection of Property 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 ClassesModifier and TypeInterfaceDescriptionstatic classCommon exceptions to use with an element. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidAdds one or more labels to this element.default voidRemoves specific labels from this element.default voidRemoves all labels from this element, triggering the provider's default label behavior.graph()Get the graph that this element is within.id()Gets the unique identifier for the graphElement.keys()Get the keys of the properties associated with this element.label()Deprecated.labels()Gets all labels for this element.properties(String... propertyKeys) Get anIteratorof properties where thepropertyKeysis meant to be a filter on the available keys.default <V> Property<V>Get aPropertyfor theElementgiven its key.<V> Property<V>Add or set a property value for theElementgiven its key.voidremove()Removes theElementfrom the graph.default <V> VGet the value of aPropertygiven it's key.default <V> Iterator<V>Get the values of properties as anIterator.
-
Method Details
-
id
Object id()Gets the unique identifier for the graphElement.- Returns:
- The id of the element
-
labels
Gets all labels for this element.For
Vertex: may return zero or more labels (multi-label support). ForEdge: returns a singleton set (single label only in TinkerGraph). ForVertexProperty: returns a singleton set containing the property key.- Returns:
- An unmodifiable
Setof labels; may be empty for vertices with no labels - Since:
- 4.0.0
-
label
Deprecated.As of release 4.0.0, replaced bylabels(). This method returns an arbitrary label when multiple labels exist.Gets the label for the graphElementwhich 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
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
Get aPropertyfor theElementgiven its key. The default implementation calls the rawproperties(java.lang.String...). -
property
Add or set a property value for theElementgiven its key. -
value
Get the value of aPropertygiven 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 theElementfrom the graph. -
addLabel
Adds one or more labels to this element.- Parameters:
label- the first label to addlabels- additional labels to add- Throws:
UnsupportedOperationException- if the element does not support label mutation- Since:
- 4.0.0
-
dropLabels
default void dropLabels()Removes all labels from this element, triggering the provider's default label behavior.- Throws:
UnsupportedOperationException- if the element does not support label mutation- Since:
- 4.0.0
-
dropLabel
Removes specific labels from this element. If this action removes all labels, triggers the provider's default label behavior.- Parameters:
label- the first label to removelabels- additional labels to remove- Throws:
UnsupportedOperationException- if the element does not support label mutation- Since:
- 4.0.0
-
values
Get the values of properties as anIterator. -
properties
Get anIteratorof properties where thepropertyKeysis meant to be a filter on the available keys. If no keys are provide then return all the properties.
-
labels().