orc.runtime.sites.core
Class Equal

java.lang.Object
  extended by orc.runtime.values.Value
      extended by orc.runtime.sites.Site
          extended by orc.runtime.sites.EvalSite
              extended by orc.runtime.sites.core.Equal
All Implemented Interfaces:
Callable

public class Equal
extends EvalSite

Implement standard equality.

Author:
dkitchin, quark

Field Summary
 
Fields inherited from class orc.runtime.values.Value
futureNotReady
 
Constructor Summary
Equal()
           
 
Method Summary
static boolean eq(java.lang.Object a, java.lang.Object b)
          Are two values equivalent, in the sense that one may be substituted for another without changing the meaning of the program?
 java.lang.Object evaluate(Args args)
           
static void registerValueClass(java.lang.Class c)
          Register a class as a "value class" which can be safely compared with Object.equals(Object).
 Type type()
           
 
Methods inherited from class orc.runtime.sites.EvalSite
callSite
 
Methods inherited from class orc.runtime.sites.Site
accept, createCall
 
Methods inherited from class orc.runtime.values.Value
forceArg, forceCall, signal, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Equal

public Equal()
Method Detail

registerValueClass

public static void registerValueClass(java.lang.Class c)
Register a class as a "value class" which can be safely compared with Object.equals(Object). Instances of value classes should be immutable.

If possible, it's better if you make your class implement the interface Eq instead. This is here as a workaround for third-party libraries which can't be modified.

You should call this from a static constructor, so you can be reasonably sure everything is registered before eq(Object, Object) is called.

Parameters:
c -

evaluate

public java.lang.Object evaluate(Args args)
                          throws TokenException
Specified by:
evaluate in class EvalSite
Throws:
TokenException

eq

public static boolean eq(java.lang.Object a,
                         java.lang.Object b)
Are two values equivalent, in the sense that one may be substituted for another without changing the meaning of the program?

See Also:
Eq

type

public Type type()
Overrides:
type in class Site