ecash.kernel
Class BankChoice

java.lang.Object
  |
  +--ecash.kernel.BankChoice
All Implemented Interfaces:
java.io.Serializable

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

Represents a number chosen by the bank, with n = [0..nbEnveloppe[. The client will have to reveal all information used to build the notes, except for the note n (which will be blindly signed and returned).

Author:
Michel Deriaz
See Also:
Serialized Form

Constructor Summary
BankChoice(int nbEnvelopes)
          Chooses randomly a number which represents the choice of the bank.
BankChoice(java.lang.String value)
          Re-build the object from it's string representation.
 
Method Summary
static BankChoice load(java.lang.String filename)
          Re-build the object from it's file representation.
 void save(java.lang.String filename)
          Saves this object into it's file representation.
 int toInt()
          Returns an int representation of this BankChoice.
 java.lang.String toString()
          Returns a string representation of this BankChoice.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BankChoice

public BankChoice(int nbEnvelopes)
Chooses randomly a number which represents the choice of the bank.


BankChoice

public BankChoice(java.lang.String value)
Re-build the object from it's string representation.

Parameters:
value - the string representation of the object
Method Detail

load

public static BankChoice load(java.lang.String filename)
Re-build the object from it's file representation.

Parameters:
filename - the filename

save

public void save(java.lang.String filename)
Saves this object into it's file representation.

Parameters:
filename - the filename

toInt

public int toInt()
Returns an int representation of this BankChoice.

Returns:
an int representation of this BankChoice

toString

public java.lang.String toString()
Returns a string representation of this BankChoice.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this BankChoice