Newer
Older
MaZiFAU
committed
SOMDoc tp = new OMS(MMTConstants.Wall);
SOMDoc df = new OMA(
new OMS(MMTConstants.CreateWall),
Pids.Select(pid => new OMS(pid)).ToArray()
MaZiFAU
committed
); ;
return new MMTGeneralFact(Label, tp, df);
protected override bool EquivalentWrapped(QuadFact f1, QuadFact f2)
if (f1.Points.Length != f2.Points.Length)
return false;
int i = 0;
for (; i < f2.Points.Length; i++) // 1st incedence
if (f2.Points[i].Equivalent(f1.Points[0]))
break;
if (i == f2.Points.Length) // no match
return false;
for (int j = 1; j < f2.Points.Length; j++) // cyclic match
if (!f2.Points[(i + j) % f2.Points.Length].Equivalent(f1.Points[j]))
return false;
return true;
MaZiFAU
committed
public override bool HasDependentFacts => true;
protected override string[] GetDependentFactIds()
=> Pids;
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);
#pragma warning disable // Testing...
/// use this if you need to test certain implementations of facts.
/// </summary>
public class TestFact : FactWrappedCRTP<TestFact>
{
/// <summary> \copydoc Fact.Fact </summary>
public TestFact() : base()
{
/// 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>
protected override void RecalculateTransform() { }
/// <summary>
/// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_.
/// </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="backendURI">MMT URI</param>
/// <param name="organizer">sets <see cref="Fact._Facts"/></param>
public TestFact(string backendURI, FactRecorder organizer) : base(organizer)
this.ServerDefinition = ServerDefinition;
_ = this.Label;
}
/// <summary>
/// parses the Circlefact response of the MMT-Server
/// </summary>
/// \copydoc Fact.parseFact(ScrollFact)
public new static IEnumerator parseFact(List<Fact> ret, MMTFact fact)
{
string uri = fact.@ref.uri;
Debug.Log("TestFact Uri:" + uri);
ret.Add(new TestFact(uri, StageStatic.stage.factState));
yield break;
}
/// \copydoc Fact.generateLabel
=> "test";
/// \copydoc Fact.hasDependentFacts
MaZiFAU
committed
public override bool HasDependentFacts => false;
/// \copydoc Fact.getDependentFactIds
protected override string[] GetDependentFactIds()
=> new string[] { };
/// \copydoc Fact.GetHashCode
=> base.GetHashCode();// this.Pid1.GetHashCode() ^ this.Pid2.GetHashCode();
/// \copydoc Fact.Equivalent(Fact, Fact)
protected override bool EquivalentWrapped(TestFact f1, TestFact f2)
{
protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactRecorder organizer)
public override MMTFact MakeMMTDeclaration()
{
throw new NotImplementedException();
}
}
#pragma warning restore // Testing over