concept property

  1. @override
Concept concept
override

Implementation

@override
Concept get concept {
  if (_concept == null) {
    throw EDNetException("concept is not set");
  }

  return _concept!;
}
void concept=(Concept concept)

Implementation

set concept(Concept concept) {
  _concept = concept;
  _attributeMap = <String, Object?>{};
  _referenceMap = <String, Reference>{};
  _parentMap = <String, Object?>{};
  _childMap = <String, Object?>{};
  _internalChildMap = <String, Object?>{};

  pre = true;
  post = true;

  for (Attribute a in _concept!.attributes.whereType<Attribute>()) {
    if (a.init == null) {
      // _attributeMap[a.code!] = null;
    } else if (a.type?.code! == 'DateTime' && a.init == 'now') {
      _attributeMap[a.code!] = DateTime.now();
    } else if (a.type?.code! == 'bool' && a.init == 'true') {
      _attributeMap[a.code!] = true;
    } else if (a.type?.code! == 'bool' && a.init == 'false') {
      _attributeMap[a.code!] = false;
    } else if (a.type?.code! == 'int') {
      try {
        _attributeMap[a.code!] = int.parse(a.init);
      } on FormatException catch (e) {
        throw TypeException(
            '${a.code!} attribute init (default) value is not int: $e');
      }
    } else if (a.type?.code! == 'double') {
      try {
        _attributeMap[a.code!] = double.parse(a.init);
      } on FormatException catch (e) {
        throw TypeException(
            '${a.code!} attribute init (default) value is not double: $e');
      }
    } else if (a.type?.code! == 'num') {
      try {
        _attributeMap[a.code!] = int.parse(a.init);
      } on FormatException catch (e1) {
        try {
          _attributeMap[a.code!] = double.parse(a.init);
        } on FormatException catch (e2) {
          throw TypeException(
              '${a.code!} attribute init (default) value is not num: $e1; $e2');
        }
      }
    } else if (a.type?.code! == 'Uri') {
      try {
        _attributeMap[a.code!] = Uri.parse(a.init);
      } on ArgumentError catch (e) {
        throw TypeException(
            '${a.code!} attribute init (default) value is not Uri: $e');
      }
    } else {
      _attributeMap[a.code!] = a.init;
    }
  } // for

  for (Parent parent in _concept!.parents.whereType<Parent>()) {
    _referenceMap.remove(parent.code!);
    _parentMap.remove(parent.code!);
  }

  for (Child child in _concept!.children.whereType<Child>()) {
    var childEntities = Entities<E>();
    childEntities.concept = child.destinationConcept;
    _childMap[child.code!] = childEntities;
    if (child.internal) {
      _internalChildMap[child.code!] = childEntities;
    }
  }
}