Package org.harctoolbox.irp
Class FiniteBitField
java.lang.Object
org.harctoolbox.irp.IrpObject
org.harctoolbox.irp.BitField
org.harctoolbox.irp.FiniteBitField
- All Implemented Interfaces:
Serializable
,EquationSolving
,IrStreamItem
,Numerical
,XmlExport
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Max length of a BitField in this implementation. -
Constructor Summary
ConstructorDescriptionFiniteBitField
(long data, long width, long chop, boolean complement, boolean reverse) FiniteBitField
(String str) FiniteBitField
(String name, long width) FiniteBitField
(String name, long width, boolean complement) -
Method Summary
Modifier and TypeMethodDescriptionallDurationsInMicros
(GeneralSpec generalSpec, NameEngine nameEngine) Delivers a set of all the contained durations in microseconds.boolean
constant
(NameEngine nameEngine) void
createParameterSpecs
(ParameterSpecs parameterSpecs) void
decode
(RecognizeData recognizeData, List<BitSpec> bitSpecStack, boolean isLast) endingDurationType
(DurationType last, boolean gapFlashBitSpecs) boolean
void
evaluate
(RenderData renderData, List<BitSpec> bitSpecStack) extractPass
(IrSignal.Pass pass, IrStream.PassExtractorState state) long
getWidth
(NameEngine nameEngine) getWidth
(RecognizeData recognizeData) guessParameterLength
(String name) Tries to infer the bit-length of the parameter with name as the argument.int
hashCode()
boolean
interleavingOk
(DurationType last, boolean gapFlashBitSpecs) boolean
interleavingOk
(DurationType toCheck, DurationType last, boolean gapFlashBitSpecs) invert
(BitwiseParameter rhs, RecognizeData recognizeData) static FiniteBitField
boolean
Computes the number of encoded bits, which may differ from the number of payload bits, in the case of redundancy.Upper limit of the number of (interleaving) durations in the rendered signal.propertiesMap
(boolean eval, GeneralSpec generalSpec, NameEngine nameEngine) propertiesMap
(GeneralSpec generalSpec, NameEngine nameEngine) void
render
(RenderData renderData, List<BitSpec> bitSpecs) static void
setAllowLargeBitfields
(boolean aAllowLargeBitfields) startingDuratingType
(DurationType last, boolean gapFlashBitSpecs) substituteConstantVariables
(Map<String, Long> constantVariables) Returns an IrStreamItem of the same type with all occurrences of the variables in the dictionary replaced by their values in the dictionary.toBinaryString
(NameEngine nameEngine) toBinaryString
(NameEngine nameEngine, boolean reverse) toBitwiseParameter
(RecognizeData nameResolver) toIrpString
(int radix) Returns a computed IRP (-segment) string representation of current IrpObject.static long
toLong
(long data, long width, long chop, boolean complement, boolean reverse) long
toLong
(NameEngine nameResolver) Produces a numerical result.toString
(NameEngine nameEngine) int
weight()
Returns a (somewhat arbitrary) measure of the complexity of the object.Methods inherited from class org.harctoolbox.irp.BitField
getChop, getChop, getData, hasChop, hasExtent, isComplement, isEmpty, leftHandSide, microSeconds, newBitField, newBitField, newBitField, numberOfBareDurations, parse, toLong
Methods inherited from class org.harctoolbox.irp.IrpObject
getParseTree, numberOfBitSpecs, numberOfInfiniteRepeats, prerender, propertiesMap, toDocument, toIrpString, toString, toString, toStringTree, toStringTree, toTreeViewer, toTreeViewer, toTreeViewer, updateStateWhenEntering, updateStateWhenExiting
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.harctoolbox.irp.IrStreamItem
hasExtent, isEmpty, microSeconds, numberOfBareDurations, numberOfBitSpecs, numberOfInfiniteRepeats, propertiesMap, updateStateWhenEntering, updateStateWhenExiting
Methods inherited from interface org.harctoolbox.xml.XmlExport
toDocument
-
Field Details
-
MAXWIDTH
public static final int MAXWIDTHMax length of a BitField in this implementation.- See Also:
-
-
Constructor Details
-
FiniteBitField
-
FiniteBitField
- Throws:
InvalidNameException
-
FiniteBitField
- Throws:
InvalidNameException
-
FiniteBitField
public FiniteBitField(long data, long width, long chop, boolean complement, boolean reverse) throws InvalidNameException - Throws:
InvalidNameException
-
FiniteBitField
-
-
Method Details
-
newFiniteBitField
-
setAllowLargeBitfields
public static void setAllowLargeBitfields(boolean aAllowLargeBitfields) - Parameters:
aAllowLargeBitfields
- the allowLargeBitfields to set
-
toLong
public static long toLong(long data, long width, long chop, boolean complement, boolean reverse) -
substituteConstantVariables
Description copied from interface:IrStreamItem
Returns an IrStreamItem 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 interfaceIrStreamItem
- Specified by:
substituteConstantVariables
in classBitField
- Parameters:
constantVariables
- Map<String, Long> of variables to replace.- Returns:
- IrStreamItem of the same type.
-
equals
-
hashCode
public int hashCode() -
toLong
Description copied from interface:Numerical
Produces a numerical result.- Specified by:
toLong
in interfaceNumerical
- Parameters:
nameResolver
- used to resolve names in expressions.- Returns:
- result, long.
- Throws:
NameUnassignedException
-
toBitwiseParameter
- Specified by:
toBitwiseParameter
in interfaceNumerical
-
toBinaryString
- Throws:
NameUnassignedException
-
toBinaryString
- Throws:
NameUnassignedException
-
getWidth
- Specified by:
getWidth
in classBitField
- Throws:
NameUnassignedException
-
getWidth
-
toString
-
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 interfaceIrStreamItem
- Specified by:
toIrpString
in classIrpObject
- Parameters:
radix
- Radix for parameters.- Returns:
- Formatted string.
-
render
- Specified by:
render
in interfaceIrStreamItem
- Throws:
NameUnassignedException
-
evaluate
public void evaluate(RenderData renderData, List<BitSpec> bitSpecStack) throws NameUnassignedException - Specified by:
evaluate
in interfaceIrStreamItem
- Throws:
NameUnassignedException
-
extractPass
- Specified by:
extractPass
in interfaceIrStreamItem
-
toElement
-
numberOfBits
Description copied from interface:IrStreamItem
Computes the number of encoded bits, which may differ from the number of payload bits, in the case of redundancy.- Specified by:
numberOfBits
in interfaceIrStreamItem
- Overrides:
numberOfBits
in classIrpObject
- Returns:
-
decode
public void decode(RecognizeData recognizeData, List<BitSpec> bitSpecStack, boolean isLast) throws SignalRecognitionException - Specified by:
decode
in interfaceIrStreamItem
- Throws:
SignalRecognitionException
-
invert
public BitwiseParameter invert(BitwiseParameter rhs, RecognizeData recognizeData) throws NameUnassignedException - Specified by:
invert
in interfaceEquationSolving
- Specified by:
invert
in classBitField
- Throws:
NameUnassignedException
-
interleavingOk
- Specified by:
interleavingOk
in interfaceIrStreamItem
- Returns:
-
interleavingOk
- Specified by:
interleavingOk
in interfaceIrStreamItem
-
endingDurationType
- Specified by:
endingDurationType
in interfaceIrStreamItem
-
startingDuratingType
- Specified by:
startingDuratingType
in interfaceIrStreamItem
-
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 interfaceIrStreamItem
- Overrides:
weight
in classBitField
- Returns:
- non-negative integer.
-
assignmentVariables
- Specified by:
assignmentVariables
in interfaceIrStreamItem
-
propertiesMap
- Specified by:
propertiesMap
in interfaceIrStreamItem
-
propertiesMap
public Map<String,Object> propertiesMap(boolean eval, GeneralSpec generalSpec, NameEngine nameEngine) - Overrides:
propertiesMap
in classBitField
-
numberOfDurations
Description copied from interface:IrStreamItem
Upper limit of the number of (interleaving) durations in the rendered signal. Only intended to be used on intro/repeat/ending IrStreams.- Specified by:
numberOfDurations
in interfaceIrStreamItem
- Returns:
- number of durations (not necessarily interleaving), or null if not possible to determine.
-
nonConstantBitFieldLength
public boolean nonConstantBitFieldLength()- Specified by:
nonConstantBitFieldLength
in interfaceIrStreamItem
-
guessParameterLength
Description copied from interface:IrStreamItem
Tries to infer the bit-length of the parameter with name as the argument.- Specified by:
guessParameterLength
in interfaceIrStreamItem
- Parameters:
name
- Name of parameter sought.- Returns:
- length if success, null if failure.
-
allDurationsInMicros
Description copied from interface:IrStreamItem
Delivers a set of all the contained durations in microseconds. Dumb, in that it does not consider consecutive flashes or consecutive gaps. Also, durations that cannot be statically computed may be omitted, as well as duration arising from extents.- Specified by:
allDurationsInMicros
in interfaceIrStreamItem
- Returns:
-
constant
- Specified by:
constant
in interfaceIrStreamItem
- Overrides:
constant
in classBitField
-
createParameterSpecs
- Specified by:
createParameterSpecs
in interfaceIrStreamItem
- Overrides:
createParameterSpecs
in classIrpObject
- Throws:
InvalidNameException
-