synchronized public void receive(UnsignedIntegerFourBytes sequence, Collection<StateVariableValue> newValues) { if (this.currentSequence != null) { // TODO: Handle rollover to 1! if (this.currentSequence.getValue().equals(this.currentSequence.getBits().getMaxValue()) && sequence.getValue() == 1) { System.err.println("TODO: HANDLE ROLLOVER"); return; } if (this.currentSequence.getValue() >= sequence.getValue()) { return; } int difference; long expectedValue = currentSequence.getValue() + 1; if ((difference = (int) (sequence.getValue() - expectedValue)) != 0) { eventsMissed(difference); } } this.currentSequence = sequence; for (StateVariableValue newValue : newValues) { currentValues.put(newValue.getStateVariable().getName(), newValue); } eventReceived(); }
public void isInRange(long value) throws NumberFormatException { if (value < getMinValue() || value > getBits().getMaxValue()) { throw new NumberFormatException("Value must be between " + getMinValue() + " and " + getBits().getMaxValue() + ": " + value); } }
synchronized public void receive(UnsignedIntegerFourBytes sequence, Collection<StateVariableValue> newValues) { if (this.currentSequence != null) { // TODO: Handle rollover to 1! if (this.currentSequence.getValue().equals(this.currentSequence.getBits().getMaxValue()) && sequence.getValue() == 1) { System.err.println("TODO: HANDLE ROLLOVER"); return; } if (this.currentSequence.getValue() >= sequence.getValue()) { return; } int difference; long expectedValue = currentSequence.getValue() + 1; if ((difference = (int) (sequence.getValue() - expectedValue)) != 0) { eventsMissed(difference); } } this.currentSequence = sequence; for (StateVariableValue newValue : newValues) { currentValues.put(newValue.getStateVariable().getName(), newValue); } eventReceived(); }
synchronized public void receive(UnsignedIntegerFourBytes sequence, Collection<StateVariableValue> newValues) { if (this.currentSequence != null) { // TODO: Handle rollover to 1! if (this.currentSequence.getValue().equals(this.currentSequence.getBits().getMaxValue()) && sequence.getValue() == 1) { System.err.println("TODO: HANDLE ROLLOVER"); return; } if (this.currentSequence.getValue() >= sequence.getValue()) { return; } int difference; long expectedValue = currentSequence.getValue() + 1; if ((difference = (int) (sequence.getValue() - expectedValue)) != 0) { eventsMissed(difference); } } this.currentSequence = sequence; for (StateVariableValue newValue : newValues) { currentValues.put(newValue.getStateVariable().getName(), newValue); } eventReceived(); }
public void isInRange(long value) throws NumberFormatException { if (value < getMinValue() || value > getBits().getMaxValue()) { throw new NumberFormatException("Value must be between " + getMinValue() + " and " + getBits().getMaxValue() + ": " + value); } }
public UnsignedVariableInteger increment(boolean rolloverToOne) { if (value + 1 > getBits().getMaxValue()) { value = rolloverToOne ? 1 : 0; } else { value++; } return this; }
public UnsignedVariableInteger increment(boolean rolloverToOne) { if (value + 1 > getBits().getMaxValue()) { value = rolloverToOne ? 1 : 0; } else { value++; } return this; }
public void isInRange(long value) throws NumberFormatException { if (value < getMinValue() || value > getBits().getMaxValue()) { throw new NumberFormatException("Value must be between " + getMinValue() + " and " + getBits().getMaxValue() + ": " + value); } }
public UnsignedVariableInteger increment(boolean rolloverToOne) { if (value + 1 > getBits().getMaxValue()) { value = rolloverToOne ? 1 : 0; } else { value++; } return this; }