uk.ac.man.cs.rainbow.datamodel
Class Type.Union
java.lang.Object
|
+--uk.ac.man.cs.rainbow.datamodel.Type
|
+--uk.ac.man.cs.rainbow.datamodel.Type.Union
- All Implemented Interfaces:
- Argument, Data.Union.T, Serializable, Type
- Enclosing class:
- Type
- public static class Type.Union
- extends Type
- implements Data.Union.T
The class of types of unions.
- See Also:
Data.Union
, Serialized Form
types
protected Type[] types
tags
protected String[] tags
Type.Union
public Type.Union(Type[] types,
String[] fieldNames)
toString
public String toString()
- Description copied from class:
Type
- Render the type as a string. Must be specified by real types.
- Overrides:
toString
in class Type
render
public String render(Expression contents,
int index)
- Description copied from interface:
Data.Union.T
- Render a union, given the value and tag that the union is
defined by.
- Specified by:
render
in interface Data.Union.T
countTags
public int countTags()
- Description copied from interface:
Data.Union.T
- How many tags are there?
- Specified by:
countTags
in interface Data.Union.T
getTag
public String getTag(int idx)
- Description copied from interface:
Data.Union.T
- Get the name of the idxth tag.
- Specified by:
getTag
in interface Data.Union.T
- Following copied from interface:
uk.ac.man.cs.rainbow.datamodel.Data.Union.T
- Throws:
TypeException
- If the index is out of range.
getType
public Type getType(int idx)
- Description copied from interface:
Data.Union.T
- Get the type of the idxth tag.
- Specified by:
getType
in interface Data.Union.T
getTagEnumeration
public Type getTagEnumeration()
throws TypeException
- Description copied from interface:
Data.Union.T
- Get an enumeration of the tags.
- Specified by:
getTagEnumeration
in interface Data.Union.T
equals
public boolean equals(Type t)
- Description copied from class:
Type
- Test for equality between types.
- Overrides:
equals
in class Type
getIndex
public int getIndex(String fieldName)
throws TypeException
- Convert an option name into an integer index into the type.
- Specified by:
getIndex
in interface Data.Union.T
- Throws:
TypeException
- If the option name is not known in the type.