4 * License : The MIT License
5 * Copyright(c) 2010 MikuToga Partners
8 package jp.sourceforge.mikutoga.pmd;
10 import java.util.ArrayList;
11 import java.util.Collection;
12 import jp.sourceforge.mikutoga.corelib.I18nText;
13 import jp.sourceforge.mikutoga.corelib.SerialNumbered;
18 public class RigidInfo implements SerialNumbered {
20 private final I18nText rigidName = new I18nText();
22 private RigidBehaviorType behaviorType = RigidBehaviorType.FOLLOWBONE;
24 private final RigidShape rigidShape = new RigidShape();
25 private final Pos3d position = new Pos3d();
26 private final Rad3d rotation = new Rad3d();
28 private BoneInfo linkedBone;
30 private final DynamicsInfo dynamicsInfo = new DynamicsInfo();
32 private final Collection<RigidGroup> throughGroupColl =
33 new ArrayList<RigidGroup>();
35 private RigidGroup rigidGroup;
37 private int serialNo = -1;
51 public I18nText getRigidName(){
52 return this.rigidName;
59 public RigidBehaviorType getBehaviorType(){
60 return this.behaviorType;
65 * @param type 剛体の振る舞い種別。
66 * @throws NullPointerException 引数がnull
68 public void setBehaviorType(RigidBehaviorType type)
69 throws NullPointerException{
70 if(type == null) throw new NullPointerException();
71 this.behaviorType = type;
79 public RigidShape getRigidShape(){
80 return this.rigidShape;
87 public Pos3d getPosition(){
95 public Rad3d getRotation(){
103 public BoneInfo getLinkedBone(){
104 return this.linkedBone;
111 public void setLinkedBone(BoneInfo bone){
112 this.linkedBone = bone;
120 public DynamicsInfo getDynamicsInfo(){
121 return this.dynamicsInfo;
128 public Collection<RigidGroup> getThroughGroupColl(){
129 return this.throughGroupColl;
136 public RigidGroup getRigidGroup(){
137 return this.rigidGroup;
142 * @param group 所属する剛体グループ
144 public void setRigidGroup(RigidGroup group){
145 this.rigidGroup = group;
151 * @param num {@inheritDoc}
154 public void setSerialNumber(int num){
161 * @return {@inheritDoc}
164 public int getSerialNumber(){
165 return this.serialNo;
170 * @return {@inheritDoc}
173 public String toString(){
174 StringBuilder result = new StringBuilder();
177 if(this.linkedBone == null){
180 boneName = this.linkedBone.getBoneName().toString();
183 result.append("Rigid(").append(this.rigidName).append(") ");
187 result.append(" [").append(this.rigidShape).append("]");
188 result.append(" ").append(this.position);
189 result.append(" ").append(this.rotation);
190 result.append(" [").append(this.dynamicsInfo).append("]");
191 result.append(" [").append(this.behaviorType).append("]");
193 result.append(" through[");
194 boolean dumped = false;
195 for(RigidGroup group : this.throughGroupColl){
196 if(dumped) result.append(" ");
197 result.append(group.getGroupNumber());
202 return result.toString();