Class ActorType

  • All Implemented Interfaces:
    java.lang.Cloneable, Type

    public class ActorType
    extends java.lang.Object
    implements Type, java.lang.Cloneable
    The base type of matrix token classes. This type functions as a union of the various matrix types. It allows for the creation of arrays that consist of diverse matrix types, because the array type will be {matrix}.
    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Steve Neuendorffer and Edward A. Lee
    Pt.AcceptedRating:
    Red
    Pt.ProposedRating:
    Red (yuhong)
    • Constructor Summary

      Constructors 
      Constructor Description
      ActorType()  
    • 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.
      boolean equals​(Type t)
      Determine if the argument represents the same BaseType as this object.
      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)
      Model if the argument type is compatible with this type.
      boolean isConstant()
      Model 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

      • ActorType

        public ActorType()
    • 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()
        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 BaseType.
      • 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.
      • equals

        public boolean equals​(Type t)
        Determine if the argument represents the same BaseType as this object.
        Parameters:
        t - A Type.
        Returns:
        True if the argument represents the same BaseType as this object; false otherwise.
      • getTokenClass

        public java.lang.Class getTokenClass()
        Return the class for tokens that this basetype represents.
        Specified by:
        getTokenClass in interface Type
        Returns:
        the class for tokens that this basetype represents.
      • 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.
      • 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)
        Model 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()
        Model if this Type is UNKNOWN.
        Specified by:
        isConstant in interface Type
        Returns:
        True if this Type is not UNKNOWN; false otherwise.
      • 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.