public void TestMapParams() { ScopeChain scope = new ScopeChain(); scope.SetValue("+", new TestSum()); ValueDelimiter square = new ValueDelimiter("]", DelimiterType.AsArray); scope.SetValue("[", square); ValueDelimiter curly = new ValueDelimiter("}", DelimiterType.AsArray, new CreateMap()); scope.SetValue("{", curly); { // create postfix function that takes { :a :b } Map map = new Map(); map["a"] = PatternData.Single("a", ValueType.Int); map["b"] = PatternData.Single("b", ValueType.Int); ValueMap vMap = new ValueMap(map); List<string> body = new List<string>(); body.Add("a + b"); CreateFunction.Do(scope, "add", null, vMap, body); } { // try out the function DelimiterList list = ParseLine.Do("add { :a 2 :b 5 }", scope); Value value = EvalList.Do(list.Nodes, scope); Assert.AreEqual(7, value.AsInt); } { // try it as a partial DelimiterList list = ParseLine.Do("add { :a 2 } { :b 5 }", scope); Value value = EvalList.Do(list.Nodes, scope); Assert.AreEqual(7, value.AsInt); } }
public RepresentedModel(Type classWithProps) { schema = new ValueMap<string, RepresentedModelValue>(); PropertyInfo[] props = classWithProps.GetProperties(); foreach (PropertyInfo prop in props) { if (prop.CanRead && prop.CanWrite) { FieldDescription[] attrs = (FieldDescription[])prop.GetCustomAttributes(typeof(FieldDescription), true); bool isnull; FieldType itv = GetRType(prop.PropertyType, out isnull); RepresentedModelValue sch_v = new RepresentedModelValue(itv) { propertyDescriptor = prop }; if (attrs.Length > 0) { FieldDescription at = attrs[0]; if (!at.Ignore) { sch_v.Description = at.Description; sch_v.Required = at.Required; sch_v.Inherited = at.Inherited; schema.Add(prop.Name, sch_v); } } else { schema.Add(prop.Name, sch_v); } } } }
void SetProps() { if (Holder == null) { Holder = new Dictionary <string, object>(); } Type t = this.GetType(); //ValueMap<string, RepresentedModelValue> model = new RepresentedModel(t).schema; ValueMap <string, RepresentedModelValue> model = RepresentedModel.FindScheme(t); for (int i = 0; i < model.val1.Count; i++) { string k = model.val1[i]; PropertyInfo pi = model.val2[i].propertyDescriptor; //t.GetProperty(k); object val = pi.GetValue(this, null); if (Holder.ContainsKey(k)) { Holder[k] = val; } else { Holder.Add(k, val); } } }
protected internal override void MergeElement(View childView) { // dictionaries children == elements. var item = childView._map as ElementMap; if (item != null) { // translate elements into child nodes here. var _key = (TKey)(object)_keyExchanger(item.Parameter); var accessor = new Accessor(() => Dictionary[_key], v => Dictionary[_key] = (TVal)v); var childMap = new ValueMap <object>(_key.ToString(), (p, v) => accessor, item.Initializers); childMap.GetMacroValue += (name, context) => { return(name == "ElementId" || name == MemberName?_key.ToString().SingleItemAsEnumerable() : null); }; MergeChild(ParentView, new View(childMap) { _propertyNode = childView._propertyNode }); } else { throw new ClrPlusException("map really should be an elementmap here..."); } }
private void SetValues(string[] parsedCSV, ValueMap valueSheet) { for (int i = 0; i < parsedCSV.Length; i++) { valueSheet.ValueItems[i] = this.GetValueItem(parsedCSV[i]); } }
//public void SetHolder(System.Collections.Hashtable msgDict) //{ // Type t = this.GetType(); // //ValueMap<string, RepresentedModelValue> model = new RepresentedModel(t).schema; // ValueMap<string, RepresentedModelValue> model = RepresentedModel.FindScheme(t); // //foreach (KeyValuePair<string, object> v in msgDict) // //{ // // int descIndex = model.IndexOf(v.Key); // // if (descIndex >= 0) // // { // // //PropertyInfo pi = t.GetProperty(v.Key); // // //if (pi == null) // // // continue; // // PropertyInfo pi = model.val2[descIndex].propertyDescriptor; // // Type pt = pi.PropertyType; // // bool nullable = false; // // Type ptn = Nullable.GetUnderlyingType(pt); // // if (nullable = ptn != null) // // pt = ptn; // // if (v.Value == null && !nullable) // // { // // if (pt.BaseType != typeof(object)) // // throw new Exception("value does not accept nullable types, key: " + v.Key); // // else continue; // // } // // else if (!nullable && pt != v.Value.GetType()) // // throw new Exception("unknown type for key: " + v.Key); // // pi.SetValue(this, v.Value, null); // // } // //} // for (int idx = 0; idx < model.val1.Count; idx++) // { // string key = model.val1[idx]; // object val; // //if (msgDict.TryGetValue(key, out val)) // if (msgDict.ContainsKey(key)) // { // val = msgDict[key]; // //PropertyInfo pi = t.GetProperty(v.Key); // //if (pi == null) // // continue; // PropertyInfo pi = model.val2[idx].propertyDescriptor; // Type pt = pi.PropertyType; // bool nullable = false; // Type ptn = Nullable.GetUnderlyingType(pt); // if (nullable = ptn != null) // pt = ptn; // if (val == null && !nullable) // { // if (pt.BaseType != typeof(object)) // throw new Exception("value does not accept nullable types, key: " + key); // else continue; // } // else if (!nullable && pt != val.GetType()) // throw new Exception("unknown type for key: " + key); // //pi.SetValue(this, val, null); // model.val2[idx].PropValueSet(this, val); // } // } // Holder = new System.Collections.Hashtable(msgDict); //} //void ReverseSetProps() //{ // if (Holder == null) // return; // Type t = this.GetType(); // ValueMap<string, RepresentedModelValue> model = RepresentedModel.FindScheme(t); // foreach (KeyValuePair<string, object> v in Holder) // { // //PropertyInfo pi = t.GetProperty(v.Key); // //if (pi == null) // // continue; // int propDescIndex = model.IndexOf(v.Key); // if (propDescIndex >= 0) // { // PropertyInfo pi = model.val2[propDescIndex].propertyDescriptor; // pi.SetValue(this, v.Value, null); // } // } //} void SetProps() { if (Holder == null) { //Holder = new System.Collections.Hashtable(); Holder = new Dictionary <string, object>(); } Type t = this.GetType(); //ValueMap<string, RepresentedModelValue> model = new RepresentedModel(t).schema; ValueMap <string, RepresentedModelValue> model = RepresentedModel.FindScheme(t); for (int i = 0; i < model.val1.Count; i++) { /*string k = model.val1[i]; * PropertyInfo pi = model.val2[i].propertyDescriptor; //t.GetProperty(k); * object val = pi.GetValue(this, null); * * if (Holder.ContainsKey(k)) * Holder[k] = val; * else * Holder.Add(k, val);*/ Holder[model.val1[i]] = model.val2[i].PropValue(this); } }
internal override object DoGetProperty(System.Reflection.MethodInfo methodInfo, string propertyName) { object value; ValueMap.TryGetValue(propertyName, out value); return(value); }
private TermLookupTransform(IChannel ch, ModelLoadContext ctx, IHost host, IDataView input) : base(host, ctx, input, TestIsText) { Host.AssertValue(ch); // *** Binary format *** // <base> ch.AssertNonEmpty(Infos); // Extra streams: // DefaultMap.idv byte[] rgb = null; Action <BinaryReader> fn = r => rgb = ReadAllBytes(ch, r); if (!ctx.TryLoadBinaryStream(DefaultMapName, fn)) { throw ch.ExceptDecode(); } _bytes = rgb; // Process the bytes into the loader and map. _ldr = GetLoader(Host, _bytes); ValidateLoader(ch, _ldr); _valueMap = Train(ch, _ldr); SetMetadata(); }
public override void OnAwake(ILoopState state) { _events = state.Get <SourceBuffer <EventSource> >(); _physics = state.Get <SourceBuffer <PhysicsSource> >(); _timer = state.Get <Ticker>(); _intMap = state.Get <ValueMap <int> >(); }
public string GetValue(Type type, object obj) { if (!string.IsNullOrWhiteSpace(Attribute?.Format)) { var displayText = Attribute.Format; var metas = DataListHelper.GetDataColumnMeta(type); return(FormatPlaceholder.Aggregate(displayText, (current, ph) => current.Replace("{" + ph + "}", metas.First(p => p.Name == ph).GetPlainValue(obj)?.ToString()))); } var value = GetPlainValue(obj)?.ToString(); if (string.IsNullOrWhiteSpace(value)) { return(value); } if (ValueMap != null && ValueMap.ContainsKey(value)) { var displayText = ValueMap[value]; var metas = DataListHelper.GetDataColumnMeta(type); return(ValueMapPlaceholder.Aggregate(displayText, (current, ph) => current.Replace("{" + ph + "}", metas.First(p => p.Name == ph).GetPlainValue(obj)?.ToString()))); } return(value); }
public override IEnumerable<PlayerRecommendation> Analyse(Player player, Fixture fixture, SimulationContext context) { if (PointMapper == null) throw new ArgumentException("Invalid property", nameof(PointMapper)); var res = new PlayerRecommendation(); res.Type = PlayerRecommendationType.PlayerPlaytime; var playerTeam = player.GetLeagueTeam(fixture); double teamPlayedMinutes = playerTeam.GetPlayedMinutesBeforeFixtureForTeam(fixture); double playerMinutes = player.GetPlayedMinutesBeforeFixtureForPlayer(fixture); var percentage = teamPlayedMinutes > 0 ? playerMinutes / teamPlayedMinutes : 0; var valueMap = new ValueMap(); valueMap["minutes"] = playerMinutes; valueMap["percentage"] = percentage; //valueMap["playedgames"] = ; //valueMap["substitutes-in"] = ; //valueMap["substitutes-out"] = ; // todo: add more data points (subs, recent playtime (5 last team games), recent subs) res.Points = PointMapper.Test(valueMap).Sum(x => x.Points); yield return res; }
public override IEnumerable<PlayerRecommendation> Analyse(Player player, Fixture fixture, SimulationContext context) { if (Mapper == null) throw new ArgumentException("Invalid property", nameof(Mapper)); var res = new PlayerRecommendation(); res.Type = PlayerRecommendationType.ChanceOfPlaying; // old: //// Negatives //if (player.Fantasy.ChanceOfPlayingNextFixture >= 0) //{ // if (player.Fantasy.ChanceOfPlayingNextFixture <= 0) // res.Points = -10; // else if (player.Fantasy.ChanceOfPlayingNextFixture <= 0.25) // res.Points = -3; // else if (player.Fantasy.ChanceOfPlayingNextFixture <= 0.50) // res.Points = -2; // else if (player.Fantasy.ChanceOfPlayingNextFixture <= 0.75) // res.Points = -1; //} var valueMap = new ValueMap(); valueMap["percentage"] = player.Fantasy.ChanceOfPlayingNextFixture; res.Points = Mapper.Test(valueMap).Sum(x => x.Points); yield return res; }
public static int CompareWithSelector(ValueMap <string, object> one, ValueMap <string, object> other, TQItemSelector selector) { int counter = -1; foreach (KeyValuePair <string, TQItemSelectorParam> rule in selector.parameters) { counter++; if (rule.Value.ValueSet == TQItemSelectorSet.Equals || rule.Value.ValueSet == TQItemSelectorSet.NotEquals) { continue; } int rslt; if (rule.Value.ValueSet == TQItemSelectorSet.Ascending) { rslt = ((IComparable)one.val2[counter]).CompareTo(other.val2[counter]); } else { rslt = ((IComparable)other.val2[counter]).CompareTo(one.val2[counter]); } if (rslt != 0) { return(rslt); } } return(0); }
public void Constructor() { // Constructor. { var o = new ValueMap(); } }
public ValueMap <string, object> GetValueMap(TQItemSelector order) { ValueMap <string, object> result = new ValueMap <string, object>(); if (Holder == null) { SetProps(); } foreach (KeyValuePair <string, TQItemSelectorParam> rule in order.parameters) { object valobj; if (Holder.TryGetValue(rule.Key, out valobj)) { result.Add(rule.Key, valobj); } else { result.Add(rule.Key, null); } // result.Add(rule.Key, Holder[rule.Key]); } // extra data - without any order foreach (KeyValuePair <string, object> hdpair in Holder) //foreach (System.Collections.DictionaryEntry hdpair in Holder) { string k = (string)hdpair.Key; if (!order.parameters.ContainsKey(k)) { result.Add(k, hdpair.Value); } } return(result); }
/// <summary> /// Creates an <see cref="IntegerType"/> instance. /// </summary> /// <param name="module"></param> /// <param name="name"></param> /// <param name="enumerator"></param> public IntegerType(IModule module, string name, Symbol type, ISymbolEnumerator symbols) : base (module, name) { Types? t = GetExactType(type); type.Assert(t.HasValue, "Unknown symbol for unsigned type!"); _type = t.Value; _isEnumeration = false; Symbol current = symbols.NextNonEOLSymbol(); if (current == Symbol.OpenBracket) { _isEnumeration = true; symbols.PutBack(current); _map = Lexer.DecodeEnumerations(symbols); } else if (current == Symbol.OpenParentheses) { symbols.PutBack(current); _ranges = Lexer.DecodeRanges(symbols); current.Assert(!_ranges.IsSizeDeclaration, "SIZE keyword is not allowed for ranges of integer types!"); } else { symbols.PutBack(current); } }
public override View this[string key] { get { key = _keyExchanger(key); // if the view we have if (!ChildItems.ContainsKey(key)) { var _key = (TKey)(object)key; // var x = Dictionary[_key]; // if (Dictionary.ContainsKey(_key)) { var accessor = new Accessor(() => Dictionary[_key], v => Dictionary[_key] = (TVal)v); var childMap = new ValueMap <object>(key, (p, v) => accessor, null); childMap.GetMacroValue += (name, context) => { return(name == "ElementId" || name == MemberName?key.SingleItemAsEnumerable() : null); }; MergeChild(ParentView, new View(childMap)); // } } InitializeChildItem(ChildItems[key]); return(ChildItems[key]); } set { InitializeChildItem(value); key = _keyExchanger(key); base[key] = value; } }
/// <summary> /// Creates an <see cref="IntegerType"/> instance. /// </summary> /// <param name="module"></param> /// <param name="name"></param> /// <param name="enumerator"></param> public IntegerType(IModule module, string name, Symbol type, ISymbolEnumerator symbols) : base(module, name) { Types?t = GetExactType(type); type.Assert(t.HasValue, "Unknown symbol for unsigned type!"); _type = t.Value; _isEnumeration = false; Symbol current = symbols.NextNonEOLSymbol(); if (current == Symbol.OpenBracket) { _isEnumeration = true; symbols.PutBack(current); _map = Lexer.DecodeEnumerations(symbols); } else if (current == Symbol.OpenParentheses) { symbols.PutBack(current); _ranges = Lexer.DecodeRanges(symbols); current.Assert(!_ranges.IsSizeDeclaration, "SIZE keyword is not allowed for ranges of integer types!"); } else { symbols.PutBack(current); } }
public Form1() { InitializeComponent(); Dashboard dashboard = new Dashboard(); DashboardSqlDataSource dataSource = new DashboardSqlDataSource(); CustomSqlQuery sqlQuery = new CustomSqlQuery("Countries", "select * from Countries"); dataSource.ConnectionParameters = new Access97ConnectionParameters(@"..\..\Data\countriesDB.mdb", "", ""); dataSource.Queries.Add(sqlQuery); ChoroplethMapDashboardItem choroplethMap = new ChoroplethMapDashboardItem(); choroplethMap.DataSource = dataSource; choroplethMap.DataMember = "Countries"; choroplethMap.Area = ShapefileArea.WorldCountries; choroplethMap.AttributeName = "NAME"; choroplethMap.AttributeDimension = new Dimension("Country"); ValueMap populationMap = new ValueMap(new Measure("Population")); choroplethMap.Maps.Add(populationMap); dashboard.Items.Add(choroplethMap); dashboardViewer1.Dashboard = dashboard; }
/// <summary> /// Try getting a mapped value given a migration source unique Id and the value to be mapped. /// </summary> /// <param name="fromSide">Left or Right of the migration source in the session configuration</param> /// <param name="sourceFieldValue">Value before the mapping rule is applied</param> /// <param name="valueMapName"></param> /// <param name="descriptionDocRootNode">The document that contains all the field information in a particular revision</param> /// <param name="mappedValue">Value after the mapping rule is applied</param> /// <returns>True if a mapping rule is applied; FALSE otherwise</returns> private bool GetMappedFieldValue( SourceSideTypeEnum fromSide, string sourceFieldValue, string valueMapName, XmlElement descriptionDocRootNode, out string mappedValue) { TraceManager.TraceVerbose("Getting mapped field value of '{0}' in Value Map '{1}'", sourceFieldValue ?? string.Empty, valueMapName ?? string.Empty); ValueMap valueMapEntry = null; foreach (ValueMap valueMap in m_session.WITCustomSetting.ValueMaps.ValueMap) { if (valueMap.name == valueMapName) { valueMapEntry = valueMap; break; } } if (null != valueMapEntry) { TraceManager.TraceVerbose("Applying mapped field value of '{0}' in Value Map '{1}'", sourceFieldValue ?? string.Empty, valueMapName ?? string.Empty); return(valueMapEntry.TryGetMappedValue(fromSide, sourceFieldValue, descriptionDocRootNode, out mappedValue)); } else { TraceManager.TraceVerbose("Cannot find Value Map '{0}'", valueMapName ?? string.Empty); mappedValue = sourceFieldValue; return(false); } }
private static IEnumerable<IRestriction> CreateRestrictions(ValueMap map) { if ((map != null) && (map.Count > 0)) { return CreateRestrictions(map.GetContinousRanges()); } return new List<IRestriction>(); }
public void Init(IExampleContext context, ShapeIngredientConfig config, WorldGeneratorConfig worldGeneratorConfig, ValueMap initialShapeValues) { _worldGeneratorConfig = worldGeneratorConfig; _config = config; _initialShapeValues = initialShapeValues; base.Init(context, config, worldGeneratorConfig); Values = new ValueMap(1, worldGeneratorConfig.XSize, worldGeneratorConfig.YSize); }
public void Init(IExampleContext context, WalkabilityIngredientConfig config, WorldGeneratorConfig worldGeneratorConfig, ValueMap waterMap) { _context = context; _config = config; _waterMap = waterMap; Values = new ValueMap(1, worldGeneratorConfig.XSize, worldGeneratorConfig.YSize); base.Init(context, config, worldGeneratorConfig); }
private void WriteToGround(int2 key, DungeonTheme theme, string tile) { ValueMap.Add(key, new Dungeon.MapValue { Theme = theme, Index = (DungeonTile.Index)Convert.ToInt32(tile), IsSpecial = true, }); }
public void SetConditionalWildcardPriorityValueMap(Configuration config) { // Map P2 to P1 Value v1 = new Value(); v1.LeftValue = "2"; v1.RightValue = "1"; ValueMap vMap = new ValueMap(); vMap.name = "PriorityValueMap"; vMap.Value.Add(v1); Value v2 = new Value(); v2.LeftValue = "*"; v2.RightValue = "3"; v2.When.ConditionalSrcFieldName = "System.Description"; v2.When.ConditionalSrcFieldValue = ConditionalValueMapDescription; vMap.Value.Add(v2); // Map field MappedField mField1 = new MappedField(); mField1.LeftName = FIELD_PRIORITY; mField1.RightName = FIELD_PRIORITY; mField1.MapFromSide = SourceSideTypeEnum.Left; mField1.valueMap = vMap.name; // Map the rest of the fields using wild card MappedField defaultField = new MappedField(); defaultField.LeftName = "*"; defaultField.RightName = "*"; defaultField.MapFromSide = SourceSideTypeEnum.Left; FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; fieldMap.MappedFields.MappedField.Add(defaultField); fieldMap.MappedFields.MappedField.Add(mField1); // Map work item type WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; // Build WIT Session custom setting WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); customSetting.ValueMaps.ValueMap.Add(vMap); SetWitSessionCustomSetting(config, customSetting); }
private static IEnumerable <IRestriction> CreateRestrictions(ValueMap map) { if ((map != null) && (map.Count > 0)) { return(CreateRestrictions(map.GetContinousRanges())); } return(new List <IRestriction>()); }
internal Print() { SetDocString("Print the string representation of a value, i.e. send it to stdout."); Map map = new Map(); map["value"] = PatternData.Single("value"); ValueMap vMap = new ValueMap(map); Init(vMap); }
public void Init(IExampleContext context, InitialHeightIngredientConfig config, WorldGeneratorConfig worldGeneratorConfig, IRandomNumberGenerator rng) { _config = config; _rng = rng; _noiseOffset = new Position(_rng.Next(10000), _rng.Next(10000)); base.Init(context, config, worldGeneratorConfig); Values = new ValueMap(1, worldGeneratorConfig.XSize, worldGeneratorConfig.YSize); }
internal AddToArray() { SetDocString("Add value to an array"); Map map = new Map(); map["array"] = PatternData.Single("array", ValueType.Array); map["value"] = PatternData.Single("value"); ValueMap vMap = new ValueMap(map); Init(vMap); }
internal IfBody() { SetDocString("If do?, evaluate body and return the last value in body.\nElse return false."); Map map = new Map(); map["do?"] = PatternData.Single("do?", ValueType.Bool); map["body"] = PatternData.Body(); ValueMap vMap = new ValueMap(map); Init(vMap); }
public void Init(IExampleContext context, WaterIngredientConfig config, WorldGeneratorConfig worldGeneratorConfig, IRandomNumberGenerator rng, ValueMap heightMapValues) { _config = config; _heightMapValues = heightMapValues; base.Init(context, config, worldGeneratorConfig); _rng = rng; Values = new ValueMap(1, worldGeneratorConfig.XSize, worldGeneratorConfig.YSize); _tileset = worldGeneratorConfig.Tileset; }
internal ArrayToArray() { SetDocString("Return a new array, where elements from the original array are present if filter returns true. The values are transformed by the given function."); Map map = new Map(); map["array"] = PatternData.Single("array", ValueType.Array); map["filter?"] = PatternData.Single("filter?", ValueType.Function, ValueNil.Nil); map["transform"] = PatternData.Single("transform", ValueType.Function, ValueNil.Nil); ValueMap vMap = new ValueMap(map); Init(vMap); }
public int Compare(ValueMap <string, object> x, ValueMap <string, object> y) { int r = internalComparer.Compare(x, y); if (r == 0) { return(((int)x.val2[x.val2.Count - 1]).CompareTo((int)y.val2[y.val2.Count - 1])); } //return ((int)x.Holder["__idx"]).CompareTo((int)y.Holder["__idx"]); return(r); }
internal IfValue() { SetDocString("If do?, return value of ifTrue, else value of ifFalse."); Map map = new Map(); map["do?"] = PatternData.Single("do?", ValueType.Bool); map["ifTrue"] = PatternData.Single("ifTrue", ValueBool.True); map["ifFalse"] = PatternData.Single("ifFalse", ValueBool.False); ValueMap vMap = new ValueMap(map); Init(vMap); }
internal object DoGetProperty(System.Reflection.MethodInfo methodInfo, string propertyName) { TValue value; if (ValueMap.TryGetValue(propertyName, out value)) { return((methodInfo.ReturnType.Equals(typeof(string))) ?value:CommonExtension.ToObject(value, methodInfo.ReturnType)); } return(value); }
public string GetUrl() { if (Method == HttpMethodType.Get && ValueMap.Count > 0) { var query = string.Join("&", ValueMap.Select(item => $"{item.Key.UrlEncode()}={item.Value.UrlEncode()}")); return($"{RawUrl}?{query}"); } else { return(RawUrl); } }
internal BasicLoop() { SetDocString("Repeat body until a condition is no longer true. Optionally run some code at the end of each loop. Return value is last value of body."); Map map = new Map(); map["check"] = PatternData.Single("check", ValueType.Raw); map["change"] = PatternData.Single("change", ValueType.Raw, ValueNil.Nil); map["checkFirst?"] = PatternData.Single("checkFirst?", ValueType.Bool, ValueBool.True); map["body"] = PatternData.Body(); ValueMap vMap = new ValueMap(map); Init(vMap); }
internal FormatTable() { SetDocString("Creates a string that's the array formatted w/ the given number of columns."); Map map = new Map(); map["array"] = PatternData.Single("array", ValueType.Array); map["columns"] = PatternData.Single("columns", ValueType.Int); map["dashesAfterFirst?"] = PatternData.Single("dashesAfterFirst?", ValueType.Bool, ValueBool.False); map["spaces"] = PatternData.Single("spaces", ValueType.Int, new ValueInt(1)); ValueMap vMap = new ValueMap(map); Init(vMap); }
internal LoadModule() { SetDocString("Load a module into the current scope. Returns true if the file was found."); Map map = new Map(); map["file"] = PatternData.Single("file", ValueType.String); // todo: change scope to level map["scope"] = PatternData.Single("scope", ValueType.String, new ValueString("current")); map["force?"] = PatternData.Single("force?", ValueType.Bool, ValueBool.False); ValueMap vMap = new ValueMap(map); Init(vMap); }
public void SetConditionalHybridPriorityValueMap(MigrationTestEnvironment env, Configuration config) { // Map P2 to P1 Value v1 = env.NewValue("2", "1"); Value v2 = env.NewValue("*", "1"); v2.When.ConditionalSrcFieldName = "System.Description"; v2.When.ConditionalSrcFieldValue = ConditionalValueMapDescription; Value v3 = env.NewValue("2", "3"); v3.When.ConditionalSrcFieldName = "System.Description"; v3.When.ConditionalSrcFieldValue = ConditionalValueMapDescription; ValueMap vMap = new ValueMap(); vMap.name = "PriorityValueMap"; vMap.Value.Add(v1); vMap.Value.Add(v2); vMap.Value.Add(v3); // Map field MappedField mField1 = env.NewMappedField(FIELD_PRIORITY, FIELD_PRIORITY); mField1.valueMap = vMap.name; // Map the rest of the fields using wild card MappedField defaultField = env.NewMappedField("*", "*"); FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; fieldMap.MappedFields.MappedField.Add(defaultField); fieldMap.MappedFields.MappedField.Add(mField1); // Map work item type WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; // Build WIT Session custom setting WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); customSetting.ValueMaps.ValueMap.Add(vMap); SetWitSessionCustomSetting(config, customSetting); }
public static XElement ToXml(this ValueMap map) { var elem = new XElement( EventManifestSchema.Namespace + "valueMap", new XAttribute("name", map.Name)); if (map.Symbol != null) { elem.Add(new XAttribute("symbol", map.Symbol)); } elem.Add(map.Items.Select(i => ((ValueMapItem)i).ToXml())); return(elem); }
public void SetUserValueMap(Configuration config) { // User Map Value v1 = new Value(); v1.LeftValue = SourceUser; v1.RightValue = TargetUser; ValueMap vMap = new ValueMap(); vMap.name = "UserMap"; vMap.Value.Add(v1); // Map field MappedField mField1 = new MappedField(); mField1.LeftName = FIELD_ASSIGNEDTO; mField1.RightName = FIELD_ASSIGNEDTO; mField1.MapFromSide = SourceSideTypeEnum.Left; mField1.valueMap = vMap.name; // Map the rest of the fields using wild card MappedField defaultField = new MappedField(); defaultField.LeftName = "*"; defaultField.RightName = "*"; defaultField.MapFromSide = SourceSideTypeEnum.Left; FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; fieldMap.MappedFields.MappedField.Add(defaultField); fieldMap.MappedFields.MappedField.Add(mField1); // Map work item type WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; // Build WIT Session custom setting WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); customSetting.ValueMaps.ValueMap.Add(vMap); SetWitSessionCustomSetting(config, customSetting); }
private void CreateScoreValueSheets() { foreach (TextAsset csvFile in this.csvFiles) { ValueMap tempValueSheet = this.gameObject.AddComponent <ValueMap>(); tempValueSheet.ValueMapName = csvFile.name; string[] parsedCSV = this.ParseCSV(csvFile); tempValueSheet.ValueItems = new ValueMap.ValueItem[parsedCSV.Length]; this.SetValues(parsedCSV, tempValueSheet); } Destroy(this); }
public void Init(IExampleContext context, VegetationIngredientConfig config, WorldGeneratorConfig worldGeneratorConfig, IRandomNumberGenerator rng, ValueMap soilMap, ValueMap heightMap) { _rng = rng; _config = config; _soilMap = soilMap; _heightMap = heightMap; base.Init(context, config, worldGeneratorConfig); Values = new ValueMap(1, worldGeneratorConfig.XSize, worldGeneratorConfig.YSize); _plants = new Plant[worldGeneratorConfig.XSize, worldGeneratorConfig.YSize]; _initialSeeds = (int)(worldGeneratorConfig.XSize * worldGeneratorConfig.YSize * _config.InitialSeedsPerPosition); _tileMatricesByte = context.TileMatricesByLayer; }
public override IEnumerable<TeamRecommendation> Analyse(Player player, Fixture fixture, SimulationContext context) { if (PointMapper == null) throw new ArgumentException("Invalid property", nameof(PointMapper)); if (EloProvider == null) throw new ArgumentException("Invalid property", nameof(EloProvider)); var res = new TeamRecommendation(); res.Type = TeamRecommendationType.FixtureOdds; var playerTeam = player.GetLeagueTeam(fixture); var opposingTeam = player.GetOpposingTeam(fixture); if (playerTeam == null || opposingTeam == null) { _log.Warn($"Invalid teams"); yield break; } var playerTeamEloRating = EloProvider.GetRating(fixture.Time, player.Team).WaitForResult(); var opposingTeamEloRating = EloProvider.GetRating(fixture.Time, opposingTeam.Team).WaitForResult(); if (playerTeamEloRating == null) { _log.Warn($"Could not get elo rating for team {playerTeam.Team.Name} @{fixture.Time}"); yield break; } if (opposingTeamEloRating == null) { _log.Warn($"Could not get elo rating for team {opposingTeam.Team.Name} @{fixture.Time}"); yield break; } float diff = playerTeamEloRating.Rating - opposingTeamEloRating.Rating; float diffPercentage = diff / playerTeamEloRating.Rating; var valueMap = new ValueMap(); valueMap[ValueMapKeys.EloRatingPlayerTeam] = playerTeamEloRating.Rating; valueMap[ValueMapKeys.EloRatingOpposingTeam] = opposingTeamEloRating.Rating; valueMap[ValueMapKeys.EloRatingTeamDifferance] = diff; valueMap[ValueMapKeys.EloRatingTeamDifferancePercentage] = diffPercentage; res.Points = PointMapper.Test(valueMap).Sum(x => x.Points); yield return res; }
public override IEnumerable<TeamRecommendation> Analyse(Player player, Fixture fixture, SimulationContext context) { if (PointMapper == null) throw new ArgumentException("Invalid property", nameof(PointMapper)); var res = new TeamRecommendation(); res.Type = TeamRecommendationType.FixtureOdds; var playerTeam = player.GetLeagueTeam(fixture); var valueMap = new ValueMap(); if (fixture.Odds == null) { _log.Info($"No odds for fixture {fixture.HomeTeam.Team.ShortName} vs {fixture.AwayTeam.Team.ShortName} (GW #{fixture.Gameweek.Number}, cannot continue analyse"); yield break; } else if (fixture.HomeTeam.Team.ID == playerTeam.Team.ID) { valueMap["odds-win"] = fixture.Odds.HomeWin.Value; valueMap["odds-draw"] = fixture.Odds.Draw.Value; valueMap["odds-loss"] = fixture.Odds.AwayWin.Value; } else if (fixture.AwayTeam.Team.ID == player.Team.ID) { valueMap["odds-win"] = fixture.Odds.AwayWin.Value; valueMap["odds-draw"] = fixture.Odds.Draw.Value; valueMap["odds-loss"] = fixture.Odds.HomeWin.Value; } else { _log.Warn($"Player '{player.DisplayName}' doesn't play for any of the fixture teams: {fixture.HomeTeam.Team.ShortName} vs {fixture.AwayTeam.Team.ShortName} (GW #{fixture.Gameweek.Number}"); yield break; } res.Points = PointMapper.Test(valueMap).Sum(x => x.Points); yield return res; }
public MsgGenericValues() { type = NetworkMessageType.GenericValues; values = new ValueMap(); }
public void TestMapFromArrayPattern() { List<Value> list = new List<Value>(); list.Add(PatternData.Single("a", ValueType.Int)); list.Add(PatternData.Single("b", new ValueInt(17))); ValueArray pattern = new ValueArray(list); Value match = null, leftover = null; { // get a & b Map map = new Map(); map["a"] = new ValueInt(42); map["b"] = new ValueInt(31); ValueMap input = new ValueMap(map); Assert.IsTrue(PatternChecker.Do(input, pattern, false/*bShortPat*/, out match, out leftover)); Assert.AreEqual(2, match.AsMap.Count); Assert.AreEqual(42, match.AsMap["a"].AsInt); Assert.AreEqual(31, match.AsMap["b"].AsInt); Assert.AreEqual(null, leftover); } { // fill in default for b Map map = new Map(); map["a"] = new ValueInt(42); ValueMap input = new ValueMap(map); Assert.IsTrue(PatternChecker.Do(input, pattern, false/*bShortPat*/, out match, out leftover)); Assert.AreEqual(2, match.AsMap.Count); Assert.AreEqual(42, match.AsMap["a"].AsInt); Assert.AreEqual(17, match.AsMap["b"].AsInt); Assert.AreEqual(null, leftover); } { // leftover Map map = new Map(); map["b"] = new ValueInt(31); ValueMap input = new ValueMap(map); Assert.IsTrue(PatternChecker.Do(input, pattern, false/*bShortPat*/, out match, out leftover)); Assert.AreEqual(1, match.AsMap.Count); Assert.AreEqual(31, match.AsMap["b"].AsInt); Assert.AreEqual(1, leftover.AsMap.Count); Assert.AreEqual("a", leftover.AsMap["a"].AsString); } { // get a & b, ignore c because bShortPat=true Map map = new Map(); map["a"] = new ValueInt(42); map["b"] = new ValueInt(31); map["c"] = new ValueInt(31); ValueMap input = new ValueMap(map); Assert.IsTrue(PatternChecker.Do(input, pattern, true/*bShortPat*/, out match, out leftover)); Assert.AreEqual(2, match.AsMap.Count); Assert.AreEqual(42, match.AsMap["a"].AsInt); Assert.AreEqual(31, match.AsMap["b"].AsInt); Assert.AreEqual(null, leftover); } { // missing key List<Value> list2 = new List<Value>(); list2.Add(PatternData.Single("a", ValueType.Int)); list2.Add(PatternData.Rest("other")); ValueArray pattern2 = new ValueArray(list2); Map map = new Map(); map["b"] = new ValueInt(31); map["c"] = new ValueInt(31); ValueMap input = new ValueMap(map); Assert.IsFalse(PatternChecker.Do(input, pattern2, true/*bShortPat*/, out match, out leftover)); // but if "a" is present, it matches map["a"] = new ValueInt(42); Assert.IsTrue(PatternChecker.Do(input, pattern2, true/*bShortPat*/, out match, out leftover)); } }
public ValueMap GeneratePlayerValueMap(Player player, Fixture fixture, PlayerAnalyserBase analyser) { var playerTeam = player.GetLeagueTeam(fixture); double teamPlayedMinutes = playerTeam.GetPlayedMinutesBeforeFixtureForTeam(fixture); double playerMinutes = player.GetPlayedMinutesBeforeFixtureForPlayer(fixture); var percentage = teamPlayedMinutes > 0 ? playerMinutes / teamPlayedMinutes : 0; var recentLeagueFixtues = playerTeam.GetFixturesFromLeagueTeam() .Where(x => x.Statistics.GameStarted && x.Statistics.GameFinished) .OrderByDescending(x => x.Time) .Take(5) .ToList(); var playedLeagueFixtues = playerTeam.GetFixturesFromLeagueTeam() .Where(x => x.Statistics.GameStarted && x.Statistics.GameFinished) .OrderBy(x => x.Time) .ToList(); double points = playedLeagueFixtues .Sum(fixt => playerTeam.Team.HasHomeTeamAdvantage(fixt) ? fixt.Statistics.Score.PointsForHomeTeam : fixt.Statistics.Score.PointsForAwayTeam); double totalPoints = playedLeagueFixtues .Where(x => x.Statistics.GameStarted && x.Statistics.GameFinished) .Sum(fixt => playerTeam.Team.HasHomeTeamAdvantage(fixt) ? fixt.Statistics.Score.PointsForHomeTeam : fixt.Statistics.Score.PointsForAwayTeam); var fixtGoalsAgainst = playedLeagueFixtues.Select(fixt => { var isHome = playerTeam.Team.HasHomeTeamAdvantage(fixt); var ga = isHome ? fixt.Statistics.Score.GoalsForAwayTeam : fixt.Statistics.Score.GoalsForHomeTeam; return ga; }).ToList(); double saves = player.Statistics.Saves; double goalsAgainst = fixtGoalsAgainst.Sum(x => x); double cleansheets = fixtGoalsAgainst.Count(x => x == 0); double cleansheetsPer = cleansheets / playedLeagueFixtues.Count; var valueMap = new ValueMap(); valueMap[ValueMapKeys.GameweekStarted] = fixture.Gameweek.Started; valueMap[ValueMapKeys.GameweekEnded] = fixture.Gameweek.Ended; valueMap[ValueMapKeys.FixtureStarted] = fixture.Statistics.GameStarted; valueMap[ValueMapKeys.FixtureEnded] = fixture.Statistics.GameFinished; valueMap[ValueMapKeys.TotalGamesWon] = playedLeagueFixtues.Count(x => playerTeam.GetTeamFixtureOutcome(fixture) == TeamFixtureOutcome.Win); valueMap[ValueMapKeys.TotalGamesDraw] = playedLeagueFixtues.Count(x => playerTeam.GetTeamFixtureOutcome(fixture) == TeamFixtureOutcome.Draw); valueMap[ValueMapKeys.TotalGamesLoss] = playedLeagueFixtues.Count(x => playerTeam.GetTeamFixtureOutcome(fixture) == TeamFixtureOutcome.Loss); valueMap[ValueMapKeys.PlayerTotalGamesPlayed] = playedLeagueFixtues.Count; valueMap[ValueMapKeys.TotalGamesPlayed] = playedLeagueFixtues.Count; valueMap[ValueMapKeys.RecentGamesTeamPlayed] = recentLeagueFixtues.Count; valueMap[ValueMapKeys.RecentGamesTeamPoints] = points; valueMap[ValueMapKeys.RecentPointsPerGame] = points / recentLeagueFixtues.Count; valueMap[ValueMapKeys.TotalPoints] = totalPoints; valueMap[ValueMapKeys.TotalPointsPerGame] = totalPoints / playedLeagueFixtues.Count; valueMap[ValueMapKeys.PlayerTotalMinutesPlayed] = playerMinutes; valueMap[ValueMapKeys.PlayerTotalMinutesPercentageOfTeam] = percentage; valueMap[ValueMapKeys.FantasyPlayerCurrentPrice] = player.Fantasy.CurrentPrice; valueMap[ValueMapKeys.PlayerPosition] = player.Fantasy.Position.ToString(); valueMap[ValueMapKeys.PlayerTotalCleansheets] = cleansheets; valueMap[ValueMapKeys.PlayerTotalCleansheetsPercentage] = cleansheetsPer; valueMap[ValueMapKeys.PlayerTotalSaves] = saves; valueMap[ValueMapKeys.PlayerTotalSavesPerGame] = saves / playedLeagueFixtues.Count; valueMap[ValueMapKeys.PlayerTotalSavesPercentage] = saves / (saves + goalsAgainst); // todo: filter out other keepers in the team //valueMap["playedgames"] = ; //valueMap["substitutes-in"] = ; //valueMap["substitutes-out"] = ; // todo: add more data points (subs, recent playtime (5 last team games), recent subs) return valueMap; }
private void SetValuesUsingFieldId_v4(string pFieldId){ //Includes US states and Canadian provinces. //http://www.nrcan.gc.ca/earth-sciences/geography-boundary/geographical-name/translators/5782 string[] stateCodes=new string [] { //Canadian province codes. "AB",//Alberta "BC",//Britich Columbia "MB",//Manitoba "NB",//New Brunswick "NL",//Newfoundland and Labrador "NS",//Nova Scotia "NT",//Northwest Territories "NU",//Nunavut "ON",//Ontario "PE",//Prince Edward Island "QC",//Quebec "SK",//Saskatchewan "YT", //Yukon //Traditional Canadian province codes which somehow made it into our application, but we are going to leave them because they are probably harmless. "LB",//Newfoundland and Labrador - This appeared in Canada Post publications (e.g., The Canadian Postal Code Directory) for the mainland section of the province of Newfoundland and Labrador. "NF",//Newfoundland and Labrador - Nfld. and later NF (the two-letter abbreviation used before the province's name changed to Newfoundland and Labrador) and T.-N. (French version, for Terre-Neuve) "PQ",//Quebec - Que. and P.Q. (French version, for Province du Québec); later, PQ evolved from P.Q. as the first two-letter non-punctuated abbreviation. //US state codes. "AK","AL","AR","AZ","CA","CO","CT","DC","DE","FL", "GA","HI","IA","ID","IL","IN","KS","KY","LA","MA", "MD","ME","MI","MN","MO","MS","MT","NC","ND","NE", "NH","NJ","NM","NV","NY","OH","OK","OR","PA","RI", "SC","SD","TX","UT","VA","VT","WA","WI","WV","WY"}; string[] languageCodes=new string[] {"A","E","F"}; ValueMap valueMap; //Values in the following table were taken from the data dictionary of the CCD doc (about page 70). switch(pFieldId) { case "A01": fieldName="Transaction Prefix"; frenchFieldName="Préfixe de transaction"; format="A/N"; lengthRequirement=new ConstLengthRequirement(12); break; case "A02": //DENTAL OFFICE CLAIM REFERENCE NO fieldName="DENTAL OFFICE CLAIM REFERENCE NO"; frenchFieldName="NO DE TRANSACTION DU CABINET"; format="N"; lengthRequirement=new ConstLengthRequirement(6); break; case "A03": fieldName="Format Version Number"; frenchFieldName="Nombre de version de format"; format="N"; lengthRequirement=new ConstLengthRequirement(2); valueRequirements.Add(new DiscreteValueRequirement(new string[] {"02","04"})); break; case "A04": fieldName="Transaction Code"; frenchFieldName="Code de transaction"; format="N"; lengthRequirement=new ConstLengthRequirement(2); valueRequirements.Add(new DiscreteValueRequirement(new string[] { "01","11","21","02","12","03","13","23","04","14", "24","05","15","06","16","07","08","18"})); break; case "A05": fieldName="Carrier Identification Number"; frenchFieldName="Numéro d'identification de porteur"; format="N"; lengthRequirement=new ConstLengthRequirement(6); break; case "A06": fieldName="Software System ID"; frenchFieldName="Système logiciel identification"; format="A/N"; lengthRequirement=new ConstLengthRequirement(3); break; case "A07": fieldName="Message Length"; frenchFieldName="Longueur de message"; format="N"; lengthRequirement=new ConstLengthRequirement(5); break; case "A08": format="A/N"; lengthRequirement=new ConstLengthRequirement(1); fieldName="Materials Forwarded"; frenchFieldName="Les matériaux ont expédié"; valueRequirements.Add(new DiscreteValueRequirement(new string[] {" ","E","C","M","X","I","A","B","D","F","G", "H","J","K","L","N","O","P","Q","R","T","U"})); break; case "A09"://Not in version 2. fieldName="Carrier Transaction Counter"; frenchFieldName="Compteur de transaction de porteur"; format="N"; lengthRequirement=new ConstLengthRequirement(5); break; case "A10"://Not in version 2. fieldName="Encryption Method"; frenchFieldName="Méthode de chiffrage"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(1,3)); break; case "A11"://Not in version 2. fieldName="Mailbox Indicator"; frenchFieldName="Indicateur de boîte aux lettres"; format="A"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new DiscreteValueRequirement(new string[] {"Y","O","N"})); break; case "B01": //CDA Provider Number fieldName="UNIQUE ID NO"; frenchFieldName="NO DU DENTISTE"; format="A/N"; lengthRequirement=new ConstLengthRequirement(9); break; case "B02": //Provider Office Number fieldName="OFFICE NO"; frenchFieldName="NO DU CABINET"; format="A/N"; lengthRequirement=new ConstLengthRequirement(4); break; case "B03"://Not in version 2. fieldName="BILLING PROVIDER NUMBER"; frenchFieldName="NOMBRE DE FOURNISSEUR DE FACTURATION"; format="A/N"; lengthRequirement=new ConstLengthRequirement(9); break; case "B04"://Not in version 2. fieldName="BILLING OFFICE NUMBER"; frenchFieldName="NOMBRE D'OFFICE DE FACTURATION"; format="A/N"; lengthRequirement=new ConstLengthRequirement(4); break; case "B05"://Not in version 2. fieldName="Referring Provider Number"; frenchFieldName="Référence du nombre de fournisseur"; format="A/N"; lengthRequirement=new ConstLengthRequirement(10); break; case "B06"://Not in version 2. fieldName="Referral Reason Code"; frenchFieldName="Code complémentaire de référence"; format="N"; lengthRequirement=new ConstLengthRequirement(2); valueRequirements.Add(new RangeValueRequirement(0,13)); break; case "B07"://Not in version 2. fieldName="Receiving Provider Number"; frenchFieldName="Réception du nombre de fournisseur"; format="A/N"; lengthRequirement=new ConstLengthRequirement(9); break; case "B08"://Not in version 2. fieldName="Receiving Office Number"; frenchFieldName="Réception du nombre d'Office"; format="A/N"; lengthRequirement=new ConstLengthRequirement(4); break; case "C01": //Primary Policy/Plan Number fieldName="POLICY#"; frenchFieldName="NO DE POLICE"; format="A/N"; lengthRequirement=new ConstLengthRequirement(12); break; case "C02": //Subscriber Identification Number fieldName="CERTIFICATE NO"; frenchFieldName="NO DE CERTIFICAT"; format="A/N"; lengthRequirement=new ConstLengthRequirement(12); break; case "C03": fieldName="Relationship Code"; frenchFieldName="Code de rapport"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(1,5)); break; case "C04": fieldName="Patient's Sex"; frenchFieldName="Le sexe du patient"; format="A"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new DiscreteValueRequirement(new string[] {"M","F"})); break; case "C05": fieldName="Patient's Birthday"; frenchFieldName="L'anniversaire du patient"; format="N"; lengthRequirement=new ConstLengthRequirement(8); break; case "C06": fieldName="Patient's Last Name"; frenchFieldName="Le dernier nom du patient"; format="AE"; lengthRequirement=new ConstLengthRequirement(25); break; case "C07": fieldName="Patient's First Name"; frenchFieldName="Le prénom du patient"; format="AE"; lengthRequirement=new ConstLengthRequirement(15); break; case "C08": fieldName="Patient's Middle Initial"; frenchFieldName="L'initiale moyenne du patient"; format="AE"; lengthRequirement=new ConstLengthRequirement(1); break; case "C09": fieldName="Eligibility Exception Code"; frenchFieldName="Code d'exception d'acceptabilité"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(1,4)); break; case "C10": fieldName="Name of School"; frenchFieldName="Nom d'école"; format="AE/N"; lengthRequirement=new ConstLengthRequirement(25); break; case "C11": fieldName="DIVISION/SECTION NO"; frenchFieldName="NO DE DIVISION/SECTION"; format="A/N"; lengthRequirement=new ConstLengthRequirement(10); break; case "C12"://Not in version 2. fieldName="Plan Flag"; frenchFieldName="Drapeau de plan"; format="A"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new DiscreteValueRequirement(new string[] {" ","A","V","N"})); break; case "C13"://Not in version 2. fieldName="Band Number"; frenchFieldName="Nombre de bande"; format="N"; lengthRequirement=new ConstLengthRequirement(3); break; case "C14"://Not in version 2. fieldName="Family Number"; frenchFieldName="Nombre de famille"; format="N"; lengthRequirement=new ConstLengthRequirement(5); break; case "C15"://Not in version 2. fieldName="Missing Teeth"; frenchFieldName="Dents absentes"; format="A"; lengthRequirement=new ConstLengthRequirement(11); break; case "C16"://Not in version 2. fieldName="Eligibility Date"; frenchFieldName="Date d'acceptabilité"; format="N"; lengthRequirement=new ConstLengthRequirement(8); break; case "C17"://Not in version 2. fieldName="Primary Dependant Code"; frenchFieldName="Code dépendant primaire"; format="N"; lengthRequirement=new ConstLengthRequirement(2); break; case "C18"://Not in version 2. fieldName="Plan Record Count"; frenchFieldName="Plan Coun record"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(0,1)); valueMap=new ValueMap(new string[] {"A","N"},new string[] {"1"}); valueRequirements.Add(new DiscreteValuesBasedOnOtherField("C12",new ValueMap[] {valueMap})); break; case "C19"://Not in version 2. fieldName="Plan Record"; frenchFieldName="Disque de plan"; format="AN"; lengthRequirement=new ConstLengthRequirement(30); break; case "D01": fieldName="Subscriber's Birthday"; frenchFieldName="L'anniversaire de l'abonné"; format="N"; lengthRequirement=new ConstLengthRequirement(8); break; case "D02": fieldName="Subscriber's Last Name"; frenchFieldName="Le dernier nom de l'abonné"; format="AE"; lengthRequirement=new ConstLengthRequirement(25); break; case "D03": fieldName="Subscriber's First Name"; frenchFieldName="Le prénom de l'abonné"; format="AE"; lengthRequirement=new ConstLengthRequirement(15); break; case "D04": fieldName="Subscriber's Middle Initial"; frenchFieldName="L'initiale moyenne de l'abonné"; format="AE"; lengthRequirement=new ConstLengthRequirement(1); break; case "D05": fieldName="Subscriber's Address Line 1"; frenchFieldName="Ligne 1 de l'adresse de l'abonné"; format="AE/N"; lengthRequirement=new ConstLengthRequirement(30); break; case "D06": fieldName="Subscriber's Address Line 2"; frenchFieldName="Ligne 2 de l'adresse de l'abonné"; format="AE/N"; lengthRequirement=new ConstLengthRequirement(30); break; case "D07": fieldName="Subscriber's City"; frenchFieldName="La ville de l'abonné"; format="AE/N"; lengthRequirement=new ConstLengthRequirement(20); break; case "D08": fieldName="Subscriber's Province/State Code"; frenchFieldName="Code de la province/état de l'abonné"; format="A"; lengthRequirement=new ConstLengthRequirement(2); valueRequirements.Add(new DiscreteValueRequirement(stateCodes)); break; case "D09": fieldName="Subscriber's Postal/ZIP Code"; frenchFieldName="Code du Postal/ZIP de l'abonné"; format="A/N"; lengthRequirement=new ConstLengthRequirement(9); break; case "D10": fieldName="Language of the Insured"; frenchFieldName="Langue des assurés"; format="A"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new DiscreteValueRequirement(languageCodes)); break; case "D11"://Not in version 2. fieldName="Card Sequence/Version Number"; frenchFieldName="Ordre de carte/nombre de version"; format="N"; lengthRequirement=new ConstLengthRequirement(2); valueRequirements.Add(new RangeValueRequirement(1,99));//Cannot be 0 and 99 is largest for 2 digits in base 10. break; case "E01": fieldName="Secondary Carrier Unique ID Number"; frenchFieldName="Nombre unique d'identification de porteur secondaire"; format="N"; lengthRequirement=new ConstLengthRequirement(6); break; case "E02": fieldName="Secondary Policy/Plan"; frenchFieldName="Politique/plan secondaires"; format="A/N"; lengthRequirement=new ConstLengthRequirement(12); break; case "E03": fieldName="Secondary Plan Subscriber ID"; frenchFieldName="Identification secondaire d'abonné de plan"; format="A/N"; lengthRequirement=new ConstLengthRequirement(12); break; case "E04": fieldName="Secondary Subscriber's Birthday"; frenchFieldName="L'anniversaire de l'abonné secondaire"; format="N"; lengthRequirement=new ConstLengthRequirement(8); break; case "E05": fieldName="Secondary Division/Section Number"; frenchFieldName="Nombre secondaire de Division/section"; format="A/N"; lengthRequirement=new ConstLengthRequirement(10); break; case "E06": fieldName="Secondary Relationship Code"; frenchFieldName="Code secondaire de rapport"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(1,5)); break; case "E07"://Not in version 2. fieldName="Secondary Card Sequence/Version Number"; frenchFieldName="Ordre de carte secondaire/nombre de version"; format="N"; lengthRequirement=new ConstLengthRequirement(2); break; case "E08"://Not in version 2. fieldName="Secondary Subscriber's Last Name"; frenchFieldName="Le dernier nom de l'abonné secondaire"; format="AE"; lengthRequirement=new ConstLengthRequirement(25); break; case "E09"://Not in version 2. fieldName="Secondary Subscriber's First Name"; frenchFieldName="Le prénom de l'abonné secondaire"; format="AE"; lengthRequirement=new ConstLengthRequirement(15); break; case "E10"://Not in version 2. fieldName="Secondary Subscriber's Middle Initial"; frenchFieldName="L'initiale moyenne de l'abonné secondaire"; format="AE"; lengthRequirement=new ConstLengthRequirement(1); break; case "E11"://Not in version 2. fieldName="Secondary Subscriber's Address Line 1"; frenchFieldName="Ligne 1 de l'adresse de l'abonné secondaire"; format="AE/N"; lengthRequirement=new ConstLengthRequirement(30); break; case "E12"://Not in version 2. fieldName="Secondary Subscriber's Address Line 2"; frenchFieldName="Ligne 2 de l'adresse de l'abonné secondaire"; format="AE/N"; lengthRequirement=new ConstLengthRequirement(30); break; case "E13"://Not in version 2. fieldName="Secondary Subscriber's City"; frenchFieldName="La ville de l'abonné secondaire"; format="AE/N"; lengthRequirement=new ConstLengthRequirement(20); break; case "E14"://Not in version 2. fieldName="Secondary Subscriber's Province/State Code"; frenchFieldName="Code de la province/état de l'abonné secondaire"; format="A"; lengthRequirement=new ConstLengthRequirement(2); valueRequirements.Add(new DiscreteValueRequirement(stateCodes)); break; case "E15"://Not in version 2. fieldName="Secondary Subscriber's Postal/ZIP Code"; frenchFieldName="Code du Postal/ZIP de l'abonné secondaire"; format="A/N"; lengthRequirement=new ConstLengthRequirement(9); break; case "E16"://Not in version 2. fieldName="Secondary Language"; frenchFieldName="Langue secondaire"; format="A"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new DiscreteValueRequirement(languageCodes)); break; case "E17"://Not in version 2. fieldName="Secondary Dependant Code"; frenchFieldName="Code dépendant secondaire"; format="N"; lengthRequirement=new ConstLengthRequirement(2); break; case "E18"://Not in version 2. fieldName="Secondary Coverage"; frenchFieldName="Assurance secondaire"; format="A"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new DiscreteValueRequirement(new string[] {"Y","O","N","X"})); break; case "E19"://Not in version 2. fieldName="Secondary Carrier Transaction Counter"; frenchFieldName="Compteur secondaire de transaction de porteur"; format="N"; lengthRequirement=new ConstLengthRequirement(6); break; case "E20"://Not in version 2. fieldName="Secondary Record Count"; frenchFieldName="Compte record secondaire"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(0,1)); valueMap=new ValueMap(new string[] {"Y","O"},new string[] {"1"}); valueRequirements.Add(new DiscreteValuesBasedOnOtherField("E18",new ValueMap[]{valueMap})); break; case "F01": fieldName="Payee Code"; frenchFieldName="Code de bénéficiaire"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(1,4)); break; case "F02": fieldName="Accident Date"; frenchFieldName="Date d'accidents"; format="N"; lengthRequirement=new ConstLengthRequirement(8); break; case "F03": fieldName="Predetermination Number"; frenchFieldName="Nombre de prédétermination"; format="A/N"; lengthRequirement=new ConstLengthRequirement(14); break; case "F04": fieldName="Date of Initial Placement Upper"; frenchFieldName="Date de haut initial de placement"; format="N"; lengthRequirement=new ConstLengthRequirement(8); break; case "F05": fieldName="Treatment Required for orthodontic"; frenchFieldName="Traitement requis pour orthodontique"; format="A"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new DiscreteValueRequirement(new string[] {"Y","O","N"})); break; case "F06": fieldName="Number of Procedures Performed"; frenchFieldName="Nombre de procédures exécutées"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(1,7)); break; case "F07": fieldName="Procedure Line Number"; frenchFieldName="Ligne nombre de procédé"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(0,7)); break; case "F08": fieldName="Procedure Code"; frenchFieldName="Code de procédé"; format="A/N"; lengthRequirement=new ConstLengthRequirement(5); break; case "F09": fieldName="Date of Service"; frenchFieldName="Date de service"; format="N"; lengthRequirement=new ConstLengthRequirement(8); break; case "F10": fieldName="International Tooth,Sextant, Quad or Arch"; frenchFieldName="Dent, sextant, quadruple ou voûte international"; format="N"; lengthRequirement=new ConstLengthRequirement(2); break; case "F11": fieldName="Tooth Surface"; frenchFieldName="Surface de dent"; format="A"; lengthRequirement=new ConstLengthRequirement(5); valueRequirements.Add(new RegexValueRequirement("^[MOIDBLV ]+$")); break; case "F12": fieldName="Dentist's Fee Claimed"; frenchFieldName="Les honoraires du dentiste réclamés"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; case "F13": fieldName="Lab Procedure Fee # 1"; frenchFieldName="Honoraires # 1 de procédé de laboratoire"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; //case "F14": // Does not exist in data dictionary! // break; case "F15": fieldName="Is this an Initial Placement Upper"; frenchFieldName="Est c'un premier haut de placement"; format="A"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new DiscreteValueRequirement(new string[] {"Y","O","N","X"})); break; case "F16"://Not in version 2. fieldName="Procedure Type Codes"; frenchFieldName="Type codes de procédé"; format="A"; lengthRequirement=new ConstLengthRequirement(5); valueRequirements.Add(new DiscreteValueRequirement(new string[] {"A","B","C","E","L","S","X"})); break; case "F17"://Not in version 2. fieldName="Remarks Code"; frenchFieldName="Code de remarques"; format="N"; lengthRequirement=new ConstLengthRequirement(2); break; case "F18"://Not in version 2. fieldName="Is this an Initial Placement Lower"; frenchFieldName="Est c'un premier placement inférieur"; format="A"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new DiscreteValueRequirement(new string[] { "Y","O","N","X" })); break; case "F19"://Not in version 2. fieldName="Date of Initial Placement Lower"; frenchFieldName="La date du placement initial s'abaissent"; format="N"; lengthRequirement=new ConstLengthRequirement(8); break; case "F20"://Not in version 2. fieldName="Maxillary Prosthesis Material"; frenchFieldName="Matériel maxillaire de prothèse"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(1,6)); break; case "F21"://Not in version 2. fieldName="Mandibular Prosthesis Material"; frenchFieldName="Matériel mandibulaire de prothèse"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(1,6)); break; case "F22"://Not in version 2. fieldName="Extracted Teeth Count"; frenchFieldName="Compte extrait de dents"; format="N"; lengthRequirement=new ConstLengthRequirement(2); valueRequirements.Add(new RangeValueRequirement(0,50)); break; case "F23"://Not in version 2. fieldName="Extracted Tooth Number"; frenchFieldName="Nombre extrait de dent"; format="N"; lengthRequirement=new ConstLengthRequirement(2); break; case "F24"://Not in version 2. fieldName="Extraction Date"; frenchFieldName="Date d'extraction"; format="N"; lengthRequirement=new ConstLengthRequirement(8); break; case "F25"://Not in version 2. fieldName="Orthodontic Record Flag"; frenchFieldName="Drapeau record orthodontique"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(0,1)); break; case "F26"://Not in version 2. fieldName="First Examination Fee"; frenchFieldName="Premiers honoraires d'examen"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; case "F27"://Not in version 2. fieldName="Diagnostic Phase Fee"; frenchFieldName="Honoraires diagnostiques de phase"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; case "F28"://Not in version 2. fieldName="Initial Payment"; frenchFieldName="Paiement initial"; format="D"; lengthRequirement=new ConstLengthWhenOtherFieldHasValue("F25","1",6); break; case "F29"://Not in version 2. fieldName="Payment Mode"; frenchFieldName="Mode de paiement"; format="N"; lengthRequirement=new ConstLengthWhenOtherFieldHasValue("F25","1",1); valueRequirements.Add(new RangeValueRequirement(1,4)); break; case "F30"://Not in version 2. fieldName="Treatment Duration"; frenchFieldName="Durée de traitement"; format="N"; lengthRequirement=new ConstLengthWhenOtherFieldHasValue("F25","1",2); break; case "F31"://Not in version 2. fieldName="Number of Anticipated Payments"; frenchFieldName="Nombre de paiements prévus"; format="N"; lengthRequirement=new ConstLengthWhenOtherFieldHasValue("F25","1",2); break; case "F32"://Not in version 2. fieldName="Anticipated Payment Amount"; frenchFieldName="Quantité prévue de paiement"; format="D"; lengthRequirement=new ConstLengthWhenOtherFieldHasValue("F25","1",6); break; case "F33"://Not in version 2. fieldName="Reconciliation Date"; frenchFieldName="Date de réconciliation"; format="N"; lengthRequirement=new ConstLengthRequirement(8); break; case "F34"://Not in version 2. fieldName="Lab Procedure Code # 1"; frenchFieldName="Code # 1 de procédé de laboratoire"; format="A/N"; lengthRequirement=new ConstLengthRequirement(5); break; case "F35"://Not in version 2. fieldName="Lab Procedure Code # 2"; frenchFieldName="Code # 2 de procédé de laboratoire"; format="A/N"; lengthRequirement=new ConstLengthRequirement(5); break; case "F36"://Not in version 2. fieldName="Lab Procedure Fee # 2"; frenchFieldName="Honoraires # 2 de procédé de laboratoire"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; case "F37"://Not in version 2. fieldName="Estimated Treatment Start Date"; frenchFieldName="Date estimée de début de traitement"; format="N"; lengthRequirement=new ConstLengthWhenOtherFieldHasValue("F25","1",8); break; case "F38"://Not in version 2. fieldName="Current Reconciliation Page Number"; frenchFieldName="Numéro de page courant de réconciliation"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(1,9)); break; case "F39"://Not in version 2. fieldName="Diagnostic Code"; frenchFieldName="Code diagnostique"; format="A/N"; lengthRequirement=new ConstLengthRequirement(6); break; case "F40"://Not in version 2. fieldName="Institution Code"; frenchFieldName="Code d'établissement"; format="A/N"; lengthRequirement=new ConstLengthRequirement(6); break; case "F41"://Not in version 2. fieldName="Original DENTAL OFFICE CLAIM REFERENCE NO"; frenchFieldName="Nombre d'ordre original d'Office"; format="N"; lengthRequirement=new ConstLengthRequirement(6); break; case "F42"://Not in version 2. fieldName="Original Transaction Reference Number"; frenchFieldName="Numéro de référence original de transaction"; format="A/N"; lengthRequirement=new ConstLengthRequirement(14); break; case "F43"://Not in version 2. fieldName="Attachment Source"; frenchFieldName="Source d'attachement"; format="A"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new DiscreteValueRequirement(new string[] {"I","U"})); break; case "F44"://Not in version 2. fieldName="Attachment Count"; frenchFieldName="Compte d'attachement"; format="N"; lengthRequirement=new ConstLengthRequirement(2); valueRequirements.Add(new RangeValueRequirement(1,30)); break; case "F45"://Not in version 2. fieldName="Attachment Type"; frenchFieldName="Type d'attachement"; format="A/N"; lengthRequirement=new ConstLengthRequirement(3); valueRequirements.Add(new DiscreteValueRequirement(new string[] {"JPG","DIC","TXT","DOC"})); break; case "F46"://Not in version 2. fieldName="Attachment Length"; frenchFieldName="Longueur d'attachement"; format="N"; lengthRequirement=new ConstLengthRequirement(7); break; case "F47"://Not in version 2. fieldName="Attachment"; frenchFieldName="Attachement"; format="N"; lengthRequirement=new LengthFromAnotherField("F46"); break; case "F48"://Not in version 2. fieldName="Attachment File Date"; frenchFieldName="Date de dossier d'attachement"; format="N"; lengthRequirement=new ConstLengthRequirement(8); break; case "F49"://Not in version 2. fieldName="Attachment Number"; frenchFieldName="Nombre d'attachement"; format="A/N"; lengthRequirement=new ConstLengthRequirement(2); break; case "G01": //Transaction Reference Number fieldName="CARRIER CLAIM NO"; frenchFieldName="NO DE RÉFÉRENCE DE TRANSACTION"; format="A/N"; lengthRequirement=new ConstLengthRequirement(14); break; case "G02": fieldName="Eligible Amount for Lab Procedure Code #2"; frenchFieldName="Quantité éligible pour le code #2 de procédé de laboratoire"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; case "G03": fieldName="Expected Payment Date"; frenchFieldName="Date prévue de paiement"; format="N"; lengthRequirement=new ConstLengthRequirement(8); break; case "G04": fieldName="Total Amount of Service"; frenchFieldName="Montant total de service"; format="D"; lengthRequirement=new ConstLengthRequirement(7); break; case "G05": fieldName="Response Status"; frenchFieldName="Statut de réponse"; format="A"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new DiscreteValueRequirement(new string[] {"A","E","R","H","B","C","N","M","X"})); break; case "G06": fieldName="Number of Error Codes"; frenchFieldName="Nombre de codes d'erreur"; format="N"; lengthRequirement=new ConstLengthRequirement(2); valueRequirements.Add(new RangeValueRequirement(0,10)); break; case "G07": //Disposition message fieldName="DISPOSITION"; frenchFieldName="SPÉCIFICATIONS"; format="AE/N"; lengthRequirement=new ConstLengthRequirement(75); break; case "G08": fieldName="Error Code"; frenchFieldName="Code d'erreur"; format="N"; lengthRequirement=new ConstLengthRequirement(3); break; //case "G09": // Does not exist //break; case "G10": fieldName="Number of Carrier Issued Procedure Codes"; frenchFieldName="Le nombre de porteur a publié des codes de procédé"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(0,6)); break; case "G11": fieldName="Number of Note Lines"; frenchFieldName="Nombre de lignes de note"; format="N"; lengthRequirement=new ConstLengthRequirement(2); valueRequirements.Add(new RangeValueRequirement(0,32)); break; case "G12": fieldName="Eligible Amount"; frenchFieldName="Quantité éligible"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; case "G13": fieldName="Deductible Amount"; frenchFieldName="Quantité déductible"; format="D"; lengthRequirement=new ConstLengthRequirement(5); break; case "G14": fieldName="Eligible Percentage"; frenchFieldName="Pourcentage éligible"; format="N"; lengthRequirement=new ConstLengthRequirement(3); valueRequirements.Add(new RangeValueRequirement(0,100)); break; case "G15": fieldName="Benefit Amount for the Procedure"; frenchFieldName="Quantité d'avantage pour le procédé"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; case "G16": fieldName="Explanation Note Number 1"; frenchFieldName="Note numéro 1 d'explication"; format="N"; lengthRequirement=new ConstLengthRequirement(2); break; case "G17": fieldName="Explanation Note Number 2"; frenchFieldName="Note numéro 2 d'explication"; format="N"; lengthRequirement=new ConstLengthRequirement(2); break; case "G18": fieldName="Reference to Line Number of the Submitted Procedure"; frenchFieldName="Référence à la ligne nombre du procédé soumis"; format="N"; lengthRequirement=new ConstLengthRequirement(7); valueRequirements.Add(new RegexValueRequirement("^[0-7]+$")); break; case "G19": fieldName="Additional Procedure Code"; frenchFieldName="Code additionnel de procédé"; format="A/N"; lengthRequirement=new ConstLengthRequirement(5); break; case "G20": fieldName="Eligible Amount for the Additional Procedure"; frenchFieldName="Quantité éligible pour le procédé additionnel"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; case "G21": fieldName="Dedutible for the Additional Procedure"; frenchFieldName=""; format="D"; lengthRequirement=new ConstLengthRequirement(5); break; case "G22": fieldName="Eligible Percentage"; frenchFieldName="Pourcentage éligible"; format="N"; lengthRequirement=new ConstLengthRequirement(3); valueRequirements.Add(new RangeValueRequirement(0,100)); break; case "G23": fieldName="Benefit Amount for the Additional Procedure"; frenchFieldName="Quantité d'avantage pour le procédé additionnel"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; case "G24": fieldName="Explanation Note Number 1 for the Additional Procedure"; frenchFieldName="Note d'explication numéro 1 pour le procédé additionnel"; format="N"; lengthRequirement=new ConstLengthRequirement(2); break; case "G25": fieldName="Explanation Note Number 2 for the Additional Procedure"; frenchFieldName="Note d'explication numéro 2 pour le procédé additionnel"; format="N"; lengthRequirement=new ConstLengthRequirement(2); break; case "G26": fieldName="Note Text"; frenchFieldName="Noter le texte"; format="AE/N"; lengthRequirement=new ConstLengthRequirement(75); break; case "G27": fieldName="Language of the Insured"; frenchFieldName="Langue des assurés"; format="A"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new DiscreteValueRequirement(new string [3] {"A","E","F"})); break; case "G28": fieldName="Total Benefit Amount"; frenchFieldName="Quantité totale d'avantage"; format="D"; lengthRequirement=new ConstLengthRequirement(7); break; case "G29": fieldName="Deductible amount unallocated"; frenchFieldName="La quantité déductible a désassigné"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; case "G30": fieldName="VERIFICATION NO"; frenchFieldName="CODE DE VALIDATION"; format="A/N"; lengthRequirement=new ConstLengthRequirement(10); break; case "G31"://Not in version 2. fieldName="Display Message Count"; frenchFieldName="Compte de message d'affichage"; format="N"; lengthRequirement=new ConstLengthRequirement(2); valueRequirements.Add(new RangeValueRequirement(0,40)); break; case "G32"://Not in version 2. fieldName="Display Message"; frenchFieldName="Message d'affichage"; format="AE/N"; lengthRequirement=new ConstLengthRequirement(75); break; case "G33"://Not in version 2. fieldName="PAYMENT ADJUSTMENT AMOUNT"; frenchFieldName="MONTANT D'ADAPTATION DE PAIEMENT"; format="D"; lengthRequirement=new ConstLengthRequirement(7); break; case "G34"://Not in version 2. fieldName="PAYMENT REFERENCE"; frenchFieldName="RÉFÉRENCE DE PAIEMENT"; format="A/N"; lengthRequirement=new ConstLengthRequirement(10); break; case "G35"://Not in version 2. fieldName="PAYMENT DATE"; frenchFieldName="DATE DE PAIEMENT"; format="N"; lengthRequirement=new ConstLengthRequirement(8); break; case "G36"://Not in version 2. fieldName="PAYMENT AMOUNT"; frenchFieldName="QUANTITÉ DE PAIEMENT"; format="D"; lengthRequirement=new ConstLengthRequirement(7); break; case "G37"://Not in version 2. fieldName="Payment Detail Count"; frenchFieldName="Compte de détail de paiement"; format="N"; lengthRequirement=new ConstLengthRequirement(3); valueRequirements.Add(new RangeValueRequirement(0,250)); break; case "G38"://Not in version 2. fieldName="Transaction Payment"; frenchFieldName="Paiement de transaction"; format="D"; lengthRequirement=new ConstLengthRequirement(7); break; case "G39"://Not in version 2. fieldName="Embedded Transaction Length"; frenchFieldName="Longueur incluse de transaction"; format="N"; lengthRequirement=new ConstLengthRequirement(4); break; case "G40"://Not in version 2. fieldName="Embedded Transaction"; frenchFieldName="Transaction incluse"; format="AE/N"; lengthRequirement=new LengthFromAnotherField("G39"); break; case "G41"://Not in version 2. fieldName="Message Output Flag"; frenchFieldName="Drapeau de rendement de message"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(0,2)); break; case "G42"://Not in version 2. fieldName="Form ID"; frenchFieldName="Former l'identification"; format="N"; lengthRequirement=new ConstLengthRequirement(2); valueRequirements.Add(new RangeValueRequirement(1,8)); break; case "G43"://Not in version 2. fieldName="Eligible Amount for Lab Procedure Code # 1"; frenchFieldName="Quantité éligible pour le code # 1 de procédé de laboratoire"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; case "G44"://Not in version 2. fieldName="Eligible Lab Amount for the Additional Procedure"; frenchFieldName="Quantité éligible de laboratoire pour le procédé additionnel"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; case "G45"://Not in version 2. fieldName="Note Number"; frenchFieldName="Noter le nombre"; format="N"; lengthRequirement=new ConstLengthRequirement(3); break; case "G46"://Not in version 2. fieldName="Current Predetermination Page Number"; frenchFieldName="Numéro de page courant de prédétermination"; format="N"; lengthRequirement=new ConstLengthRequirement(1); break; case "G47"://Not in version 2. fieldName="Last Predetermination Page Number"; frenchFieldName="Numéro de page courant de prédétermination"; format="N"; lengthRequirement=new ConstLengthRequirement(1); break; case "G48"://Not in version 2. fieldName="E-Mail Office Number"; frenchFieldName="Nombre d'Office d'E-mail"; format="N"; lengthRequirement=new ConstLengthRequirement(4); break; case "G49"://Not in version 2. //E-mail to fieldName="TO"; frenchFieldName="DESTINATAIRE"; format="AE/N"; lengthRequirement=new ConstLengthRequirement(60); break; case "G50"://Not in version 2. //E-mail from fieldName="FROM"; frenchFieldName="EXPÉDITEUR"; format="AE/N"; lengthRequirement=new ConstLengthRequirement(60); break; case "G51"://Not in version 2. fieldName="SUBJECT"; frenchFieldName="OBJET"; format="AE/N"; lengthRequirement=new ConstLengthRequirement(60); break; case "G52"://Not in version 2. fieldName="Number of E-mail Note Lines"; frenchFieldName="Nombre de lignes de note d'E-mail"; format="N"; lengthRequirement=new ConstLengthRequirement(2); valueRequirements.Add(new RangeValueRequirement(1,50)); break; case "G53"://Not in version 2. fieldName="E-Mail Note Line"; frenchFieldName="Ligne de note d'E-mail"; format="AE/N"; lengthRequirement=new ConstLengthRequirement(75); break; case "G54"://Not in version 2. //Email reference number fieldName="REFERENCE"; frenchFieldName="RÉFÉRENCE"; format="A/N"; lengthRequirement=new ConstLengthRequirement(10); break; case "G55"://Not in version 2. fieldName="Total Payable"; frenchFieldName="Payable total"; format="D"; lengthRequirement=new ConstLengthRequirement(7); break; case "G56"://Not in version 2. fieldName="Deductible Amount for Lab Procedure Code # 1"; frenchFieldName="Quantité déductible pour le code # 1 de procédé de laboratoire"; format="D"; lengthRequirement=new ConstLengthRequirement(5); break; case "G57"://Not in version 2. fieldName="Eligible Percentage for Lab Procedure # 1"; frenchFieldName="Pourcentage éligible pour le procédé # 1 de laboratoire"; format="N"; lengthRequirement=new ConstLengthRequirement(3); break; case "G58"://Not in version 2. fieldName="Benefit Amount for Lab Procedure Code #1"; frenchFieldName="Quantité d'avantage pour le code #1 de procédé de laboratoire"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; case "G59"://Not in version 2. fieldName="Deductible Amount for Lab Procedure Code # 2"; frenchFieldName="Quantité déductible pour le code # 2 de procédé de laboratoire"; format="D"; lengthRequirement=new ConstLengthRequirement(5); break; case "G60"://Not in version 2. fieldName="Eligible Percentage for Lab Procedure Code # 2"; frenchFieldName="Pourcentage éligible pour le code # 2 de procédé de laboratoire"; format="N"; lengthRequirement=new ConstLengthRequirement(3); break; case "G61"://Not in version 2. fieldName="Benefit Amount for Lab Procedure Code # 2"; frenchFieldName="Bénéficier la quantité pour le code # 2 de procédé de laboratoire"; format="D"; lengthRequirement=new ConstLengthRequirement(6); break; case "G62"://Not in version 2. fieldName="Last Reconciliation Page Number"; frenchFieldName="Dernier numéro de page de réconciliation"; format="N"; lengthRequirement=new ConstLengthRequirement(1); valueRequirements.Add(new RangeValueRequirement(1,9)); break; default: MessageBox.Show("Internal Error, unknown version 4 CCD field ID during construction: "+pFieldId); return;//error } }
public DiscreteValuesBasedOnOtherField(string pOtherFieldId,ValueMap[] pValueMaps) { otherFieldId=pOtherFieldId; valueMaps=pValueMaps; }
private void Init(IScope parent, Map map) { m_parent = parent; m_values = map; m_valueMap = new ValueMap(m_values); m_valueMap.Scope = this; m_valueMap.WritableMetadata[keyParent] = (parent == null ? ValueNil.Nil : parent.AsValue); m_valueMap.WritableMetadata[Value.keyType] = s_type; m_valueMap.WritableMetadata[keyName] = s_defaultName; }
public void TestRestOfMap() { Map map = new Map(); map["a"] = PatternData.Single("a", ValueType.Int); map["other"] = PatternData.Rest("other"); ValueMap pattern = new ValueMap(map); Value match = null, leftover = null; { // input is a map w/ fewer keys - match w/ leftover map = new Map(); map["a"] = new ValueInt(14); ValueMap input = new ValueMap(map); Assert.IsTrue(PatternChecker.Do(input, pattern, false/*bShortPat*/, out match, out leftover)); Assert.AreEqual(2, match.AsMap.Count); Assert.AreEqual(14, match.AsMap["a"].AsInt); Map rest = match.AsMap["other"].AsMap; Assert.AreEqual(0, rest.Count); // 'rest' is present but empty Assert.AreEqual(null, leftover); } { // input contains extra keys that will get stuffed in 'other' map = new Map(); map["a"] = new ValueInt(14); map["b"] = new ValueInt(3); map["c"] = new ValueInt(15); ValueMap input = new ValueMap(map); Assert.IsTrue(PatternChecker.Do(input, pattern, false/*bShortPat*/, out match, out leftover)); Assert.AreEqual(2, match.AsMap.Count); Assert.AreEqual(14, match.AsMap["a"].AsInt); Map rest = match.AsMap["other"].AsMap; Assert.AreEqual(2, rest.Count); Assert.AreEqual(3, rest["b"].AsInt); Assert.AreEqual(15, rest["c"].AsInt); Assert.AreEqual(null, leftover); } }
internal FoldRight() { SetDocString("Apply infix function to last and second to last item, then result and third to last, etc. Returns a single value."); Map map = new Map(); map["array"] = PatternData.Single("array", ValueType.Array); map["function"] = PatternData.Single("function", ValueType.Function); ValueMap vMap = new ValueMap(map); Init(vMap); }
public void TestMapDefault() { Map map = new Map(); map["first"] = PatternData.Single("first", new ValueInt(156)); // default map["second"] = PatternData.Single("second"); ValueMap pattern = new ValueMap(map); Value match = null, leftover = null; { // input is missing key w/ default - full match map = new Map(); map["second"] = new ValueInt(3); ValueMap input = new ValueMap(map); Assert.IsTrue(PatternChecker.Do(input, pattern, false/*bShortPat*/, out match, out leftover)); Assert.AreEqual(2, match.AsMap.Count); Assert.AreEqual(156, match.AsMap["first"].AsInt); Assert.AreEqual(3, match.AsMap["second"].AsInt); Assert.AreEqual(null, leftover); } { // input is missing key w/out default - match w/ leftover map = new Map(); map["first"] = new ValueInt(5); ValueMap input = new ValueMap(map); Assert.IsTrue(PatternChecker.Do(input, pattern, false/*bShortPat*/, out match, out leftover)); Assert.AreEqual(1, match.AsMap.Count); Assert.AreEqual(5, match.AsMap["first"].AsInt); Assert.AreEqual(1, leftover.AsMap.Count); Assert.AreEqual("second", leftover.AsMap["second"].AsString); } }
public static ValueMap DecodeEnumerations(ISymbolEnumerator symbols) { Symbol current = symbols.NextNonEOLSymbol(); current.Expect(Symbol.OpenBracket); ValueMap map = new ValueMap(); do { current = symbols.NextNonEOLSymbol(); string identifier = current.ToString(); current = symbols.NextNonEOLSymbol(); current.Expect(Symbol.OpenParentheses); current = symbols.NextNonEOLSymbol(); Int64 enumValue; if (Int64.TryParse(current.ToString(), out enumValue)) { try { // Have to include the number as it seems repeated identifiers are allowed ?? map.Add(enumValue, String.Format("{0}({1})", identifier, enumValue)); } catch (ArgumentException ex) { current.Assert(false, ex.Message); } } else { // Need to get "DefinedValue". } current = symbols.NextNonEOLSymbol(); current.Expect(Symbol.CloseParentheses); current = symbols.NextNonEOLSymbol(); } while (current == Symbol.Comma); current.Expect(Symbol.CloseBracket); return map; }
public BitsType(IModule module, string name, ISymbolEnumerator symbols) : base(module, name) { _map = Lexer.DecodeEnumerations(symbols); }
internal SubtractMap() { Map map = new Map(); map["a"] = PatternData.Single("a", ValueType.Int); map["b"] = PatternData.Single("b", ValueType.Int); ValueMap vMap = new ValueMap(map); Init(vMap); }
public void TestMap() { Map map = new Map(); map["do?"] = PatternData.Single("do?", ValueType.Bool); map["body"] = PatternData.Body(); ValueMap pattern = new ValueMap(map); Value match = null, leftover = null; { // single object - not a match Value input = PatternData.Single("a"); Assert.IsFalse(PatternChecker.Do(input, pattern, false/*bShortPat*/, out match, out leftover)); } { // input is a map w/ fewer keys - match w/ leftover map = new Map(); map["do?"] = new ValueBool(true); ValueMap input = new ValueMap(map); Assert.IsTrue(PatternChecker.Do(input, pattern, false/*bShortPat*/, out match, out leftover)); Assert.AreEqual(1, match.AsMap.Count); Assert.AreEqual(true, match.AsMap["do?"].AsBool); Assert.AreEqual(1, leftover.AsMap.Count); Assert.AreEqual("l3.body", leftover.AsMap["body"].AsString); } { // map w/ same keys - match map = new Map(); map["do?"] = new ValueBool(true); map["body"] = PatternData.Body(); ValueMap input = new ValueMap(map); Assert.IsTrue(PatternChecker.Do(input, pattern, false/*bShortPat*/, out match, out leftover)); Assert.AreEqual(2, match.AsMap.Count); Assert.AreEqual(true, match.AsMap["do?"].AsBool); Assert.AreEqual("l3.body", match.AsMap["body"].AsString); Assert.AreEqual(null, leftover); } { // map w/ extra keys - not a match map = new Map(); map["do?"] = new ValueBool(true); map["body"] = PatternData.Body(); map["something"] = new ValueInt(42); ValueMap input = new ValueMap(map); Assert.IsFalse(PatternChecker.Do(input, pattern, false/*bShortPat*/, out match, out leftover)); } }