public void SendMethodInvoke(EntityMethod method, object[] arguments) { if (GetNetworkActor().IsAuthority(authority)) { method.SendMethodInvoke(this, arguments); } }
private EntityMethod CreateEntityMethod(XmlNode element) { EntityMethod method = new EntityMethod(); if (element.Attributes["xmi:id"] != null) { method.Id = element.Attributes["xmi:id"].Value; } if (element.Attributes["name"] != null) { method.Name = element.Attributes["name"].Value; } if (element.Attributes["visibility"] != null) { method.MethodModifier += element.Attributes["visibility"].Value; } if (element.Attributes["isAbstract"] != null && XmiLoader.ParseBool(element.Attributes["isAbstract"])) { method.MethodModifier += " abstract"; } if (element.Attributes["isStatic"] != null && element.Attributes["isStatic"].Value.CompareTo("static") == 0) { method.MethodModifier += " static"; } return(method); }
private static EntityInterface GetInterface() { /** IPerson Definition **/ EntityInterface iPerson = new EntityInterface(); iPerson.Name = "IPerson"; iPerson.Visibility = "public"; EntityMethod getDescription = new EntityMethod(); getDescription.Name = "GetPerson"; EntityParameter paramRet = new EntityParameter(); paramRet.IsReturn = true; paramRet.Type = IntrinsicTypes.Create("System.String"); EntityParameter param = new EntityParameter(); param.IsReturn = false; param.Type = IntrinsicTypes.Create("System.Int32"); param.Name = "id"; getDescription.ReturnEntity = paramRet; List <EntityParameter> parames = new List <EntityParameter>(); parames.Add(param); getDescription.Parameters = parames; EntityMethod init = new EntityMethod(); init.Name = "Init"; EntityMethod set = new EntityMethod(); set.Name = "SetData"; EntityParameter param1 = new EntityParameter(); param1.IsReturn = true; param1.Type = IntrinsicTypes.Create("System.String"); param1.Name = "nome"; EntityParameter param2 = new EntityParameter(); param2.IsReturn = false; param2.Type = IntrinsicTypes.Create("System.Boolean"); param2.Name = "isMale"; List <EntityParameter> parames2 = new List <EntityParameter>(); parames2.Add(param1); parames2.Add(param2); set.Parameters = parames2; iPerson.Methods.Add(getDescription); iPerson.Methods.Add(init); iPerson.Methods.Add(set); return(iPerson); }
private void ParseOperation(IEntity entity, XmlNode element) { if (entity is Entity) { EntityMethod method = CreateEntityMethod(element); ((Entity)entity).Methods.Add(method); IterateInnerChilds(element, method); } else { throw new UnknownContextException("Operation is being parse in a unknown context.Operation show be child of UML:Class or UML:Interface"); } }
private static void BuildClassTestModel() { EntityInterface iPerson = GetInterface(); EntityClass parent = new EntityClass(); parent.Name = "Pai"; EntityClass category = new EntityClass(); category.Name = "Category"; category.Visibility = "public"; category.Interfaces.Add(iPerson); category.Parent = parent; EntityField field = new EntityField(); field.Name = "Id"; field.Visibility = "protected"; field.IsPrimaryKey = true; field.Type = new Int(); category.Fields.Add(field); field = new EntityField(); field.Name = "Description"; field.IsRequired = true; field.MaxSize = 500; field.Type = new Loki.DataRepresentation.IntrinsicEntities.String(); category.Fields.Add(field); category.IsAbstract = true; category.Persistable = true; category.Visibility = "protected"; EntityMethod init = new EntityMethod(); init.Name = "Init"; category.Methods.Add(init); Model list = new Model(); list.Add(category); classes.Model = list; }
public void DeploySettings(IPlaneSettings settings, ToolkitExperimentNotes _notes, ILogBuilder logger) { DeploySettingsBase(_notes); PlanesMethodSettings mainSettings = (PlanesMethodSettings)settings; EntityMethod.DeploySettings(mainSettings.entityMethod, notes, logger); CorpusMethod.DeploySettings(mainSettings.corpusMethod, notes, logger); VectorMethod.DeploySettings(mainSettings.vectorMethod, notes, logger); FeatureMethod.DeploySettings(mainSettings.featureMethod, notes, logger); CacheProvider.Deploy(new System.IO.DirectoryInfo(mainSettings.cachePath)); EntityMethod.CacheProvider = CacheProvider; CorpusMethod.CacheProvider = CacheProvider; VectorMethod.CacheProvider = CacheProvider; FeatureMethod.CacheProvider = CacheProvider; CloseDeploySettingsBase(); }
public IPlaneContext ExecutePlaneMethod(IPlaneContext inputContext, ExperimentModelExecutionContext generalContext, ILogBuilder logger) { //if (generalContext == null) //{ // generalContext = new PlanesMethodContext(); //} IEntityPlaneContext entityInputContext = inputContext as IEntityPlaneContext; ICorpusPlaneContext entityContext = EntityMethod.ExecutePlaneMethod(inputContext, generalContext, logger) as ICorpusPlaneContext; IVectorPlaneContext corpusContext = CorpusMethod.ExecutePlaneMethod(entityContext, generalContext, logger) as IVectorPlaneContext; IFeaturePlaneContext vectorContext = VectorMethod.ExecutePlaneMethod(corpusContext, generalContext, logger) as IFeaturePlaneContext; IFeaturePlaneContext featureContext = FeatureMethod.ExecutePlaneMethod(vectorContext, generalContext, logger) as IFeaturePlaneContext; // --- the results reporting var evaluationMetrics = generalContext.truthTable.EvaluateTestResultsToMetricSet(featureContext.testResults, generalContext.runName + "-" + notes.folder.name, logger); DataTableTypeExtended <classificationEval> inclassEvalTable = new DataTableTypeExtended <classificationEval>("inclass_evaluation", "Test results, per class"); evaluationMetrics.GetAllEntries().ForEach(x => inclassEvalTable.AddRow(x)); inclassEvalTable.AddRow(evaluationMetrics.GetSummary("Sum")); notes.SaveDataTable(inclassEvalTable, notes.folder_classification); classificationReport averagedReport = new classificationReport(evaluationMetrics, generalContext.averagingMethod); averagedReport.Classifier = FeatureMethod.classifier.name; averagedReport.saveObjectToXML(notes.folder_classification.pathFor(averagedReport.Name + ".xml", imbSCI.Data.enums.getWritableFileMode.overwrite, "Serialized classification evaluation results summary")); generalContext.testSummaries.Add(averagedReport); averagedReport.ReportToLog(notes); featureContext.provider.Dispose(); EntityMethod.CacheProvider.Dispose(); return(generalContext); }
public void WriteEntityMethod(EntityMethod method) { syncronizer.constant_manager.GetEntityMethodSubManager().WriteConstantReference(method, this); }
public void SmsTest() { EntityClass entity = project.Model[1] as EntityClass; //Class stuff Assert.AreEqual("Sms", entity.Name, "Class Name should be 'Sms'!"); Assert.AreEqual("public", entity.Visibility, "Class Visibility should be 'public'!"); Assert.AreEqual(false, entity.IsAbstract, "Class should not be abstract!"); //Implemented Interfaces Assert.AreEqual(1, entity.Interfaces.Count, "Sms should have 1 Interface"); EntityInterface iDescription = entity.Interfaces[0]; Assert.AreEqual("IDescription", iDescription.Name, "Sms interface name is incorrect"); Assert.AreEqual("_10_5_1dc00e8_1135161125319_156036_314", iDescription.Id, "Sms interface id is incorrect"); //Attribute Stuff Assert.AreEqual(4, entity.Fields.Count, "Sms should Have 4 fields"); EntityField id = entity.Fields[0]; Assert.AreEqual("id", id.Name, "Field id has an incorrect Name"); Assert.AreEqual("private", id.Visibility, "Field id has an incorrect modifier"); Assert.AreEqual("int", id.Type.Name, "Field id has an incorrect type"); Assert.IsNull(id.ReferenceType, "Field id should not have a ReferenceType"); EntityField description = entity.Fields[1]; Assert.AreEqual("_10_5_1dc00e8_1135160692997_580873_136", description.Id, "Field size has an incorrect Id"); Assert.AreEqual("description", description.Name, "Field description has an incorrect Name"); Assert.AreEqual("private", description.Visibility, "Field description has an incorrect modifier"); Assert.AreEqual("string", description.Type.Name, "Field description has an incorrect type"); Assert.IsNull(description.ReferenceType, "Field description should not have a ReferenceType"); EntityField messages = entity.Fields[2]; Assert.AreEqual("category", messages.Name, "Field messages has an incorrect Name"); Assert.AreEqual("private", messages.Visibility, "Field messages has an incorrect modifier"); Assert.AreEqual("Category", messages.Type.Name, "Field messages has an incorrect type"); Assert.AreEqual(true, messages.InfoOnly, "Field messages should be InfoOnly"); Assert.IsNotNull(messages.ReferenceType, "Field messages should have a ReferenceType"); Assert.AreEqual(Multiplicity.ManyToOne, messages.Mult, "Field messages has an incorrect Multiplicity"); messages = entity.Fields[3]; Assert.AreEqual("user", messages.Name, "Field messages has an incorrect Name"); Assert.AreEqual("private", messages.Visibility, "Field messages has an incorrect modifier"); Assert.AreEqual("User", messages.Type.Name, "Field messages has an incorrect type"); Assert.AreEqual(true, messages.InfoOnly, "Field messages should be InfoOnly"); Assert.IsNotNull(messages.ReferenceType, "Field messages should have a ReferenceType"); Assert.AreEqual(Multiplicity.ManyToOne, messages.Mult, "Field messages has an incorrect Multiplicity"); //Method Stuff Assert.AreEqual(1, entity.Methods.Count, "1 Method were expected"); EntityMethod method = entity.Methods[0]; Assert.IsNotNull(method.ReturnEntity, "Return type was expected"); Assert.AreEqual("ToHtml", method.Name, "Incorrect method name"); Assert.AreEqual("public", method.MethodModifier, "Incorrect method modifier"); //Parameter Stuff Assert.AreEqual(0, entity.Methods[0].Parameters.Count, "0 Parameters were expected"); }
public void CategoryTest() { EntityClass entity = project.Model[4] as EntityClass; //Class stuff Assert.AreEqual("Category", entity.Name, "Class Name should be 'Category'!"); Assert.AreEqual("public", entity.Visibility, "Class Visibility should be 'public'!"); Assert.AreEqual(false, entity.IsAbstract, "Class should not be abstract!"); //Attribute Stuff Assert.AreEqual(3, entity.Fields.Count, "Category should Have 3 fields"); EntityField id = entity.Fields[0]; Assert.AreEqual("id", id.Name, "Field id has an incorrect Name"); Assert.AreEqual("private", id.Visibility, "Field id has an incorrect modifier"); Assert.AreEqual("int", id.Type.Name, "Field id has an incorrect type"); EntityField description = entity.Fields[1]; Assert.AreEqual("_10_5_1dc00e8_1135161420293_516114_378", description.Id, "Field description has an incorrect Id"); Assert.AreEqual("description", description.Name, "Field description has an incorrect Name"); Assert.AreEqual("private", description.Visibility, "Field description has an incorrect modifier"); Assert.AreEqual("string", description.Type.Name, "Field description has an incorrect type"); EntityField messages = entity.Fields[2]; Assert.AreEqual("_10_5_46601c1_1135362050395_684076_141", messages.Id, "Field messages has an incorrect Id"); Assert.AreEqual("messages", messages.Name, "Field messages has an incorrect Name"); Assert.AreEqual("private", messages.Visibility, "Field messages has an incorrect modifier"); Assert.AreEqual(Multiplicity.OneToMany, messages.Mult, "Field messages has an incorrect Multiplicity"); Assert.AreEqual("Sms", messages.Type.Name, "Field messages has an incorrect type"); Assert.IsNotNull(messages.ReferenceType, "Field messages should have a ReferenceType"); //Method Stuff Assert.AreEqual(4, entity.Methods.Count, "1 Method were expected"); //Sms[] GetMessages(int start,int count) EntityMethod method = entity.Methods[0]; Assert.IsNotNull(method.ReturnEntity, "Return type was expected"); Assert.AreEqual("GetMessages", method.Name, "Incorrect method name"); Assert.AreEqual("public", method.MethodModifier, "Incorrect method modifier"); Assert.AreEqual(2, method.Parameters.Count, "2 Parameters were expected"); EntityParameter param = method.ReturnEntity; Assert.IsNotNull(param.Type, "Return should not be null"); Assert.AreEqual(string.Empty, param.Name, "Incorrect parameter name"); Assert.AreEqual("Sms", param.Type.Name, "Incorrect parameter type"); Assert.AreEqual(true, param.IsReturn, "Incorrect return information"); Assert.AreEqual(Multiplicity.OneToMany, param.Mult, "Incorrect multiplicity"); param = method.Parameters[0]; Assert.IsNotNull(param.Type, "Start should not be null"); Assert.AreEqual("start", param.Name, "Incorrect parameter name"); Assert.AreEqual("int", param.Type.Name, "Incorrect parameter type"); Assert.AreEqual(false, param.IsReturn, "Incorrect return information"); Assert.AreEqual(Multiplicity.OneToOne, param.Mult, "Incorrect multiplicity"); param = method.Parameters[1]; Assert.IsNotNull(param.Type, "Count should not be null"); Assert.AreEqual("count", param.Name, "Incorrect parameter name"); Assert.AreEqual("int", param.Type.Name, "Incorrect parameter type"); Assert.AreEqual(false, param.IsReturn, "Incorrect return information"); Assert.AreEqual(Multiplicity.OneToOne, param.Mult, "Incorrect multiplicity"); //Sms[] GetMessages(User owner) method = entity.Methods[1]; Assert.IsNotNull(method.ReturnEntity, "Return type was expected"); Assert.AreEqual("GetMessages", method.Name, "Incorrect method name"); Assert.AreEqual("public", method.MethodModifier, "Incorrect method modifier"); Assert.AreEqual(1, method.Parameters.Count, "1 Parameter were expected"); param = method.ReturnEntity; Assert.IsNotNull(param.Type, "Return should not be null"); Assert.AreEqual(string.Empty, param.Name, "Incorrect parameter name"); Assert.AreEqual("Sms", param.Type.Name, "Incorrect parameter type"); Assert.AreEqual(true, param.IsReturn, "Incorrect return information"); Assert.AreEqual(Multiplicity.OneToMany, param.Mult, "Incorrect multiplicity"); Assert.AreEqual(1, method.Parameters.Count, "1 Parameters were expected"); param = method.Parameters[0]; Assert.IsNotNull(param.Type, "Owner should not be null"); Assert.AreEqual("owner", param.Name, "Incorrect parameter name"); Assert.AreEqual("User", param.Type.Name, "Incorrect parameter type"); Assert.AreEqual(false, param.IsReturn, "Incorrect return information"); Assert.AreEqual(Multiplicity.OneToOne, param.Mult, "Incorrect multiplicity"); //Sms[] GetMessages(User owner) method = entity.Methods[2]; Assert.IsNotNull(method.ReturnEntity, "Return type was expected"); Assert.AreEqual("GetMessages", method.Name, "Incorrect method name"); Assert.AreEqual("public", method.MethodModifier, "Incorrect method modifier"); Assert.AreEqual(1, method.Parameters.Count, "1 Parameter were expected"); param = method.ReturnEntity; Assert.IsNotNull(param.Type, "Return should not be null"); Assert.AreEqual(string.Empty, param.Name, "Incorrect parameter name"); Assert.AreEqual("Sms", param.Type.Name, "Incorrect parameter type"); Assert.AreEqual(true, param.IsReturn, "Incorrect return information"); Assert.AreEqual(Multiplicity.OneToMany, param.Mult, "Incorrect multiplicity"); Assert.AreEqual(1, method.Parameters.Count, "1 Parameters were expected"); param = method.Parameters[0]; Assert.IsNotNull(param.Type, "Owner should not be null"); Assert.AreEqual("owner", param.Name, "Incorrect parameter name"); Assert.AreEqual("User", param.Type.Name, "Incorrect parameter type"); Assert.AreEqual(false, param.IsReturn, "Incorrect return information"); Assert.AreEqual(Multiplicity.OneToMany, param.Mult, "Incorrect multiplicity"); //Categories GetCategories(User owner) method = entity.Methods[3]; Assert.IsNotNull(method.ReturnEntity, "Return type was expected"); Assert.AreEqual("GetCategories", method.Name, "Incorrect method name"); Assert.AreEqual("public", method.MethodModifier, "Incorrect method modifier"); param = method.ReturnEntity; Assert.IsNotNull(param.Type, "Return should not be null"); Assert.AreEqual(string.Empty, param.Name, "Incorrect parameter name"); Assert.AreEqual("Category", param.Type.Name, "Incorrect parameter type"); Assert.AreEqual(true, param.IsReturn, "Incorrect return information"); Assert.AreEqual(Multiplicity.OneToMany, param.Mult, "Incorrect multiplicity"); Assert.AreEqual(0, method.Parameters.Count, "0 Parameters were expected"); }
private static void BuildSmsTestModel() { EntityField field = null; /** User **/ EntityClass user = new EntityClass(); user.Name = "Principal"; user.Visibility = "public"; field = new EntityField(); field.Name = "Id"; field.IsPrimaryKey = true; field.Type = new Int(); user.Fields.Add(field); /** IDescription Definition **/ EntityInterface iDescription = new EntityInterface(); iDescription.Name = "IDescription"; iDescription.Visibility = "public"; EntityMethod getDescription = new EntityMethod(); getDescription.Name = "GetDescription"; EntityParameter param = new EntityParameter(); param.IsReturn = true; param.Type = IntrinsicTypes.Create("System.String"); getDescription.ReturnEntity = param; iDescription.Methods.Add(getDescription); /** Category Definition **/ EntityClass category = new EntityClass(); category.Name = "Category"; category.Visibility = "public"; //category.Interfaces.Add(iDescription); field = new EntityField(); field.Name = "Id"; field.IsPrimaryKey = true; field.Type = new Int(); category.Fields.Add(field); field = new EntityField(); field.Name = "Description"; field.IsRequired = true; field.MaxSize = 500; field.Type = new Loki.DataRepresentation.IntrinsicEntities.String(); category.Fields.Add(field); /** Sms Definition **/ EntityClass message = new EntityClass(); message.Name = "SmsBase"; message.IsAbstract = true; message.Visibility = "public"; //message.Interfaces.Add(iDescription); field = new EntityField(); field.Name = "Id"; field.IsPrimaryKey = true; field.Type = new Int(); message.Fields.Add(field); field = new EntityField(); field.Name = "Description"; field.IsRequired = true; field.MaxSize = 500; field.Default = "No Description"; field.Type = new Loki.DataRepresentation.IntrinsicEntities.String(); message.Fields.Add(field); field = new EntityField(); field.Name = "Category"; field.Type = category; field.Mult = Multiplicity.ManyToOne; field.IsRequired = true; message.Fields.Add(field); field = new EntityField(); field.Name = "Principal"; field.Type = user; field.Mult = Multiplicity.ManyToOne; field.IsRequired = true; message.Fields.Add(field); field = new EntityField(); field.Name = "Messages"; field.Type = message; field.Mult = Multiplicity.OneToMany; field.InfoOnly = true; user.Fields.Add(field); field = new EntityField(); field.Name = "Messages"; field.Type = message; field.InfoOnly = true; field.Mult = Multiplicity.OneToMany; category.Fields.Add(field); /** ImageSms **/ EntityClass imageSms = new EntityClass(); imageSms.Name = "ImageSms"; imageSms.Visibility = "public"; imageSms.Parent = message; field = new EntityField(); field.Name = "ImageUrl"; field.Type = new Loki.DataRepresentation.IntrinsicEntities.String(); field.IsRequired = true; field.Default = "#"; imageSms.Fields.Add(field); /** TextSms **/ EntityClass textSms = new EntityClass(); textSms.Name = "TextSms"; textSms.Visibility = "public"; textSms.Parent = message; field = new EntityField(); field.Name = "Text"; field.Type = new Loki.DataRepresentation.IntrinsicEntities.String(); field.IsRequired = true; field.Default = "Empty"; textSms.Fields.Add(field); /** Setting up project **/ Model list = new Model(); list.Add(category); list.Add(iDescription); list.Add(user); list.Add(message); list.Add(imageSms); list.Add(textSms); smsTestModel.Model = list; }
public void SendMethodInvoke(MethodInfo method, object[] arguments) { SendMethodInvoke(EntityMethod.GetEntityMethod(method), arguments); }
public void SendMethodInvoke(string name, object[] arguments) { SendMethodInvoke(EntityMethod.GetEntityMethodBySignature(GetTargetType(), name), arguments); }