Newer
Older
this.unequalCirclesProof = null;
this.proof = null;
}
/// <summary>
/// Standard Constructor:
/// Initiates members and creates MMT %Fact Server-Side
/// </summary>
/// <param name="cid1">sets <see cref="Cid1"/></param>
/// <param name="cid2">sets <see cref="Cid2"/></param>
/// <param name="vol">sets <see cref="vol"/></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, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = cid1;
this.Cid2 = cid2;
this.proof = proof;
this.unequalCirclesProof = unequalproof;
AddFactResponse.sendAdd(MakeMMTDeclaration(), out this._URI);
{
Position = Circle2.Position;
Rotation = Circle2.Rotation;
}
/// <summary>
/// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_.
/// </summary>
/// <param name="Cid1">sets <see cref="Cid1"/></param>
/// <param name="Cid2">sets <see cref="Cid2"/></param>
/// <param name="volume">sets <see cref="vol"/></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, string backendURI, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = Cid1;
this.Cid2 = Cid2;
this.vol = volume;
this.proof = proof;
this.unequalCirclesProof = unequalproof;
this._URI = backendURI;
_ = this.Label;
}
/// \copydoc Fact.parseFact(Scroll.ScrollFact)
public new static TruncatedConeVolumeFact parseFact(Scroll.ScrollFact fact)
{
string uri = fact.@ref.uri;
string Circle1Uri = ((OMS)((OMA)((OMA)((Scroll.ScrollValueFact)fact).lhs).arguments[0]).arguments[0]).uri;
string Circle2Uri = ((OMS)((OMA)((OMA)((Scroll.ScrollValueFact)fact).lhs).arguments[0]).arguments[1]).uri;
float volume = ((OMF)((Scroll.ScrollValueFact)fact).value).f;
string UnEqualCirclesProof = ((OMS)(((OMA)((OMA)((Scroll.ScrollValueFact)fact).lhs).arguments[0]).arguments[2])).uri;
OMA proof = (OMA)(((OMA)((OMA)((Scroll.ScrollValueFact)fact).lhs).arguments[0]).arguments[3]);
if (StageStatic.stage.factState.ContainsKey(Circle1Uri) && StageStatic.stage.factState.ContainsKey(Circle2Uri))
return new TruncatedConeVolumeFact(Circle1Uri, Circle2Uri, volume, UnEqualCirclesProof, proof, uri, StageStatic.stage.factState);
else //If dependent facts do not exist return null
return null;
}
/// \copydoc Fact.generateLabel
protected override string generateLabel()
protected override MMTDeclaration MakeMMTDeclaration()
MaZiFAU
committed
SOMDoc lhs =
MaZiFAU
committed
new OMS(MMT_OMS_URI.TruncatedVolumeCone),
MaZiFAU
committed
new List<SOMDoc> {
new OMS(Cid1),
new OMS(Cid2),
new OMS(unequalCirclesProof),
proof,
}
);
MaZiFAU
committed
SOMDoc valueTp = new OMS(MMT_OMS_URI.RealLit);
return new MMTValueDeclaration(this.Label, lhs, valueTp, value);
}
/// \copydoc Fact.hasDependentFacts
public override Boolean hasDependentFacts()
/// \copydoc Fact.getDependentFactIds
public override string[] getDependentFactIds()
/// \copydoc Fact.instantiateDisplay(GameObject, Transform)
public override GameObject instantiateDisplay(GameObject prefab, Transform transform)
{
var obj = GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity, transform);
obj.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().text = Circle1.Label + Circle2.Label;
obj.GetComponent<FactWrapper>().fact = this;
return obj;
}
/// \copydoc Fact.Equivalent(Fact, Fact)
protected override bool EquivalentWrapped(TruncatedConeVolumeFact f1, TruncatedConeVolumeFact f2)
protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactOrganizer organizer)
=> new TruncatedConeVolumeFact(old_to_new[this.Cid1], old_to_new[this.Cid2], this.vol, old_to_new[this.unequalCirclesProof], this.proof, organizer);
/// <summary>
/// The volume of a cylinder defined by a base area <see cref="CircleFact">CircleFact</see>, a top area <see cref="CircleFact">CircleFact</see> and the volume as float
/// </summary>
public class CylinderVolumeFact : FactWrappedCRTP<CylinderVolumeFact>
{
/// <summary> a <see cref="CircleFact">CircleFact</see> describing the base area </summary>
public string Cid1;
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle1 { get => (CircleFact)FactOrganizer.AllFacts[Cid1]; }
MaZiFAU
committed
/// <summary> a <see cref="CircleFact">CircleFact</see> describing the top area </summary>
public string Cid2;
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle2 { get => (CircleFact)FactOrganizer.AllFacts[Cid2]; }
MaZiFAU
committed
/// <summary> the volume of the cylinder as a float </summary>
public float vol;
/// <summary> a proof that both circles have the same size </summary>
public string equalCirclesProof;
/// <summary> OMA proof that the two circles are parallel </summary>
public OMA proof;
/// <summary> \copydoc Fact.Fact </summary>
public CylinderVolumeFact() : base()
{
this.Cid1 = null;
this.Cid2 = null;
this.vol = 0.0f;
this.proof = null;
this.equalCirclesProof = null;
}
/// <summary>
/// Standard Constructor:
/// Initiates members and creates MMT %Fact Server-Side
/// </summary>
/// <param name="cid1">sets <see cref="Cid1"/></param>
/// <param name="cid2">sets <see cref="Cid2"/></param>
/// <param name="vol">sets <see cref="vol"/></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, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = cid1;
this.Cid2 = cid2;
this.proof = proof;
this.equalCirclesProof = eqProof;
this.vol = vol;
AddFactResponse.sendAdd(MakeMMTDeclaration(), out this._URI);
{
Position = Circle2.Position;
Rotation = Circle2.Rotation;
}
/// <summary>
/// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_.
/// </summary>
/// <param name="Cid1">sets <see cref="Cid1"/></param>
/// <param name="Cid2">sets <see cref="Cid2"/></param>
/// <param name="volume">sets <see cref="vol"/></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, string backendURI, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = Cid1;
this.Cid2 = Cid2;
this.vol = volume;
this.proof = proof;
this.equalCirclesProof = eqProof;
this._URI = backendURI;
_ = this.Label;
}
/// \copydoc Fact.parseFact(Scroll.ScrollFact)
public new static CylinderVolumeFact parseFact(Scroll.ScrollFact fact)
{
string uri = fact.@ref.uri;
string Circle1Uri = ((OMS)((OMA)((OMA)((Scroll.ScrollValueFact)fact).lhs).arguments[0]).arguments[0]).uri;
string Circle2Uri = ((OMS)((OMA)((OMA)((Scroll.ScrollValueFact)fact).lhs).arguments[0]).arguments[1]).uri;
float volume = ((OMF)((Scroll.ScrollValueFact)fact).value).f;
string EqualCirclesProof = ((OMS)(((OMA)((OMA)((Scroll.ScrollValueFact)fact).lhs).arguments[0]).arguments[2])).uri;
OMA proof = (OMA)(((OMA)((OMA)((Scroll.ScrollValueFact)fact).lhs).arguments[0]).arguments[3]);
if (StageStatic.stage.factState.ContainsKey(Circle1Uri) && StageStatic.stage.factState.ContainsKey(Circle2Uri))
return new CylinderVolumeFact(Circle1Uri, Circle2Uri, volume, EqualCirclesProof, proof, uri, StageStatic.stage.factState);
else //If dependent facts do not exist return null
return null;
}
/// \copydoc Fact.generateLabel
protected override string generateLabel()
protected override MMTDeclaration MakeMMTDeclaration()
MaZiFAU
committed
SOMDoc lhs =
new OMA(
MaZiFAU
committed
new OMS(MMT_OMS_URI.CylinderVolume),
MaZiFAU
committed
new List<SOMDoc> {
new OMS(Cid1),
new OMS(Cid2),
new OMS(equalCirclesProof),
proof,
}
);
MaZiFAU
committed
SOMDoc valueTp = new OMS(MMT_OMS_URI.RealLit);
return new MMTValueDeclaration(this.Label, lhs, valueTp, value);
}
/// \copydoc Fact.hasDependentFacts
/// \copydoc Fact.getDependentFactIds
public override string[] getDependentFactIds()
=> new string[] { Cid1, Cid2, equalCirclesProof };
/// \copydoc Fact.instantiateDisplay(GameObject, Transform)
public override GameObject instantiateDisplay(GameObject prefab, Transform transform)
{
var obj = GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity, transform);
obj.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().text = Circle1.Label + Circle2.Label;
obj.GetComponent<FactWrapper>().fact = this;
return obj;
}
/// \copydoc Fact.Equivalent(Fact, Fact)
protected override bool EquivalentWrapped(CylinderVolumeFact f1, CylinderVolumeFact f2)
protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactOrganizer organizer)
=> new CylinderVolumeFact(old_to_new[this.Cid1], old_to_new[this.Cid2], this.vol, old_to_new[this.equalCirclesProof], this.proof, organizer);
/// <summary>
/// A fact that describes, that two circles have the same size and is comprised of two <see cref="CircleFact">CircleFacts</see>
/// </summary>
public class EqualCirclesFact : FactWrappedCRTP<EqualCirclesFact>
{
/// @{ <summary>
/// two circles that are meant to be equal in area
/// </summary>
public string Cid1, Cid2;
/// @}
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle1 { get => (CircleFact)FactOrganizer.AllFacts[Cid1]; }
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle2 { get => (CircleFact)FactOrganizer.AllFacts[Cid2]; }
/// <summary> \copydoc Fact.Fact </summary>
public EqualCirclesFact() : base()
{
this.Cid1 = null;
this.Cid2 = null;
}
/// <summary>
/// Standard Constructor:
/// Initiates members and creates MMT %Fact Server-Side
/// </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, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = cid1;
this.Cid2 = cid2;
AddFactResponse.sendAdd(MakeMMTDeclaration(), out this._URI);
{
Position = Circle1.Position;
Rotation = Circle1.Rotation;
}
/// <summary>
/// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_.
/// </summary>
/// <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, string backendURI, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = Cid1;
this.Cid2 = Cid2;
this._URI = backendURI;
_ = this.Label;
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
}
/// \copydoc Fact.parseFact(Scroll.ScrollFact)
public new static EqualCirclesFact parseFact(Scroll.ScrollFact fact)
{
OMA tp = (OMA)((Scroll.ScrollSymbolFact)fact).tp;
if (tp == null)
return null;
string circleAUri = "";
string circleBUri = "";
string uri = fact.@ref.uri;
OMA proof_OMA = (OMA)((Scroll.ScrollSymbolFact)fact).tp; // proof DED
OMA parallel_circles_OMA = (OMA)proof_OMA.arguments[0]; // parallel
if (parallel_circles_OMA.arguments[0] is OMS)
{
// Normaler Fall
circleAUri = ((OMS)((OMA)((OMA)((Scroll.ScrollSymbolFact)fact).tp).arguments[0]).arguments[0]).uri;
circleBUri = ((OMS)((OMA)((OMA)((Scroll.ScrollSymbolFact)fact).tp).arguments[0]).arguments[1]).uri;
}
if (StageStatic.stage.factState.ContainsKey(circleAUri)
&& StageStatic.stage.factState.ContainsKey(circleBUri))
return new EqualCirclesFact(circleAUri, circleBUri, uri, StageStatic.stage.factState);
else //If dependent facts do not exist return null
return null;
}
/// \copydoc Fact.generateLabel
protected override string generateLabel()
protected override MMTDeclaration MakeMMTDeclaration()
MaZiFAU
committed
SOMDoc tp = new OMA(
MaZiFAU
committed
new List<SOMDoc> {
new OMS(MMT_OMS_URI.EqualityCircles),
MaZiFAU
committed
new List<SOMDoc> {
new OMS(Cid1),
new OMS(Cid2),
MaZiFAU
committed
SOMDoc df = null;
return new MMTSymbolDeclaration(this.Label, tp, df);
}
/// \copydoc Fact.hasDependentFacts
public override Boolean hasDependentFacts()
/// \copydoc Fact.getDependentFactIds
public override string[] getDependentFactIds()
/// \copydoc Fact.instantiateDisplay(GameObject, Transform)
public override GameObject instantiateDisplay(GameObject prefab, Transform transform)
{
var obj = GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity, transform);
obj.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().text = Circle1.Label;
obj.transform.GetChild(1).gameObject.GetComponent<TextMeshProUGUI>().text = Circle2.Label;
obj.GetComponent<FactWrapper>().fact = this;
return obj;
}
/// \copydoc Fact.Equivalent(Fact, Fact)
protected override bool EquivalentWrapped(EqualCirclesFact f1, EqualCirclesFact f2)
protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactOrganizer organizer)
=> new EqualCirclesFact(old_to_new[this.Cid1], old_to_new[this.Cid2], organizer);
}
/// <summary>
/// A fact that describes, that two circles have not the same size and is comprised of two <see cref="CircleFact">CircleFacts</see>
/// </summary>
public class UnEqualCirclesFact : FactWrappedCRTP<UnEqualCirclesFact>
{
/// @{ <summary>
/// two circles that are meant to be unequal in area
/// </summary>
public string Cid1, Cid2;
/// @}
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle1 { get => (CircleFact)FactOrganizer.AllFacts[Cid1]; }
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle2 { get => (CircleFact)FactOrganizer.AllFacts[Cid2]; }
/// <summary> \copydoc Fact.Fact </summary>
public UnEqualCirclesFact() : base()
{
this.Cid1 = null;
this.Cid2 = null;
}
/// <summary>
/// Standard Constructor:
/// Initiates members and creates MMT %Fact Server-Side
/// </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, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = cid1;
this.Cid2 = cid2;
AddFactResponse.sendAdd(MakeMMTDeclaration(), out this._URI);
{
Position = Circle2.Position;
Rotation = Circle2.Rotation;
}
/// <summary>
/// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_.
/// </summary>
/// <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, string backendURI, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = Cid1;
this.Cid2 = Cid2;
this._URI = backendURI;
_ = this.Label;
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
}
/// \copydoc Fact.parseFact(Scroll.ScrollFact)
public new static UnEqualCirclesFact parseFact(Scroll.ScrollFact fact)
{
OMA tp = (OMA)((Scroll.ScrollSymbolFact)fact).tp;
if (tp == null)
return null;
string circleAUri = "";
string circleBUri = "";
string uri = fact.@ref.uri;
OMA proof_OMA = (OMA)((Scroll.ScrollSymbolFact)fact).tp; // proof DED
OMA unequal_circles_OMA = (OMA)proof_OMA.arguments[0]; // unequal
if (unequal_circles_OMA.arguments[0] is OMS)
{
// Normaler Fall
circleAUri = ((OMS)((OMA)((OMA)((Scroll.ScrollSymbolFact)fact).tp).arguments[0]).arguments[0]).uri;
circleBUri = ((OMS)((OMA)((OMA)((Scroll.ScrollSymbolFact)fact).tp).arguments[0]).arguments[1]).uri;
}
if (StageStatic.stage.factState.ContainsKey(circleAUri)
&& StageStatic.stage.factState.ContainsKey(circleBUri))
return new UnEqualCirclesFact(circleAUri, circleBUri, uri, StageStatic.stage.factState);
else //If dependent facts do not exist return null
return null;
}
/// \copydoc Fact.generateLabel
protected override string generateLabel()
protected override MMTDeclaration MakeMMTDeclaration()
MaZiFAU
committed
SOMDoc tp = new OMA(
MaZiFAU
committed
new List<SOMDoc> {
new OMA(new OMS(MMT_OMS_URI.UnEqualityCircles),
MaZiFAU
committed
new List<SOMDoc> {
new OMS(Cid1),
new OMS(Cid2),
MaZiFAU
committed
SOMDoc df = null;
return new MMTSymbolDeclaration(this.Label, tp, df);
}
/// \copydoc Fact.hasDependentFacts
public override Boolean hasDependentFacts()
/// \copydoc Fact.getDependentFactIds
public override string[] getDependentFactIds()
/// \copydoc Fact.instantiateDisplay(GameObject, Transform)
public override GameObject instantiateDisplay(GameObject prefab, Transform transform)
{
var obj = GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity, transform);
obj.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().text = Circle1.Label;
obj.transform.GetChild(1).gameObject.GetComponent<TextMeshProUGUI>().text = Circle2.Label;
obj.GetComponent<FactWrapper>().fact = this;
return obj;
}
/// \copydoc Fact.Equivalent(Fact, Fact)
protected override bool EquivalentWrapped(UnEqualCirclesFact f1, UnEqualCirclesFact f2)
protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactOrganizer organizer)
=> new UnEqualCirclesFact(old_to_new[this.Cid1], old_to_new[this.Cid2], 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>
public TestFact(FactOrganizer organizer) : base(organizer)
// mmtDecl = generateCircleFactDeclaration(p1URI, p2URI, radius, normal);
AddFactResponse.sendAdd(MakeMMTDeclaration(), out this._URI);
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, FactOrganizer organizer) : base(organizer)
this._URI = backendURI;
_ = this.Label;
}
/// <summary>
/// parses the Circlefact response of the MMT-Server
/// </summary>
/// \copydoc Fact.parseFact(Scroll.ScrollFact)
public new static TestFact parseFact(Scroll.ScrollFact fact)
{
string uri = fact.@ref.uri;
Debug.Log("TestFact Uri:" + uri);
return new TestFact(uri, StageStatic.stage.factState);
}
/// \copydoc Fact.generateLabel
protected override string generateLabel()
{
}
/// \copydoc Fact.hasDependentFacts
public override bool hasDependentFacts()
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
{
return false;
}
/// \copydoc Fact.getDependentFactIds
public override string[] getDependentFactIds()
{
return new string[] { };
}
/// \copydoc Fact.instantiateDisplay(GameObject, Transform)
public override GameObject instantiateDisplay(GameObject prefab, Transform transform)
{
var obj = GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity, transform);
// obj.transform.GetChild(1).gameObject.GetComponent<TextMeshProUGUI>().text = _Facts[this.Lid2].Label;
obj.GetComponent<FactWrapper>().fact = this;
return obj;
}
/// \copydoc Fact.GetHashCode
public override int GetHashCode()
{
return 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, FactOrganizer organizer)
=> new TestFact(organizer);
protected override MMTDeclaration MakeMMTDeclaration()
{
throw new NotImplementedException();
}
}
#pragma warning restore // Testing over