fr.cnes.sirius.patrius.assembly
Class AssemblyBuilder

java.lang.Object
  extended by fr.cnes.sirius.patrius.assembly.AssemblyBuilder

public class AssemblyBuilder
extends Object

- This class is the builder that shall be needed to create an instance of the assembly.

- Its purpose is to simplify the building process of the assembly. It provides the method that allow the user to add a part to the assembly, and then to add properties to each of the parts.

Since:
1.1
Version:
$Id: AssemblyBuilder.java 17587 2017-05-10 13:31:11Z bignon $
Author:
Thomas Trapier
See Also:
Assembly
Concurrency :
not thread-safe
Concurrency comment :
The assembly is not thread-safe itself

Constructor Summary
AssemblyBuilder()
          Simple constructor of an assembly builder.
AssemblyBuilder(Assembly inAssembly)
          Constructor with an assembly instance.
 
Method Summary
 void addMainPart(String mainBodyName)
          Adds the main part to the assembly : shall be done before adding any other part.
 void addPart(String partName, String parentPartName, Transform transform)
          This method adds a new part to the currently built assembly, defining its new frame by a Transform object.
 void addPart(String partName, String parentPartName, Vector3D translation, Rotation rotation)
          This method adds a new part to the currently built assembly.
 void addProperty(IPartProperty property, String partName)
          Adds a property of any type to a part of the assembly.
 IPart getPart(String name)
          This method returns the part whose name is given in parameter.
 void initMainPartFrame(SpacecraftState state)
          Sets up the main frame of the assembly from a "SpacecraftState" object.
 void initMainPartFrame(UpdatableFrame newFrame)
          Sets up the frame of the main part.
 void removePart(String partName)
          This method removes one part from the assembly.
 Assembly returnAssembly()
          This method returns the assembly when the user wants to get the instance of the assembly that has been built so far.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssemblyBuilder

public AssemblyBuilder()
Simple constructor of an assembly builder.


AssemblyBuilder

public AssemblyBuilder(Assembly inAssembly)
Constructor with an assembly instance. User should be aware that with this constructor, the reference to the assembly is shared with the builder. It means that any change to it might have direct effect on current computation using the assembly, until the returnAssembly() method is used to release the reference. This functionality is designed to spare the user the building of a whole new assembly between two computations, which can be a bit tedious when only small changes are needed.

Parameters:
inAssembly - the assembly instance
Method Detail

addPart

public final void addPart(String partName,
                          String parentPartName,
                          Transform transform)
This method adds a new part to the currently built assembly, defining its new frame by a Transform object.

Parameters:
partName - the name of the part
parentPartName - the name of the parent of the part
transform - the transformation law that defines the new part's frame
Throws:
IllegalArgumentException - if a part with this name already exists, if the main part has not been created yet or if the parent part does not exist (no part with this name).

addPart

public final void addPart(String partName,
                          String parentPartName,
                          Vector3D translation,
                          Rotation rotation)
This method adds a new part to the currently built assembly. Its frame is defined by a translation from its parent part's frame and then a rotation.

Parameters:
partName - the name of the part
parentPartName - the name of the parent of the part
translation - the translation
rotation - the rotation

getPart

public final IPart getPart(String name)
This method returns the part whose name is given in parameter.

Parameters:
name - the name of the part
Returns:
the part

removePart

public final void removePart(String partName)
This method removes one part from the assembly.

Parameters:
partName - the name of the part to remove.

addMainPart

public final void addMainPart(String mainBodyName)
Adds the main part to the assembly : shall be done before adding any other part.

Parameters:
mainBodyName - the name of the part

initMainPartFrame

public final void initMainPartFrame(UpdatableFrame newFrame)
Sets up the frame of the main part. Shall be used to link the assembly to the main tree of frames.

Parameters:
newFrame - the new frame of the main part

initMainPartFrame

public final void initMainPartFrame(SpacecraftState state)
                             throws OrekitException
Sets up the main frame of the assembly from a "SpacecraftState" object. Shall be used to link the assembly to the main tree of frames. The parent frame of the main part frame is the SpacecraftState's frame.

Parameters:
state - the new SpacecraftState of the assembly
Throws:
OrekitException - if a problem occurs during frames transformations

returnAssembly

public final Assembly returnAssembly()
This method returns the assembly when the user wants to get the instance of the assembly that has been built so far.

Returns:
the assembly instance

addProperty

public final void addProperty(IPartProperty property,
                              String partName)
Adds a property of any type to a part of the assembly.

Parameters:
property - the property to add
partName - the name of the part to which the property must be added
Throws:
IllegalArgumentException - if the part already contains a property of this type or if the assembly contains no part of this name.
Preconditions :
A part with this name exists and contains no property of this type.


Copyright © 2017 CNES. All Rights Reserved.