ecash.kernel
Class EnvelopesList

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

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

The list of envelopes sended to the bank. The latter will then choose one of them and return it signed to the client.

Author:
Michel Deriaz
See Also:
Serialized Form

Constructor Summary
EnvelopesList()
          Constructs a new list.
EnvelopesList(java.lang.String value)
          Re-build the object from it's string representation.
 
Method Summary
 void add(java.math.BigInteger envelope)
          Adds the specified envelope to the list.
 boolean checkRevealed(RevealedNotesList revealedNotesList, BankChoice bankChoice, java.lang.String id, PubKey pubKey)
          Returns true if the information used to build all the envelopes except the one chosen by the bank is correct, false otherwise.
 java.math.BigInteger get(int index)
          Returns the specified envelope.
static EnvelopesList 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.
 java.lang.String toString()
          Returns a string representation of this EnvelopesList.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EnvelopesList

public EnvelopesList()
Constructs a new list.


EnvelopesList

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

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

add

public void add(java.math.BigInteger envelope)
Adds the specified envelope to the list.

Parameters:
envelope - the envelope

get

public java.math.BigInteger get(int index)
Returns the specified envelope.

Parameters:
index - the index of the envelope
Returns:
the envelope

checkRevealed

public boolean checkRevealed(RevealedNotesList revealedNotesList,
                             BankChoice bankChoice,
                             java.lang.String id,
                             PubKey pubKey)
Returns true if the information used to build all the envelopes except the one chosen by the bank is correct, false otherwise.

Parameters:
revealedNotesList - information used to build the envelopes (except for the one chosen by the bank)
bankChoice - the choice of the bank (all the other envelopes must be revealed)
id - the identification of the client (bank account)
pubKey - the public key of the bank
Returns:
a boolean indicating whether the revealed information is correct or not

load

public static EnvelopesList 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

toString

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

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