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

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

Best Java code snippets using org.mapsforge.core.util.LRUCache.put (Showing top 6 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 lruCacheWithCapacityZeroTest() {
  LRUCache<String, String> lruCache = createLRUCache(0);
  lruCache.put(KEY1, VALUE1);
  Assert.assertFalse(lruCache.containsKey(KEY1));
}
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.utilLRUCacheput

Popular methods of LRUCache

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

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onRequestPermissionsResult (Fragment)
  • getResourceAsStream (ClassLoader)
  • runOnUiThread (Activity)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Runner (org.openjdk.jmh.runner)
  • Top PhpStorm plugins
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