Skip to content

Commit 7729736

Browse files
committed
adding inertial tag
1 parent cf90378 commit 7729736

File tree

1 file changed

+57
-9
lines changed

1 file changed

+57
-9
lines changed

src/main/java/org/mujoco/xml/BodyarchType.java

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@
3737
import com.kscs.util.jaxb.PropertyTreeUse;
3838
import com.kscs.util.jaxb.PropertyVisitor;
3939
import org.mujoco.xml.attributetypes.CompositetypeType;
40+
import org.mujoco.xml.attributetypes.JointtypeType;
4041
import org.mujoco.xml.body.BodyType;
4142
import org.mujoco.xml.body.CameraType;
4243
import org.mujoco.xml.body.CompositeType;
4344
import org.mujoco.xml.body.CompositegeomType;
4445
import org.mujoco.xml.body.CompositejointType;
4546
import org.mujoco.xml.body.CompositesiteType;
47+
import org.mujoco.xml.body.FreejointType;
4648
import org.mujoco.xml.body.GeomType;
4749
import org.mujoco.xml.body.InertialType;
4850
import org.mujoco.xml.body.JointType;
@@ -66,7 +68,7 @@
6668
* <choice maxOccurs="unbounded" minOccurs="0">
6769
* <element name="inertial" type="{body}inertialType"/>
6870
* <element name="joint" type="{body}jointType"/>
69-
* <element name="freejoint" type="{body}jointType"/>
71+
* <element name="freejoint" type="{body}freejointType"/>
7072
* <element name="geom" type="{body}geomType"/>
7173
* <element name="site" type="{body}siteType"/>
7274
* <element name="camera" type="{body}cameraType"/>
@@ -380,7 +382,7 @@ protected<_P extends BodyarchType >_P init(final _P _product) {
380382
}
381383
private JAXBElement<?> buildRecoursive(Object o) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException{
382384
Class<? extends Object> class1 = o.getClass();
383-
System.out.println("Class "+class1);
385+
//System.out.println("Class "+class1);
384386
Method setNameMethod = class1.getMethod("build");
385387
Object product = setNameMethod.invoke(o);
386388
if(JAXBElement.class.isInstance(product))
@@ -404,15 +406,46 @@ private JAXBElement<?> buildRecoursive(Object o) throws NoSuchMethodException, S
404406
//JointType
405407
if(JointType.class.isInstance(product)) {
406408
JointType bat = (JointType)product;
407-
return new JAXBElement<JointType>(new QName("freejoint"),JointType.class,bat);
409+
if(bat.getType()==JointtypeType.FREE) {
410+
bat.setType(null);
411+
return new JAXBElement<JointType>(new QName("freejoint"),JointType.class,bat);
412+
}
413+
return new JAXBElement<JointType>(new QName("joint"),JointType.class,bat);
408414
}
415+
// //FreejointType
416+
// if(FreejointType.class.isInstance(product)) {
417+
// FreejointType bat = (FreejointType)product;
418+
// return new JAXBElement<FreejointType>(new QName("freejoint"),FreejointType.class,bat);
419+
// }
420+
409421
//CameraType
410422
if(CameraType.class.isInstance(product)) {
411423
CameraType bat = (CameraType)product;
412424
return new JAXBElement<CameraType>(new QName("camera"),CameraType.class,bat);
413425
}
426+
//InertialType
427+
if(InertialType.class.isInstance(product)) {
428+
InertialType bat = (InertialType)product;
429+
return new JAXBElement<InertialType>(new QName("inertial"),InertialType.class,bat);
430+
}
414431
return buildRecoursive(product);
415432
}
433+
/**
434+
* Returns a new builder to build an additional value of the "camera" property.
435+
* Use {@link org.mujoco.xml.body.CameraType.Builder#end()} to return to the current builder.
436+
*
437+
* @return
438+
* a new builder to build an additional value of the "camera" property.
439+
* Use {@link org.mujoco.xml.body.CameraType.Builder#end()} to return to the current builder.
440+
*/
441+
public org.mujoco.xml.body.InertialType.Builder<? extends BodyType.Builder<_B>> addInertial() {
442+
if (this.inertialOrJointOrFreejoint == null) {
443+
this.inertialOrJointOrFreejoint = new ArrayList<Buildable>();
444+
}
445+
final org.mujoco.xml.body.InertialType.Builder<BodyType.Builder<_B>> camera_Builder = new org.mujoco.xml.body.InertialType.Builder<BodyType.Builder<_B>>(this, null, false);
446+
this.inertialOrJointOrFreejoint.add(camera_Builder);
447+
return camera_Builder;
448+
}
416449
/**
417450
* Returns a new builder to build an additional value of the "camera" property.
418451
* Use {@link org.mujoco.xml.body.CameraType.Builder#end()} to return to the current builder.
@@ -479,6 +512,19 @@ public org.mujoco.xml.body.LightType.Builder<? extends BodyType.Builder<_B>> add
479512
this.inertialOrJointOrFreejoint.add(light_Builder);
480513
return light_Builder;
481514
}
515+
//JointType
516+
/**
517+
* Returns a new builder to build an additional value of the "joint" property.
518+
* Use {@link org.mujoco.xml.body.FreejointType.Builder#end()} to return to the current builder.
519+
*
520+
* @return
521+
* a new builder to build an additional value of the "joint" property.
522+
* Use {@link org.mujoco.xml.body.FreejointType.Builder#end()} to return to the current builder.
523+
*/
524+
public org.mujoco.xml.body.JointType.Builder<? extends BodyType.Builder<_B>> addFreejoint() {
525+
return addJoint(JointtypeType.FREE);
526+
}
527+
482528
//JointType
483529
/**
484530
* Returns a new builder to build an additional value of the "joint" property.
@@ -488,14 +534,16 @@ public org.mujoco.xml.body.LightType.Builder<? extends BodyType.Builder<_B>> add
488534
* a new builder to build an additional value of the "joint" property.
489535
* Use {@link org.mujoco.xml.body.JointType.Builder#end()} to return to the current builder.
490536
*/
491-
public org.mujoco.xml.body.JointType.Builder<? extends BodyType.Builder<_B>> addFreejoint() {
537+
public org.mujoco.xml.body.JointType.Builder<? extends BodyType.Builder<_B>> addJoint(JointtypeType type) {
492538
if (this.inertialOrJointOrFreejoint == null) {
493539
this.inertialOrJointOrFreejoint = new ArrayList<Buildable>();
494540
}
495-
final org.mujoco.xml.body.JointType.Builder<BodyType.Builder<_B>> light_Builder = new org.mujoco.xml.body.JointType.Builder<BodyType.Builder<_B>>(this, null, false);
496-
this.inertialOrJointOrFreejoint.add(light_Builder);
497-
return light_Builder;
541+
final org.mujoco.xml.body.JointType.Builder<BodyType.Builder<_B>> joint_builder = new org.mujoco.xml.body.JointType.Builder<BodyType.Builder<_B>>(this, null, false);
542+
this.inertialOrJointOrFreejoint.add(joint_builder);
543+
joint_builder.withType(type);
544+
return joint_builder;
498545
}
546+
499547
/**
500548
* Adds the given items to the value of "inertialOrJointOrFreejoint"
501549
*
@@ -595,7 +643,7 @@ public BodyarchType.Builder<_B> addJoint(JAXBElement<JointType> ... joint_) {
595643
* @param freejoint_
596644
* Items to add to the value of the "freejoint_" property
597645
*/
598-
public BodyarchType.Builder<_B> addFreejoint(final Iterable<? extends JAXBElement<JointType>> freejoint_) {
646+
public BodyarchType.Builder<_B> addFreejoint(final Iterable<? extends JAXBElement<FreejointType>> freejoint_) {
599647
return addInertialOrJointOrFreejoint(freejoint_);
600648
}
601649

@@ -605,7 +653,7 @@ public BodyarchType.Builder<_B> addFreejoint(final Iterable<? extends JAXBElemen
605653
* @param freejoint_
606654
* Items to add to the value of the "freejoint_" property
607655
*/
608-
public BodyarchType.Builder<_B> addFreejoint(JAXBElement<JointType> ... freejoint_) {
656+
public BodyarchType.Builder<_B> addFreejoint(JAXBElement<FreejointType> ... freejoint_) {
609657
return addFreejoint(Arrays.asList(freejoint_));
610658
}
611659

0 commit comments

Comments
 (0)