Interface IIntegerItem

All Superinterfaces:
IAnyAtomicItem, IAtomicValuedItem, ICollectionValue, IDecimalItem, IItem, INumericItem
All Known Subinterfaces:
INonNegativeIntegerItem, IPositiveIntegerItem

public interface IIntegerItem extends IDecimalItem
An atomic Metapath item containing an integer data value.
  • Field Details

    • ONE

      @NonNull static final IIntegerItem ONE
      The integer value "1".
    • ZERO

      @NonNull static final IIntegerItem ZERO
      The integer value "0".
    • NEGATIVE_ONE

      @NonNull static final IIntegerItem NEGATIVE_ONE
      The integer value "-1".
  • Method Details

    • type

      @NonNull static IAtomicOrUnionType<IIntegerItem> type()
      Get the type information for this item.
      Returns:
      the type information
    • getType

      default IAtomicOrUnionType<? extends IIntegerItem> getType()
      Description copied from interface: IItem
      Get the type information for the item.
      Specified by:
      getType in interface IDecimalItem
      Specified by:
      getType in interface IItem
      Returns:
      the item's type information
    • valueOf

      @NonNull static IIntegerItem valueOf(@NonNull String value)
      Create an item from an existing integer value.
      Parameters:
      value - a string representing an integer value
      Returns:
      the item
      Throws:
      InvalidTypeMetapathException - if the provided value is not an integer
    • valueOf

      @NonNull static IIntegerItem valueOf(int value)
      Construct a new integer item using the provided value.
      Parameters:
      value - a long value
      Returns:
      the new item
    • valueOf

      @NonNull static IIntegerItem valueOf(long value)
      Construct a new integer item using the provided value.
      Parameters:
      value - a long value
      Returns:
      the new item
    • valueOf

      @NonNull static IIntegerItem valueOf(boolean value)
      Construct a new integer item using the provided value.
      Parameters:
      value - a long value
      Returns:
      the new item
    • valueOf

      @NonNull static IIntegerItem valueOf(@NonNull BigInteger value)
      Construct a new integer item using the provided value.
      Parameters:
      value - an integer value
      Returns:
      the new item
    • cast

      @NonNull static IIntegerItem cast(@NonNull IAnyAtomicItem item)
      Cast the provided type to this item type.
      Parameters:
      item - the item to cast
      Returns:
      the original item if it is already this type, otherwise a new item cast to this type
      Throws:
      InvalidValueForCastFunctionException - if the provided item cannot be cast to this type
    • castAsType

      default IIntegerItem castAsType(IAnyAtomicItem item)
      Description copied from interface: IAnyAtomicItem
      Cast the provided item to be the same type as this item.
      Specified by:
      castAsType in interface IAnyAtomicItem
      Specified by:
      castAsType in interface IDecimalItem
      Specified by:
      castAsType in interface INumericItem
      Parameters:
      item - the item to cast
      Returns:
      an atomic item of this type
    • abs

      default IIntegerItem abs()
      Description copied from interface: INumericItem
      Get the absolute value of the item.
      Specified by:
      abs in interface IDecimalItem
      Specified by:
      abs in interface INumericItem
      Returns:
      this item negated if this item is negative, or the item otherwise
    • ceiling

      default IIntegerItem ceiling()
      Description copied from interface: INumericItem
      Round the value to the whole number closest to positive infinity.
      Specified by:
      ceiling in interface IDecimalItem
      Specified by:
      ceiling in interface INumericItem
      Returns:
      the rounded value
    • floor

      default IIntegerItem floor()
      Description copied from interface: INumericItem
      Round the value to the whole number closest to negative infinity.
      Specified by:
      floor in interface IDecimalItem
      Specified by:
      floor in interface INumericItem
      Returns:
      the rounded value
    • toIntValueExact

      default int toIntValueExact()
      Convert this integer item to a Java int, precisely.
      Specified by:
      toIntValueExact in interface IDecimalItem
      Specified by:
      toIntValueExact in interface INumericItem
      Returns:
      the int value
      Throws:
      CastFunctionException - if the value does not fit in an int
    • add

      @NonNull default IIntegerItem add(@NonNull IIntegerItem addend)
      Create a new sum by adding this value to the provided addend value.
      Parameters:
      addend - the second value to sum
      Returns:
      a new value resulting from adding this value to the provided addend value
    • subtract

      @NonNull default IIntegerItem subtract(@NonNull IIntegerItem subtrahend)
      Determine the difference by subtracting the provided subtrahend value from this minuend value.
      Parameters:
      subtrahend - the value to subtract
      Returns:
      a new value resulting from subtracting the subtrahend from the minuend
    • multiply

      @NonNull default IIntegerItem multiply(@NonNull IIntegerItem multiplier)
      Multiply this multiplicand value by the provided multiplier value.
      Parameters:
      multiplier - the value to multiply by
      Returns:
      a new value resulting from multiplying the multiplicand by the multiplier
    • integerDivide

      @NonNull default IIntegerItem integerDivide(@NonNull IIntegerItem divisor)
      Divide this dividend value by the provided divisor value using integer division.
      Parameters:
      divisor - the value to divide by
      Returns:
      a new value resulting from dividing the dividend by the divisor
    • mod

      @NonNull default IIntegerItem mod(@NonNull IIntegerItem divisor)
      Compute the remainder when dividing this dividend value by the provided divisor value.
      Parameters:
      divisor - the value to divide by
      Returns:
      a new value containing the remainder resulting from dividing the dividend by the divisor
    • negate

      default IIntegerItem negate()
      Description copied from interface: INumericItem
      Reverse the sign of this value.
      Specified by:
      negate in interface IDecimalItem
      Specified by:
      negate in interface INumericItem
      Returns:
      a new value with the sign reversed
    • compareTo

      default int compareTo(IIntegerItem item)
      Compares this value with the argument.
      Parameters:
      item - the item to compare with this value
      Returns:
      a negative integer, zero, or a positive integer if this value is less than, equal to, or greater than the item.