/** * * {@inheritDoc} * * @return {@inheritDoc} * @throws NotAvailableException {@inheritDoc} */ @Override public synchronized List<PointingRay3DFloatDistribution> getPointingRays() throws NotAvailableException { if (lastPostures == null) { throw new NotAvailableException("Pointing Rays"); } return lastPostures.getPostureList().stream() .filter(posture -> checkPosture(posture)) .map(posture -> getRays(posture, 1, 1)) .flatMap(List::stream) .collect(Collectors.toList()); } }
/** * {@inheritDoc} * * @return {@inheritDoc} * @throws NotAvailableException {@inheritDoc} */ @Override public synchronized List<PointingRay3DFloatDistribution> getPointingRays() throws NotAvailableException { if (lastPostures == null) { throw new NotAvailableException("Pointing Rays"); } return lastPostures.getPostureList().stream() .filter(posture -> checkPosture(posture)) .map(posture -> getRays(posture, pointingProbability(posture, false), pointingProbability(posture, true))) .flatMap(List::stream) .collect(Collectors.toList()); }
/** * {@inheritDoc} * * @param postures {@inheritDoc} */ @Override public synchronized void updatePostures(final TrackedPostures3DFloat postures) { final int postureCount = postures.getPostureCount(); while (postureCount > postureHistory.size()) { postureHistory.addLast(new PostureHistory(lookback)); } while (postureHistory.size() > postureCount) { postureHistory.removeLast(); } final long timestamp = System.currentTimeMillis(); ListIterator<PostureHistory> it = postureHistory.listIterator(); while (it.hasNext()) { final TrackedPosture3DFloat posture = postures.getPosture(it.nextIndex()); if (checkPosture(posture)) { it.next().update(timestamp, posture, pointingProbability(posture, true), pointingProbability(posture, false)); } else { it.next().clear(); } } }