Package org.harctoolbox.irp
Class Number
java.lang.Object
org.harctoolbox.irp.IrpObject
org.harctoolbox.irp.PrimaryItem
org.harctoolbox.irp.Number
- All Implemented Interfaces:
Serializable,EquationSolving,Numerical,XmlExport
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanconstant(NameEngine nameEngine) booleanformatIntegerWithLeadingZeros(int radix, int length) inthashCode()invert(BitwiseParameter rhs, RecognizeData nameEngine) Default implementation, for non-invertible expressions.booleanisZero()Default implementation.longstatic Numberstatic NumberpropertiesMap(boolean eval, GeneralSpec generalSpec, NameEngine nameEngine) Generate a map of the properties in the very object.shiftRight(int n) 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.booleantestBit(int n) toBitwiseParameter(RecognizeData recognizeData) toIrpString(int radix) Returns a computed IRP (-segment) string representation of current IrpObject.longtoLong()longtoLong(NameEngine nameEngine) Produces a numerical result.toString(int radix) intweight()Returns a (somewhat arbitrary) measure of the complexity of the object.Methods inherited from class org.harctoolbox.irp.PrimaryItem
newPrimaryItem, newPrimaryItem, newPrimaryItemMethods inherited from class org.harctoolbox.irp.IrpObject
createParameterSpecs, getParseTree, numberOfBits, numberOfBitSpecs, numberOfInfiniteRepeats, prerender, propertiesMap, toDocument, toIrpString, toString, toStringTree, toStringTree, toTreeViewer, toTreeViewer, toTreeViewer, updateStateWhenEntering, updateStateWhenExiting
-
Field Details
-
SIZE
public static final int SIZE- See Also:
-
-
Constructor Details
-
Number
-
Number
-
Number
public Number(org.antlr.v4.runtime.tree.TerminalNode n) -
Number
-
-
Method Details
-
parse
-
parse
-
longValueExact
- Throws:
ArithmeticException
-
equals
-
isZero
public boolean isZero() -
hashCode
public int hashCode() -
shiftRight
-
toString
-
toLong
Description copied from interface:NumericalProduces a numerical result.- Parameters:
nameEngine- used to resolve names in expressions.- Returns:
- result, long.
- Throws:
ArithmeticException
-
toBitwiseParameter
-
toLong
- Throws:
ArithmeticException
-
toIrpString
Description copied from class:IrpObjectReturns 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:
toIrpStringin classPrimaryItem- Parameters:
radix- Radix for parameters.- Returns:
- Formatted string.
-
toElement
-
weight
public int weight()Description copied from class:IrpObjectReturns a (somewhat arbitrary) measure of the complexity of the object. Can be used for determining if a decode is "simpler" than another decode. -
propertiesMap
public Map<String,Object> propertiesMap(boolean eval, GeneralSpec generalSpec, NameEngine nameEngine) Description copied from class:PrimaryItemGenerate a map of the properties in the very object.- Specified by:
propertiesMapin classPrimaryItem- Parameters:
eval- If true, evaluate names.generalSpec-nameEngine-- Returns:
-
invert
Description copied from class:PrimaryItemDefault implementation, for non-invertible expressions.- Specified by:
invertin interfaceEquationSolving- Overrides:
invertin classPrimaryItem- Parameters:
rhs-nameEngine-- Returns:
- null
-
leftHandSide
Description copied from class:PrimaryItemDefault implementation.- Specified by:
leftHandSidein interfaceEquationSolving- Overrides:
leftHandSidein classPrimaryItem- Returns:
- this
-
substituteConstantVariables
Description copied from class:PrimaryItemReturns 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:
substituteConstantVariablesin classPrimaryItem- Parameters:
constantVariables- Map<String, Long> of variables to replace.- Returns:
- PrimaryItem of the same type.
-
formatIntegerWithLeadingZeros
-
testBit
public boolean testBit(int n) -
constant
- Specified by:
constantin classPrimaryItem
-