Interface Condition

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

public interface Condition extends Term, org.refcodes.mixin.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).
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.refcodes.mixin.ChildrenAccessor

    org.refcodes.mixin.ChildrenAccessor.ChildrenBuilder<T extends Object,B extends org.refcodes.mixin.ChildrenAccessor.ChildrenBuilder<T,B>>, org.refcodes.mixin.ChildrenAccessor.ChildrenMutator<T extends Object>, org.refcodes.mixin.ChildrenAccessor.ChildrenProperty<T extends Object>

    Nested classes/interfaces inherited from interface org.refcodes.mixin.DescriptionAccessor

    org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<B extends org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<B>>, org.refcodes.mixin.DescriptionAccessor.DescriptionMutator, org.refcodes.mixin.DescriptionAccessor.DescriptionProperty

    Nested classes/interfaces inherited from interface org.refcodes.exception.ExceptionAccessor

    org.refcodes.exception.ExceptionAccessor.ExceptionBuilder<EXC extends Throwable,B extends org.refcodes.exception.ExceptionAccessor.ExceptionBuilder<EXC,B>>, org.refcodes.exception.ExceptionAccessor.ExceptionMutator<EXC extends Throwable>, org.refcodes.exception.ExceptionAccessor.ExceptionProperty<EXC extends Throwable>

    Nested classes/interfaces inherited from interface org.refcodes.graphical.VisibleAccessor

    org.refcodes.graphical.VisibleAccessor.VisibleBuilder<B extends org.refcodes.graphical.VisibleAccessor.VisibleBuilder<B>>, org.refcodes.graphical.VisibleAccessor.VisibleMutator, org.refcodes.graphical.VisibleAccessor.VisibleProperty
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    hasChild(Term aTerm)
    Determines whether the provided Term is a child (or a child's child) of this Condition.
    default boolean
    isChild(Term aTerm)
    Determines whether the provided Term is a direct child of this Condition.
    default Condition[]
    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).
    default <T extends Operand<?>>
    T
    toOperand(Class<T> aType)
    Traverses the hierarchy of Condition tree and returns the (first) operand matching the given type.
    default Operand<?>
    toOperand(String aAlias)
    Traverses the hierarchy of Condition tree and returns the (first) operand matching the given alias.
    <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.
    Operand<?>[]
    Traverses the hierarchy of Conditions and collects all therein found Operands and sub-types such as the Flag or the Option.
    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).

    Methods inherited from interface org.refcodes.mixin.ChildrenAccessor

    getChildren

    Methods inherited from interface org.refcodes.mixin.DescriptionAccessor

    getDescription

    Methods inherited from interface org.refcodes.mixin.Resetable

    reset

    Methods inherited from interface org.refcodes.cli.Synopsisable

    toSynopsis, toSynopsis, toSynopsis, toSynopsis

    Methods inherited from interface org.refcodes.graphical.VisibleAccessor.VisibleBuilder

    withHide, withShow, withVisible

    Methods inherited from interface org.refcodes.graphical.VisibleAccessor.VisibleMutator

    hide, show

    Methods inherited from interface org.refcodes.graphical.VisibleAccessor.VisibleProperty

    letVisible
  • 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,