示例#1
0
        //---------------------------------------------------------------------
        // Add a new transaction to the list
        // params: (in)
        //---------------------------------------------------------------------
        public void AddTransaction(Transaction inData)
        {
            TransactionNode newTransaction = new TransactionNode();

            newTransaction.Data = inData;
            newTransaction.next = head;

            head = newTransaction;

            transactionCount += 1;
        }
示例#2
0
        //---------------------------------------------------------------------
        // Returns the most recent transaction
        // params: none
        //---------------------------------------------------------------------
        public Transaction getLastTransaction()
        {
            TransactionNode transPtr = head;

            if (head == null)
            {
                return(null);
            }
            else
            {
                while (transPtr.next != null)
                {
                    transPtr = transPtr.next;
                }
                return(transPtr.Data);
            }
        }
示例#3
0
        //---------------------------------------------------------------------
        // Retrieves the transaction from the transaction history at
        // specified index
        // params: (in)
        //---------------------------------------------------------------------
        public Transaction getTransaction(int index)
        {
            TransactionNode transPtr = head;

            if (index == 0)
            {
                return(head.Data);
            }
            else
            {
                for (int i = 0; i < index; i++)
                {
                    transPtr = transPtr.next;
                }
                return(transPtr.Data);
            }
        }
示例#4
0
 //---------------------------------------------------------------------
 // Clears transaction history
 // params: none
 //---------------------------------------------------------------------
 public void clear()
 {
     this.transactionCount = 0;
     this.head             = null;
 }