private void Register() { try { if (!config.InstanceKey.HasValue || reregister) { try { var instances = new Instances(config); Instance instance = new Instance() { TargetKey = config.TargetKey }; instances.CreateInstance(instance); config.InstanceKey = instance.Key; } catch (Exception ex) { throw new DeploymentException("Failed registering instance.", ex); } try { Utils.Registry.Save(config); } catch (Exception ex) { throw new DeploymentException("Failed updating config after instance registration.", ex); } } } catch (Exception ex) { this.EventLog.WriteEntry("Failed service registration: " + ex.ToString(), EventLogEntryType.Error); throw; } reregister = false; }
public static void Main(string[] args) { try { int runs = 1; string algo = ""; string data = ""; if(args.Length>0) runs = Convert.ToInt32(args[0]); if(args.Length>1) algo = args[1]; if(args.Length>2) data = args[2]; Stopwatch read = new Stopwatch(), build = new Stopwatch(), classify = new Stopwatch(); for (int cnt=0; cnt<runs; cnt++) { read.Start(); Instances train = new Instances(new java.io.FileReader(data+"train.arff")); train.setClassIndex(train.numAttributes() - 1); Instances test = new Instances(new java.io.FileReader(data+"test.arff")); test.setClassIndex(test.numAttributes() - 1); read.Stop(); Classifier[] clList = { new weka.classifiers.bayes.NaiveBayes(), new weka.classifiers.trees.RandomForest(), new weka.classifiers.trees.J48(), new weka.classifiers.functions.MultilayerPerceptron(), new weka.classifiers.rules.ConjunctiveRule(), new weka.classifiers.functions.SMO() }; build.Start(); foreach (Classifier classifier in clList) { if(algo.Equals("") || algo.Equals("All") || classifier.getClass().getSimpleName().Equals(algo)) classifier.buildClassifier(train); } build.Stop(); classify.Start(); foreach (Classifier classifier in clList) { if(algo.Equals("") || algo.Equals("All") || classifier.getClass().getSimpleName().Equals(algo)) { int numCorrect = 0; for (int i = 0; i < test.numInstances(); i++) { if (classifier.classifyInstance(test.instance(i)) == test.instance(i).classValue()) numCorrect++; } //Console.Write(classifier.getClass().getSimpleName() + "\t" + numCorrect + " out of " + test.numInstances() + " correct (" +(100.0 * numCorrect / test.numInstances()) + "%)"); } } classify.Stop(); } Console.WriteLine("{\""+ algo + "\"," + read.ElapsedMilliseconds + "," + build.ElapsedMilliseconds + "," + classify.ElapsedMilliseconds + "," + (read.ElapsedMilliseconds+build.ElapsedMilliseconds+classify.ElapsedMilliseconds)+"};"); if(args.Length>3) Console.ReadLine(); } catch (java.lang.Exception e){ e.printStackTrace(); } }
public ActionResult AddTag(Guid id, string name, string value) { var instances = new Instances(); var instance = instances.GetInstance(id); if (instance.Tags.ContainsKey(name)) throw new HttpException(406, "Tag name already exists"); instance.Tags.Add(name, value); instances.UpdateInstance(instance); if (Request.IsAjaxRequest()) return Json(null); else return RedirectToAction("EditTags", new { id = id }); }
private static void SearchAndDelete(Guid targetKey, Instances instancesController, Instance instance) { var aSecondInstance = new Instance() { Name = "A Second Instance", TargetKey = targetKey }; instancesController.CreateInstance(aSecondInstance); var zThirdInstance = new Instance() { Name = "Z Third Instance", TargetKey = targetKey }; instancesController.CreateInstance(zThirdInstance); var search1 = instancesController.SearchInstances(targetKey); Debug.Assert(search1.TotalCount == 3); Debug.Assert(search1.Instances.Count() == 3); Debug.Assert(search1.Instances.ElementAt(0).Key == aSecondInstance.Key); Debug.Assert(search1.Instances.ElementAt(1).Key == instance.Key); Debug.Assert(search1.Instances.ElementAt(2).Key == zThirdInstance.Key); var search2 = instancesController.SearchInstances(targetKey, "Test"); Debug.Assert(search2.TotalCount == 1); Debug.Assert(search2.Instances.Count() == 1); Debug.Assert(search2.Instances.ElementAt(0).Key == instance.Key); var search3 = instancesController.SearchInstances(targetKey, pageSize: 1); Debug.Assert(search3.TotalCount == 3); Debug.Assert(search3.Instances.Count() == 1); Debug.Assert(search3.Instances.ElementAt(0).Key == aSecondInstance.Key); var search4 = instancesController.SearchInstances(targetKey, pageSize: 2); Debug.Assert(search4.TotalCount == 3); Debug.Assert(search4.Instances.Count() == 2); Debug.Assert(search4.Instances.ElementAt(0).Key == aSecondInstance.Key); Debug.Assert(search4.Instances.ElementAt(1).Key == instance.Key); var search5 = instancesController.SearchInstances(targetKey, offset: 1); Debug.Assert(search5.TotalCount == 3); Debug.Assert(search5.Instances.Count() == 2); Debug.Assert(search5.Instances.ElementAt(0).Key == instance.Key); Debug.Assert(search5.Instances.ElementAt(1).Key == zThirdInstance.Key); var search6 = instancesController.SearchInstances(targetKey, offset: 1, pageSize: 1); Debug.Assert(search6.TotalCount == 3); Debug.Assert(search6.Instances.Count() == 1); Debug.Assert(search6.Instances.ElementAt(0).Key == instance.Key); instancesController.DeleteInstance(aSecondInstance.Key); instancesController.DeleteInstance(zThirdInstance.Key); var searchDeleted = instancesController.SearchInstances(targetKey); Debug.Assert(searchDeleted.TotalCount == 1); Debug.Assert(searchDeleted.Instances.Count() == 1); Debug.Assert(searchDeleted.Instances.ElementAt(0).Key == instance.Key); }
public static Instance Run(ControllerConfiguration context, Guid targetKey) { var instancesController = new Instances(context); var searchEmpty = instancesController.SearchInstances(targetKey); Debug.Assert(searchEmpty.TotalCount == 0); Debug.Assert(searchEmpty.Instances.Count() == 0); var testInstance = new Instance() { TargetKey = targetKey }; instancesController.CreateInstance(testInstance); var createdInstance = instancesController.GetInstance(testInstance.Key); Debug.Assert(testInstance.Key == createdInstance.Key); Debug.Assert(testInstance.Name == createdInstance.Name); Debug.Assert(testInstance.TargetKey == createdInstance.TargetKey); var searchSingle = instancesController.SearchInstances(targetKey); Debug.Assert(searchSingle.TotalCount == 1); Debug.Assert(searchSingle.Instances.Count() == 1); Debug.Assert(searchSingle.Instances.First().Key == createdInstance.Key); Debug.Assert(searchSingle.Instances.First().Name == createdInstance.Name); createdInstance.Tags.Add("Foo", "Bar"); instancesController.UpdateInstance(createdInstance); var taggedInstance = instancesController.GetInstance(createdInstance.Key); Debug.Assert(taggedInstance.Tags.Count == 1); Debug.Assert(taggedInstance.Tags.ContainsKey("Foo")); Debug.Assert(taggedInstance.Tags["Foo"] == "Bar"); taggedInstance.Name = "Updated Test Instance"; instancesController.UpdateInstance(taggedInstance); var renamedInstance = instancesController.GetInstance(taggedInstance.Key); Debug.Assert(renamedInstance.Name == taggedInstance.Name); var searchRenamed = instancesController.SearchInstances(targetKey); Debug.Assert(searchRenamed.TotalCount == 1); Debug.Assert(searchRenamed.Instances.First().Name == renamedInstance.Name); taggedInstance.Name = "Test Instance"; instancesController.UpdateInstance(taggedInstance); SearchAndDelete(targetKey, instancesController, taggedInstance); return testInstance; }
// // GET: /Instances/ConfirmDelete/5 public ActionResult ConfirmDelete(Guid id) { var instances = new Instances(); var targets = new Targets(); var groups = new Groups(); var instance = instances.GetInstance(id); var target = targets.GetTarget(instance.TargetKey); var group = groups.GetGroup(target.GroupKey); var model = new InstanceDetails() { Instance = instance, Target = target, Group = group, }; return View(model); }
// // GET: /Logs/ public ActionResult Index(Guid iid, string m = null, int c = 50) { var logs = new Logs(); var instances = new Instances(); var targets = new Targets(); var groups = new Groups(); var logPage = logs.GetLogEntryPage(iid, m, c); var instance = instances.GetInstance(iid); var target = targets.GetTarget(instance.TargetKey); var group = groups.GetGroup(target.GroupKey); var model = new LogIndex() { LogEntryPage = logPage, Instance = instance, Target = target, Group = group, }; return View(model); }
public ActionResult Details(Guid iid, long t, LogStatus s) { var logs = new Logs(); var instances = new Instances(); var targets = new Targets(); var groups = new Groups(); var log = logs.GetLogEntry(iid, new DateTime(t, DateTimeKind.Utc), s); var instance = instances.GetInstance(iid); var target = targets.GetTarget(instance.TargetKey); var group = groups.GetGroup(target.GroupKey); var model = new LogDetails() { LogEntry = log, Instance = instance, Target = target, Group = group, }; return View(model); }
public JsonResult UpdateTag(Guid id, string oldName, string name, string value) { var instances = new Instances(); var instance = instances.GetInstance(id); if (!instance.Tags.ContainsKey(oldName)) throw new HttpException(404, "Tag not found"); if (oldName == name) { instance.Tags[name] = value; } else if (instance.Tags.ContainsKey(name)) { throw new HttpException(406, "Tag name already exists"); } else { instance.Tags.Remove(oldName); instance.Tags.Add(name, value); } instances.UpdateInstance(instance); return Json(null); }
// // GET: /Instances/ public ActionResult Index(Guid tid, string q = null, int o = 0, int c = 50) { if (o < 0) o = 0; if (c < 1) o = 1; if (c > 100) o = 100; var instances = new Instances(); var targets = new Targets(); var groups = new Groups(); var instanceList = instances.SearchInstances(tid, q, o, c); var target = targets.GetTarget(tid); var group = groups.GetGroup(target.GroupKey); var model = new InstanceIndex() { InstanceList = instanceList, Target = target, Group = group, }; return View(model); }
public ActionResult Delete(Guid id, FormCollection collection) { var instances = new Instances(); var instance = instances.GetInstance(id); try { instances.DeleteInstance(id); return RedirectToAction("Index", new { tid = instance.TargetKey }); } catch(Exception ex) { ModelState.AddModelError("Error", ex); } var targets = new Targets(); var groups = new Groups(); var target = targets.GetTarget(instance.TargetKey); var group = groups.GetGroup(target.GroupKey); var model = new InstanceDetails() { Instance = instance, Target = target, Group = group, }; return View("ConfirmDelete", model); }
protected virtual void OnDestroy() { Instances.Remove(this); }
public IEnumerable <Feature> UniqueFeatures() { return(Instances.SelectMany(f => f.Features).DistinctBy(f => f.Axis + f.Value).ToList()); }
public override void OnAfterDelete() { Instances.Remove(this); base.OnAfterDelete(); }
public static uint Report(byte resource, Instances instanceNumber, byte context = 0, string feature = null) { return HALReport(resource, (byte) instanceNumber, context, feature); }
/// <summary> /// Calculates giniLeft, giniRigth(these are fraction operations, so also calculates denominator and numerator of fractions) /// then calvulates gini result for each inctance /// Then calling the creating dataset function /// </summary> /// <param name="insts"></param> /// <param name="categoryTypeNumber"></param> /// <param name="categoryTypeTargetNumber"></param> private void Gini(weka.core.Instances insts, List <int[]> categoryTypeNumber, List <int[, ]> categoryTypeTargetNumber) { List <double[]> giniResult = new List <double[]>(); for (int i = 0; i < categoryTypeNumber.Count; i++) { giniResult.Add(new double[categoryTypeNumber[i].Length]); } for (int i = 0; i < categoryTypeNumber.Count - 1; i++) { int changeAttribute = 0; for (changeAttribute = 0; changeAttribute < categoryTypeNumber[i].Length; changeAttribute++) { List <Double> giniLeftNumerator = new List <Double>(); List <Double> giniRigthNumerator = new List <Double>(); //numerator -> pay Double giniRigthDenominator = 0; //denominator -> payda Double giniLeftDenominator = 0; Double sumFunctionRight = 0; Double giniRight = 0; Double giniLeft = 0; int categoryChange = 0; Double sumFuntionLeft = 0; for (categoryChange = 0; categoryChange < categoryTypeNumber[categoryTypeNumber.Count - 1].Length; categoryChange++) { giniLeftNumerator.Add(Convert.ToDouble(categoryTypeTargetNumber[i][changeAttribute, categoryChange])); } for (int index = 0; index < giniLeftNumerator.Count; index++) { giniLeftDenominator += giniLeftNumerator[index]; } for (int z = giniLeftNumerator.Count; z > 0; z--) { sumFuntionLeft += Convert.ToDouble(Math.Pow(Math.Abs(giniLeftNumerator[z - 1] / giniLeftDenominator), 2)); } giniLeft = 1 - sumFuntionLeft; int[] targets = new int[giniLeftNumerator.Count]; for (int h = 0; h < categoryTypeNumber[i].Length; h++) { if (h != changeAttribute) { for (int z = 0; z < giniLeftNumerator.Count; z++) { giniRigthNumerator.Add(Convert.ToDouble(categoryTypeTargetNumber[i][h, z])); targets[z] += categoryTypeTargetNumber[i][h, z]; } } } for (int index = 0; index < giniRigthNumerator.Count; index++) { giniRigthDenominator += giniRigthNumerator[index]; } for (int z = targets.Length; z > 0; z--) { sumFunctionRight += Convert.ToDouble(Math.Pow(Math.Abs(targets[z - 1] / giniRigthDenominator), 2)); } giniRight = 1 - sumFunctionRight; giniResult[i][changeAttribute] = Convert.ToDouble(1 / (giniLeftDenominator + giniRigthDenominator)) * Convert.ToDouble((giniLeftDenominator * giniLeft) + (giniRigthDenominator * giniRight)); } Instances fileInst = new Instances(insts); CreateNewDataset(fileInst, giniResult, giniPath); } }
private void OnDestroy() { Instances.Remove(this); }
private void BuildInstances(Instances instances) { CacheHasClassValues(); Array.ForEach(data, r => instances.add(CreateInstanceForRow(r).Impl)); }
void IJsonSerializable.Serialize(JsonWriter writer) { // Types if (Types != null && Types.Any()) { writer.WritePropertyName("types"); writer.WriteStartObject(); foreach (var type in Types) { writer.WritePropertyName(type); writer.WriteRawValue(GetTypeJson(type)); } writer.WriteEndObject(); } if (Instances != null && Instances.Any()) { writer.WritePropertyName("instances"); writer.WriteStartObject(); foreach (var typeItem in Instances) { writer.WritePropertyName(typeItem.Key); writer.WriteStartObject(); // Serialize static property values if (typeItem.Value.StaticProperties.Count > 0) { writer.WritePropertyName("static"); writer.Serialize( typeItem.Value.StaticProperties.ToDictionary( property => property.Name, property => JsonConverter.GetPropertyValue(property, property.DeclaringType))); } // Serialize instances foreach (var instanceItem in typeItem.Value.Instances) { writer.WritePropertyName(instanceItem.Key); writer.Serialize(instanceItem.Value); } writer.WriteEndObject(); } writer.WriteEndObject(); } if (Conditions != null && Conditions.Any()) { writer.WritePropertyName("conditions"); writer.Serialize(Conditions); } if (Events != null && Events.Any()) { writer.WritePropertyName("events"); writer.Serialize(Events); } if (Model != null && Model.Any()) { writer.WritePropertyName("model"); writer.Serialize(Model); } if (ServerInfo != null) { writer.WritePropertyName("serverInfo"); writer.Serialize(ServerInfo); } if (Changes != null && Changes.Any()) { writer.WritePropertyName("changes"); writer.Serialize(Changes.Where(modelEvent => !(modelEvent is ModelValueChangeEvent) || ExoWeb.IncludeInClientModel(((ModelValueChangeEvent)modelEvent).Property))); } }
/// <summary> /// Attempts to construct a <see cref="IMonoid"/> over <typeparamref name="X"/> using derived aspects /// </summary> /// <typeparam name="X">The monoid element type</typeparam> public static Option <IMonoid <X> > make <X>() => Try(() => Instances.TryFind(typeof(X)) .MapValueOrDefault(instance => cast <IMonoid <X> >(instance), DefaultMonoid <X> .instance));
public Dataset(Header header, Instance[] instances) : this() { Header = header ?? throw new ArgumentNullException(nameof(header)); Instances = instances ?? throw new ArgumentNullException(nameof(instances)); Name = (Header != null) ? Header.RelationName : "Unknown"; var iterableFeatures = Header.Features.Yaap(settings: new YaapSettings() { Description = $"Processing features of {Name}", ColorScheme = YaapColorScheme.Bright, UnitName = "feature" }); foreach (var feature in iterableFeatures) { if (feature.Type is IntegerFeature) { var nonMissingValues = Instances.Where(x => !feature.Type.IsMissing(x[feature])).Select(x => (int)x[feature]).ToArray(); var valuesmissing = Instances.Length - nonMissingValues.Length; int max, min; if (nonMissingValues.Length > 0) { max = nonMissingValues.Max(); min = nonMissingValues.Min(); } else { max = 0; min = 0; } feature.FeatureInformation = new IntegerFeatureInformation() { MissingValueCount = valuesmissing, MaxValue = max, MinValue = min, Feature = feature, }; } else if (feature.Type is NumericFeature) { var nonMissingValues = Instances.Where(x => !feature.Type.IsMissing(x[feature])).Select(x => (double)x[feature]).ToArray(); var valuesmissing = Instances.Length - nonMissingValues.Length; double max, min; if (nonMissingValues.Length > 0) { max = nonMissingValues.Max(); min = nonMissingValues.Min(); } else { max = 0; min = 0; } feature.FeatureInformation = new NumericFeatureInformation() { MissingValueCount = valuesmissing, MaxValue = max, MinValue = min, Feature = feature, }; } else if (feature.Type is NominalFeature) { var len = ((NominalFeature)feature.Type).Values.Count; double[] valuesCount = new double[len]; bool missingFeatures = Instances.Any(x => !feature.Type.IsMissing(x[feature])); var iterableValues = Range(0, len).Yaap(settings: new YaapSettings() { Description = $"Counting each value of {feature.Name}'s appearances", ColorScheme = YaapColorScheme.NoColor }); foreach (var i in iterableValues) { valuesCount[i] = Instances.Where(x => !feature.Type.IsMissing(x[feature])).Count(x => (int)x[feature] == i); } //for (int i = 0; i < len; i++) // valuesCount[i] = Instances.Where(x => !feature.Type.IsMissing(x[feature])).Count(x => (int)x[feature] == i); var valuesmissing = Instances.Select(x => x[feature]).Count(feature.Type.IsMissing); var valueProbability = valuesCount.Select(x => x / (valuesCount.Sum() * 1.0)).ToArray(); var ratio = valuesCount.Select(x => x / (valuesCount.Min() * 1F)).ToArray(); feature.FeatureInformation = new NominalFeatureInformation() { Distribution = valuesCount, MissingValueCount = valuesmissing, ValueProbability = valueProbability, Ratio = ratio, Feature = feature, }; } } int objWithIncompleteData = 0; var iterableInstances = Instances.Yaap(settings: new YaapSettings() { Description = "Processing instances...", ColorScheme = YaapColorScheme.Bright, UnitName = "feature" }); foreach (var instance in iterableInstances) { if (Header.Features.Any(feature => feature.Type.IsMissing(instance[feature]))) { objWithIncompleteData++; } } DatasetInformation = new DatasetInformation() { ObjectsWithIncompleteData = objWithIncompleteData, GlobalAbscenseInformation = Header.Features.Sum(feature => feature.FeatureInformation.MissingValueCount) }; }
public int[] GetClasses() => Instances.Select(i => i.GetClass()).ToArray();
public double[] GetColumn(int featureIdx) => Instances.Select(i => i.GetColumn(featureIdx)).ToArray();
/// <summary> /// Return results of Argos instances have been updated /// </summary> /// <returns></returns> public async Task <IEnumerable <ArgosResult> > RunAsync() { var items = new List <ArgosResult>(); foreach (var instance in Instances.Where(a => a.IsDue)) { try { //Log.Debug("Running {type} - {name}", instance.GetType().Name, instance.Id); // Run instance var result = await instance.RunAsync(); await _stateProcessor.ProcessAsync(instance.Definition, result.Items); await _ruleProcessor.ProcessAsync(instance.Definition, result.Items); // Check if state has changed since last time ArgosResult previous = null; if (_state.ContainsKey(instance.Id)) { previous = _state[instance.Id]; } if (!Compare.IsEqual(result, previous)) { items.Add(result); // #hack: dump result Log.Debug(result.ToString()); } _state[instance.Id] = result.Copy(); } catch (Exception ex) { Log.Error(ex, ex.Message); } } #region original //// Get any argos definitions who's heartbeat is due //foreach (var definition in GetDue()) // { // try // { // ArgosResult lastRun; // if (_state.ContainsKey(definition.Id)) // { // lastRun = _state[definition.Id]; // } // else // { // lastRun = new ArgosResult(); // _state.Add(definition.Id, lastRun); // } // var argos = _argos.Single(t => t.GetType().Name == definition.Type); // //Validate(testdefinition, test.Meta); // Log.Debug("Running {type} - {name}", argos.GetType().Name, definition.Id); // var rs = await argos.RunAsync(definition); // foreach(var item in rs.Items) // { // await _stateProcessor.ProcessAsync(definition, item); // await _ruleProcessor.ProcessAsync(definition, item); // } // if (!Compare.ArgosResultsAreEqual(rs, lastRun)) // { // //Log.Information("{argos} '{id}' Has changed: " + rs, // // argos.GetType().Name, // // definition.Id); // items.Add(rs); // } // _state[definition.Id] = rs; // } // catch (Exception ex) // { // Log.Error(ex, ex.Message); // } // } #endregion return(items); }
/// <summary> /// Clears all type-mappings and instances. /// </summary> public void Clear() { Instances.Clear(); Mappings.Clear(); RelationshipMappings.Clear(); }
public double[] GetColumn(Feature feature) => Instances.Select(i => i.GetColumn(feature)).ToArray();
public ActionResult Result(Customer customer) { string projectPath = AppDomain.CurrentDomain.BaseDirectory; string filePath = projectPath + "/csv-output/file.csv"; string delimiter = ","; string header = "age, job, marital, education, default, housing, loan, contact, month, day_of_week, campaign, pdays, previous, poutcome, emp.var.rate, cons.price.idx, cons.conf.idx, euribor3m, nr.employed, y,"; string clientData = customer.Age.ToString() + delimiter + customer.Job + delimiter + customer.MaritalStatus + delimiter + customer.Education + delimiter + customer.Credit + delimiter + customer.HousingLoan + delimiter + customer.PersonalLoan + delimiter + customer.ContactType + delimiter + customer.LastContactMonth + delimiter + customer.LastContactDay + delimiter + customer.NumberOfContactsThis + delimiter + customer.DaysSinceLastContact.ToString() + delimiter + customer.NumberOfContactsPrior.ToString() + delimiter + customer.OutcomePreviousCampaign + delimiter + customer.EmploymentVariationRate + delimiter + customer.ConsumerPriceIndex + delimiter + customer.Euribor3Month + delimiter + customer.NumberOfEmployees + delimiter + " " + delimiter; StringBuilder sb = new StringBuilder(); sb.AppendLine(header); sb.AppendLine(clientData); System.IO.File.WriteAllText(filePath, sb.ToString()); CSVLoader loader = new CSVLoader(); loader.setSource(new java.io.File(projectPath + "/csv-output/file.csv")); Instances instances = loader.getDataSet(); Outcome outcome = MachineLearning(instances); outcome.FirstInfluenceType = "Number of Employees:"; outcome.FirstInfluenceValue = customer.NumberOfEmployees.ToString(); outcome.FirstImageLink = "/Images/Influences/Employee.png"; outcome.SecondInfluenceType = "Euribor:"; outcome.SecondInfluenceValue = customer.Euribor3Month.ToString(); outcome.SecondImageLink = "/Images/Influences/Euribor.png"; outcome.ThirdInfluenceType = "Employment Variation Rate:"; outcome.ThirdInfluenceValue = customer.EmploymentVariationRate.ToString(); outcome.ThirdImageLink = "/Images/Influences/Job.png"; outcome.FourthInfluenceType = "Days Since Last Contact:"; outcome.FourthInfluenceValue = customer.DaysSinceLastContact.ToString(); outcome.FourthImageLink = "/Images/Influences/NumberContacts.png"; outcome.FifthInfluenceType = "Outcome of Previous Campaign:"; outcome.FifthInfluenceValue = customer.OutcomePreviousCampaign; outcome.FifthImageLink = "/Images/Influences/PrevOutcome.png"; return(View(outcome)); }
public TheMasterInstructor(Serial serial) : base(serial) { Instances.Add(this); }
public async Task AndNode() { var padContract = new Engine.Contracts.PadContract() { Id = 1, Name = "test" }; var constant1 = new Engine.Contracts.NodeBaseContract() { Id = 1, NodeId = 1, OutNodes = new List <long>() { 3 }, Type = NodeType.Input, MetaData = new NodeMetaData() { NodeData = new NodeMetaDataAttribute() { NodeClass = typeof(ConstantNode) }, FieldsMetaData = new List <FieldMetaDataAttribute>() { new FieldMetaDataAttribute() { Name = "Value", ValueType = typeof(bool) }, new FieldMetaDataAttribute() { Name = "ConstantType", ValueType = typeof(ConstantType) } } } }; var constant2 = new Engine.Contracts.NodeBaseContract() { Id = 2, NodeId = 2, OutNodes = new List <long>() { 3 }, Type = NodeType.Input, MetaData = new NodeMetaData() { NodeData = new Engine.NodeMetaDataAttribute() { NodeClass = typeof(ConstantNode) }, FieldsMetaData = new List <FieldMetaDataAttribute>() { new FieldMetaDataAttribute() { Name = "Value", ValueType = typeof(bool) }, new FieldMetaDataAttribute() { Name = "ConstantType", ValueType = typeof(ConstantType) } } } }; var add = new Engine.Contracts.NodeBaseContract() { Id = 3, NodeId = 3, InNodes = new List <long>() { 1, 2 }, Type = NodeType.Output, MetaData = new NodeMetaData() { NodeData = new Engine.NodeMetaDataAttribute() { NodeClass = typeof(AndNode) }, FieldsMetaData = new List <FieldMetaDataAttribute>() { new FieldMetaDataAttribute() { Name = "Left", Direction = FieldDirection.Input, MappedNodeId = 1, MappedFieldName = "Value" }, new FieldMetaDataAttribute() { Name = "Right", MappedNodeId = 2, Direction = FieldDirection.Input, } } } }; padContract.Nodes = new List <Engine.Contracts.NodeBaseContract>() { constant1, constant2, add }; List <InstanceMapping> mappings = new List <InstanceMapping>() { new InstanceMapping() { NodeId = 1, FieldMappings = new List <FieldMapping>() { new FieldMapping() { FieldName = "Value", Value = "True" }, new FieldMapping() { FieldName = "ConstantType", Value = "Boolean" }, } }, new InstanceMapping() { NodeId = 2, FieldMappings = new List <FieldMapping>() { new FieldMapping() { FieldName = "Value", Value = "False" }, new FieldMapping() { FieldName = "ConstantType", Value = "Boolean" }, } } }; var instance = new Instances(mappings); var json = JsonConvert.SerializeObject(instance); var pad = PadFactory.CreateInstance(padContract, ExecutionMode.Normal, instance); await pad.Init(); await pad.Execute(pad.Context, instance); Assert.Equal(ExecutionStatus.Success, pad.Context.Status); Assert.Equal(false, pad.Context.Result); }
public Instance InstanceFor(string name) { return(Instances.ContainsKey(name) ? Instances[name] : _instances.Values.ToArray().FirstOrDefault(x => x.Name == name)); }
public override void Render(RenderContext renderContext) { if (!IsRendering) { return; } if (Geometry == null) { return; } if (Visibility != Visibility.Visible) { return; } if (renderContext.IsShadowPass) { if (!IsThrowingShadow) { return; } } /// --- set constant paramerers var worldMatrix = modelMatrix * renderContext.WorldMatrix; effectTransforms.mWorld.SetMatrix(ref worldMatrix); /// --- check shadowmaps hasShadowMap = renderHost.IsShadowMapEnabled; effectMaterial.bHasShadowMapVariable.Set(hasShadowMap); /// --- set material params if (phongMaterial != null) { effectMaterial.vMaterialDiffuseVariable.Set(phongMaterial.DiffuseColor); effectMaterial.vMaterialAmbientVariable.Set(phongMaterial.AmbientColor); effectMaterial.vMaterialEmissiveVariable.Set(phongMaterial.EmissiveColor); effectMaterial.vMaterialSpecularVariable.Set(phongMaterial.SpecularColor); effectMaterial.vMaterialReflectVariable.Set(phongMaterial.ReflectiveColor); effectMaterial.sMaterialShininessVariable.Set(phongMaterial.SpecularShininess); /// --- has samples effectMaterial.bHasDiffuseMapVariable.Set(phongMaterial.DiffuseMap != null); effectMaterial.bHasNormalMapVariable.Set(phongMaterial.NormalMap != null); /// --- set samplers if (phongMaterial.DiffuseMap != null) { effectMaterial.texDiffuseMapVariable.SetResource(texDiffuseMapView); } if (phongMaterial.NormalMap != null) { effectMaterial.texNormalMapVariable.SetResource(texNormalMapView); } } /// --- check instancing hasInstances = (Instances != null) && (Instances.Any()); if (bHasInstances != null) { bHasInstances.Set(hasInstances); } /// --- set context Device.ImmediateContext.InputAssembler.InputLayout = vertexLayout; Device.ImmediateContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList; Device.ImmediateContext.InputAssembler.SetIndexBuffer(indexBuffer, Format.R32_UInt, 0); /// --- set rasterstate Device.ImmediateContext.Rasterizer.State = rasterState; if (hasInstances) { /// --- update instance buffer if (isChanged) { instanceBuffer = Buffer.Create(Device, instanceArray, new BufferDescription(Matrix.SizeInBytes * instanceArray.Length, ResourceUsage.Dynamic, BindFlags.VertexBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, 0)); DataStream stream; Device.ImmediateContext.MapSubresource(instanceBuffer, MapMode.WriteDiscard, MapFlags.None, out stream); stream.Position = 0; stream.WriteRange(instanceArray, 0, instanceArray.Length); Device.ImmediateContext.UnmapSubresource(instanceBuffer, 0); stream.Dispose(); isChanged = false; } /// --- INSTANCING: need to set 2 buffers Device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new[] { new VertexBufferBinding(vertexBuffer, DynamoMeshVertex.SizeInBytes, 0), new VertexBufferBinding(instanceBuffer, Matrix.SizeInBytes, 0), }); /// --- render the geometry effectTechnique.GetPassByIndex(0).Apply(Device.ImmediateContext); /// --- draw Device.ImmediateContext.DrawIndexedInstanced(Geometry.Indices.Count, instanceArray.Length, 0, 0, 0); } else { /// --- bind buffer Device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertexBuffer, DynamoMeshVertex.SizeInBytes, 0)); /// --- render the geometry effectTechnique.GetPassByIndex(0).Apply(Device.ImmediateContext); /// --- draw Device.ImmediateContext.DrawIndexed(Geometry.Indices.Count, 0, 0); } }
static void Main() { { // Anonymous enums int i = enum_thorough.AnonEnum1; if (enum_thorough.ReallyAnInteger != 200) throw new Exception("Test Anon 1 failed"); i += enum_thorough.AnonSpaceEnum1; i += AnonStruct.AnonStructEnum1; } { colour red = colour.red; enum_thorough.colourTest1(red); enum_thorough.colourTest2(red); enum_thorough.colourTest3(red); enum_thorough.colourTest4(red); enum_thorough.myColour = red; } { SpeedClass s = new SpeedClass(); SpeedClass.speed speed = SpeedClass.speed.slow; if (s.speedTest1(speed) != speed) throw new Exception("speedTest 1 failed"); if (s.speedTest2(speed) != speed) throw new Exception("speedTest 2 failed"); if (s.speedTest3(speed) != speed) throw new Exception("speedTest 3 failed"); if (s.speedTest4(speed) != speed) throw new Exception("speedTest 4 failed"); if (s.speedTest5(speed) != speed) throw new Exception("speedTest 5 failed"); if (s.speedTest6(speed) != speed) throw new Exception("speedTest 6 failed"); if (s.speedTest7(speed) != speed) throw new Exception("speedTest 7 failed"); if (s.speedTest8(speed) != speed) throw new Exception("speedTest 8 failed"); if (enum_thorough.speedTest1(speed) != speed) throw new Exception("speedTest Global 1 failed"); if (enum_thorough.speedTest2(speed) != speed) throw new Exception("speedTest Global 2 failed"); if (enum_thorough.speedTest3(speed) != speed) throw new Exception("speedTest Global 3 failed"); if (enum_thorough.speedTest4(speed) != speed) throw new Exception("speedTest Global 4 failed"); if (enum_thorough.speedTest5(speed) != speed) throw new Exception("speedTest Global 5 failed"); } { SpeedClass s = new SpeedClass(); SpeedClass.speed slow = SpeedClass.speed.slow; SpeedClass.speed lightning = SpeedClass.speed.lightning; if (s.mySpeedtd1 != slow) throw new Exception("mySpeedtd1 1 failed"); if ((int)s.mySpeedtd1 != 10) throw new Exception("mySpeedtd1 2 failed"); s.mySpeedtd1 = lightning; if (s.mySpeedtd1 != lightning) throw new Exception("mySpeedtd1 3 failed"); if ((int)s.mySpeedtd1 != 31) throw new Exception("mySpeedtd1 4 failed"); } { if (enum_thorough.namedanonTest1(namedanon.NamedAnon2) != namedanon.NamedAnon2) throw new Exception("namedanonTest 1 failed"); } { twonames val = twonames.TwoNames2; if (enum_thorough.twonamesTest1(val) != val) throw new Exception("twonamesTest 1 failed"); if (enum_thorough.twonamesTest2(val) != val) throw new Exception("twonamesTest 2 failed"); if (enum_thorough.twonamesTest3(val) != val) throw new Exception("twonamesTest 3 failed"); } { TwoNamesStruct t = new TwoNamesStruct(); TwoNamesStruct.twonames val = TwoNamesStruct.twonames.TwoNamesStruct1; if (t.twonamesTest1(val) != val) throw new Exception("twonamesTest 1 failed"); if (t.twonamesTest2(val) != val) throw new Exception("twonamesTest 2 failed"); if (t.twonamesTest3(val) != val) throw new Exception("twonamesTest 3 failed"); } { namedanonspace val = namedanonspace.NamedAnonSpace2; if (enum_thorough.namedanonspaceTest1(val) != val) throw new Exception("namedanonspaceTest 1 failed"); if (enum_thorough.namedanonspaceTest2(val) != val) throw new Exception("namedanonspaceTest 2 failed"); if (enum_thorough.namedanonspaceTest3(val) != val) throw new Exception("namedanonspaceTest 3 failed"); if (enum_thorough.namedanonspaceTest4(val) != val) throw new Exception("namedanonspaceTest 4 failed"); } { TemplateClassInt t = new TemplateClassInt(); TemplateClassInt.scientists galileo = TemplateClassInt.scientists.galileo; if (t.scientistsTest1(galileo) != galileo) throw new Exception("scientistsTest 1 failed"); if (t.scientistsTest2(galileo) != galileo) throw new Exception("scientistsTest 2 failed"); if (t.scientistsTest3(galileo) != galileo) throw new Exception("scientistsTest 3 failed"); if (t.scientistsTest4(galileo) != galileo) throw new Exception("scientistsTest 4 failed"); if (t.scientistsTest5(galileo) != galileo) throw new Exception("scientistsTest 5 failed"); if (t.scientistsTest6(galileo) != galileo) throw new Exception("scientistsTest 6 failed"); if (t.scientistsTest7(galileo) != galileo) throw new Exception("scientistsTest 7 failed"); if (t.scientistsTest8(galileo) != galileo) throw new Exception("scientistsTest 8 failed"); if (t.scientistsTest9(galileo) != galileo) throw new Exception("scientistsTest 9 failed"); // if (t.scientistsTestA(galileo) != galileo) throw new Exception("scientistsTest A failed"); if (t.scientistsTestB(galileo) != galileo) throw new Exception("scientistsTest B failed"); // if (t.scientistsTestC(galileo) != galileo) throw new Exception("scientistsTest C failed"); if (t.scientistsTestD(galileo) != galileo) throw new Exception("scientistsTest D failed"); if (t.scientistsTestE(galileo) != galileo) throw new Exception("scientistsTest E failed"); if (t.scientistsTestF(galileo) != galileo) throw new Exception("scientistsTest F failed"); if (t.scientistsTestG(galileo) != galileo) throw new Exception("scientistsTest G failed"); if (t.scientistsTestH(galileo) != galileo) throw new Exception("scientistsTest H failed"); if (t.scientistsTestI(galileo) != galileo) throw new Exception("scientistsTest I failed"); if (t.scientistsTestJ(galileo) != galileo) throw new Exception("scientistsTest J failed"); if (enum_thorough.scientistsTest1(galileo) != galileo) throw new Exception("scientistsTest Global 1 failed"); if (enum_thorough.scientistsTest2(galileo) != galileo) throw new Exception("scientistsTest Global 2 failed"); if (enum_thorough.scientistsTest3(galileo) != galileo) throw new Exception("scientistsTest Global 3 failed"); if (enum_thorough.scientistsTest4(galileo) != galileo) throw new Exception("scientistsTest Global 4 failed"); if (enum_thorough.scientistsTest5(galileo) != galileo) throw new Exception("scientistsTest Global 5 failed"); if (enum_thorough.scientistsTest6(galileo) != galileo) throw new Exception("scientistsTest Global 6 failed"); if (enum_thorough.scientistsTest7(galileo) != galileo) throw new Exception("scientistsTest Global 7 failed"); if (enum_thorough.scientistsTest8(galileo) != galileo) throw new Exception("scientistsTest Global 8 failed"); } { TClassInt t = new TClassInt(); TClassInt.scientists bell = TClassInt.scientists.bell; TemplateClassInt.scientists galileo = TemplateClassInt.scientists.galileo; if (t.scientistsNameTest1(bell) != bell) throw new Exception("scientistsNameTest 1 failed"); if (t.scientistsNameTest2(bell) != bell) throw new Exception("scientistsNameTest 2 failed"); if (t.scientistsNameTest3(bell) != bell) throw new Exception("scientistsNameTest 3 failed"); if (t.scientistsNameTest4(bell) != bell) throw new Exception("scientistsNameTest 4 failed"); if (t.scientistsNameTest5(bell) != bell) throw new Exception("scientistsNameTest 5 failed"); if (t.scientistsNameTest6(bell) != bell) throw new Exception("scientistsNameTest 6 failed"); if (t.scientistsNameTest7(bell) != bell) throw new Exception("scientistsNameTest 7 failed"); if (t.scientistsNameTest8(bell) != bell) throw new Exception("scientistsNameTest 8 failed"); if (t.scientistsNameTest9(bell) != bell) throw new Exception("scientistsNameTest 9 failed"); // if (t.scientistsNameTestA(bell) != bell) throw new Exception("scientistsNameTest A failed"); if (t.scientistsNameTestB(bell) != bell) throw new Exception("scientistsNameTest B failed"); // if (t.scientistsNameTestC(bell) != bell) throw new Exception("scientistsNameTest C failed"); if (t.scientistsNameTestD(bell) != bell) throw new Exception("scientistsNameTest D failed"); if (t.scientistsNameTestE(bell) != bell) throw new Exception("scientistsNameTest E failed"); if (t.scientistsNameTestF(bell) != bell) throw new Exception("scientistsNameTest F failed"); if (t.scientistsNameTestG(bell) != bell) throw new Exception("scientistsNameTest G failed"); if (t.scientistsNameTestH(bell) != bell) throw new Exception("scientistsNameTest H failed"); if (t.scientistsNameTestI(bell) != bell) throw new Exception("scientistsNameTest I failed"); if (t.scientistsNameSpaceTest1(bell) != bell) throw new Exception("scientistsNameSpaceTest 1 failed"); if (t.scientistsNameSpaceTest2(bell) != bell) throw new Exception("scientistsNameSpaceTest 2 failed"); if (t.scientistsNameSpaceTest3(bell) != bell) throw new Exception("scientistsNameSpaceTest 3 failed"); if (t.scientistsNameSpaceTest4(bell) != bell) throw new Exception("scientistsNameSpaceTest 4 failed"); if (t.scientistsNameSpaceTest5(bell) != bell) throw new Exception("scientistsNameSpaceTest 5 failed"); if (t.scientistsNameSpaceTest6(bell) != bell) throw new Exception("scientistsNameSpaceTest 6 failed"); if (t.scientistsNameSpaceTest7(bell) != bell) throw new Exception("scientistsNameSpaceTest 7 failed"); if (t.scientistsOtherTest1(galileo) != galileo) throw new Exception("scientistsOtherTest 1 failed"); if (t.scientistsOtherTest2(galileo) != galileo) throw new Exception("scientistsOtherTest 2 failed"); if (t.scientistsOtherTest3(galileo) != galileo) throw new Exception("scientistsOtherTest 3 failed"); if (t.scientistsOtherTest4(galileo) != galileo) throw new Exception("scientistsOtherTest 4 failed"); if (t.scientistsOtherTest5(galileo) != galileo) throw new Exception("scientistsOtherTest 5 failed"); if (t.scientistsOtherTest6(galileo) != galileo) throw new Exception("scientistsOtherTest 6 failed"); if (t.scientistsOtherTest7(galileo) != galileo) throw new Exception("scientistsOtherTest 7 failed"); if (enum_thorough.scientistsNameTest1(bell) != bell) throw new Exception("scientistsNameTest Global 1 failed"); if (enum_thorough.scientistsNameTest2(bell) != bell) throw new Exception("scientistsNameTest Global 2 failed"); if (enum_thorough.scientistsNameTest3(bell) != bell) throw new Exception("scientistsNameTest Global 3 failed"); if (enum_thorough.scientistsNameTest4(bell) != bell) throw new Exception("scientistsNameTest Global 4 failed"); if (enum_thorough.scientistsNameTest5(bell) != bell) throw new Exception("scientistsNameTest Global 5 failed"); if (enum_thorough.scientistsNameTest6(bell) != bell) throw new Exception("scientistsNameTest Global 6 failed"); if (enum_thorough.scientistsNameTest7(bell) != bell) throw new Exception("scientistsNameTest Global 7 failed"); if (enum_thorough.scientistsNameSpaceTest1(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 1 failed"); if (enum_thorough.scientistsNameSpaceTest2(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 2 failed"); if (enum_thorough.scientistsNameSpaceTest3(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 3 failed"); if (enum_thorough.scientistsNameSpaceTest4(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 4 failed"); if (enum_thorough.scientistsNameSpaceTest5(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 5 failed"); if (enum_thorough.scientistsNameSpaceTest6(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 6 failed"); if (enum_thorough.scientistsNameSpaceTest7(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 7 failed"); if (enum_thorough.scientistsNameSpaceTest8(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 8 failed"); if (enum_thorough.scientistsNameSpaceTest9(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 9 failed"); if (enum_thorough.scientistsNameSpaceTestA(bell) != bell) throw new Exception("scientistsNameSpaceTest Global A failed"); if (enum_thorough.scientistsNameSpaceTestB(bell) != bell) throw new Exception("scientistsNameSpaceTest Global B failed"); if (enum_thorough.scientistsNameSpaceTestC(bell) != bell) throw new Exception("scientistsNameSpaceTest Global C failed"); if (enum_thorough.scientistsNameSpaceTestD(bell) != bell) throw new Exception("scientistsNameSpaceTest Global D failed"); if (enum_thorough.scientistsNameSpaceTestE(bell) != bell) throw new Exception("scientistsNameSpaceTest Global E failed"); if (enum_thorough.scientistsNameSpaceTestF(bell) != bell) throw new Exception("scientistsNameSpaceTest Global F failed"); if (enum_thorough.scientistsNameSpaceTestG(bell) != bell) throw new Exception("scientistsNameSpaceTest Global G failed"); if (enum_thorough.scientistsNameSpaceTestH(bell) != bell) throw new Exception("scientistsNameSpaceTest Global H failed"); if (enum_thorough.scientistsNameSpaceTestI(bell) != bell) throw new Exception("scientistsNameSpaceTest Global I failed"); if (enum_thorough.scientistsNameSpaceTestJ(bell) != bell) throw new Exception("scientistsNameSpaceTest Global J failed"); if (enum_thorough.scientistsNameSpaceTestK(bell) != bell) throw new Exception("scientistsNameSpaceTest Global K failed"); if (enum_thorough.scientistsNameSpaceTestL(bell) != bell) throw new Exception("scientistsNameSpaceTest Global L failed"); } { newname val = newname.argh; if (enum_thorough.renameTest1(val) != val) throw new Exception("renameTest Global 1 failed"); if (enum_thorough.renameTest2(val) != val) throw new Exception("renameTest Global 2 failed"); } { NewNameStruct n = new NewNameStruct(); if (n.renameTest1(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new Exception("renameTest 1 failed"); if (n.renameTest2(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new Exception("renameTest 2 failed"); if (n.renameTest3(NewNameStruct.simplerenamed.simple1) != NewNameStruct.simplerenamed.simple1) throw new Exception("renameTest 3 failed"); if (n.renameTest4(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest 4 failed"); if (n.renameTest5(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest 5 failed"); if (n.renameTest6(NewNameStruct.singlenamerenamed.singlename1) != NewNameStruct.singlenamerenamed.singlename1) throw new Exception("renameTest 6 failed"); } { if (enum_thorough.renameTest3(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new Exception("renameTest Global 3 failed"); if (enum_thorough.renameTest4(NewNameStruct.simplerenamed.simple1) != NewNameStruct.simplerenamed.simple1) throw new Exception("renameTest Global 4 failed"); if (enum_thorough.renameTest5(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest Global 5 failed"); if (enum_thorough.renameTest6(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest Global 6 failed"); if (enum_thorough.renameTest7(NewNameStruct.singlenamerenamed.singlename1) != NewNameStruct.singlenamerenamed.singlename1) throw new Exception("renameTest Global 7 failed"); } { TreesClass t = new TreesClass(); TreesClass.trees pine = TreesClass.trees.pine; if (t.treesTest1(pine) != pine) throw new Exception("treesTest 1 failed"); if (t.treesTest2(pine) != pine) throw new Exception("treesTest 2 failed"); if (t.treesTest3(pine) != pine) throw new Exception("treesTest 3 failed"); if (t.treesTest4(pine) != pine) throw new Exception("treesTest 4 failed"); if (t.treesTest5(pine) != pine) throw new Exception("treesTest 5 failed"); if (t.treesTest6(pine) != pine) throw new Exception("treesTest 6 failed"); if (t.treesTest7(pine) != pine) throw new Exception("treesTest 7 failed"); if (t.treesTest8(pine) != pine) throw new Exception("treesTest 8 failed"); if (t.treesTest9(pine) != pine) throw new Exception("treesTest 9 failed"); if (t.treesTestA(pine) != pine) throw new Exception("treesTest A failed"); if (t.treesTestB(pine) != pine) throw new Exception("treesTest B failed"); if (t.treesTestC(pine) != pine) throw new Exception("treesTest C failed"); if (t.treesTestD(pine) != pine) throw new Exception("treesTest D failed"); if (t.treesTestE(pine) != pine) throw new Exception("treesTest E failed"); if (t.treesTestF(pine) != pine) throw new Exception("treesTest F failed"); if (t.treesTestG(pine) != pine) throw new Exception("treesTest G failed"); if (t.treesTestH(pine) != pine) throw new Exception("treesTest H failed"); if (t.treesTestI(pine) != pine) throw new Exception("treesTest I failed"); if (t.treesTestJ(pine) != pine) throw new Exception("treesTest J failed"); if (t.treesTestK(pine) != pine) throw new Exception("treesTest K failed"); if (t.treesTestL(pine) != pine) throw new Exception("treesTest L failed"); if (t.treesTestM(pine) != pine) throw new Exception("treesTest M failed"); if (t.treesTestN(pine) != pine) throw new Exception("treesTest N failed"); if (t.treesTestO(pine) != pine) throw new Exception("treesTest O failed"); if (enum_thorough.treesTest1(pine) != pine) throw new Exception("treesTest Global 1 failed"); if (enum_thorough.treesTest2(pine) != pine) throw new Exception("treesTest Global 2 failed"); if (enum_thorough.treesTest3(pine) != pine) throw new Exception("treesTest Global 3 failed"); if (enum_thorough.treesTest4(pine) != pine) throw new Exception("treesTest Global 4 failed"); if (enum_thorough.treesTest5(pine) != pine) throw new Exception("treesTest Global 5 failed"); if (enum_thorough.treesTest6(pine) != pine) throw new Exception("treesTest Global 6 failed"); if (enum_thorough.treesTest7(pine) != pine) throw new Exception("treesTest Global 7 failed"); if (enum_thorough.treesTest8(pine) != pine) throw new Exception("treesTest Global 8 failed"); if (enum_thorough.treesTest9(pine) != pine) throw new Exception("treesTest Global 9 failed"); if (enum_thorough.treesTestA(pine) != pine) throw new Exception("treesTest Global A failed"); if (enum_thorough.treesTestB(pine) != pine) throw new Exception("treesTest Global B failed"); if (enum_thorough.treesTestC(pine) != pine) throw new Exception("treesTest Global C failed"); if (enum_thorough.treesTestD(pine) != pine) throw new Exception("treesTest Global D failed"); if (enum_thorough.treesTestE(pine) != pine) throw new Exception("treesTest Global E failed"); if (enum_thorough.treesTestF(pine) != pine) throw new Exception("treesTest Global F failed"); if (enum_thorough.treesTestG(pine) != pine) throw new Exception("treesTest Global G failed"); if (enum_thorough.treesTestH(pine) != pine) throw new Exception("treesTest Global H failed"); if (enum_thorough.treesTestI(pine) != pine) throw new Exception("treesTest Global I failed"); if (enum_thorough.treesTestJ(pine) != pine) throw new Exception("treesTest Global J failed"); if (enum_thorough.treesTestK(pine) != pine) throw new Exception("treesTest Global K failed"); if (enum_thorough.treesTestL(pine) != pine) throw new Exception("treesTest Global L failed"); if (enum_thorough.treesTestM(pine) != pine) throw new Exception("treesTest Global M failed"); // if (enum_thorough.treesTestN(pine) != pine) throw new Exception("treesTest Global N failed"); if (enum_thorough.treesTestO(pine) != pine) throw new Exception("treesTest Global O failed"); if (enum_thorough.treesTestP(pine) != pine) throw new Exception("treesTest Global P failed"); if (enum_thorough.treesTestQ(pine) != pine) throw new Exception("treesTest Global Q failed"); if (enum_thorough.treesTestR(pine) != pine) throw new Exception("treesTest Global R failed"); } { HairStruct h = new HairStruct(); HairStruct.hair ginger = HairStruct.hair.ginger; if (h.hairTest1(ginger) != ginger) throw new Exception("hairTest 1 failed"); if (h.hairTest2(ginger) != ginger) throw new Exception("hairTest 2 failed"); if (h.hairTest3(ginger) != ginger) throw new Exception("hairTest 3 failed"); if (h.hairTest4(ginger) != ginger) throw new Exception("hairTest 4 failed"); if (h.hairTest5(ginger) != ginger) throw new Exception("hairTest 5 failed"); if (h.hairTest6(ginger) != ginger) throw new Exception("hairTest 6 failed"); if (h.hairTest7(ginger) != ginger) throw new Exception("hairTest 7 failed"); if (h.hairTest8(ginger) != ginger) throw new Exception("hairTest 8 failed"); if (h.hairTest9(ginger) != ginger) throw new Exception("hairTest 9 failed"); if (h.hairTestA(ginger) != ginger) throw new Exception("hairTest A failed"); if (h.hairTestB(ginger) != ginger) throw new Exception("hairTest B failed"); colour red = colour.red; if (h.colourTest1(red) != red) throw new Exception("colourTest HairStruct 1 failed"); if (h.colourTest2(red) != red) throw new Exception("colourTest HairStruct 2 failed"); if (h.namedanonTest1(namedanon.NamedAnon2) != namedanon.NamedAnon2) throw new Exception("namedanonTest HairStruct 1 failed"); if (h.namedanonspaceTest1(namedanonspace.NamedAnonSpace2) != namedanonspace.NamedAnonSpace2) throw new Exception("namedanonspaceTest HairStruct 1 failed"); TreesClass.trees fir = TreesClass.trees.fir; if (h.treesGlobalTest1(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 1 failed"); if (h.treesGlobalTest2(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 2 failed"); if (h.treesGlobalTest3(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 3 failed"); if (h.treesGlobalTest4(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 4 failed"); } { HairStruct.hair blonde = HairStruct.hair.blonde; if (enum_thorough.hairTest1(blonde) != blonde) throw new Exception("hairTest Global 1 failed"); if (enum_thorough.hairTest2(blonde) != blonde) throw new Exception("hairTest Global 2 failed"); if (enum_thorough.hairTest3(blonde) != blonde) throw new Exception("hairTest Global 3 failed"); if (enum_thorough.hairTest4(blonde) != blonde) throw new Exception("hairTest Global 4 failed"); if (enum_thorough.hairTest5(blonde) != blonde) throw new Exception("hairTest Global 5 failed"); if (enum_thorough.hairTest6(blonde) != blonde) throw new Exception("hairTest Global 6 failed"); if (enum_thorough.hairTest7(blonde) != blonde) throw new Exception("hairTest Global 7 failed"); if (enum_thorough.hairTest8(blonde) != blonde) throw new Exception("hairTest Global 8 failed"); if (enum_thorough.hairTest9(blonde) != blonde) throw new Exception("hairTest Global 9 failed"); if (enum_thorough.hairTestA(blonde) != blonde) throw new Exception("hairTest Global A failed"); if (enum_thorough.hairTestB(blonde) != blonde) throw new Exception("hairTest Global B failed"); if (enum_thorough.hairTestC(blonde) != blonde) throw new Exception("hairTest Global C failed"); if (enum_thorough.hairTestA1(blonde) != blonde) throw new Exception("hairTest Global A1 failed"); if (enum_thorough.hairTestA2(blonde) != blonde) throw new Exception("hairTest Global A2 failed"); if (enum_thorough.hairTestA3(blonde) != blonde) throw new Exception("hairTest Global A3 failed"); if (enum_thorough.hairTestA4(blonde) != blonde) throw new Exception("hairTest Global A4 failed"); if (enum_thorough.hairTestA5(blonde) != blonde) throw new Exception("hairTest Global A5 failed"); if (enum_thorough.hairTestA6(blonde) != blonde) throw new Exception("hairTest Global A6 failed"); if (enum_thorough.hairTestA7(blonde) != blonde) throw new Exception("hairTest Global A7 failed"); if (enum_thorough.hairTestA8(blonde) != blonde) throw new Exception("hairTest Global A8 failed"); if (enum_thorough.hairTestA9(blonde) != blonde) throw new Exception("hairTest Global A9 failed"); if (enum_thorough.hairTestAA(blonde) != blonde) throw new Exception("hairTest Global AA failed"); if (enum_thorough.hairTestAB(blonde) != blonde) throw new Exception("hairTest Global AB failed"); if (enum_thorough.hairTestAC(blonde) != blonde) throw new Exception("hairTest Global AC failed"); if (enum_thorough.hairTestB1(blonde) != blonde) throw new Exception("hairTest Global B1 failed"); if (enum_thorough.hairTestB2(blonde) != blonde) throw new Exception("hairTest Global B2 failed"); if (enum_thorough.hairTestB3(blonde) != blonde) throw new Exception("hairTest Global B3 failed"); if (enum_thorough.hairTestB4(blonde) != blonde) throw new Exception("hairTest Global B4 failed"); if (enum_thorough.hairTestB5(blonde) != blonde) throw new Exception("hairTest Global B5 failed"); if (enum_thorough.hairTestB6(blonde) != blonde) throw new Exception("hairTest Global B6 failed"); if (enum_thorough.hairTestB7(blonde) != blonde) throw new Exception("hairTest Global B7 failed"); if (enum_thorough.hairTestB8(blonde) != blonde) throw new Exception("hairTest Global B8 failed"); if (enum_thorough.hairTestB9(blonde) != blonde) throw new Exception("hairTest Global B9 failed"); if (enum_thorough.hairTestBA(blonde) != blonde) throw new Exception("hairTest Global BA failed"); if (enum_thorough.hairTestBB(blonde) != blonde) throw new Exception("hairTest Global BB failed"); if (enum_thorough.hairTestBC(blonde) != blonde) throw new Exception("hairTest Global BC failed"); if (enum_thorough.hairTestC1(blonde) != blonde) throw new Exception("hairTest Global C1 failed"); if (enum_thorough.hairTestC2(blonde) != blonde) throw new Exception("hairTest Global C2 failed"); if (enum_thorough.hairTestC3(blonde) != blonde) throw new Exception("hairTest Global C3 failed"); if (enum_thorough.hairTestC4(blonde) != blonde) throw new Exception("hairTest Global C4 failed"); if (enum_thorough.hairTestC5(blonde) != blonde) throw new Exception("hairTest Global C5 failed"); if (enum_thorough.hairTestC6(blonde) != blonde) throw new Exception("hairTest Global C6 failed"); if (enum_thorough.hairTestC7(blonde) != blonde) throw new Exception("hairTest Global C7 failed"); if (enum_thorough.hairTestC8(blonde) != blonde) throw new Exception("hairTest Global C8 failed"); if (enum_thorough.hairTestC9(blonde) != blonde) throw new Exception("hairTest Global C9 failed"); if (enum_thorough.hairTestCA(blonde) != blonde) throw new Exception("hairTest Global CA failed"); if (enum_thorough.hairTestCB(blonde) != blonde) throw new Exception("hairTest Global CB failed"); if (enum_thorough.hairTestCC(blonde) != blonde) throw new Exception("hairTest Global CC failed"); } { FirStruct f = new FirStruct(); HairStruct.hair blonde = HairStruct.hair.blonde; if (f.hairTestFir1(blonde) != blonde) throw new Exception("hairTestFir 1 failed"); if (f.hairTestFir2(blonde) != blonde) throw new Exception("hairTestFir 2 failed"); if (f.hairTestFir3(blonde) != blonde) throw new Exception("hairTestFir 3 failed"); if (f.hairTestFir4(blonde) != blonde) throw new Exception("hairTestFir 4 failed"); if (f.hairTestFir5(blonde) != blonde) throw new Exception("hairTestFir 5 failed"); if (f.hairTestFir6(blonde) != blonde) throw new Exception("hairTestFir 6 failed"); if (f.hairTestFir7(blonde) != blonde) throw new Exception("hairTestFir 7 failed"); if (f.hairTestFir8(blonde) != blonde) throw new Exception("hairTestFir 8 failed"); if (f.hairTestFir9(blonde) != blonde) throw new Exception("hairTestFir 9 failed"); if (f.hairTestFirA(blonde) != blonde) throw new Exception("hairTestFir A failed"); } { enum_thorough.GlobalInstance = enum_thorough.globalinstance2; if (enum_thorough.GlobalInstance != enum_thorough.globalinstance2) throw new Exception("GlobalInstance 1 failed"); Instances i = new Instances(); i.MemberInstance = Instances.memberinstance3; if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed"); } { if ((int)enum_thorough.repeatTest(repeat.one) != 1) throw new Exception("repeatTest 1 failed"); if ((int)enum_thorough.repeatTest(repeat.initial) != 1) throw new Exception("repeatTest 2 failed"); if ((int)enum_thorough.repeatTest(repeat.two) != 2) throw new Exception("repeatTest 3 failed"); if ((int)enum_thorough.repeatTest(repeat.three) != 3) throw new Exception("repeatTest 4 failed"); if ((int)enum_thorough.repeatTest(repeat.last) != 3) throw new Exception("repeatTest 5 failed"); if ((int)enum_thorough.repeatTest(repeat.end) != 3) throw new Exception("repeatTest 6 failed"); } }
public void FactoryExampleTest() { var dataset = TestDatasets.adultText; string dataFilename = GetDataPath(dataset.trainFilename); string testDataFilename = GetDataPath(dataset.testFilename); ///********* Training a model *******// string modelFilename = Path.GetTempFileName(); TLCArguments cmd = new TLCArguments(); Assert.IsTrue(CmdParser.ParseArguments(dataset.extraSettings, cmd)); cmd.command = Command.Train; cmd.modelfile = modelFilename; cmd.datafile = dataFilename; cmd.instancesSettings = dataset.settings; cmd.classifierName = TestLearners.linearSVM.Trainer; RunExperiments.Run(cmd); // Load and make predictions with a previously saved model. IDataModel dataModel; IDataStats dataStats; var predictor = (IDistributionPredictor <Instance, Float, Float>)PredictorUtils.LoadPredictor( out dataModel, out dataStats, modelFilename); var instanceFactory = ReflectionUtilsOld.CreateInstanceOld <IInstanceFactory, SignatureInstances>( cmd.instancesClass, cmd.instancesSettings, null, dataModel); bool headerSkip = true; List <Float> outputs = new List <Float>(); List <Float> probabilities = new List <Float>(); using (StreamReader reader = new StreamReader(testDataFilename)) { List <string> features = new List <string>(); string text; long line = 0; while ((text = reader.ReadLine()) != null) { ++line; if (string.IsNullOrWhiteSpace(text)) { continue; } string[] cols = text.Split(','); Assert.IsTrue(cols.Length == 15); if (headerSkip) { // skip header line headerSkip = false; continue; } features.Clear(); // Add in the "max dimensionality" features.Add("15"); for (int col = 0; col < cols.Length; col++) { string s = cols[col].Trim(); switch (col) { case 0: case 2: case 4: case 10: case 11: case 12: case 14: // numeric feature or label -- add if non-zero Float val = InstancesUtils.FloatParse(s); if (val == 0) // Beware of NaNs - they should be recorded! { continue; } break; } features.Add(col + ":" + s); } Instance instance = instanceFactory.ProduceInstance(line, features.ToArray()); Float rawOutput, probability; probability = predictor.PredictDistribution(instance, out rawOutput); outputs.Add(rawOutput); probabilities.Add(probability); } } List <Float> originalOutputs = new List <Float>(); List <Float> originalProbabilities = new List <Float>(); var env = new LocalEnvironment(SysRandom.Wrap(RunExperiments.GetRandom(cmd))); Instances instances = RunExperiments.CreateTestData(cmd, testDataFilename, dataModel, null, env); foreach (Instance instance in instances) { Float rawOutput, probability; probability = predictor.PredictDistribution(instance, out rawOutput); originalOutputs.Add(rawOutput); originalProbabilities.Add(probability); } CollectionAssert.AreEqual(outputs, originalOutputs); CollectionAssert.AreEqual(probabilities, originalProbabilities); File.Delete(modelFilename); Done(); }
public double[][] GetColumns(IEnumerable <string> featureNames) => Instances.Select(i => i.GetColumns(featureNames)).ToArray();
public ActionResult Create(Guid tid, string name) { var newInstance = new Instance() { Name = name, TargetKey = tid, }; if (string.IsNullOrWhiteSpace(name)) ModelState.AddModelError("name", "Name is required."); if (ModelState.IsValid) { try { var instances = new Instances(); instances.CreateInstance(newInstance); return RedirectToAction("Details", new { id = newInstance.Key }); } catch (Exception ex) { ModelState.AddModelError("Error", ex); } } var targets = new Targets(); var groups = new Groups(); var target = targets.GetTarget(tid); var group = groups.GetGroup(target.GroupKey); var model = new InstanceDetails() { Instance = newInstance, Target = target, Group = group, }; return View(model); }
public JsonResult RemoveTag(Guid id, string name) { var instances = new Instances(); var instance = instances.GetInstance(id); if (!instance.Tags.ContainsKey(name)) throw new HttpException(404, "Tag not found"); instance.Tags.Remove(name); instances.UpdateInstance(instance); return Json(null); }
private void SetInstance(string name, Instances ?val) { if (!PropertyExists(name)) { } else { string strval = ""; switch (val) { case Instances.Dev: strval = "Dev"; break; case Instances.IT: strval = "IT"; break; case Instances.UAT: strval = "UAT"; break; default: strval = "Prod"; break; } Properties.Settings.Default[name] = strval; } }
/// <summary> /// Загружает классы из библиотек /// </summary> /// <param name="routFolder">Корневая директория</param> public new void LoadLibraries(string routFolder = null) { base.LoadLibraries(routFolder); _classByName = Instances.Where(m => m is IClassInfo).ToDictionary(m => ((IClassInfo)m).ClassName, m => m); }
public double[] GetColumn(string featureName) => Instances.Select(i => i.GetColumn(featureName)).ToArray();
private Instances GetInstance(string name, Instances deflt) { if (PropertyExists(name)) { string inst = (string)Properties.Settings.Default[name]; switch (inst) { case "Dev": return Instances.Dev; case "IT": return Instances.IT; case "UAT": return Instances.UAT; default: return Instances.Prod; } } else { return deflt; } }
public double[][] GetColumns(IEnumerable <int> featureIdxs) => Instances.Select(i => i.GetColumns(featureIdxs)).ToArray();
public static double classifyCrossFold_Train_Test_onlySelectedClass(string classifierFileName, int baseClasses, Classifier _classifier) { double performance = 0.0; try { List <BrResult> results = new List <BrResult>(); for (int singleClass = 1; singleClass <= baseClasses; singleClass++) { string eachFileName = String.Format("{0}_{1}.arff", classifierFileName, singleClass); BrResult result = new BrResult(); result.classNumber = singleClass; FileReader javaFileReader = new FileReader(eachFileName); weka.core.Instances insts = new weka.core.Instances(javaFileReader); javaFileReader.close(); insts.setClassIndex(insts.numAttributes() - 1); List <Result> eachResults = new List <Result>(); var totalnstances = insts.numInstances(); var foldsInstances = totalnstances / 10; Instances foldsData = new Instances(insts); var folds = 10; int numCorrect = 0; int dataIndex = 0; for (int n = 0; n < folds; n++) { System.Console.WriteLine("Performing " + n + " folds"); Instances trainFold = foldsData.trainCV(folds, n); var numnerOfTrainInst = trainFold.numInstances(); Instances testFold = foldsData.testCV(folds, n); var numnerOfTestInst = testFold.numInstances(); _classifier.buildClassifier(trainFold); //List<Result> eachResults = new List<Result>(); for (int test = 0; test < numnerOfTestInst; test++) { dataIndex++; Result eachRow = new Result(); eachRow.lineIndex = 0; weka.core.Instance currentInst = testFold.instance(test); double predictClass = _classifier.classifyInstance(currentInst); //double[] dist = _classifier.distributionForInstance(currentInst); string actualClass = testFold.classAttribute().value((int)testFold.instance(test).classValue()); string predictedClass = testFold.classAttribute().value((int)predictClass); //var abcd = _classifier.getClass(); if (predictedClass == actualClass) { eachRow.correct = "1"; numCorrect++; } else { eachRow.correct = "0"; } eachRow.lineIndex = dataIndex; eachRow.classActual = actualClass; eachRow.classPredicted = predictedClass; eachResults.Add(eachRow); } } result.classResult = eachResults; results.Add(result); //System.Console.WriteLine(numCorrect + " out of " + testSize + " correct (" + (double)((double)numCorrect / (double)testSize * 100.0) + "%)"); } #region Evaludation Matrix var evaluationMatrix = new Dictionary <int, string>(); foreach (var res in results) { foreach (var classRes in res.classResult) { if (!evaluationMatrix.Keys.Contains(classRes.lineIndex)) { evaluationMatrix[classRes.lineIndex] = classRes.correct.toString(); } else { evaluationMatrix[classRes.lineIndex] = evaluationMatrix[classRes.lineIndex].toString() + "," + classRes.correct.toString(); } } } #endregion #region int correnctlyClassified = 0; int incorrenctlyClassified = 0; int totalData = evaluationMatrix.Count; foreach (var key in evaluationMatrix.Keys) { string multiLevelClass = evaluationMatrix[key].ToString(); string[] a = multiLevelClass.Split(','); int classPredect = 0; for (int i = 0; i < a.Length; i++) { if (a[i] == "0") { classPredect++; } } if (classPredect == 0) { correnctlyClassified++; } else if (classPredect > 0) { incorrenctlyClassified++; } } performance = (double)((double)correnctlyClassified / (double)totalData) * 100; System.Console.WriteLine(performance); #endregion } catch (java.lang.Exception ex) { ex.printStackTrace(); } return(performance); }
/// /// <summary> * Analyzes time series data. Must initialize all fields of the timeseries /// * that are not being set via options (ie. multiple calls of analyze /// * must always lead to the same result). Must not change the dataset /// * in any way. /// * </summary> /// * <param name="data"> set of instances serving as training data </param> /// * <exception cref="Exception"> if the analysis has not been /// * done successfully </exception> /// //JAVA TO VB & C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public abstract void analyze(Instances data) throws Exception; public abstract void analyze(Instances data);
public AdvancedVendor(Serial serial) : base(serial) { Instances.Add(this); }
public override void OnDelete() { base.OnDelete(); Instances.Remove(this); }
public void LearnModel() { Init(); foreach (Feature currFeature in DomPool.SelectorFeatures) { String featureString = currFeature.ToString(); HashSet <HtmlNode> resNodes = DomPool.RunXpathQuery(featureString); foreach (HtmlNode nd in resNodes) { if (!allNodes.Contains(nd)) { continue; } nodeFeatures[nd].Add(featureString); } } FastVector fvWekaAttributes = GetDataSetAtts(); Instances trainingSet = new Instances("TS", fvWekaAttributes, 100); trainingSet.setClassIndex(fvWekaAttributes.size() - 1); foreach (HtmlNode currNode in allNodes) { Instance item = new SparseInstance(fvWekaAttributes.size()); for (int i = 0; i < fvWekaAttributes.size() - 1; i++) { weka.core.Attribute currFeature = (weka.core.Attribute)fvWekaAttributes.elementAt(i); if (nodeFeatures[currNode].Contains(currFeature.name())) { item.setValue(currFeature, 1); } else { item.setValue(currFeature, 0); } } //set the class weka.core.Attribute classFeature = (weka.core.Attribute)fvWekaAttributes.elementAt(fvWekaAttributes.size() - 1); item.setValue(classFeature, (DomPool.TargetNodes.Contains(currNode)?"yes":"no")); item.setDataset(trainingSet); if (DomPool.TargetNodes.Contains(currNode)) { for (int t = 0; t < (DomPool.NonTargetNodes.Count() / DomPool.TargetNodes.Count()); t++) { trainingSet.add(new SparseInstance(item)); } } else { trainingSet.add(item); } } String[] options = new String[2]; options[0] = "-C"; // unpruned tree options[1] = "0.1"; J48 tree = new J48(); // new instance of tree tree.setOptions(options); // set the options tree.buildClassifier(trainingSet); // build classifier //save the resulting classifier classifierTree = tree; Reader treeDot = new StringReader(tree.graph()); TreeBuild treeBuild = new TreeBuild(); Node treeRoot = treeBuild.create(treeDot); FeaturesUsed = getTreeFeatures(treeRoot); }
public double[][] GetInputs() => Instances.Select(i => i.GetInputs()).ToArray();
static void Main() { { // Anonymous enums int i = enum_thorough_simple.AnonEnum1; if (enum_thorough_simple.ReallyAnInteger != 200) throw new Exception("Test Anon 1 failed"); i += enum_thorough_simple.AnonSpaceEnum1; i += AnonStruct.AnonStructEnum1; } { int red = enum_thorough_simple.red; enum_thorough_simple.colourTest1(red); enum_thorough_simple.colourTest2(red); enum_thorough_simple.colourTest3(red); enum_thorough_simple.colourTest4(red); enum_thorough_simple.myColour = red; } { SpeedClass s = new SpeedClass(); int speed = SpeedClass.slow; if (s.speedTest1(speed) != speed) throw new Exception("speedTest 1 failed"); if (s.speedTest2(speed) != speed) throw new Exception("speedTest 2 failed"); if (s.speedTest3(speed) != speed) throw new Exception("speedTest 3 failed"); if (s.speedTest4(speed) != speed) throw new Exception("speedTest 4 failed"); if (s.speedTest5(speed) != speed) throw new Exception("speedTest 5 failed"); if (s.speedTest6(speed) != speed) throw new Exception("speedTest 6 failed"); if (s.speedTest7(speed) != speed) throw new Exception("speedTest 7 failed"); if (s.speedTest8(speed) != speed) throw new Exception("speedTest 8 failed"); if (enum_thorough_simple.speedTest1(speed) != speed) throw new Exception("speedTest Global 1 failed"); if (enum_thorough_simple.speedTest2(speed) != speed) throw new Exception("speedTest Global 2 failed"); if (enum_thorough_simple.speedTest3(speed) != speed) throw new Exception("speedTest Global 3 failed"); if (enum_thorough_simple.speedTest4(speed) != speed) throw new Exception("speedTest Global 4 failed"); if (enum_thorough_simple.speedTest5(speed) != speed) throw new Exception("speedTest Global 5 failed"); } { SpeedClass s = new SpeedClass(); int slow = SpeedClass.slow; int lightning = SpeedClass.lightning; if (s.mySpeedtd1 != slow) throw new Exception("mySpeedtd1 1 failed"); if (s.mySpeedtd1 != 10) throw new Exception("mySpeedtd1 2 failed"); s.mySpeedtd1 = lightning; if (s.mySpeedtd1 != lightning) throw new Exception("mySpeedtd1 3 failed"); if (s.mySpeedtd1 != 31) throw new Exception("mySpeedtd1 4 failed"); } { if (enum_thorough_simple.namedanonTest1(enum_thorough_simple.NamedAnon2) != enum_thorough_simple.NamedAnon2) throw new Exception("namedanonTest 1 failed"); } { int val = enum_thorough_simple.TwoNames2; if (enum_thorough_simple.twonamesTest1(val) != val) throw new Exception("twonamesTest 1 failed"); if (enum_thorough_simple.twonamesTest2(val) != val) throw new Exception("twonamesTest 2 failed"); if (enum_thorough_simple.twonamesTest3(val) != val) throw new Exception("twonamesTest 3 failed"); } { TwoNamesStruct t = new TwoNamesStruct(); int val = TwoNamesStruct.TwoNamesStruct1; if (t.twonamesTest1(val) != val) throw new Exception("twonamesTest 1 failed"); if (t.twonamesTest2(val) != val) throw new Exception("twonamesTest 2 failed"); if (t.twonamesTest3(val) != val) throw new Exception("twonamesTest 3 failed"); } { int val = enum_thorough_simple.NamedAnonSpace2; if (enum_thorough_simple.namedanonspaceTest1(val) != val) throw new Exception("namedanonspaceTest 1 failed"); if (enum_thorough_simple.namedanonspaceTest2(val) != val) throw new Exception("namedanonspaceTest 2 failed"); if (enum_thorough_simple.namedanonspaceTest3(val) != val) throw new Exception("namedanonspaceTest 3 failed"); if (enum_thorough_simple.namedanonspaceTest4(val) != val) throw new Exception("namedanonspaceTest 4 failed"); } { TemplateClassInt t = new TemplateClassInt(); int galileo = TemplateClassInt.galileo; if (t.scientistsTest1(galileo) != galileo) throw new Exception("scientistsTest 1 failed"); if (t.scientistsTest2(galileo) != galileo) throw new Exception("scientistsTest 2 failed"); if (t.scientistsTest3(galileo) != galileo) throw new Exception("scientistsTest 3 failed"); if (t.scientistsTest4(galileo) != galileo) throw new Exception("scientistsTest 4 failed"); if (t.scientistsTest5(galileo) != galileo) throw new Exception("scientistsTest 5 failed"); if (t.scientistsTest6(galileo) != galileo) throw new Exception("scientistsTest 6 failed"); if (t.scientistsTest7(galileo) != galileo) throw new Exception("scientistsTest 7 failed"); if (t.scientistsTest8(galileo) != galileo) throw new Exception("scientistsTest 8 failed"); if (t.scientistsTest9(galileo) != galileo) throw new Exception("scientistsTest 9 failed"); // if (t.scientistsTestA(galileo) != galileo) throw new Exception("scientistsTest A failed"); if (t.scientistsTestB(galileo) != galileo) throw new Exception("scientistsTest B failed"); // if (t.scientistsTestC(galileo) != galileo) throw new Exception("scientistsTest C failed"); if (t.scientistsTestD(galileo) != galileo) throw new Exception("scientistsTest D failed"); if (t.scientistsTestE(galileo) != galileo) throw new Exception("scientistsTest E failed"); if (t.scientistsTestF(galileo) != galileo) throw new Exception("scientistsTest F failed"); if (t.scientistsTestG(galileo) != galileo) throw new Exception("scientistsTest G failed"); if (t.scientistsTestH(galileo) != galileo) throw new Exception("scientistsTest H failed"); if (t.scientistsTestI(galileo) != galileo) throw new Exception("scientistsTest I failed"); if (t.scientistsTestJ(galileo) != galileo) throw new Exception("scientistsTest J failed"); if (enum_thorough_simple.scientistsTest1(galileo) != galileo) throw new Exception("scientistsTest Global 1 failed"); if (enum_thorough_simple.scientistsTest2(galileo) != galileo) throw new Exception("scientistsTest Global 2 failed"); if (enum_thorough_simple.scientistsTest3(galileo) != galileo) throw new Exception("scientistsTest Global 3 failed"); if (enum_thorough_simple.scientistsTest4(galileo) != galileo) throw new Exception("scientistsTest Global 4 failed"); if (enum_thorough_simple.scientistsTest5(galileo) != galileo) throw new Exception("scientistsTest Global 5 failed"); if (enum_thorough_simple.scientistsTest6(galileo) != galileo) throw new Exception("scientistsTest Global 6 failed"); if (enum_thorough_simple.scientistsTest7(galileo) != galileo) throw new Exception("scientistsTest Global 7 failed"); if (enum_thorough_simple.scientistsTest8(galileo) != galileo) throw new Exception("scientistsTest Global 8 failed"); } { TClassInt t = new TClassInt(); int bell = TClassInt.bell; int galileo = TemplateClassInt.galileo; if (t.scientistsNameTest1(bell) != bell) throw new Exception("scientistsNameTest 1 failed"); if (t.scientistsNameTest2(bell) != bell) throw new Exception("scientistsNameTest 2 failed"); if (t.scientistsNameTest3(bell) != bell) throw new Exception("scientistsNameTest 3 failed"); if (t.scientistsNameTest4(bell) != bell) throw new Exception("scientistsNameTest 4 failed"); if (t.scientistsNameTest5(bell) != bell) throw new Exception("scientistsNameTest 5 failed"); if (t.scientistsNameTest6(bell) != bell) throw new Exception("scientistsNameTest 6 failed"); if (t.scientistsNameTest7(bell) != bell) throw new Exception("scientistsNameTest 7 failed"); if (t.scientistsNameTest8(bell) != bell) throw new Exception("scientistsNameTest 8 failed"); if (t.scientistsNameTest9(bell) != bell) throw new Exception("scientistsNameTest 9 failed"); // if (t.scientistsNameTestA(bell) != bell) throw new Exception("scientistsNameTest A failed"); if (t.scientistsNameTestB(bell) != bell) throw new Exception("scientistsNameTest B failed"); // if (t.scientistsNameTestC(bell) != bell) throw new Exception("scientistsNameTest C failed"); if (t.scientistsNameTestD(bell) != bell) throw new Exception("scientistsNameTest D failed"); if (t.scientistsNameTestE(bell) != bell) throw new Exception("scientistsNameTest E failed"); if (t.scientistsNameTestF(bell) != bell) throw new Exception("scientistsNameTest F failed"); if (t.scientistsNameTestG(bell) != bell) throw new Exception("scientistsNameTest G failed"); if (t.scientistsNameTestH(bell) != bell) throw new Exception("scientistsNameTest H failed"); if (t.scientistsNameTestI(bell) != bell) throw new Exception("scientistsNameTest I failed"); if (t.scientistsNameSpaceTest1(bell) != bell) throw new Exception("scientistsNameSpaceTest 1 failed"); if (t.scientistsNameSpaceTest2(bell) != bell) throw new Exception("scientistsNameSpaceTest 2 failed"); if (t.scientistsNameSpaceTest3(bell) != bell) throw new Exception("scientistsNameSpaceTest 3 failed"); if (t.scientistsNameSpaceTest4(bell) != bell) throw new Exception("scientistsNameSpaceTest 4 failed"); if (t.scientistsNameSpaceTest5(bell) != bell) throw new Exception("scientistsNameSpaceTest 5 failed"); if (t.scientistsNameSpaceTest6(bell) != bell) throw new Exception("scientistsNameSpaceTest 6 failed"); if (t.scientistsNameSpaceTest7(bell) != bell) throw new Exception("scientistsNameSpaceTest 7 failed"); if (t.scientistsOtherTest1(galileo) != galileo) throw new Exception("scientistsOtherTest 1 failed"); if (t.scientistsOtherTest2(galileo) != galileo) throw new Exception("scientistsOtherTest 2 failed"); if (t.scientistsOtherTest3(galileo) != galileo) throw new Exception("scientistsOtherTest 3 failed"); if (t.scientistsOtherTest4(galileo) != galileo) throw new Exception("scientistsOtherTest 4 failed"); if (t.scientistsOtherTest5(galileo) != galileo) throw new Exception("scientistsOtherTest 5 failed"); if (t.scientistsOtherTest6(galileo) != galileo) throw new Exception("scientistsOtherTest 6 failed"); if (t.scientistsOtherTest7(galileo) != galileo) throw new Exception("scientistsOtherTest 7 failed"); if (enum_thorough_simple.scientistsNameTest1(bell) != bell) throw new Exception("scientistsNameTest Global 1 failed"); if (enum_thorough_simple.scientistsNameTest2(bell) != bell) throw new Exception("scientistsNameTest Global 2 failed"); if (enum_thorough_simple.scientistsNameTest3(bell) != bell) throw new Exception("scientistsNameTest Global 3 failed"); if (enum_thorough_simple.scientistsNameTest4(bell) != bell) throw new Exception("scientistsNameTest Global 4 failed"); if (enum_thorough_simple.scientistsNameTest5(bell) != bell) throw new Exception("scientistsNameTest Global 5 failed"); if (enum_thorough_simple.scientistsNameTest6(bell) != bell) throw new Exception("scientistsNameTest Global 6 failed"); if (enum_thorough_simple.scientistsNameTest7(bell) != bell) throw new Exception("scientistsNameTest Global 7 failed"); if (enum_thorough_simple.scientistsNameSpaceTest1(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 1 failed"); if (enum_thorough_simple.scientistsNameSpaceTest2(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 2 failed"); if (enum_thorough_simple.scientistsNameSpaceTest3(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 3 failed"); if (enum_thorough_simple.scientistsNameSpaceTest4(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 4 failed"); if (enum_thorough_simple.scientistsNameSpaceTest5(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 5 failed"); if (enum_thorough_simple.scientistsNameSpaceTest6(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 6 failed"); if (enum_thorough_simple.scientistsNameSpaceTest7(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 7 failed"); if (enum_thorough_simple.scientistsNameSpaceTest8(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 8 failed"); if (enum_thorough_simple.scientistsNameSpaceTest9(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 9 failed"); if (enum_thorough_simple.scientistsNameSpaceTestA(bell) != bell) throw new Exception("scientistsNameSpaceTest Global A failed"); if (enum_thorough_simple.scientistsNameSpaceTestB(bell) != bell) throw new Exception("scientistsNameSpaceTest Global B failed"); if (enum_thorough_simple.scientistsNameSpaceTestC(bell) != bell) throw new Exception("scientistsNameSpaceTest Global C failed"); if (enum_thorough_simple.scientistsNameSpaceTestD(bell) != bell) throw new Exception("scientistsNameSpaceTest Global D failed"); if (enum_thorough_simple.scientistsNameSpaceTestE(bell) != bell) throw new Exception("scientistsNameSpaceTest Global E failed"); if (enum_thorough_simple.scientistsNameSpaceTestF(bell) != bell) throw new Exception("scientistsNameSpaceTest Global F failed"); if (enum_thorough_simple.scientistsNameSpaceTestG(bell) != bell) throw new Exception("scientistsNameSpaceTest Global G failed"); if (enum_thorough_simple.scientistsNameSpaceTestH(bell) != bell) throw new Exception("scientistsNameSpaceTest Global H failed"); if (enum_thorough_simple.scientistsNameSpaceTestI(bell) != bell) throw new Exception("scientistsNameSpaceTest Global I failed"); if (enum_thorough_simple.scientistsNameSpaceTestJ(bell) != bell) throw new Exception("scientistsNameSpaceTest Global J failed"); if (enum_thorough_simple.scientistsNameSpaceTestK(bell) != bell) throw new Exception("scientistsNameSpaceTest Global K failed"); if (enum_thorough_simple.scientistsNameSpaceTestL(bell) != bell) throw new Exception("scientistsNameSpaceTest Global L failed"); } { int val = enum_thorough_simple.argh; if (enum_thorough_simple.renameTest1(val) != val) throw new Exception("renameTest Global 1 failed"); if (enum_thorough_simple.renameTest2(val) != val) throw new Exception("renameTest Global 2 failed"); } { NewNameStruct n = new NewNameStruct(); if (n.renameTest1(NewNameStruct.bang) != NewNameStruct.bang) throw new Exception("renameTest 1 failed"); if (n.renameTest2(NewNameStruct.bang) != NewNameStruct.bang) throw new Exception("renameTest 2 failed"); if (n.renameTest3(NewNameStruct.simple1) != NewNameStruct.simple1) throw new Exception("renameTest 3 failed"); if (n.renameTest4(NewNameStruct.doublename1) != NewNameStruct.doublename1) throw new Exception("renameTest 4 failed"); if (n.renameTest5(NewNameStruct.doublename1) != NewNameStruct.doublename1) throw new Exception("renameTest 5 failed"); if (n.renameTest6(NewNameStruct.singlename1) != NewNameStruct.singlename1) throw new Exception("renameTest 6 failed"); } { if (enum_thorough_simple.renameTest3(NewNameStruct.bang) != NewNameStruct.bang) throw new Exception("renameTest Global 3 failed"); if (enum_thorough_simple.renameTest4(NewNameStruct.simple1) != NewNameStruct.simple1) throw new Exception("renameTest Global 4 failed"); if (enum_thorough_simple.renameTest5(NewNameStruct.doublename1) != NewNameStruct.doublename1) throw new Exception("renameTest Global 5 failed"); if (enum_thorough_simple.renameTest6(NewNameStruct.doublename1) != NewNameStruct.doublename1) throw new Exception("renameTest Global 6 failed"); if (enum_thorough_simple.renameTest7(NewNameStruct.singlename1) != NewNameStruct.singlename1) throw new Exception("renameTest Global 7 failed"); } { TreesClass t = new TreesClass(); int pine = TreesClass.pine; if (t.treesTest1(pine) != pine) throw new Exception("treesTest 1 failed"); if (t.treesTest2(pine) != pine) throw new Exception("treesTest 2 failed"); if (t.treesTest3(pine) != pine) throw new Exception("treesTest 3 failed"); if (t.treesTest4(pine) != pine) throw new Exception("treesTest 4 failed"); if (t.treesTest5(pine) != pine) throw new Exception("treesTest 5 failed"); if (t.treesTest6(pine) != pine) throw new Exception("treesTest 6 failed"); if (t.treesTest7(pine) != pine) throw new Exception("treesTest 7 failed"); if (t.treesTest8(pine) != pine) throw new Exception("treesTest 8 failed"); if (t.treesTest9(pine) != pine) throw new Exception("treesTest 9 failed"); if (t.treesTestA(pine) != pine) throw new Exception("treesTest A failed"); if (t.treesTestB(pine) != pine) throw new Exception("treesTest B failed"); if (t.treesTestC(pine) != pine) throw new Exception("treesTest C failed"); if (t.treesTestD(pine) != pine) throw new Exception("treesTest D failed"); if (t.treesTestE(pine) != pine) throw new Exception("treesTest E failed"); if (t.treesTestF(pine) != pine) throw new Exception("treesTest F failed"); if (t.treesTestG(pine) != pine) throw new Exception("treesTest G failed"); if (t.treesTestH(pine) != pine) throw new Exception("treesTest H failed"); if (t.treesTestI(pine) != pine) throw new Exception("treesTest I failed"); if (t.treesTestJ(pine) != pine) throw new Exception("treesTest J failed"); if (t.treesTestK(pine) != pine) throw new Exception("treesTest K failed"); if (t.treesTestL(pine) != pine) throw new Exception("treesTest L failed"); if (t.treesTestM(pine) != pine) throw new Exception("treesTest M failed"); if (t.treesTestN(pine) != pine) throw new Exception("treesTest N failed"); if (t.treesTestO(pine) != pine) throw new Exception("treesTest O failed"); if (enum_thorough_simple.treesTest1(pine) != pine) throw new Exception("treesTest Global 1 failed"); if (enum_thorough_simple.treesTest2(pine) != pine) throw new Exception("treesTest Global 2 failed"); if (enum_thorough_simple.treesTest3(pine) != pine) throw new Exception("treesTest Global 3 failed"); if (enum_thorough_simple.treesTest4(pine) != pine) throw new Exception("treesTest Global 4 failed"); if (enum_thorough_simple.treesTest5(pine) != pine) throw new Exception("treesTest Global 5 failed"); if (enum_thorough_simple.treesTest6(pine) != pine) throw new Exception("treesTest Global 6 failed"); if (enum_thorough_simple.treesTest7(pine) != pine) throw new Exception("treesTest Global 7 failed"); if (enum_thorough_simple.treesTest8(pine) != pine) throw new Exception("treesTest Global 8 failed"); if (enum_thorough_simple.treesTest9(pine) != pine) throw new Exception("treesTest Global 9 failed"); if (enum_thorough_simple.treesTestA(pine) != pine) throw new Exception("treesTest Global A failed"); if (enum_thorough_simple.treesTestB(pine) != pine) throw new Exception("treesTest Global B failed"); if (enum_thorough_simple.treesTestC(pine) != pine) throw new Exception("treesTest Global C failed"); if (enum_thorough_simple.treesTestD(pine) != pine) throw new Exception("treesTest Global D failed"); if (enum_thorough_simple.treesTestE(pine) != pine) throw new Exception("treesTest Global E failed"); if (enum_thorough_simple.treesTestF(pine) != pine) throw new Exception("treesTest Global F failed"); if (enum_thorough_simple.treesTestG(pine) != pine) throw new Exception("treesTest Global G failed"); if (enum_thorough_simple.treesTestH(pine) != pine) throw new Exception("treesTest Global H failed"); if (enum_thorough_simple.treesTestI(pine) != pine) throw new Exception("treesTest Global I failed"); if (enum_thorough_simple.treesTestJ(pine) != pine) throw new Exception("treesTest Global J failed"); if (enum_thorough_simple.treesTestK(pine) != pine) throw new Exception("treesTest Global K failed"); if (enum_thorough_simple.treesTestL(pine) != pine) throw new Exception("treesTest Global L failed"); if (enum_thorough_simple.treesTestM(pine) != pine) throw new Exception("treesTest Global M failed"); // if (enum_thorough_simple.treesTestN(pine) != pine) throw new Exception("treesTest Global N failed"); if (enum_thorough_simple.treesTestO(pine) != pine) throw new Exception("treesTest Global O failed"); if (enum_thorough_simple.treesTestP(pine) != pine) throw new Exception("treesTest Global P failed"); if (enum_thorough_simple.treesTestQ(pine) != pine) throw new Exception("treesTest Global Q failed"); if (enum_thorough_simple.treesTestR(pine) != pine) throw new Exception("treesTest Global R failed"); } { HairStruct h = new HairStruct(); int ginger = HairStruct.ginger; if (h.hairTest1(ginger) != ginger) throw new Exception("hairTest 1 failed"); if (h.hairTest2(ginger) != ginger) throw new Exception("hairTest 2 failed"); if (h.hairTest3(ginger) != ginger) throw new Exception("hairTest 3 failed"); if (h.hairTest4(ginger) != ginger) throw new Exception("hairTest 4 failed"); if (h.hairTest5(ginger) != ginger) throw new Exception("hairTest 5 failed"); if (h.hairTest6(ginger) != ginger) throw new Exception("hairTest 6 failed"); if (h.hairTest7(ginger) != ginger) throw new Exception("hairTest 7 failed"); if (h.hairTest8(ginger) != ginger) throw new Exception("hairTest 8 failed"); if (h.hairTest9(ginger) != ginger) throw new Exception("hairTest 9 failed"); if (h.hairTestA(ginger) != ginger) throw new Exception("hairTest A failed"); if (h.hairTestB(ginger) != ginger) throw new Exception("hairTest B failed"); int red = enum_thorough_simple.red; if (h.colourTest1(red) != red) throw new Exception("colourTest HairStruct 1 failed"); if (h.colourTest2(red) != red) throw new Exception("colourTest HairStruct 2 failed"); if (h.namedanonTest1(enum_thorough_simple.NamedAnon2) != enum_thorough_simple.NamedAnon2) throw new Exception("namedanonTest HairStruct 1 failed"); if (h.namedanonspaceTest1(enum_thorough_simple.NamedAnonSpace2) != enum_thorough_simple.NamedAnonSpace2) throw new Exception("namedanonspaceTest HairStruct 1 failed"); int fir = TreesClass.fir; if (h.treesGlobalTest1(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 1 failed"); if (h.treesGlobalTest2(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 2 failed"); if (h.treesGlobalTest3(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 3 failed"); if (h.treesGlobalTest4(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 4 failed"); } { int blonde = HairStruct.blonde; if (enum_thorough_simple.hairTest1(blonde) != blonde) throw new Exception("hairTest Global 1 failed"); if (enum_thorough_simple.hairTest2(blonde) != blonde) throw new Exception("hairTest Global 2 failed"); if (enum_thorough_simple.hairTest3(blonde) != blonde) throw new Exception("hairTest Global 3 failed"); if (enum_thorough_simple.hairTest4(blonde) != blonde) throw new Exception("hairTest Global 4 failed"); if (enum_thorough_simple.hairTest5(blonde) != blonde) throw new Exception("hairTest Global 5 failed"); if (enum_thorough_simple.hairTest6(blonde) != blonde) throw new Exception("hairTest Global 6 failed"); if (enum_thorough_simple.hairTest7(blonde) != blonde) throw new Exception("hairTest Global 7 failed"); if (enum_thorough_simple.hairTest8(blonde) != blonde) throw new Exception("hairTest Global 8 failed"); if (enum_thorough_simple.hairTest9(blonde) != blonde) throw new Exception("hairTest Global 9 failed"); if (enum_thorough_simple.hairTestA(blonde) != blonde) throw new Exception("hairTest Global A failed"); if (enum_thorough_simple.hairTestB(blonde) != blonde) throw new Exception("hairTest Global B failed"); if (enum_thorough_simple.hairTestC(blonde) != blonde) throw new Exception("hairTest Global C failed"); if (enum_thorough_simple.hairTestA1(blonde) != blonde) throw new Exception("hairTest Global A1 failed"); if (enum_thorough_simple.hairTestA2(blonde) != blonde) throw new Exception("hairTest Global A2 failed"); if (enum_thorough_simple.hairTestA3(blonde) != blonde) throw new Exception("hairTest Global A3 failed"); if (enum_thorough_simple.hairTestA4(blonde) != blonde) throw new Exception("hairTest Global A4 failed"); if (enum_thorough_simple.hairTestA5(blonde) != blonde) throw new Exception("hairTest Global A5 failed"); if (enum_thorough_simple.hairTestA6(blonde) != blonde) throw new Exception("hairTest Global A6 failed"); if (enum_thorough_simple.hairTestA7(blonde) != blonde) throw new Exception("hairTest Global A7 failed"); if (enum_thorough_simple.hairTestA8(blonde) != blonde) throw new Exception("hairTest Global A8 failed"); if (enum_thorough_simple.hairTestA9(blonde) != blonde) throw new Exception("hairTest Global A9 failed"); if (enum_thorough_simple.hairTestAA(blonde) != blonde) throw new Exception("hairTest Global AA failed"); if (enum_thorough_simple.hairTestAB(blonde) != blonde) throw new Exception("hairTest Global AB failed"); if (enum_thorough_simple.hairTestAC(blonde) != blonde) throw new Exception("hairTest Global AC failed"); if (enum_thorough_simple.hairTestB1(blonde) != blonde) throw new Exception("hairTest Global B1 failed"); if (enum_thorough_simple.hairTestB2(blonde) != blonde) throw new Exception("hairTest Global B2 failed"); if (enum_thorough_simple.hairTestB3(blonde) != blonde) throw new Exception("hairTest Global B3 failed"); if (enum_thorough_simple.hairTestB4(blonde) != blonde) throw new Exception("hairTest Global B4 failed"); if (enum_thorough_simple.hairTestB5(blonde) != blonde) throw new Exception("hairTest Global B5 failed"); if (enum_thorough_simple.hairTestB6(blonde) != blonde) throw new Exception("hairTest Global B6 failed"); if (enum_thorough_simple.hairTestB7(blonde) != blonde) throw new Exception("hairTest Global B7 failed"); if (enum_thorough_simple.hairTestB8(blonde) != blonde) throw new Exception("hairTest Global B8 failed"); if (enum_thorough_simple.hairTestB9(blonde) != blonde) throw new Exception("hairTest Global B9 failed"); if (enum_thorough_simple.hairTestBA(blonde) != blonde) throw new Exception("hairTest Global BA failed"); if (enum_thorough_simple.hairTestBB(blonde) != blonde) throw new Exception("hairTest Global BB failed"); if (enum_thorough_simple.hairTestBC(blonde) != blonde) throw new Exception("hairTest Global BC failed"); if (enum_thorough_simple.hairTestC1(blonde) != blonde) throw new Exception("hairTest Global C1 failed"); if (enum_thorough_simple.hairTestC2(blonde) != blonde) throw new Exception("hairTest Global C2 failed"); if (enum_thorough_simple.hairTestC3(blonde) != blonde) throw new Exception("hairTest Global C3 failed"); if (enum_thorough_simple.hairTestC4(blonde) != blonde) throw new Exception("hairTest Global C4 failed"); if (enum_thorough_simple.hairTestC5(blonde) != blonde) throw new Exception("hairTest Global C5 failed"); if (enum_thorough_simple.hairTestC6(blonde) != blonde) throw new Exception("hairTest Global C6 failed"); if (enum_thorough_simple.hairTestC7(blonde) != blonde) throw new Exception("hairTest Global C7 failed"); if (enum_thorough_simple.hairTestC8(blonde) != blonde) throw new Exception("hairTest Global C8 failed"); if (enum_thorough_simple.hairTestC9(blonde) != blonde) throw new Exception("hairTest Global C9 failed"); if (enum_thorough_simple.hairTestCA(blonde) != blonde) throw new Exception("hairTest Global CA failed"); if (enum_thorough_simple.hairTestCB(blonde) != blonde) throw new Exception("hairTest Global CB failed"); if (enum_thorough_simple.hairTestCC(blonde) != blonde) throw new Exception("hairTest Global CC failed"); } { FirStruct f = new FirStruct(); int blonde = HairStruct.blonde; if (f.hairTestFir1(blonde) != blonde) throw new Exception("hairTestFir 1 failed"); if (f.hairTestFir2(blonde) != blonde) throw new Exception("hairTestFir 2 failed"); if (f.hairTestFir3(blonde) != blonde) throw new Exception("hairTestFir 3 failed"); if (f.hairTestFir4(blonde) != blonde) throw new Exception("hairTestFir 4 failed"); if (f.hairTestFir5(blonde) != blonde) throw new Exception("hairTestFir 5 failed"); if (f.hairTestFir6(blonde) != blonde) throw new Exception("hairTestFir 6 failed"); if (f.hairTestFir7(blonde) != blonde) throw new Exception("hairTestFir 7 failed"); if (f.hairTestFir8(blonde) != blonde) throw new Exception("hairTestFir 8 failed"); if (f.hairTestFir9(blonde) != blonde) throw new Exception("hairTestFir 9 failed"); if (f.hairTestFirA(blonde) != blonde) throw new Exception("hairTestFir A failed"); } { enum_thorough_simple.GlobalInstance = enum_thorough_simple.globalinstance2; if (enum_thorough_simple.GlobalInstance != enum_thorough_simple.globalinstance2) throw new Exception("GlobalInstance 1 failed"); Instances i = new Instances(); i.MemberInstance = Instances.memberinstance3; if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed"); } // ignore enum item tests start { if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_zero) != 0) throw new Exception("ignoreATest 0 failed"); if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_three) != 3) throw new Exception("ignoreATest 3 failed"); if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_ten) != 10) throw new Exception("ignoreATest 10 failed"); if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_eleven) != 11) throw new Exception("ignoreATest 11 failed"); if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirteen) != 13) throw new Exception("ignoreATest 13 failed"); if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_fourteen) != 14) throw new Exception("ignoreATest 14 failed"); if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_twenty) != 20) throw new Exception("ignoreATest 20 failed"); if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty) != 30) throw new Exception("ignoreATest 30 failed"); if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_two) != 32) throw new Exception("ignoreATest 32 failed"); if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_three) != 33) throw new Exception("ignoreATest 33 failed"); } { if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_eleven) != 11) throw new Exception("ignoreBTest 11 failed"); if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_twelve) != 12) throw new Exception("ignoreBTest 12 failed"); if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_one) != 31) throw new Exception("ignoreBTest 31 failed"); if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_two) != 32) throw new Exception("ignoreBTest 32 failed"); if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_one) != 41) throw new Exception("ignoreBTest 41 failed"); if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_two) != 42) throw new Exception("ignoreBTest 42 failed"); } { if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_ten) != 10) throw new Exception("ignoreCTest 10 failed"); if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_twelve) != 12) throw new Exception("ignoreCTest 12 failed"); if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty) != 30) throw new Exception("ignoreCTest 30 failed"); if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty_two) != 32) throw new Exception("ignoreCTest 32 failed"); if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty) != 40) throw new Exception("ignoreCTest 40 failed"); if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty_two) != 42) throw new Exception("ignoreCTest 42 failed"); } { if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_one) != 21) throw new Exception("ignoreDTest 21 failed"); if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_two) != 22) throw new Exception("ignoreDTest 22 failed"); } { if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_zero) != 0) throw new Exception("ignoreETest 0 failed"); if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_one) != 21) throw new Exception("ignoreETest 21 failed"); if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_two) != 22) throw new Exception("ignoreETest 22 failed"); } // ignore enum item tests end { if (enum_thorough_simple.repeatTest(enum_thorough_simple.one) != 1) throw new Exception("repeatTest 1 failed"); if (enum_thorough_simple.repeatTest(enum_thorough_simple.initial) != 1) throw new Exception("repeatTest 2 failed"); if (enum_thorough_simple.repeatTest(enum_thorough_simple.two) != 2) throw new Exception("repeatTest 3 failed"); if (enum_thorough_simple.repeatTest(enum_thorough_simple.three) != 3) throw new Exception("repeatTest 4 failed"); if (enum_thorough_simple.repeatTest(enum_thorough_simple.llast) != 3) throw new Exception("repeatTest 5 failed"); if (enum_thorough_simple.repeatTest(enum_thorough_simple.end) != 3) throw new Exception("repeatTest 6 failed"); } // different types { if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typeint) != 10) throw new Exception("differentTypes 1 failed"); if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typeboolfalse) != 0) throw new Exception("differentTypes 2 failed"); if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typebooltrue) != 1) throw new Exception("differentTypes 3 failed"); if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typebooltwo) != 2) throw new Exception("differentTypes 4 failed"); if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typechar) != 'C') throw new Exception("differentTypes 5 failed"); if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typedefaultint) != 'D') throw new Exception("differentTypes 6 failed"); int global_enum = enum_thorough_simple.global_typeint; if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed"); global_enum = enum_thorough_simple.global_typeboolfalse; if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 0) throw new Exception("global differentTypes 2 failed"); global_enum = enum_thorough_simple.global_typebooltrue; if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 1) throw new Exception("global differentTypes 3 failed"); global_enum = enum_thorough_simple.global_typebooltwo; if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 2) throw new Exception("global differentTypes 4 failed"); global_enum = enum_thorough_simple.global_typechar; if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed"); global_enum = enum_thorough_simple.global_typedefaultint; if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'D') throw new Exception("global differentTypes 6 failed"); } }
public static IDisposable Push(IServiceLocator locator) { return(Instances.Subscribe(locator)); }