DSX<T> constructor
Creates a DSX object that makes a reference to object with parameters
.
Implementation
factory DSX(Object objSource, T obj, {List? parameters}) {
if (_isPrimitive(objSource) || _isPrimitive(obj)) {
var dsx = DSX<T>._(parameters);
_dsxToObjectSource[dsx] = objSource;
_dsxToObject[dsx] = obj;
_keyToDSK[dsx._key] ??= dsx;
print('primitive> $dsx > $objSource ; $obj');
return dsx;
}
var prevDSX = _objectsToDSX[objSource];
prevDSX ??= _objectsToDSX[obj as Object];
if (prevDSX != null) {
for (var e in prevDSX) {
if (e.equalsParameters(parameters)) {
var dsx = e as DSX<T>;
if (identical(dsx.objectSource, objSource)) {
return dsx;
}
}
}
var dsx = DSX<T>._(parameters);
prevDSX.add(dsx);
_objectsToDSX[objSource] = prevDSX;
_objectsToDSX[obj as Object] = prevDSX;
_dsxToObjectSource[dsx] = objSource;
_dsxToObject[dsx] = obj;
_keyToDSK[dsx._key] ??= dsx;
return dsx;
} else {
var dsx = DSX<T>._(parameters);
_objectsToDSX[objSource] = [dsx];
_objectsToDSX[obj as Object] = [dsx];
_dsxToObjectSource[dsx] = objSource;
_dsxToObject[dsx] = obj;
_keyToDSK[dsx._key] ??= dsx;
return dsx;
}
}