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; }
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 boolean existGroup(Pads cfg, String groupName) { for (PadGroup g : cfg.getPadGroup()) { if (groupName.equals(g.getName())) return true; } return false; }
/** * 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; }
public static PadGroup getPadGroup(Pads cfg, String groupName) { for (PadGroup g : cfg.getPadGroup()) if (groupName.equals(g.getName())) return g; return null; }