X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fmodel%2FPatternDetailsItem.java;h=a5ec165c3e18353ee7977b3a590d1c45d67c05fc;hb=423e6077aaa672ef1cb9e6c489c8144811f5c682;hp=43c77f72e5ff7416041a20383df421c71c4be4b0;hpb=b0404689e0dbb2b08f02deca7ee5d14636a3baa6;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 43c77f72..a5ec165c 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/PatternDetailsItem.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/PatternDetailsItem.java @@ -61,8 +61,17 @@ abstract public class PatternDetailsItem { header.setName(ph.getName()); header.setPattern(ph.getRegularExpression()); header.setTestText(ph.getTestText()); - header.setTransactionDescription(ph.getTransactionDescription()); - header.setTransactionComment(ph.getTransactionComment()); + + if (ph.getTransactionDescriptionMatchGroup() == null) + header.setTransactionDescription(ph.getTransactionDescription()); + else + 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()); @@ -228,6 +237,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 { @@ -404,7 +423,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; @@ -528,13 +548,13 @@ abstract public class PatternDetailsItem { public int getTransactionDescriptionMatchGroup() { return transactionDescription.getMatchGroup(); } - public void setTransactionDescriptionMatchGroup(short group) { + public void setTransactionDescriptionMatchGroup(int group) { transactionDescription.setMatchGroup(group); } public int getTransactionCommentMatchGroup() { return transactionComment.getMatchGroup(); } - public void setTransactionCommentMatchGroup(short group) { + public void setTransactionCommentMatchGroup(int group) { transactionComment.setMatchGroup(group); } public void switchToLiteralDateYear() {