public final class Type extends Object implements Comparable<Type>
e.g. integer, boolean, string, array, function.
| Modifier and Type | Method and Description |
|---|---|
static Type |
arrayType(Type t)
Returns the type associated with a
Arguments containing elements of the specified type. |
static Type |
bigDecimalType()
Returns the type associated with instances of
java.math.BigDecimal. |
static Type |
bigIntegerType()
Returns the type associated with instances of
java.math.BigInteger. |
static Type |
booleanArrayType()
Returns the type associated with a
Arguments containing elements of type booleanType(). |
static Type |
booleanType()
Returns the type associated with instances of
java.lang.Boolean. |
int |
compareTo(Type t) |
static Type |
doubleType()
Returns the type associated with instances of
java.lang.Double. |
boolean |
equals(Object o) |
static Type |
functionType(Type... signature)
Returns the type associated with instances of
org.oakgp.function.Function with the specified signature. |
int |
hashCode() |
static Type |
integerArrayType()
Returns the type associated with a
Arguments containing elements of type integerType(). |
static Type |
integerToBooleanFunctionType()
Returns the type associated with
org.oakgp.function.Function instances that accept a integerType() and return booleanType(). |
static Type |
integerType()
Returns the type associated with instances of
java.lang.Integer. |
static boolean |
isNullable(Type t)
Returns
true if the given Type represents values that may be null. |
static Type |
longType()
Returns the type associated with instances of
java.lang.Long. |
static Type |
nullableType(Type t)
Returns a type that represents values that can be either the given
Type or null. |
static boolean |
sameTypes(Type[] a,
Type[] b)
Returns
true if the two arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are the same. |
static Type |
stringType()
Returns the type associated with instances of
java.lang.String. |
String |
toString() |
static Type |
type(String name)
Returns a
Type with the given name. |
static Type |
type(String name,
Type... args)
Returns a
Type with the given name and arguments. |
public static Type stringType()
java.lang.String.public static Type booleanType()
java.lang.Boolean.public static Type integerType()
java.lang.Integer.public static Type longType()
java.lang.Long.public static Type doubleType()
java.lang.Double.public static Type bigIntegerType()
java.math.BigInteger.public static Type bigDecimalType()
java.math.BigDecimal.public static Type integerToBooleanFunctionType()
org.oakgp.function.Function instances that accept a integerType() and return booleanType().public static Type nullableType(Type t)
Type or null.
e.g. The result of calling nullableType(stringType()) is a type that represents values that can be either a java.lang.String
or null.
isNullable(Type)public static Type functionType(Type... signature)
org.oakgp.function.Function with the specified signature.signature - the function signature with the first element representing the return type and the subsequent elements representing the argument typespublic static Type integerArrayType()
Arguments containing elements of type integerType().public static Type booleanArrayType()
Arguments containing elements of type booleanType().public static Type arrayType(Type t)
Arguments containing elements of the specified type.public static Type type(String name)
Type with the given name.
If there already exists a Type with the given name and no arguments then it will be returned else a new Type with the given
name and no arguments will be created and returned.
public static Type type(String name, Type... args)
Type with the given name and arguments.
If there already exists a Type with the given name and args then it will be returned else a new Type with the given
name and args will be created and returned.
public static boolean isNullable(Type t)
true if the given Type represents values that may be null.nullableType(Type)public static boolean sameTypes(Type[] a, Type[] b)
true if the two arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are the same.
Assumes no null values. Compares elements using == rather than equals(Object).
a - one array to be tested for equalityb - the other array to be tested for equalitytrue if the two arrays contain the same elements in the same order, else falsepublic int compareTo(Type t)
compareTo in interface Comparable<Type>OakGP Genetic Programming Framework