Satsuma
a delicious .NET graph library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Pages
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Properties | List of all members
Satsuma.IO.GraphML.DictionaryProperty< T > Class Template Referenceabstract

A property which can store values in a dictionary. More...

Inheritance diagram for Satsuma.IO.GraphML.DictionaryProperty< T >:
Satsuma.IO.GraphML.GraphMLProperty Satsuma.IClearable Satsuma.IO.GraphML.NodeGraphicsProperty Satsuma.IO.GraphML.StandardProperty< T >

Public Member Functions

void Clear ()
 Clears all values (including the default value) stored by the property. More...
 
virtual XElement GetKeyElement ()
 Returns a <key> element for the property. More...
 
override void ReadData (XElement x, object key)
 Parses an XML value definition. More...
 
bool TryGetValue (object key, out T result)
 Tries to get the property value for a given object. More...
 
override XElement WriteData (object key)
 Writes an XML value definition. More...
 

Protected Member Functions

 DictionaryProperty ()
 
virtual void LoadFromKeyElement (XElement xKey)
 Loads the declaration of the property from the given <key> element (including the default value). More...
 
abstract T ReadValue (XElement x)
 Parses an XML value definition. More...
 
abstract XElement WriteValue (T value)
 Writes an XML value definition. More...
 

Static Protected Member Functions

static string DomainToGraphML (PropertyDomain domain)
 Converts the domain to a GraphML string representation. More...
 
static PropertyDomain ParseDomain (string s)
 Parses the string representation of a GraphML domain. More...
 

Properties

DefaultValue [get, set]
 The default value of the property. Undefined if HasDefaultValue is false. More...
 
PropertyDomain Domain [get, set]
 The domain of the property, i.e. the kind of objects the property applies to. More...
 
bool HasDefaultValue [get, set]
 true if DefaultValue should be taken into account as the default value for this property. More...
 
string Id [get, set]
 The unique identifier of the property in the GraphML file. More...
 
string Name [get, set]
 The name of the property. More...
 
Dictionary< object, T > Values [get, set]
 The values of the property for the individual objects. More...
 

Detailed Description

A property which can store values in a dictionary.

Definition at line 140 of file IO.GraphML.cs.

Constructor & Destructor Documentation

Satsuma.IO.GraphML.DictionaryProperty< T >.DictionaryProperty ( )
protected

Definition at line 151 of file IO.GraphML.cs.

Member Function Documentation

void Satsuma.IO.GraphML.DictionaryProperty< T >.Clear ( )

Clears all values (including the default value) stored by the property.

Implements Satsuma.IClearable.

Definition at line 158 of file IO.GraphML.cs.

static string Satsuma.IO.GraphML.GraphMLProperty.DomainToGraphML ( PropertyDomain  domain)
staticprotectedinherited

Converts the domain to a GraphML string representation.

Definition at line 70 of file IO.GraphML.cs.

virtual XElement Satsuma.IO.GraphML.GraphMLProperty.GetKeyElement ( )
virtualinherited

Returns a <key> element for the property.

This element declares the property in a GraphML file.

Reimplemented in Satsuma.IO.GraphML.NodeGraphicsProperty, and Satsuma.IO.GraphML.StandardProperty< T >.

Definition at line 108 of file IO.GraphML.cs.

virtual void Satsuma.IO.GraphML.GraphMLProperty.LoadFromKeyElement ( XElement  xKey)
protectedvirtualinherited

Loads the declaration of the property from the given <key> element (including the default value).

Definition at line 95 of file IO.GraphML.cs.

static PropertyDomain Satsuma.IO.GraphML.GraphMLProperty.ParseDomain ( string  s)
staticprotectedinherited

Parses the string representation of a GraphML domain.

Possible input values: "node", "edge", "graph", "all".

Definition at line 83 of file IO.GraphML.cs.

override void Satsuma.IO.GraphML.DictionaryProperty< T >.ReadData ( XElement  x,
object  key 
)
virtual

Parses an XML value definition.

Parameters
xA <data> or <default> element, which stores either the default value or the value taken on a node, arc or graph. If null, the data for key is erased.
keyA Node, Arc or IGraph, for which the loaded value will be stored. If null, the default value is loaded/erased.

Implements Satsuma.IO.GraphML.GraphMLProperty.

Definition at line 181 of file IO.GraphML.cs.

abstract T Satsuma.IO.GraphML.DictionaryProperty< T >.ReadValue ( XElement  x)
protectedpure virtual

Parses an XML value definition.

Parameters
xA non-null <data> or <default> element compatible with the property.
Returns
The parsed value.

Implemented in Satsuma.IO.GraphML.NodeGraphicsProperty, and Satsuma.IO.GraphML.StandardProperty< T >.

bool Satsuma.IO.GraphML.DictionaryProperty< T >.TryGetValue ( object  key,
out T  result 
)

Tries to get the property value for a given object.

First, key is looked up in Values. If not found, DefaultValue is used, unless HasDefaultValue is false.

Parameters
keyA Node, Arc or IGraph.
resultThe property value assigned to the key is returned here, or default(T) if none found.
Returns
true if key was found as a key in Values, or HasDefaultValue is true.

Definition at line 169 of file IO.GraphML.cs.

override XElement Satsuma.IO.GraphML.DictionaryProperty< T >.WriteData ( object  key)
virtual

Writes an XML value definition.

Parameters
keyA Node, Arc or IGraph, whose value will be returned as an XML representation. If null, the default value is used.
Returns
A data element, or null if there was no special value stored for the object.

Implements Satsuma.IO.GraphML.GraphMLProperty.

Definition at line 201 of file IO.GraphML.cs.

abstract XElement Satsuma.IO.GraphML.DictionaryProperty< T >.WriteValue ( value)
protectedpure virtual

Writes an XML value definition.

Returns
A data element containing the definition of value.

Implemented in Satsuma.IO.GraphML.StandardProperty< T >.

Property Documentation

T Satsuma.IO.GraphML.DictionaryProperty< T >.DefaultValue
getset

The default value of the property. Undefined if HasDefaultValue is false.

Definition at line 145 of file IO.GraphML.cs.

PropertyDomain Satsuma.IO.GraphML.GraphMLProperty.Domain
getsetinherited

The domain of the property, i.e. the kind of objects the property applies to.

Definition at line 58 of file IO.GraphML.cs.

bool Satsuma.IO.GraphML.DictionaryProperty< T >.HasDefaultValue
getset

true if DefaultValue should be taken into account as the default value for this property.

Definition at line 143 of file IO.GraphML.cs.

string Satsuma.IO.GraphML.GraphMLProperty.Id
getsetinherited

The unique identifier of the property in the GraphML file.

This field is for internal use. When saving, it is ignored and replaced by an auto-generated identifier.

Definition at line 62 of file IO.GraphML.cs.

string Satsuma.IO.GraphML.GraphMLProperty.Name
getsetinherited

The name of the property.

Can be either null or a nonempty string. It is advisable but not necessary to keep names unique.

Definition at line 56 of file IO.GraphML.cs.

Dictionary<object, T> Satsuma.IO.GraphML.DictionaryProperty< T >.Values
getset

The values of the property for the individual objects.

Keys must be of type Node, Arc or IGraph, as specified by Domain. This dictionary need not contain entries for all objects (e.g. nodes, arcs).

Definition at line 149 of file IO.GraphML.cs.


The documentation for this class was generated from the following file: