1 package jalview.util.matcher;
3 import jalview.util.MessageManager;
6 * An enumeration for binary conditions that a user might choose from when
7 * setting filter or match conditions for values
11 Contains(false, true, "Contains"),
12 NotContains(false, true, "NotContains"), Matches(false, true, "Matches"),
13 NotMatches(false, true, "NotMatches"), Present(false, false, "Present"),
14 NotPresent(false, false, "NotPresent"), EQ(true, true, "EQ"),
15 NE(true, true, "NE"), LT(true, true, "LT"), LE(true, true, "LE"),
16 GT(true, true, "GT"), GE(true, true, "GE");
18 private boolean numeric;
20 private boolean needsAPattern;
23 * value used to save a Condition to the
24 * Jalview project file or restore it from project;
25 * it should not be changed even if enum names change in future
27 private String stableName;
30 * Answers the enum value whose 'stable name' matches the argument (not case
31 * sensitive), or null if no match
36 public static Condition fromString(String stableName)
38 for (Condition c : values())
40 if (c.stableName.equalsIgnoreCase(stableName))
55 Condition(boolean isNumeric, boolean needsPattern, String stablename)
58 needsAPattern = needsPattern;
59 stableName = stablename;
63 * Answers true if the condition does a numerical comparison, else false
68 public boolean isNumeric()
74 * Answers true if the condition requires a pattern to compare against, else
79 public boolean needsAPattern()
84 public String getStableName()
90 * Answers a display name for the match condition, suitable for showing in
91 * drop-down menus. The value may be internationalized using the resource key
92 * "label.matchCondition_" with the enum name appended.
97 public String toString()
99 return MessageManager.getStringOrReturn("label.matchCondition_",