* @param entity2
* entity2
* @return <code>true</code> if two entities have equal neighbors
*/
public boolean equalNeighbors(IEntity entity1, IEntity entity2) {
Entity entityLeft = (Entity) entity1;
Entity entityRight = (Entity) entity2;
if (entityLeft == entityRight) {
return true;
} else if (entityLeft == null || entityRight == null) {
return false;
}
try {
NeighborsConfig neighborsConfig = entityLeft.getConceptConfig()
.getNeighborsConfig();
for (IEntity config : neighborsConfig) {
NeighborConfig neighborConfig = (NeighborConfig) config;
String neighborCode = neighborConfig.getCode();
Object entityLeftNeighbor = entityLeft
.getNeighbor(neighborCode);
Object entityRightNeighbor = entityRight
.getNeighbor(neighborCode);
if (entityLeftNeighbor == null) {
if (entityRightNeighbor != null) {
return false;
}