orc.runtime.values
Class Constant

java.lang.Object
  extended by orc.runtime.values.Value
      extended by orc.runtime.values.Constant
All Implemented Interfaces:
Future

public class Constant
extends Value

A value container for an arbitrary Java object, which includes Orc literal atomic values.

This has overrides to support treating collections and arrays as lists (i.e. list pattern matches will work on them).

FIXME: how well does this cope with Java nulls?

Author:
wcook, dkitchin, quark

Constructor Summary
Constant(java.lang.Object value)
           
 
Method Summary
<E> E
accept(Visitor<E> visitor)
           
 Callable forceCall(Token t)
          A Java value used in call position becomes a proxied object.
 java.lang.Object getValue()
           
 Value head()
          Return the head value of a cons-like data structure.
 boolean isCons()
           
 boolean isNil()
           
 Value tail()
          Return the tail value of a cons-like data structure.
 java.lang.String toString()
           
 
Methods inherited from class orc.runtime.values.Value
forceArg, isNone, isSome, signal, untag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Constant

public Constant(java.lang.Object value)
Method Detail

getValue

public java.lang.Object getValue()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

forceCall

public Callable forceCall(Token t)
A Java value used in call position becomes a proxied object.

Specified by:
forceCall in interface Future
Overrides:
forceCall in class Value

head

public Value head()
Description copied from class: Value
Return the head value of a cons-like data structure. This method must throw an exception iff isCons() returns false.

Overrides:
head in class Value

tail

public Value tail()
Description copied from class: Value
Return the tail value of a cons-like data structure. This method must throw an exception iff isCons() returns false.

Overrides:
tail in class Value

isCons

public boolean isCons()
Overrides:
isCons in class Value

isNil

public boolean isNil()
Overrides:
isNil in class Value

accept

public <E> E accept(Visitor<E> visitor)
Specified by:
accept in class Value