X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fmodel%2FPatternDetailsItem.java;h=52fa1dc7671c1f877be9590eb22a179dae95223e;hb=a063310fe70a3c451636e25d334cbdcacec677eb;hp=935280519791bb1f2d3be4996f41180ab690e53c;hpb=72bbdba090181d9d725cd1d80f96e6ea1ab4c28c;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/model/PatternDetailsItem.java b/app/src/main/java/net/ktnx/mobileledger/model/PatternDetailsItem.java index 93528051..52fa1dc7 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/PatternDetailsItem.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/PatternDetailsItem.java @@ -65,16 +65,28 @@ abstract public class PatternDetailsItem { if (ph.getTransactionDescriptionMatchGroup() == null) header.setTransactionDescription(ph.getTransactionDescription()); else - header.setTransactionDescriptionMatchGroup(ph.getTransactionDescriptionMatchGroup()); + header.setTransactionDescriptionMatchGroup( + ph.getTransactionDescriptionMatchGroup()); if (ph.getTransactionCommentMatchGroup() == null) header.setTransactionComment(ph.getTransactionComment()); else header.setTransactionCommentMatchGroup(ph.getTransactionCommentMatchGroup()); - header.setDateDayMatchGroup(ph.getDateDayMatchGroup()); - header.setDateMonthMatchGroup(ph.getDateMonthMatchGroup()); - header.setDateYearMatchGroup(ph.getDateYearMatchGroup()); + if (ph.getDateDayMatchGroup() == null) + header.setDateDay(ph.getDateDay()); + else + header.setDateDayMatchGroup(ph.getDateDayMatchGroup()); + + if (ph.getDateMonthMatchGroup() == null) + header.setDateMonth(ph.getDateMonth()); + else + header.setDateMonthMatchGroup(ph.getDateMonthMatchGroup()); + + if (ph.getDateYearMatchGroup() == null) + header.setDateYear(ph.getDateYear()); + else + header.setDateYearMatchGroup(ph.getDateYearMatchGroup()); return header; } @@ -237,6 +249,16 @@ abstract public class PatternDetailsItem { public void switchToLiteral() { literalValue = true; } + public String toString() { + if (literalValue) + if (value == null) + return ""; + else + return value.toString(); + if (matchGroup > 0) + return "grp:" + matchGroup; + return ""; + } } public static class TYPE { @@ -413,7 +435,8 @@ abstract public class PatternDetailsItem { @Override public String toString() { return super.toString() + - String.format(" name[%s] pat[%s] test[%s]", name, pattern, testText); + String.format(" name[%s] pat[%s] test[%s] tran[%s] com[%s]", name, pattern, + testText, transactionDescription, transactionComment); } public String getTestText() { return testText;