this.hasGap = hasGap;
}
public enum Position {
- before(-1), after(1), unknown(0), none(-2);
- Position(int value) {
- }
- static Position valueOf(int value) {
- switch (value) {
- case -1:
- return before;
- case +1:
- return after;
- case 0:
- return unknown;
- case -2:
- return none;
- default:
- throw new IllegalStateException(String.format("Unexpected value (%d)", value));
- }
- }
+ before, after, unknown, none
}
}
{
while (c.moveToNext()) {
Currency currency = new Currency(c.getInt(0), c.getString(1),
- Currency.Position.valueOf(c.getInt(2)), c.getInt(3) == 1);
+ Currency.Position.valueOf(c.getString(2)), c.getInt(3) == 1);
result.add(currency);
}
}
{
if (cursor.moveToFirst()) {
return new Currency(cursor.getInt(0), cursor.getString(1),
- Currency.Position.valueOf(cursor.getInt(2)), cursor.getInt(3) == 1);
+ Currency.Position.valueOf(cursor.getString(2)), cursor.getInt(3) == 1);
}
return null;
}