public OP_BinaryFilter_SingleC(TypedCH <A> CH_in, TypedCH <B> CH_arg, TypedSingleCH <A> CH_res, Func <A, B, bool> FilterF, bool use_repeater) { this.CH_in = CH_in; this.CH_arg = CH_arg; this.CH_res = CH_res; this.FilterF = FilterF; this.use_repeater = use_repeater; }
public explicit_preCH(TTuple types_in, VBoxTU _dataSrc) { _types = types_in; this._dataSrc = _dataSrc; // since this is bijective, there is no point in deferring creation _CH = Instantiate(types_in, dataSrc); }
// untyped version outside of these overloads ... to avoid mind pretzels // invariant of proper type association between CH and Column now rests within the SpawnColumn method public Column getGen(TypedCH CH) { if (!D.ContainsKey(CH)) { D[CH] = (Column)CH.GetType().GetMethod("SpawnColumn").Invoke(CH, new SObject[0]); } return(D[CH]); }
public Column <T> get <T> (TypedCH <T> CH) { if (!D.ContainsKey(CH)) { D[CH] = CH.SpawnColumn(); } return((Column <T>)D[CH]); }
public static JsonObject conv(TypedCH ch, Column col) { var J_edge = new JsonObject(); J_edge["kind"] = "ch_column_edge"; J_edge["id_from"] = ID(ch); J_edge["id_to"] = ID(col); return(J_edge); }
public static JsonObject conv(string scopename, TypedCH ch) { var J_scope_edge = new JsonObject(); J_scope_edge["name"] = scopename; J_scope_edge["kind"] = "scope_edge"; J_scope_edge["id_to"] = ID(ch); return(J_scope_edge); }
public CH_deltaScope addRef(string name, out TypedCH CH) // instead of resolve - but this one has "side effects" i.e. it returns an updated variant { try { CH = ownLL_head.findNode(name).pay; return(this); } catch (LL_Exception) { } try { CH = orig_scope.LL_head.findNode(name).pay; return(new CH_deltaScope(orig_scope, ownLL_head, externals.chain(name, CH))); } catch (LL_Exception) { } throw new ScopeException(); }
public static OPCode MK_OP_Assign_Dollar(TypedCH CH_Left, TypedCH CH_Res, TypedCH CH_aux, Action <VBox, SObject> PrimAssign) { // can one dynamically check the actual type of the backing function in a delegate ? D.Assert( (CH_Left.ttuple.PayT == CH_Res.ttuple.PayT) && (CH_Res.ttuple.PayT == CH_aux.ttuple.PayT )); // todo turn this into Exception - MakeGenericType checks this too, but the err msg is cryptic and generic var completeType = typeof(OP_Assign_Dollar <>).MakeGenericType(new [] { CH_Left.ttuple.PayT }); return((OPCode)Activator.CreateInstance(completeType, new object [] { CH_Left, CH_Res, CH_aux, PrimAssign })); }
public static JsonObject conv(TypedCH CH) { var J_CH = new JsonObject(); J_CH["kind"] = "CH"; J_CH["id"] = ID(CH); Type CHtype = CH.GetType(); string name = typeof(SingleCH).IsAssignableFrom(CHtype) ? "Single" : "Multi"; name += "[" + CHtype.GetGenericArguments()[0].Name + "]"; J_CH["name"] = name; return(J_CH); }
public static IEnumerable <string> ColumnChainPrttS(Column Col_in, Func <TypedCH, Column> CH2Col) { Column col = Col_in; while (true) { yield return(col.ToString()); TypedCH CH = col.CH; if (CH.pred_SrcVBXTU == null) { yield break; } col = CH2Col(CH.pred_SrcVBXTU.CH_in); } }
public OP_BarrierShift( TypedCH <PayOrig> origCH, TypedSingleCH <PayLHS> lhsCH, TypedSingleCH <PayOrig> CH_out) { this.origCH = origCH; this.lhsCH = lhsCH; this.CH_out = CH_out; // starting from lhs count backwards the VBox-edges backsteps = 0; TypedCH currentCH = lhsCH; // TODO , throw when not ColumnSingle while (currentCH != origCH) { currentCH = currentCH.pred_SrcVBXTU.CH_in; backsteps++; } // if dataSrc is null, that's a bug in translate }
/* * Since Frames and Fans are expected to "spread" nodes that would natrually have multi-VBoxes (ref types for example) * into VBoxSingles TypedSingleCH can be assumed for all data gathering Columns */ public OP_TupleExtract(SingleCH [] data_CHs , TypedCH lhs_CH // typing problem in case of 0 FrameElements [1] , TypedSingleCH <arg_tuple> out_CH ) { this.data_CHs = data_CHs; this.lhs_CH = lhs_CH; this.out_CH = out_CH; steps2CH = new int[data_CHs.Length]; TypedCH current_CH = lhs_CH; for (int i = data_CHs.Length - 1; i >= 0; i--) { int step_sz = 0; while (current_CH != data_CHs[i]) { current_CH = current_CH.pred_SrcVBXTU.CH_in; step_sz++; } steps2CH[i] = step_sz; } }
public OP_UnaryFilter_SingleC(TypedCH <BoxT> CH_in, TypedSingleCH <BoxT> CH_out, Func <BoxT, bool> FilterF) { this.CH_in = CH_in; this.CH_out = CH_out; this.FilterF = FilterF; }
void init() { _types = TypeCalcEdges(); _CH = Instantiate(_types, dataSrc); // <- das isses }
public adapter_preCH(TypedCH CH_in) { _CH = CH_in; }
public OP_ComponentFilterComp(TypedCH <T_comp_in> CH_in, TypedSingleCH <T_comp_out> CH_out) { this.CH_in = CH_in; this.CH_out = CH_out; }
public OP_MemA_FieldSingle(TypedCH <Tobj> CH_in, TypedSingleCH <Tfield> CH_out, FieldInfo fi) { this.CH_in = CH_in; this.CH_out = CH_out; this.fi = fi; }
public OP_Dollar_Spread(TypedCH LHS_CH, TypedCH <T_variable> referenced_CH, TypedSingleCH <T_variable> CH_out) { this.LHS_CH = LHS_CH; this.referenced_CH = referenced_CH; this.CH_out = CH_out; }
public OP_ComponentFilterGO(TypedCH <GameObject> CH_in, TypedSingleCH <T_component> CH_out) { this.CH_in = CH_in; this.CH_out = CH_out; }
public OP_MemA_RefRef(TypedCH <Tobj> CH_in, TypedCH <Tfield> CH_out, FieldInfo fi) { this.CH_in = CH_in; this.CH_out = CH_out; this.fi = fi; }
public OP_SG_all_GO(TypedCH <GameObject> CH_in, TypedMultiCH <GameObject> CH_out) { this.CH_in = CH_in; this.CH_out = CH_out; }
public OP_lift_up(TypedCH <CollectionT> CH_in, TypedSingleCH <ElementT> CH_out) { this.CH_in = CH_in; this.CH_out = CH_out; }
public OP_SG_immediate_Comp(TypedCH <in_CompType> CH_in, TypedSingleCH <GameObject> CH_out) { this.CH_in = CH_in; this.CH_out = CH_out; }
public OP_MemA_PropSingle(TypedCH <Tobj> CH_in, TypedSingleCH <Tprop> CH_out, PropertyInfo pi) { this.CH_in = CH_in; this.CH_out = CH_out; this.pi = pi; }
public OP_MemA_RefProp(TypedCH <Tobj> CH_in, TypedCH <Tprop> CH_out, PropertyInfo pi) { this.CH_in = CH_in; this.CH_out = CH_out; this.pi = pi; }
public OP_Const_Spread(TypedCH CH_in, TypedSingleCH <DeserializedPay> CH_out, DeserializedPay pay) { this.CH_in = CH_in; this.CH_out = CH_out; this.pay = pay; }
public static void Test2_basic_scoping() { var closA = new TypedSingleCH <int>(); var closB = new TypedMultiCH <string>(); // types and kinds don't matter var closedSC = new CH_closedScope() .decl("cA", closA) .decl("cB", closB); var D1 = new TypedSingleCH <int>(); var D2 = new TypedMultiCH <string>(); // types and kinds don't matter TypedCH dummy1; TypedCH dummy2; var deltaCH = new CH_deltaScope(closedSC) .decl("new name", D1) .addRef("cA", out dummy1) .addRef("new name", out dummy2); D.Assert(object.ReferenceEquals(dummy1, closA)); D.Assert(object.ReferenceEquals(dummy2, D1)); D.Assert( deltaCH.external_refs().Select(_ref => _ref.name). SequenceEqual(new [] { "cA" }) // ref for "new name" is not external ); // ---------------------------- var deltaCH2 = new CH_deltaScope(closedSC) .decl("cA", D1) .decl("cA", D1) .decl("cA", D1) .decl("cB", D1) // shadow both, multiple "cA"s are compressed to one in LIFO_shadowed .decl("cA", D2) // shadow cA again with a different target .addRef("cA", out dummy1); var expected_names = new [] { "cA", "cB" }; // in reverse of insertion order var expected_chs = new TypedCH[] { D2, D1 }; // for cA , cB resp. D.Assert(deltaCH2.refs().Select(r => r.name).SequenceEqual(expected_names)); D.Assert(deltaCH2.refs().Select(r => r.CH).SequenceEqual(expected_chs)); // ------------------------------------- var closFunky = new TypedSingleCH <object>(); var origSC = new CH_closedScope() .decl("cA", closFunky) // never see this guy .decl("cA", closA) .decl("cB", closB); var sh1 = new TypedMultiCH <float>(); TypedCH sh_dummy1 = null; TypedCH sh_dummy2 = null; var shadowDelta1 = new CH_deltaScope(origSC) .decl("sh1", sh1) .addRef("cA", out sh_dummy1) // external ref .decl("cA", sh1) .addRef("cA", out sh_dummy2) // now cA is both an external and internal ref ; // cB is not touched , thus : // refs in order : [ "cA" -> sh_dummy2 == sh1 | "sh1" -> sh1 | "cB" -> closB ] // ["cA" -> closA == sh_dummy1] is preserved in external_refs D.Assert(ReferenceEquals(sh_dummy1, closA)); D.Assert(ReferenceEquals(sh_dummy2, sh1)); expected_names = new [] { "cA", "sh1", "cB" }; expected_chs = new TypedCH[] { sh1, sh1, closB }; D.Assert(shadowDelta1.refs().Select(r => r.name).SequenceEqual(expected_names)); D.Assert(shadowDelta1.refs().Select(r => r.CH).SequenceEqual(expected_chs)); D.Assert(shadowDelta1.external_refs().Select(r => r.name).SequenceEqual(new [] { "cA" })); D.Assert(shadowDelta1.external_refs().Select(r => r.CH).SequenceEqual(new TypedCH[] { closA })); // heheh :) two chaining deltaScopes need no extra testing new DeltaScope ( fromDeltaScope ) is identical to its original in all fields - there is no point to this Console.WriteLine("================= basicScoping ok ============= "); }
public OP_SG_all_Comp(TypedCH <Component> CH_in, TypedMultiCH <GameObject> CH_out) { this.CH_in = CH_in; this.CH_out = CH_out; }
public CH_deltaScope decl(string name, TypedCH CH) { return(new CH_deltaScope(orig_scope, ownLL_head.chain(name, CH), externals)); }
Action <VBox, SObject> PrimAssign; // todo SObject -> PayT public OP_Assign_Dollar(TypedCH <PayT> LHS, TypedCH <PayT> RHS, TypedCH <PayT> Data, Action <VBox, SObject> PrimAssign) { CH_in = LHS; CH_out = RHS; CH_aux = Data; this.PrimAssign = PrimAssign; }