Package science.aist.gtf.graph.impl
Class EdgeViewImpl<V,E>
- java.lang.Object
-
- science.aist.gtf.graph.impl.MetaTagCollectionImpl
-
- science.aist.gtf.graph.impl.AbstractEdge<V,E>
-
- science.aist.gtf.graph.impl.EdgeViewImpl<V,E>
-
- Type Parameters:
V
- the type of the decorated vertex valueE
- the type of the decorated edge value
- All Implemented Interfaces:
Edge<V,E>
,EdgeView<V,E>
,MetaTagCollection
public class EdgeViewImpl<V,E> extends AbstractEdge<V,E> implements EdgeView<V,E>
This class is used to provide a view on a given edge, this means, that it decorates an existing edge 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 EdgeViewImpl(Edge<V,E> viewedEdge)
-
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 vertexE
getElement()
Returns the element associated with the edge<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 vertex<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.AbstractEdge
getSource, getTarget
-
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.EdgeView
getViewedEdge
-
-
-
-
Method Detail
-
getElement
public E getElement()
Description copied from interface:Edge
Returns the element associated with the edge- Specified by:
getElement
in interfaceEdge<V,E>
- Returns:
- the element associated with the edge, or null if not present
-
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.
-
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
-
-