Klasse ExpressionPrimitiveType

java.lang.Object
de.svws_nrw.transpiler.ExpressionType
de.svws_nrw.transpiler.ExpressionPrimitiveType
Alle implementierten Schnittstellen:
PrimitiveTypeTree, Tree

public final class ExpressionPrimitiveType extends ExpressionType implements PrimitiveTypeTree
The specialized ExpressionType if the type is a primitive type.
  • Konstruktordetails

    • ExpressionPrimitiveType

      public ExpressionPrimitiveType(TypeKind typeKind) throws TranspilerException
      Creates a primitive expression type instance for the specified TypeKind.
      Parameter:
      typeKind - the type kind of the primitive type
      Löst aus:
      TranspilerException - an exception if the specified type kind is not a primitive type kind
    • ExpressionPrimitiveType

      public ExpressionPrimitiveType(String type)
      Creates a primitive expression type instance for the specified primitive type string.
      Parameter:
      type - the primitive type string (e.g. "float")
      Löst aus:
      TranspilerException - an exception if the specified type kind is not a primitive type kind
  • Methodendetails

    • isPrimitiveOrBoxedPrimitive

      public boolean isPrimitiveOrBoxedPrimitive()
      Beschreibung aus Klasse kopiert: ExpressionType
      Returns whether the type is a primitive type or a boxed primitive type.
      Angegeben von:
      isPrimitiveOrBoxedPrimitive in Klasse ExpressionType
      Gibt zurück:
      true if it is a primitive type and false otherwise
    • isNumberType

      public boolean isNumberType()
      Beschreibung aus Klasse kopiert: ExpressionType
      Checks whether this type is a numeric or boxed numeric type. The method is an override in the subclasses ExpressionPrimitiveType and ExpressionClassType.
      Setzt außer Kraft:
      isNumberType in Klasse ExpressionType
      Gibt zurück:
      true if it is a numeric type and false otherwise.
    • isIntegerType

      public boolean isIntegerType()
      Beschreibung aus Klasse kopiert: ExpressionType
      Checks whether this type is an integer type. The method is an override in the subclasses ExpressionPrimitiveType and ExpressionClassType.
      Setzt außer Kraft:
      isIntegerType in Klasse ExpressionType
      Gibt zurück:
      true if it is an integer type and false otherwise.
    • isAssignable

      public int isAssignable(Transpiler transpiler, ExpressionType other)
      Checks whether the specified primitive type other is assignable to this primitive type or not.
      Angegeben von:
      isAssignable in Klasse ExpressionType
      Parameter:
      transpiler - the transpiler object used for utility methods
      other - the other primitive type
      Gibt zurück:
      true if it is assignable and false otherwise
    • getPrimitiveTypeKind

      public TypeKind getPrimitiveTypeKind()
      Angegeben von:
      getPrimitiveTypeKind in Schnittstelle PrimitiveTypeTree
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object
    • hashCode

      public int hashCode()
      Beschreibung aus Klasse kopiert: ExpressionType
      Returns the hashCode for the expression type.
      Setzt außer Kraft:
      hashCode in Klasse ExpressionType
      Gibt zurück:
      the hash code
    • equals

      public boolean equals(Object obj)
      Beschreibung aus Klasse kopiert: ExpressionType
      Returns whether the object parameter ist equal to this expression type or not
      Setzt außer Kraft:
      equals in Klasse ExpressionType
      Gibt zurück:
      true if both are equal
    • getUnboxed

      public static ExpressionPrimitiveType getUnboxed(ExpressionClassType classType)
      Determines the primitive type for the specified boxed class type. If the classType is invalid null is returned.
      Parameter:
      classType - the class name of the boxed type
      Gibt zurück:
      the unboxed primitive type or null on error
    • getPrimitiveType

      public static ExpressionPrimitiveType getPrimitiveType(ExpressionType type)
      Returns the primitive type of specified type if it is a primitive or boxed primitive type.
      Parameter:
      type - the specified type
      Gibt zurück:
      the primitive type or null
    • getPromotedType

      public static ExpressionPrimitiveType getPromotedType(ExpressionType type1, ExpressionType type2)
      Returns the unboxed binary numeric promotion type of the two specified type.
      Parameter:
      type1 - the first type
      type2 - teh second type
      Gibt zurück:
      the unboxed binary numeric promotion type
    • get

      public static ExpressionPrimitiveType get(String typeName)
      Determines the primitive type for the primitive type string. If the string does not represent a valid primitive type null is returned.
      Parameter:
      typeName - the primitive type string
      Gibt zurück:
      the primitive type or null on error