List<IRange1D> range1d = dimensionX.getRangesXList();
for (int i = 0; i < range1d.size(); i++) {
List<ITrajectory> listTrajectory = range1d.get(i).getTrajectoriesList();
for (int j = 0; j < listTrajectory.size(); j++) {
TrajectoryImpl trajectory = new TrajectoryImpl();
trajectory.setName(listActuator.get(j).getName());
trajectory.setBeginPosition(listTrajectory.get(j).getBeginPosition());
trajectory.setEndPosition(listTrajectory.get(j).getEndPosition());
trajectories.add(trajectory);
}
}
if (!trajectories.isEmpty()) {
for (int i = 0; i < trajectories.size(); i++) {
ITrajectory trajectory = trajectories.get(i);
String tempId = trajectory.getName();
StringTokenizer st = new StringTokenizer(tempId, "/");
String id = null;
while (st.hasMoreTokens()) {
id = st.nextToken();
}
Double from = trajectory.getBeginPosition();
Double to = trajectory.getEndPosition();
Element actuator = document.createElement("actuator");
actuator.setAttribute("id", id);
actuator.setAttribute("from", String.valueOf(from));
actuator.setAttribute("to", String.valueOf(to));
actuators.appendChild(actuator);
}
element.appendChild(actuators);
}
break;
case SCAN_2D:
IConfig2D config2d = (IConfig2D) config;
IDimension2DX dimension2DX = config2d.getDimensionX();
List<IActuator> listActuator2DX = dimension2DX.getActuatorsList();
ArrayList<ITrajectory> trajectories2DX = new ArrayList<ITrajectory>();
List<IRange2DX> range2DX = dimension2DX.getRangesList();
for (int i = 0; i < range2DX.size(); i++) {
List<ITrajectory> listTrajectory = range2DX.get(i).getTrajectoriesList();
for (int j = 0; j < listTrajectory.size(); j++) {
ITrajectory trajectory = new TrajectoryImpl();
trajectory.setName(listActuator2DX.get(j).getName());
trajectory.setBeginPosition(listTrajectory.get(j).getBeginPosition());
trajectory.setEndPosition(listTrajectory.get(j).getEndPosition());
trajectories2DX.add(trajectory);
}
}
if (!trajectories2DX.isEmpty()) {
for (int i = 0; i < trajectories2DX.size(); i++) {
ITrajectory trajectory2DX = trajectories2DX.get(i);
String tempId = trajectory2DX.getName();
StringTokenizer st = new StringTokenizer(tempId, "/");
String id = null;
while (st.hasMoreTokens()) {
id = st.nextToken();
}
Double from = trajectory2DX.getBeginPosition();
Double to = trajectory2DX.getEndPosition();
Element actuator = document.createElement("actuator");
actuator.setAttribute("id", id);
actuator.setAttribute("from", String.valueOf(from));
actuator.setAttribute("to", String.valueOf(to));
actuators.appendChild(actuator);
}
element.appendChild(actuators);
}
IDimension2DY dimension2DY = config2d.getDimensionY();
List<IActuator> listActuator2DY = dimension2DY.getActuatorsList();
ArrayList<ITrajectory> trajectories2DY = new ArrayList<ITrajectory>();
List<IRange2DY> range2DY = dimension2DY.getRangesList();
for (int i = 0; i < range2DY.size(); i++) {
List<ITrajectory> listTrajectory = range2DY.get(i).getTrajectoriesList();
for (int j = 0; j < listTrajectory.size(); j++) {
ITrajectory trajectory = new TrajectoryImpl();
trajectory.setName(listActuator2DY.get(j).getName());
trajectory.setBeginPosition(listTrajectory.get(j).getBeginPosition());
trajectory.setEndPosition(listTrajectory.get(j).getEndPosition());
trajectories2DY.add(trajectory);
}
}
if (!trajectories2DY.isEmpty()) {
for (int i = 0; i < trajectories2DY.size(); i++) {
ITrajectory trajectory2DY = trajectories2DY.get(i);
String tempId = trajectory2DY.getName();
StringTokenizer st = new StringTokenizer(tempId, "/");
String id = null;
while (st.hasMoreTokens()) {
id = st.nextToken();
}
Double from = trajectory2DY.getBeginPosition();
Double to = trajectory2DY.getEndPosition();
Element actuator = document.createElement("actuator");
actuator.setAttribute("id", id);
actuator.setAttribute("from", String.valueOf(from));
actuator.setAttribute("to", String.valueOf(to));
actuators.appendChild(actuator);
}
element.appendChild(actuators);
}
break;
case SCAN_HCS:
IConfigHCS configHCS = (IConfigHCS) config;
IDimensionHCS dimensionHCS = configHCS.getDimensionX();
List<IActuator> listActuatorHCS = dimensionHCS.getActuatorsList();
ArrayList<ITrajectory> trajectoriesHCS = new ArrayList<ITrajectory>();
List<IRangeHCS> rangeHCS = dimensionHCS.getRangesXList();
for (int i = 0; i < rangeHCS.size(); i++) {
List<ITrajectory> listTrajectory = rangeHCS.get(i).getTrajectoriesList();
for (int j = 0; j < listTrajectory.size(); j++) {
ITrajectory trajectory = new TrajectoryImpl();
trajectory.setName(listActuatorHCS.get(j).getName());
trajectory.setBeginPosition(listTrajectory.get(j).getBeginPosition());
trajectory.setEndPosition(listTrajectory.get(j).getEndPosition());
trajectoriesHCS.add(trajectory);
}
}
if (!trajectoriesHCS.isEmpty()) {
for (int i = 0; i < trajectoriesHCS.size(); i++) {
ITrajectory trajectoryHCS = trajectoriesHCS.get(i);
String tempId = trajectoryHCS.getName();
StringTokenizer st = new StringTokenizer(tempId, "/");
String id = null;
while (st.hasMoreTokens()) {
id = st.nextToken();
}
Double from = trajectoryHCS.getBeginPosition();
Double to = trajectoryHCS.getEndPosition();
Element actuator = document.createElement("actuator");
actuator.setAttribute("id", id);
actuator.setAttribute("from", String.valueOf(from));
actuator.setAttribute("to", String.valueOf(to));
actuators.appendChild(actuator);
}
element.appendChild(actuators);
}
break;
case SCAN_K:
IConfigK configK = (IConfigK) config;
IDimensionK dimensionK = configK.getDimensionX();
List<IActuator> listTrajectory = dimensionK.getActuatorsList();
for (int i = 0; i < listTrajectory.size(); i++) {
String tempId = dimensionK.getActuatorsList().get(i).getName();
StringTokenizer st = new StringTokenizer(tempId, "/");
String id = null;
while (st.hasMoreTokens()) {
id = st.nextToken();
}
Element actuator = document.createElement("actuator");
actuator.setAttribute("id", id);
actuator.setAttribute("from", "0.0");
actuator.setAttribute("to", "0.0");
actuators.appendChild(actuator);
element.appendChild(actuators);
}
break;
case SCAN_ENERGY:
IConfigEnergy configEnergy = (IConfigEnergy) config;
IDimensionEnergy dimensionEnergy = configEnergy.getDimensionEnergy();
List<IActuator> listActuatorEnergy = dimensionEnergy.getActuatorsList();
ArrayList<ITrajectory> trajectoriesEnergy = new ArrayList<ITrajectory>();
List<IRangeEnergy> rangeEnergy = dimensionEnergy.getRangesEnergyList();
for (int i = 0; i < rangeEnergy.size(); i++) {
List<ITrajectory> listTrajectories = rangeEnergy.get(i)
.getTrajectoriesList();
for (int j = 0; j < listTrajectories.size(); j++) {
ITrajectory trajectoryEnergy = new TrajectoryImpl();
trajectoryEnergy.setName(listActuatorEnergy.get(j).getName());
trajectoryEnergy.setBeginPosition(listTrajectories.get(j)
.getBeginPosition());
trajectoryEnergy.setEndPosition(listTrajectories.get(j)
.getEndPosition());
trajectoriesEnergy.add(trajectoryEnergy);
}
}
if (!trajectoriesEnergy.isEmpty()) {
for (int i = 0; i < trajectoriesEnergy.size(); i++) {
ITrajectory trajectoryEnergy = trajectoriesEnergy.get(i);
String tempId = trajectoryEnergy.getName();
StringTokenizer st = new StringTokenizer(tempId, "/");
String id = null;
while (st.hasMoreTokens()) {
id = st.nextToken();
}
Double from = trajectoryEnergy.getBeginPosition();
Double to = trajectoryEnergy.getEndPosition();
Element actuator = document.createElement("actuator");
actuator.setAttribute("id", id);
actuator.setAttribute("from", String.valueOf(from));
actuator.setAttribute("to", String.valueOf(to));
actuators.appendChild(actuator);