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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
constant
(NameEngine nameEngine) boolean
formatIntegerWithLeadingZeros
(int radix, int length) int
hashCode()
invert
(BitwiseParameter rhs, RecognizeData nameEngine) Default implementation, for non-invertible expressions.boolean
isZero()
Default implementation.long
static Number
static Number
propertiesMap
(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.boolean
testBit
(int n) toBitwiseParameter
(RecognizeData recognizeData) toIrpString
(int radix) Returns a computed IRP (-segment) string representation of current IrpObject.long
toLong()
long
toLong
(NameEngine nameEngine) Produces a numerical result.toString
(int radix) int
weight()
Returns a (somewhat arbitrary) measure of the complexity of the object.Methods inherited from class org.harctoolbox.irp.PrimaryItem
newPrimaryItem, newPrimaryItem, newPrimaryItem
Methods 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:Numerical
Produces 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: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 classPrimaryItem
- Parameters:
radix
- Radix for parameters.- Returns:
- Formatted string.
-
toElement
-
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. -
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 classPrimaryItem
- Parameters:
eval
- If true, evaluate names.- Returns:
-
invert
Description copied from class:PrimaryItem
Default implementation, for non-invertible expressions.- Specified by:
invert
in interfaceEquationSolving
- Overrides:
invert
in classPrimaryItem
- Returns:
- null
-
leftHandSide
Description copied from class:PrimaryItem
Default implementation.- Specified by:
leftHandSide
in interfaceEquationSolving
- Overrides:
leftHandSide
in classPrimaryItem
- Returns:
- this
-
substituteConstantVariables
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 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:
constant
in classPrimaryItem
-