Package me.zpath

Class Term

java.lang.Object
me.zpath.Term

public class Term extends Object

A term is a basic unit of the parsed ZPath, which may be a token like "+", a string or number constant, a path like "parent/child", a function, or an expression like "(name=="test" || age+3 < 5)".

This class is only of interest to people implementing their own Function

  • Field Details

    • WS

      public static final Term WS
      The whitespace Token
    • DOT

      public static final Term DOT
      The "." Token
    • DOTDOT

      public static final Term DOTDOT
      The ".." Token
    • DOTDOTSTAR

      public static final Term DOTDOTSTAR
      The "..*" Token
    • LBRACE

      public static final Term LBRACE
      The "[" Token
    • RBRACE

      public static final Term RBRACE
      The "]" Token
    • LPAREN

      public static final Term LPAREN
      The "(" Token
    • RPAREN

      public static final Term RPAREN
      The ")" Token
    • BANG

      public static final Term BANG
      The "!" Token
    • TILDE

      public static final Term TILDE
      The "~" Token
    • STAR

      public static final Term STAR
      The "*" Token
    • STARSTAR

      public static final Term STARSTAR
      The "**" Token
    • SLASH

      public static final Term SLASH
      The "/" Token
    • PERCENT

      public static final Term PERCENT
      The "%" Token
    • PLUS

      public static final Term PLUS
      The "+" Token
    • MINUS

      public static final Term MINUS
      The "-" Token
    • GT

      public static final Term GT
      The ">" Token
    • LT

      public static final Term LT
      The "<" Token
    • GE

      public static final Term GE
      The ">=" Token
    • LE

      public static final Term LE
      The "<=" Token
    • EQ

      public static final Term EQ
      The "==" Token
    • NE

      public static final Term NE
      The "!=" Token
    • EEQ

      public static final Term EEQ
      The "===" Token
    • NEE

      public static final Term NEE
      The "!-=" Token
    • BITAND

      public static final Term BITAND
      The "&" Token
    • CARET

      public static final Term CARET
      The "^" Token
    • BITOR

      public static final Term BITOR
      The "|" Token
    • AND

      public static final Term AND
      The "&&" Token
    • OR

      public static final Term OR
      The "||;" Token
    • QUESTION

      public static final Term QUESTION
      The "?" Token
    • COLON

      public static final Term COLON
      The ":" Token
    • COMMA

      public static final Term COMMA
      The "," Token
    • ANYINDEX

      static final int ANYINDEX
      A value that can be passed into axisKey(java.lang.Object, int) to mean "applies to any index"
      See Also:
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isDelim

      public boolean isDelim()
      Return true if this Term is a known delimiter
      Returns:
      true if it's a delimiter
    • isString

      public boolean isString()
      Return true if this Term is a string
      Returns:
      true if it's a string
    • isInteger

      public boolean isInteger()
      Return true if this Term is an integer
      Returns:
      true if it's an integer
    • isReal

      public boolean isReal()
      Return true if this Term is an real number
      Returns:
      true if it's a real
    • isIndex

      public boolean isIndex()
      Return true if this Term is an index
      Returns:
      true if it's an index
    • isNumber

      public boolean isNumber()
      Return true if this Term is an integer or a real number
      Returns:
      true if it's a number
    • isBoolean

      public boolean isBoolean()
      Return true if this Term is a boolean
      Returns:
      true if it's a boolean
    • isName

      public boolean isName()
      Return true if this Term is a name (an unquoted string)
      Returns:
      true if it's a name
    • isFunction

      public boolean isFunction()
      Return true if this Term is a function
      Returns:
      true if it's a function
    • isPath

      public boolean isPath()
      Return true if this Term is a path
      Returns:
      true if it's a function
    • isExpr

      public boolean isExpr()
      Return true if this Term is an expression
      Returns:
      true if it's a function
    • numberValue

      public Number numberValue()
      If this term is a number, return the value as a double
      Returns:
      the value of the term as a double
      Throws:
      IllegalStateException - if its not a double
    • stringValue

      public String stringValue()
      If this term is a string, return the value as a string
      Returns:
      the value of the term as a string
      Throws:
      IllegalStateException - if its not a string
    • eval

      public List<Object> eval(List<Object> in, List<Object> out, EvalContext context)
      Evaluate this Term.
      Parameters:
      in - the set of Objects that are the current context - will never be empty
      out - if this Term evaluates to one or more Objects, they should be added to this collection
      context - the context
    • log

      default void log(Configuration.Logger logger)
      Write this object to the specified Logger
      Parameters:
      logger - the logger