Class AbstractCondition

    • Constructor Detail

      • AbstractCondition

        public AbstractCondition​(Syntaxable... aElements)
        Instantiates a new abstract condition.
        Parameters:
        aElements - the elements
    • Method Detail

      • toSyntax

        public java.lang.String toSyntax​(SyntaxNotation aSyntaxNotation,
                                         java.lang.String aOptionEscCode,
                                         java.lang.String aResetEscCode)
        This method is to be called from inside the Syntaxable hierarchy; use the method SyntaxUsage.toUsage(SyntaxNotation) in case you invoke syntax retrieval from the root Syntaxable. Returns the human readable (verbose) syntax of this Syntaxable instance including, in case of being a node in the syntax tree (such as a Condition, the syntax of the child Syntaxable instances. ATTENTION: As of different parenthesis settings for some notations regarding the root Syntaxable and the child Syntaxables, the method Syntaxable.toSyntax(SyntaxNotation, String, String) is called from inside the Syntaxable hierarchy. In case the syntax is to be retrieved from the root Syntaxable, then the applicable method to be called is SyntaxUsage.toUsage(SyntaxNotation), as for some notations it will for example not create the most outer braces.
        Specified by:
        toSyntax in interface Syntaxable
        Parameters:
        aSyntaxNotation - The syntax notation used for generating the command line arguments syntax.
        aOptionEscCode - The escape code to be used when processing an option, e.g. this can be an ANSI Escape-Code to highlight the option parameters.
        aResetEscCode - The escape code to close (reset) any Escape-Code being set before.
        Returns:
        The human readable (verbose) command line arguments syntax.
      • reset

        public void reset​()
        Specified by:
        reset in interface org.refcodes.component.Resetable
      • toString

        public java.lang.String toString​()
        Overrides:
        toString in class java.lang.Object
      • toOperands

        public java.util.List<? extends Operand<?>> toOperands​()
        Traverses the hierarchy of Conditions and collects all therein found Operands and sub-types such as the Flag or the Option. This is most useful when creating a list of Options, Flages and Operands when printing out detailed help.
        Specified by:
        toOperands in interface Condition
        Returns:
        The according Operand elements.
      • getChildren

        protected java.util.List<Syntaxable> getChildren​()
        Gets the children.
        Returns:
        the children
      • addChild

        protected void addChild​(Syntaxable aArgumentizer)
        Adds the child.
        Parameters:
        aArgumentizer - the argumentizer
      • get

        public <V> V get​(java.lang.String aAlias)
        Searches for a value being set for the given for given alias in the syntax tree parsing the command line arguments; if a node in the syntax tree has a value for the given alias, then this value is returned.
        Specified by:
        get in interface Syntaxable
        Type Parameters:
        V - The type of the value being expected.
        Parameters:
        aAlias - The alias for which to seek for a value being set.
        Returns:
        The according value or null if none has been set for the given alias.
      • toUsage

        public java.lang.String toUsage​(SyntaxNotation aSyntaxNotation,
                                        java.lang.String aOptionEscCode,
                                        java.lang.String aResetEscCode)
        Returns the human readable (verbose) syntax of implementing class ATTENTION: As of different parenthesis settings for some notations regarding the root Syntaxable and the child Syntaxables, the method Syntaxable.toSyntax(SyntaxNotation, String, String) is called from inside a Syntaxable hierarchy. In case the syntax is to be retrieved from the root Syntaxable or an encapsulating and different type, then the applicable method to be called is SyntaxUsage.toUsage(SyntaxNotation), as for some notations it will for example not create the most outer braces.
        Specified by:
        toUsage in interface SyntaxUsage
        Parameters:
        aSyntaxNotation - The syntax notation used for generating the command line arguments syntax.
        aOptionEscCode - The escape code to be used when processing an option, e.g. this can be an ANSI Escape-Code to highlight the option parameters (for example "--help", "-q" and so on).
        aResetEscCode - The escape code to close (reset) any Escape-Code being set before.
        Returns:
        The human readable (verbose) command line arguments syntax.