/** @since 0.17 or earlier */ @TruffleBoundary public String toStringLimit(int limit) { StringBuilder sb = new StringBuilder(); sb.append('@'); sb.append(Integer.toHexString(hashCode())); if (!isValid()) { sb.append('!'); } sb.append("{"); for (Iterator<Property> iterator = propertyMap.reverseOrderedValueIterator(); iterator.hasNext();) { Property p = iterator.next(); sb.append(p); if (iterator.hasNext()) { sb.append(","); } if (sb.length() >= limit) { sb.append("..."); break; } sb.append("\n"); } sb.append("}"); return sb.toString(); }
/** @since 0.17 or earlier */ @TruffleBoundary public String toStringLimit(int limit) { StringBuilder sb = new StringBuilder(); sb.append('@'); sb.append(Integer.toHexString(hashCode())); if (!isValid()) { sb.append('!'); } sb.append("{"); for (Iterator<Property> iterator = propertyMap.reverseOrderedValueIterator(); iterator.hasNext();) { Property p = iterator.next(); sb.append(p); if (iterator.hasNext()) { sb.append(","); } if (sb.length() >= limit) { sb.append("..."); break; } sb.append("\n"); } sb.append("}"); return sb.toString(); }
/** * Returns all (also hidden) Property objects in this shape. * * @param ascending desired order * @since 0.17 or earlier */ @TruffleBoundary @Override public final List<Property> getPropertyListInternal(boolean ascending) { Property[] props = new Property[this.propertyMap.size()]; int i = ascending ? props.length : 0; for (Iterator<Property> it = this.propertyMap.reverseOrderedValueIterator(); it.hasNext();) { Property current = it.next(); if (ascending) { props[--i] = current; } else { props[i++] = current; } } return Arrays.asList(props); }
/** @since 0.17 or earlier */ @TruffleBoundary @Override public final List<Property> getPropertyList() { Property[] props = new Property[getPropertyCount()]; int i = props.length; for (Iterator<Property> it = this.propertyMap.reverseOrderedValueIterator(); it.hasNext();) { Property currentProperty = it.next(); if (!currentProperty.isHidden()) { props[--i] = currentProperty; } } return Arrays.asList(props); }
/** @since 0.17 or earlier */ @TruffleBoundary @Override public final List<Property> getPropertyList() { Property[] props = new Property[getPropertyCount()]; int i = props.length; for (Iterator<Property> it = this.propertyMap.reverseOrderedValueIterator(); it.hasNext();) { Property currentProperty = it.next(); if (!currentProperty.isHidden()) { props[--i] = currentProperty; } } return Arrays.asList(props); }
/** * Returns all (also hidden) Property objects in this shape. * * @param ascending desired order * @since 0.17 or earlier */ @TruffleBoundary @Override public final List<Property> getPropertyListInternal(boolean ascending) { Property[] props = new Property[this.propertyMap.size()]; int i = ascending ? props.length : 0; for (Iterator<Property> it = this.propertyMap.reverseOrderedValueIterator(); it.hasNext();) { Property current = it.next(); if (ascending) { props[--i] = current; } else { props[i++] = current; } } return Arrays.asList(props); }
/** @since 0.17 or earlier */ @TruffleBoundary @Override public final List<Object> getKeyList() { Object[] props = new Object[getPropertyCount()]; int i = props.length; for (Iterator<Property> it = this.propertyMap.reverseOrderedValueIterator(); it.hasNext();) { Property currentProperty = it.next(); if (!currentProperty.isHidden()) { props[--i] = currentProperty.getKey(); } } return Arrays.asList(props); }
/** @since 0.17 or earlier */ @TruffleBoundary @Override public final List<Object> getKeyList() { Object[] props = new Object[getPropertyCount()]; int i = props.length; for (Iterator<Property> it = this.propertyMap.reverseOrderedValueIterator(); it.hasNext();) { Property currentProperty = it.next(); if (!currentProperty.isHidden()) { props[--i] = currentProperty.getKey(); } } return Arrays.asList(props); }
/** * Get a list of all (visible) property names in insertion order. * * @return list of property names * @since 0.17 or earlier */ @TruffleBoundary @Override public final List<Object> getKeyList(Pred<Property> filter) { ArrayDeque<Object> keys = new ArrayDeque<>(); for (Iterator<Property> it = this.propertyMap.reverseOrderedValueIterator(); it.hasNext();) { Property currentProperty = it.next(); if (!currentProperty.isHidden() && filter.test(currentProperty)) { keys.addFirst(currentProperty.getKey()); } } return Arrays.asList(keys.toArray(new Object[0])); }
/** * Get a list of all properties that this Shape stores. * * @return list of properties * @since 0.17 or earlier */ @TruffleBoundary @Override public final List<Property> getPropertyList(Pred<Property> filter) { ArrayDeque<Property> props = new ArrayDeque<>(); for (Iterator<Property> it = this.propertyMap.reverseOrderedValueIterator(); it.hasNext();) { Property currentProperty = it.next(); if (!currentProperty.isHidden() && filter.test(currentProperty)) { props.addFirst(currentProperty); } } return Arrays.asList(props.toArray(new Property[0])); }
/** * Get a list of all properties that this Shape stores. * * @return list of properties * @since 0.17 or earlier */ @TruffleBoundary @Override public final List<Property> getPropertyList(Pred<Property> filter) { ArrayDeque<Property> props = new ArrayDeque<>(); for (Iterator<Property> it = this.propertyMap.reverseOrderedValueIterator(); it.hasNext();) { Property currentProperty = it.next(); if (!currentProperty.isHidden() && filter.test(currentProperty)) { props.addFirst(currentProperty); } } return Arrays.asList(props.toArray(new Property[0])); }
/** * Get a list of all (visible) property names in insertion order. * * @return list of property names * @since 0.17 or earlier */ @TruffleBoundary @Override public final List<Object> getKeyList(Pred<Property> filter) { ArrayDeque<Object> keys = new ArrayDeque<>(); for (Iterator<Property> it = this.propertyMap.reverseOrderedValueIterator(); it.hasNext();) { Property currentProperty = it.next(); if (!currentProperty.isHidden() && filter.test(currentProperty)) { keys.addFirst(currentProperty.getKey()); } } return Arrays.asList(keys.toArray(new Object[0])); }
private void copyProperties(DynamicObject fromObject) { ShapeImpl fromShape = (ShapeImpl) fromObject.getShape(); ShapeImpl toShape = getShape(); assert toShape.isRelated(fromShape); assert toShape.isValid(); assert !fromShape.isShared(); PropertyMap fromMap = fromShape.getPropertyMap(); for (Iterator<Property> toMapIt = toShape.getPropertyMap().reverseOrderedValueIterator(); toMapIt.hasNext();) { Property toProperty = toMapIt.next(); Property fromProperty = fromMap.get(toProperty.getKey()); // copy only if property has a location and it's not the same as the source location if (!toProperty.getLocation().isValue() && !toProperty.getLocation().equals(fromProperty.getLocation())) { toProperty.setInternal(this, fromProperty.get(fromObject, false)); assert toShape.isValid(); } } }
private void copyProperties(DynamicObject fromObject) { ShapeImpl fromShape = (ShapeImpl) fromObject.getShape(); ShapeImpl toShape = getShapeImpl(); assert toShape.isRelated(fromShape); assert toShape.isValid(); assert !fromShape.isShared(); PropertyMap fromMap = fromShape.getPropertyMap(); for (Iterator<Property> toMapIt = toShape.getPropertyMap().reverseOrderedValueIterator(); toMapIt.hasNext();) { Property toProperty = toMapIt.next(); Property fromProperty = fromMap.get(toProperty.getKey()); // copy only if property has a location and it's not the same as the source location if (!toProperty.getLocation().isValue() && !toProperty.getLocation().equals(fromProperty.getLocation())) { toProperty.setInternal(this, fromProperty.get(fromObject, false)); assert toShape.isValid(); } } }