> = ARR | (ARR)[];*/\r\n\r\n\r\n\r\n@RuntimeAccessible\r\nexport class Pointers{\r\n public static cname: string = \"Pointers\";\r\n static filterValid\r\n (p: P): P | null {\r\n const pointerval: DPointerTargetable | DPointerTargetable[] = DPointerTargetable.from(p);\r\n if (Array.isArray(pointerval)) return pointerval.filter( p => !!p).map( p => p.id) as P;\r\n if (!pointerval) return null;\r\n return pointerval.id as P; }\r\n\r\n fromArr (val: (P | D | L | null | undefined)[] | (P | D | L | null | undefined)): P[] {\r\n if (!val) val = [];\r\n if (!Array.isArray(val)) { val = [val]; }\r\n if (!val.length) { return []; }\r\n if ((val[0] as any).id) { val = (val as any as (LModelElement | DModelElement)[]).filter(v => !!v).map( (v) => v.id) as any[]; }\r\n return val.filter( v => !!v) as any[]; }\r\n\r\n fromm (val: (P | D | L)): P | null { return !val ? null : (val as any).id; }\r\n\r\n from0/ LOW extends number, UPP extends number | 'N',\r\n PTR extends Pointer | Pointer[], // ,\r\n // DDD extends (PTR extends Pointer ? D : 'undefined_D'),\r\n LOW extends (PTR extends Pointer ? LO : 'undefined_upp'),\r\n UPP extends (PTR extends Pointer ? UP : 'undefined_low'),\r\n DDD extends (PTR extends Pointer ? LL : 'undefined_L'),\r\n\r\n LOWARR extends (PTR extends Pointer[] ? LO : 'undefined_uppARR'),\r\n UPPARR extends (PTR extends Pointer[] ? 'UP_is_N' : 'undefined_lowARR'),\r\n DDDARR extends (PTR extends Pointer[] ? LL : 'undefined_LARR'),\r\n\r\n DX extends DPointerTargetable,\r\n LX extends LPointerTargetable,\r\n WX extends WPointerTargetable,\r\n RETPTR = UPPARR extends 'UP_is_N' ?\r\n (DDDARR[]) : // 0...N\r\n (UPP extends 1 ? (LOW extends 0 ? DDD | null : DDD) : // 0...1 && 1...1\r\n (LOW extends 1 ? DDD : undefined) //1...1\r\n ),\r\n\r\n\r\n // DX = LX extends LEnumerator ? DEnumerator : (LX extends LAttribute ? DAttribute : (LX extends LReference ? DReference : (LX extends LDataType ? DDataType : (LX extends LClass ? DClass : (LX extends LStructuralFeature ? DStructuralFeature : (LX extends LParameter ? DParameter : (LX extends LOperation ? DOperation : (LX extends LModel ? DModel : (LX extends LValue ? DValue : (LX extends LObject ? DObject : (LX extends LEnumLiteral ? DEnumLiteral : (LX extends LPackage ? DPackage : (LX extends LClassifier ? DClassifier : (LX extends LTypedElement ? DTypedElement : (LX extends LNamedElement ? DNamedElement : (LX extends LAnnotation ? DAnnotation : ('ERROR'))))))))))))))))),\r\n LXX = DtoL,\r\n DXX = LtoD,\r\n LXFinal = LXX extends 'ERROR' ? LX : LXX,\r\n DXFinal = DXX extends 'ERROR' ? DX : DXX,\r\n RET = {d: DXFinal, l:LXFinal}, // Pointer\r\n INFERRED = {ret: RET, RETPTR: RETPTR, LXX: LXX, DXX: DXX, upp: UPP, low:LOW, ddd: DDD, dddARR: DDDARR, lowARR: LOWARR, uppARR: UPPARR, LX:LX, DX:DX}>(data: LX | DX | WX)\r\n : INFERRED {\r\n return null as any;\r\n }\r\n\r\n\r\n static from00<\r\n // LOW extends number, UPP extends number | 'N',\r\n // DDD extends (PTR extends Pointer ? D : 'undefined_D'),\r\n DWL extends {id: any},\r\n // PCK extends (T extends Pack ? PPP : never),\r\n //ISARR extends (T extends any[] ? true : false),\r\n // PCK1 extends (T extends any[] ? null : T extends Pack1 ? PPP : never), // PCK1 extends (T extends any[] ? true : false),\r\n // PCKA extends (T extends PackArr ? PPP : 'undefined_arrpack'),\r\n // PTR extends DWL[\"id\"], // ,\r\n // T extends DWL | DWL[] | null | undefined,\r\n /*DX extends (PTR extends Pointer ? D0 : 'undefined_D'),\r\n LOW extends (PTR extends Pointer ? LO : 'undefined_upp'),\r\n UPP extends (PTR extends Pointer ? UP : 'undefined_low'),\r\n LX extends (PTR extends Pointer ? LL : 'undefined_L'),\r\n\r\n LOWARR extends (PTR extends Pointer[] ? LO : 'undefined_uppARR'),\r\n UPPARR extends (PTR extends Pointer[] ? 'UP_is_N' : 'undefined_lowARR'),\r\n DDDARR extends (PTR extends Pointer[] ? LL : 'undefined_LARR'),\r\n RET = DX extends DPointerTargetable ? ( LOW extends number ? ( UPP extends number ? ( LX extends LPointerTargetable ? Pointer : '_notret_L_') : '_notret_UPP_') : '_notret_LOW_') : '_notret_D_'\r\n */\r\n PTRPARAM = Pointer | Pointer[],\r\n T = Exclude,\r\n // @ts-ignore\r\n PTR = T extends null ? null : T extends undefined ? null : (T extends PTRPARAM ? T : (T extends any[] ? T[number]['id'][] : T['id'])),\r\n // RET extends Pointer = T extends DWL ? DWL[\"id\"] : (T extends DWL[] ? DWL[\"id\"] : null),\r\n // INF = { PCK:PCK, ISARR: ISARR, PTR: PTR, DWL: DWL, RET: RET}, // {DD:DD, LL: LL}//\r\n >(data: T | T[] ): PTR { // RET | RET[] {\r\n if (Array.isArray(data)) return data.filter(d => !!d).map(d => (typeof d === \"string\" ? d : (d as any as DWL).id)) as any;\r\n else return (data ? (data as any).id : null);\r\n } // stavolta fai infer so D|l.id\r\n\r\n\r\n public static from(data:DX): DX[\"id\"]; // | {D:any};\r\n public static from(data:DX[]): DX[\"id\"][]; // | {DD:any};\r\n public static from(data:LX): LX[\"id\"]; // | {L:any};\r\n public static from(data:LX[]): LX[\"id\"][]; // | {LL:any};\r\n public static from(data:WX): WX[\"id\"]; // | {W:any};\r\n public static from(data:WX[]): WX[\"id\"][]; // | {WW:any};\r\n public static from>(data:PTR): PTR; // | {P:any};\r\n public static from>(data:PTR[]): PTR[]; // | {PP:any};\r\n public static from(data:Pack1): Pointer, 1, 1, T>; //{TEST1:any};\r\n public static from(data:Pack1[]): Pointer, 1, 1, T>[]; //{TEST111:any};\r\n public static from(data:Pack): Pointer, 1, 1, T>[]; //{TEST0:any};\r\n public static from | undefined, T extends LPointerTargetable>(data: P): Pointer, 1, 1, T>[]; //{TEST0:any};\r\n public static from(data:PackArr): Pointer, 1, 1, T>[]; //{TESTARR:any};\r\n public static from(data:Pack1): Pointer, 1, 1, T>; //{TEST1:any};\r\n public static from(data:Pack1[]): Pointer, 1, 1, T>[]; //{TEST111:any};\r\n public static from(data:Pack): Pointer, 1, 1, T>[]; //{TEST0:any};\r\n public static from(data:PackArr): Pointer, 1, 1, T>[]; //{TESTARR:any};\r\n\r\n /*\r\n public static from(data:undefined): undefined; // | {D:any};\r\n public static from(data:DX): DX extends DPointerTargetable ? DX[\"id\"] : DX; // | {D:any};\r\n public static from(data:DX[]): DX extends DPointerTargetable ? DX[\"id\"][] : DX; // | {DD:any};\r\n public static from(data:LX): LX extends LPointerTargetable ? LX[\"id\"] : LX; // | {L:any};\r\n public static from(data:LX[]): LX extends LPointerTargetable ? LX[\"id\"][] : LX; // | {LL:any};\r\n public static from(data:WX): WX extends WPointerTargetable ? WX[\"id\"] : WX; // | {W:any};\r\n public static from(data:WX[]): WX extends WPointerTargetable ? WX[\"id\"][] : WX; // | {WW:any};\r\n public static from | undefined | null>(data:PTR): PTR extends Pointer ? PTR : PTR; // | {P:any};\r\n public static from | undefined | null>(data:PTR[]): PTR extends Pointer ? PTR[] : PTR; // | {PP:any};\r\n public static from(data:Pack1): T extends LPointerTargetable ? Pointer, 1, 1, T> : T; //{TEST1:any};\r\n public static from(data:Pack1[]): T extends LPointerTargetable ? Pointer, 1, 1, T>[] : T; //{TEST111:any};\r\n public static from(data:Pack): T extends LPointerTargetable ? Pointer, 1, 1, T>[] : T; //{TEST0:any};\r\n public static from(data:PackArr): T extends LPointerTargetable ? Pointer, 1, 1, T>[] : T; //{TESTARR:any};\r\n // public static from(data:Pack1): T extends LPointerTargetable ? Pointer, 1, 1, T> : T; //{TEST1:any};\r\n // public static from(data:Pack1[]): T extends LPointerTargetable ? Pointer, 1, 1, T>[] : T; //{TEST111:any};\r\n // DDD extends (T extends Pointer ? D : 'undefined D'),*/\r\n public static from | undefined | null,\r\n // @ts-ignore\r\n T extends (TT extends Pack ? PTYPE : undefined)>(data:T): T extends null | undefined ? T : Pointer, 1, 1, T>[]; //{TEST0:any};\r\n // @ts-ignore\r\n public static from(data: PackArr): T extends null | undefined ? T : Pointer, 1, 1, T>[]; //{TESTARR:any};\r\n public static from(data:null | undefined): null; // | {Dn:any};\r\n public static from(data:(null | undefined)[]): []; // | {Dnn:any};\r\n public static from(data:(null | undefined) | (null | undefined)[]): []; // | {Dn0:any};\r\n\r\n // function from>(data:unknown | unknown[]): PTR | PTR[] | GObject {\r\n public static from>(data:unknown | unknown[]): null | PTR | PTR[]{\r\n if (!data) return null;\r\n if (Array.isArray(data)) return data.filter(d => !!d).map(d => (typeof d === \"string\" ? d : (d as any).id)) as any;\r\n return typeof data === \"string\" ? data : (data as any).id;\r\n }\r\n\r\n static isPointer(val: any): val is Pointer {\r\n // todo: must refine this in a safer way\r\n return typeof val === \"string\" ? val.includes(\"Pointer\") : false;\r\n }\r\n}\r\n/*\r\nexport type Pack1 : undefined | null) = (L extends LPointerTargetable ? LtoD : undefined | null)> =\r\n L extends LPointerTargetable ? ( D extends DPointerTargetable ? D | L /*| LtoW* / | Pointer : L) : undefined;\r\nexport type PackArr | undefined | null,\r\n L extends LPointerTargetable | undefined | null = LL extends undefined | null ? undefined : unArr> = Pack1[];\r\nexport type Pack<\r\n LL extends orArr | undefined | null,\r\n L extends unArr = unArr,\r\n // L extends (LL extends orArr ? LPointerTargetable : undefined | null) = (LL extends orArr ? unArr : undefined)\r\n >\r\n = LL extends undefined ? undefined : Pack1 | PackArr;\r\n*/\r\nexport type Pack1 | undefined, L extends LPointerTargetable | undefined = unArr,\r\n D extends (L extends LPointerTargetable ? LtoD : undefined) = (L extends LPointerTargetable ? LtoD : undefined)> =\r\n L extends LPointerTargetable ? ( D extends DPointerTargetable ? D | L | Pointer : undefined) : undefined;\r\nexport type PackArr | undefined, L extends LPointerTargetable | undefined = unArr> = Pack1[];\r\nexport type Pack | undefined, L extends LPointerTargetable | undefined = unArr> = L extends undefined ? undefined : Pack1