]> git.ktnx.net Git - mobile-ledger-staging.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/model/Currency.java
fix storing/retrieval of currency position
[mobile-ledger-staging.git] / app / src / main / java / net / ktnx / mobileledger / model / Currency.java
index 28e6d03e9fe6c2007c1b4ece489472c027ab030b..5f488e28634eb4ca72a156b05371be075747c0af 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2019 Damyan Ivanov.
+ * Copyright © 2020 Damyan Ivanov.
  * This file is part of MoLe.
  * MoLe is free software: you can distribute it and/or modify it
  * under the term of the GNU General Public License as published by
@@ -42,7 +42,7 @@ public class Currency {
                            (oldItem.hasGap == newItem.hasGap);
                 }
             };
-    private int id;
+    private final int id;
     private String name;
     private Position position;
     private boolean hasGap;
@@ -119,24 +119,6 @@ public class Currency {
         this.hasGap = hasGap;
     }
     public enum Position {
-        before(-1), after(1), unknown(0), none(-2);
-        private int value;
-        Position(int value) {
-            this.value = 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
     }
 }