org.objectweb.proactive.branchnbound.core
Class Result

java.lang.Object
  extended byorg.objectweb.proactive.branchnbound.core.Result
All Implemented Interfaces:
java.io.Serializable

public class Result
extends java.lang.Object
implements java.io.Serializable

A wrapper for a solution.

Author:
Alexandre di Costanzo Created on May 2, 2005
See Also:
Serialized Form

Constructor Summary
Result()
          Construct an empty result.
Result(java.lang.Exception e)
          Construct a new result with an excpetion.
Result(java.lang.Object theSolution)
          Construct a new result with an attached value.
 
Method Summary
 java.lang.Exception getException()
           
 java.lang.Object getSolution()
           
 boolean isAnException()
           
 boolean isBetterThan(Result other)
          Compare 2 results.
 Result returnTheBest(Result other)
          Compare 2 results and return which is the best.
 void setSolution(java.lang.Object theSolution)
          Attach a value to this result.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Result

public Result()
Construct an empty result.


Result

public Result(java.lang.Object theSolution)
Construct a new result with an attached value. The value must implement Comparable.

Parameters:
theSolution - the value of the result.

Result

public Result(java.lang.Exception e)
Construct a new result with an excpetion.

Parameters:
e - the exception.
Method Detail

getSolution

public java.lang.Object getSolution()
Returns:
the value of the result or null if no value is attached.

getException

public java.lang.Exception getException()
Returns:
the attached exception or null else.

setSolution

public void setSolution(java.lang.Object theSolution)
Attach a value to this result. The value must implement Comparable.

Parameters:
theSolution - the value.

returnTheBest

public Result returnTheBest(Result other)
Compare 2 results and return which is the best. Use compareTo from java.lang.Comparable. The least is returned.

Parameters:
other - the other result.
Returns:
the best result.

toString

public java.lang.String toString()
See Also:
Object.toString()

isBetterThan

public boolean isBetterThan(Result other)
Compare 2 results.

Parameters:
other - the other result.
Returns:
true this is better than the other, else returns false.

isAnException

public boolean isAnException()
Returns:
true if this result contains an exception, else false.


Copyright 2001-2005 INRIA All Rights Reserved.