From 48efe99494960178f2e0520feea0bfee158d641d Mon Sep 17 00:00:00 2001 From: "Marco Zimmer (MaZiFAU)" <marco.alexander.zimmer@fau.de> Date: Mon, 2 Aug 2021 17:35:14 +0200 Subject: [PATCH] +FactOrganizer: changed Key to URI --- Assets/Scripts/InteractionEngine/Fact.cs | 16 ++++++++++++- .../Scripts/InteractionEngine/FactManager.cs | 24 +------------------ 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/Assets/Scripts/InteractionEngine/Fact.cs b/Assets/Scripts/InteractionEngine/Fact.cs index f26c8e07..e7709422 100644 --- a/Assets/Scripts/InteractionEngine/Fact.cs +++ b/Assets/Scripts/InteractionEngine/Fact.cs @@ -84,7 +84,7 @@ public void rename(string newLabel) public virtual void delete() { - //TODO: MMT + //TODO: MMT: delete over there } public abstract bool Equivalent(Fact f2); @@ -98,6 +98,20 @@ public virtual void delete() protected string generateLetter() { return ((char)(64 + LabelId++ + 1)).ToString(); + + /* Keeping track of free Ids + private static List<int> NextEmpties = new List<int>(); + NextEmpties.Add(LabelId++); + + public int GetFirstEmptyID() + { + NextEmpties.Sort(); + + int id = NextEmpties[0]; + NextEmpties.RemoveAt(0); + if (NextEmpties.Count == 0) + NextEmpties.Add(LabelId++); + }*/ } } diff --git a/Assets/Scripts/InteractionEngine/FactManager.cs b/Assets/Scripts/InteractionEngine/FactManager.cs index 8f448fc0..89a6cc7d 100644 --- a/Assets/Scripts/InteractionEngine/FactManager.cs +++ b/Assets/Scripts/InteractionEngine/FactManager.cs @@ -7,15 +7,7 @@ public class FactManager : MonoBehaviour { - private List<int> NextEmpties = new List<int>(); - - // Start is called before the first frame update - void Start() - { - NextEmpties.Add(0); - } - - //TODO! communicate success + //TODO! communicate success/ failure public static Fact AddFactIfNotFound(Fact fact, out bool exists, bool samestep) { return Facts[Facts.Add(fact, out exists, samestep)]; @@ -75,23 +67,9 @@ void AddHitIfOnLine(RaycastHit hit) return rayFact; } - public AngleFact AddAngleFact(string pid1, string pid2, string pid3, bool samestep = false) { return (AngleFact)AddFactIfNotFound(new AngleFact(pid1, pid2, pid3), out bool obsolete, samestep); } - public int GetFirstEmptyID() - { - NextEmpties.Sort(); - - int id = NextEmpties[0]; - NextEmpties.RemoveAt(0); - if (NextEmpties.Count == 0) - NextEmpties.Add(id + 1); - - Debug.Log("place fact at " + id); - - return id; - } } -- GitLab