Beispiel #1
0
 public virtual object Clone()
 {
     ArrayMap copy = new ArrayMap();
     copy.threshold = threshold;
     copy.keyTables = keyTables;
     copy.valueTables = valueTables;
     copy.size = size;
     return copy;
 }
Beispiel #2
0
 public void Dispose()
 {
     this.isClose = true;
     if (displayList != null) {
     displayList.Destroy();
     displayList = null;
     }
     if (displays != null) {
     displays.Clear();
     displays = null;
     }
 }
Beispiel #3
0
 public Entry(int hashCode_0, object key_1, object value_ren,
         ArrayMap.Entry next_2)
 {
     this.hashCode = hashCode_0;
     this.key = key_1;
     this.value_ren = value_ren;
     this.next = next_2;
 }
Beispiel #4
0
 private object SwapValue(ArrayMap.Entry entry, object value_ren)
 {
     object old = entry.value_ren;
     entry.value_ren = value_ren;
     return old;
 }
Beispiel #5
0
 private int IndexOf(ArrayMap.Entry entry)
 {
     for (int i = 0; i < size; i++)
     {
         if (valueTables[i] == entry)
         {
             return i;
         }
     }
     return -1;
 }
Beispiel #6
0
 public AVGCG()
 {
     this.charas = new ArrayMap(10);
     this.style = true;
     this.loop = true;
 }
Beispiel #7
0
		internal Actions() {
			this.actions = new ArrayMap(CollectionUtils.INITIAL_CAPACITY);
		}
Beispiel #8
0
        private void Parse(Stream file)
        {
            if (displays == null) {
            displays = new ArrayMap(DEFAULT_MAX_CHAR);
            } else {
            displays.Clear();
            }
            try {
            StreamReader ins = new StreamReader(file,
                    System.Text.Encoding.UTF8);
            info = ins.ReadLine();
            common = ins.ReadLine();
            page = ins.ReadLine();

            ArrayMap kerning = new ArrayMap(
                    64);
            List<CharDef> charDefs = new List<CharDef>(
                    DEFAULT_MAX_CHAR);

            int maxChar = 0;
            bool done = false;
            for (; !done;) {
                string line = ins.ReadLine();
                if (line == null) {
                    done = true;
                } else {
                    if (line.StartsWith("chars c")) {
                    } else if (line.StartsWith("char")) {
                        CharDef def = ParseChar(line);
                        if (def != null) {
                            maxChar = MathUtils.Max(maxChar, def.id);
                            charDefs.Add(def);
                        }
                    }
                    if (line.StartsWith("kernings c")) {
                    } else if (line.StartsWith("kerning")) {
                        StringTokenizer tokens = new StringTokenizer(line, " =");
                        tokens.NextToken();
                        tokens.NextToken();
                        short first = short.Parse(tokens.NextToken());
                        tokens.NextToken();
                        int second = int.Parse(tokens.NextToken());
                        tokens.NextToken();
                        int offset = int.Parse(tokens.NextToken());
                        List<short> values = (List<short>)kerning.GetValue(first);
                        if (values == null) {
                            values = new List<short>();
                            kerning.Put(first, values);
                        }
                        values.Add((short) ((offset << 8) | second));
                    }
                }
            }

            this.chars = new CharDef[maxChar + 1];

            for (IEnumerator<CharDef> iter = charDefs.GetEnumerator(); iter.MoveNext();) {
                CharDef def = (CharDef) iter.Current;
                chars[def.id] = def;
            }
            ArrayMap.Entry[] entrys = kerning.ToEntrys();
            for (int j=0;j<entrys.Length;j++) {
                ArrayMap.Entry entry = entrys[j];
                short first = (short) entry.GetKey();
                List<short> valueList = (List<short>) entry.GetValue();
                short[] valueArray = new short[valueList.Count];
                int i = 0;
                for (IEnumerator<short> valueIter = valueList.GetEnumerator(); valueIter
                        .MoveNext(); i++) {
                    valueArray[i] = (short) valueIter.Current;
                }
                chars[first].kerning = valueArray;
            }
            } catch (IOException e) {
            Log.Exception(e);
            throw new Exception("Invalid font file: " + file);
            }
        }
Beispiel #9
0
        private bool SetupIF(string commandString, string nowPosFlagName,
                Dictionary<object, object> setEnvironmentList, ArrayMap conditionEnvironmentList)
        {
            bool result = false;
            conditionEnvironmentList.Put(nowPosFlagName, (bool)(false));
            try
            {
                IList temps = CommandSplit(commandString);
                int size = temps.Count;
                object valueA = null;
                object valueB = null;
                string condition = null;
                if (size <= 4)
                {
                    valueA = (string)temps[1];
                    valueB = (string)temps[3];
                    valueA = (CollectionUtils.Get(setEnvironmentList, valueA) == null) ? valueA
                            : CollectionUtils.Get(setEnvironmentList, valueA);
                    valueB = (CollectionUtils.Get(setEnvironmentList, valueB) == null) ? valueB
                            : CollectionUtils.Get(setEnvironmentList, valueB);
                    condition = (string)temps[2];
                }
                else
                {
                    int count = 0;
                    StringBuilder sbr = new StringBuilder();
                    for (IEnumerator it = temps.GetEnumerator(); it.MoveNext(); )
                    {
                        string res = (string)it.Current;
                        if (count > 0)
                        {
                            if (!IsCondition(res))
                            {
                                sbr.Append(res);
                            }
                            else
                            {
                                valueA = sbr.ToString();
                                valueA = exp.Parse(valueA).ToString();
                                sbr.Remove(0, sbr.Length - (0));
                                condition = res;
                            }
                        }
                        count++;
                    }
                    valueB = sbr.ToString();
                }

                if (!NumberUtils.IsNan((string)valueB))
                {
                    try
                    {
                        valueB = exp.Parse(valueB);
                    }
                    catch (Exception)
                    {
                    }
                }

                if (valueA == null || valueB == null)
                {
                    conditionEnvironmentList
                            .Put(nowPosFlagName, (bool)(false));
                }

                if ("==".Equals(condition))
                {
                    conditionEnvironmentList.Put(nowPosFlagName, (bool)(result = valueA.ToString().Equals(valueB.ToString())));
                }
                else if ("!=".Equals(condition))
                {
                    conditionEnvironmentList.Put(nowPosFlagName, (bool)(result = !valueA.ToString().Equals(valueB.ToString())));
                }
                else if (">".Equals(condition))
                {
                    float numberA = Single.Parse(valueA.ToString(), JavaRuntime.NumberFormat);
                    float numberB = Single.Parse(valueB.ToString(), JavaRuntime.NumberFormat);
                    conditionEnvironmentList.Put(nowPosFlagName, (bool)(result = numberA > numberB));
                }
                else if ("<".Equals(condition))
                {
                    float numberA = Single.Parse(valueA.ToString(), JavaRuntime.NumberFormat);
                    float numberB = Single.Parse(valueB.ToString(), JavaRuntime.NumberFormat);
                    conditionEnvironmentList.Put(nowPosFlagName, (bool)(result = numberA < numberB));
                }
                else if (">=".Equals(condition))
                {
                    float numberA = Single.Parse(valueA.ToString(), JavaRuntime.NumberFormat);
                    float numberB = Single.Parse(valueB.ToString(), JavaRuntime.NumberFormat);
                    conditionEnvironmentList.Put(nowPosFlagName, (bool)(result = numberA >= numberB));
                }
                else if ("<=".Equals(condition))
                {
                    float numberA = Single.Parse(valueA.ToString(), JavaRuntime.NumberFormat);
                    float numberB = Single.Parse(valueB.ToString(), JavaRuntime.NumberFormat);
                    conditionEnvironmentList.Put(nowPosFlagName, (bool)(result = numberA <= numberB));
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
            return result;
        }
Beispiel #10
0
 public static void ReleaseCache()
 {
     if (setEnvironmentList != null)
     {
         setEnvironmentList.Clear();
         setEnvironmentList = null;
     }
     if (conditionEnvironmentList != null)
     {
         conditionEnvironmentList.Clear();
         conditionEnvironmentList = null;
     }
     if (functions != null)
     {
         functions.Clear();
         functions = null;
     }
     if (scriptContext != null)
     {
         scriptContext.Clear();
         scriptContext = null;
     }
     if (scriptLazy != null)
     {
         scriptLazy.Clear();
         scriptLazy = null;
     }
 }
Beispiel #11
0
 public static void CreateCache(bool free)
 {
     if (free)
     {
         if (scriptContext == null)
         {
             scriptContext = new Dictionary<object, object>(1000);
         }
         else
         {
             scriptContext.Clear();
         }
         if (functions == null)
         {
             functions = new ArrayMap(20);
         }
         else
         {
             functions.Clear();
         }
         if (setEnvironmentList == null)
         {
             setEnvironmentList = new Dictionary<object, object>(20);
         }
         else
         {
             setEnvironmentList.Clear();
         }
         if (conditionEnvironmentList == null)
         {
             conditionEnvironmentList = new ArrayMap(30);
         }
         else
         {
             conditionEnvironmentList.Clear();
         }
     }
     else
     {
         if (scriptContext == null)
         {
             scriptContext = new Dictionary<object, object>(1000);
         }
         if (functions == null)
         {
             functions = new ArrayMap(20);
         }
         if (setEnvironmentList == null)
         {
             setEnvironmentList = new Dictionary<object, object>(20);
         }
         if (conditionEnvironmentList == null)
         {
             conditionEnvironmentList = new ArrayMap(30);
         }
     }
 }
Beispiel #12
0
 public void Dispose()
 {
     this.isClose = true;
     if (displayList != null)
     {
         displayList.Destroy();
         displayList = null;
     }
     if (displays != null)
     {
         for (int i = 0; i < displays.Size(); i++)
         {
             Display d = (Display)displays.Get(i);
             if (d != null && d.cache != null)
             {
                 d.cache.Dispose();
                 d.cache = null;
             }
         }
         displays.Clear();
         displays = null;
     }
 }
Beispiel #13
0
		public void Dispose() {
			 lock (typeof(CollisionManager)) {
						if (freeObjects != null) {
							freeObjects.Clear();
							freeObjects = null;
						}
						if (collisionClasses != null) {
							CollectionUtils.Clear(collisionClasses);
							collisionClasses = null;
						}
						if (collisionChecker != null) {
							collisionChecker.Dispose();
							collisionChecker.Clear();
							collisionChecker = null;
						}
					}
		}
Beispiel #14
0
		public NSDictionary(int len) {
			_dict = new ArrayMap(len);
		}
Beispiel #15
0
		public NSDictionary() {
			_dict = new ArrayMap();
		}