Package science.aist.gtf.graph.impl
Class VertexViewImpl<V,E>
- java.lang.Object
-
- science.aist.gtf.graph.impl.MetaTagCollectionImpl
-
- science.aist.gtf.graph.impl.AbstractVertex<V,E>
-
- science.aist.gtf.graph.impl.VertexViewImpl<V,E>
-
- Type Parameters:
V
- the type of the decorated vertex valueE
- the type of the decorated edge value
- All Implemented Interfaces:
MetaTagCollection
,Vertex<V,E>
,VertexView<V,E>
public class VertexViewImpl<V,E> extends AbstractVertex<V,E> implements VertexView<V,E>
This class is used to provide a view on a given vertex, this means, that it decorates an existing vertex but uses its own graph state which does only contain a view on the graph.
- Since:
- 1.0
- Author:
- Andreas Pointner
-
-
Constructor Summary
Constructors Constructor Description VertexViewImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> boolean
addMetaTag(MetaTag<T> metaTag)
Adds a meta tag to the current vertexV
getElement()
<T> Collection<MetaTag<T>>
getMetaTags()
<T> T
getMetaTagValue(String key)
Returns the first value for a meta tag with a given key or throws an exception if not present<T> T
getMetaTagValue(String key, Class<T> clazz)
Returns the value for a meta tag with a given keyvoid
removeMetaTag(String key, Class<?>... clazz)
Removes all meta that, where the key of the meta tag equals the key parameter.<T> boolean
removeMetaTag(MetaTag<T> metaTag)
Removes a meta tag from the current vertexvoid
setElement(V element)
Method that allows to change the decorated element - this is especially needed at graph creation time.<T> Optional<T>
tryGetMetaTagValue(String key)
Try to return the first value for a meta tag with a given key<T> Optional<T>
tryGetMetaTagValue(String key, Class<T> clazz)
Tries to get a value for a given meta tag with a given key-
Methods inherited from class science.aist.gtf.graph.impl.AbstractVertex
getAdjacentVertices, getEdges, getIncomingEdges, getOutgoingEdges
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface science.aist.gtf.graph.Vertex
getAdjacentVertices, getEdges, getIncomingEdges, getOutgoingEdges
-
Methods inherited from interface science.aist.gtf.graph.VertexView
getViewedVertex
-
-
-
-
Method Detail
-
getMetaTags
public <T> Collection<MetaTag<T>> getMetaTags()
- Specified by:
getMetaTags
in interfaceMetaTagCollection
- Overrides:
getMetaTags
in classMetaTagCollectionImpl
- Type Parameters:
T
- returns a collection of all the meta tags- Returns:
- the collection of all current meta tags
-
addMetaTag
public <T> boolean addMetaTag(MetaTag<T> metaTag)
Description copied from interface:MetaTagCollection
Adds a meta tag to the current vertex- Specified by:
addMetaTag
in interfaceMetaTagCollection
- Overrides:
addMetaTag
in classMetaTagCollectionImpl
- Type Parameters:
T
- the type of the meta tag to add- Parameters:
metaTag
- the meta tag- Returns:
- a flag which indicates if the element was added
-
removeMetaTag
public <T> boolean removeMetaTag(MetaTag<T> metaTag)
Description copied from interface:MetaTagCollection
Removes a meta tag from the current vertex- Specified by:
removeMetaTag
in interfaceMetaTagCollection
- Overrides:
removeMetaTag
in classMetaTagCollectionImpl
- Type Parameters:
T
- the type of the meta tag to remove- Parameters:
metaTag
- the meta tag- Returns:
- a flag which indicates if the element was removed
-
getMetaTagValue
public <T> T getMetaTagValue(String key, Class<T> clazz)
Description copied from interface:MetaTagCollection
Returns the value for a meta tag with a given key- Specified by:
getMetaTagValue
in interfaceMetaTagCollection
- Type Parameters:
T
- the type of the meta tag value- Parameters:
key
- the key of the meta tagclazz
- the class of the meta tag value- Returns:
- the value of the meta tag, if there are multiple elements with the same key and class type, the first one which is matching will be returned
-
tryGetMetaTagValue
public <T> Optional<T> tryGetMetaTagValue(String key, Class<T> clazz)
Description copied from interface:MetaTagCollection
Tries to get a value for a given meta tag with a given key- Specified by:
tryGetMetaTagValue
in interfaceMetaTagCollection
- Type Parameters:
T
- the type of the meta tag value- Parameters:
key
- the key of the meta tagclazz
- the class of the meta tag value- Returns:
- the value of the meta tag, if there are multiple elements with the same key class type, the first one which is matching will be returned
-
getMetaTagValue
public <T> T getMetaTagValue(String key)
Description copied from interface:MetaTagCollection
Returns the first value for a meta tag with a given key or throws an exception if not present- Specified by:
getMetaTagValue
in interfaceMetaTagCollection
- Type Parameters:
T
- the type of the meta tag- Parameters:
key
- the key- Returns:
- the value if present
- See Also:
MetaTagCollection.getMetaTagValue(String, Class)
-
tryGetMetaTagValue
public <T> Optional<T> tryGetMetaTagValue(String key)
Description copied from interface:MetaTagCollection
Try to return the first value for a meta tag with a given key- Specified by:
tryGetMetaTagValue
in interfaceMetaTagCollection
- Type Parameters:
T
- the type of the meta tag- Parameters:
key
- the key- Returns:
- the value if present
- See Also:
MetaTagCollection.tryGetMetaTagValue(String, Class)
-
removeMetaTag
public void removeMetaTag(String key, Class<?>... clazz)
Description copied from interface:MetaTagCollection
Removes all meta that, where the key of the meta tag equals the key parameter. Optionally it also checks if the value type is one of the given classes. If classes is null or empty it will only check for the key. After calling this method the meta tag with the associated key will be removed. In case the key does not exist, no error will occur.
- Specified by:
removeMetaTag
in interfaceMetaTagCollection
- Parameters:
key
- the key of the meta tag to be removedclazz
- optional: a list of possible types where the meta tag must be one of them.
-
getElement
public V getElement()
- Specified by:
getElement
in interfaceVertex<V,E>
- Returns:
- returns the decorated element
-
setElement
public void setElement(V element)
Description copied from class:AbstractVertex
Method that allows to change the decorated element - this is especially needed at graph creation time.- Specified by:
setElement
in classAbstractVertex<V,E>
- Parameters:
element
- The new decorated element.
-
-