/** * Sets this YoInteger to its current value minus one. */ public void decrement() { this.set(this.getIntegerValue() - 1); }
/** * Creates a new YoInteger with the same parameters as this one, and registers it to the passed {@link YoVariableRegistry}. * * @param newRegistry YoVariableRegistry to duplicate this YoInteger to * @return the newly created and registered YoInteger */ @Override public YoInteger duplicate(YoVariableRegistry newRegistry) { YoInteger retVar = new YoInteger(getName(), getDescription(), newRegistry, getManualScalingMin(), getManualScalingMax()); retVar.set(getIntegerValue()); return retVar; }
/** * Add a value and return a handle to the object. * * @return value at the last position. This object can still hold data. */ public T add() { maxCapacityCheck(position.getIntegerValue() + 1); position.increment(); T val = values[position.getIntegerValue()]; return val; }
public GlitchFilteredYoInteger(String name, int windowSize, YoInteger position, YoVariableRegistry registry) { super(name, GlitchFilteredYoInteger.class.getSimpleName(), registry); this.position = position; previousPosition = new YoInteger(name + "PrevValue", registry); counter = new YoInteger(name + "Count", registry); YoInteger yoWindowSize = new YoInteger(name + "WindowSize", registry); yoWindowSize.set(windowSize); this.windowSize = yoWindowSize; }
public void update(int currentValue) { if (currentValue == previousPosition.getIntegerValue()) counter.increment(); else counter.set(0); if (counter.getIntegerValue() >= windowSize.getValue()) { set(currentValue); counter.set(0); } previousPosition.set(currentValue); }
/** * Clears the list. * * This function just resets the size to 0. The underlying data objects are not emptied or removed. */ public void resetQuick() { position.set(-1); }
@Override public String toString() { if (numberOfWaypoints.getIntegerValue() == 0) return namePrefix + ": Has no waypoints."; else return namePrefix + ": number of waypoints = " + numberOfWaypoints.getIntegerValue() + ", current waypoint index = " + currentWaypointIndex.getIntegerValue() + "\nFirst waypoint: " + waypoints.get(0) + ", last waypoint: " + waypoints.get(numberOfWaypoints.getIntegerValue() - 1); } }
@Override public void doControl() { if ((ticksTillNextWrite == null) || (ticksTillNextWrite.getIntegerValue() <= 0)) { write(); if (ticksTillNextWrite != null) ticksTillNextWrite.set(writeEveryNTicks-1); } else { ticksTillNextWrite.decrement(); } }
public void set(Point3DReadOnly[] points) { if (points.length > this.ccwOrderedYoFramePoints.length) throw new RuntimeException("Cannot plot more vertices than the maximum number"); numberOfPoints.set(points.length); for (int i = 0; i < numberOfPoints.getValue(); i++) ccwOrderedYoFramePoints[i].set(points[i]); for (int i = numberOfPoints.getValue(); i < ccwOrderedYoFramePoints.length; i++) ccwOrderedYoFramePoints[i].setToNaN(); }
@Override public void doAction() { ticksInState.increment(); }
public boolean isDone() { if (isEmpty()) return true; boolean isLastWaypoint = currentWaypointIndex.getIntegerValue() >= numberOfWaypoints.getIntegerValue() - 2; if (!isLastWaypoint) return false; return currentTrajectoryTime.getValue() >= waypoints.get(currentWaypointIndex.getValue() + 1).getTime(); }
@Override public void doScript(double t) { if(counter.getIntegerValue() == 0) { teleopManager.update(); updateCounter(); } else { counter.decrement(); } }
/** * Returns String representation of this YoInteger. * * @return String representing this YoInteger and its current value as an integer */ @Override public String toString() { return String.format("%s: %d", getName(), getIntegerValue()); }
public void doAverage() { if (dataLength.getIntegerValue() < 1) return; set(dataCumulated.getDoubleValue() / dataLength.getValueAsDouble()); reset(); }
/** {@inheritDoc} */ @Override public void addVertex(double x, double y) { isUpToDate = false; YoFramePoint2D newVertex = vertexBuffer.get(numberOfVertices.getValue()); if (newVertex == null) throw new RuntimeException("This polygon has reached its maximum number of vertices."); newVertex.set(x, y); numberOfVertices.increment(); }
/** {@inheritDoc} */ @Override public int getNumberOfVertices() { return numberOfVertices.getValue(); }
/** * Removes the last element in the list. The underlying data object is not emptied or removed */ public void remove() { nonEmptyCheck(); position.decrement(); }
public YoPreallocatedList(Class<T> clazz, Supplier<T> allocator, String prefix, YoVariableRegistry registry, int capacity) { this.clazz = clazz; this.position = new YoInteger(prefix + "Index", registry); this.values = (T[]) Array.newInstance(clazz, capacity); for (int i = 0; i < capacity; i++) { values[i] = allocator.get(); } position.set(-1); }
public RTPSDebugRegistry() { this.skippedPackets = new YoInteger("skippedPackets", loggerDebugRegistry); this.skippedIncomingPackets = new YoInteger("skippedIncomingPackets", loggerDebugRegistry); this.nonIncreasingTimestamps = new YoInteger("nonIncreasingTimestamps", loggerDebugRegistry); this.packetsOutOfOrder = new YoInteger("packetsOutOfOrder", loggerDebugRegistry); this.mergedPackets = new YoInteger("mergedPackets", loggerDebugRegistry); this.totalPackets = new YoInteger("totalPackets", loggerDebugRegistry); this.skippedPacketDueToFullBuffer = new YoInteger("skippedPacketDueToFullBuffer", loggerDebugRegistry); this.firstSegmentsMissing = new YoInteger("firstSegmentsMissing", loggerDebugRegistry); }