public Pads clone(Pads pads) { if (pads == null) return null; Pads newPads = new Pads(); if (pads.getInstanceName() != null) newPads.setInstanceName(pads.getInstanceName()); for (PadGroup pg : pads.getPadGroup()) newPads.getPadGroup().add(clone(pg)); for (Pad p : pads.getPad()) newPads.getPad().add(clone(p)); return newPads; }
public static Pad[] getPadsOfGroup(Pads cfg, String groupName) { ArrayList<Pad> res = new ArrayList<Pad>(); for (Pad g : cfg.getPad()) if (groupName == null && g.getGroup() == null || groupName != null && groupName.equals(g.getGroup())) res.add(g); return (Pad[]) res.toArray(new Pad[res.size()]); }
public static Pad getPad(Pads cfg, String groupName, String instName) { if (cfg == null) return null; for (Pad g : cfg.getPad()) if ((groupName == null && g.getGroup() == null || groupName != null && groupName.equals(g.getGroup())) && (instName.equals(g.getInstanceName()))) return g; return null; }
/** * checks if a padData object still exists in the memory specification * * @param cfg * @param padData * @return */ public static boolean existPadDataObject(Pads cfg, Pad padData) { for (Pad g : cfg.getPad()) { if (g == padData) return true; } return false; }