equalContent method

bool equalContent(
  1. E entity
)

Checks if the entity is equal in content to the given entity. Two entities are equal if they have the same content, ignoring oid and when.

Implementation

bool equalContent(E entity) {
  if (_concept == null) {
    throw new ConceptException('Entity concept is not defined.');
  }

  if (_code != entity.code!) {
    return false;
  }
  for (Attribute a in _concept!.attributes.whereType<Attribute>()) {
    if (_attributeMap[a.code!] != entity.getAttribute(a.code!)) {
      return false;
    }
  }
  for (Parent parent in _concept!.parents.whereType<Parent>()) {
    if (_parentMap[parent.code!] != entity.getParent(parent.code!)) {
      return false;
    }
  }
  for (Child child in _concept!.children.whereType<Child>()) {
    if (_childMap[child.code!] != entity.getChild(child.code!)) {
      return false;
    }
  }
  return true;
}