|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.grogra.graph.Attribute<T>
public abstract class Attribute<T>
An Attribute
represents an attribute of nodes and edges
in a Graph
. Attribute values are read and
written on objects within the context of a
GraphState
, the corresponding
get
- and set
-methods are declared in
this class, its type-dependent subclasses
(IntAttribute
,
ObjectAttribute
, ...), and in
GraphState
.
Attributes may be derived (see isDerived()
),
which means that their values
are not directly stored in objects, but are computed on the basis
of the state of the object, and possibly of neighbouring objects, too.
Values of derived attributes cannot be written.
Field Summary | |
---|---|
static Attribute[] |
ATTRIBUTE_0
An attribute array of length 0. |
protected Type |
attrType
|
protected Quantity |
quantity
|
Fields inherited from interface de.grogra.util.Described |
---|
ACCELERATOR_KEY, ICON, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, TITLE |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object o)
|
static AttributeAccessor |
find(AttributeAccessor[] accessors,
java.lang.String name)
Finds an attribute accessor corresponding to a name
in a list of accessors . |
static Attribute |
forName(java.lang.String name)
Returns the attribute with the specified name . |
abstract T |
get(java.lang.Object object,
boolean asNode,
GraphState gs)
Returns the value of this attribute for the given object in the given graph state. |
protected java.lang.Object |
getAttributeState(GraphState gs)
|
java.lang.Object |
getDescription(java.lang.String type)
Returns the description associated with the given type . |
int |
getId()
Returns a unique id for this attribute. |
java.lang.String |
getKey()
Returns the unique, fully-qualified name of this attribute. |
Quantity |
getQuantity()
Returns the physical quantity of this attribute. |
java.lang.String |
getSimpleName()
Returns the simple name of this attribute. |
Type |
getType()
Returns the type of values of this attribute. |
int |
hashCode()
|
Attribute |
initializeI18N(I18NBundle bundle,
java.lang.String resourceKey)
|
Attribute |
initializeName(java.lang.String name)
|
boolean |
isContained(Attribute[] b)
Checks whether this attribute is contained in the sorted array b . |
boolean |
isDerived()
Determines whether this is a derived attribute or not. |
boolean |
isWritable(java.lang.Object object,
boolean asNode,
GraphState gs)
Checks whether a value for this attribute can be written to the given object. |
abstract T |
set(java.lang.Object object,
boolean asNode,
java.lang.Object value,
GraphState gs)
Sets the value of this attribute for the given object
to the given value |
protected void |
setAttributeState(GraphState gs,
java.lang.Object info)
|
Attribute[] |
toArray()
Returns an array of length one containing this attribute. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Attribute[] ATTRIBUTE_0
protected final Type attrType
protected final Quantity quantity
Method Detail |
---|
public final int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public static AttributeAccessor find(AttributeAccessor[] accessors, java.lang.String name)
name
in a list of accessors
. If the attribute of one of the
accessors
has a name or a simple name which equals
the given name
, then this accessor is returned, otherwise
null
. null
-values are allowed within
accessors
.
accessors
- the array of accessorsname
- the name to search
name
,
or null
public static final Attribute forName(java.lang.String name)
name
.
If an attribute with that name has not yet been registered
by initializeName(String)
, null
is
returned.
name
- name of an attribute
null
public abstract T get(java.lang.Object object, boolean asNode, GraphState gs)
object
- the objectasNode
- true
if object
is a node,
false
if object
is an edgegs
- the graph state context
protected final java.lang.Object getAttributeState(GraphState gs)
public java.lang.Object getDescription(java.lang.String type)
Described
type
.
type
has to be one of the predefined constants
of this interface, the returned value has to conform to the
specification of the used constant.
getDescription
in interface Described
type
- the type of description
null
if no description is availablepublic final int getId()
public final java.lang.String getKey()
getKey
in interface KeyDescription
public final Quantity getQuantity()
getQuantity
in interface KeyDescription
public final java.lang.String getSimpleName()
public final Type getType()
getType
in interface KeyDescription
public final int hashCode()
hashCode
in class java.lang.Object
public final Attribute initializeI18N(I18NBundle bundle, java.lang.String resourceKey)
public final Attribute initializeName(java.lang.String name)
public final boolean isContained(Attribute[] b)
b
. The array has to be sorted in ascending order
according to the order induced by compareTo(Object)
.
b
- a sorted array of attributes
true
iff this attribute is contained in b
public boolean isDerived()
true
iff this is a derived attributepublic boolean isWritable(java.lang.Object object, boolean asNode, GraphState gs)
object
- the objectasNode
- true
if object
is a node,
false
if object
is an edgegs
- the graph state context
true
iff the attribute is writable for the given objectpublic abstract T set(java.lang.Object object, boolean asNode, java.lang.Object value, GraphState gs)
object
to the given value
object
- the objectasNode
- true
if object
is a node,
false
if object
is an edgevalue
- the new value of the attribute for the objectgs
- the graph state contextprotected final void setAttributeState(GraphState gs, java.lang.Object info)
public final Attribute[] toArray()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |