ecash.kernel
Class SellerPurse

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

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

Contains all the notes and information obtained from buyers during transactions. Calls to the add() and the remove() methods will be taken into account only after a call to addCommit() and removeCommit() respectively. The clear() method will initialize this process. Each item of this list is a SellerPurseUnit object.

Author:
Michel Deriaz
See Also:
SellerPurseUnit, Serialized Form

Constructor Summary
SellerPurse()
          Creates a SellerPurse.
 
Method Summary
 void add(Note note, java.math.BigInteger challengeRIS, RISPart risPart, java.lang.String buyerNickname)
          Adds a new note and the information obtained from the buyer during the transaction.
 void addCommit()
          Let's take into effect all the calls made to the add() method, and then calls the clear() method.
 void clear()
          Initializes the data for the add() and the remove() methods.
 int findAmount(java.lang.String amount)
          Returns the first index of a note with the specified amount.
 java.util.Vector getAmountList()
          Returns the list of the amounts of the notes.
 java.lang.String getBuyerNickname(int index)
          Gets the nickname of the buyer that sent the specified note.
 java.math.BigInteger getChallengeRIS(int index)
          Gets the challenge imposed to the specified note.
 Note getNote(int index)
          Gets the specified note.
 RISPart getRISPart(int index)
          Gets the revealed part of the RIS for the specified note.
 void initFindAmount()
          Initializes the findAmount() method.
 void remove(int index)
          Removes a note.
 void removeCommit()
          Let's take into effect all the calls made to the remove() method, and then calls the clear() method.
 int size()
          Returns the number of notes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SellerPurse

public SellerPurse()
Creates a SellerPurse.

Method Detail

add

public void add(Note note,
                java.math.BigInteger challengeRIS,
                RISPart risPart,
                java.lang.String buyerNickname)
Adds a new note and the information obtained from the buyer during the transaction.

Parameters:
note - the note
challengeRIS - the challenge
risPart - the revealed part of the RIS
buyerNickname - the nickname provided by the buyer in order to identify the origin of the payment
See Also:
addCommit()

addCommit

public void addCommit()
Let's take into effect all the calls made to the add() method, and then calls the clear() method.

See Also:
add(ecash.kernel.Note, java.math.BigInteger, ecash.kernel.RISPart, java.lang.String)

remove

public void remove(int index)
Removes a note.

Parameters:
index - the index of the note to remove
See Also:
removeCommit()

removeCommit

public void removeCommit()
Let's take into effect all the calls made to the remove() method, and then calls the clear() method.

See Also:
remove(int)

getNote

public Note getNote(int index)
Gets the specified note.

Parameters:
index - the index in the list

getChallengeRIS

public java.math.BigInteger getChallengeRIS(int index)
Gets the challenge imposed to the specified note.

Parameters:
index - the index of the specified note
Returns:
the challenge imposed to the specified note

getRISPart

public RISPart getRISPart(int index)
Gets the revealed part of the RIS for the specified note.

Parameters:
index - the index of the specified note
Returns:
the revealed part of the RIS for the specified note

getBuyerNickname

public java.lang.String getBuyerNickname(int index)
Gets the nickname of the buyer that sent the specified note.

Parameters:
index - the index of the specified note
Returns:
the nickname of the buyer that sent the specified note

getAmountList

public java.util.Vector getAmountList()
Returns the list of the amounts of the notes. Each entry of this Vector is a String.

Returns:
a vector containing the amounts of all the notes

size

public int size()
Returns the number of notes.

Returns:
the number of notes

clear

public void clear()
Initializes the data for the add() and the remove() methods.


initFindAmount

public void initFindAmount()
Initializes the findAmount() method.


findAmount

public int findAmount(java.lang.String amount)
Returns the first index of a note with the specified amount. Then the note is "marked" in order to avoid to return the same note when the method is called again with the same parameter. The initFindAmount() will "unmark" all the notes.

Parameters:
amount - the amount to find
Returns:
the index in the list