/** * Absolute position of object denoted by key in the * history or -1 if !containsKey(key). The higher the * newer. * * @param key The key of the object to inspect * @return value between 0 and MAX_HISTORY_SIZE - 1, or -1 */ public synchronized int getPosition(K key) { if (!containsKey(key)) return -1; return fPositions.get(key).intValue(); }
/** * Absolute position of object denoted by key in the * history or -1 if !containsKey(key). The higher the * newer. * * @param key The key of the object to inspect * @return value between 0 and MAX_HISTORY_SIZE - 1, or -1 */ public synchronized int getPosition(Object key) { if (!containsKey(key)) return -1; return ((Integer)fPositions.get(key)).intValue(); }
/** * Absolute position of object denoted by key in the * history or -1 if !containsKey(key). The higher the * newer. * * @param key The key of the object to inspect * @return value between 0 and MAX_HISTORY_SIZE - 1, or -1 */ public synchronized int getPosition(K key) { if (!containsKey(key)) return -1; return fPositions.get(key).intValue(); }
/** * Normalized position in history of object denoted by key. * The position is a value between zero and one where zero * means not contained in history and one means newest element * in history. The lower the value the older the element. * * @param key The key of the object to inspect * @return value in [0.0, 1.0] the lower the older the element */ public synchronized float getNormalizedPosition(K key) { if (!containsKey(key)) return 0.0f; int pos= fPositions.get(key).intValue() + 1; //containsKey(key) implies fHistory.size()>0 return (float)pos / (float)fHistory.size(); }
/** * Normalized position in history of object denoted by key. * The position is a value between zero and one where zero * means not contained in history and one means newest element * in history. The lower the value the older the element. * * @param key The key of the object to inspect * @return value in [0.0, 1.0] the lower the older the element */ public synchronized float getNormalizedPosition(K key) { if (!containsKey(key)) return 0.0f; int pos= fPositions.get(key).intValue() + 1; //containsKey(key) implies fHistory.size()>0 return (float)pos / (float)fHistory.size(); }
/** * Normalized position in history of object denoted by key. * The position is a value between zero and one where zero * means not contained in history and one means newest element * in history. The lower the value the older the element. * * @param key The key of the object to inspect * @return value in [0.0, 1.0] the lower the older the element */ public synchronized float getNormalizedPosition(Object key) { if (!containsKey(key)) return 0.0f; int pos= ((Integer)fPositions.get(key)).intValue() + 1; //containsKey(key) implies fHistory.size()>0 return (float)pos / (float)fHistory.size(); }