Re: [h2] MVMap similar to LinkedHashMap
but that taking up more memory... On Monday, April 23, 2018 at 2:07:42 PM UTC+8, Thomas Mueller Graf wrote: > > Hi, > > What about adding a second map with a counter as a key, and the key as the > value. So there are two maps: > > map 1: key: counter; value: your key > map 2: key: your key; value: your value plus the counter from map 1 > > Regards, > Thomas > > > On Sun, Apr 22, 2018 at 8:46 PM, ivan> wrote: > >> oh? that great! do you have any sample? Thanks >> >> I found this but can't really understand how this work : >> >> MVRTreeMap r = s.openMap("data", >> new MVRTreeMap.Builder()); >> >> // add two key-value pairs >> // the first value is the key id (to make the key unique) >> // then the min x, max x, min y, max y >> r.add(new SpatialKey(0, -3f, -2f, 2f, 3f), "left"); >> r.add(new SpatialKey(1, 3f, 4f, 4f, 5f), "right"); >> >> // iterate over the intersecting keys >> Iterator it = >> r.findIntersectingKeys(new SpatialKey(0, 0f, 9f, 3f, 6f)); >> for (SpatialKey k; it.hasNext();) { >> k = it.next(); >> System.out.println(k + ": " + r.get(k)); >> } >> s.close(); >> >> On Saturday, April 21, 2018 at 7:34:10 PM UTC+8, Noel Grandin wrote: >>> >>> you can use ceiingKey(K) to match on the first part of the search key. >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "H2 Database" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to h2-database...@googlegroups.com . >> To post to this group, send email to h2-da...@googlegroups.com >> . >> Visit this group at https://groups.google.com/group/h2-database. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
Re: [h2] MVMap similar to LinkedHashMap
Hi, What about adding a second map with a counter as a key, and the key as the value. So there are two maps: map 1: key: counter; value: your key map 2: key: your key; value: your value plus the counter from map 1 Regards, Thomas On Sun, Apr 22, 2018 at 8:46 PM, ivanwrote: > oh? that great! do you have any sample? Thanks > > I found this but can't really understand how this work : > > MVRTreeMap r = s.openMap("data", > new MVRTreeMap.Builder()); > > // add two key-value pairs > // the first value is the key id (to make the key unique) > // then the min x, max x, min y, max y > r.add(new SpatialKey(0, -3f, -2f, 2f, 3f), "left"); > r.add(new SpatialKey(1, 3f, 4f, 4f, 5f), "right"); > > // iterate over the intersecting keys > Iterator it = > r.findIntersectingKeys(new SpatialKey(0, 0f, 9f, 3f, 6f)); > for (SpatialKey k; it.hasNext();) { > k = it.next(); > System.out.println(k + ": " + r.get(k)); > } > s.close(); > > On Saturday, April 21, 2018 at 7:34:10 PM UTC+8, Noel Grandin wrote: >> >> you can use ceiingKey(K) to match on the first part of the search key. >> > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to h2-database+unsubscr...@googlegroups.com. > To post to this group, send email to h2-database@googlegroups.com. > Visit this group at https://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
Re: [h2] MVMap similar to LinkedHashMap
oh? that great! do you have any sample? Thanks I found this but can't really understand how this work : MVRTreeMap r = s.openMap("data", new MVRTreeMap.Builder()); // add two key-value pairs // the first value is the key id (to make the key unique) // then the min x, max x, min y, max y r.add(new SpatialKey(0, -3f, -2f, 2f, 3f), "left"); r.add(new SpatialKey(1, 3f, 4f, 4f, 5f), "right"); // iterate over the intersecting keys Iterator it = r.findIntersectingKeys(new SpatialKey(0, 0f, 9f, 3f, 6f)); for (SpatialKey k; it.hasNext();) { k = it.next(); System.out.println(k + ": " + r.get(k)); } s.close(); On Saturday, April 21, 2018 at 7:34:10 PM UTC+8, Noel Grandin wrote: > > you can use ceiingKey(K) to match on the first part of the search key. > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
Re: [h2] MVMap similar to LinkedHashMap
you can use ceiingKey(K) to match on the first part of the search key. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
Re: [h2] MVMap similar to LinkedHashMap
But that will effecte the search key .. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
Re: [h2] MVMap similar to LinkedHashMap
you could probably get the same effect by adding a sequentially increasing id to the end of the key -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
Re: [h2] MVMap similar to LinkedHashMap
No -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.