Skip to content
Snippets Groups Projects
Commit 48efe994 authored by Marco Zimmer's avatar Marco Zimmer
Browse files

+FactOrganizer: changed Key to URI

parent 323e2574
No related branches found
No related tags found
No related merge requests found
...@@ -84,7 +84,7 @@ public void rename(string newLabel) ...@@ -84,7 +84,7 @@ public void rename(string newLabel)
public virtual void delete() public virtual void delete()
{ {
//TODO: MMT //TODO: MMT: delete over there
} }
public abstract bool Equivalent(Fact f2); public abstract bool Equivalent(Fact f2);
...@@ -98,6 +98,20 @@ public virtual void delete() ...@@ -98,6 +98,20 @@ public virtual void delete()
protected string generateLetter() protected string generateLetter()
{ {
return ((char)(64 + LabelId++ + 1)).ToString(); 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++);
}*/
} }
} }
......
...@@ -7,15 +7,7 @@ ...@@ -7,15 +7,7 @@
public class FactManager : MonoBehaviour public class FactManager : MonoBehaviour
{ {
private List<int> NextEmpties = new List<int>(); //TODO! communicate success/ failure
// Start is called before the first frame update
void Start()
{
NextEmpties.Add(0);
}
//TODO! communicate success
public static Fact AddFactIfNotFound(Fact fact, out bool exists, bool samestep) public static Fact AddFactIfNotFound(Fact fact, out bool exists, bool samestep)
{ {
return Facts[Facts.Add(fact, out exists, samestep)]; return Facts[Facts.Add(fact, out exists, samestep)];
...@@ -75,23 +67,9 @@ void AddHitIfOnLine(RaycastHit hit) ...@@ -75,23 +67,9 @@ void AddHitIfOnLine(RaycastHit hit)
return rayFact; return rayFact;
} }
public AngleFact AddAngleFact(string pid1, string pid2, string pid3, bool samestep = false) public AngleFact AddAngleFact(string pid1, string pid2, string pid3, bool samestep = false)
{ {
return (AngleFact)AddFactIfNotFound(new AngleFact(pid1, pid2, pid3), out bool obsolete, samestep); 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;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment