private <T> Collection<T> generatePoints(
      TreeSet<Integer> grids_x,
      TreeSet<Integer> grids_y,
      PointFactory<T> factory,
      boolean collectExtremity)
      throws PointFactory.PFException {

    TreeMap<ViewComponentInfo, Collection<T>> map = new TreeMap<ViewComponentInfo, Collection<T>>();
    ViewComponentInfo hit;
    for (Integer x : grids_x) {
      for (Integer y : grids_y) {
        // System.out.println("("+x+","+y+")");
        hit = this.projectAbsoluteCoordinateRecursively(x, y);
        if (hit != null) {
          // Collection<T> iter = factory.get(x,y,hit);
          map.put(hit, factory.get(x, y, hit));
        }
      }
    }

    LinkedList<T> lst = new LinkedList<T>();
    for (Map.Entry<ViewComponentInfo, Collection<T>> entry : map.entrySet()) {
      for (T t : entry.getValue()) {
        if (collectExtremity) {
          if (entry.getKey().children == null
              || entry.getKey().isCollectionMember
              || entry.getKey().isSpinner
              || entry.getKey().hasOnClickListener()) {
            lst.add(t);
          }
        } else lst.add(t);
      }
    }
    return lst;
  }
Beispiel #2
0
 public static void main(String[] args) {
   PointFactory factory = PointFactory.getInstance();
   factory.getPoint("two", 10, 10, 0);
   factory.getPoint("three", 10, 10, 10);
 }