Enum Class Occ

java.lang.Object
java.lang.Enum<Occ>
org.basex.query.value.type.Occ
All Implemented Interfaces:
Serializable, Comparable<Occ>, java.lang.constant.Constable

public enum Occ extends Enum<Occ>
Occurrence indicator (cardinality).
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Enum Constant Details

    • ZERO

      public static final Occ ZERO
      Zero.
    • ZERO_OR_ONE

      public static final Occ ZERO_OR_ONE
      Zero or one.
    • EXACTLY_ONE

      public static final Occ EXACTLY_ONE
      Exactly one.
    • ONE_OR_MORE

      public static final Occ ONE_OR_MORE
      One or more.
    • ZERO_OR_MORE

      public static final Occ ZERO_OR_MORE
      Zero or more.
  • Field Details

    • min

      public final long min
      Minimal result size (0 or more).
    • max

      public final long max
      Maximal result size (equal to min or more).
  • Method Details

    • values

      public static Occ[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Occ valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • instanceOf

      public boolean instanceOf(Occ occ)
      Checks if the specified occurrence indicator is an instance of the current occurrence indicator.
      Parameters:
      occ - occurrence indicator to check
      Returns:
      result of check
    • intersect

      public Occ intersect(Occ other)
      Computes the intersection between this occurrence indicator and the given one. If none exists (e.g. between ZERO and EXACTLY_ONE), null is returned.
      Parameters:
      other - other occurrence indicator
      Returns:
      intersection or null
    • union

      public Occ union(Occ other)
      Computes the union between this occurrence indicator and the given one.
      Parameters:
      other - other occurrence indicator
      Returns:
      union
    • add

      public Occ add(Occ other)
      Adds two occurrence indicators.
      Parameters:
      other - other occurrence indicator
      Returns:
      union
    • check

      public boolean check(long card)
      Checks if the given cardinality is supported by this type.
      Parameters:
      card - cardinality
      Returns:
      result of check
    • toString

      public String toString()
      Overrides:
      toString in class Enum<Occ>