Beispiel #1
0
 public bool isA(Classifier classifierParam)
 {
     if (classifierParam == this)
         return true;
     else
     {
         foreach (Classifier parent in parents)
         {
             if (parent.isA(classifierParam))
                 return true;
         }
     }
     return false;
 }
Beispiel #2
0
        //Default Parameters opposite = null ,ValueSpecification def= ,null,DomainSpecification domain=null
        public Property(string name, Class cl, Classifier type, Property opposite, ValueSpecification def, DomainSpecification domain)
            : base(name)
        {
            this.type = type;
            this.classifier = cl;
            this.opposite = opposite;
            this.defaultValue = null;
            this.domain = domain;
            this.isComposite = false;
            this.isNavigable = false;
            this.isReadOnly = false;
            this.isDerived = false;
            this.isUnique = false;
            this.isOrdered = false;
            this.minimumNumber = 0;
            this.maximumNumber = 1;

            if (def != null)
                this.defaultValue = def;
            else
            {
                string typeName = type.name;
                if (typeName == "real")
                {
                    this.defaultValue = new LiteralReal();
                }
                else if (typeName == "integer")
                {
                    this.defaultValue = new LiteralInteger();
                }
                else if (typeName == "string")
                {
                    this.defaultValue = new LiteralString();
                }
                else if (typeName == "boolean")
                {
                    this.defaultValue = new LiteralBoolean();
                }
                else if (typeName == "bool")
                {
                    this.defaultValue = new LiteralBoolean();
                }
            }
        }
 bool _isBaseType2(Classifier type)
 {
     if (type.name == "integer")
     {
         return(true);
     }
     if (type.name == "real")
     {
         return(true);
     }
     if (type.name == "string")
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #4
0
 public void setActiveShape(string name)
 {
     if (Classifier.hasAttribute(name))
     {
         Slot s = getProperty(name);
         if (s != null)
         {
             activeShape = (ShapeSpecification)s.getValue();
             if (activeShape != null)
             {
                 activeShape.setEntity(this);
             }
             else
             {
                 System.Console.WriteLine(this.name + ".setActiveShape(" + name + ") : the property is undefined");
             }
         }
     }
 }
Beispiel #5
0
 public FlowPort(string name, Class cl, Classifier type, Property opposite, ValueSpecification def, DomainSpecification domain) :
     base(name, cl, type, opposite, def, domain)
 {
 }
Beispiel #6
0
 public Operation(string name, Class owner, Behavior behavior)
     : base(name, behavior)
 {
     this.classifier = owner;
     this.type       = null;
 }
Beispiel #7
0
 public TopologicalSpecification(Classifier type)
     : base(type)
 {
 }
 public LiteralSpecification(Classifier type)
     : base(type)
 {
     CLASSTYPE = "Litteral";
 }
Beispiel #9
0
 //callback
 public Expression(string expression, Classifier returnType)
     : base(returnType)
 {
     expressionValue = expression;
 }
Beispiel #10
0
 public Parameter(string name, string direction, Classifier type)
     : base(name)
 {
     this.type      = type;
     this.direction = direction;
 }
 public LiteralSpecification(Classifier type)
     : base(type)
 {
     CLASSTYPE = "Litteral";
 }
        public override void manageRequest(HttpRequest req)
        {
            string procName = req.parameters["alias"];
            string orgName  = req.parameters["org"];

            req.response.write("<html>");
            req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
            req.response.write("<body>");

            OrganisationalEntity        org  = null;
            List <OrganisationalEntity> orgs = MascaretApplication.Instance.AgentPlateform.Organisations;
            bool found = false;
            int  i     = 0;

            while (!found && i < orgs.Count)
            {
                if (orgs[i].name == orgName)
                {
                    found = true;
                }
                else
                {
                    i++;
                }
            }
            if (found)
            {
                org = orgs[i];
            }

            OrganisationalStructure struc = org.Structure;

            List <Procedure> procs = struc.Procedures;
            Procedure        proc  = null;

            found = false;
            i     = 0;
            while (!found && i < procs.Count)
            {
                if (procs[i].name == procName)
                {
                    found = true;
                }
                else
                {
                    i++;
                }
            }
            if (found)
            {
                proc = procs[i];
            }

            Environment env = MascaretApplication.Instance.getEnvironment();

            List <Parameter>    parameters = new List <Parameter>();
            List <ActivityNode> nodes      = proc.Activity.Nodes;

            for (int iNode = 0; iNode < nodes.Count; iNode++)
            {
                if (nodes[iNode].Kind == "parameter")
                {
                    parameters.Add(((ActivityParameterNode)(nodes[iNode])).Parameter);
                }
            }

            req.response.write("<HR>");
            req.response.write("<H2>Parametres</H2>");
            req.response.write("<FORM METHOD=GET action=\"launchProcedure\">");
            req.response.write("<INPUT type=\"hidden\" name=\"org\" value=\"");
            req.response.write(orgName);
            req.response.write("\"/>");
            req.response.write("<INPUT type=\"hidden\" name=\"alias\" value=\"");
            req.response.write(procName);
            req.response.write("\"/>");
            req.response.write("<ul>");
            for (int iParam = 0; iParam < parameters.Count; iParam++)
            {
                Parameter param = parameters[iParam];
                req.response.write("<li>");
                Classifier type = param.Type;
                req.response.write(type.name);
                req.response.write("\t");
                req.response.write(param.name);
                if (_isBaseType2(type))
                {
                    req.response.write(" = ");
                    req.response.write(" <INPUT name=_");
                    req.response.write(param.name);
                    req.response.write(">");
                    req.response.write("</li>");
                }
                else
                {
                    req.response.write(" <select name=\"_");
                    req.response.write(param.name);
                    req.response.write("\">");

                    foreach (KeyValuePair <string, InstanceSpecification> instance in env.InstanceSpecifications)
                    {
                        if (instance.Value.Classifier != null)
                        {
                            if (instance.Value.Classifier.isA(type))
                            {
                                req.response.write(" = <option value=\"");
                                req.response.write(instance.Key);
                                req.response.write("\">");
                                req.response.write(instance.Key);
                                req.response.write("</option>");
                            }
                        }
                    }
                    req.response.write("</select>");
                }
            }
            req.response.write("</ul>");
            req.response.write("<INPUT TYPE=\"submit\" VALUE=\"Lancer\">");
            req.response.write("</FORM>");

            req.response.write("</body>");
            req.response.write("</html>");
        }
 public ValueSpecification(Classifier type)
 {
     this.type = type;
     CLASSTYPE = "ValueSpecification";
 }
Beispiel #14
0
 public Port(string name, Class cl, Classifier type, Property opposite, ValueSpecification def, DomainSpecification domain)
     : base(name, cl, type, opposite, def, domain)
 {
 }
 public ValueSpecification(Classifier type)
 {
     this.type = type;
     CLASSTYPE = "ValueSpecification";
 }
Beispiel #16
0
 public Operation(string name, Class owner, Behavior behavior)
     : base(name, behavior)
 {
     this.classifier = owner;
     this.type = null;
 }
Beispiel #17
0
 public InstanceValue(Classifier type)
     : base(type)
 {
     CLASSTYPE = "Instance";
     specValue = null;
 }
 public TopologicalProperty(string name, Class classe, Classifier type)
     : base(name, classe, type, null, null, null)
 {
 }
Beispiel #19
0
 public InstanceValue(Classifier type)
     : base(type)
 {
     CLASSTYPE = "Instance";
     specValue = null;
 }
Beispiel #20
0
 protected override void _addFeaturesToChild(Classifier child)
 {
     Class c = (Class)child;
     foreach (Property p in attributes.Values)
     {
         c.addAttribute(p);
     }
     /*
     foreach(Operation op in operations.ValuesList)
     {
         c.addOperation(op);
     }*/
 }
 public TopologicalSpecification(Classifier type)
     : base(type)
 {
 }
Beispiel #22
0
        public override void manageRequest(HttpRequest req)
        {
            Class classe = null;

            string id = "";

            if (req.parameters.ContainsKey("agent"))
            {
                id = req.parameters["agent"];
            }


            Environment           env    = MascaretApplication.Instance.getEnvironment();
            InstanceSpecification entity = null;

            if (env.InstanceSpecifications.ContainsKey(id))
            {
                entity = env.InstanceSpecifications[id];
            }

            VirtualHuman human = null;

            if (entity != null)
            {
                human = (VirtualHuman)(entity);
            }


            if (human != null)
            {
                env = human.KnowledgeBase.Environment;
                if (env != null)
                {
                    classe = _findClasse(env.Model.Package, req.parameters["alias"]);
                }
            }
            else
            {
                classe = _findClasse(MascaretApplication.Instance.Model.Package, req.parameters["alias"]);
            }

            req.response.write("<html>");
            req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
            req.response.write("<body>");
            req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">");
            req.response.write("<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">");

            req.response.write("<H2>Description</H2>");
            req.response.write("<ul>");
            req.response.write("<li>");
            req.response.write(classe.name);
            req.response.write("</li>");
            req.response.write("<li>");
            req.response.write(classe.getFullName());
            req.response.write("</li>");
            req.response.write("<li>");
            req.response.write(classe.Summary);
            req.response.write("</li>");
            req.response.write("<li>");
            req.response.write(classe.Description);
            req.response.write("</li>");
            req.response.write("</ul>");

            req.response.write("<HR>");
            req.response.write("<H2>Hierarchie</H2>");

            req.response.write("<H3>Parent</H3>");
            req.response.write("<ul>");
            List <Classifier> parents = classe.Parents;

            for (int iC = 0; iC < parents.Count; iC++)
            {
                Classifier parent = classe.Parents[iC];
                req.response.write("<li><a href=\"Class?alias=");
                req.response.write(parent.name);
                req.response.write("\" target = \"Body\">");
                req.response.write(parent.name);
                req.response.write("</a></li>");
            }
            req.response.write("</ul>");
            //req.response.write("</ul>");


            req.response.write("<HR>");
            req.response.write("<H2>Attributs</H2>");
            req.response.write("<ul>");
            Dictionary <string, Property> attributes = classe.Attributes;

            foreach (KeyValuePair <string, Property> attr in attributes)
            {
                req.response.write("<li>");
                req.response.write(attr.Key);
                req.response.write(" : ");
                req.response.write(attr.Value.Type.name);
                req.response.write("</li>");
            }
            req.response.write("</ul>");

            req.response.write("<HR>");
            req.response.write("<H2>Operations</H2>");
            Dictionary <string, Operation> operations = classe.Operations;

            foreach (KeyValuePair <string, Operation> oper in operations)
            {
                req.response.write("<li>");
                req.response.write(oper.Key);
                req.response.write("( ");
                List <Parameter> parameters = oper.Value.Parameters;
                for (int iP = 0; iP < parameters.Count; iP++)
                {
                    Parameter attr = parameters[iP];
                    req.response.write(attr.name);
                    req.response.write(" : <a href=\"Class?alias=");
                    req.response.write(attr.Type.name);
                    req.response.write("\" target = \"Body\">");
                    req.response.write(attr.Type.name);
                    req.response.write("</a>");
                    if (iP != parameters.Count - 1)
                    {
                        req.response.write(", ");
                    }
                }
                req.response.write(" )");
                req.response.write(" : ");
                if (oper.Value.Type != null)
                {
                    req.response.write(oper.Value.Type.name);
                }
                else
                {
                    req.response.write("undefined");
                }
                req.response.write("</li>");
            }

            req.response.write("<HR>");
            req.response.write("<H2>Instances</H2>");
            Dictionary <string, InstanceSpecification> instances = classe.Instances;

            foreach (KeyValuePair <string, InstanceSpecification> instance in instances)
            {
                req.response.write("<li>");
                req.response.write("<a href=\"Entity?alias=");
                req.response.write(instance.Key);
                req.response.write("\" target = \"Body\">");
                req.response.write(instance.Key);
                req.response.write("</a>");
            }

            req.response.write("</body>");
            req.response.write("</html>");
        }
Beispiel #23
0
 public TopologicalProperty(string name, Class classe, Classifier type)
     : base(name, classe, type, null, null, null)
 {
 }
Beispiel #24
0
 protected virtual void _addFeaturesToChild(Classifier child)
 {
     foreach (Behavior currentBehavior in ownedBehavior.Values)
     {
         child.addOwnedBehavior(currentBehavior);
     }
 }
Beispiel #25
0
 public void addChild(Classifier child)
 {
     child.parents.Add(this);
     children.Add(child);
     _addFeaturesToChild(child);
 }
Beispiel #26
0
 public void addParents(Classifier element)
 {
     parents.Add(element);
 }
Beispiel #27
0
 public void addChild(Classifier child)
 {
     child.parents.Add(this);
     children.Add(child);
     _addFeaturesToChild(child);
 }
Beispiel #28
0
 public void addParents(Classifier element)
 {
     parents.Add(element);
 }
Beispiel #29
0
 public VirtualRealitySpecification(Classifier type)
     : base(type)
 {
 }
 public VirtualRealitySpecification(Classifier type)
     : base(type)
 {
 }
Beispiel #31
0
 public override string getFullName()
 {
     return(Classifier.getFullName() + "." + name);
 }
Beispiel #32
0
 public GeometryProperty(string name, Class classe, Classifier type)
     : base(name, classe, type)
 {
 }
Beispiel #33
0
 public Parameter(string name, string direction, Classifier type)
     : base(name)
 {
     this.type = type;
     this.direction = direction;
 }
 bool _isBaseType2(Classifier type)
 {
     if (type.name == "integer") return true;
     if (type.name == "real") return true;
     if (type.name == "string") return true;
     else return false;
 }
Beispiel #35
0
        //callback

        public Expression(string expression, Classifier returnType)
            : base(returnType)
        {
            expressionValue = expression;
        }
Beispiel #36
0
 public GeometryProperty(string name, Class classe, Classifier type)
     : base(name, classe, type)
 {
 }