Package com.j3d.engine.scene.copy
Class CopyProperties
java.lang.Object
com.j3d.engine.scene.copy.CopyProperties
The properties used when a copy operation is applied. (When calling
GObject.copy(CopyProperties)
A callee, gets an existing list of GObject to copy, and creates the CopyOperation.
Then after the callee needs to call GObject.copy(CopyProperties) on every single object
on the list in order of points, lines and tris. (or else tis thing finna break.)
- Author:
- Lehlogonolo Poole
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new original-copy pair to the collection of managed copies.booleanChecks if soft dependency handling is currently enabled.static CopyPropertiesBuilderCreates a newCopyPropertiesBuilderinstance for constructingCopyProperties.booleanChecks if a copy for a given originalUUIDalready exists in the collection.<T extends CanCopy>
TexistsOrElse(UUID id, Supplier<T> supplier) Checks if a copy for the givenUUIDalready exists.protected voidsetSoftDependencies(boolean severeConnections) Sets the dependency handling mode for this copy operation.
-
Field Details
-
softDependencies
private boolean softDependencies -
copies
-
objects
-
-
Constructor Details
-
CopyProperties
-
-
Method Details
-
setSoftDependencies
protected void setSoftDependencies(boolean severeConnections) Sets the dependency handling mode for this copy operation. If soft dependencies are enabled, missing dependencies will be created via a supplier. If disabled, anInvalidCopyExceptionwill be thrown for missing dependencies.- Parameters:
severeConnections- Iftrue, enables soft dependency handling. Iffalse, disables it.
-
allowsSoftDependencies
public boolean allowsSoftDependencies()Checks if soft dependency handling is currently enabled.- Returns:
trueif soft dependencies are allowed,falseotherwise.
-
add
Adds a new original-copy pair to the collection of managed copies. -
get
- Parameters:
original- TheUUIDof the originalGObjectto look for.- Returns:
- The copied
GObjectif found, ornullif no copy for the given originalUUIDexists. - Throws:
InvalidCopyException
-
exists
Checks if a copy for a given originalUUIDalready exists in the collection. -
getCopies
-
getCopiesAsObjects
-
builder
Creates a newCopyPropertiesBuilderinstance for constructingCopyProperties.- Parameters:
objects- The initial list ofGObjectinstances to be managed by theCopyProperties.- Returns:
- A new
CopyPropertiesBuilderinstance.
-
existsOrElse
public <T extends CanCopy> T existsOrElse(UUID id, Supplier<T> supplier) throws InvalidCopyException Checks if a copy for the givenUUIDalready exists. If it does, returns the existing copy. If not, and soft dependencies are enabled, it creates a new object using the provided supplier, adds it as a copy, and returns it. If not, and soft dependencies are disabled, it throws anInvalidCopyException.- Type Parameters:
T- The type of the object, which must extendCanCopy.- Parameters:
id- TheUUIDof the original object to check for.supplier- ASupplierto create a new object of typeTif it doesn't exist and soft dependencies are allowed.- Returns:
- An existing copy or a newly created and added copy.
- Throws:
InvalidCopyException- If the object with the given ID is not found and soft dependencies are disabled. This exception is handled and re-thrown byStaticRefs.getErrs().- See Also:
-