comparison src/main/gov/nasa/jpf/vm/BooleanChoiceGenerator.java @ 3:fdc263e5806b

added inverse matching in StringSetMatcher. Since this is not easy to do in regexes, it's at the next hight level in StringSetMatcher added a optional CG accessor interface (geChoice(i), getAllChoices(), getProcessedChoices() getUnprocessedChoices()) that can be used from listeners and peers to enumerate/analyse choice sets. Note that not all CGs have to support this as there is no requirement that CGs actually use pre-computed choice sets. The low level accessor is getChoice(i), ChoiceGeneratorBase provides generic (not very efficient) set accessor implementations. Note that ChoiceGeneratorBase.getChoice() has to be overridden in subclasses in order to support choice enumeration, the default impl is just there so that we don't break subclass compilation
author Peter Mehlitz <Peter.C.Mehlitz@nasa.gov>
date Tue, 03 Feb 2015 08:49:33 -0800
parents 61d41facf527
children
comparison
equal deleted inserted replaced
2:b920e6b1be83 3:fdc263e5806b
70 @Override 70 @Override
71 public void advance () { 71 public void advance () {
72 if (count < 1) { 72 if (count < 1) {
73 count++; 73 count++;
74 next = !next; 74 next = !next;
75 }
76 }
77
78 @Override
79 public Boolean getChoice (int idx){
80 if (idx == 0){
81 return falseFirst ? Boolean.FALSE : Boolean.TRUE;
82 } else if (idx == 1){
83 return falseFirst ? Boolean.TRUE : Boolean.FALSE;
84 } else {
85 throw new IllegalArgumentException("choice index out of range: " + idx);
75 } 86 }
76 } 87 }
77 88
78 @Override 89 @Override
79 public void reset () { 90 public void reset () {