Ejemplo n.º 1
0
    public CogwheelEqsysFact(int i, int[] ids)
    {
        this.Id          = i;
        this.CogwheelIds = ids;

        List <MMTTerm> typeArguments = new List <MMTTerm>
        {
            new OMS(MMTURIs.Prop)
        };

        List <int>     cogwheelIdList = new List <int>(this.CogwheelIds);
        List <MMTTerm> listArguments  = new List <MMTTerm>();

        cogwheelIdList
        .Select(cogwheelId =>
                new OMS((GameState.Facts.Find(x => x.Id == cogwheelId) as CogwheelFact).backendURI))
        .ToList()
        .ForEach(oms => listArguments.Add(oms));

        List <MMTTerm> eqsysArguments = new List <MMTTerm>
        {
            new OMA(new OMS(MMTURIs.ListOf), listArguments)
        };

        MMTTerm tp = new OMA(new OMS(MMTURIs.List), typeArguments);
        MMTTerm df = new OMA(new OMS(MMTURIs.CogwheelEquationSystem), eqsysArguments);

        MMTSymbolDeclaration mmtDecl = new MMTSymbolDeclaration(this.Label, tp, df);
        string body = MMTSymbolDeclaration.ToJson(mmtDecl);

        AddFactResponse res = AddFactResponse.sendAdd(GameSettings.ServerAdress + "/fact/add", body);

        this.backendURI = res.uri;
        Debug.Log(this.backendURI);
    }
Ejemplo n.º 2
0
    private void init(string pid, string rid)
    {
        this.Pid = pid;
        this.Rid = rid;

        PointFact pf   = _Facts[pid] as PointFact;
        RayFact   rf   = _Facts[rid] as RayFact;
        string    pURI = pf.Id;
        string    rURI = rf.Id;

        List <MMTTerm> innerArguments = new List <MMTTerm>
        {
            new OMS(rURI),
            new OMS(pURI)
        };

        List <MMTTerm> outerArguments = new List <MMTTerm>
        {
            new OMA(new OMS(MMTURIs.OnLine), innerArguments)
        };

        //OMS constructor generates full URI
        MMTTerm tp = new OMA(new OMS(MMTURIs.Ded), outerArguments);
        MMTTerm df = null;

        MMTSymbolDeclaration mmtDecl = new MMTSymbolDeclaration(this.Label, tp, df);

        AddFactResponse.sendAdd(mmtDecl, out this._URI);
    }
Ejemplo n.º 3
0
    public CogwheelFact(int i, Vector3 P, Vector3 N, float R, float iR, float oR)
    {
        this.Id            = i;
        this.Point         = P;
        this.Normal        = N;
        this.Radius        = R;
        this.InsideRadius  = iR;
        this.OutsideRadius = oR;

        List <MMTTerm> tupleArguments = new List <MMTTerm>
        {
            new OMF(P.x),
            new OMF(P.y),
            new OMF(P.z)
        };

        List <MMTTerm> wheelOfArguments = new List <MMTTerm>
        {
            new OMF(this.Radius),
            new OMF(this.InsideRadius),
            new OMF(this.OutsideRadius),
            new OMA(new OMS(MMTURIs.Tuple), tupleArguments)
        };

        MMTTerm tp = new OMS(MMTURIs.Cogwheel);
        MMTTerm df = new OMA(new OMS(MMTURIs.CogwheelOf), wheelOfArguments);

        MMTSymbolDeclaration mmtDecl = new MMTSymbolDeclaration(this.Label, tp, df);
        string body = MMTSymbolDeclaration.ToJson(mmtDecl);

        AddFactResponse res = AddFactResponse.sendAdd(GameSettings.ServerAdress + "/fact/add", body);

        this.backendURI = res.uri;
        Debug.Log(this.backendURI);
    }
Ejemplo n.º 4
0
    private MMTDeclaration generate90DegreeAngleDeclaration(float val, string p1URI, string p2URI, string p3URI)
    {
        MMTTerm argument = new OMA(
            new OMS(MMTURIs.Eq),
            new List <MMTTerm> {
            new OMS(MMTURIs.RealLit),
            new OMA(
                new OMS(MMTURIs.Angle),
                new List <MMTTerm> {
                new OMS(p1URI),
                new OMS(p2URI),
                new OMS(p3URI)
            }
                ),
            new OMF(val)     // 90f
        }
            );

        MMTTerm tp = new OMA(new OMS(MMTURIs.Ded), new List <MMTTerm> {
            argument
        });
        MMTTerm df = null;

        return(new MMTSymbolDeclaration(this.Label, tp, df));
    }
Ejemplo n.º 5
0
    private void init(string pid1, string pid2)
    {
        SetDistance();

        PointFact pf1 = _Facts[pid1] as PointFact;
        PointFact pf2 = _Facts[pid2] as PointFact;

        string p1URI = pf1.Id;
        string p2URI = pf2.Id;
        float  v     = (pf1.Point - pf2.Point).magnitude;

        MMTTerm lhs =
            new OMA(
                new OMS(MMTURIs.Metric),
                new List <MMTTerm> {
            new OMS(p1URI),
            new OMS(p2URI)
        }
                );

        MMTTerm valueTp = new OMS(MMTURIs.RealLit);
        MMTTerm value   = new OMF(v);

        //see point label
        MMTValueDeclaration mmtDecl = new MMTValueDeclaration(this.Label, lhs, valueTp, value);

        AddFactResponse.sendAdd(mmtDecl, out this._URI);
    }
Ejemplo n.º 6
0
        public override bool Equals(object obj)
        {
            if (!(obj is OMA))
            {
                return(false);
            }

            OMA oma = (OMA)obj;

            return(kind.Equals(oma.kind) &&
                   applicant.Equals(oma.applicant) &&
                   arguments.SequenceEqual(oma.arguments));
        }
Ejemplo n.º 7
0
    private MMTDeclaration generateNot90DegreeAngleDeclaration(float val, string p1URI, string p2URI, string p3URI)
    {
        MMTTerm lhs =
            new OMA(
                new OMS(MMTURIs.Angle),
                new List <MMTTerm> {
            new OMS(p1URI),
            new OMS(p2URI),
            new OMS(p3URI)
        }
                );

        MMTTerm valueTp = new OMS(MMTURIs.RealLit);
        MMTTerm value   = new OMF(val);

        return(new MMTValueDeclaration(this.Label, lhs, valueTp, value));
    }
Ejemplo n.º 8
0
    public static PointFact parseFact(Scroll.ScrollFact fact)
    {
        String uri = [email protected];
        OMA    df  = (OMA)((Scroll.ScrollSymbolFact)fact).df;

        if (df != null)
        {
            float a = (float)((OMF)df.arguments[0]).f;
            float b = (float)((OMF)df.arguments[1]).f;
            float c = (float)((OMF)df.arguments[2]).f;
            return(new PointFact(a, b, c, uri, StageStatic.stage.factState));
        }
        else
        {
            return(null);
        }
    }
Ejemplo n.º 9
0
    private void init(Vector3 P, Vector3 N)
    {
        this.Point  = P;
        this.Normal = N;

        List <MMTTerm> arguments = new List <MMTTerm>
        {
            new OMF(P.x),
            new OMF(P.y),
            new OMF(P.z)
        };

        //OMS constructor generates full URI
        MMTTerm tp = new OMS(MMTURIs.Point);
        MMTTerm df = new OMA(new OMS(MMTURIs.Tuple), arguments);

        MMTSymbolDeclaration mmtDecl = new MMTSymbolDeclaration(this.Label, tp, df);

        AddFactResponse.sendAdd(mmtDecl, out this._URI);
    }
Ejemplo n.º 10
0
    private void init(string pid1, string pid2)
    {
        PointFact pf1 = _Facts[pid1] as PointFact;
        PointFact pf2 = _Facts[pid2] as PointFact;

        string p1URI = pf1.Id;
        string p2URI = pf2.Id;

        List <MMTTerm> arguments = new List <MMTTerm>
        {
            new OMS(p1URI),
            new OMS(p2URI)
        };

        //OMS constructor generates full URI
        MMTTerm tp = new OMS(MMTURIs.LineType);
        MMTTerm df = new OMA(new OMS(MMTURIs.LineOf), arguments);

        MMTSymbolDeclaration mmtDecl = new MMTSymbolDeclaration(this.Label, tp, df);

        AddFactResponse.sendAdd(mmtDecl, out this._URI);
    }