Class ModifierSet

java.lang.Object
org.z3950.zing.cql.ModifierSet

public class ModifierSet extends Object
Represents a base String and a set of Modifiers.

This class is used as a workhorse delegate by both CQLRelation and CQLProxNode - two functionally very separate classes that happen to require similar data structures and functionality.

A ModifierSet consists of a ``base'' string together with a set of zero or more type comparison value pairs, where type, comparison and value are all strings.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new ModifierSet with the specified base.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a modifier of the specified type, but with no comparison and value, to a ModifierSet.
    void
    addModifier(String type, String comparison, String value)
    Adds a modifier of the specified type, comparison and value to a ModifierSet.
    Returns the base string with which the ModifierSet was created.
    int
    Returns the exclusive source end, suitable for query.substring(getStart(), getEnd()).
    Returns an array of the modifiers in a ModifierSet.
    int
    Returns the inclusive source start of this base and its modifiers.
    static void
    main(String[] args)
     
    Returns the value of the modifier in the specified ModifierSet that corresponds to the specified type.
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ModifierSet

      public ModifierSet(String base)
      Creates a new ModifierSet with the specified base.
  • Method Details

    • getStart

      public int getStart()
      Returns the inclusive source start of this base and its modifiers. Offsets are zero-based UTF-16 indexes into the original query, excluding surrounding whitespace. Manually constructed objects and implicit defaults have no source location and return -1. Locations describe the original parse and are not updated after tree modifications.
      Returns:
      source start, or -1 when unavailable
    • getEnd

      public int getEnd()
      Returns the exclusive source end, suitable for query.substring(getStart(), getEnd()).
      Returns:
      source end, or -1 when unavailable
      See Also:
    • getBase

      public String getBase()
      Returns the base string with which the ModifierSet was created.
    • addModifier

      public void addModifier(String type, String comparison, String value)
      Adds a modifier of the specified type, comparison and value to a ModifierSet.
    • addModifier

      public void addModifier(String type)
      Adds a modifier of the specified type, but with no comparison and value, to a ModifierSet.
    • modifier

      public String modifier(String type)
      Returns the value of the modifier in the specified ModifierSet that corresponds to the specified type.
    • getModifiers

      public List<Modifier> getModifiers()
      Returns an array of the modifiers in a ModifierSet.
      Returns:
      An array of Modifiers.
    • toCQL

      public String toCQL()
    • main

      public static void main(String[] args)