Example #1
0
 private void setSlowCase(DynamicObject store, Object value) {
   Shape oldShape = store.getShape();
   Shape newShape = oldShape.defineProperty(getKey(), value, getFlags());
   if (store.updateShape()) {
     oldShape = store.getShape();
   }
   assert newShape.isValid() && oldShape.isValid();
   Property newProperty = newShape.getProperty(getKey());
   newProperty.setSafe(store, value, oldShape, newShape);
 }
Example #2
0
  private void setWithShapeSlowCase(
      DynamicObject store, Object value, Shape currentShape, Shape nextShape) {
    Shape oldShape = currentShape;
    if (store.updateShape()) {
      oldShape = store.getShape();
    }
    LayoutStrategy strategy = ((LayoutImpl) currentShape.getLayout()).getStrategy();
    LayoutStrategy.ShapeAndProperty newShapeAndProperty =
        strategy.generalizeProperty(this, value, (ShapeImpl) oldShape, (ShapeImpl) nextShape);
    if (store.updateShape()) {
      oldShape = store.getShape();
    }

    Shape newNextShape = newShapeAndProperty.getShape();
    Property newProperty = newShapeAndProperty.getProperty();

    assert newNextShape.isValid() && oldShape.isValid();
    newProperty.setSafe(store, value, oldShape, newNextShape);
  }