/** @since 0.17 or earlier */ protected ShapeImpl definePropertyGeneralize(ShapeImpl oldShape, Property oldProperty, Object value, LocationFactory locationFactory) { if (oldProperty.getLocation() instanceof DeclaredLocation) { Property property = oldProperty.relocate(locationFactory.createLocation(oldShape, value)); return oldShape.replaceProperty(oldProperty, property); } else { return generalizeProperty(oldProperty, value, oldShape, oldShape); } }
/** @since 0.17 or earlier */ protected ShapeImpl generalizeProperty(Property oldProperty, Object value, ShapeImpl currentShape, ShapeImpl nextShape) { Location oldLocation = oldProperty.getLocation(); Location newLocation = currentShape.allocator().locationForValueUpcast(value, oldLocation); Property newProperty = oldProperty.relocate(newLocation); ShapeImpl newShape = nextShape.replaceProperty(oldProperty, newProperty); return newShape; }
/** @since 0.17 or earlier */ protected ShapeImpl definePropertyGeneralize(ShapeImpl oldShape, Property oldProperty, Object value, LocationFactory locationFactory) { if (oldProperty.getLocation() instanceof DeclaredLocation) { Property property = oldProperty.relocate(locationFactory.createLocation(oldShape, value)); return oldShape.replaceProperty(oldProperty, property); } else { return generalizeProperty(oldProperty, value, oldShape, oldShape); } }
/** @since 0.17 or earlier */ protected ShapeImpl generalizeProperty(Property oldProperty, Object value, ShapeImpl currentShape, ShapeImpl nextShape) { Location oldLocation = oldProperty.getLocation(); Location newLocation = currentShape.allocator().locationForValueUpcast(value, oldLocation); Property newProperty = oldProperty.relocate(newLocation); ShapeImpl newShape = nextShape.replaceProperty(oldProperty, newProperty); return newShape; }
/** @since 0.17 or earlier */ protected ShapeImpl definePropertyChangeFlags(ShapeImpl oldShape, Property oldProperty, Object value, int flags) { Location oldLocation = oldProperty.getLocation(); Location newLocation; if (oldLocation.canSet(value)) { newLocation = oldLocation; } else { newLocation = oldShape.allocator().locationForValueUpcast(value, oldLocation); } Property newProperty = Property.create(oldProperty.getKey(), newLocation, flags); ShapeImpl newShape = oldShape.replaceProperty(oldProperty, newProperty); return newShape; }
/** @since 0.17 or earlier */ protected ShapeImpl definePropertyChangeFlags(ShapeImpl oldShape, Property oldProperty, Object value, int flags) { Location oldLocation = oldProperty.getLocation(); Location newLocation; if (oldLocation.canSet(value)) { newLocation = oldLocation; } else { newLocation = oldShape.allocator().locationForValueUpcast(value, oldLocation); } Property newProperty = Property.create(oldProperty.getKey(), newLocation, flags); ShapeImpl newShape = oldShape.replaceProperty(oldProperty, newProperty); return newShape; }
private void defineExisting(Object id, Object value, int flags, Property existing, ShapeImpl oldShape) { if (existing.getFlags() == flags) { existing.setGeneric(this, value, null); } else { Property newProperty = Property.create(id, oldShape.getLayout().existingLocationForValue(value, existing.getLocation(), oldShape), flags); Shape newShape = oldShape.replaceProperty(existing, newProperty); this.setShapeAndResize(newShape); newProperty.setInternal(this, value); } }