Exemple #1
0
            /// <summary>
            /// Retrieves a map that associates with each declared numeric token
            /// identifier its corresponding declared character sequence value.
            /// </summary>
            /// <returns>
            /// A new map from each declared numeric identifier to its character sequence value.
            /// </returns>
            private static IntKeyHashMap NewTokenIdentifierMap()
            {
                IntKeyHashMap map = new IntKeyHashMap(347, 1.0F);

                FieldInfo[] fields = typeof(Token.IdFor).GetFields(
                    BindingFlags.DeclaredOnly |
                    BindingFlags.Static |
                    BindingFlags.Public);

                foreach (FieldInfo keyField in fields)
                {
                    if (keyField.FieldType != typeof(int))
                    {
                        continue;
                    }
                    if (0 == (keyField.Attributes & (FieldAttributes.HasDefault |
                                                     FieldAttributes.Literal)))
                    {
                        continue;
                    }

                    FieldInfo valueField = (typeof(Token.ValueFor)).GetField(
                        keyField.Name);

                    if (valueField == null)
                    {
                        continue;
                    }

                    map.put((int)keyField.GetValue(null), valueField.GetValue(null));
                }

                return(map);
            }
 public void addRechargeTime(int sid, int[] time)
 {
     if (rechargeTime == null)
     {
         rechargeTime = new IntKeyHashMap();
     }
     rechargeTime.put(sid, time);
 }
 public void addExchangeTime(int sid, int[] time)
 {
     if (exchangeTime == null)
     {
         exchangeTime = new IntKeyHashMap();
     }
     exchangeTime.put(sid, time);
 }
Exemple #4
0
 /// <summary>
 /// Initializes the <see cref="Map"/> class.
 /// </summary>
 static Map()
 {
     m_CommandTokenIdentifierMap = Map.NewCommandTokenIdentifierMap();
     m_TokenValueMap             = Map.NewTokenValueMap();
     m_TokenIdentifierMap        = Map.NewTokenIdentifierMap();
     // literals not allowed as table / column names
     m_KeywordSet = Map.NewKeywordSet();
 }