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 Pad clone(Pad p) { if (p == null) return null; Pad newPad = new Pad(); if (p.getCount() != null) newPad.setCount(p.getCount()); if (p.getCapacitance() != null) newPad.setCapacitance(p.getCapacitance()); if (p.getGroup() != null) newPad.setGroup(p.getGroup()); if (p.getModel() != null) newPad.setModel(p.getModel()); if (p.getInstanceName() != null) newPad.setInstanceName(p.getInstanceName()); if (p.getType() != null) newPad.setType(p.getType()); return newPad; }