edu.neu.ccs.demeterf
Class ValueThrow

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by edu.neu.ccs.demeterf.ValueThrow
All Implemented Interfaces:
java.io.Serializable

public class ValueThrow
extends java.lang.RuntimeException

Represents a Value that can be tossed out of a traversal. Includes static methods to hide how we actually deal with values and cutting traversals short. See Examples for more details.

This class basically allows a program to cut off traversal by jumping out with a value (considered tossing). e.g., We might stop traversal after finding a metching element in a list. Usually you would toss a value within an update method, as these are called on the way down while traversing ("pre-order").

See Also:
Serialized Form

Method Summary
static void toss(java.lang.Object o)
          Toss a Value out of the traversal
static
<T> T
traverse(Traversal t, java.lang.Object o)
          Handles traversing when a thrown value is expected (No traversal Argument)
static
<T> T
traverse(Traversal t, java.lang.Object o, java.lang.Object a)
          Handles traversing when a thrown value is expected (With traversal Argument)
<T> T
value()
          Get the inner Thrown Value
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

value

public <T> T value()
Get the inner Thrown Value


toss

public static void toss(java.lang.Object o)
                 throws ValueThrow
Toss a Value out of the traversal

Throws:
ValueThrow

traverse

public static <T> T traverse(Traversal t,
                             java.lang.Object o)
Handles traversing when a thrown value is expected (No traversal Argument)


traverse

public static <T> T traverse(Traversal t,
                             java.lang.Object o,
                             java.lang.Object a)
Handles traversing when a thrown value is expected (With traversal Argument)