Coverage Report - org.homeunix.thecave.buddi.plugin.api.model.impl.ImmutableTransactionSplitImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
ImmutableTransactionSplitImpl
0%
0/12
0%
0/6
2.2
 
 1  
 /*
 2  
  * Created on Aug 12, 2007 by wyatt
 3  
  */
 4  
 package org.homeunix.thecave.buddi.plugin.api.model.impl;
 5  
 
 6  
 import org.homeunix.thecave.buddi.model.Account;
 7  
 import org.homeunix.thecave.buddi.model.BudgetCategory;
 8  
 import org.homeunix.thecave.buddi.model.Transaction;
 9  
 import org.homeunix.thecave.buddi.model.TransactionSplit;
 10  
 import org.homeunix.thecave.buddi.plugin.api.model.ImmutableSource;
 11  
 import org.homeunix.thecave.buddi.plugin.api.model.ImmutableTransactionSplit;
 12  
 
 13  
 public class ImmutableTransactionSplitImpl extends ImmutableTransactionImpl implements ImmutableTransactionSplit {
 14  
         
 15  
         public ImmutableTransactionSplitImpl(Transaction transaction) {
 16  0
                 super(transaction);
 17  0
         }
 18  
         
 19  
         public TransactionSplit getTransactionSplit(){
 20  0
                 return (TransactionSplit) getRaw();
 21  
         }
 22  
         
 23  
         public ImmutableSource getSource(){
 24  0
                 if (getTransactionSplit().getSource() instanceof Account)
 25  0
                         return new MutableAccountImpl((Account) getTransaction().getFrom());
 26  0
                 if (getTransactionSplit().getSource() instanceof BudgetCategory)
 27  0
                         return new MutableBudgetCategoryImpl((BudgetCategory) getTransaction().getFrom());
 28  0
                 return null;
 29  
         }
 30  
         public long getAmount(){
 31  0
                 return getTransactionSplit().getAmount();
 32  
         }
 33  
         
 34  
         @Override
 35  
         public boolean equals(Object obj) {
 36  0
                 if (obj instanceof ImmutableTransactionSplit)
 37  0
                         return getUid().equals(((ImmutableTransactionSplit) obj).getUid());
 38  0
                 return false;
 39  
         }
 40  
 }