/** @since 0.17 or earlier */ @Override public String toString() { return String.format("remove(%s)", getProperty()); } }
/** @since 0.17 or earlier */ protected ShapeImpl removeProperty(ShapeImpl shape, Property property) { assert !shape.isShared(); RemovePropertyTransition transition = new RemovePropertyTransition(property); ShapeImpl cachedShape = shape.queryTransition(transition); if (cachedShape != null) { return ensureValid(cachedShape); } ShapeImpl owningShape = getShapeFromProperty(shape, property.getKey()); if (owningShape != null) { List<Transition> transitionList = new ArrayList<>(); ShapeImpl current = shape; while (current != owningShape) { if (!(current.getTransitionFromParent() instanceof Transition.DirectReplacePropertyTransition) || !((Transition.DirectReplacePropertyTransition) current.getTransitionFromParent()).getPropertyBefore().getKey().equals(property.getKey())) { transitionList.add(current.getTransitionFromParent()); } current = current.parent; } ShapeImpl newShape = owningShape.parent; for (ListIterator<Transition> iterator = transitionList.listIterator(transitionList.size()); iterator.hasPrevious();) { Transition previous = iterator.previous(); newShape = applyTransition(newShape, previous, true); } shape.addIndirectTransition(transition, newShape); return newShape; } else { return null; } }
/** @since 0.17 or earlier */ protected ShapeImpl removeProperty(ShapeImpl shape, Property property) { assert !shape.isShared(); RemovePropertyTransition transition = new RemovePropertyTransition(property); ShapeImpl cachedShape = shape.queryTransition(transition); if (cachedShape != null) { return ensureValid(cachedShape); } ShapeImpl owningShape = getShapeFromProperty(shape, property.getKey()); if (owningShape != null) { List<Transition> transitionList = new ArrayList<>(); ShapeImpl current = shape; while (current != owningShape) { if (!(current.getTransitionFromParent() instanceof Transition.DirectReplacePropertyTransition) || !((Transition.DirectReplacePropertyTransition) current.getTransitionFromParent()).getPropertyBefore().getKey().equals(property.getKey())) { transitionList.add(current.getTransitionFromParent()); } current = current.parent; } ShapeImpl newShape = owningShape.parent; for (ListIterator<Transition> iterator = transitionList.listIterator(transitionList.size()); iterator.hasPrevious();) { Transition previous = iterator.previous(); newShape = applyTransition(newShape, previous, true); } shape.addIndirectTransition(transition, newShape); return newShape; } else { return null; } }
@TruffleBoundary @Override public final ShapeImpl removeProperty(Property prop) { RemovePropertyTransition transition = new RemovePropertyTransition(prop); ShapeImpl cachedShape = queryTransition(transition); if (cachedShape != null) { return cachedShape; } ShapeImpl shape = getShapeFromProperty(prop); if (shape != null) { List<Transition> transitionList = new ArrayList<>(); ShapeImpl current = this; while (current != shape) { transitionList.add(current.getTransitionFromParent()); current = current.parent; } ShapeImpl newShape = shape.parent; for (ListIterator<Transition> iterator = transitionList.listIterator(transitionList.size()); iterator.hasPrevious();) { Transition previous = iterator.previous(); newShape = newShape.applyTransition(previous, true); } addIndirectTransition(transition, newShape); return newShape; } else { return null; } }
/** @since 0.17 or earlier */ @Override public String toString() { return String.format("remove(%s)", getProperty()); } }