import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
-import java.util.ArrayList;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
TemplateAccount pa = (TemplateAccount) p;
AccountRow acc = createAccountRow();
acc.setId(pa.getId());
+ acc.setPosition(pa.getPosition());
if (pa.getAccountNameMatchGroup() == null)
acc.setAccountName(Misc.nullIsEmpty(pa.getAccountName()));
result.setValue(initialValue);
return result;
}
+ public void copyFrom(@NonNull PossiblyMatchedValue<T> origin) {
+ literalValue = origin.literalValue;
+ value = origin.value;
+ matchGroup = origin.matchGroup;
+ }
public T getValue() {
if (!literalValue)
throw new IllegalStateException("Value is not literal");
PossiblyMatchedValue.withLiteralFloat(null);
private final PossiblyMatchedValue<Currency> currency = new PossiblyMatchedValue<>();
private boolean negateAmount;
- private AccountRow() {
+ public AccountRow() {
super(Type.ACCOUNT_ITEM);
}
+ public AccountRow(AccountRow origin) {
+ super(Type.ACCOUNT_ITEM);
+ id = origin.id;
+ position = origin.position;
+ accountName.copyFrom(origin.accountName);
+ accountComment.copyFrom(origin.accountComment);
+ amount.copyFrom(origin.amount);
+ currency.copyFrom(origin.currency);
+ negateAmount = origin.negateAmount;
+ }
public boolean isNegateAmount() {
return negateAmount;
}
SpannableString ss = new SpannableString(testText);
Matcher m = compiledPattern.matcher(testText);
if (m.find()) {
- ArrayList<String> notMatched = new ArrayList<>();
if (m.start() > 0)
ss.setSpan(notMatchedSpan(), 0, m.start(),
Spanned.SPAN_INCLUSIVE_INCLUSIVE);
if (m.end() < testText.length() - 1)
- ss.setSpan(notMatchedSpan(), m.end(), testText.length() - 1,
+ ss.setSpan(notMatchedSpan(), m.end(), testText.length(),
Spanned.SPAN_INCLUSIVE_INCLUSIVE);
ss.setSpan(matchedSpan(), m.start(0), m.end(0),