org.simantics.databoard.type
Class Datatype

java.lang.Object
  extended by org.simantics.databoard.type.Datatype
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
ArrayType, BooleanType, MapType, NumberType, OptionalType, RecordType, StringType, UnionType, VariantType

public abstract class Datatype
extends java.lang.Object
implements java.lang.Cloneable


Nested Class Summary
static interface Datatype.Visitor<T>
           
static interface Datatype.Visitor1
           
 
Field Summary
 java.util.TreeMap<java.lang.String,java.lang.String> metadata
           
 
Constructor Summary
Datatype()
           
 
Method Summary
abstract
<T> T
accept(Datatype.Visitor<T> v)
           
abstract  void accept(Datatype.Visitor1 v, java.lang.Object obj)
           
 boolean equals(java.lang.Object obj)
          Deep equals-compare
abstract  int getComponentCount()
          Get component type count
abstract  Datatype getComponentType(ChildReference path)
          Get component type
abstract  Datatype getComponentType(int index)
          Get component type
 int hashCode()
           
 int metadataHashCode()
           
 java.lang.String toSingleLineString()
          Print the type in data type notation.
 java.lang.String toString()
          Print the type in data type notation.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

metadata

public java.util.TreeMap<java.lang.String,java.lang.String> metadata
Constructor Detail

Datatype

public Datatype()
Method Detail

getComponentCount

public abstract int getComponentCount()
Get component type count

Returns:
component count

getComponentType

public abstract Datatype getComponentType(int index)
Get component type

Parameters:
index - component index
Returns:
datatype

getComponentType

public abstract Datatype getComponentType(ChildReference path)
Get component type

Parameters:
path - child path or null to return this.
Returns:
datatype
Throws:
java.lang.IllegalArgumentException - if path cannot be applied to this type

toString

public java.lang.String toString()
Print the type in data type notation. Datatype Notation See Datatypes.getDatatype(String) to parse string to data type.

Overrides:
toString in class java.lang.Object
Returns:
type

toSingleLineString

public java.lang.String toSingleLineString()
Print the type in data type notation. Datatype Notation See Datatypes.getDatatype(String) to parse string to data type.

Returns:
type

accept

public abstract void accept(Datatype.Visitor1 v,
                            java.lang.Object obj)

accept

public abstract <T> T accept(Datatype.Visitor<T> v)

equals

public boolean equals(java.lang.Object obj)
Deep equals-compare

Overrides:
equals in class java.lang.Object
Parameters:
obj - object to compare with
Returns:
true if the object is equal (incl. structurally) with this object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

metadataHashCode

public int metadataHashCode()