ecash.internet
Class Report

java.lang.Object
  |
  +--ecash.internet.Report
Direct Known Subclasses:
BuyReport, DepositReport, PayReport

public abstract class Report
extends java.lang.Object

A Report indicates how an operation succeeded, from the server point of view. A BuyReport is created for the bank when a buyer buyes some notes, a DepositReport is created for the bank when a seller deposits some notes and a PayReport is created for the seller when a buyer sends him some notes. This abstract class contains all the common methods used by its subclasses.

Author:
Michel Deriaz
See Also:
ECashGen

Method Summary
 void addAmount(java.lang.String s)
          Adds an amount to the amounts list.
 java.lang.String computeNotesExp()
          Computes and returns the notes expression for the amounts list.
 java.lang.String computeSum()
          Computes and returns the sum of all the amounts found in the amounts list.
 java.lang.String getAmounts()
          Returns a string that represents a list of all the amounts, separated by a coma.
 int getResult()
          Returns an int that represents how the operation succeeded.
 void setResult(int result)
          Set the result that describes how the operation succeeded.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAmounts

public java.lang.String getAmounts()
Returns a string that represents a list of all the amounts, separated by a coma.

Returns:
a string that represents a list of all the amounts, separated by a coma

getResult

public int getResult()
Returns an int that represents how the operation succeeded.

For a buy operation (BuyReport), it can be
ECashGen.OK,
ECashGen.CHEAT_WRONG_PASSWORD,
ECashGen.CHEAT_AMOUNTS_NOT_ALL_THE_SAME or
ECashGen.CHEAT_WRONG_REVEALED_NOTES.

For a deposit operation (DepositReport) it can be
ECashGen.OK,
ECashGen.CHEAT_WRONG_PASSWORD,
ECashGen.CHEAT_WRONG_SIGNATURE,
ECashGen.CHEAT_WRONG_RIS,
ECashGen.CHEAT_NOTE_REUSED_BY_SELLER or
ECashGen.CHEAT_NOTE_REUSED_BY_BUYER.

For a pay operation (PayReport) it can be
ECashGen.OK,
ECashGen.CHEAT_WRONG_SIGNATURE or
ECashGen.CHEAT_WRONG_RIS.

Returns:
an int that represents how the operation succeeded
See Also:
ECashGen

addAmount

public void addAmount(java.lang.String s)
Adds an amount to the amounts list.

Parameters:
s - the amount to add

setResult

public void setResult(int result)
Set the result that describes how the operation succeeded.

Parameters:
result - an integer describing how the operation succeeded
See Also:
getResult()

computeSum

public java.lang.String computeSum()
Computes and returns the sum of all the amounts found in the amounts list.

Returns:
the sum of all the amounts found in the amounts list

computeNotesExp

public java.lang.String computeNotesExp()
Computes and returns the notes expression for the amounts list.

Returns:
the notes expression for the amounts list