Orbital library

orbital.logic.sign.type
Class Types

java.lang.Object
  extended by orbital.logic.sign.type.Types

public final class Types
extends java.lang.Object

Manager for type system and factories. Manages the current type system of your system.

Simple applications will generally use getDefault() to get the current system default type system. While applications that require more control over the particular arithmetic object implementations will get their own instance of TypeSystem and configure it according to their needs.

Properties: type system settings
Property Name Property Value
orbital.logic.sign.type.TypeSystem.default class name of the initial default TypeSystem implementation returned by getDefault().
This properties allow a different vendor's factory implementation of type systems to be "plugged in".

Author:
André Platzer
See Also:
TypeSystem

Field Summary
static Type INDIVIDUAL
          The type ι of individuals (objects).
static Type TRUTH
          The type ο = () of truth-values.
 
Method Summary
static int arityOf(Type type)
          Get the number of components n of a product type iτi = τ1×…×τn.
static Type declaredTypeOf(Functor f)
          Converts a functor specification to a type (guesses it from the declared type information).
static TypeSystem getDefault()
          Get the (single) default type system instance.
static boolean isApplicableTo(Type compositorType, Expression[] args)
          Checks whether the type specification is compatible with the given list of arguments.
static void setDefault(TypeSystem newTypeSystem)
          Set the (single) default type system instance.
static java.lang.String toTypedString(Typed s)
          Get a string describing a typed object and its type.
static java.lang.String toTypedString(Typed[] s)
           
static Type typeOf(java.lang.Object args)
          Guesses the type of an object.
static Type typeOf(Typed[] args)
          Returns the type of a list of arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDIVIDUAL

public static final Type INDIVIDUAL
The type ι of individuals (objects).


TRUTH

public static final Type TRUTH
The type ο = () of truth-values.

Method Detail

getDefault

public static final TypeSystem getDefault()
Get the (single) default type system instance.

See Also:
"Singleton", "FacadeFactory", setDefault(TypeSystem)

setDefault

public static final void setDefault(TypeSystem newTypeSystem)
Set the (single) default type system instance.

Parameters:
newTypeSystem - the new default factory of this Virtual Machine.
See Also:
getDefault()

isApplicableTo

public static final boolean isApplicableTo(Type compositorType,
                                           Expression[] args)
Checks whether the type specification is compatible with the given list of arguments. Convenience method.

Parameters:
compositorType - the type of the compositor to apply to the arguments.
args - the arguments to check for compatibility with this symbol. null, or an array of length 0 can be used for zero arguments.
Returns:
whether a compositor of type compositorType is applicable to the given arguments. Which means that the arguments are assignable to the required parameter types of this symbol. This especially includes whether the number of arguments matches the arity of the compositorTypes' domain.
See Also:
Convenience method, Type.on(Type), Type.subtypeOf(Type), Functor.Specification.isApplicableTo(Object[])
Preconditions:
true
Postconditions:
RES == (typeOf(args) ≤ compositorType.domain()) == (compositorType ≤ typeOf(args)→⊤) == succeedes(compositorType.on(typeOf(args)))

arityOf

public static final int arityOf(Type type)
Get the number of components n of a product type iτi = τ1×…×τn.


typeOf

public static final Type typeOf(Typed[] args)
Returns the type of a list of arguments. Convenience method.

Parameters:
args - the arguments whose (combined) type to return. null, or an array of length 0 can be used for zero arguments.
See Also:
Convenience method, TypeSystem.product(Type[]), Typed.getType()
Preconditions:
true

typeOf

public static final Type typeOf(java.lang.Object args)
Guesses the type of an object. The guess may be wrong.


declaredTypeOf

public static final Type declaredTypeOf(Functor f)
                                 throws java.beans.IntrospectionException
Converts a functor specification to a type (guesses it from the declared type information). Also looks for additional declarations of logical type. (experimental)
 static final Type logicalTypeDeclaration;
 

Throws:
java.beans.IntrospectionException - if an exception occurs during introspection.
See Also:
Functor.Specification.getSpecification(orbital.logic.functor.Functor)

toTypedString

public static final java.lang.String toTypedString(Typed s)
Get a string describing a typed object and its type.

Returns:
s:τ if s has type τ.
See Also:
Convenience Method, Object.toString(), Typed.getType()

toTypedString

public static final java.lang.String toTypedString(Typed[] s)

Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.