private static boolean isRootShape(ShapeImpl shape) { return shape.getParent() == null; }
private static boolean isRootShape(ShapeImpl shape) { return shape.getParent() == null; }
/** @since 0.17 or earlier */ public final void addDirectTransition(Transition transition, ShapeImpl next) { assert next.getParent() == this && transition.isDirect(); addTransitionInternal(transition, next); }
/** @since 0.17 or earlier */ public final void addDirectTransition(Transition transition, ShapeImpl next) { assert next.getParent() == this && transition.isDirect(); addTransitionInternal(transition, next); }
protected final void addDirectTransition(Transition transition, ShapeImpl next) { assert next.getParent() == this && transition.isDirect(); addTransitionInternal(transition, next); }
public final void addIndirectTransition(Transition transition, ShapeImpl next) { assert next.getParent() != this && !transition.isDirect(); addTransitionInternal(transition, next); }
/** @since 0.17 or earlier */ public final void addIndirectTransition(Transition transition, ShapeImpl next) { assert !isShared(); assert next.getParent() != this && !transition.isDirect(); addTransitionInternal(transition, next); }
/** @since 0.17 or earlier */ public final void addIndirectTransition(Transition transition, ShapeImpl next) { assert !isShared(); assert next.getParent() != this && !transition.isDirect(); addTransitionInternal(transition, next); }
/** * Get the (parent) shape that holds the given property. */ public final ShapeImpl getShapeFromProperty(Object propertyName) { ShapeImpl current = this; while (current != getRoot()) { if (current.getTransitionFromParent() instanceof AddPropertyTransition && ((AddPropertyTransition) current.getTransitionFromParent()).getProperty().getKey().equals(propertyName)) { return current; } current = current.getParent(); } return null; }
/** * Get the (parent) shape that holds the given property. * * @since 0.17 or earlier */ protected static ShapeImpl getShapeFromProperty(ShapeImpl shape, Object propertyName) { ShapeImpl current = shape; ShapeImpl root = shape.getRoot(); while (current != root) { if (current.getTransitionFromParent() instanceof AddPropertyTransition && ((AddPropertyTransition) current.getTransitionFromParent()).getProperty().getKey().equals(propertyName)) { return current; } current = current.getParent(); } return null; }
/** * Get the (parent) shape that holds the given property. * * @since 0.17 or earlier */ protected static ShapeImpl getShapeFromProperty(ShapeImpl shape, Object propertyName) { ShapeImpl current = shape; ShapeImpl root = shape.getRoot(); while (current != root) { if (current.getTransitionFromParent() instanceof AddPropertyTransition && ((AddPropertyTransition) current.getTransitionFromParent()).getProperty().getKey().equals(propertyName)) { return current; } current = current.getParent(); } return null; }
public final void copyProperties(DynamicObject fromObject, Shape ancestor) { ShapeImpl fromShape = (ShapeImpl) fromObject.getShape(); ShapeImpl toShape = getShape(); assert toShape.isRelated(ancestor); assert toShape.isValid(); assert ancestor.isValid(); for (; toShape != ancestor; toShape = toShape.getParent()) { Transition transitionFromParent = toShape.getTransitionFromParent(); if (transitionFromParent instanceof Transition.AddPropertyTransition) { Property toProperty = ((Transition.AddPropertyTransition) transitionFromParent).getProperty(); Property fromProperty = fromShape.getProperty(toProperty.getKey()); // copy only if property has a location and it's not the same as the source location if (toProperty.getLocation() != null && !(toProperty.getLocation() instanceof ValueLocation) && !toProperty.getLocation().equals(fromProperty.getLocation())) { toProperty.setInternal(this, fromProperty.get(fromObject, false)); assert toShape.isValid(); } if (fromShape.getTransitionFromParent() instanceof Transition.AddPropertyTransition && ((Transition.AddPropertyTransition) fromShape.getTransitionFromParent()).getProperty() == fromProperty) { // no property is looked up twice, so we can skip over to parent fromShape = fromShape.getParent(); } } } }