org.nodal.type
Interface Type

All Superinterfaces:
Nameable
All Known Subinterfaces:
MapType, MapType.Editor, NodeType, NodeType.Editor, RecordType, RecordType.Editor, RestrictionType, RestrictionType.Editor, SequenceType, SequenceType.Editor, UnionType, UnionType.Editor
All Known Implementing Classes:
TypeFilter

public interface Type
extends Nameable

A NODAL data type.

A data type in NODAL is represented by an instance of Type, and each such instance represents an ability to check for the type validity of various potential inputs (via the accepts methods), and an ability to convert to an acceptable type (via the as methods).

Author:
Lee Iverson

Method Summary
 boolean accepts(boolean b)
          Check that this type accepts the boolean value.
 boolean accepts(byte b)
          Check that this type accepts the byte value.
 boolean accepts(char c)
          Check that this type accepts the char value.
 boolean accepts(double d)
          Check that this type accepts the double value.
 boolean accepts(float s)
          Check that this type accepts the float value.
 boolean accepts(int i)
          Check that this type accepts the int value.
 boolean accepts(long l)
          Check that this type accepts the long value.
 boolean accepts(java.lang.Object v)
          Check that this type accepts the Object.
 boolean accepts(short s)
          Check that this type accepts the short value.
 boolean acceptsNode(Node n)
          Check that this type accepts the Node.
 boolean acceptsString(java.lang.String s)
          Check that this type accepts the String.
 boolean acceptsType(Type t)
          Check that this type accepts a value with the given Type.
 java.lang.Object from(boolean b)
          Convert a boolean value to this Type (if possible).
 java.lang.Object from(byte b)
          Convert a byte value to this Type (if possible).
 java.lang.Object from(char c)
          Convert a char value to this Type (if possible).
 java.lang.Object from(double d)
          Convert a double value to this Type (if possible).
 java.lang.Object from(float f)
          Convert a float value to this Type (if possible).
 java.lang.Object from(int i)
          Convert an int value to this Type (if possible).
 java.lang.Object from(long l)
          Convert a long value to this Type (if possible).
 java.lang.Object from(java.lang.Object v)
          Convert an Object to this Type (if possible).
 java.lang.Object from(short s)
          Convert a short value to this Type (if possible).
 java.lang.Object fromNode(Node n)
          Convert a Node to this Type (if possible).
 java.lang.Object fromString(java.lang.String s)
          Convert a String to this Type (if possible).
 boolean isNodeType()
          Is this a NodeType?
 Type type()
          The base Type associated with this interface.
 
Methods inherited from interface org.nodal.util.Nameable
name, setName
 

Method Detail

type

public Type type()
The base Type associated with this interface.

Interfaces that extend the Type interface should override this method to refer back to the Type from which they are derived.

See Also:
TypeFilter, NodeType.Editor

accepts

public boolean accepts(boolean b)
Check that this type accepts the boolean value.


accepts

public boolean accepts(char c)
Check that this type accepts the char value.


accepts

public boolean accepts(byte b)
Check that this type accepts the byte value.


accepts

public boolean accepts(short s)
Check that this type accepts the short value.


accepts

public boolean accepts(int i)
Check that this type accepts the int value.


accepts

public boolean accepts(long l)
Check that this type accepts the long value.


accepts

public boolean accepts(float s)
Check that this type accepts the float value.


accepts

public boolean accepts(double d)
Check that this type accepts the double value.


acceptsString

public boolean acceptsString(java.lang.String s)
Check that this type accepts the String.


acceptsNode

public boolean acceptsNode(Node n)
Check that this type accepts the Node.


accepts

public boolean accepts(java.lang.Object v)
Check that this type accepts the Object.


acceptsType

public boolean acceptsType(Type t)
Check that this type accepts a value with the given Type.

This is a much more specific test than the value-based accepts tests, since it returns true only if all values of the parameter type are accepted by this Type. As such, this function tests a strict sub-type relationship.


from

public java.lang.Object from(boolean b)
Convert a boolean value to this Type (if possible).


from

public java.lang.Object from(char c)
Convert a char value to this Type (if possible).


from

public java.lang.Object from(byte b)
Convert a byte value to this Type (if possible).


from

public java.lang.Object from(short s)
Convert a short value to this Type (if possible).


from

public java.lang.Object from(int i)
Convert an int value to this Type (if possible).


from

public java.lang.Object from(long l)
Convert a long value to this Type (if possible).


from

public java.lang.Object from(float f)
Convert a float value to this Type (if possible).


from

public java.lang.Object from(double d)
Convert a double value to this Type (if possible).


fromString

public java.lang.Object fromString(java.lang.String s)
Convert a String to this Type (if possible).


fromNode

public java.lang.Object fromNode(Node n)
Convert a Node to this Type (if possible).


from

public java.lang.Object from(java.lang.Object v)
Convert an Object to this Type (if possible).


isNodeType

public boolean isNodeType()
Is this a NodeType?