|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.graphstream.graph.implementations.OneAttributeElement
public abstract class OneAttributeElement
An implementation of an Element
.
It allows only one attribute and has no internal map structure. It is not used and may be removed.
Nested Class Summary | |
---|---|
static class |
OneAttributeElement.AttributeChangeEvent
|
Constructor Summary | |
---|---|
OneAttributeElement(String id)
New element. |
Method Summary | ||
---|---|---|
void |
addAttribute(String attribute,
Object value)
|
|
void |
addAttributes(Map<String,Object> attributes)
Add or replace each attribute found in attributes. |
|
void |
changeAttribute(String attribute,
Object value)
|
|
void |
clearAttributes()
Remove all registered attributes. |
|
|
getAttribute(String key)
Get the attribute object bound to the given key. |
|
|
getAttribute(String key,
Class<T> clazz)
Get the attribute object bound to the given key if it is an instance of the given class. |
|
Iterator<String> |
getAttributeKeyIterator()
Iterator on all attributes keys. |
|
Map<String,Object> |
getAttributeMap()
|
|
|
getFirstAttributeOf(Class<T> clazz,
String... keys)
Like Element.getAttribute(String, Class) , but returns the first existing
attribute in a list of keys, instead of only one key. |
|
|
getFirstAttributeOf(String... keys)
Like Element.getAttribute(String) , but returns the first existing
attribute in a list of keys, instead of only one key. |
|
String |
getId()
Unique identifier of this element. |
|
CharSequence |
getLabel(String key)
Get the label string bound to the given key key. |
|
double |
getNumber(String key)
Get the number bound to key. |
|
ArrayList<? extends Number> |
getVector(String key)
Get the vector of number bound to key. |
|
boolean |
hasAttribute(String key)
Does this element store a value for the given attribute key? |
|
boolean |
hasAttribute(String key,
Class<?> clazz)
Does this element store a value for the given attribute key and this value is an instance of the given class? |
|
boolean |
hasLabel(String key)
Does this element store a label value for the given key? |
|
boolean |
hasNumber(String key)
Does this element store a number for the given key? |
|
boolean |
hasVector(String key)
Does this element store a vector value for the given key? |
|
void |
removeAttribute(String attribute)
Remove an attribute. |
|
String |
toString()
Override the Object method |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.graphstream.graph.Element |
---|
addAttribute, changeAttribute, getArray, getAttributeCount, getAttributeKeySet, getHash, getIndex, hasArray, hasHash, setAttribute |
Constructor Detail |
---|
public OneAttributeElement(String id)
id
- The unique identifier of this element.Method Detail |
---|
public String getId()
Element
getId
in interface Element
public <T> T getAttribute(String key)
Element
getAttribute
in interface Element
key
- Name of the attribute to search.
public <T> T getFirstAttributeOf(String... keys)
Element
Element.getAttribute(String)
, but returns the first existing
attribute in a list of keys, instead of only one key. The key list order
matters.
getFirstAttributeOf
in interface Element
keys
- Several strings naming attributes.
public <T> T getAttribute(String key, Class<T> clazz)
Element
getAttribute
in interface Element
key
- The attribute name to search.clazz
- The expected attribute class.
public <T> T getFirstAttributeOf(Class<T> clazz, String... keys)
Element
Element.getAttribute(String, Class)
, but returns the first existing
attribute in a list of keys, instead of only one key. The key list order
matters.
getFirstAttributeOf
in interface Element
clazz
- The class the attribute must be instance of.keys
- Several string naming attributes.
public CharSequence getLabel(String key)
Element
getLabel
in interface Element
key
- The label to search.
public double getNumber(String key)
Element
getNumber
in interface Element
key
- The name of the number to search.
public ArrayList<? extends Number> getVector(String key)
Element
getVector
in interface Element
key
- The name of the number to search.
public boolean hasAttribute(String key)
Element
hasAttribute
in interface Element
key
- The name of the attribute to search.
public boolean hasAttribute(String key, Class<?> clazz)
Element
hasAttribute
in interface Element
key
- The name of the attribute to search.clazz
- The expected class of the attribute value.
public boolean hasLabel(String key)
Element
hasLabel
in interface Element
key
- The name of the label.
public boolean hasNumber(String key)
Element
hasNumber
in interface Element
key
- The name of the number.
public boolean hasVector(String key)
Element
hasVector
in interface Element
key
- The name of the vector.
public Iterator<String> getAttributeKeyIterator()
Element
getAttributeKeyIterator
in interface Element
public Map<String,Object> getAttributeMap()
public String toString()
toString
in class Object
public void clearAttributes()
Element
clearAttributes
in interface Element
public void addAttribute(String attribute, Object value)
public void changeAttribute(String attribute, Object value)
public void addAttributes(Map<String,Object> attributes)
Element
addAttributes
in interface Element
attributes
- A set of (key,value) pairs.public void removeAttribute(String attribute)
Element
removeAttribute
in interface Element
attribute
- Name of the attribute to remove.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |