Clover Coverage Report - AnCal Coverage Report
Coverage timestamp: gio dic 18 2014 12:18:42 EST
../../../../../img/srcFileCovDistChart9.png 40% of files have more coverage
36   135   23   2,12
6   101   0,64   8,5
17     1,35  
2    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  DataField       Line # 9 36 23 88,1% 0.88135594
  DataField.Type       Line # 12 0 0 - -1.0
 
No Tests
 
1   
2    package pl.magot.vetch.ancal.database;
3   
4   
5    import java.util.Calendar;
6    import android.content.*;
7   
8   
 
9    public class DataField
10    {
11    //types
 
12    public static enum Type { INT, TEXT, BOOL };
13   
14    //fields
15    private Calendar dateOut = Calendar.getInstance();
16   
17    //fields
18    private DataRow dataRow = null;
19    private ContentValues values = null;
20   
21    //fields
22    private int index = 0;
23    private String sName = "";
24    private Type FieldType = Type.INT;
25    private boolean bCanBeNull = true;
26    private boolean bPrimaryKey = false;
27   
28   
29    //methods
 
30  819 toggle public DataField(int index, String sName, Type FieldType, boolean bCanBeNull, boolean bPrimaryKey)
31    {
32  819 this.index = index;
33  819 this.sName = sName;
34  819 this.FieldType = FieldType;
35  819 this.bCanBeNull = bCanBeNull;
36  819 this.bPrimaryKey = bPrimaryKey;
37    }
38   
 
39  23 toggle public String GetColumnDefinition()
40    {
41  23 String s = sName + " " + GetSqlType(FieldType);
42  23 if (bPrimaryKey)
43  4 s += " PRIMARY KEY";
44  23 if (!bCanBeNull)
45  0 s += " NOT NULL";
46  23 return s;
47    }
48   
 
49  88 toggle public Type GetType()
50    {
51  88 return FieldType;
52    }
53   
 
54  0 toggle public int GetIndex()
55    {
56  0 return index;
57    }
58   
 
59  23 toggle public String GetSqlType(Type value)
60    {
61  23 switch (value)
62    {
63  15 case INT: return "INTEGER";
64  4 case TEXT: return "TEXT";
65  4 case BOOL: return "INTEGER";
66    }
67  0 return "TEXT";
68    }
69   
 
70  819 toggle public void SetParentRow(DataRow dataRow)
71    {
72  819 this.dataRow = dataRow;
73  819 this.values = this.dataRow.GetContentValues();
74    }
75   
 
76  0 toggle public String GetName()
77    {
78  0 return sName;
79    }
80   
81    //getters
 
82  8 toggle public String asString()
83    {
84  8 return values.getAsString(sName);
85    }
86   
 
87  47 toggle public long asLong()
88    {
89  47 return values.getAsLong(sName);
90    }
91   
 
92  12 toggle public boolean asBoolean()
93    {
94  12 return (values.getAsLong(sName) == 1);
95    }
96   
 
97  6 toggle public boolean isNull()
98    {
99  6 return (values.get(sName) == null);
100    }
101   
 
102  6 toggle public Calendar asCalendar()
103    {
104  6 dateOut.setTimeInMillis(values.getAsLong(sName));
105  6 return dateOut;
106    }
107   
108    //setters
 
109  33 toggle public void set(String value)
110    {
111  33 values.put(sName, value);
112    }
113   
 
114  104 toggle public void set(long value)
115    {
116  104 values.put(sName, value);
117    }
118   
 
119  40 toggle public void set(boolean value)
120    {
121  40 int i = (value)?1:0;
122  40 values.put(sName, i);
123    }
124   
 
125  13 toggle public void set(Calendar value)
126    {
127  13 values.put(sName, value.getTimeInMillis());
128    }
129   
 
130  25 toggle public void setNull()
131    {
132  25 values.put(sName, (String)null);
133    }
134   
135    }