Interface Expression

All Known Implementing Classes:
BaseExpression, FilterExpression

public interface Expression
Interface describing an expression to be used in the Find command.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds arguments to this expression.
    void
    Adds children to this expression.
    apply(PathData item, int depth)
    Apply the expression to the specified item, called once for each item.
    void
    Finishes the expression, called once after processing all items.
    Returns a description of the expression for use in help.
    int
    Returns the precedence of this expression (only applicable to operators).
    Returns brief usage instructions for this expression.
    boolean
    Indicates whether this expression performs an action, i.e. provides output back to the user.
    boolean
    Identifies the expression as an operator rather than a primary.
    void
    Prepares the expression for execution, called once after setting options and before processing any options.
    void
    Set the options for this expression, called once before processing any items.
  • Method Details

    • setOptions

      void setOptions(FindOptions options) throws IOException
      Set the options for this expression, called once before processing any items.
      Parameters:
      options - options.
      Throws:
      IOException - raised on errors performing I/O.
    • prepare

      void prepare() throws IOException
      Prepares the expression for execution, called once after setting options and before processing any options.
      Throws:
      IOException - raised on errors performing I/O.
    • apply

      Result apply(PathData item, int depth) throws IOException
      Apply the expression to the specified item, called once for each item.
      Parameters:
      item - PathData item to be processed
      depth - distance of the item from the command line argument
      Returns:
      Result of applying the expression to the item
      Throws:
      IOException - raised on errors performing I/O.
    • finish

      void finish() throws IOException
      Finishes the expression, called once after processing all items.
      Throws:
      IOException - raised on errors performing I/O.
    • getUsage

      String[] getUsage()
      Returns brief usage instructions for this expression. Multiple items should be returned if there are multiple ways to use this expression.
      Returns:
      array of usage instructions
    • getHelp

      String[] getHelp()
      Returns a description of the expression for use in help. Multiple lines should be returned array items. Lines should be formated to 60 characters or less.
      Returns:
      array of description lines
    • isAction

      boolean isAction()
      Indicates whether this expression performs an action, i.e. provides output back to the user.
      Returns:
      if is action true, not false.
    • isOperator

      boolean isOperator()
      Identifies the expression as an operator rather than a primary.
      Returns:
      if is operator true, not false.
    • getPrecedence

      int getPrecedence()
      Returns the precedence of this expression (only applicable to operators).
      Returns:
      precedence.
    • addChildren

      void addChildren(Deque<Expression> expressions)
      Adds children to this expression. Children are popped from the head of the deque.
      Parameters:
      expressions - deque of expressions from which to take the children
    • addArguments

      void addArguments(Deque<String> args)
      Adds arguments to this expression. Arguments are popped from the head of the deque and added to the front of the child list, ie last child added is the first evaluated.
      Parameters:
      args - deque of arguments from which to take expression arguments