xtc.type
Class UnionT

java.lang.Object
  extended by xtc.tree.Node
      extended by xtc.type.Type
          extended by xtc.type.DerivedT
              extended by xtc.type.StructOrUnionT
                  extended by xtc.type.UnionT
All Implemented Interfaces:
java.lang.Iterable<java.lang.Object>, Locatable, Tagged

public class UnionT
extends StructOrUnionT

A union type.

Version:
$Revision: 1.20 $
Author:
Robert Grimm

Nested Class Summary
 
Nested classes/interfaces inherited from class xtc.type.Type
Type.Tag
 
Field Summary
 
Fields inherited from class xtc.type.StructOrUnionT
members, name, nonce
 
Constructor Summary
UnionT(java.lang.String tag)
          Create a new, incomplete union type.
UnionT(java.lang.String tag, java.util.List<VariableT> members)
          Create a new union type with a fresh nonce.
UnionT(Type template, Nonce nonce, java.lang.String tag, java.util.List<VariableT> members)
          Create a new union type.
 
Method Summary
 UnionT copy()
          Create a deep copy of this type.
 boolean isUnion()
          Determine whether this type is a union.
 Type.Tag tag()
          Get this type's tag.
 UnionT toUnion()
          Get this type as a union.
 void write(java.lang.Appendable out)
          Write a human readable representation to the specified appendable.
 
Methods inherited from class xtc.type.StructOrUnionT
equals, getMember, getMemberCount, getMembers, getName, getNonce, hashCode, hasName, hasTagged, isUnnamed, lookup, seal, setMembers, toStructOrUnion, toTagged
 
Methods inherited from class xtc.type.DerivedT
isDerived
 
Methods inherited from class xtc.type.Type
addAttribute, annotate, attribute, attribute, attribute, attributes, cast, checkNotSealed, constant, constant, copy, deannotate, getAttribute, getAttribute, getConstant, getConstant, getLanguage, getLanguage, getLocation, getLocation, getScope, getScope, getShape, getShape, hasAlias, hasAnnotated, hasAttribute, hasAttribute, hasAttribute, hasAttribute, hasAttributes, hasConstant, hasConstant, hasEnum, hasEnumerator, hasError, hasInstantiated, hasLanguage, hasLanguage, hasLocation, hasLocation, hasParameterized, hasScope, hasScope, hasShape, hasShape, hasStructOrUnion, hasTag, hasVariable, hasWTag, isAlias, isAnnotated, isArray, isBoolean, isClass, isConcrete, isEnum, isEnumerator, isError, isFloat, isFunction, isInstantiated, isInteger, isInterface, isInternal, isInternalParameter, isLabel, isMethod, isNamedParameter, isNumber, isPackage, isParameter, isParameterized, isPointer, isSealed, isStruct, isTuple, isUnit, isVariable, isVariant, isVoid, isWildcard, isWrapped, language, locate, locate, mark, properties, removeAttribute, removeProperty, resolve, resolve, scope, seal, setLocation, setLocation, setProperty, shape, shape, toAlias, toAnnotated, toArray, toBoolean, toClass, toEnum, toEnumerator, toFloat, toFunction, toInstantiated, toInteger, toInterface, toInternal, toInternalParameter, toLabel, toMethod, toNamedParameter, toNumber, toPackage, toParameter, toParameterized, toPointer, toStruct, toTuple, toUnit, toVariable, toVariant, toVoid, toWildcard, toWrapped, trace, wtag
 
Methods inherited from class xtc.tree.Node
add, add, addAll, addAll, addAll, addAll, addAllTo, addNode, contains, get, getBoolean, getBooleanProperty, getGeneric, getList, getNode, getProperty, getString, getStringProperty, getTokenText, hasProperty, hasTraversal, indexOf, isAnnotation, isEmpty, isGeneric, isList, isToken, iterator, lastIndexOf, remove, set, size, strip, toAnnotation, toList, toString, toToken
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface xtc.type.Tagged
isEnum, isStruct
 

Constructor Detail

UnionT

public UnionT(java.lang.String tag)
Create a new, incomplete union type. The newly created union type has a fresh nonce.

Parameters:
tag - The tag.
Throws:
java.lang.NullPointerException - Signals a null tag.

UnionT

public UnionT(java.lang.String tag,
              java.util.List<VariableT> members)
Create a new union type with a fresh nonce. The newly created union type has a fresh nonce.

Parameters:
tag - The tag.
members - The members.
Throws:
java.lang.NullPointerException - Signals a null tag.

UnionT

public UnionT(Type template,
              Nonce nonce,
              java.lang.String tag,
              java.util.List<VariableT> members)
Create a new union type.

Parameters:
template - The type whose annotations to copy.
nonce - The nonce.
tag - The tag.
members - The members.
Throws:
java.lang.NullPointerException - Signals a null tag.
Method Detail

copy

public UnionT copy()
Description copied from class: Type
Create a deep copy of this type. The resulting type is not sealed.

Specified by:
copy in class Type
Returns:
A deep copy of this type.

tag

public Type.Tag tag()
Description copied from class: Type
Get this type's tag. Invocations to this method are forwarded across wrapped types.

Specified by:
tag in class Type
Returns:
This type's tag.
See Also:
Type.wtag()

isUnion

public boolean isUnion()
Description copied from class: Type
Determine whether this type is a union.

Specified by:
isUnion in interface Tagged
Overrides:
isUnion in class Type
Returns:
true if this type is a union.

toUnion

public UnionT toUnion()
Description copied from class: Type
Get this type as a union.

Overrides:
toUnion in class Type
Returns:
This type as a union.

write

public void write(java.lang.Appendable out)
           throws java.io.IOException
Description copied from class: Node
Write a human readable representation to the specified appendable. If this node supports generic traversal, the default implementation writes this node in algebraic term-format; otherwise, it writes the string returned by Object.toString().

Overrides:
write in class Node
Parameters:
out - The appendable.
Throws:
java.io.IOException - Signals an I/O error.


Copyright © 2012. All Rights Reserved.