antlraux package
v0.2.1

antlraux.context.types
Interface Type

All Known Subinterfaces:
ClassMemberType, HeritableType, ModifiedType, ScopedType, SimpleInheritanceType
All Known Implementing Classes:
AttributeType, ClassType, CommonType, DeclaredType, MethodType

public interface Type

This interface is the main object of antlraux's type system. A Type is a very basic object that only has two mandatory attributes: an integuer "tag" and a name.

Their functionality is similar to Token.type and Token.text, but not exactly the same.

In most programmation languajes, there are some Tokens that represent "basic types" - for example, token INT_TYPE represents the Token wose text is allways "int" and wose token type is INT_TYPE, whatever integer it is. The Type represented by that token will have INT_TYPE as tag and "int" as name.

However other tokens don't act that way - take the class token. A class definition may begin with a token with RES_CLASS type and "class" text, but we're not sure of what type we're defining until we see the class' name. Let's suppose that the class name's "A". In this case, the Type represented will have RES_CLASS as tag, but its name will be "A" instead of "class".

In conclusion, new Scope specifies the "type of Type" we're dealing with, while name really makes difference between Types of the same type.

Author:
Enrique José García Cota

Field Summary
static java.lang.String DEFAULT_NAME
           
static int DEFAULT_TAG
           
 
Method Summary
 boolean equals(java.lang.Object other)
           
 java.lang.String getName()
          Returns the Type's name
 int getTag()
          Returns the Type's tag
 void setName(java.lang.String s)
          Sets the Type's name.
 void setTag(int tag)
          Sets the Type's tag
 java.lang.String toString()
           
 

Field Detail

DEFAULT_NAME

public static final java.lang.String DEFAULT_NAME

DEFAULT_TAG

public static final int DEFAULT_TAG
See Also:
Constant Field Values
Method Detail

getName

public java.lang.String getName()
Returns the Type's name


getTag

public int getTag()
Returns the Type's tag


setName

public void setName(java.lang.String s)
Sets the Type's name. It is recommended to check if the new name is null or empty string ("") and throw IllegalArgumentException in that case.


setTag

public void setTag(int tag)
Sets the Type's tag


equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

antlraux package
v0.2.1

Created by Enrique José García Cota