public virtual object Clone() { ArrayMap copy = new ArrayMap(); copy.threshold = threshold; copy.keyTables = keyTables; copy.valueTables = valueTables; copy.size = size; return copy; }
public void Dispose() { this.isClose = true; if (displayList != null) { displayList.Destroy(); displayList = null; } if (displays != null) { displays.Clear(); displays = null; } }
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; }
private object SwapValue(ArrayMap.Entry entry, object value_ren) { object old = entry.value_ren; entry.value_ren = value_ren; return old; }
private int IndexOf(ArrayMap.Entry entry) { for (int i = 0; i < size; i++) { if (valueTables[i] == entry) { return i; } } return -1; }
public AVGCG() { this.charas = new ArrayMap(10); this.style = true; this.loop = true; }
internal Actions() { this.actions = new ArrayMap(CollectionUtils.INITIAL_CAPACITY); }
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); } }
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; }
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; } }
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); } } }
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; } }
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; } } }
public NSDictionary(int len) { _dict = new ArrayMap(len); }
public NSDictionary() { _dict = new ArrayMap(); }