Class Number

All Implemented Interfaces:
Serializable, EquationSolving, Numerical, XmlExport

public final class Number extends PrimaryItem
See Also:
  • Field Details

  • Constructor Details

    • Number

      public Number(Number n)
    • Number

      public Number(IrpParser.NumberContext ctx)
    • Number

      public Number(org.antlr.v4.runtime.tree.TerminalNode n)
    • Number

      public Number(String str)
  • Method Details

    • parse

      public static Number parse(String str)
    • parse

      public static Number parse(String str, int radix)
    • longValueExact

      public long longValueExact() throws ArithmeticException
      Throws:
      ArithmeticException
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in class IrpObject
    • isZero

      public boolean isZero()
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class IrpObject
    • shiftRight

      public Number shiftRight(int n)
    • toString

      public String toString(int radix)
      Overrides:
      toString in class IrpObject
    • toLong

      public long toLong(NameEngine nameEngine) throws ArithmeticException
      Description copied from interface: Numerical
      Produces a numerical result.
      Parameters:
      nameEngine - used to resolve names in expressions.
      Returns:
      result, long.
      Throws:
      ArithmeticException
    • toBitwiseParameter

      public BitwiseParameter toBitwiseParameter(RecognizeData recognizeData)
    • toLong

      public long toLong() throws ArithmeticException
      Throws:
      ArithmeticException
    • toIrpString

      public String toIrpString(int radix)
      Description copied from class: IrpObject
      Returns a computed IRP (-segment) string representation of current IrpObject. Numerical parameters, but not durations etc, will be printed using the radix in the argument.
      Specified by:
      toIrpString in class PrimaryItem
      Parameters:
      radix - Radix for parameters.
      Returns:
      Formatted string.
    • toElement

      public Element toElement(Document document)
      Specified by:
      toElement in interface XmlExport
      Overrides:
      toElement in class IrpObject
      Parameters:
      document -
      Returns:
    • weight

      public int weight()
      Description copied from class: IrpObject
      Returns a (somewhat arbitrary) measure of the complexity of the object. Can be used for determining if a decode is "simpler" than another decode.
      Specified by:
      weight in class IrpObject
      Returns:
      non-negative integer.
    • propertiesMap

      public Map<String,Object> propertiesMap(boolean eval, GeneralSpec generalSpec, NameEngine nameEngine)
      Description copied from class: PrimaryItem
      Generate a map of the properties in the very object.
      Specified by:
      propertiesMap in class PrimaryItem
      Parameters:
      eval - If true, evaluate names.
      generalSpec -
      nameEngine -
      Returns:
    • invert

      public BitwiseParameter invert(BitwiseParameter rhs, RecognizeData nameEngine)
      Description copied from class: PrimaryItem
      Default implementation, for non-invertible expressions.
      Specified by:
      invert in interface EquationSolving
      Overrides:
      invert in class PrimaryItem
      Parameters:
      rhs -
      nameEngine -
      Returns:
      null
    • leftHandSide

      public PrimaryItem leftHandSide()
      Description copied from class: PrimaryItem
      Default implementation.
      Specified by:
      leftHandSide in interface EquationSolving
      Overrides:
      leftHandSide in class PrimaryItem
      Returns:
      this
    • substituteConstantVariables

      public PrimaryItem substituteConstantVariables(Map<String,Long> constantVariables)
      Description copied from class: PrimaryItem
      Returns a PrimaryItem of the same type with all occurrences of the variables in the dictionary replaced by their values in the dictionary. Does not change the containing object. May return the object itself, or share sub-objects with it.
      Specified by:
      substituteConstantVariables in class PrimaryItem
      Parameters:
      constantVariables - Map<String, Long> of variables to replace.
      Returns:
      PrimaryItem of the same type.
    • formatIntegerWithLeadingZeros

      public String formatIntegerWithLeadingZeros(int radix, int length)
    • testBit

      public boolean testBit(int n)
    • constant

      public boolean constant(NameEngine nameEngine)
      Specified by:
      constant in class PrimaryItem