/** * Allocates a new {@link FrameTransform}. * * @param transform * the {@link Transform} that transforms data in the {@code source} * frame to data in the {@code target} frame * @param source * the source frame * @param target * the target frame * @param time * the time associated with this {@link FrameTransform}, can be * {@null} */ public FrameTransform(Transform transform, GraphName source, GraphName target, Time time) { Preconditions.checkNotNull(transform); Preconditions.checkNotNull(source); Preconditions.checkNotNull(target); this.transform = transform; this.source = source.toRelative(); this.target = target.toRelative(); this.time = time; }
/** * Returns the most recent {@link FrameTransform} for target {@code source}. * * @param source * the frame to look up * @return the most recent {@link FrameTransform} for {@code source} or * {@code null} if no transform for {@code source} is available */ public FrameTransform lookUp(GraphName source) { Preconditions.checkNotNull(source); // This adds support for tf2 while maintaining backward compatibility with tf. return getLatest(source.toRelative()); }
private void add(GraphName source, LazyFrameTransform lazyFrameTransform) { // This adds support for tf2 while maintaining backward compatibility with tf. GraphName relativeSource = source.toRelative(); if (!transforms.containsKey(relativeSource)) { transforms.put(relativeSource, new CircularBlockingDeque<LazyFrameTransform>( TRANSFORM_QUEUE_CAPACITY)); } synchronized (mutex) { transforms.get(relativeSource).addFirst(lazyFrameTransform); } }
public Object search(GraphName namespace, GraphName name) { GraphName search = namespace; GraphName result = search.join(name.toRelative()); if (has(result)) { return result; } while (!search.isRoot()) { search = search.getParent(); result = search.join(name.toRelative()); if (has(result)) { return result; } } return null; }
/** * @param name * name to resolve * @return the name resolved relative to the default or private namespace */ @Override public GraphName resolve(GraphName name) { GraphName graphName = lookUpRemapping(name); if (graphName.isPrivate()) { return resolve(privateNamespace, graphName.toRelative()); } return super.resolve(name); }
Preconditions.checkNotNull(target); GraphName relativeSource = source.toRelative(); GraphName relativeTarget = target.toRelative(); if (relativeSource.equals(relativeTarget)) { return new FrameTransform(Transform.identity(), relativeSource, relativeTarget, null);