Exemplo n.º 1
0
 private static Element storePath(OPath path) {
   Element elem = new Element("path");
   elem.setAttribute("pathName", path.getName());
   elem.setAttribute("blockName", "" + path.getBlock().getSystemName());
   Portal portal = path.getFromPortal();
   if (portal != null) {
     elem.setAttribute("fromPortal", portal.getName());
   }
   portal = path.getToPortal();
   if (portal != null) {
     elem.setAttribute("toPortal", portal.getName());
   }
   List<BeanSetting> list = path.getSettings();
   for (int i = 0; i < list.size(); i++) {
     BeanSetting bs = list.get(i);
     Element e = new Element("setting");
     // Turnout to = (Turnout)bs.getBean();
     e.setAttribute("turnout", bs.getBeanName());
     e.setAttribute("set", "" + bs.getSetting());
     elem.addContent(e);
   }
   elem.setAttribute("fromDirection", "" + path.getFromBlockDirection());
   elem.setAttribute("toDirection", "" + path.getToBlockDirection());
   elem.setAttribute("length", "" + path.getLengthMm());
   return elem;
 }