@Test public void testSameAs_Equal() throws Exception { ArrayList<DENOPTIMAttachmentPoint> apsA = new ArrayList<DENOPTIMAttachmentPoint>(); apsA.add(new DENOPTIMAttachmentPoint(0, 1, 1)); apsA.add(new DENOPTIMAttachmentPoint(1, 1, 1)); apsA.add(new DENOPTIMAttachmentPoint(2, 1, 1)); apsA.add(new DENOPTIMAttachmentPoint(3, 1, 1)); DENOPTIMVertex vA = new DENOPTIMVertex(0, 0, apsA, 0); ArrayList<DENOPTIMAttachmentPoint> apsB = new ArrayList<DENOPTIMAttachmentPoint>(); apsB.add(new DENOPTIMAttachmentPoint(0, 1, 1)); apsB.add(new DENOPTIMAttachmentPoint(1, 1, 1)); apsB.add(new DENOPTIMAttachmentPoint(2, 1, 1)); apsB.add(new DENOPTIMAttachmentPoint(3, 1, 1)); DENOPTIMVertex vB = new DENOPTIMVertex(90, 0, apsB, 0); assertTrue(vA.sameAs(vB, reason)); }
public boolean sameAs(DENOPTIMVertex other, StringBuilder reason) { if (this.getFragmentType() != other.getFragmentType()) { reason.append("Different fragment type ("+this.getFragmentType()+":" +other.getFragmentType()+"); "); return false; } if (this.getMolId() != other.getMolId()) { reason.append("Different molID ("+this.getMolId()+":" +other.getMolId()+"); "); return false; } if (this.getFreeAPCount() != other.getFreeAPCount()) { reason.append("Different number of free APs (" +this.getFreeAPCount()+":" +other.getFreeAPCount()+"); "); return false; } if (this.lstAP.size() != other.lstAP.size()) { reason.append("Different number of APs (" +this.lstAP.size()+":" +other.lstAP.size()+"); "); return false; } for (DENOPTIMAttachmentPoint apT : this.lstAP) { boolean found = false; for (DENOPTIMAttachmentPoint apO : other.lstAP) { if (apT.equals(apO)) { found = true; break; } } if (!found) { reason.append("No corresponding AP for "+apT); return false; } } return true; }
DENOPTIMVertex implements Cloneable, Serializable { public boolean sameAs(DENOPTIMVertex other, StringBuilder reason) { if (this.getFragmentType() != other.getFragmentType()) { reason.append("Different fragment type ("+this.getFragmentType()+":" +other.getFragmentType()+"); "); return false; } if (this.getMolId() != other.getMolId()) { reason.append("Different molID ("+this.getMolId()+":" +other.getMolId()+"); "); return false; } if (this.getFreeAPCount() != other.getFreeAPCount()) { reason.append("Different number of free APs (" +this.getFreeAPCount()+":" +other.getFreeAPCount()+"); "); return false; } if (this.lstAP.size() != other.lstAP.size()) { reason.append("Different number of APs (" +this.lstAP.size()+":" +other.lstAP.size()+"); "); return false; } for (DENOPTIMAttachmentPoint apT : this.lstAP) { boolean found = false; for (DENOPTIMAttachmentPoint apO : other.lstAP) { if (apT.equals(apO)) { found = true; break; } } if (!found) { reason.append("No corresponding AP for "+apT); return false; } } return true; } }
DENOPTIMVertex implements Cloneable, Serializable { public boolean sameAs(DENOPTIMVertex other, StringBuilder reason) { if (this.getFragmentType() != other.getFragmentType()) { reason.append("Different fragment type ("+this.getFragmentType()+":" +other.getFragmentType()+"); "); return false; } if (this.getMolId() != other.getMolId()) { reason.append("Different molID ("+this.getMolId()+":" +other.getMolId()+"); "); return false; } if (this.getFreeAPCount() != other.getFreeAPCount()) { reason.append("Different number of free APs (" +this.getFreeAPCount()+":" +other.getFreeAPCount()+"); "); return false; } if (this.lstAP.size() != other.lstAP.size()) { reason.append("Different number of APs (" +this.lstAP.size()+":" +other.lstAP.size()+"); "); return false; } for (DENOPTIMAttachmentPoint apT : this.lstAP) { boolean found = false; for (DENOPTIMAttachmentPoint apO : other.lstAP) { if (apT.equals(apO)) { found = true; break; } } if (!found) { reason.append("No corresponding AP for "+apT); return false; } } return true; } DENOPTIMVertex();  DENOPTIMVertex(int m_vid, int m_molId,
            ArrayList<DENOPTIMAttachmentPoint> m_lstAP, int m_fragmentType); }
DENOPTIMVertex implements Cloneable, Serializable { public boolean sameAs(DENOPTIMVertex other, StringBuilder reason) { if (this.getFragmentType() != other.getFragmentType()) { reason.append("Different fragment type ("+this.getFragmentType()+":" +other.getFragmentType()+"); "); return false; } if (this.getMolId() != other.getMolId()) { reason.append("Different molID ("+this.getMolId()+":" +other.getMolId()+"); "); return false; } if (this.getFreeAPCount() != other.getFreeAPCount()) { reason.append("Different number of free APs (" +this.getFreeAPCount()+":" +other.getFreeAPCount()+"); "); return false; } if (this.lstAP.size() != other.lstAP.size()) { reason.append("Different number of APs (" +this.lstAP.size()+":" +other.lstAP.size()+"); "); return false; } for (DENOPTIMAttachmentPoint apT : this.lstAP) { boolean found = false; for (DENOPTIMAttachmentPoint apO : other.lstAP) { if (apT.equals(apO)) { found = true; break; } } if (!found) { reason.append("No corresponding AP for "+apT); return false; } } return true; } DENOPTIMVertex();  DENOPTIMVertex(int m_vid, int m_molId,
            ArrayList<DENOPTIMAttachmentPoint> m_lstAP, int m_fragmentType); int getFragmentType(); int getMolId(); void setMolId(int m_molId); ArrayList<DENOPTIMAttachmentPoint> getAttachmentPoints(); void setAttachmentPoints(ArrayList<DENOPTIMAttachmentPoint> m_lstAP); void setVertexId(int m_vid); int getVertexId(); void setSymmetricAP(ArrayList<SymmetricSet> m_Sap); ArrayList<SymmetricSet> getSymmetricAP(); SymmetricSet getPartners(int m_dapidx); int getNumberOfAP(); ArrayList<Integer> getFreeAPList(); int getFreeAPCount(); boolean hasFreeAP(); void updateAttachmentPoint(int idx, int delta); void setLevel(int m_level); int getLevel(); boolean isRCV(); boolean hasSymmetricAP(); @Override String toString(); void cleanup(); boolean sameAs(DENOPTIMVertex other, StringBuilder reason); }
DENOPTIMVertex implements Cloneable, Serializable { public boolean sameAs(DENOPTIMVertex other, StringBuilder reason) { if (this.getFragmentType() != other.getFragmentType()) { reason.append("Different fragment type ("+this.getFragmentType()+":" +other.getFragmentType()+"); "); return false; } if (this.getMolId() != other.getMolId()) { reason.append("Different molID ("+this.getMolId()+":" +other.getMolId()+"); "); return false; } if (this.getFreeAPCount() != other.getFreeAPCount()) { reason.append("Different number of free APs (" +this.getFreeAPCount()+":" +other.getFreeAPCount()+"); "); return false; } if (this.lstAP.size() != other.lstAP.size()) { reason.append("Different number of APs (" +this.lstAP.size()+":" +other.lstAP.size()+"); "); return false; } for (DENOPTIMAttachmentPoint apT : this.lstAP) { boolean found = false; for (DENOPTIMAttachmentPoint apO : other.lstAP) { if (apT.equals(apO)) { found = true; break; } } if (!found) { reason.append("No corresponding AP for "+apT); return false; } } return true; } DENOPTIMVertex();  DENOPTIMVertex(int m_vid, int m_molId,
            ArrayList<DENOPTIMAttachmentPoint> m_lstAP, int m_fragmentType); int getFragmentType(); int getMolId(); void setMolId(int m_molId); ArrayList<DENOPTIMAttachmentPoint> getAttachmentPoints(); void setAttachmentPoints(ArrayList<DENOPTIMAttachmentPoint> m_lstAP); void setVertexId(int m_vid); int getVertexId(); void setSymmetricAP(ArrayList<SymmetricSet> m_Sap); ArrayList<SymmetricSet> getSymmetricAP(); SymmetricSet getPartners(int m_dapidx); int getNumberOfAP(); ArrayList<Integer> getFreeAPList(); int getFreeAPCount(); boolean hasFreeAP(); void updateAttachmentPoint(int idx, int delta); void setLevel(int m_level); int getLevel(); boolean isRCV(); boolean hasSymmetricAP(); @Override String toString(); void cleanup(); boolean sameAs(DENOPTIMVertex other, StringBuilder reason);  }