*
* @param nodeEventList, index, events, historicLogArray
*/
public void createHistoricLogLine(NodeList nodeEventList, int index, ArrayList<Element> events,
ArrayList<HistoricLogLine> historicLogArray) {
HistoricLogLine historicLogLine = new HistoricLogLine();
Element elementEvent = (Element) (nodeEventList).item(index);
if (elementEvent.hasAttribute("action")) {
events.add(elementEvent);
}
NodeList nodeActuatorList = elementEvent.getElementsByTagName("actuators");
int nbrNodeActuator = nodeActuatorList.getLength();
if (nbrNodeActuator != 0) {
for (int id = 0; id < nbrNodeActuator; id++) {
Element elementActuator = (Element) nodeActuatorList.item(id);
NodeList nodeActuatorElementList = elementActuator.getElementsByTagName("actuator");
int nbrnodeActuatorElement = nodeActuatorElementList.getLength();
if (nbrnodeActuatorElement != 0) {
ArrayList<Element> actuatorListElement = new ArrayList<Element>();
for (int i = 0; i < nbrnodeActuatorElement; i++) {
if (((Element) nodeActuatorElementList.item(i)).hasAttribute("from")
&& ((Element) nodeActuatorElementList.item(i)).hasAttribute("to")
&& ((Element) nodeActuatorElementList.item(i)).hasAttribute("id")) {
actuatorListElement.add((Element) nodeActuatorElementList.item(i));
}
}
ArrayList<ITrajectory> trajectoriesList = new ArrayList<ITrajectory>();
if (!actuatorListElement.isEmpty()) {
int nbrActuatorElement = actuatorListElement.size();
for (int a = 0; a < nbrActuatorElement; a++) {
TrajectoryImpl trajectory = new TrajectoryImpl();
trajectory.setName(actuatorListElement.get(a).getAttribute("id"));
trajectory.setBeginPosition(Double.parseDouble(actuatorListElement.get(
a).getAttribute("from")));
trajectory.setEndPosition(Double.parseDouble(actuatorListElement.get(a)
.getAttribute("to")));
trajectoriesList.add(trajectory);
}
}
historicLogLine.setTrajectories(trajectoriesList);
}
}
}
else {
ArrayList<ITrajectory> trajectoriesList = new ArrayList<ITrajectory>();
historicLogLine.setTrajectories(trajectoriesList);
}
String date = elementEvent.getAttribute("date");
String time = elementEvent.getAttribute("hour");
String month = date.substring(0, 2);
String day = date.substring(2, 4);
String year = "20" + date.substring(4, 6);
String hour = time.substring(0, 2);
String minute = time.substring(3, 5);
String second = time.substring(6, 8);
String stringDate = day + month + year + hour + minute + second;
Date dateEvent = null;
try {
dateEvent = stringToDate(stringDate, "ddMMyyyyHHmmss");
}
catch (Exception e) {
e.printStackTrace();
}
historicLogLine.setDate(dateEvent);
historicLogLine.setAction(elementEvent.getAttribute("action"));
historicLogLine.setNexusFile("");
historicLogLine.setScan(elementEvent.getAttribute("scan"));
historicLogArray.add(historicLogLine);
}