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> booleanaddMetaTag(MetaTag<T> metaTag)Adds a meta tag to the current vertexVgetElement()<T> Collection<MetaTag<T>>getMetaTags()<T> TgetMetaTagValue(String key)Returns the first value for a meta tag with a given key or throws an exception if not present<T> TgetMetaTagValue(String key, Class<T> clazz)Returns the value for a meta tag with a given keyvoidremoveMetaTag(String key, Class<?>... clazz)Removes all meta that, where the key of the meta tag equals the key parameter.<T> booleanremoveMetaTag(MetaTag<T> metaTag)Removes a meta tag from the current vertexvoidsetElement(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:
getMetaTagsin interfaceMetaTagCollection- Overrides:
getMetaTagsin 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:MetaTagCollectionAdds a meta tag to the current vertex- Specified by:
addMetaTagin interfaceMetaTagCollection- Overrides:
addMetaTagin 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:MetaTagCollectionRemoves a meta tag from the current vertex- Specified by:
removeMetaTagin interfaceMetaTagCollection- Overrides:
removeMetaTagin 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:MetaTagCollectionReturns the value for a meta tag with a given key- Specified by:
getMetaTagValuein 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:MetaTagCollectionTries to get a value for a given meta tag with a given key- Specified by:
tryGetMetaTagValuein 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:MetaTagCollectionReturns the first value for a meta tag with a given key or throws an exception if not present- Specified by:
getMetaTagValuein 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:MetaTagCollectionTry to return the first value for a meta tag with a given key- Specified by:
tryGetMetaTagValuein 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:MetaTagCollectionRemoves 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:
removeMetaTagin 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:
getElementin interfaceVertex<V,E>- Returns:
- returns the decorated element
-
setElement
public void setElement(V element)
Description copied from class:AbstractVertexMethod that allows to change the decorated element - this is especially needed at graph creation time.- Specified by:
setElementin classAbstractVertex<V,E>- Parameters:
element- The new decorated element.
-
-