2 * Copyright © 2020 Damyan Ivanov.
3 * This file is part of MoLe.
4 * MoLe is free software: you can distribute it and/or modify it
5 * under the term of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your opinion), any later version.
9 * MoLe is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License terms for details.
14 * You should have received a copy of the GNU General Public License
15 * along with MoLe. If not, see <https://www.gnu.org/licenses/>.
18 package net.ktnx.mobileledger.model;
20 import net.ktnx.mobileledger.utils.Misc;
22 public class Currency {
25 private Position position;
26 private boolean hasGap;
27 public Currency(int id, String name) {
30 position = Position.after;
33 public Currency(int id, String name, Position position, boolean hasGap) {
36 this.position = position;
39 static public boolean equal(Currency left, Currency right) {
44 return left.equals(right);
46 static public boolean equal(Currency left, String right) {
47 right = Misc.emptyIsNull(right);
52 String leftName = Misc.emptyIsNull(left.getName());
53 if (leftName == null) {
57 return leftName.equals(right);
63 public String getName() {
66 public void setName(String name) {
69 public Position getPosition() {
72 public void setPosition(Position position) {
73 this.position = position;
75 public boolean hasGap() {
78 public void setHasGap(boolean hasGap) {
81 public enum Position {
82 before, after, unknown, none