Package org.harctoolbox.irp
Class Duration
java.lang.Object
org.harctoolbox.irp.IrpObject
org.harctoolbox.irp.Duration
- All Implemented Interfaces:
Serializable,Floatable,IrStreamItem,XmlExport
This class implements Durations in Chapter 3 and 4.
Depends on its Protocol (GeneralSpec and NameEngine), except for this, it is immutable.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected NameOrNumberprotected Doubleprotected Doubleprotected Stringprotected Double -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDuration(double us) protectedprotectedDuration(IrpParser.Name_or_numberContext ctx, String unit) protectedDuration(NameOrNumber nameOrNumber, String unit) -
Method Summary
Modifier and TypeMethodDescriptionallDurationsInMicros(GeneralSpec generalSpec, NameEngine nameEngine) Delivers a set of all the contained durations in microseconds.booleanconstant(NameEngine nameEngine) voiddecode(RecognizeData recognizeData, List<BitSpec> bitSpecStack, boolean isLast) endingDurationType(DurationType last, boolean gapFlashBitSpecs) booleandoubleevaluate(GeneralSpec generalSpec, NameEngine nameEngine) doubleevaluate(GeneralSpec generalSpec, NameEngine nameEngine, double elapsed) voidevaluate(RenderData renderData, List<BitSpec> bitSpecStack) protected abstract DurationevaluatedDuration(GeneralSpec generalSpec, NameEngine nameEngine) Deliver an "evaluated" Duration (variables resolved) of the same subclass.abstract doubleevaluateWithSign(GeneralSpec generalSpec, NameEngine nameEngine, double elapsed) extractPass(IrSignal.Pass pass, IrStream.PassExtractorState state) doublegetUnit()guessParameterLength(String name) Tries to infer the bit-length of the parameter with name as the argument.booleaninthashCode()booleaninterleavingOk(DurationType last, boolean gapFlashBitSpecs) booleaninterleavingOk(DurationType toCheck, DurationType last, boolean gapFlashBitSpecs) final booleanisEmpty(NameEngine nameEngine) protected abstract booleanisOn()static booleanisOn(int index) microSeconds(GeneralSpec generalSpec, NameEngine nameEngine) static DurationnewDuration(String str) static Durationstatic Durationstatic DurationnewDuration(ParserDriver parserDriver) booleanComputes 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(int noProperties) propertiesMap(GeneralSpec generalSpec, NameEngine nameEngine) protected voidrecognize(RecognizeData recognizeData, double actual, double wanted, boolean isLast) voidrender(RenderData renderData, List<BitSpec> bitSpecs) startingDuratingType(DurationType last, boolean gapFlashBitSpecs) doubletoFloat(GeneralSpec generalSpec, NameEngine nameEngine) Produces a floating result.toIrpString(int radix) Returns a computed IRP (-segment) string representation of current IrpObject.intweight()Returns a (somewhat arbitrary) measure of the complexity of the object.Methods inherited from class org.harctoolbox.irp.IrpObject
createParameterSpecs, getParseTree, numberOfBitSpecs, numberOfInfiniteRepeats, prerender, propertiesMap, toDocument, toIrpString, toString, toString, toStringTree, toStringTree, toTreeViewer, toTreeViewer, toTreeViewer, updateStateWhenEntering, updateStateWhenExitingMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.harctoolbox.irp.IrStreamItem
createParameterSpecs, numberOfBitSpecs, numberOfInfiniteRepeats, propertiesMap, substituteConstantVariables, updateStateWhenEntering, updateStateWhenExitingMethods inherited from interface org.harctoolbox.xml.XmlExport
toDocument
-
Field Details
-
us
-
time_periods
-
time_units
-
nameOrNumber
-
unit
-
-
Constructor Details
-
Duration
-
Duration
protected Duration(double us) -
Duration
-
Duration
-
-
Method Details
-
newDuration
-
newDuration
-
newDuration
-
newDuration
-
isOn
public static boolean isOn(int index) -
constant
- Specified by:
constantin interfaceFloatable- Specified by:
constantin interfaceIrStreamItem
-
hashCode
public int hashCode() -
equals
-
evaluateWithSign
public abstract double evaluateWithSign(GeneralSpec generalSpec, NameEngine nameEngine, double elapsed) throws NameUnassignedException, IrpInvalidArgumentException -
evaluate
public double evaluate(GeneralSpec generalSpec, NameEngine nameEngine, double elapsed) throws NameUnassignedException, IrpInvalidArgumentException -
evaluate
public double evaluate(GeneralSpec generalSpec, NameEngine nameEngine) throws NameUnassignedException, IrpInvalidArgumentException -
evaluatedDuration
protected abstract Duration evaluatedDuration(GeneralSpec generalSpec, NameEngine nameEngine) throws NameUnassignedException, IrpInvalidArgumentException Deliver an "evaluated" Duration (variables resolved) of the same subclass.- Parameters:
generalSpec-nameEngine-- Returns:
- Throws:
NameUnassignedExceptionIrpInvalidArgumentException
-
isEmpty
public final boolean isEmpty(NameEngine nameEngine) throws NameUnassignedException, IrpInvalidArgumentException - Specified by:
isEmptyin interfaceIrStreamItem- Throws:
NameUnassignedExceptionIrpInvalidArgumentException
-
toFloat
public double toFloat(GeneralSpec generalSpec, NameEngine nameEngine) throws NameUnassignedException, IrpInvalidArgumentException Description copied from interface:FloatableProduces a floating result.- Specified by:
toFloatin interfaceFloatable- Parameters:
generalSpec-nameEngine-- Returns:
- Floating representation of class.
- Throws:
NameUnassignedExceptionIrpInvalidArgumentException
-
render
- Specified by:
renderin interfaceIrStreamItem- Throws:
NameUnassignedException
-
decode
public void decode(RecognizeData recognizeData, List<BitSpec> bitSpecStack, boolean isLast) throws SignalRecognitionException - Specified by:
decodein interfaceIrStreamItem- Throws:
SignalRecognitionException
-
evaluate
public void evaluate(RenderData renderData, List<BitSpec> bitSpecStack) throws NameUnassignedException - Specified by:
evaluatein interfaceIrStreamItem- Throws:
NameUnassignedException
-
extractPass
- Specified by:
extractPassin interfaceIrStreamItem
-
toElement
-
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 interfaceFloatable- Specified by:
toIrpStringin interfaceIrStreamItem- Specified by:
toIrpStringin classIrpObject- Parameters:
radix- Radix for parameters.- Returns:
- Formatted string.
-
numberOfBareDurations
- Specified by:
numberOfBareDurationsin interfaceIrStreamItem
-
numberOfDurations
Description copied from interface:IrStreamItemUpper limit of the number of (interleaving) durations in the rendered signal. Only intended to be used on intro/repeat/ending IrStreams.- Specified by:
numberOfDurationsin interfaceIrStreamItem- Returns:
- number of durations (not necessarily interleaving), or null if not possible to determine.
-
numberOfBits
Description copied from interface:IrStreamItemComputes the number of encoded bits, which may differ from the number of payload bits, in the case of redundancy.- Specified by:
numberOfBitsin interfaceIrStreamItem- Overrides:
numberOfBitsin classIrpObject- Returns:
-
recognize
protected void recognize(RecognizeData recognizeData, double actual, double wanted, boolean isLast) throws SignalRecognitionException - Throws:
SignalRecognitionException
-
isOn
protected abstract boolean isOn() -
interleavingOk
- Specified by:
interleavingOkin interfaceIrStreamItem- Parameters:
last-gapFlashBitSpecs-- Returns:
-
interleavingOk
- Specified by:
interleavingOkin interfaceIrStreamItem
-
endingDurationType
- Specified by:
endingDurationTypein interfaceIrStreamItem
-
startingDuratingType
- Specified by:
startingDuratingTypein interfaceIrStreamItem
-
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.- Specified by:
weightin interfaceIrStreamItem- Specified by:
weightin classIrpObject- Returns:
- non-negative integer.
-
getUnit
-
getTimeInUnits
- Throws:
InvalidArgumentException
-
hasExtent
public boolean hasExtent()- Specified by:
hasExtentin interfaceIrStreamItem
-
assignmentVariables
- Specified by:
assignmentVariablesin interfaceIrStreamItem
-
propertiesMap
- Specified by:
propertiesMapin interfaceIrStreamItem
-
microSeconds
- Specified by:
microSecondsin interfaceIrStreamItem
-
nonConstantBitFieldLength
public boolean nonConstantBitFieldLength()- Specified by:
nonConstantBitFieldLengthin interfaceIrStreamItem
-
guessParameterLength
Description copied from interface:IrStreamItemTries to infer the bit-length of the parameter with name as the argument.- Specified by:
guessParameterLengthin interfaceIrStreamItem- Parameters:
name- Name of parameter sought.- Returns:
- length if success, null if failure.
-
allDurationsInMicros
Description copied from interface:IrStreamItemDelivers 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:
allDurationsInMicrosin interfaceIrStreamItem- Parameters:
generalSpec-nameEngine-- Returns:
-
numberOfBitSpecs
Integer numberOfBitSpecs() -
propertiesMap
-