Interface Condition

All Superinterfaces:
ChildrenAccessor<Term[]>, DescriptionAccessor, Diagnosable, ExceptionAccessor<ArgsSyntaxException>, MatchCountAccessor, Resetable, Schemable<DiagnosticOptions>, Synopsisable, Term, VisibleAccessor, VisibleAccessor.VisibleBuilder<Term>, VisibleAccessor.VisibleMutator, VisibleAccessor.VisibleProperty
All Known Implementing Classes:
AbstractCondition, AllCondition, AndCondition, AnyCondition, CasesCondition, OrCondition, XorCondition

public interface Condition extends Term, ChildrenAccessor<Term[]>
The Condition interface represents a node (and therewith the syntax for the arguments) in the command line arguments syntax tree by simply extending the Term interface and adding the functionality of providing access to the added Operands (leafs).
  • Method Details

    • toOperand

      default <T extends Operand<?>> T toOperand(Class<T> aType)
      Traverses the hierarchy of Condition tree and returns the (first) operand matching the given type.
      Type Parameters:
      T - the generic type
      Parameters:
      aType - The type for which to seek for.
      Returns:
      The according Operand element or null if none matching was found
    • toOperand

      default Operand<?> toOperand(String aAlias)
      Traverses the hierarchy of Condition tree and returns the (first) operand matching the given alias.
      Parameters:
      aAlias - The alias for which to seek for.
      Returns:
      The according Operand element or null if none matching was found.
    • toOperand

      <T extends Operand<?>> T toOperand(String aAlias, Class<T> aType)
      Traverses the hierarchy of Condition tree and returns the (first) operand matching the given alias and type.
      Type Parameters:
      T - the generic type
      Parameters:
      aAlias - The alias for which to seek for.
      aType - The type for which to seek for.
      Returns:
      The according Operand element or null if none matching was found
    • toOperands

      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.
      Returns:
      The according Operand elements.
    • toOperands

      default Operand<?>[] toOperands(String[] aArgs)
      Determines the potential Operand instances matching the given args (intersection) which might be useful to get more details on failing to parse arguments (in case we have superfluous arguments and want to see which Operand addressed them).
      Parameters:
      aArgs - The arguments for which to determine the Operand parameters.
      Returns:
      The according Operand parameters or null if none was found.
    • toConditions

      default Condition[] toConditions(String[] aArgs)
      Determines the potential Condition instances matching the given args (intersection) which might be useful to get more details on failing to parse arguments (in case we have superfluous arguments and want to see which Condition parent's Operand child addressed them).
      Parameters:
      aArgs - The arguments for which to determine the Condition parents.
      Returns:
      The according Condition parents or null if none was found.
    • isChild

      default boolean isChild(Term aTerm)
      Determines whether the provided Term is a direct child of this Condition.
      Parameters:
      aTerm - The Term for which to determine if it is a direct child.
      Returns:
      True in case it is a direct child, else false,
    • hasChild

      default boolean hasChild(Term aTerm)
      Determines whether the provided Term is a child (or a child's child) of this Condition.
      Parameters:
      aTerm - The Term for which to determine if it is a child (or a child's child).
      Returns:
      True in case it is a child (or a child's child), else false,