Commits

John Louis del Rosario committed b8ebae9

More changes

Comments (0)

Files changed (1)

ExpenseParser.pde

 
   //get expenses of the date
   public Expense[] getExpensesForDate(String date){
+    return getExpensesForDate(date, this.lists, this.types);
+  }
+
+  public Expense[] getExpensesForDate(String date, ArrayList lists){
+    return getExpensesForDate(date, lists, this.types);
+  }
+
+  public Expense[] getExpensesForDate(String date, ArrayList types){
+    return getExpensesForDate(date, this.lists, types);
+  }
+
+  public Expense[] getExpensesForDate(String date, ArrayList lists, ArrayList types){
     Date d;
     ArrayList expensesForDate = new ArrayList();
     d = parseDateString(date);
     for(int i = 0; i < expenses.length; i++){
       try{
-        if (expenses[i].date.equals(d)){
+        if (expenses[i].date.equals(d) && lists.contains(expenses[i].list) && types.contains(expenses[i].type)){
           println(expenses[i]);
           expensesForDate.add(expenses[i]);
         }
     return expensesForDate;
   }
 
-  public Expense[] getExpensesForDate(String date, HashMap filters){
-    return expenses;
-  }
-
   //get expenses of date range
   public Expense[] getExpensesForDateRange(String fromDate, String toDate){
     return expenses;
     return expenses;
   }
 
+  // getters
+  public ArrayList getLists(){
+    return this.lists;
+  }
+
+  public ArrayList getTypes(){
+    return this.types;
+  }
+
+  public Expense[] getAllExpenses(){
+    return this.expenses;
+  }
+
   private Date parseDateString(String date){
     try{
       return df.parse(date);