Class TestToken.TestType

  • All Implemented Interfaces:
    java.lang.Cloneable, Type
    Enclosing class:
    TestToken

    public static class TestToken.TestType
    extends java.lang.Object
    implements Type, java.lang.Cloneable
    The class of this token.
    • Constructor Summary

      Constructors 
      Constructor Description
      TestType()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Type add​(Type rightArgumentType)
      Return a new type which represents the type that results from adding a token of this type and a token of the given argument type.
      java.lang.Object clone()
      Return this, that is, return the reference to this object.
      Token convert​(Token token)
      Convert the specified token to a token having the type represented by this object.
      Type divide​(Type rightArgumentType)
      Return a new type which represents the type that results from dividing a token of this type and a token of the given argument type.
      java.lang.Class getTokenClass()
      Return the class for tokens that this basetype represents.
      int getTypeHash()
      Return this type's node index in the (constant) type lattice.
      boolean isAbstract()
      Return true if this type does not correspond to a single token class.
      boolean isCompatible​(Type type)
      Test if the argument type is compatible with this type.
      boolean isConstant()
      Test if this Type is UNKNOWN.
      boolean isInstantiable()
      Determine if this type corresponds to an instantiable token classes.
      boolean isSubstitutionInstance​(Type type)
      Return true if the argument is a substitution instance of this type.
      Type modulo​(Type rightArgumentType)
      Return a new type which represents the type that results from moduloing a token of this type and a token of the given argument type.
      Type multiply​(Type rightArgumentType)
      Return a new type which represents the type that results from multiplying a token of this type and a token of the given argument type.
      Type one()
      Return the type of the multiplicative identity for elements of this type.
      Type subtract​(Type rightArgumentType)
      Return a new type which represents the type that results from subtracting a token of this type and a token of the given argument type.
      java.lang.String toString()
      Return the string representation of this type.
      Type zero()
      Return the type of the additive identity for elements of this type.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface ptolemy.data.type.Type

        equals
    • Constructor Detail

      • TestType

        public TestType()
    • Method Detail

      • add

        public Type add​(Type rightArgumentType)
        Return a new type which represents the type that results from adding a token of this type and a token of the given argument type.
        Specified by:
        add in interface Type
        Parameters:
        rightArgumentType - The type to add to this type.
        Returns:
        A new type, or BaseType.GENERAL, if the operation does not make sense for the given types.
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Return this, that is, return the reference to this object.
        Specified by:
        clone in interface Type
        Overrides:
        clone in class java.lang.Object
        Returns:
        A TestType
        Throws:
        java.lang.CloneNotSupportedException - Not thrown in this baseclass unless thrown by a parent class.
      • divide

        public Type divide​(Type rightArgumentType)
        Return a new type which represents the type that results from dividing a token of this type and a token of the given argument type.
        Specified by:
        divide in interface Type
        Parameters:
        rightArgumentType - The type to add to this type.
        Returns:
        A new type, or BaseType.GENERAL, if the operation does not make sense for the given types.
      • getTokenClass

        public java.lang.Class getTokenClass()
        Return the class for tokens that this basetype represents.
        Specified by:
        getTokenClass in interface Type
        Returns:
        The class.
      • isAbstract

        public boolean isAbstract()
        Return true if this type does not correspond to a single token class. This occurs if the type is not instantiable, or it represents either an abstract base class or an interface.
        Specified by:
        isAbstract in interface Type
        Returns:
        Always return false, this token is instantiable.
      • isCompatible

        public boolean isCompatible​(Type type)
        Test if the argument type is compatible with this type. The method returns true if this type is UNKNOWN, since any type is a substitution instance of it. If this type is not UNKNOWN, this method returns true if the argument type is less than or equal to this type in the type lattice, and false otherwise.
        Specified by:
        isCompatible in interface Type
        Parameters:
        type - An instance of Type.
        Returns:
        True if the argument type is compatible with this type.
      • isConstant

        public boolean isConstant()
        Test if this Type is UNKNOWN.
        Specified by:
        isConstant in interface Type
        Returns:
        True if this Type is not UNKNOWN; false otherwise.
      • getTypeHash

        public int getTypeHash()
        Return this type's node index in the (constant) type lattice.
        Specified by:
        getTypeHash in interface Type
        Returns:
        this type's node index in the (constant) type lattice.
      • isInstantiable

        public boolean isInstantiable()
        Determine if this type corresponds to an instantiable token classes. A BaseType is instantiable if it does not correspond to an abstract token class, or an interface, or UNKNOWN.
        Specified by:
        isInstantiable in interface Type
        Returns:
        True if this type is instantiable.
      • isSubstitutionInstance

        public boolean isSubstitutionInstance​(Type type)
        Return true if the argument is a substitution instance of this type.
        Specified by:
        isSubstitutionInstance in interface Type
        Parameters:
        type - A Type.
        Returns:
        True if this type is UNKNOWN; false otherwise.
      • modulo

        public Type modulo​(Type rightArgumentType)
        Return a new type which represents the type that results from moduloing a token of this type and a token of the given argument type.
        Specified by:
        modulo in interface Type
        Parameters:
        rightArgumentType - The type to add to this type.
        Returns:
        A new type, or BaseType.GENERAL, if the operation does not make sense for the given types.
      • multiply

        public Type multiply​(Type rightArgumentType)
        Return a new type which represents the type that results from multiplying a token of this type and a token of the given argument type.
        Specified by:
        multiply in interface Type
        Parameters:
        rightArgumentType - The type to add to this type.
        Returns:
        A new type, or BaseType.GENERAL, if the operation does not make sense for the given types.
      • one

        public Type one()
        Return the type of the multiplicative identity for elements of this type.
        Specified by:
        one in interface Type
        Returns:
        A new type, or BaseType.GENERAL, if the operation does not make sense for the given types.
      • subtract

        public Type subtract​(Type rightArgumentType)
        Return a new type which represents the type that results from subtracting a token of this type and a token of the given argument type.
        Specified by:
        subtract in interface Type
        Parameters:
        rightArgumentType - The type to add to this type.
        Returns:
        A new type, or BaseType.GENERAL, if the operation does not make sense for the given types.
      • toString

        public java.lang.String toString()
        Return the string representation of this type.
        Specified by:
        toString in interface Type
        Overrides:
        toString in class java.lang.Object
        Returns:
        A String.
      • zero

        public Type zero()
        Return the type of the additive identity for elements of this type.
        Specified by:
        zero in interface Type
        Returns:
        A new type, or BaseType.GENERAL, if the operation does not make sense for the given types.