Class PrimaryItem

java.lang.Object
org.harctoolbox.irp.IrpObject
org.harctoolbox.irp.PrimaryItem
All Implemented Interfaces:
Serializable, EquationSolving, Numerical, XmlExport
Direct Known Subclasses:
Expression, Name, Number

public abstract class PrimaryItem extends IrpObject implements Numerical, EquationSolving
See Also:
  • Constructor Details

    • PrimaryItem

      protected PrimaryItem(org.antlr.v4.runtime.tree.ParseTree ctx)
  • Method Details

    • newPrimaryItem

      public static PrimaryItem newPrimaryItem(IrpParser.Primary_itemContext ctx)
    • newPrimaryItem

      public static PrimaryItem newPrimaryItem(long n)
    • newPrimaryItem

      public static PrimaryItem newPrimaryItem(String name) throws InvalidNameException
      Throws:
      InvalidNameException
    • toIrpString

      public abstract 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 IrpObject
      Parameters:
      radix - Radix for parameters.
      Returns:
      Formatted string.
    • propertiesMap

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

      Default implementation, for non-invertible expressions.
      Specified by:
      invert in interface EquationSolving
      Parameters:
      rhs -
      nameEngine -
      Returns:
      null
      Throws:
      NameUnassignedException
    • leftHandSide

      public PrimaryItem leftHandSide()
      Default implementation.
      Specified by:
      leftHandSide in interface EquationSolving
      Returns:
      this
    • substituteConstantVariables

      public abstract PrimaryItem substituteConstantVariables(Map<String,Long> constantVariables)
      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.
      Parameters:
      constantVariables - Map<String, Long> of variables to replace.
      Returns:
      PrimaryItem of the same type.
    • constant

      public abstract boolean constant(NameEngine nameEngine)