Clover Coverage Report - SaveApp Coverage Report
Coverage timestamp: mar dic 23 2014 15:53:11 EST
../../../../img/srcFileCovDistChart4.png 67% of files have more coverage
53   120   12   17,67
16   96   0,23   3
3     4  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  DBReader       Line # 8 53 12 38,9% 0.3888889
 
No Tests
 
1    package com.loopback.androidapps.saveapp;
2   
3    import java.util.ArrayList;
4   
5    import android.database.Cursor;
6    import android.util.Log;
7   
 
8    public class DBReader {
9   
10    public static SaveApp saveApp;
11    private String dateAux;
12    public ArrayList<Outlay> outlayList = new ArrayList<Outlay>();
13    public ArrayList<Integer> chargeList = new ArrayList<Integer>();
14    public ArrayList<Integer> dateList = new ArrayList<Integer>();
15    public ArrayList<Integer> chargeListAux = new ArrayList<Integer>();
16    public ArrayList<Integer> dateListAux = new ArrayList<Integer>();
17    private int itemId, placeId, addressId;
18    private Item item;
19    private Place place;
20    private AddressX address;
21   
 
22  10 toggle public DBReader() {
23    }
24   
 
25  10 toggle public void readOutlay(Cursor cursor) {
26   
27  10 item = new Item();
28  10 place = new Place();
29  10 address = new AddressX();
30  10 Log.i("HA", "Read Cursor");
31  10 if (cursor.moveToFirst())
32  10 do {
33  16 Outlay outlay = new Outlay();
34  16 outlay.setId(cursor.getInt(cursor
35    .getColumnIndexOrThrow(DBManager.KEY_ID)));
36  16 outlay.setCharge(cursor.getInt(cursor
37    .getColumnIndexOrThrow(DBManager.OUTLAY_COLUMN_CHARGE)));
38  16 outlay.setDate(cursor.getString(cursor
39    .getColumnIndexOrThrow(DBManager.OUTLAY_COLUMN_DATE)));
40  16 itemId = Utilities.stringToInt(cursor.getString(cursor
41    .getColumnIndexOrThrow(DBManager.OUTLAY_COLUMN_ITEM)));
42  16 placeId = Utilities.stringToInt(cursor.getString(cursor
43    .getColumnIndexOrThrow(DBManager.OUTLAY_COLUMN_PLACE)));
44  16 addressId = Utilities
45    .stringToInt(cursor.getString(cursor
46    .getColumnIndexOrThrow(DBManager.OUTLAY_COLUMN_ADDRESS)));
47   
48  16 item.inflate(itemId);
49  16 outlay.setItemId(itemId);
50  16 outlay.setItemDesc(item.getDescription());
51   
52  16 place.inflate(placeId);
53  16 outlay.setPlaceId(placeId);
54  16 outlay.setPlaceDesc(place.getDescription());
55   
56  16 address.inflate(addressId);
57  16 outlay.setAddressId(addressId);
58  16 outlay.setAddressDesc(address.getDescription());
59   
60  16 outlayList.add(outlay);
61   
62  16 } while (cursor.moveToNext());
63    }
64   
 
65  0 toggle public void plotList(Cursor cursor) {
66  0 int i = 0;
67  0 Log.i("HA", "Read Cursor for Plot");
68  0 if (cursor.moveToFirst())
69  0 do {
70  0 Integer charge;
71  0 String date;
72   
73  0 charge = Utilities
74    .stringToInt(cursor.getString(cursor
75    .getColumnIndexOrThrow(DBManager.OUTLAY_COLUMN_CHARGE)));
76  0 date = cursor.getString(cursor
77    .getColumnIndexOrThrow(DBManager.OUTLAY_COLUMN_DATE));
78  0 chargeListAux.add(charge);
79  0 dateListAux.add(Integer.valueOf(Utilities
80    .getDateUnit(date, 'd')));
81  0 dateAux = date;
82    // dateList.add(Utilities.dateToMiliseconds(date));
83  0 i++;
84   
85  0 } while (cursor.moveToNext());
86   
87    // Charge 0 until the fisrt date is reached
88  0 if (dateListAux.size()>0) {
89  0 Integer firstDate = dateListAux.get(0);
90    // The bufget is add to the first outlay
91  0 dateList.add(1);
92  0 chargeList.add(saveApp.getBudget());
93  0 for (int j = 2; j < firstDate; j++) {
94  0 dateList.add(j);
95  0 chargeList.add(0);
96    }
97  0 Integer lastDate = Utilities.numberOfDaysPerMonth(
98    Integer.valueOf(Utilities.getDateUnit(dateAux, 'M')),
99    Integer.valueOf(Utilities.getDateUnit(dateAux, 'y')));
100  0 Integer y = 0;
101  0 Integer size = dateListAux.size();
102    // Charge 0 in the positions where there isn�t outlays until the end
103    // of the month
104  0 for (int k = firstDate; k <= lastDate; k++) {
105  0 if ((y < size) && k == dateListAux.get(y)) {
106  0 dateList.add(k);
107  0 chargeList.add(chargeListAux.get(y));
108  0 y++;
109    } else {
110  0 dateList.add(k);
111  0 chargeList.add(0);
112    }
113   
114    }
115    }else
116  0 dateList=null;
117   
118   
119    }
120    }