diff --git a/Assets/Scripts/GenerateDemoFiles.cs b/Assets/Scripts/GenerateDemoFiles.cs index 3637e3c9d7938c5e9be7e8f9fe9114e6c5580576..b0827c9942e2ce909c010a2ace405874aab36b17 100644 --- a/Assets/Scripts/GenerateDemoFiles.cs +++ b/Assets/Scripts/GenerateDemoFiles.cs @@ -67,13 +67,13 @@ public static void GenerateTreeStage() // Populate Solution PointFact - buttom = new PointFact(Vector3.zero, Vector3.up, StageStatic.stage.solution), - top = new PointFact(Vector3.zero + Vector3.up * minimalSolutionHight, Vector3.up, StageStatic.stage.solution); + buttom = new PointFact(Vector3.zero, Vector3.up), + top = new PointFact(Vector3.zero + Vector3.up * minimalSolutionHight, Vector3.up); StageStatic.stage.solution.Add(buttom, out _, false, null, null); StageStatic.stage.solution.Add(top, out _, true, null, null); - LineFact target = new LineFact(buttom.Id, top.Id, StageStatic.stage.solution); + LineFact target = new LineFact(buttom.Id, top.Id); var target_Id = StageStatic.stage.solution.Add(target, out _, true, null, null); // Set Solution @@ -115,13 +115,13 @@ public static void GenerateRiverStage() // Populate Solution PointFact - buttom = new PointFact(Vector3.zero, Vector3.up, StageStatic.stage.solution), - top = new PointFact(Vector3.zero + Vector3.up * minimalSolutionHight, Vector3.up, StageStatic.stage.solution); + buttom = new PointFact(Vector3.zero, Vector3.up), + top = new PointFact(Vector3.zero + Vector3.up * minimalSolutionHight, Vector3.up); StageStatic.stage.solution.Add(buttom, out _, false, null, null); StageStatic.stage.solution.Add(top, out _, true, null, null); - LineFact target = new LineFact(buttom.Id, top.Id, StageStatic.stage.solution); + LineFact target = new LineFact(buttom.Id, top.Id); var target_Id = StageStatic.stage.solution.Add(target, out _, true, null, null); // Set Solution @@ -232,22 +232,22 @@ public static void GenerateCanonBallStage2D() // Populate Solution string BallURI = StageStatic.stage.solution.Add( - new PointFact(StartPos, Vector3.up, StageStatic.stage.solution), + new PointFact(StartPos, Vector3.up), out _, false, null, null); StageStatic.stage.solution.ExposedSolutionFacts.Add(BallURI); string VecURI = StageStatic.stage.solution.Add( - new PointFact(StartVec, StartVec.normalized, StageStatic.stage.solution), + new PointFact(StartVec, StartVec.normalized), out _, false, null, null); StageStatic.stage.solution.ExposedSolutionFacts.Add(VecURI); string GravURI = StageStatic.stage.solution.Add( - new PointFact(Gravity, Gravity.normalized, StageStatic.stage.solution), + new PointFact(Gravity, Gravity.normalized), out _, false, null, null); StageStatic.stage.solution.ExposedSolutionFacts.Add(GravURI); string BounceURI = StageStatic.stage.solution.Add( - new RealLitFact(Py_bounce, StageStatic.stage.solution), + new RealLitFact(Py_bounce), out _, false, null, null); StageStatic.stage.solution.ExposedSolutionFacts.Add(BounceURI); @@ -258,15 +258,15 @@ public static void GenerateCanonBallStage2D() tmpVec[dim_A] = Wall_parameter[i, 0, 1]; tmpVec[dim_B] = Wall_parameter[i, 0, 0]; - PointFact topA = new(tmpVec, Vector3.up, StageStatic.stage.solution); + PointFact topA = new(tmpVec, Vector3.up); string topAURI = StageStatic.stage.solution.Add(topA, out _, false, null, null); tmpVec[dim_A] = Wall_parameter[i, 1, 1]; tmpVec[dim_B] = Wall_parameter[i, 1, 0]; - PointFact topB = new(tmpVec, Vector3.up, StageStatic.stage.solution); + PointFact topB = new(tmpVec, Vector3.up); string topBURI = StageStatic.stage.solution.Add(topB, out _, true, null, null); - LineFact topology = new(topAURI, topBURI, StageStatic.stage.solution); + LineFact topology = new(topAURI, topBURI); string lineURI = StageStatic.stage.solution.Add(topology, out _, true, null, null); StageStatic.stage.solution.ExposedSolutionFacts.Add(lineURI); @@ -292,7 +292,7 @@ public static void GenerateCanonBallStage2D() }); } StageStatic.stage.solution.Add( - new ListFact(null, RRRRTupel, null, StageStatic.stage.solution), + new ListFact(null, RRRRTupel, null), out bool _, true, null, null ); #endregion CannonBallScroll @@ -455,22 +455,22 @@ public static void GenerateCanonBallStage3D() // Populate Solution string BallURI = StageStatic.stage.solution.Add( - new PointFact(StartPos, Vector3.up, StageStatic.stage.solution), + new PointFact(StartPos, Vector3.up), out _, false, null, null); StageStatic.stage.solution.ExposedSolutionFacts.Add(BallURI); string VecURI = StageStatic.stage.solution.Add( - new PointFact(StartVec, StartVec.normalized, StageStatic.stage.solution), + new PointFact(StartVec, StartVec.normalized), out _, false, null, null); StageStatic.stage.solution.ExposedSolutionFacts.Add(VecURI); string GravURI = StageStatic.stage.solution.Add( - new PointFact(Gravity, Gravity.normalized, StageStatic.stage.solution), + new PointFact(Gravity, Gravity.normalized), out _, false, null, null); StageStatic.stage.solution.ExposedSolutionFacts.Add(GravURI); string BounceURI = StageStatic.stage.solution.Add( - new RealLitFact(Py_bounce, StageStatic.stage.solution), + new RealLitFact(Py_bounce), out _, false, null, null); StageStatic.stage.solution.ExposedSolutionFacts.Add(BounceURI); @@ -489,19 +489,19 @@ public static void GenerateCanonBallStage3D() tmpVec[dim_G] = Wall_parameter[i, j, 2]; corners[j] = tmpVec; - PointFact edge_point = new(tmpVec, Vector3.up, StageStatic.stage.solution); + PointFact edge_point = new(tmpVec, Vector3.up); edge[j] = StageStatic.stage.solution.Add(edge_point, out _, false, null, null); } - QuadFact topology = new(edge, StageStatic.stage.solution); + QuadFact topology = new(edge); string quadURI = StageStatic.stage.solution.Add(topology, out _, true, null, null); StageStatic.stage.solution.ExposedSolutionFacts.Add(quadURI); - TriangleFact top0 = new(new[] { corners[0], corners[1], corners[2] }, StageStatic.stage.solution); + TriangleFact top0 = new(new[] { corners[0], corners[1], corners[2] }); string top0URI = StageStatic.stage.solution.Add(top0, out _, true, null, null); StageStatic.stage.solution.ExposedSolutionFacts.Add(top0URI); - TriangleFact top1 = new(new[] { corners[2], corners[3], corners[0] }, StageStatic.stage.solution); + TriangleFact top1 = new(new[] { corners[2], corners[3], corners[0] }); string top1URI = StageStatic.stage.solution.Add(top1, out _, true, null, null); StageStatic.stage.solution.ExposedSolutionFacts.Add(top1URI); @@ -513,7 +513,7 @@ public static void GenerateCanonBallStage3D() // Set Solution #region CannonBallScroll StageStatic.stage.solution.Add( // for CannonBallScroll - new ListFact(Trieangles.Select(q => q.Id).ToArray(), null, new OMS(MMTConstants.TYPE_TO_OMS[typeof(TriangleFact)]), StageStatic.stage.solution), + new ListFact(Trieangles.Select(q => q.Id).ToArray(), null, new OMS(MMTConstants.TYPE_TO_OMS[typeof(TriangleFact)])), out bool _, true, null, null ); @@ -526,7 +526,7 @@ public static void GenerateCanonBallStage3D() ); } StageStatic.stage.solution.Add( - new ListFact(null, RRRRTupel, null, StageStatic.stage.solution), + new ListFact(null, RRRRTupel, null), out bool _, true, null, null ); #endregion CannonBallScroll diff --git a/Assets/Scripts/GlobalBehaviour.cs b/Assets/Scripts/GlobalBehaviour.cs index a1bde2ead658416552c4ed09550e64a22b5025d7..33e8f2abecdb7a6b9293f30fec21130af3b7ff75 100644 --- a/Assets/Scripts/GlobalBehaviour.cs +++ b/Assets/Scripts/GlobalBehaviour.cs @@ -65,6 +65,8 @@ private void Awake() static public List<REST_JSON_API.Scroll> AvailableScrolls; public static IEnumerator InitiateScrolls = IEnumeratorExtensions.yield_break; + public static FactRecorder Context = new(); + private void PostServerConnection() { StartCoroutine(InitiateScrolls = getScrollsfromServer()); diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactAdder.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactAdder.cs index 18f2ac2e74c68f0e48e52ee6bdb8b71b6b259e2e..e8b18cea1ca08c53ca5520fe53f4326e204dd721 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactAdder.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactAdder.cs @@ -40,7 +40,7 @@ public static Fact AddFactIfNotFound(Fact fact, out bool exists, bool samestep, public static PointFact AddPointFact(RaycastHit hit, bool samestep = false, Gadget gadget = null, string scroll_label = null) { return (PointFact) AddFactIfNotFound( - new PointFact(hit.point, hit.normal, StageStatic.stage.factState) + new PointFact(hit.point, hit.normal) , out _, samestep, gadget, scroll_label); } @@ -51,7 +51,7 @@ public static PointFact AddPointFact(RaycastHit hit, bool samestep = false, Gadg public static PointFact AddPointFact(Vector3 point, Vector3 normal, bool samestep = false, Gadget gadget = null, string scroll_label = null) { return (PointFact) AddFactIfNotFound( - new PointFact(point, normal, StageStatic.stage.factState) + new PointFact(point, normal) , out _, samestep, gadget, scroll_label); } @@ -72,7 +72,7 @@ public static OnLineFact AddOnLineFact(string pid, string lid, bool samestep = f } return (OnLineFact)AddFactIfNotFound( - new OnLineFact(pid, lid, StageStatic.stage.factState) + new OnLineFact(pid, lid) , out _, samestep, gadget, scroll_label); } @@ -83,7 +83,7 @@ public static OnLineFact AddOnLineFact(string pid, string lid, bool samestep = f public static LineFact AddLineFact(string pid1, string pid2, bool samestep = false, Gadget gadget = null, string scroll_label = null) { return (LineFact)AddFactIfNotFound( - new LineFact(pid1, pid2, StageStatic.stage.factState) + new LineFact(pid1, pid2) , out _, samestep, gadget, scroll_label); } @@ -97,7 +97,7 @@ public static LineFact AddLineFact(string pid1, string pid2, bool samestep = fal public static RayFact AddRayFact(string pid1, string pid2, bool samestep = false, Gadget gadget = null, string scroll_label = null) { RayFact rayFact = (RayFact)AddFactIfNotFound( - new RayFact(pid1, pid2, StageStatic.stage.factState) + new RayFact(pid1, pid2) , out bool exists, samestep, gadget, scroll_label); if (exists) @@ -141,12 +141,12 @@ public static AngleFact AddAngleFact(string pid1, string pid2, string pid3, bool { AngleFact angle = (AngleFact)AddFactIfNotFound( - new AngleFact(pid1, pid2, pid3, StageStatic.stage.factState) + new AngleFact(pid1, pid2, pid3) , out _, samestep, gadget, scroll_label); if (angle.is_right_angle) { AddFactIfNotFound( - new RightAngleFact(pid1, pid2, pid3, StageStatic.stage.factState) + new RightAngleFact(pid1, pid2, pid3) , out _, samestep, gadget, scroll_label); } @@ -157,13 +157,13 @@ public static AngleCircleLineFact AddAngleCircleLineFact(string cid, string lid, { AngleCircleLineFact angle = (AngleCircleLineFact)AddFactIfNotFound( - new AngleCircleLineFact(cid, lid, StageStatic.stage.factState) + new AngleCircleLineFact(cid, lid) , out _, samestep, gadget, scroll_label); if (Mathf.Approximately(Mathf.Abs(angleValue), 90.0f)) { AddFactIfNotFound( - new OrthogonalCircleLineFact(cid, lid, StageStatic.stage.factState) + new OrthogonalCircleLineFact(cid, lid) , out _, samestep, gadget, scroll_label); } @@ -175,7 +175,7 @@ public static Fact AddParsedAngleCircleLineFactIfNotFound(AngleCircleLineFact fa if (Mathf.Approximately(Mathf.Abs(fact.angle), 90.0f)) { AddFactIfNotFound( - new OrthogonalCircleLineFact(fact.Cid1, fact.Rid2, StageStatic.stage.factState) + new OrthogonalCircleLineFact(fact.Cid1, fact.Rid2) , out _, samestep, gadget, scroll_label); } @@ -190,7 +190,7 @@ public static Fact AddParsedAngleFactIfNotFound(AngleFact fact, out bool exists, { if (fact.is_right_angle) AddFactIfNotFound( - new RightAngleFact(fact.Pid1, fact.Pid2, fact.Pid3, StageStatic.stage.factState) + new RightAngleFact(fact.Pid1, fact.Pid2, fact.Pid3) , out _, samestep, gadget, scroll_label); return FactRecorder.AllFacts[ @@ -203,11 +203,11 @@ public static Fact AddParsedAngleFactIfNotFound(AngleFact fact, out bool exists, public static EqualCirclesFact AddEqualCirclesFact(string cid1, string cid2, bool samestep = false, Gadget gadget = null, string scroll_label = null) { - return (EqualCirclesFact)AddFactIfNotFound(new EqualCirclesFact(cid1, cid2, StageStatic.stage.factState), out _, samestep,gadget,scroll_label); + return (EqualCirclesFact)AddFactIfNotFound(new EqualCirclesFact(cid1, cid2), out _, samestep,gadget,scroll_label); } public static UnEqualCirclesFact AddUnEqualCirclesFact(string cid1, string cid2, bool samestep = false, Gadget gadget = null, string scroll_label = null) { - return (UnEqualCirclesFact)AddFactIfNotFound(new UnEqualCirclesFact(cid1, cid2, StageStatic.stage.factState), out _, samestep,gadget,scroll_label); + return (UnEqualCirclesFact)AddFactIfNotFound(new UnEqualCirclesFact(cid1, cid2), out _, samestep,gadget,scroll_label); } } diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactRecorder.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactRecorder.cs index 16d19def832537e0b04462df05b12ac615d118ee..d57c722103a4df1d868d7b5a5e718b973d604d88 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactRecorder.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactRecorder.cs @@ -457,16 +457,16 @@ public bool TryGetFact(string URI, out Fact found) public bool ContainsKey(string id) => MyFactSpace.ContainsKey(id); /// <summary> - /// Looks up if there is a <paramref name="label"/> <see cref="Fact.Label"/> in <see cref="MyFactSpace"/>.Values + /// Looks up if there is a <paramref name="label"/> <see cref="Fact.GetLabel"/> in <see cref="MyFactSpace"/>.Values /// </summary> - /// <param name="label">supposed <see cref="Fact.Label"/> to be checked</param> - /// <returns><c>true</c> iff <see cref="MyFactSpace"/> conatains a <c>Value</c> <see cref="Fact"/>, where <see cref="Fact.Label"/> == <paramref name="label"/>.</returns> + /// <param name="label">supposed <see cref="Fact.GetLabel"/> to be checked</param> + /// <returns><c>true</c> iff <see cref="MyFactSpace"/> conatains a <c>Value</c> <see cref="Fact"/>, where <see cref="Fact.GetLabel"/> == <paramref name="label"/>.</returns> public bool ContainsLabel(string label) { if (string.IsNullOrEmpty(label)) return false; - var hit = MyFactSpace.FirstOrDefault(e => e.Value.Label == label); + var hit = MyFactSpace.FirstOrDefault(e => e.Value.GetLabel(this) == label); return !hit.Equals(default); } @@ -884,7 +884,7 @@ public void Undraw(bool force_invoke = false) } /// <summary> - /// Updates <see cref="MetaInf"/>, <see cref="Fact.Label"/> and invokes <see cref="CommunicationEvents"/> (latter iff <see cref="invoke"/> is set) + /// Updates <see cref="MetaInf"/>, <see cref="Fact.GetLabel"/> and invokes <see cref="CommunicationEvents"/> (latter iff <see cref="invoke"/> is set) /// </summary> /// <param name="creation">wether <see cref="Fact"/> is created or removed</param> /// <param name="Id"><see cref="Fact.Id"/></param> @@ -903,9 +903,9 @@ private void InvokeFactEvent(bool creation, string Id) if (creation) // undo freeLabel() - _ = MyFactSpace[Id].Label; + _ = MyFactSpace[Id].GetLabel(this); else - MyFactSpace[Id].freeAutoLabel(); + MyFactSpace[Id].freeAutoLabel(this); } /// <summary> diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs index daa326fd46bd533571ced6d8c09c315e05d82845..50feaccb6e2acc49a2bbc05df0945617939d8332 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs @@ -84,7 +84,7 @@ public void SpawnLine(LineFact fact) line.transform.GetChild(0).rotation = fact.Rotation; line.GetComponentInChildren<TextMeshPro>().text = - fact.Label + " = " + System.Math.Round(fact.Distance, 2) + " m"; + fact.GetLabel(StageStatic.stage.factState) + " = " + System.Math.Round(fact.Distance, 2) + " m"; } public void SpawnRay(RayFact fact) @@ -225,7 +225,7 @@ IEnumerator _BlossomAndDie(Fact fact) yield return new WaitForSeconds(GlobalBehaviour.HintAnimationDuration); RemoveFactEvent.Invoke(fact); - fact.freeAutoLabel(); + fact.freeAutoLabel(StageStatic.stage.factState); } } @@ -273,7 +273,7 @@ IEnumerator __BlossomAndDiePerFrame(FunctionCallFact FCF) List<Fact> factlist = new(); foreach (object i in result) - Fact.MakeFact(factlist, i, null, StageStatic.stage.factState, true); + Fact.MakeFact(factlist, i, null, true); foreach (Fact fact in factlist) SpawnFactRepresentation(fact); @@ -283,7 +283,7 @@ IEnumerator __BlossomAndDiePerFrame(FunctionCallFact FCF) foreach (Fact fact in factlist) { RemoveFactEvent.Invoke(fact); - fact.freeAutoLabel(); + fact.freeAutoLabel(StageStatic.stage.factState); } current_time = Time.time - trigger_time; @@ -297,7 +297,7 @@ IEnumerator __BlossomDragAndDie(FunctionCallFact FCF) object[] result = FCF.Call(FCF.Domain.t_0); foreach (object i in result) - Fact.MakeFact(factlist, i, null, StageStatic.stage.factState, true); + Fact.MakeFact(factlist, i, null, true); foreach (Fact fact in factlist) SpawnFactRepresentation(fact); @@ -310,7 +310,7 @@ IEnumerator __BlossomDragAndDie(FunctionCallFact FCF) object[] result_media = FCF.Call(current_time); foreach (object i in result_media) - Fact.MakeFact(factlist_media, i, null, StageStatic.stage.factState, true); + Fact.MakeFact(factlist_media, i, null, true); for (int i = 0; i < math.min(factlist.Count, factlist_media.Count); i++) { @@ -319,7 +319,7 @@ IEnumerator __BlossomDragAndDie(FunctionCallFact FCF) factlist_media[i].Position, factlist_media[i].Rotation ); - factlist_media[i].freeAutoLabel(); + factlist_media[i].freeAutoLabel(StageStatic.stage.factState); } yield return null; @@ -329,7 +329,7 @@ IEnumerator __BlossomDragAndDie(FunctionCallFact FCF) foreach (Fact fact in factlist) { RemoveFactEvent.Invoke(fact); - fact.freeAutoLabel(); + fact.freeAutoLabel(StageStatic.stage.factState); } } } diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObject.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObject.cs index b9d7331ce0f51c0fbd1427934cda4df864380706..cb844473f45dc90c015e05bdf4d7d94e8653f6df 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObject.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObject.cs @@ -128,11 +128,11 @@ protected override void FactUpdated() private void ReLabel() { - string[] mother_child_labels = new[] { Fact.Label } + string[] mother_child_labels = new[] { Fact.GetLabel(StageStatic.stage.factState) } .ShallowCloneAppend(Fact.DependentFactIds .Select(fid => FactRecorder.AllFacts.TryGetValue(fid, out Fact fact) - ? fact.Label + ? fact.GetLabel(StageStatic.stage.factState) : "N/A") .ToArray()); diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/RenderedScrollFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/RenderedScrollFact.cs index 88daa87d03ba608470ecfa8966169cba76466f39..64adcc77c9326b639127da7fe8c287dd150a49e6 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/RenderedScrollFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/RenderedScrollFact.cs @@ -108,7 +108,7 @@ public void SetByFactObject(FactObjectUI fOUI) Fact = fOUI.Fact; if (VerboseURI) - Debug.Log(Fact.Label + " was dropped on " + Debug.Log(Fact.GetLabel(StageStatic.stage.factState) + " was dropped on " + gameObject.name + " " + (ID + 1) + "/" + ScrollDetails.ParameterDisplays.Count + " label: " + ScrollFactLabel); diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractAngleFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractAngleFact.cs index dd0015098ece4c49d0f521bdf27fbcf955074bf8..41e5596ed3942393bef817f44d5649d8690c6acb 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractAngleFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractAngleFact.cs @@ -40,11 +40,11 @@ protected AbstractAngleFact() : base() } /// <summary>\copydoc AbstractAngleFact.AbstractAngleFact(AbstractAngleFact, Dictionary{string, string}, FactOrganizer)</summary> - protected AbstractAngleFact(AbstractAngleFact fact, Dictionary<string, string> old_to_new, FactRecorder organizer) - : this(old_to_new[fact.Pid1], old_to_new[fact.Pid2], old_to_new[fact.Pid3], organizer) { } + protected AbstractAngleFact(AbstractAngleFact fact, Dictionary<string, string> old_to_new) + : this(old_to_new[fact.Pid1], old_to_new[fact.Pid2], old_to_new[fact.Pid3]) { } /// <summary>\copydoc AbstractAngleFact.AbstractAngleFact(string, string, FactOrganizer)</summary> - protected AbstractAngleFact(string pid1, string pid2, string pid3, FactRecorder organizer) : base(organizer) + protected AbstractAngleFact(string pid1, string pid2, string pid3) : base() { this.Pid1 = pid1; this.Pid2 = pid2; @@ -52,8 +52,8 @@ protected AbstractAngleFact(string pid1, string pid2, string pid3, FactRecorder } /// <summary>\copydoc AbstractAngleFact.AbstractAngleFact(string, string, string, FactOrganizer)</summary> - protected AbstractAngleFact(string pid1, string pid2, string pid3, float angle, SOMDoc _ServerDefinition, FactRecorder organizer) - : this(pid1, pid2, pid3, organizer) + protected AbstractAngleFact(string pid1, string pid2, string pid3, float angle, SOMDoc _ServerDefinition) + : this(pid1, pid2, pid3) { this.angle = angle == -0f ? Vector3.Angle((Point1.Point - Point2.Point), (Point3.Point - Point2.Point)) @@ -96,13 +96,13 @@ public abstract class AbstractAngleFactWrappedCRTP<T> : AbstractAngleFact where protected AbstractAngleFactWrappedCRTP() : base() { } /// <summary>\copydoc AbstractAngleFactWrappedCRTP.AbstractAngleFactWrappedCRTP(AbstractAngleFactWrappedCRTP, Dictionary{string, string}, FactOrganizer)</summary> - protected AbstractAngleFactWrappedCRTP(AbstractAngleFactWrappedCRTP<T> fact, Dictionary<string, string> old_to_new, FactRecorder organizer) : base(fact, old_to_new, organizer) { } + protected AbstractAngleFactWrappedCRTP(AbstractAngleFactWrappedCRTP<T> fact, Dictionary<string, string> old_to_new) : base(fact, old_to_new) { } /// <summary>\copydoc AbstractAngleFactWrappedCRTP.AbstractAngleFactWrappedCRTP(string, string, FactOrganizer)</summary> - protected AbstractAngleFactWrappedCRTP(string pid1, string pid2, string pid3, FactRecorder organizer) : base(pid1, pid2, pid3, organizer) { } + protected AbstractAngleFactWrappedCRTP(string pid1, string pid2, string pid3) : base(pid1, pid2, pid3) { } /// <summary>\copydoc AbstractAngleFactWrappedCRTP.AbstractAngleFactWrappedCRTP(string, string, string, FactOrganizer)</summary> - protected AbstractAngleFactWrappedCRTP(string pid1, string pid2, string pid3, float angle, SOMDoc _ServerDefinition, FactRecorder organizer) : base(pid1, pid2, pid3, angle, _ServerDefinition, organizer) { } + protected AbstractAngleFactWrappedCRTP(string pid1, string pid2, string pid3, float angle, SOMDoc _ServerDefinition) : base(pid1, pid2, pid3, angle, _ServerDefinition) { } /// \copydoc Fact.Equivalent(Fact, Fact) protected override bool EquivalentWrapped(AbstractAngleFact f1, AbstractAngleFact f2) @@ -127,8 +127,7 @@ public AngleFact() : base() { } /// <param name="pid1">sets <see cref="Pid1"/></param> /// <param name="pid2">sets <see cref="Pid2"/></param> /// <param name="pid3">sets <see cref="Pid3"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public AngleFact(string pid1, string pid2, string pid3, FactRecorder organizer) : base(pid1, pid2, pid3, organizer) + public AngleFact(string pid1, string pid2, string pid3) : base(pid1, pid2, pid3) { angle = Vector3.Angle((Point1.Point - Point2.Point), (Point3.Point - Point2.Point)); @@ -144,16 +143,15 @@ public AngleFact(string pid1, string pid2, string pid3, FactRecorder organizer) /// <param name="Pid2">sets <see cref="Pid2"/></param> /// <param name="Pid3">sets <see cref="Pid3"/></param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public AngleFact(string Pid1, string Pid2, string Pid3, float angle, SOMDoc _ServerDefinition, FactRecorder organizer) - : base(Pid1, Pid2, Pid3, angle, _ServerDefinition, organizer) { } + public AngleFact(string Pid1, string Pid2, string Pid3, float angle, SOMDoc _ServerDefinition) + : base(Pid1, Pid2, Pid3, angle, _ServerDefinition) { } public override MMTFact MakeMMTDeclaration() { SOMDoc valueTp = new OMS(MMTConstants.RealLit); SOMDoc value = new OMLIT<float>(angle); - return new MMTValueFact(this.Label, Defines(), valueTp, value); + return new MMTValueFact(_LastLabel, Defines(), valueTp, value); } public override SOMDoc Defines() @@ -188,19 +186,19 @@ public override SOMDoc Defines() || !FactRecorder.AllFacts.ContainsKey(pointCUri)) yield break; - ret.Add(new AngleFact(pointAUri, pointBUri, pointCUri, angle, fact.@ref, StageStatic.stage.factState)); + ret.Add(new AngleFact(pointAUri, pointBUri, pointCUri, angle, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => (is_right_angle ? "⊾" : "∠") + Point1.Label + Point2.Label + Point3.Label; + protected override string generateLabel(FactRecorder name_space) + => (is_right_angle ? "⊾" : "∠") + Point1.GetLabel(name_space) + Point2.GetLabel(name_space) + Point3.GetLabel(name_space); /// \copydoc Fact.Equivalent(Fact, Fact) protected override bool EquivalentWrapped(AngleFact f1, AngleFact f2) => DependentFactsEquivalent(f1, f2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new AngleFact(old_to_new[this.Pid1], old_to_new[this.Pid2], old_to_new[this.Pid3], organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new AngleFact(old_to_new[this.Pid1], old_to_new[this.Pid2], old_to_new[this.Pid3]); } /// <summary> @@ -221,8 +219,7 @@ public RightAngleFact() : base() { } /// <param name="pid1">sets <see cref="Pid1"/></param> /// <param name="pid2">sets <see cref="Pid2"/></param> /// <param name="pid3">sets <see cref="Pid3"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public RightAngleFact(string pid1, string pid2, string pid3, FactRecorder organizer) : base(pid1, pid2, pid3, organizer) + public RightAngleFact(string pid1, string pid2, string pid3) : base(pid1, pid2, pid3) { angle = 90f; } @@ -234,9 +231,8 @@ public RightAngleFact(string pid1, string pid2, string pid3, FactRecorder organi /// <param name="Pid2">sets <see cref="Pid2"/></param> /// <param name="Pid3">sets <see cref="Pid3"/></param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public RightAngleFact(string Pid1, string Pid2, string Pid3, SOMDoc _ServerDefinition, FactRecorder organizer) - : base(Pid1, Pid2, Pid3, 90f, _ServerDefinition, organizer) { } + public RightAngleFact(string Pid1, string Pid2, string Pid3, SOMDoc _ServerDefinition) + : base(Pid1, Pid2, Pid3, 90f, _ServerDefinition) { } public override MMTFact MakeMMTDeclaration() { @@ -258,7 +254,7 @@ public override MMTFact MakeMMTDeclaration() new OMLIT<float>(90f), }),}); - return new MMTGeneralFact(Label, tp, Defines()); + return new MMTGeneralFact(_LastLabel, tp, Defines()); } public override SOMDoc Defines() @@ -287,17 +283,17 @@ is not OMS // rightAngle Arg0 || !FactRecorder.AllFacts.ContainsKey(Point3Uri)) yield break; - ret.Add(new RightAngleFact(Point1Uri, Point2Uri, Point3Uri, fact.@ref, StageStatic.stage.factState)); + ret.Add(new RightAngleFact(Point1Uri, Point2Uri, Point3Uri, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => Point1.Label + Point2.Label + Point3.Label + "⊥"; + protected override string generateLabel(FactRecorder name_space) + => Point1.GetLabel(name_space) + Point2.GetLabel(name_space) + Point3.GetLabel(name_space) + "⊥"; /// \copydoc Fact.Equivalent(Fact, Fact) protected override bool EquivalentWrapped(RightAngleFact f1, RightAngleFact f2) => DependentFactsEquivalent(f1, f2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new RightAngleFact(old_to_new[this.Pid1], old_to_new[this.Pid2], old_to_new[this.Pid3], organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new RightAngleFact(old_to_new[this.Pid1], old_to_new[this.Pid2], old_to_new[this.Pid3]); } \ No newline at end of file diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractLineFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractLineFact.cs index 7421b1bec05be625a3dba35ff2a8c63c545c24cd..9ca1bac20e572fa554fcf9903ec064240d41f634 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractLineFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractLineFact.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.WSA; /// <summary> /// Base-class for 1D-Facts @@ -44,8 +45,7 @@ protected AbstractLineFact() : base() /// </summary> /// <param name="pid1">sets <see cref="AbstractLineFact.Pid1"/></param> /// <param name="pid2">sets <see cref="AbstractLineFact.Pid2"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - protected AbstractLineFact(string pid1, string pid2, FactRecorder organizer) : base(organizer) + protected AbstractLineFact(string pid1, string pid2) : base() { set_public_members(pid1, pid2); } @@ -56,8 +56,7 @@ protected AbstractLineFact(string pid1, string pid2, FactRecorder organizer) : b /// <param name="pid1">sets <see cref="Pid1"/></param> /// <param name="pid2">sets <see cref="Pid2"/></param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - protected AbstractLineFact(string pid1, string pid2, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + protected AbstractLineFact(string pid1, string pid2, SOMDoc _ServerDefinition) : base() { this.ServerDefinition = _ServerDefinition; set_public_members(pid1, pid2); @@ -102,10 +101,10 @@ public abstract class AbstractLineFactWrappedCRTP<T> : AbstractLineFact where T protected AbstractLineFactWrappedCRTP() : base() { } /// <summary>\copydoc AbstractLineFact.AbstractLineFact(string, string, FactOrganizer)</summary> - protected AbstractLineFactWrappedCRTP(string pid1, string pid2, FactRecorder organizer) : base(pid1, pid2, organizer) { } + protected AbstractLineFactWrappedCRTP(string pid1, string pid2) : base(pid1, pid2) { } /// <summary>\copydoc AbstractLineFact.AbstractLineFact(string, string, string, FactOrganizer)</summary> - protected AbstractLineFactWrappedCRTP(string pid1, string pid2, SOMDoc _ServerDefinition, FactRecorder organizer) : base(pid1, pid2, _ServerDefinition, organizer) { } + protected AbstractLineFactWrappedCRTP(string pid1, string pid2, SOMDoc _ServerDefinition) : base(pid1, pid2, _ServerDefinition) { } /// \copydoc Fact.Equivalent(Fact, Fact) protected override bool EquivalentWrapped(AbstractLineFact f1, AbstractLineFact f2) @@ -128,18 +127,17 @@ public class LineFact : AbstractLineFactWrappedCRTP<LineFact> public LineFact() : base() { } /// <summary> \copydoc AbstractLineFact.AbstractLineFact(string, string, string, FactOrganizer) </summary> - public LineFact(string pid1, string pid2, SOMDoc _ServerDefinition, FactRecorder organizer) : base(pid1, pid2, _ServerDefinition, organizer) - => _ = this.Label; + public LineFact(string pid1, string pid2, SOMDoc _ServerDefinition) : base(pid1, pid2, _ServerDefinition) { } /// <summary> \copydoc AbstractLineFact.AbstractLineFact(string, string, FactOrganizer) </summary> - public LineFact(string pid1, string pid2, FactRecorder organizer) : base(pid1, pid2, organizer) { } + public LineFact(string pid1, string pid2) : base(pid1, pid2) { } public override MMTFact MakeMMTDeclaration() { SOMDoc valueTp = new OMS(MMTConstants.RealLit); OMLIT<float> value = new OMLIT<float>(Distance); - return new MMTValueFact(this.Label, Defines(), valueTp, value); + return new MMTValueFact(_LastLabel, Defines(), valueTp, value); } public override SOMDoc Defines() @@ -161,19 +159,19 @@ public override SOMDoc Defines() || !FactRecorder.AllFacts.ContainsKey(pointBUri)) yield break; - ret.Add(new LineFact(pointAUri, pointBUri, fact.@ref, StageStatic.stage.factState)); + ret.Add(new LineFact(pointAUri, pointBUri, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => "[" + Point1.Label + Point2.Label + "]"; + protected override string generateLabel(FactRecorder name_space) + => "[" + Point1.GetLabel(name_space) + Point2.GetLabel(name_space) + "]"; /// \copydoc Fact.Equivalent(Fact, Fact) protected override bool EquivalentWrapped(LineFact f1, LineFact f2) => DependentFactsEquivalent(f1, f2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new LineFact(old_to_new[this.Pid1], old_to_new[this.Pid2], organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new LineFact(old_to_new[this.Pid1], old_to_new[this.Pid2]); } /// <summary> @@ -189,17 +187,16 @@ public class RayFact : AbstractLineFactWrappedCRTP<RayFact> public RayFact() : base() { } /// <summary> \copydoc AbstractLineFact.AbstractLineFact(string, string, string, FactOrganizer) </summary> - public RayFact(string pid1, string pid2, SOMDoc _ServerDefinition, FactRecorder organizer) : base(pid1, pid2, _ServerDefinition, organizer) - => _ = this.Label; + public RayFact(string pid1, string pid2, SOMDoc _ServerDefinition) : base(pid1, pid2, _ServerDefinition) { } /// <summary> \copydoc AbstractLineFact.AbstractLineFact(string, string, FactOrganizer) </summary> - public RayFact(string pid1, string pid2, FactRecorder organizer) : base(pid1, pid2, organizer) { } + public RayFact(string pid1, string pid2) : base(pid1, pid2) { } public override MMTFact MakeMMTDeclaration() { SOMDoc type = new OMS(MMTConstants.LineType); - return new MMTGeneralFact(this.Label, type, Defines()); + return new MMTGeneralFact(_LastLabel, type, Defines()); } public override SOMDoc Defines() @@ -223,7 +220,7 @@ public override SOMDoc Defines() || !FactRecorder.AllFacts.ContainsKey(pointBUri)) yield break; - ret.Add(new RayFact(pointAUri, pointBUri, fact.@ref, StageStatic.stage.factState)); + ret.Add(new RayFact(pointAUri, pointBUri, fact.@ref)); } protected override void RecalculateTransform() @@ -233,11 +230,11 @@ protected override void RecalculateTransform() } /// \copydoc Fact.generateLabel - protected override string generateLabel() + protected override string generateLabel(FactRecorder name_space) { // TODO this string is too large to properly depict on scrolls. // return "]" + Point1.Label + Point2.Label + "["; - return Point1.Label + Point2.Label; + return Point1.GetLabel(name_space) + Point2.GetLabel(name_space); } /// \copydoc Fact.Equivalent(Fact, Fact) @@ -250,6 +247,6 @@ protected override bool EquivalentWrapped(RayFact f1, RayFact f2) && Math3d.IsPointApproximatelyOnLine(f1.Point1.Point, f1.Dir, f2.Point2.Point); } - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new RayFact(old_to_new[this.Pid1], old_to_new[this.Pid2], organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new RayFact(old_to_new[this.Pid1], old_to_new[this.Pid2]); } diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/CircleFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/CircleFact.cs index 08a2ca1df0cd156bf0ae7acc8efc22ff87438b04..542d7da889aba5cae5e055502e4a7dab129b920f 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/CircleFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/CircleFact.cs @@ -4,6 +4,7 @@ using Newtonsoft.Json; using REST_JSON_API; using System.Collections; +using System.Xml.Linq; /// <summary> /// A Circle that is made out of a middle point, a plane and a radius @@ -42,8 +43,7 @@ public CircleFact() : base() /// <param name="pid2">sets <see cref="PidBase"/></param> /// <param name="radius">sets <see cref="radius"/></param> /// <param name="normal">sets <see cref="normal"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public CircleFact(string pid1, string pid2, float radius, Vector3 normal, FactRecorder organizer) : base(organizer) + public CircleFact(string pid1, string pid2, float radius, Vector3 normal) : base() { this.PidCenter = pid1; this.PidBase = pid2; @@ -72,8 +72,7 @@ protected override void RecalculateTransform() /// <param name="radius">sets <see cref="radius"/></param> /// <param name="normal">sets <see cref="normal"/></param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public CircleFact(string Pid1, string Pid2, float radius, Vector3 normal, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public CircleFact(string Pid1, string Pid2, float radius, Vector3 normal, SOMDoc _ServerDefinition) : base() { this.PidCenter = Pid1; this.PidBase = Pid2; @@ -82,7 +81,6 @@ public CircleFact(string Pid1, string Pid2, float radius, Vector3 normal, SOMDoc this.normal = normal; this.ServerDefinition = _ServerDefinition; - _ = this.Label; } /// <summary> @@ -126,12 +124,12 @@ public CircleFact(string Pid1, string Pid2, float radius, Vector3 normal, SOMDoc || !FactRecorder.AllFacts.ContainsKey(A_uri)) yield break; //If dependent facts do not exist return null - ret.Add(new CircleFact(M_uri, A_uri, radius, normal, fact.@ref, StageStatic.stage.factState)); + ret.Add(new CircleFact(M_uri, A_uri, radius, normal, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => "○" + PointCenter.Label; + protected override string generateLabel(FactRecorder name_space) + => "○" + PointCenter.GetLabel(name_space); /// <summary> /// Constructs struct for right-angled MMT %Fact <see cref="AddFactResponse"/> @@ -144,7 +142,7 @@ public override MMTFact MakeMMTDeclaration() { SOMDoc tp = new OMS(MMTConstants.CircleType3d); - return new MMTGeneralFact(Label, tp, Defines()); + return new MMTGeneralFact(_LastLabel, tp, Defines()); } public override SOMDoc Defines() @@ -192,8 +190,8 @@ protected override bool EquivalentWrapped(CircleFact f1, CircleFact f2) && Math3d.IsApproximatelyEqual(f1.normal, f2.normal) && Mathf.Approximately(f1.radius, f2.radius); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new CircleFact(old_to_new[this.PidCenter], old_to_new[this.PidBase], this.radius, this.normal, organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new CircleFact(old_to_new[this.PidCenter], old_to_new[this.PidBase], this.radius, this.normal); } /// <summary> @@ -222,8 +220,7 @@ public RadiusFact() : base() /// Initiates <see cref="Cid1"/> and <see cref="rad"/> /// </summary> /// <param name="cid1">sets <see cref="Cid1"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public RadiusFact(string cid1, FactRecorder organizer) : base(organizer) + public RadiusFact(string cid1) : base() { this.Cid1 = cid1; this.rad = Circle.radius; @@ -240,13 +237,11 @@ protected override void RecalculateTransform() /// </summary> /// <param name="Cid1">sets <see cref="Cid1"/></param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public RadiusFact(string Cid1, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public RadiusFact(string Cid1, SOMDoc _ServerDefinition) : base() { this.Cid1 = Cid1; this.ServerDefinition = _ServerDefinition; - _ = this.Label; } /// \copydoc Fact.parseFact(ScrollFact) @@ -257,12 +252,12 @@ public RadiusFact(string Cid1, SOMDoc _ServerDefinition, FactRecorder organizer) if (!FactRecorder.AllFacts.ContainsKey(CircleUri)) yield break; - ret.Add(new RadiusFact(CircleUri, fact.@ref, StageStatic.stage.factState)); + ret.Add(new RadiusFact(CircleUri, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => "r " + Circle.Label; + protected override string generateLabel(FactRecorder name_space) + => "r " + Circle.GetLabel(name_space); /// <summary> /// Constructs struct for not-right-angled MMT %Fact <see cref="AddFactResponse"/> @@ -275,7 +270,7 @@ public override MMTFact MakeMMTDeclaration() SOMDoc valueTp = new OMS(MMTConstants.RealLit); SOMDoc value = new OMLIT<float>(rad); - return new MMTValueFact(this.Label, Defines(), valueTp, value); + return new MMTValueFact(_LastLabel, Defines(), valueTp, value); } public override SOMDoc Defines() @@ -297,8 +292,8 @@ protected override string[] GetDependentFactIds() protected override bool EquivalentWrapped(RadiusFact f1, RadiusFact f2) => DependentFactsEquivalent(f1, f2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new RadiusFact(old_to_new[this.Cid1], organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new RadiusFact(old_to_new[this.Cid1]); } /// <summary> @@ -328,8 +323,7 @@ public AreaCircleFact() : base() /// Initiates <see cref="Cid1"/> and creates MMT %Fact Server-Side /// </summary> /// <param name="cid1">sets <see cref="Cid1"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public AreaCircleFact(string cid1, FactRecorder organizer) : base(organizer) + public AreaCircleFact(string cid1) : base() { this.Cid1 = cid1; this.A = Circle.radius * Circle.radius * (float)Math.PI; @@ -346,13 +340,11 @@ protected override void RecalculateTransform() /// </summary> /// <param name="Cid1">sets <see cref="Cid1"/></param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public AreaCircleFact(string Cid1, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public AreaCircleFact(string Cid1, SOMDoc _ServerDefinition) : base() { this.Cid1 = Cid1; this.ServerDefinition = _ServerDefinition; - _ = this.Label; } /// \copydoc Fact.parseFact(ScrollFact) @@ -363,19 +355,19 @@ public AreaCircleFact(string Cid1, SOMDoc _ServerDefinition, FactRecorder organi if (!FactRecorder.AllFacts.ContainsKey(CircleUri)) yield break; - ret.Add(new AreaCircleFact(CircleUri, fact.@ref, StageStatic.stage.factState)); + ret.Add(new AreaCircleFact(CircleUri, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => "A(" + Circle.Label + ")"; + protected override string generateLabel(FactRecorder name_space) + => "A(" + Circle.GetLabel(name_space) + ")"; public override MMTFact MakeMMTDeclaration() { SOMDoc valueTp = new OMS(MMTConstants.RealLit); SOMDoc value = new OMLIT<float>(A); - return new MMTValueFact(this.Label, Defines(), valueTp, value); + return new MMTValueFact(_LastLabel, Defines(), valueTp, value); } public override SOMDoc Defines() @@ -401,8 +393,8 @@ public override int GetHashCode() protected override bool EquivalentWrapped(AreaCircleFact f1, AreaCircleFact f2) => DependentFactsEquivalent(f1, f2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new AreaCircleFact(old_to_new[this.Cid1], organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new AreaCircleFact(old_to_new[this.Cid1]); } /// <summary> @@ -433,8 +425,7 @@ public OnCircleFact() : base() /// </summary> /// <param name="pid">sets <see cref="Pid"/></param> /// <param name="cid">sets <see cref="Cid"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public OnCircleFact(string pid, string cid, FactRecorder organizer) : base(organizer) + public OnCircleFact(string pid, string cid) : base() { this.Pid = pid; this.Cid = cid; @@ -452,13 +443,11 @@ protected override void RecalculateTransform() /// <param name="pid">sets <see cref="Pid"/></param> /// <param name="cid">sets <see cref="Cid"/></param> /// <param name="uri">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public OnCircleFact(string pid, string cid, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public OnCircleFact(string pid, string cid, SOMDoc _ServerDefinition) : base() { this.Pid = pid; this.Cid = cid; this.ServerDefinition = _ServerDefinition; - _ = this.Label; } /// \copydoc Fact.parseFact(ScrollFact) @@ -474,12 +463,12 @@ public OnCircleFact(string pid, string cid, SOMDoc _ServerDefinition, FactRecord || !FactRecorder.AllFacts.ContainsKey(circleUri)) yield break; - ret.Add(new OnCircleFact(pointUri, circleUri, fact.@ref, StageStatic.stage.factState)); + ret.Add(new OnCircleFact(pointUri, circleUri, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => Point.Label + "∈" + Circle.Label; + protected override string generateLabel(FactRecorder name_space) + => Point.GetLabel(name_space) + "∈" + Circle.GetLabel(name_space); /// \copydoc Fact.hasDependentFacts public override bool HasDependentFacts => true; @@ -492,8 +481,8 @@ protected override string[] GetDependentFactIds() protected override bool EquivalentWrapped(OnCircleFact c1, OnCircleFact c2) => DependentFactsEquivalent(c1, c2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new OnCircleFact(old_to_new[this.Pid], old_to_new[this.Cid], organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new OnCircleFact(old_to_new[this.Pid], old_to_new[this.Cid]); public override MMTFact MakeMMTDeclaration() { @@ -508,7 +497,7 @@ public override MMTFact MakeMMTDeclaration() new OMS(Pid), }),}); - return new MMTGeneralFact(Label, tp, Defines()); + return new MMTGeneralFact(_LastLabel, tp, Defines()); } public override SOMDoc Defines() @@ -553,8 +542,7 @@ public AngleCircleLineFact() : base() /// <param name="cid1">sets <see cref="Cid1"/></param> /// <param name="rid2">sets <see cref="Rid2"/></param> /// <param name="angle"> sets the angle </param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public AngleCircleLineFact(string cid1, string rid2, FactRecorder organizer) : base(organizer) + public AngleCircleLineFact(string cid1, string rid2) : base() { this.Cid1 = cid1; this.Rid2 = rid2; @@ -594,15 +582,13 @@ protected override void RecalculateTransform() /// <param name="´Rid2">sets <see cref="Rid2"/></param> /// <param name="angle"> sets the angle </param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public AngleCircleLineFact(string Cid1, string Rid2, float angle, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public AngleCircleLineFact(string Cid1, string Rid2, float angle, SOMDoc _ServerDefinition) : base() { this.Cid1 = Cid1; this.Rid2 = Rid2; this.angle = angle; this.ServerDefinition = _ServerDefinition; - _ = this.Label; } /// \copydoc Fact.parseFact(ScrollFact) @@ -625,19 +611,19 @@ public AngleCircleLineFact(string Cid1, string Rid2, float angle, SOMDoc _Server || !FactRecorder.AllFacts.ContainsKey(RayUri)) yield break; - ret.Add(new AngleCircleLineFact(CircleUri, RayUri, angle, fact.@ref, StageStatic.stage.factState)); + ret.Add(new AngleCircleLineFact(CircleUri, RayUri, angle, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => "∠" + Circle.Label + Ray.Label; + protected override string generateLabel(FactRecorder name_space) + => "∠" + Circle.GetLabel(name_space) + Ray.GetLabel(name_space); public override MMTFact MakeMMTDeclaration() { SOMDoc valueTp = new OMS(MMTConstants.RealLit); SOMDoc value = new OMLIT<float>(angle); - return new MMTValueFact(this.Label, Defines(), valueTp, value); + return new MMTValueFact(_LastLabel, Defines(), valueTp, value); } public override SOMDoc Defines() @@ -660,8 +646,8 @@ protected override string[] GetDependentFactIds() protected override bool EquivalentWrapped(AngleCircleLineFact f1, AngleCircleLineFact f2) => DependentFactsEquivalent(f1, f2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new AngleCircleLineFact(old_to_new[this.Cid1], old_to_new[this.Rid2], organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new AngleCircleLineFact(old_to_new[this.Cid1], old_to_new[this.Rid2]); } /// <summary> @@ -700,8 +686,7 @@ public OrthogonalCircleLineFact() : base() /// </summary> /// <param name="cid1">sets <see cref="Cid1"/></param> /// <param name="lid1">sets <see cref="Lid1"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public OrthogonalCircleLineFact(string cid1, string lid1, FactRecorder organizer) : base(organizer) + public OrthogonalCircleLineFact(string cid1, string lid1) : base() { this.Cid1 = cid1; this.Lid1 = lid1; @@ -731,14 +716,12 @@ protected override void RecalculateTransform() /// <param name="Cid1">sets <see cref="Cid1"/></param> /// <param name="Lid1">sets <see cref="Lid1"/></param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public OrthogonalCircleLineFact(string Cid1, string Lid1, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public OrthogonalCircleLineFact(string Cid1, string Lid1, SOMDoc _ServerDefinition) : base() { this.Cid1 = Cid1; this.Lid1 = Lid1; this.ServerDefinition = _ServerDefinition; - _ = this.Label; } /// \copydoc Fact.parseFact(ScrollFact) @@ -754,12 +737,12 @@ public OrthogonalCircleLineFact(string Cid1, string Lid1, SOMDoc _ServerDefiniti || !FactRecorder.AllFacts.ContainsKey(LineUri)) yield break; - ret.Add(new OrthogonalCircleLineFact(CircleUri, LineUri, fact.@ref, StageStatic.stage.factState)); + ret.Add(new OrthogonalCircleLineFact(CircleUri, LineUri, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => Circle.Label + "⊥" + Ray.Label; + protected override string generateLabel(FactRecorder name_space) + => Circle.GetLabel(name_space) + "⊥" + Ray.GetLabel(name_space); public override MMTFact MakeMMTDeclaration() { @@ -776,7 +759,7 @@ public override MMTFact MakeMMTDeclaration() } ); - return new MMTGeneralFact(this.Label, tp, Defines()); + return new MMTGeneralFact(_LastLabel, tp, Defines()); } public override SOMDoc Defines() @@ -793,8 +776,8 @@ protected override string[] GetDependentFactIds() protected override bool EquivalentWrapped(OrthogonalCircleLineFact f1, OrthogonalCircleLineFact f2) => DependentFactsEquivalent(f1, f2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new OrthogonalCircleLineFact(old_to_new[this.Cid1], old_to_new[this.Lid1], organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new OrthogonalCircleLineFact(old_to_new[this.Cid1], old_to_new[this.Lid1]); } /// <summary> @@ -826,8 +809,7 @@ public EqualCirclesFact() : base() /// </summary> /// <param name="cid1">sets <see cref="Cid1"/></param> /// <param name="cid2">sets <see cref="Cid2"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public EqualCirclesFact(string cid1, string cid2, FactRecorder organizer) : base(organizer) + public EqualCirclesFact(string cid1, string cid2) : base() { this.Cid1 = cid1; this.Cid2 = cid2; @@ -845,14 +827,12 @@ protected override void RecalculateTransform() /// <param name="Cid1">sets <see cref="Cid1"/></param> /// <param name="Cid2">sets <see cref="Cid2"/></param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public EqualCirclesFact(string Cid1, string Cid2, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public EqualCirclesFact(string Cid1, string Cid2, SOMDoc _ServerDefinition) : base() { this.Cid1 = Cid1; this.Cid2 = Cid2; this.ServerDefinition = _ServerDefinition; - _ = this.Label; } /// \copydoc Fact.parseFact(ScrollFact) @@ -870,12 +850,12 @@ public EqualCirclesFact(string Cid1, string Cid2, SOMDoc _ServerDefinition, Fact || !FactRecorder.AllFacts.ContainsKey(circleBUri)) yield break; - ret.Add(new EqualCirclesFact(circleAUri, circleBUri, fact.@ref, StageStatic.stage.factState)); + ret.Add(new EqualCirclesFact(circleAUri, circleBUri, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => Circle1.Label + " ≠" + Circle2.Label; + protected override string generateLabel(FactRecorder name_space) + => Circle1.GetLabel(name_space) + " ≠" + Circle2.GetLabel(name_space); public override MMTFact MakeMMTDeclaration() { @@ -892,7 +872,7 @@ public override MMTFact MakeMMTDeclaration() } ); - return new MMTGeneralFact(this.Label, tp, Defines()); + return new MMTGeneralFact(_LastLabel, tp, Defines()); } public override SOMDoc Defines() @@ -909,8 +889,8 @@ protected override string[] GetDependentFactIds() protected override bool EquivalentWrapped(EqualCirclesFact f1, EqualCirclesFact f2) => DependentFactsEquivalent(f1, f2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new EqualCirclesFact(old_to_new[this.Cid1], old_to_new[this.Cid2], organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new EqualCirclesFact(old_to_new[this.Cid1], old_to_new[this.Cid2]); } /// <summary> @@ -942,8 +922,7 @@ public UnEqualCirclesFact() : base() /// </summary> /// <param name="cid1">sets <see cref="Cid1"/></param> /// <param name="cid2">sets <see cref="Cid2"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public UnEqualCirclesFact(string cid1, string cid2, FactRecorder organizer) : base(organizer) + public UnEqualCirclesFact(string cid1, string cid2) : base() { this.Cid1 = cid1; this.Cid2 = cid2; @@ -961,14 +940,12 @@ protected override void RecalculateTransform() /// <param name="Cid1">sets <see cref="Cid1"/></param> /// <param name="Cid2">sets <see cref="Cid2"/></param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public UnEqualCirclesFact(string Cid1, string Cid2, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public UnEqualCirclesFact(string Cid1, string Cid2, SOMDoc _ServerDefinition) : base() { this.Cid1 = Cid1; this.Cid2 = Cid2; this.ServerDefinition = _ServerDefinition; - _ = this.Label; } /// \copydoc Fact.parseFact(ScrollFact) @@ -986,12 +963,12 @@ public UnEqualCirclesFact(string Cid1, string Cid2, SOMDoc _ServerDefinition, Fa || !FactRecorder.AllFacts.ContainsKey(circleBUri)) yield break; - ret.Add(new UnEqualCirclesFact(circleAUri, circleBUri, fact.@ref, StageStatic.stage.factState)); + ret.Add(new UnEqualCirclesFact(circleAUri, circleBUri, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => Circle1.Label + " = " + Circle2.Label; + protected override string generateLabel(FactRecorder name_space) + => Circle1.GetLabel(name_space) + " = " + Circle2.GetLabel(name_space); public override MMTFact MakeMMTDeclaration() { @@ -1004,7 +981,7 @@ public override MMTFact MakeMMTDeclaration() new OMS(Cid2), }),}); - return new MMTGeneralFact(this.Label, tp, Defines()); + return new MMTGeneralFact(_LastLabel, tp, Defines()); } public override SOMDoc Defines() @@ -1021,6 +998,6 @@ protected override string[] GetDependentFactIds() protected override bool EquivalentWrapped(UnEqualCirclesFact f1, UnEqualCirclesFact f2) => DependentFactsEquivalent(f1, f2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new UnEqualCirclesFact(old_to_new[this.Cid1], old_to_new[this.Cid2], organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new UnEqualCirclesFact(old_to_new[this.Cid1], old_to_new[this.Cid2]); } diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs index d5468a4deb8f4ec767b460582fd49339bb369db0..cfceb1b7683f82e651950acf05c022c65560da4a 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs @@ -170,54 +170,50 @@ public SOMDoc ServerDefinition public bool HasServerTwin => ServerDefinition is OMS; /// <value> - /// <c>get</c> initiates and subsequently updates a human readable name. <remarks>Should be called once a constructor call to be initiated.</remarks> - /// <c>set</c> calls <see cref="rename(string)"/> + /// <c>get</c> initiates and subsequently updates a human readable name. + /// <c>set</c> calls <see cref="rename(string, FactRecorder)"/> /// </value> - public string Label + public string GetLabel(FactRecorder name_space) + { // in case of renamed dependables + return _LastLabel = ( + name_space == null // JsonSerialization toggle (_Facts.GetNumberOfFacts() == 0 && this is not PointFact) // JsonSerialization toggle && allow first (Point)Fact to be created + || (hasCustomLabel && _CustomLabel != null) + ? _CustomLabel + : generateLabel(name_space)); + } + protected internal string _LastLabel = "NaN"; + + public bool SetLabel(string value, FactRecorder name_space) { - get - { // in case of renamed dependables - return _Facts == null // JsonSerialization toggle (_Facts.GetNumberOfFacts() == 0 && this is not PointFact) // JsonSerialization toggle && allow first (Point)Fact to be created - || (hasCustomLabel && _CustomLabel != null) - ? _CustomLabel - : generateLabel(); - } - set + if (name_space == null) // JsonSerialization toggle) { - if (_Facts == null) // JsonSerialization toggle) - { - _CustomLabel = value; - LabelId = -LabelId; - return; - } - rename(value); + _CustomLabel = value; + LabelId = -LabelId; + return true; } + else + return rename(value, name_space); } + /// <value> - /// Is true if Fact has a custom <see cref="Label"/> which is not <c>null</c> or <c>""</c>. + /// Is true if Fact has a custom <see cref="GetLabel"/> which is not <c>null</c> or <c>""</c>. /// </value> public bool hasCustomLabel => LabelId < 0; /// <summary> - /// Stores custom <see cref="Label"/> if set. + /// Stores custom <see cref="GetLabel"/> if set. /// </summary> + [JsonProperty] protected string _CustomLabel = null; /// <summary> - /// Counter to organize auto generated <see cref="Label"/>. + /// Counter to organize auto generated <see cref="GetLabel"/>. /// Set to negative, if custom \ref Label is assigned. /// </summary> // property for JSON to set AFTER Label => declare AFTER Label public int LabelId { get; set; } - /// <summary> - /// Reference to <see cref="FactRecorder"/> in which this Fact and all its <see cref="getDependentFactIds">depending Facts</see> are beeing organized. - /// </summary> - /// <remarks>Now only relevant for Lables</remarks> - [JsonIgnore] - protected FactRecorder _Facts; - [JsonIgnore] bool ForceRecalculateTransform = true; @@ -278,65 +274,54 @@ protected set /// </summary> protected Fact() { - this._Facts = null; // new FactOrganizer(); LabelId = 0; - s_type = this.GetType().Name; } - /// <summary> - /// Standard base-constructor. - /// </summary> - /// <param name="organizer"><see cref="_Facts"/></param> - protected Fact(FactRecorder organizer) : this() - { - this._Facts = organizer; - } - /// <summary> /// Copies <paramref name="fact"/> by initiating new MMT %Fact. /// </summary> /// <param name="fact">Fact to be copied</param> - /// <param name="old_to_new"><c>Dictionary</c> mapping <paramref name="fact"/>.<see cref="getDependentFactIds"/> in <paramref name="fact"/>.<see cref="Fact._Facts"/> to corresponding <see cref="Fact.Id"/> in <paramref name="organizer"/> </param> - /// <param name="organizer"><see cref="_Facts"/></param> + /// <param name="old_to_new"><c>Dictionary</c> mapping <paramref name="fact"/>.<see cref="getDependentFactIds"/> to corresponding <see cref="Fact.Id"/> in <paramref name="organizer"/> </param> + /// <param name="organizer">for Labeling<see cref="GetLabel(FactRecorder)"/></param> public Fact ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) { - Fact ret = _ReInitializeMe(old_to_new, organizer); + Fact ret = _ReInitializeMe(old_to_new); ret.LabelId = this.LabelId; if (ret.hasCustomLabel) - ret._CustomLabel = this.Label; + ret._CustomLabel = this.GetLabel(organizer); return ret; } - protected abstract Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer); + protected abstract Fact _ReInitializeMe(Dictionary<string, string> old_to_new); /// <summary> - /// Assignes a custom <see cref="Label"/>, if <paramref name="newLabel"/> is not yet taken; - /// or clears custom <see cref="Label"/>. + /// Assignes a custom <see cref="GetLabel"/>, if <paramref name="newLabel"/> is not yet taken; + /// or clears custom <see cref="GetLabel"/>. /// </summary> - /// <param name="newLabel">To be new <see cref="Label"/>. To reset to auto-generation set to <c>null</c> or <c>""</c>.</param> + /// <param name="newLabel">To be new <see cref="GetLabel"/>. To reset to auto-generation set to <c>null</c> or <c>""</c>.</param> /// <returns></returns> //TODO: notify about updated dependable Labelnames for UI //TODO: check for colissions with not yet generated names - public bool rename(string newLabel) + public bool rename(string newLabel, FactRecorder name_space) // returns true if succeded { - if (string.IsNullOrEmpty(newLabel) && _Facts.GetNumberOfFacts() != 0) + if (string.IsNullOrEmpty(newLabel) && name_space.GetNumberOfFacts() != 0) // switch back to autogenerated { - generateLabel(); + generateLabel(name_space); _CustomLabel = null; return true; } else // set CustomLabel if available { - if (_Facts.ContainsLabel(newLabel)) + if (name_space.ContainsLabel(newLabel)) return false; - freeAutoLabel(); + freeAutoLabel(name_space); _CustomLabel = newLabel; return true; @@ -349,13 +334,13 @@ public bool rename(string newLabel) public abstract SOMDoc Defines(); /// <summary> - /// Frees ressources e.g. <see cref="Label"/> and will eventually delete %Fact Server-Side in far-near future when feature is supported. + /// Frees ressources e.g. <see cref="GetLabel"/> and will eventually delete %Fact Server-Side in far-near future when feature is supported. /// </summary> ~Fact() { //TODO: MMT: delete over there - freeAutoLabel(); + //freeAutoLabel(_Facts); //should be done already if (CommunicationEvents.VerboseURI) Debug.Log("Server removed Fact:\n" + this.Id); @@ -386,23 +371,23 @@ public bool rename(string newLabel) .Aggregate((hash1, hash2) => hash1 ^ hash2); /// <summary> - /// auto-generates <see cref="Label"/> using generation variable(s) e.g. <see cref="LabelId"/>; - /// if custom <see cref="Label"/> is set, tries to restore original generated <see cref="Label"/> **without** resetting <see cref="_CustomLabel"/>. If original <see cref="Label"/> is already taken, a new one will be generated. + /// auto-generates <see cref="GetLabel"/> using generation variable(s) e.g. <see cref="LabelId"/>; + /// if custom <see cref="GetLabel"/> is set, tries to restore original generated <see cref="GetLabel"/> **without** resetting <see cref="_CustomLabel"/>. If original <see cref="GetLabel"/> is already taken, a new one will be generated. /// </summary> - /// <returns>auto-generated <see cref="Label"/></returns> - protected virtual string generateLabel() + /// <returns>auto-generated <see cref="GetLabel"/></returns> + protected virtual string generateLabel(FactRecorder name_space) { if (LabelId < 0) // reload Label if possible - LabelId = _Facts.UnusedLabelIds.Remove(-LabelId) ? -LabelId : 0; + LabelId = name_space.UnusedLabelIds.Remove(-LabelId) ? -LabelId : 0; if (LabelId == 0) - if (_Facts.UnusedLabelIds.Count == 0) - LabelId = ++_Facts.MaxLabelId; + if (name_space.UnusedLabelIds.Count == 0) + LabelId = ++name_space.MaxLabelId; else { - LabelId = _Facts.UnusedLabelIds.Min; - _Facts.UnusedLabelIds.Remove(LabelId); + LabelId = name_space.UnusedLabelIds.Min; + name_space.UnusedLabelIds.Remove(LabelId); } return ((char)(64 + LabelId)).ToString(); @@ -417,15 +402,13 @@ public static IEnumerator parseFact(List<Fact> ret, MMTFact fact) => null; /// <summary> - /// Tells <see cref="_Facts"/> that \ref Fact "this" no longer uses auto-generated <see cref="Label"/>, but remembers current generation variable(s). + /// Tells a <see cref="FactRecorder"/> that \ref Fact "this" no longer uses auto-generated <see cref="GetLabel"/>, but remembers current generation variable(s). /// </summary> - - // TODO? only get _Fact to freeLabel/ - public /*protected internal*/ void freeAutoLabel() + public void freeAutoLabel(FactRecorder name_space) { if (LabelId > 0) { - _Facts.UnusedLabelIds.Add(LabelId); + name_space.UnusedLabelIds.Add(LabelId); // store Label for name-persistance LabelId = -LabelId; } @@ -533,7 +516,7 @@ static string _SendAdd(string path, string body)//, Action<string> uriCallback) } private static uint bypasscc = 0; - public static void MakeFact(List<Fact> ret, object payload, SOMDoc ServerDefinition, FactRecorder organizer, bool BypassServer) + public static void MakeFact(List<Fact> ret, object payload, SOMDoc ServerDefinition, bool BypassServer) { Type type = payload.GetType(); @@ -545,29 +528,29 @@ public static void MakeFact(List<Fact> ret, object payload, SOMDoc ServerDefinit else if (payload is float f) ret.Add(BypassServer - ? new RealLitFact(f, BypassURI, organizer) - : new RealLitFact(f, organizer)); + ? new RealLitFact(f, BypassURI) + : new RealLitFact(f)); else if (payload is Vector3 point) ret.Add(BypassServer - ? new PointFact(point, BypassURI, organizer) - : new PointFact(point, Vector3.up, organizer)); + ? new PointFact(point, BypassURI) + : new PointFact(point, Vector3.up)); else if (FuncExtensions.IsFuncType(type, out _)) ret.Add(BypassServer - ? new FunctionFact(ServerDefinition, BypassURI, organizer) - : new FunctionFact(ServerDefinition, organizer)); + ? new FunctionFact(ServerDefinition, BypassURI) + : new FunctionFact(ServerDefinition)); else if (TupleExtensions.IsTupleType(type, out _)) ret.AddRange(BypassServer - ? DynamicTupleFact.MMTFactory(payload, ServerDefinition, SOMDoc.SOMDocType(type), organizer, BypassURI) - : DynamicTupleFact.MMTFactory(payload, ServerDefinition, SOMDoc.SOMDocType(type), organizer)); + ? DynamicTupleFact.MMTFactory(payload, ServerDefinition, SOMDoc.SOMDocType(type), BypassURI) + : DynamicTupleFact.MMTFactory(payload, ServerDefinition, SOMDoc.SOMDocType(type))); else if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(List<>)) ret.AddRange(BypassServer - ? DynamicListFact.MMTFactory((List<dynamic>)payload, ServerDefinition, SOMDoc.SOMDocType(type), organizer, BypassURI) - : DynamicListFact.MMTFactory((List<dynamic>)payload, ServerDefinition, SOMDoc.SOMDocType(type), organizer)); + ? DynamicListFact.MMTFactory((List<dynamic>)payload, ServerDefinition, SOMDoc.SOMDocType(type), BypassURI) + : DynamicListFact.MMTFactory((List<dynamic>)payload, ServerDefinition, SOMDoc.SOMDocType(type))); else if (type.IsAnonymousType()) return; @@ -591,9 +574,6 @@ public abstract class FactWrappedCRTP<T> : Fact where T : FactWrappedCRTP<T> /// <summary>\copydoc Fact.Fact()</summary> protected FactWrappedCRTP() : base() { } - /// <summary>\copydoc Fact.Fact(FactOrganizer)</summary> - protected FactWrappedCRTP(FactRecorder organizer) : base(organizer) { } - /// \copydoc Fact.Equivalent(Fact) public override bool Equivalent(Fact f2) => Equivalent(this, f2); @@ -632,17 +612,6 @@ public TestFact() : base() } - /// <summary> - /// Standard Constructor: - /// Initiates members and creates MMT %Fact Server-Side - /// </summary> - /// <param name="pid1">sets <see cref="Pid1"/></param> - /// <param name="pid2">sets <see cref="Pid2"/></param> - /// <param name="radius">sets <see cref="radius"/></param> - /// <param name="normal">sets <see cref="normal"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public TestFact(FactRecorder organizer) : base(organizer) { } - protected override void RecalculateTransform() { } /// <summary> @@ -653,12 +622,9 @@ protected override void RecalculateTransform() { } /// <param name="radius">sets <see cref="radius"/></param> /// <param name="normal">sets <see cref="normal"/></param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public TestFact(string backendURI, FactRecorder organizer) : base(organizer) + public TestFact(string backendURI) : base() { - this.ServerDefinition = ServerDefinition; - _ = this.Label; } /// <summary> @@ -669,12 +635,12 @@ public TestFact(string backendURI, FactRecorder organizer) : base(organizer) { string uri = fact.@ref.uri; Debug.Log("TestFact Uri:" + uri); - ret.Add(new TestFact(uri, StageStatic.stage.factState)); + ret.Add(new TestFact(uri)); yield break; } /// \copydoc Fact.generateLabel - protected override string generateLabel() + protected override string generateLabel(FactRecorder _Facts) => "test"; /// \copydoc Fact.hasDependentFacts @@ -694,8 +660,8 @@ protected override bool EquivalentWrapped(TestFact f1, TestFact f2) return DependentFactsEquivalent(f1, f2); } - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new TestFact(organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new TestFact(); public override MMTFact MakeMMTDeclaration() { diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/FunctionFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/FunctionFact.cs index a042758945dc97653ece76b4b1b3d283a2472afe..dd3ac363181c6d89ed4efdedb0d1ef548fdca1dc 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/FunctionFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/FunctionFact.cs @@ -44,14 +44,14 @@ private set public FunctionFact Function_args; [JsonConstructor] - public FunctionCallFact(string func_id, string arg_func_id, (float t_0, float t_n) Domain, FactRecorder organizer) : base(organizer) + public FunctionCallFact(string func_id, string arg_func_id, (float t_0, float t_n) Domain) : base() { this.func_id = func_id; this.arg_func_id = arg_func_id; this.Domain = Domain; } - public FunctionCallFact(FunctionFact Function, FunctionFact Function_args, (float t_0, float t_n) Domain, FactRecorder organizer) : base(organizer) + public FunctionCallFact(FunctionFact Function, FunctionFact Function_args, (float t_0, float t_n) Domain) : base() { this.Function = Function; this.Function_args = Function_args; @@ -118,7 +118,7 @@ public override MMTFact MakeMMTDeclaration() mmt_in.type, }); - return new MMTGeneralFact(Label, type, Defines()); + return new MMTGeneralFact(_LastLabel, type, Defines()); } public override SOMDoc Defines() @@ -142,8 +142,8 @@ protected override void RecalculateTransform() LocalScale = Function.LocalScale; } - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new FunctionCallFact(old_to_new[this.func_id], old_to_new[this.arg_func_id], this.Domain, organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new FunctionCallFact(old_to_new[this.func_id], old_to_new[this.arg_func_id], this.Domain); } public class FunctionFact : FactWrappedCRTP<FunctionFact> @@ -167,8 +167,7 @@ public FunctionFact() : base() { } /// Initiates members and creates MMT %Fact Server-Side /// </summary> /// <param name="Function_SOMDoc">sets <see cref="Function_SOMDoc"/> and contains the Abstract Syntax Tree</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public FunctionFact(SOMDoc Function_SOMDoc, FactRecorder organizer) : base(organizer) + public FunctionFact(SOMDoc Function_SOMDoc) : base() { this.Function_SOMDoc = Function_SOMDoc; this.Function = this.Function_SOMDoc.PartialInvokeCastingLambdaExpression(out LambdaExpression, out Signature); @@ -179,14 +178,12 @@ public FunctionFact(SOMDoc Function_SOMDoc, FactRecorder organizer) : base(organ /// </summary> /// <param name="function_expression">sets <see cref="Function_expression"/> and contains the Abstract Syntax Tree</param> /// <param name="uri">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public FunctionFact(SOMDoc Function_SOMDoc, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public FunctionFact(SOMDoc Function_SOMDoc, SOMDoc _ServerDefinition) : base() { this.Function_SOMDoc = Function_SOMDoc; this.Function = Function_SOMDoc.PartialInvokeCastingLambdaExpression(out LambdaExpression, out Signature); this.ServerDefinition = _ServerDefinition; - _ = this.Label; } protected override void RecalculateTransform() { } @@ -203,7 +200,7 @@ protected override void RecalculateTransform() { } ParsingDictionary.parseTermsToId.TryAdd(fun.ToString(), fact.@ref.uri); - ret.Add(new FunctionFact(fun, fact.@ref, StageStatic.stage.factState)); + ret.Add(new FunctionFact(fun, fact.@ref)); } /// \copydoc Fact.hasDependentFacts @@ -222,12 +219,12 @@ public override int GetHashCode() protected override bool EquivalentWrapped(FunctionFact f1, FunctionFact f2) => f1.Function_SOMDoc.Equivalent(f2.Function_SOMDoc); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new FunctionFact(this.Function_SOMDoc.MapURIs(old_to_new), organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new FunctionFact(this.Function_SOMDoc.MapURIs(old_to_new)); public override MMTFact MakeMMTDeclaration() => new MMTGeneralFact( - Label, + _LastLabel, SOMDoc.SOMDocType(FuncExtensions.CreateFuncType(Signature)), Defines()); diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/MMTTypes.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/MMTTypes.cs index 5e3a37b728cde09509128075aea6ee38cb3455f0..a2fff9bb92d9e3cb0cd50cb6b33a04fb8053149e 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/MMTTypes.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/MMTTypes.cs @@ -23,12 +23,12 @@ public class ListFact : FactWrappedCRTP<ListFact> public ListFact() : base() { } - public ListFact(string[] lids, SOMDoc[] payload, SOMDoc ElementType, FactRecorder organizer) : base(organizer) + public ListFact(string[] lids, SOMDoc[] payload, SOMDoc ElementType) : base() { Init(lids, payload, ElementType); } - public ListFact(string[] lids, SOMDoc[] payload, SOMDoc ElementType, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public ListFact(string[] lids, SOMDoc[] payload, SOMDoc ElementType, SOMDoc _ServerDefinition) : base() { Init(lids, payload, ElementType); this.ServerDefinition = _ServerDefinition; @@ -70,12 +70,11 @@ private void Init(string[] lids, SOMDoc[] payload, SOMDoc ElementType) ); } - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) => new ListFact( lids.Select(id => id == null ? null : old_to_new[id]).ToArray(), payload.Select(somdoc => somdoc?.MapURIs(old_to_new)).ToArray(), - ListType.arguments[0], - organizer); + ListType.arguments[0]); public static new IEnumerable parseFact(List<Fact> ret, MMTFact fact) { @@ -88,7 +87,7 @@ protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, F // try to salvage ret.AddRange(DynamicListFact.MMTFactory(null, MMTSymbol.defines, MMTSymbol.type, - StageStatic.stage.factState, MMTSymbol.@ref + MMTSymbol.@ref )); yield break; } @@ -138,11 +137,11 @@ protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, F payload.Select(p => (p as OMS)?.uri).ToArray(), payload.ToArray(), listOMA.arguments[0], - fact.@ref, StageStatic.stage.factState)); + fact.@ref)); } public override MMTFact MakeMMTDeclaration() - => new MMTGeneralFact(Label, ListType, Defines()); + => new MMTGeneralFact(_LastLabel, ListType, Defines()); public override SOMDoc Defines() => SOMDoc.MakeShallowList(payload); @@ -172,16 +171,14 @@ public class DynamicListFact : FactWrappedCRTP<DynamicListFact>, IUnpackable public DynamicListFact() : base() { } - public DynamicListFact(FactRecorder organizer) : base(organizer) { } - - public DynamicListFact(List<object> payload, SOMDoc indirect_payload, SOMDoc ListType, FactRecorder organizer) : base(organizer) + public DynamicListFact(List<object> payload, SOMDoc indirect_payload, SOMDoc ListType) : base() { this.payload = payload; this.indirect_payload = indirect_payload; this.ListType = ListType; } - public static List<Fact> MMTFactory(List<dynamic> payload, SOMDoc indirect_payload, SOMDoc ListType, FactRecorder organizer, SOMDoc _ServerDefinition = null) + public static List<Fact> MMTFactory(List<dynamic> payload, SOMDoc indirect_payload, SOMDoc ListType, SOMDoc _ServerDefinition = null) { if (payload == null && indirect_payload == null) @@ -213,7 +210,7 @@ public static List<Fact> MMTFactory(List<dynamic> payload, SOMDoc indirect_paylo ListType ??= SOMDoc.SOMDocType(payload.GetType()); List<Fact> ret = new() { - new DynamicListFact(organizer) + new DynamicListFact() { payload = payload.Select(e => (object) e).ToList(), indirect_payload = indirect_payload, @@ -230,7 +227,7 @@ public static List<Fact> MMTFactory(List<dynamic> payload, SOMDoc indirect_paylo public override MMTFact MakeMMTDeclaration() => Defines() == null ? throw new NotSupportedException(nameof(indirect_payload) + " must not be null") - : new MMTGeneralFact(Label, ListType, Defines()); + : new MMTGeneralFact(_LastLabel, ListType, Defines()); public override SOMDoc Defines() => indirect_payload; @@ -242,7 +239,7 @@ public override SOMDoc Defines() List<Fact> orig = MMTFactory(null, MMTSymbol.defines, MMTSymbol.type, - StageStatic.stage.factState, MMTSymbol.@ref + MMTSymbol.@ref ); ret.AddRange(orig); @@ -270,14 +267,14 @@ protected override string[] GetDependentFactIds() protected override void RecalculateTransform() { } - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new DynamicListFact(payload, indirect_payload?.MapURIs(old_to_new), ListType, organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new DynamicListFact(payload, indirect_payload?.MapURIs(old_to_new), ListType); public IEnumerator UnpackMe(List<Fact> ret, bool BypassServer) { for (int i = 0; i < payload.Count; i++) { - MakeFact(ret, payload[i], SOMDocIndexer(i), _Facts, BypassServer); + MakeFact(ret, payload[i], SOMDocIndexer(i), BypassServer); yield return null; } } @@ -297,12 +294,12 @@ public class TupleFact : FactWrappedCRTP<TupleFact> public TupleFact() : base() { } - public TupleFact(string[] lids, SOMDoc[] payload, FactRecorder organizer) : base(organizer) + public TupleFact(string[] lids, SOMDoc[] payload) : base() { Init(lids, payload); } - public TupleFact(string[] lids, SOMDoc[] payload, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public TupleFact(string[] lids, SOMDoc[] payload, SOMDoc _ServerDefinition) : base() { Init(lids, payload); this.ServerDefinition = _ServerDefinition; @@ -331,11 +328,10 @@ private void Init(string[] lids, SOMDoc[] payload) } } - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) => new TupleFact( lids.Select(id => id == null ? null : old_to_new[id]).ToArray(), - payload.Select(somdoc => somdoc == null ? null : somdoc.MapURIs(old_to_new)).ToArray(), - organizer); + payload.Select(somdoc => somdoc == null ? null : somdoc.MapURIs(old_to_new)).ToArray()); public static new IEnumerable parseFact(List<Fact> ret, MMTFact fact) { @@ -349,13 +345,13 @@ protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, F .Select(oms => (oms as OMS)?.uri) .ToArray(); - ret.Add(new TupleFact(lids, defineOMA.arguments, fact.@ref, StageStatic.stage.factState)); + ret.Add(new TupleFact(lids, defineOMA.arguments, fact.@ref)); } public override MMTFact MakeMMTDeclaration() { SOMDoc Tupel = Defines(); - return new MMTGeneralFact(Label, Tupel.SOMDocType(), Tupel); + return new MMTGeneralFact(_LastLabel, Tupel.SOMDocType(), Tupel); } public override SOMDoc Defines() @@ -391,9 +387,7 @@ public class DynamicTupleFact : FactWrappedCRTP<DynamicTupleFact>, IUnpackable public DynamicTupleFact() : base() { } - private DynamicTupleFact(FactRecorder organizer) : base(organizer) { } - - public static List<Fact> MMTFactory(object payload, SOMDoc indirect_payload, SOMDoc TupleType, FactRecorder organizer, SOMDoc _ServerDefinition = null) + public static List<Fact> MMTFactory(object payload, SOMDoc indirect_payload, SOMDoc TupleType, SOMDoc _ServerDefinition = null) { if (payload == null && indirect_payload == null) @@ -419,7 +413,7 @@ public static List<Fact> MMTFactory(object payload, SOMDoc indirect_payload, SOM if (payload is Tuple<float, float, float> point) { Vector3 vec = new(point.Item1, point.Item2, point.Item3); - ret.Add(new PointFact(vec, vec, organizer)); + ret.Add(new PointFact(vec, vec)); return ret; } //if(payload is Tuple<Tuple<float, float>, Func<float, TIn>, Func<TIn?[..],TOut>> func) @@ -443,9 +437,9 @@ public static List<Fact> MMTFactory(object payload, SOMDoc indirect_payload, SOM )) { Tuple<float, float> domain = (Tuple<float, float>)((ITuple)payload)[0]; - ret.Add(new FunctionFact(SOMDocIndexer(1, 3, indirect_payload), organizer)); - ret.Add(new FunctionFact(SOMDocIndexer(2, 3, indirect_payload), organizer)); - ret.Add(new FunctionCallFact((FunctionFact)ret[1], (FunctionFact)ret[0], (domain.Item1, domain.Item2), organizer)); + ret.Add(new FunctionFact(SOMDocIndexer(1, 3, indirect_payload))); + ret.Add(new FunctionFact(SOMDocIndexer(2, 3, indirect_payload))); + ret.Add(new FunctionCallFact((FunctionFact)ret[1], (FunctionFact)ret[0], (domain.Item1, domain.Item2))); return ret; } } @@ -473,7 +467,7 @@ public static List<Fact> MMTFactory(object payload, SOMDoc indirect_payload, SOM public override MMTFact MakeMMTDeclaration() => Defines() == null ? throw new NotSupportedException(nameof(indirect_payload) + " must not be null") - : new MMTGeneralFact(Label, TupleType, Defines()); + : new MMTGeneralFact(_LastLabel, TupleType, Defines()); public override SOMDoc Defines() => indirect_payload; @@ -486,7 +480,7 @@ public override SOMDoc Defines() ret.AddRange( MMTFactory(null, MMTSymbol.defines, MMTSymbol.type, - StageStatic.stage.factState, MMTSymbol.@ref + MMTSymbol.@ref )); } @@ -533,14 +527,14 @@ protected override string[] GetDependentFactIds() protected override void RecalculateTransform() { } - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => MMTFactory(payload, indirect_payload?.MapURIs(old_to_new), TupleType, organizer)?[0]; + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => MMTFactory(payload, indirect_payload?.MapURIs(old_to_new), TupleType)?[0]; public IEnumerator UnpackMe(List<Fact> ret, bool BypassServer) { for (int i = 0; i < count; i++) { - MakeFact(ret, ((ITuple)payload)[i], SOMDocIndexer(i), _Facts, BypassServer); + MakeFact(ret, ((ITuple)payload)[i], SOMDocIndexer(i), BypassServer); yield return null; } } @@ -552,13 +546,13 @@ public class RealLitFact : FactWrappedCRTP<RealLitFact> public RealLitFact() : base() { } - public RealLitFact(float value, FactRecorder organizer) : base(organizer) + public RealLitFact(float value) : base() { this.value = value; SendToMMT(); } - public RealLitFact(float value, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public RealLitFact(float value, SOMDoc _ServerDefinition) : base() { this.value = value; this.ServerDefinition = _ServerDefinition; @@ -569,7 +563,7 @@ public override MMTFact MakeMMTDeclaration() SOMDoc df = Defines(); return new MMTGeneralFact( - Label, + _LastLabel, df.SOMDocType(), df ); @@ -586,6 +580,6 @@ protected override string[] GetDependentFactIds() protected override void RecalculateTransform() { } - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new RealLitFact(value, organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new RealLitFact(value); } \ No newline at end of file diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/UnsortedFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/UnsortedFact.cs index 5f2302e8e7d4acc13f42333c6e972e7a62ed3089..323b29640d1f4f9e606065aee567a4bfad02b754 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/UnsortedFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/UnsortedFact.cs @@ -5,6 +5,7 @@ using System; using UnityEngine; using System.Collections; +using System.Xml.Linq; /// <summary> /// Point in 3D Space @@ -30,8 +31,7 @@ public PointFact() : base() /// </summary> /// <param name="P">sets <see cref="Point"/></param> /// <param name="N">sets <see cref="Normal"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public PointFact(Vector3 P, Vector3 N, FactRecorder organizer) : base(organizer) + public PointFact(Vector3 P, Vector3 N) : base() { this.Point = P; this.Normal = N; @@ -55,13 +55,11 @@ protected override void RecalculateTransform() /// </summary> /// <param name="point">sets <see cref="Point"/></param> /// <param name="uri">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public PointFact(Vector3 point, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public PointFact(Vector3 point, SOMDoc _ServerDefinition) : base() { this.Point = point; this.Normal = Vector3.up; this.ServerDefinition = _ServerDefinition; - _ = this.Label; } /// \copydoc Fact.parseFact(ScrollFact) @@ -72,7 +70,7 @@ public PointFact(Vector3 point, SOMDoc _ServerDefinition, FactRecorder organizer ParsingDictionary.parseTermsToId.TryAdd(defines.ToString(), fact.@ref.uri); Vector3 point = SOMDoc.MakeVector3(defines); - ret.Add(new PointFact(point, fact.@ref, StageStatic.stage.factState)); + ret.Add(new PointFact(point, fact.@ref)); } /// \copydoc Fact.hasDependentFacts @@ -90,14 +88,14 @@ public override int GetHashCode() protected override bool EquivalentWrapped(PointFact f1, PointFact f2) => Math3d.IsApproximatelyEqual(f1.Point, f2.Point); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new PointFact(this.Point, this.Normal, organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new PointFact(this.Point, this.Normal); public override MMTFact MakeMMTDeclaration() { SOMDoc tp = new OMS(MMTConstants.Point); - return new MMTGeneralFact(Label, tp, Defines()); + return new MMTGeneralFact(_LastLabel, tp, Defines()); } public override SOMDoc Defines() @@ -139,8 +137,7 @@ public OnLineFact() : base() /// </summary> /// <param name="pid">sets <see cref="Pid"/></param> /// <param name="rid">sets <see cref="Rid"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public OnLineFact(string pid, string rid, FactRecorder organizer) : base(organizer) + public OnLineFact(string pid, string rid) : base() { this.Pid = pid; this.Rid = rid; @@ -172,13 +169,11 @@ protected override void RecalculateTransform() /// <param name="pid">sets <see cref="Pid"/></param> /// <param name="rid">sets <see cref="Rid"/></param> /// <param name="uri">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public OnLineFact(string pid, string rid, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public OnLineFact(string pid, string rid, SOMDoc _ServerDefinition) : base() { this.Pid = pid; this.Rid = rid; this.ServerDefinition = _ServerDefinition; - _ = this.Label; } /// \copydoc Fact.parseFact(ScrollFact) @@ -195,12 +190,12 @@ public OnLineFact(string pid, string rid, SOMDoc _ServerDefinition, FactRecorder || !FactRecorder.AllFacts.ContainsKey(lineUri)) yield break; - ret.Add(new OnLineFact(pointUri, lineUri, fact.@ref, StageStatic.stage.factState)); + ret.Add(new OnLineFact(pointUri, lineUri, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => Point.Label + "∈" + Ray.Label; + protected override string generateLabel(FactRecorder name_space) + => Point.GetLabel(name_space) + "∈" + Ray.GetLabel(name_space); /// \copydoc Fact.hasDependentFacts public override bool HasDependentFacts => true; @@ -212,8 +207,8 @@ protected override string[] GetDependentFactIds() protected override bool EquivalentWrapped(OnLineFact f1, OnLineFact f2) => DependentFactsEquivalent(f1, f2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new OnLineFact(old_to_new[this.Pid], old_to_new[this.Rid], organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new OnLineFact(old_to_new[this.Pid], old_to_new[this.Rid]); public override MMTFact MakeMMTDeclaration() { @@ -227,7 +222,7 @@ public override MMTFact MakeMMTDeclaration() new OMS(Pid) }),}); - return new MMTGeneralFact(this.Label, tp, Defines()); + return new MMTGeneralFact(_LastLabel, tp, Defines()); } public override SOMDoc Defines() => null; @@ -261,8 +256,7 @@ public ParallelLineFact() : base() /// </summary> /// <param name="lid1">sets <see cref="Lid1"/></param> /// <param name="lid2">sets <see cref="Lid2"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public ParallelLineFact(string lid1, string lid2, FactRecorder organizer) : base(organizer) + public ParallelLineFact(string lid1, string lid2) : base() { this.Lid1 = lid1; this.Lid2 = lid2; @@ -276,14 +270,12 @@ protected override void RecalculateTransform() { } /// <param name="Lid1">sets <see cref="Lid1"/></param> /// <param name="Lid2">sets <see cref="Lid2"/></param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public ParallelLineFact(string Lid1, string Lid2, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public ParallelLineFact(string Lid1, string Lid2, SOMDoc _ServerDefinition) : base() { this.Lid1 = Lid1; this.Lid2 = Lid2; this.ServerDefinition = _ServerDefinition; - _ = this.Label; } /// \copydoc Fact.parseFact(ScrollFact) @@ -301,12 +293,12 @@ public ParallelLineFact(string Lid1, string Lid2, SOMDoc _ServerDefinition, Fact || !FactRecorder.AllFacts.ContainsKey(lineBUri)) yield break; - ret.Add(new ParallelLineFact(lineAUri, lineBUri, fact.@ref, StageStatic.stage.factState)); + ret.Add(new ParallelLineFact(lineAUri, lineBUri, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => Ray1.Label + "||" + Ray2.Label; + protected override string generateLabel(FactRecorder name_space) + => Ray1.GetLabel(name_space) + "||" + Ray2.GetLabel(name_space); public override MMTFact MakeMMTDeclaration() { @@ -323,7 +315,7 @@ public override MMTFact MakeMMTDeclaration() } ); - return new MMTGeneralFact(this.Label, tp, Defines()); + return new MMTGeneralFact(_LastLabel, tp, Defines()); } public override SOMDoc Defines() => null; @@ -339,8 +331,8 @@ protected override string[] GetDependentFactIds() protected override bool EquivalentWrapped(ParallelLineFact f1, ParallelLineFact f2) => DependentFactsEquivalent(f1, f2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new ParallelLineFact(old_to_new[this.Lid1], old_to_new[this.Lid2], organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new ParallelLineFact(old_to_new[this.Lid1], old_to_new[this.Lid2]); } /// <summary> @@ -383,8 +375,7 @@ public QuadFact() : base() { } /// Initiates <see cref="Pids"/> and creates MMT %Fact Server-Side /// </summary> /// <param name="pid_corners">sets <see cref="Pids"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public QuadFact(string[] pid_corners, FactRecorder organizer) : base(organizer) + public QuadFact(string[] pid_corners) : base() { Init(pid_corners); } @@ -394,13 +385,11 @@ public QuadFact(string[] pid_corners, FactRecorder organizer) : base(organizer) /// </summary> /// <param name="pid_corners">sets <see cref="Pids"/></param> /// <param name="uri">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public QuadFact(string[] pid_corners, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public QuadFact(string[] pid_corners, SOMDoc _ServerDefinition) : base() { Init(pid_corners); this.ServerDefinition = _ServerDefinition; - _ = this.Label; } private void Init(string[] pid_corners) @@ -427,7 +416,7 @@ public override MMTFact MakeMMTDeclaration() { SOMDoc tp = new OMS(MMTConstants.Wall); - return new MMTGeneralFact(Label, tp, Defines()); + return new MMTGeneralFact(_LastLabel, tp, Defines()); } public override SOMDoc Defines() @@ -463,8 +452,8 @@ protected override string[] GetDependentFactIds() protected override void RecalculateTransform() { } - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new QuadFact(Pids.Select(pid => old_to_new[pid]).ToArray(), organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new QuadFact(Pids.Select(pid => old_to_new[pid]).ToArray()); } /// <summary> @@ -499,8 +488,7 @@ public TriangleFact() : base() { } /// Initiates <see cref="Pids"/> and creates MMT %Fact Server-Side /// </summary> /// <param name="pid_corners">sets <see cref="Pids"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public TriangleFact(Vector3[] Verticies, FactRecorder organizer) : base(organizer) + public TriangleFact(Vector3[] Verticies) : base() { Init(Verticies); } @@ -510,13 +498,11 @@ public TriangleFact(Vector3[] Verticies, FactRecorder organizer) : base(organize /// </summary> /// <param name="pid_corners">sets <see cref="Pids"/></param> /// <param name="uri">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public TriangleFact(Vector3[] Verticies, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public TriangleFact(Vector3[] Verticies, SOMDoc _ServerDefinition) : base() { Init(Verticies); this.ServerDefinition = _ServerDefinition; - _ = this.Label; } private void Init(Vector3[] Verticies) @@ -538,7 +524,7 @@ public override MMTFact MakeMMTDeclaration() { SOMDoc tp = new OMS(MMTConstants.Triangle); - return new MMTGeneralFact(Label, tp, Defines()); + return new MMTGeneralFact(_LastLabel, tp, Defines()); } public override SOMDoc Defines() @@ -576,6 +562,6 @@ protected override void RecalculateTransform() //Rotation = Quaternion.LookRotation(Tangents, Vector3.up); } - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new TriangleFact(Verticies, organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new TriangleFact(Verticies); } \ No newline at end of file diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/VolumeFacts.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/VolumeFacts.cs index 158c402f3e7266404926934065c0586815c7223b..192cfa3ed8c930c9ab529e9859092187f39ef2f6 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/VolumeFacts.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/VolumeFacts.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Newtonsoft.Json; using REST_JSON_API; +using UnityEngine.WSA; /// <summary> /// The volume of a cone A defined by a base area <see cref="CircleFact">CircleFact</see>, an apex <see cref="PointFact">PointFact</see> and the volume as float @@ -36,8 +37,7 @@ public ConeVolumeFact() : base() /// <param name="cid1">sets <see cref="Cid1"/></param> /// <param name="pid1">sets <see cref="Pid1"/></param> /// <param name="vol">sets <see cref="volume"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public ConeVolumeFact(string cid1, string pid1, float vol, FactRecorder organizer) : base(organizer) + public ConeVolumeFact(string cid1, string pid1, float vol) : base() { this.Cid1 = cid1; this.Pid1 = pid1; @@ -57,15 +57,13 @@ protected override void RecalculateTransform() /// <param name="Pid1">sets <see cref="Pid1"/></param> /// <param name="volume">sets <see cref="volume"/></param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public ConeVolumeFact(string Cid1, string Pid1, float volume, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public ConeVolumeFact(string Cid1, string Pid1, float volume, SOMDoc _ServerDefinition) : base() { this.Cid1 = Cid1; this.Pid1 = Pid1; this.volume = volume; this.ServerDefinition = _ServerDefinition; - _ = this.Label; } /// \copydoc Fact.parseFact(ScrollFact) @@ -85,19 +83,19 @@ public ConeVolumeFact(string Cid1, string Pid1, float volume, SOMDoc _ServerDefi || !FactRecorder.AllFacts.ContainsKey(PointUri)) yield break; - ret.Add(new ConeVolumeFact(CircleUri, PointUri, volume, fact.@ref, StageStatic.stage.factState)); + ret.Add(new ConeVolumeFact(CircleUri, PointUri, volume, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => "V(" + Circle.Label + "," + Point.Label + ")"; + protected override string generateLabel(FactRecorder name_space) + => "V(" + Circle.GetLabel(name_space) + "," + Point.GetLabel(name_space) + ")"; public override MMTFact MakeMMTDeclaration() { SOMDoc valueTp = new OMS(MMTConstants.RealLit); SOMDoc value = new OMLIT<float>(volume); - return new MMTValueFact(this.Label, Defines(), valueTp, value); + return new MMTValueFact(_LastLabel, Defines(), valueTp, value); } public override SOMDoc Defines() @@ -124,8 +122,8 @@ protected override string[] GetDependentFactIds() protected override bool EquivalentWrapped(ConeVolumeFact f1, ConeVolumeFact f2) => DependentFactsEquivalent(f1, f2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new ConeVolumeFact(old_to_new[this.Cid1], old_to_new[this.Pid1], this.volume, organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new ConeVolumeFact(old_to_new[this.Cid1], old_to_new[this.Pid1], this.volume); } /// <summary> @@ -170,8 +168,7 @@ public TruncatedConeVolumeFact() : base() /// <param name="cid2">sets <see cref="CidTop"/></param> /// <param name="vol">sets <see cref="volume"/></param> /// <param name="proof">sets <see cref="proof"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public TruncatedConeVolumeFact(string cid1, string cid2, float vol, string unequalproof, OMA proof, FactRecorder organizer) : base(organizer) + public TruncatedConeVolumeFact(string cid1, string cid2, float vol, string unequalproof, OMA proof) : base() { this.CidBase = cid1; this.CidTop = cid2; @@ -194,8 +191,7 @@ protected override void RecalculateTransform() /// <param name="volume">sets <see cref="volume"/></param> /// <param name="proof">sets <see cref="proof"/></param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public TruncatedConeVolumeFact(string Cid1, string Cid2, float volume, string unequalproof, OMA proof, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public TruncatedConeVolumeFact(string Cid1, string Cid2, float volume, string unequalproof, OMA proof, SOMDoc _ServerDefinition) : base() { this.CidBase = Cid1; this.CidTop = Cid2; @@ -204,7 +200,6 @@ public TruncatedConeVolumeFact(string Cid1, string Cid2, float volume, string un this.unequalCirclesProof = unequalproof; this.ServerDefinition = _ServerDefinition; - _ = this.Label; } /// \copydoc Fact.parseFact(ScrollFact) @@ -221,19 +216,19 @@ public TruncatedConeVolumeFact(string Cid1, string Cid2, float volume, string un || !FactRecorder.AllFacts.ContainsKey(Circle2Uri)) yield break; - ret.Add(new TruncatedConeVolumeFact(Circle1Uri, Circle2Uri, volume, UnEqualCirclesProof, proof, fact.@ref, StageStatic.stage.factState)); + ret.Add(new TruncatedConeVolumeFact(Circle1Uri, Circle2Uri, volume, UnEqualCirclesProof, proof, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => "V(" + CircleBase.Label + "," + CircleTop.Label + ")"; + protected override string generateLabel(FactRecorder name_space) + => "V(" + CircleBase.GetLabel(name_space) + "," + CircleTop.GetLabel(name_space) + ")"; public override MMTFact MakeMMTDeclaration() { SOMDoc valueTp = new OMS(MMTConstants.RealLit); SOMDoc value = new OMLIT<float>(volume); - return new MMTValueFact(this.Label, Defines(), valueTp, value); + return new MMTValueFact(_LastLabel, Defines(), valueTp, value); } public override SOMDoc Defines() @@ -258,8 +253,8 @@ protected override string[] GetDependentFactIds() protected override bool EquivalentWrapped(TruncatedConeVolumeFact f1, TruncatedConeVolumeFact f2) => DependentFactsEquivalent(f1, f2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new TruncatedConeVolumeFact(old_to_new[this.CidBase], old_to_new[this.CidTop], this.volume, old_to_new[this.unequalCirclesProof], this.proof, organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new TruncatedConeVolumeFact(old_to_new[this.CidBase], old_to_new[this.CidTop], this.volume, old_to_new[this.unequalCirclesProof], this.proof); } /// <summary> @@ -302,8 +297,7 @@ public CylinderVolumeFact() : base() /// <param name="cid2">sets <see cref="Cid2"/></param> /// <param name="vol">sets <see cref="volume"/></param> /// <param name="proof">sets <see cref="proof"/></param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public CylinderVolumeFact(string cid1, string cid2, float vol, string eqProof, OMA proof, FactRecorder organizer) : base(organizer) + public CylinderVolumeFact(string cid1, string cid2, float vol, string eqProof, OMA proof) : base() { this.Cid1 = cid1; this.Cid2 = cid2; @@ -326,8 +320,7 @@ protected override void RecalculateTransform() /// <param name="volume">sets <see cref="volume"/></param> /// <param name="proof">sets <see cref="proof"/></param> /// <param name="backendURI">MMT URI</param> - /// <param name="organizer">sets <see cref="Fact._Facts"/></param> - public CylinderVolumeFact(string Cid1, string Cid2, float volume, string eqProof, OMA proof, SOMDoc _ServerDefinition, FactRecorder organizer) : base(organizer) + public CylinderVolumeFact(string Cid1, string Cid2, float volume, string eqProof, OMA proof, SOMDoc _ServerDefinition) : base() { this.Cid1 = Cid1; this.Cid2 = Cid2; @@ -336,7 +329,6 @@ public CylinderVolumeFact(string Cid1, string Cid2, float volume, string eqProof this.equalCirclesProof = eqProof; this.ServerDefinition = _ServerDefinition; - _ = this.Label; } /// \copydoc Fact.parseFact(ScrollFact) @@ -353,19 +345,19 @@ public CylinderVolumeFact(string Cid1, string Cid2, float volume, string eqProof || !FactRecorder.AllFacts.ContainsKey(Circle2Uri)) yield break; - ret.Add(new CylinderVolumeFact(Circle1Uri, Circle2Uri, volume, EqualCirclesProof, proof, fact.@ref, StageStatic.stage.factState)); + ret.Add(new CylinderVolumeFact(Circle1Uri, Circle2Uri, volume, EqualCirclesProof, proof, fact.@ref)); } /// \copydoc Fact.generateLabel - protected override string generateLabel() - => "V(" + Circle1.Label + "," + Circle2.Label + ")"; + protected override string generateLabel(FactRecorder name_space) + => "V(" + Circle1.GetLabel(name_space) + "," + Circle2.GetLabel(name_space) + ")"; public override MMTFact MakeMMTDeclaration() { SOMDoc valueTp = new OMS(MMTConstants.RealLit); SOMDoc value = new OMLIT<float>(volume); - return new MMTValueFact(this.Label, Defines(), valueTp, value); + return new MMTValueFact(_LastLabel, Defines(), valueTp, value); } public override SOMDoc Defines() @@ -391,6 +383,6 @@ protected override string[] GetDependentFactIds() protected override bool EquivalentWrapped(CylinderVolumeFact f1, CylinderVolumeFact f2) => DependentFactsEquivalent(f1, f2); - protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer) - => new CylinderVolumeFact(old_to_new[this.Cid1], old_to_new[this.Cid2], this.volume, old_to_new[this.equalCirclesProof], this.proof, organizer); + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) + => new CylinderVolumeFact(old_to_new[this.Cid1], old_to_new[this.Cid2], this.volume, old_to_new[this.equalCirclesProof], this.proof); } \ No newline at end of file diff --git a/Assets/Scripts/InteractionEngine/TBD/CanonBallCalculator2D.cs b/Assets/Scripts/InteractionEngine/TBD/CanonBallCalculator2D.cs index 49349cff75df07d9a416bd4b3b928c022b593ea5..16a45134198e63628175765defd0369be2d7e53b 100644 --- a/Assets/Scripts/InteractionEngine/TBD/CanonBallCalculator2D.cs +++ b/Assets/Scripts/InteractionEngine/TBD/CanonBallCalculator2D.cs @@ -147,7 +147,7 @@ float SolveForDistanceOnPlane(Vector3 Pos, Vector3 Vel, LineFact Top, float t) return dir.magnitude * Math.Sign(dot); }; - var Result_Movement = new FunctionFact(BuildOMA_XVA(), FactOrganizer); + var Result_Movement = new FunctionFact(BuildOMA_XVA()); Result_MovementFunc_Id = FactOrganizer.Add(Result_Movement, out _, false, null, null); Vector3 PlaneNorm = Vector3.zero; @@ -179,12 +179,12 @@ float SolveForDistanceOnPlane(Vector3 Pos, Vector3 Vel, LineFact Top, float t) Result_ArgsFunc_Id.Add( FactOrganizer.Add( - new FunctionFact(BuildOMAPath(pos, vel, last_t - (float)Math3d.vectorPrecission), FactOrganizer), + new FunctionFact(BuildOMAPath(pos, vel, last_t - (float)Math3d.vectorPrecission)), out _, true, null, null)); Result_FuncCall_Id.Add( FactOrganizer.Add( - new FunctionCallFact(Result_MovementFunc_Id, Result_ArgsFunc_Id.Last(), (-(float)Math3d.vectorPrecission + last_t, next_t + last_t), FactOrganizer), + new FunctionCallFact(Result_MovementFunc_Id, Result_ArgsFunc_Id.Last(), (-(float)Math3d.vectorPrecission + last_t, next_t + last_t)), out _, true, null, null)); if (hits.Length == 0) diff --git a/Assets/Scripts/InteractionEngine/TBD/CanonBallCalculator3D.cs b/Assets/Scripts/InteractionEngine/TBD/CanonBallCalculator3D.cs index aa16e5ae7e4a8436ab5ad0a6388ae8ab35739824..4ad5378bfaebc1264b8a29192de3da7c5d17838b 100644 --- a/Assets/Scripts/InteractionEngine/TBD/CanonBallCalculator3D.cs +++ b/Assets/Scripts/InteractionEngine/TBD/CanonBallCalculator3D.cs @@ -224,7 +224,7 @@ bool HitOnPlane(Vector3 Pos, Vector3 Vel, QuadFact Top, float t) return true; }; - var Result_Movement = new FunctionFact(BuildOMA_XVA(), FactOrganizer); + var Result_Movement = new FunctionFact(BuildOMA_XVA()); Result_MovementFunc_Id = FactOrganizer.Add(Result_Movement, out _, false, null, null); Vector3 PlaneNorm = Vector3.zero; @@ -254,12 +254,12 @@ bool HitOnPlane(Vector3 Pos, Vector3 Vel, QuadFact Top, float t) Result_ArgsFunc_Id.Add( FactOrganizer.Add( - new FunctionFact(BuildOMAPath(pos, vel, last_t - (float)Math3d.vectorPrecission), FactOrganizer), + new FunctionFact(BuildOMAPath(pos, vel, last_t - (float)Math3d.vectorPrecission)), out _, true, null, null)); Result_FuncCall_Id.Add( FactOrganizer.Add( - new FunctionCallFact(Result_MovementFunc_Id, Result_ArgsFunc_Id.Last(), (-(float)Math3d.vectorPrecission + last_t, next_t + last_t), FactOrganizer), + new FunctionCallFact(Result_MovementFunc_Id, Result_ArgsFunc_Id.Last(), (-(float)Math3d.vectorPrecission + last_t, next_t + last_t)), out _, true, null, null)); if (hits.Length == 0) diff --git a/Assets/Scripts/InventoryStuff/DisplayFacts.cs b/Assets/Scripts/InventoryStuff/DisplayFacts.cs index 9a5f242d61e6df58ce611432f21f929bd1e506ba..fcff0fcef4eb0cf8224269261b1d5961e8a79683 100644 --- a/Assets/Scripts/InventoryStuff/DisplayFacts.cs +++ b/Assets/Scripts/InventoryStuff/DisplayFacts.cs @@ -214,7 +214,7 @@ public int Compare(Fact x, Fact y) else if (true) // keep auto format // Types in List and same if (0 != (ret = x.DependentFactIds.Zip(y.DependentFactIds, (x, y) => string.Compare(x, y)).Aggregate(0, (r1, r2) => r1 + r2))) ; else - if (0 != (ret = string.Compare(x.Label, y.Label))) ; + if (0 != (ret = string.Compare(x._LastLabel, y._LastLabel))) ; #pragma warning restore CS0642 // Möglicherweise falsche leere Anweisung diff --git a/Assets/Scripts/MMTServer/CommunicationProtocoll/SOMDocs.cs b/Assets/Scripts/MMTServer/CommunicationProtocoll/SOMDocs.cs index 2c3aa1122a0a9180f5f91e44c59119f5993c30b9..d696f73e7a4c9951063525b4cd6dd86c872cbbc5 100644 --- a/Assets/Scripts/MMTServer/CommunicationProtocoll/SOMDocs.cs +++ b/Assets/Scripts/MMTServer/CommunicationProtocoll/SOMDocs.cs @@ -805,7 +805,7 @@ protected internal override Type ToType(Type[] args, (string name, Type type)[] // temporary fix if Serialzation is broken public class FallbackWrapper : SOMDocCRTP<FallbackWrapper> { - public new string kind = "SFunction"; + public new string kind = "Wrapper"; public SOMDoc Wrapper; diff --git a/Assets/Scripts/StageBehaviour.cs b/Assets/Scripts/StageBehaviour.cs index f0d878fef2da5b4fe38ea9e03493223373e1bed8..4ca3d8c0c3162f10b72c4726ee38e61f0e6e2a7b 100644 --- a/Assets/Scripts/StageBehaviour.cs +++ b/Assets/Scripts/StageBehaviour.cs @@ -36,8 +36,7 @@ public static List<TriangleFact> GenerateMMTCollider(GameObject obj = null) _Transform(coll.sharedMesh.vertices[coll.sharedMesh.triangles[i + 1]], coll.transform.localToWorldMatrix), _Transform(coll.sharedMesh.vertices[coll.sharedMesh.triangles[i + 2]], coll.transform.localToWorldMatrix), }, - null, - StageStatic.stage.factState) + null) ); } }