/** * should be used rather than accessing the shapes set directly. * This method will never return null, but rather will return an instance * of {@link ome.util.EmptyIterator}. To test for a null collection, * see of {@link #sizeOfShapes()} is less than zero. */ public java.util.Iterator<ome.model.roi.Shape> iterateShapes() { if (! _loaded ) errorIfUnloaded(); if ( getShapes() == null ) { return new ome.util.EmptyIterator<ome.model.roi.Shape>(); } return getShapes().iterator(); // TODO should this be direct access }
/** * Gets the first element of shapes which can be interpreted as the * primary or default element in some situations. If there is not first * element, an {@link IndexOutOfBoundsException} is throws. This method * will also throw an {@link ApiUsageException} if the collection is * unloaded. See {@link #sizeOfShapes()} for more information. */ @javax.persistence.Transient public ome.model.roi.Shape getPrimaryShape() throws IndexOutOfBoundsException { if (! _loaded ) errorIfUnloaded(); if (getShapes() == null) { throwNullCollectionException("Shapes"); } return getShapes().get(0); }
/** * Swaps the first element of shapes with the first instance of the * given element. If the given element is not in the list, an * {@link IndexOutOfBoundsException} will be thrown. Returns the swapped * element. This method * will also throw an {@link ApiUsageException} if the collection is * unloaded. See {@link #sizeOfShapes()} for more information. */ public ome.model.roi.Shape setPrimaryShape(ome.model.roi.Shape element) throws IndexOutOfBoundsException { if (! _loaded ) errorIfUnloaded(); if (getShapes() == null) { throwNullCollectionException("Shapes"); } java.util.List<ome.model.roi.Shape> list = getShapes(); int index = list.indexOf(element); ome.model.roi.Shape old = list.get(0); list.set(index, old); list.set(0, element); return old; }
/** * use like removeShape */ public void removeShapeSet(java.util.Collection<ome.model.roi.Shape> targets ) { if (! _loaded ) errorIfUnloaded(); if (getShapes() == null) { throwNullCollectionException("Shapes"); } getShapes().removeAll( targets ); java.util.Iterator<ome.model.roi.Shape> it = targets.iterator(); while ( it.hasNext() ) { ome.model.roi.Shape target = it.next(); if (target.isLoaded()) { target.setRoi ( null ); } } }
/** * clears the set. */ public void clearShapes() { if (! _loaded ) errorIfUnloaded(); if (getShapes() == null) { throwNullCollectionException("Shapes"); } getShapes().clear(); java.util.Iterator<ome.model.roi.Shape> it = iterateShapes(); while (it.hasNext()) { ome.model.roi.Shape target = it.next(); target.setRoi ( null ); } }
/** * removes a single element from this set and makes the inverse call on ome.model.roi.Shape */ public void removeShape(ome.model.roi.Shape target) { if (! _loaded ) errorIfUnloaded(); if (getShapes() == null) { throwNullCollectionException("Shapes"); } getShapes().remove( target ); if (target.isLoaded()) { target.setRoi ( null ); } }
/** * use like addShape. */ public void addShapeSet(java.util.Collection<ome.model.roi.Shape> targets) { if (! _loaded ) errorIfUnloaded(); if (getShapes() == null) { throwNullCollectionException("Shapes"); } getShapes().addAll( targets ); java.util.Iterator<ome.model.roi.Shape> it = targets.iterator(); while ( it.hasNext() ) { ome.model.roi.Shape target = it.next(); // If this relationship is not ordered, then we will // "attempt" the setting even if it is loaded. if (target != null) { if (target.isLoaded()) { target.setRoi ( this ); } } } }
/** * use instead of setShapes . Makes the necessary * call on ome.model.roi.Shape as well. */ public void addShape(ome.model.roi.Shape target) { if (! _loaded ) errorIfUnloaded(); if (getShapes() == null) { throwNullCollectionException("Shapes"); } getShapes().add( target ); // If this relationship is not ordered, then we will // "attempt" the setting even if it is loaded. if (target != null) { if (target.isLoaded()) { target.setRoi ( this ); } } }
/** * Sets the ome.model.roi.Shape at the given index. Adheres to the {@link java.util.List#set(int, Object)} * contract. To extend the list, use {@link #addShape(Shape)}. * @see java.util.List#set(int, Object) */ public ome.model.roi.Shape setShape(int index, ome.model.roi.Shape element) throws IndexOutOfBoundsException { if (! _loaded ) errorIfUnloaded(); if (getShapes() == null) { throwNullCollectionException("Shapes"); } ome.model.roi.Shape old = getShapes().set(index, element); // If this relationship is not ordered, then we will // "attempt" the setting even if it is loaded. if (element != null) { if (element.isLoaded()) { element.setRoi ( this ); } } return old; }
return getName(); } else if (field.equals(SHAPES)) { return getShapes(); } else if (field.equals(IMAGE)) { return getImage();