|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javautils.maps.AbstractTypedMap | +--suvi.api.alg.attr.GraphLayoutAttrMap
Map from an attribute class to the attribute object.
Different graph layout algorithms need different layout attributes. It is not reasonable to design an attribute interface that would contain all possible attributes, because the set of all attributes is not closed. It is still desirable to be able to specify the interface for graph layout algorithms just once, because it makes it easier to parameterize clients by different graph layout algorithms. In order to pass the attributes to the algorithm, we would like to be able to compose the set of attributes dynamically.
A simple design pattern that fits this situation is the Extension Object-pattern described in [PLOP3]. Actually, in this case, we can do with a slightly simpler design. We simply represent the set of attributes as a map from an attribute class to the attribute object. The map can then be created to contain any set of individual attribute objects.
Field Summary |
Fields inherited from class javautils.maps.AbstractTypedMap |
map |
Constructor Summary | |
GraphLayoutAttrMap()
Default constructor for convenience. |
|
GraphLayoutAttrMap(GraphLayoutAttr attr)
A new attribute map that contains the specified attributes. |
|
GraphLayoutAttrMap(GraphLayoutAttr[] attrs)
A new attribute map that contains the specified attributes. |
|
GraphLayoutAttrMap(java.util.Map clsToAttrMap)
A new graph layout attribute map using the given map directly. |
Method Summary | |
java.lang.Class[] |
classes()
The classes of all attribute objects stored in this map. |
GraphLayoutAttr |
get(java.lang.Class cls)
The attribute object that implements the specified attribute interface or null . |
protected boolean |
valuePredicate(java.lang.Object value)
True iff the value is a non null GraphLayoutAttr -object. |
Methods inherited from class javautils.maps.AbstractTypedMap |
clear, clone, containsKey, isEmpty, keyIterator, keySet, remove, size, toString, unmodifiableMap, valueIterator |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public GraphLayoutAttrMap()
Default constructor for convenience.
public GraphLayoutAttrMap(GraphLayoutAttr attr)
A new attribute map that contains the specified attributes.
public GraphLayoutAttrMap(GraphLayoutAttr[] attrs)
A new attribute map that contains the specified attributes.
public GraphLayoutAttrMap(java.util.Map clsToAttrMap)
A new graph layout attribute map using the given map directly.
Method Detail |
protected boolean valuePredicate(java.lang.Object value)
True iff the value is a non null
GraphLayoutAttr
-object.
valuePredicate
in class javautils.maps.AbstractTypedMap
public java.lang.Class[] classes()
The classes of all attribute objects stored in this map.
public GraphLayoutAttr get(java.lang.Class cls)
The attribute object that implements the specified attribute
interface or null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |