Package com.iizix.prop
Class SelectorExpression
java.lang.Object
com.iizix.prop.SelectorExpression
- Direct Known Subclasses:
- EditorSelectorExpression
The Selector Expression Parser.
- Author:
- Christopher Mindus
- Nested Class SummaryNested ClassesModifier and TypeClassDescription- static classReference class holding the string reference and its location in the expression.- static enumThe token enumeration.- static classTokens data class with token information, and positions (offsets) in the expression String.
- Field SummaryFieldsModifier and TypeFieldDescription- static final SelectorExpression.Reference[]Empty Reference array.- final StringThe parsed expression.- protected final ArrayList<SelectorExpression.TokenData>The tokens.
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescription- protected booleanEvaluates an expression at specified index.- getClassRefactoredExpression- (String oldClassName, String newClassName) Outputs the expression reformatted used for class refactoring.- getError()Gets the error.- intGets the error position.Outputs the expression reformatted.Gets the selector and class references in the expression.- void- getReferences- (HashSet<String> selectors, HashSet<String> classes) Gets the selector and class references in the expression.- getSelectorRefactoredExpression- (String oldSelectorName, String newSelectorName) Outputs the expression reformatted used for Selector refactoring.- boolean- isSelected- (Selector selector, EnvProps envProps) Called to resolve the SelectorExpression by custom Java code.- boolean- isValidWordCharacter- (int ch) Checks for valid character in a word.- static voidCommand line.- boolean- parse()Parses the expression.
- Field Details- EMPTYEmpty Reference array.
- expressionThe parsed expression.
- tokensThe tokens.
 
- Constructor Details- SelectorExpressionCreates the Expression String.- There are four special sub expressions that are specified within brackets: - { dev: "device" } device or OS selection,
- { lang: "language" } language selection,
- { sel: "selectorReference" } used to get the result of another selector (circular references not allowed),
- { wc: environmentVariable: "Wild*Card?String" } matches an environment variable,
- { regexp: environmentVariable: "RegularExpressionWithinQuotes" } matches an environment variable in a Regular Expression,
- { java: "javaClassName" } executes a Java class implementing the interface ISelectorExpression.
 - Parameters:
- expression- The expression.
 
 
- Method Details- isValidWordCharacterpublic boolean isValidWordCharacter- (int ch) Checks for valid character in a word.- The word has the same syntax validity as - Atomnames, i.e. the characters :/\{}"'?*^,; are not allowed, but augmented with white space characters - \t \r \n and space.- Parameters:
- ch- The character to test.
- Returns:
- true for valid character, false otherwise.
 
- parsepublic boolean parse()Parses the expression.- Returns:
- true for success, false if errors are present.
 
- getErrorPositionpublic int getErrorPosition()Gets the error position.- Returns:
- The error position or -1 for no error.
 
- getErrorGets the error.- Returns:
- The error, or null for no error.
 
- getExpressionOutputs the expression reformatted.- If an error is present, the original expression is returned. - Returns:
- The expression reformatted as a string.
 
- getClassRefactoredExpressionOutputs the expression reformatted used for class refactoring.- If an error is present, the original expression is returned. - Parameters:
- oldClassName- The old class name.
- newClassName- The new class name.
- Returns:
- The expression reformatted as a string.
 
- getSelectorRefactoredExpressionOutputs the expression reformatted used for Selector refactoring.- If an error is present, the original expression is returned. - Parameters:
- oldSelectorName- The old Selector name.
- newSelectorName- The new Selector name.
- Returns:
- The expression reformatted as a string.
 
- getReferencesGets the selector and class references in the expression.
- getReferencesGets the selector and class references in the expression.
- isSelectedCalled to resolve the SelectorExpression by custom Java code.- Parameters:
- envProps- The client environment properties to verify for environment.
- Returns:
- true if the Selector is selected to be used, false otherwise.
 
- evalEvaluates an expression at specified index.- Parameters:
- selector- The selector.
- envProps- The client environment properties to verify for environment.
- index- The index in [0] processed.
- isDesigner- If true, Java classes always return true and are not called.
- Returns:
- Result from expression evaluation.
 
- mainCommand line.