예제 #1
0
 public boolean intersects(FLine f, Vec2 position) {
   Cached<FLine, Object, Area> area =
       f.attributes.computeIfAbsent(
           projectedArea,
           (k) ->
               new Cached<FLine, Object, Area>(
                   (fline, previously) -> projectFLineToArea(fline),
                   (fline) -> new Object[] {fline, fline.getModCount()}));
   return area.apply(f).contains(position.x, position.y);
 }
예제 #2
0
 private void updcache() {
   for (int i = 0; (i < cur) && list[i].d; i++) {
     Cached c;
     if (list[i].skip || ((c = list[i].statroot) == null)) continue;
     if (c.slots.isEmpty()) {
       if (newcache.get(c) != null)
         throw (new RuntimeException(
             String.format("statroot for %s already in new cache even though empty", c.root)));
       newcache.put(c, c);
     }
     c.slots.add(new SavedSlot(list[i]));
     if (list[i].disp != null) {
       c.disp.add(list[i].disp);
       list[i].disp = null;
     }
   }
   if (cachedb && Debug.kf3 && !prevcache.isEmpty()) dumprejects(prevcache, newcache);
   for (Cached old : prevcache.values()) old.dispose();
   prevcache = newcache;
   newcache = new HashMap<Cached, Cached>();
 }