java.lang.Object
de.grogra.graph.GraphBase
de.grogra.graph.GraphFilter
- All Implemented Interfaces:
AttributeChangeListener
,ChangeBoundaryListener
,EdgeChangeListener
,Graph
,Lockable
- Direct Known Subclasses:
AttributeOverwritingFilter
public abstract class GraphFilter
extends GraphBase
implements ChangeBoundaryListener, AttributeChangeListener, EdgeChangeListener
A
GraphFilter
is a Graph
which
has another graph as source and filters the data of the source graph.
Filtering may include modification of structure and attributes.
The implementations of Graph
methods in this class
just forward their invocation to the corresponding methods
of the source graph.- Author:
- Ole Kniemeyer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
This helper class delegates accessor method invocations to the correspondingget
-,set
- andisWritable
-methods of the enclosing graph filter.protected class
Nested classes/interfaces inherited from interface de.grogra.util.Lockable
Lockable.DeadLockException
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Graph
The source graph whose data is filtered by this graph filter.Fields inherited from interface de.grogra.graph.ChangeBoundaryListener
ATTRIBUTE_PRIORITY, TOPOLOGY_PRIORITY, UPDATE_PRIORITY
Fields inherited from interface de.grogra.graph.Graph
BRANCH_EDGE, CONTAINMENT_EDGE, CONTAINMENT_END_EDGE, EDGENODE_IN_EDGE, EDGENODE_OUT_EDGE, ELLIPSE_SYMBOL, IGNORED_EDGE, INSTANTIATION_EDGE, MAIN_GRAPH, MARK_EDGE, MIN_NORMAL_BIT_INDEX, MIN_UNUSED_EDGE, MIN_UNUSED_EDGE_BIT, NOTIFIES_EDGE, PERSISTENT, PERSISTENT_DELETED, RECTANGLE_SYMBOL, REFINEMENT_EDGE, RHOMBUS_SYMBOL, ROUND_RECTANGLE_SYMBOL, SPECIAL_EDGE_MASK, SPECIAL_EDGE_OF_SOURCE_BIT, STD_EDGE_5, STD_EDGE_6, SUCCESSOR_EDGE, TRANSIENT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
void
protected GraphBase.State
<V> ObjectMap<V>
protected GraphState
void
edgeChanged
(Object source, Object target, Object edgeSet, GraphState gs) void
endChange
(GraphState gs) getAccessor
(Object object, boolean asNode, Attribute attribute) Returns an attribute accessor for the given attribute on the given object.getAttributes
(Object object, boolean asNode) Returns the set of attributes which are available for the given object.protected boolean
getBoolean
(Object object, GraphFilter.AccessorBridge accessor, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofBooleanAttributeAccessor.getBoolean(Object, GraphState)
to this method.protected byte
getByte
(Object object, GraphFilter.AccessorBridge accessor, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofByteAttributeAccessor.getByte(Object, GraphState)
to this method.protected char
getChar
(Object object, GraphFilter.AccessorBridge accessor, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofCharAttributeAccessor.getChar(Object, GraphState)
to this method.int
getDependent
(Object object, boolean asNode, Attribute a) Returns the set of attributes whose values depend on the given attributea
for the givenobject
.protected Attribute[]
getDependentOfSource
(Object object, boolean asNode, Attribute a) getDescription
(Object object, boolean asNode, String type) Returns a description for the given object.protected double
getDouble
(Object object, GraphFilter.AccessorBridge accessor, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofDoubleAttributeAccessor.getDouble(Object, GraphState)
to this method.int
getEdgeBits
(Object edge) Returns the edge bits of an edge.getFirstEdge
(Object node) Returns the first edge of the linked list of edges ofnode
.protected float
getFloat
(Object object, GraphFilter.AccessorBridge accessor, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofFloatAttributeAccessor.getFloat(Object, GraphState)
to this method.long
Returns a unique identifier for the givennode
.getInstantiator
(Object node) protected int
getInt
(Object object, GraphFilter.AccessorBridge accessor, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofIntAttributeAccessor.getInt(Object, GraphState)
to this method.int
getLifeCycleState
(Object object, boolean asNode) Returns the life cycle state of the given object as part of this graph.protected long
getLong
(Object object, GraphFilter.AccessorBridge accessor, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofLongAttributeAccessor.getLong(Object, GraphState)
to this method.Returns a name for the given object.getNextEdge
(Object edge, Object parentNode) Returns the edge afteredge
in the linked list of edges ofnode
.getNodeForId
(long persistentId) Returns the node identified byid
.protected Object
getObject
(Object object, GraphFilter.AccessorBridge accessor, Object placeIn, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofObjectAttributeAccessor.getObject(Object, GraphState)
andObjectAttributeAccessor.getObject(Object, Object, GraphState)
to this method.getObjectForName
(boolean node, String name) Returns the object with the given name.Defines the derived attribute which has as value the parent object.int
Returns the root node for the given root key.String[]
Returns the root keys for the graph.protected short
getShort
(Object object, GraphFilter.AccessorBridge accessor, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofShortAttributeAccessor.getShort(Object, GraphState)
to this method.getSourceNode
(Object edge) Returns the source node ofedge
.static GraphState
getSpecialEdgeDescriptors
(Object node, boolean asSource) int
getStamp()
Returns a modification stamp for the whole graph.int
getTargetNode
(Object edge) Returns the target node ofedge
.Defines the pattern used for the construction of this graph's tree.protected boolean
isWritable
(Object object, GraphFilter.AccessorBridge accessor, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofAttributeAccessor.isWritable(Object, GraphState)
to this method.protected boolean
setBoolean
(Object object, GraphFilter.AccessorBridge accessor, boolean value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofBooleanAttributeAccessor.setBoolean(Object, boolean, GraphState)
to this method.protected byte
setByte
(Object object, GraphFilter.AccessorBridge accessor, byte value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofByteAttributeAccessor.setByte(Object, byte, GraphState)
to this method.protected char
setChar
(Object object, GraphFilter.AccessorBridge accessor, char value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofCharAttributeAccessor.setChar(Object, char, GraphState)
to this method.protected double
setDouble
(Object object, GraphFilter.AccessorBridge accessor, double value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofDoubleAttributeAccessor.setDouble(Object, double, GraphState)
to this method.protected float
setFloat
(Object object, GraphFilter.AccessorBridge accessor, float value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofFloatAttributeAccessor.setFloat(Object, float, GraphState)
to this method.protected int
setInt
(Object object, GraphFilter.AccessorBridge accessor, int value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofIntAttributeAccessor.setInt(Object, int, GraphState)
to this method.protected long
setLong
(Object object, GraphFilter.AccessorBridge accessor, long value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofLongAttributeAccessor.setLong(Object, long, GraphState)
to this method.protected Object
setObject
(Object object, GraphFilter.AccessorBridge accessor, Object value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofObjectAttributeAccessor.setObject(Object, Object, GraphState)
to this method.protected short
setShort
(Object object, GraphFilter.AccessorBridge accessor, short value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofShortAttributeAccessor.setShort(Object, short, GraphState)
to this method.Methods inherited from class de.grogra.graph.GraphBase
addAttributeChangeListener, addAttributeChangeListener, addChangeBoundaryListener, addEdgeChangeListener, addEdgeChangeListener, execute, execute, executeForcedly, executeForcedly, getMainState, getMaxWaitingTime, getQueueLength, getStateMap, init, isLocked, removeAttributeChangeListener, removeAttributeChangeListener, removeChangeBoundaryListener, removeEdgeChangeListener, removeEdgeChangeListener
-
Field Details
-
source
The source graph whose data is filtered by this graph filter.
-
-
Constructor Details
-
GraphFilter
-
-
Method Details
-
createMainState
- Specified by:
createMainState
in classGraphBase
-
getSourceState
-
beginChange
- Specified by:
beginChange
in interfaceChangeBoundaryListener
-
endChange
- Specified by:
endChange
in interfaceChangeBoundaryListener
-
getPriority
public int getPriority()- Specified by:
getPriority
in interfaceChangeBoundaryListener
-
edgeChanged
- Specified by:
edgeChanged
in interfaceEdgeChangeListener
-
attributeChanged
- Specified by:
attributeChanged
in interfaceAttributeChangeListener
-
getStamp
public int getStamp()Description copied from interface:Graph
Returns a modification stamp for the whole graph. Each modification increments the value, so that the test whether some modification occured can be simply performed on values of the stamp. -
getLifeCycleState
Description copied from interface:Graph
Returns the life cycle state of the given object as part of this graph.- Specified by:
getLifeCycleState
in interfaceGraph
- Parameters:
object
- the object to testasNode
-true
ifobject
is a node,false
ifobject
is an edge- Returns:
- life cycle state, one of
Graph.PERSISTENT
,Graph.PERSISTENT_DELETED
,Graph.TRANSIENT
-
accept
-
createState
-
createBooleanMap
- Specified by:
createBooleanMap
in interfaceGraph
-
createObjectMap
- Specified by:
createObjectMap
in interfaceGraph
-
getAccessor
Description copied from interface:Graph
Returns an attribute accessor for the given attribute on the given object.- Specified by:
getAccessor
in interfaceGraph
- Parameters:
object
- the objectasNode
-true
ifobject
is a node,false
ifobject
is an edgeattribute
- the attribute- Returns:
- an accessor for the object's attribute value
-
getDependent
Description copied from interface:Graph
Returns the set of attributes whose values depend on the given attributea
for the givenobject
.- Specified by:
getDependent
in interfaceGraph
- Parameters:
object
- the objectasNode
-true
ifobject
is a node,false
ifobject
is an edgea
- the attribute- Returns:
- the set of dependent attributes
-
getDependentOfSource
-
getAttributes
Description copied from interface:Graph
Returns the set of attributes which are available for the given object.- Specified by:
getAttributes
in interfaceGraph
- Parameters:
object
- the objectasNode
-true
ifobject
is a node,false
ifobject
is an edge- Returns:
- the object's attributes
-
getRootKeys
Description copied from interface:Graph
Returns the root keys for the graph.- Specified by:
getRootKeys
in interfaceGraph
- Returns:
- an array of root keys
- See Also:
-
getRoot
Description copied from interface:Graph
Returns the root node for the given root key.- Specified by:
getRoot
in interfaceGraph
- Parameters:
key
- a root key, one ofGraph.getRootKeys()
- Returns:
- the root node of the graph identified by
key
, ornull
if no such root node exists - See Also:
-
getFirstEdge
Description copied from interface:Graph
Returns the first edge of the linked list of edges ofnode
.- Specified by:
getFirstEdge
in interfaceGraph
- Parameters:
node
- the common node of the edges of the linked list- Returns:
- the first edge of the linked list
- See Also:
-
getNextEdge
Description copied from interface:Graph
Returns the edge afteredge
in the linked list of edges ofnode
.- Specified by:
getNextEdge
in interfaceGraph
- Parameters:
edge
- the previous edge in the linked listparentNode
- the common node of the edges of the linked list- Returns:
- the next edge of the linked list
- See Also:
-
getEdgeBits
Description copied from interface:Graph
Returns the edge bits of an edge.- Specified by:
getEdgeBits
in interfaceGraph
- Parameters:
edge
- the edge- Returns:
- the edge's edge bits
- See Also:
-
getSourceNode
Description copied from interface:Graph
Returns the source node ofedge
.- Specified by:
getSourceNode
in interfaceGraph
- Parameters:
edge
- an edge- Returns:
- the source node
- See Also:
-
getTargetNode
Description copied from interface:Graph
Returns the target node ofedge
.- Specified by:
getTargetNode
in interfaceGraph
- Parameters:
edge
- an edge- Returns:
- the target node
- See Also:
-
getInstantiator
- Specified by:
getInstantiator
in interfaceGraph
-
getName
Description copied from interface:Graph
Returns a name for the given object. Names are not necessarily unique. -
getDescription
Description copied from interface:Graph
Returns a description for the given object. The type of the desired description (e.g., text, icon) is specified in the argumenttype
; it is interpreted as inDescribed.getDescription(String)
.- Specified by:
getDescription
in interfaceGraph
- Parameters:
object
- the objectasNode
-true
ifobject
is a node,false
ifobject
is an edgetype
- the type of description- Returns:
- a description of the given type, or
null
-
getSpecialEdgeDescriptors
- Specified by:
getSpecialEdgeDescriptors
in interfaceGraph
-
getId
Description copied from interface:Graph
Returns a unique identifier for the givennode
. -
getNodeForId
Description copied from interface:Graph
Returns the node identified byid
.- Specified by:
getNodeForId
in interfaceGraph
- Parameters:
persistentId
- an identifier- Returns:
- the corresponding node, or
null
ifid
identifies no node - See Also:
-
getObjectForName
Description copied from interface:Graph
Returns the object with the given name. If several such objects exist, one of them is chosen in an unspecified manner. If no such object exists,null
is returned.- Specified by:
getObjectForName
in interfaceGraph
- Parameters:
node
-true
if a node of the given name is to be found,false
if an edge is to be foundname
- the name of the object- Returns:
- an object of the given kind (node or edge) with the given name,
or
null
if no such object exists - See Also:
-
getSymbol
-
getColor
-
getParentAttribute
Description copied from interface:Graph
Defines the derived attribute which has as value the parent object.- Specified by:
getParentAttribute
in interfaceGraph
- Returns:
- the parent attribute
- See Also:
-
getTreePattern
Description copied from interface:Graph
Defines the pattern used for the construction of this graph's tree.- Specified by:
getTreePattern
in interfaceGraph
- Returns:
- an edge pattern
- See Also:
-
isWritable
GraphFilter.AccessorBridge
forwards the invocation ofAttributeAccessor.isWritable(Object, GraphState)
to this method. This method has to be overridden by subclasses which declare a writable attribute by an accessor bridge.- Parameters:
object
- an objectaccessor
- an accessor bridgegs
- current graph state- Returns:
true
iffaccessor
represents a writable attribute
-
getBoolean
GraphFilter.AccessorBridge
forwards the invocation ofBooleanAttributeAccessor.getBoolean(Object, GraphState)
to this method. This method has to be overridden by subclasses which make use of accessor bridges in order to return the value for the attribute of the accessor bridge.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodgs
- current graph state- Returns:
- value of the accessor's attribute for the object
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
setBoolean
protected boolean setBoolean(Object object, GraphFilter.AccessorBridge accessor, boolean value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofBooleanAttributeAccessor.setBoolean(Object, boolean, GraphState)
to this method. This method has to be overridden by subclasses which use accessor bridges to represent writable attributes.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodvalue
- the new value for the attributegs
- current graph state- Returns:
- actual new value of the attribute
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
getByte
GraphFilter.AccessorBridge
forwards the invocation ofByteAttributeAccessor.getByte(Object, GraphState)
to this method. This method has to be overridden by subclasses which make use of accessor bridges in order to return the value for the attribute of the accessor bridge.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodgs
- current graph state- Returns:
- value of the accessor's attribute for the object
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
setByte
protected byte setByte(Object object, GraphFilter.AccessorBridge accessor, byte value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofByteAttributeAccessor.setByte(Object, byte, GraphState)
to this method. This method has to be overridden by subclasses which use accessor bridges to represent writable attributes.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodvalue
- the new value for the attributegs
- current graph state- Returns:
- actual new value of the attribute
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
getShort
GraphFilter.AccessorBridge
forwards the invocation ofShortAttributeAccessor.getShort(Object, GraphState)
to this method. This method has to be overridden by subclasses which make use of accessor bridges in order to return the value for the attribute of the accessor bridge.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodgs
- current graph state- Returns:
- value of the accessor's attribute for the object
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
setShort
protected short setShort(Object object, GraphFilter.AccessorBridge accessor, short value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofShortAttributeAccessor.setShort(Object, short, GraphState)
to this method. This method has to be overridden by subclasses which use accessor bridges to represent writable attributes.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodvalue
- the new value for the attributegs
- current graph state- Returns:
- actual new value of the attribute
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
getChar
GraphFilter.AccessorBridge
forwards the invocation ofCharAttributeAccessor.getChar(Object, GraphState)
to this method. This method has to be overridden by subclasses which make use of accessor bridges in order to return the value for the attribute of the accessor bridge.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodgs
- current graph state- Returns:
- value of the accessor's attribute for the object
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
setChar
protected char setChar(Object object, GraphFilter.AccessorBridge accessor, char value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofCharAttributeAccessor.setChar(Object, char, GraphState)
to this method. This method has to be overridden by subclasses which use accessor bridges to represent writable attributes.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodvalue
- the new value for the attributegs
- current graph state- Returns:
- actual new value of the attribute
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
getInt
GraphFilter.AccessorBridge
forwards the invocation ofIntAttributeAccessor.getInt(Object, GraphState)
to this method. This method has to be overridden by subclasses which make use of accessor bridges in order to return the value for the attribute of the accessor bridge.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodgs
- current graph state- Returns:
- value of the accessor's attribute for the object
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
setInt
GraphFilter.AccessorBridge
forwards the invocation ofIntAttributeAccessor.setInt(Object, int, GraphState)
to this method. This method has to be overridden by subclasses which use accessor bridges to represent writable attributes.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodvalue
- the new value for the attributegs
- current graph state- Returns:
- actual new value of the attribute
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
getLong
GraphFilter.AccessorBridge
forwards the invocation ofLongAttributeAccessor.getLong(Object, GraphState)
to this method. This method has to be overridden by subclasses which make use of accessor bridges in order to return the value for the attribute of the accessor bridge.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodgs
- current graph state- Returns:
- value of the accessor's attribute for the object
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
setLong
protected long setLong(Object object, GraphFilter.AccessorBridge accessor, long value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofLongAttributeAccessor.setLong(Object, long, GraphState)
to this method. This method has to be overridden by subclasses which use accessor bridges to represent writable attributes.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodvalue
- the new value for the attributegs
- current graph state- Returns:
- actual new value of the attribute
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
getFloat
GraphFilter.AccessorBridge
forwards the invocation ofFloatAttributeAccessor.getFloat(Object, GraphState)
to this method. This method has to be overridden by subclasses which make use of accessor bridges in order to return the value for the attribute of the accessor bridge.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodgs
- current graph state- Returns:
- value of the accessor's attribute for the object
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
setFloat
protected float setFloat(Object object, GraphFilter.AccessorBridge accessor, float value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofFloatAttributeAccessor.setFloat(Object, float, GraphState)
to this method. This method has to be overridden by subclasses which use accessor bridges to represent writable attributes.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodvalue
- the new value for the attributegs
- current graph state- Returns:
- actual new value of the attribute
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
getDouble
GraphFilter.AccessorBridge
forwards the invocation ofDoubleAttributeAccessor.getDouble(Object, GraphState)
to this method. This method has to be overridden by subclasses which make use of accessor bridges in order to return the value for the attribute of the accessor bridge.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodgs
- current graph state- Returns:
- value of the accessor's attribute for the object
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
setDouble
protected double setDouble(Object object, GraphFilter.AccessorBridge accessor, double value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofDoubleAttributeAccessor.setDouble(Object, double, GraphState)
to this method. This method has to be overridden by subclasses which use accessor bridges to represent writable attributes.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodvalue
- the new value for the attributegs
- current graph state- Returns:
- actual new value of the attribute
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
getObject
protected Object getObject(Object object, GraphFilter.AccessorBridge accessor, Object placeIn, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofObjectAttributeAccessor.getObject(Object, GraphState)
andObjectAttributeAccessor.getObject(Object, Object, GraphState)
to this method. This method has to be overridden by subclasses which make use of accessor bridges in order to return the value for the attribute of the accessor bridge.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodplaceIn
- an instance for the result may be provided by the callergs
- current graph state- Returns:
- value of the accessor's attribute for the object
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-
setObject
protected Object setObject(Object object, GraphFilter.AccessorBridge accessor, Object value, GraphState gs) GraphFilter.AccessorBridge
forwards the invocation ofObjectAttributeAccessor.setObject(Object, Object, GraphState)
to this method. This method has to be overridden by subclasses which use accessor bridges to represent writable attributes.- Parameters:
object
- the objectaccessor
- the accessor bridge which invokes this methodvalue
- the new value for the attributegs
- current graph state- Returns:
- actual new value of the attribute
- Throws:
NoSuchKeyException
- if the attribute is not defined for the object
-