[Webfunds-commits] java/webfunds/client/sox SOXWallet.java

Jeroen C. van Gelderen gelderen@cypherpunks.ai
Sun, 15 Apr 2001 00:01:40 -0400 (AST)


gelderen    01/04/15 00:01:40

  Modified:    webfunds/client/sox SOXWallet.java
  Log:
  - Add getContractForItemId helper function;
  - Add and document modifier constants for the getValue methods;
  - Add comments to getValue(AccountId...);
  - Kill commented-out code.

Revision  Changes    Path
1.154     +28 -38    java/webfunds/client/sox/SOXWallet.java

Index: SOXWallet.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/sox/SOXWallet.java,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -r1.153 -r1.154
--- SOXWallet.java	2001/04/13 17:42:49	1.153
+++ SOXWallet.java	2001/04/15 04:01:39	1.154
@@ -1,4 +1,4 @@
-/* $Id: SOXWallet.java,v 1.153 2001/04/13 17:42:49 iang Exp $
+/* $Id: SOXWallet.java,v 1.154 2001/04/15 04:01:39 gelderen Exp $
  *
  * Copyright (c) Systemics Inc. 1995-2000 on behalf of
  * The WebFunds Development Team.  All Rights Reserved.
@@ -87,7 +87,7 @@
  *
  *  Check the above search strings for separation so far.
  *
- * @version $Revision: 1.153 $
+ * @version $Revision: 1.154 $
  */
 public class SOXWallet
     extends Debug
@@ -411,6 +411,13 @@
 /////////  Acquire Things  //////////////////////////////
 
     /**
+     * Constants passed to the getValue methods to indicate over which set
+     * of receipts we want to calculate the value.
+     */
+    public static final boolean RECEIPTS_PENDING_ONLY = true,
+                                RECEIPTS_CONFIRMED_ONLY = false;
+
+    /**
      *  WebFunds Wallet Interface
      */
     public long getValue(AccountInfo info, ItemId contract, boolean pending)
@@ -418,6 +425,11 @@
         return getValue(getAccountId(info), contract, pending) ;
     }
 
+
+    /**
+     * Calculate a balance over the set of receipts indicated by the triple
+     * (account, instrument, [RECEIPTS_PENDING_ONLY | RECEIPTS_CONFIRMED_ONLY]).
+     */
     public long getValue(AccountId acct, ItemId contract, boolean pending)
     {
         // I moved the contents to StoreReceiptStore, which better knows
@@ -744,12 +756,17 @@
     }
 
 
-    public String pumphouseGetContractName(ItemId contractId) {
+    public String getContractNameForItemId(ItemId contractId) {
         Contract contract = this.contracts.getContract(contractId);
         return contract.getName();
     }
 
 
+    public Contract getContractForItemId(ItemId contractId) {
+        return this.contracts.getContract(contractId);
+    }
+
+
     /**
      *  Make a payment.
      *  This should be used by all full service clients, it does:
@@ -1307,25 +1324,11 @@
      *
      *  Low Level Wallet Interface.
      */
-    public byte[] asciiArmour(AbstractPayment pay)
-        throws PaymentException
-    {
+    public byte[] asciiArmour(AbstractPayment pay) throws PaymentException {
         if (pay == null)
-            throw new PaymentException("null");
-
-        ArmouredPayment ap = new ArmouredPayment(pay);
-        return ap.encode();
-
-/*
-        byte[] buf;
-        try {
-            buf = ap.encode();
-        } catch (IOException ex) {
-            throw new PaymentException("Payment no good: " + ex);
-        }
-
-        return buf;
-*/
+            throw new PaymentException("pay: null");
+        else
+            return new ArmouredPayment(pay).encode();
     }
 
     /**
@@ -1333,26 +1336,13 @@
      *
      *  For WebFunds Wallet.
      */
-    public byte[] asciiArmourWithError(AbstractPayment pay)
-    {
-        if (pay == null)
-        {
+    public byte[] asciiArmourWithError(AbstractPayment pay) {
+        if (pay == null) {
             error("Payment is null?");
             return null ;
         }
 
-        ArmouredPayment ap = new ArmouredPayment(pay);
-        return ap.encode();
-/*
-        byte[] b;
-        try {
-        } catch (IOException ex) {
-            error("Payment no good: " + ex);
-            return null ;
-        }
-
-        return b;
-*/
+        return new ArmouredPayment(pay).encode();
     }
 
     /**
@@ -2772,7 +2762,7 @@
      *
      *  Intended for WebFunds wallet - noisy call.
      */
-    protected void update(Account account, ItemId item)
+    public void update(Account account, ItemId item)
     {
         logmsg("update");