Tabnine Logo
LRUCache.get
Code IndexAdd Tabnine to your IDE (free)

How to use
get
method
in
org.mapsforge.core.util.LRUCache

Best Java code snippets using org.mapsforge.core.util.LRUCache.get (Showing top 5 results out of 315)

origin: mapsforge/mapsforge

/**
 * Matches a node with the given parameters against this RenderTheme.
 *
 * @param renderCallback the callback implementation which will be executed on each match.
 * @param renderContext
 * @param poi            the point of interest.
 */
public synchronized void matchNode(RenderCallback renderCallback, final RenderContext renderContext, PointOfInterest poi) {
  MatchingCacheKey matchingCacheKey = new MatchingCacheKey(poi.tags, renderContext.rendererJob.tile.zoomLevel, Closed.NO);
  List<RenderInstruction> matchingList = this.poiMatchingCache.get(matchingCacheKey);
  if (matchingList != null) {
    // cache hit
    for (int i = 0, n = matchingList.size(); i < n; ++i) {
      matchingList.get(i).renderNode(renderCallback, renderContext, poi);
    }
    return;
  }
  // cache miss
  matchingList = new ArrayList<RenderInstruction>();
  for (int i = 0, n = this.rulesList.size(); i < n; ++i) {
    this.rulesList.get(i).matchNode(renderCallback, renderContext, matchingList, poi);
  }
  this.poiMatchingCache.put(matchingCacheKey, matchingList);
}
origin: mapsforge/mapsforge

private synchronized void matchWay(RenderCallback renderCallback, final RenderContext renderContext, Closed closed, PolylineContainer way) {
  MatchingCacheKey matchingCacheKey = new MatchingCacheKey(way.getTags(), way.getUpperLeft().zoomLevel, closed);
  List<RenderInstruction> matchingList = this.wayMatchingCache.get(matchingCacheKey);
  if (matchingList != null) {
    // cache hit
    for (int i = 0, n = matchingList.size(); i < n; ++i) {
      matchingList.get(i).renderWay(renderCallback, renderContext, way);
    }
    return;
  }
  // cache miss
  matchingList = new ArrayList<RenderInstruction>();
  for (int i = 0, n = this.rulesList.size(); i < n; ++i) {
    this.rulesList.get(i).matchWay(renderCallback, way, way.getUpperLeft(), closed, matchingList, renderContext);
  }
  this.wayMatchingCache.put(matchingCacheKey, matchingList);
}
origin: mapsforge/mapsforge

@Test
public void lruCacheTest() {
  LRUCache<String, String> lruCache = createLRUCache(2);
  lruCache.put(KEY1, VALUE1);
  Assert.assertEquals(VALUE1, lruCache.get(KEY1));
  Assert.assertFalse(lruCache.containsKey(KEY2));
  Assert.assertFalse(lruCache.containsKey(KEY3));
  lruCache.put(KEY2, VALUE2);
  Assert.assertEquals(VALUE1, lruCache.get(KEY1));
  Assert.assertEquals(VALUE2, lruCache.get(KEY2));
  Assert.assertFalse(lruCache.containsKey(KEY3));
  lruCache.put(KEY3, VALUE3);
  Assert.assertFalse(lruCache.containsKey(KEY1));
  Assert.assertEquals(VALUE2, lruCache.get(KEY2));
  Assert.assertEquals(VALUE3, lruCache.get(KEY3));
  lruCache.put(KEY1, VALUE1);
  Assert.assertEquals(VALUE1, lruCache.get(KEY1));
  Assert.assertFalse(lruCache.containsKey(KEY2));
  Assert.assertEquals(VALUE3, lruCache.get(KEY3));
}
origin: org.mapsforge/mapsforge-map

/**
 * Matches a node with the given parameters against this RenderTheme.
 *
 * @param renderCallback the callback implementation which will be executed on each match.
 * @param renderContext
 * @param poi            the point of interest.
 */
public synchronized void matchNode(RenderCallback renderCallback, final RenderContext renderContext, PointOfInterest poi) {
  MatchingCacheKey matchingCacheKey = new MatchingCacheKey(poi.tags, renderContext.rendererJob.tile.zoomLevel, Closed.NO);
  List<RenderInstruction> matchingList = this.poiMatchingCache.get(matchingCacheKey);
  if (matchingList != null) {
    // cache hit
    for (int i = 0, n = matchingList.size(); i < n; ++i) {
      matchingList.get(i).renderNode(renderCallback, renderContext, poi);
    }
    return;
  }
  // cache miss
  matchingList = new ArrayList<RenderInstruction>();
  for (int i = 0, n = this.rulesList.size(); i < n; ++i) {
    this.rulesList.get(i).matchNode(renderCallback, renderContext, matchingList, poi);
  }
  this.poiMatchingCache.put(matchingCacheKey, matchingList);
}
origin: org.mapsforge/mapsforge-map

private synchronized void matchWay(RenderCallback renderCallback, final RenderContext renderContext, Closed closed, PolylineContainer way) {
  MatchingCacheKey matchingCacheKey = new MatchingCacheKey(way.getTags(), way.getUpperLeft().zoomLevel, closed);
  List<RenderInstruction> matchingList = this.wayMatchingCache.get(matchingCacheKey);
  if (matchingList != null) {
    // cache hit
    for (int i = 0, n = matchingList.size(); i < n; ++i) {
      matchingList.get(i).renderWay(renderCallback, renderContext, way);
    }
    return;
  }
  // cache miss
  matchingList = new ArrayList<RenderInstruction>();
  for (int i = 0, n = this.rulesList.size(); i < n; ++i) {
    this.rulesList.get(i).matchWay(renderCallback, way, way.getUpperLeft(), closed, matchingList, renderContext);
  }
  this.wayMatchingCache.put(matchingCacheKey, matchingList);
}
org.mapsforge.core.utilLRUCacheget

Popular methods of LRUCache

  • <init>
  • put
  • calculateInitialCapacity
  • clear
  • size
  • containsKey

Popular in Java

  • Updating database using SQL prepared statement
  • getContentResolver (Context)
  • requestLocationUpdates (LocationManager)
  • onRequestPermissionsResult (Fragment)
  • Kernel (java.awt.image)
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Notification (javax.management)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now