xtc.type
Class InstantiatedT

java.lang.Object
  extended by xtc.tree.Node
      extended by xtc.type.Type
          extended by xtc.type.WrappedT
              extended by xtc.type.InstantiatedT
All Implemented Interfaces:
java.lang.Iterable<java.lang.Object>, Locatable

public class InstantiatedT
extends WrappedT

An instantiated type.

Version:
$Revision: 1.4 $
Author:
Robert Grimm

Nested Class Summary
 
Nested classes/interfaces inherited from class xtc.type.Type
Type.Tag
 
Constructor Summary
InstantiatedT(java.util.List<Type> arguments, Type type)
          Create a new instantiated type.
InstantiatedT(Type template, java.util.List<Type> arguments, Type type)
          Create a new instantiated type.
InstantiatedT(Type argument, Type type)
          Create a new instantiated type.
 
Method Summary
 InstantiatedT copy()
          Create a deep copy of this type.
 boolean equals(java.lang.Object o)
          Determine whether this type equals the specified object.
 java.util.List<Type> getArguments()
          Get this instantiated type's arguments.
 boolean hasInstantiated()
          Determine whether this type has an instantiated type.
 boolean isInstantiated()
          Determine whether this type is instantiated.
 Type seal()
          Seal this type.
 InstantiatedT toInstantiated()
          Get this type as an instantiated type.
 void write(java.lang.Appendable out)
          Write a human readable representation to the specified appendable.
 Type.Tag wtag()
          Get this wrapped type's tag.
 
Methods inherited from class xtc.type.WrappedT
getAttribute, getConstant, getLanguage, getLocation, getScope, getShape, getType, hasAlias, hasAnnotated, hasAttribute, hasConstant, hasEnum, hasEnumerator, hashCode, hasLanguage, hasLocation, hasParameterized, hasScope, hasShape, hasTagged, hasVariable, isWrapped, resolve, setType, tag, toAlias, toAnnotated, toEnum, toEnumerator, toParameterized, toStructOrUnion, toTagged, toVariable, toWrapped
 
Methods inherited from class xtc.type.Type
addAttribute, annotate, attribute, attribute, attribute, attributes, cast, checkNotSealed, constant, constant, copy, deannotate, getAttribute, getConstant, getLanguage, getLocation, getScope, getShape, hasAttribute, hasAttribute, hasAttribute, hasAttributes, hasConstant, hasError, hasLanguage, hasLocation, hasScope, hasShape, hasStructOrUnion, hasTag, hasWTag, isAlias, isAnnotated, isArray, isBoolean, isClass, isConcrete, isDerived, isEnum, isEnumerator, isError, isFloat, isFunction, isInteger, isInterface, isInternal, isInternalParameter, isLabel, isMethod, isNamedParameter, isNumber, isPackage, isParameter, isParameterized, isPointer, isSealed, isStruct, isTuple, isUnion, isUnit, isVariable, isVariant, isVoid, isWildcard, language, locate, locate, mark, properties, removeAttribute, removeProperty, resolve, scope, seal, setLocation, setLocation, setProperty, shape, shape, toArray, toBoolean, toClass, toFloat, toFunction, toInteger, toInterface, toInternal, toInternalParameter, toLabel, toMethod, toNamedParameter, toNumber, toPackage, toParameter, toPointer, toStruct, toTuple, toUnion, toUnit, toVariant, toVoid, toWildcard, trace
 
Methods inherited from class xtc.tree.Node
add, add, addAll, addAll, addAll, addAll, addAllTo, addNode, contains, get, getBoolean, getBooleanProperty, getGeneric, getList, getName, getNode, getProperty, getString, getStringProperty, getTokenText, hasName, 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
 

Constructor Detail

InstantiatedT

public InstantiatedT(Type argument,
                     Type type)
Create a new instantiated type. The specified type must contain a parameterized type with a single parameter.

Parameters:
argument - The argument.
type - The type.
Throws:
java.lang.IllegalArgumentException - Signals that the specified type does not contain a parameterized type or that the number of arguments does not match the parameterized type's number of parameters.

InstantiatedT

public InstantiatedT(java.util.List<Type> arguments,
                     Type type)
Create a new instantiated type. The specified type must contain a parameterized type with the same number of parameters as the specified arguments.

Parameters:
arguments - The arguments.
type - The type.
Throws:
java.lang.IllegalArgumentException - Signals that the specified type does not contain a parameterized type or that the number of arguments does not match the parameterized type's number of parameters.

InstantiatedT

public InstantiatedT(Type template,
                     java.util.List<Type> arguments,
                     Type type)
Create a new instantiated type.

Parameters:
template - The type whose annotations to copy.
arguments - The arguments.
type - The type.
Throws:
java.lang.IllegalArgumentException - Signals that the specified type does not contain a parameterized type or that the number of arguments does not match the parameterized type's number of parameters.
Method Detail

copy

public InstantiatedT 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.

seal

public Type seal()
Description copied from class: Type
Seal this type. Subclasses that reference other types must override this method and, if the instance is not sealed, first invoke the superclass' version and then seal all referenced types. For example, if a subclass references a single type type, the corresponding overridden method reads:
 public Type seal() {
   if (! isSealed()) {
     super.seal();
     type.seal();
   }
   return this;
 }
 
First testing whether a type is sealed and then invoking the superclass' seal() method avoids infinite recursions for mutually recursive types.

Overrides:
seal in class WrappedT
Returns:
This type.
See Also:
Type.seal(List)

wtag

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

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

isInstantiated

public boolean isInstantiated()
Description copied from class: Type
Determine whether this type is instantiated.

Overrides:
isInstantiated in class Type
Returns:
true if this type is instantiated.

hasInstantiated

public boolean hasInstantiated()
Description copied from class: Type
Determine whether this type has an instantiated type.

Overrides:
hasInstantiated in class WrappedT
Returns:
true if this type has an instantiated type.

toInstantiated

public InstantiatedT toInstantiated()
Description copied from class: Type
Get this type as an instantiated type.

Overrides:
toInstantiated in class WrappedT
Returns:
This type as an instantiated type.

getArguments

public java.util.List<Type> getArguments()
Get this instantiated type's arguments.

Returns:
The arguments.

equals

public boolean equals(java.lang.Object o)
Determine whether this type equals the specified object. This instantiated type equals the specified object if the object is an equal wrapped type instantiated with equal types.

Overrides:
equals in class WrappedT
Parameters:
o - The object.
Returns:
true if this type equals the specified object.

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.