org.graphstream.graph
Interface CompoundAttribute


public interface CompoundAttribute

Definition of some compound value that can be used as attribute and can be transformed to a hash map.

The purpose of this class is to allow to specify how some values are stored in the graph and can be exported to files (or others) when the graph is output. Most graph writers can only handle basic types for attributes (when they are able to store attributes in files). This interface may allow to store more complex attributes, made of several elements. The DGS writer is able to understand these kinds of attributes and store them in files.

The compound attribute is made of fields. Each fields has a name and a value. For these fields to be exported successfully, they must be transformable to a hash map where each element is indexed by its name (a String).

For the values to be exported successfully, they must either be basic types, or be themselves instances of CompountAttribute.


Method Summary
 String getKey()
          The usual key used to store this attribute inside a graph element.
 HashMap<?,?> toHashMap()
          Transforms this object to a hash map where each field is stored as a pair (key,value) where the key is the field name.
 

Method Detail

toHashMap

HashMap<?,?> toHashMap()
Transforms this object to a hash map where each field is stored as a pair (key,value) where the key is the field name. As we cannot enforce the types of the key and value, the key are considered strings (or Object.toString()). The value is an arbitrary object.

Returns:
The conversion of this attribute to a hash.

getKey

String getKey()
The usual key used to store this attribute inside a graph element.

Returns:
The attribute usual name.


Copyright © 2012. All Rights Reserved.