Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //package geometry;
- // javac Geometry.java && java Geometry
- import java.util.*;
- class Point {
- public double id = 0;
- public double y = 0;
- public double x = 0;
- public double m = 0;
- public int srid = 0;
- public void Point(double y, double x, double m) {
- this.y=y;
- this.x=x;
- this.m=m;
- }
- }
- /*
- class LineString {
- public Map<Integer, ArrayList<Point>> line = new HashMap<Integer, ArrayList<Point>>();
- }
- class Polygon {
- public Map<Integer, LineString> polygon = new HashMap<Integer, LineString>();
- }
- class MultiPolygon {
- public Map<Integer, Polygon> multipolygon = new HashMap<Integer, Polygon>();
- }
- */
- class Geometry {
- Map<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer> > > > multipolygons =
- new HashMap<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer> > > >();
- public static void main(String[] args) {
- System.out.println("Hello World!");
- Point p = new Point();
- p.y=100;p.x=100;
- System.out.println(p.toString()+": "+p.y+", "+p.x+", "+p.m);
- //multipolygons.put(1, new HashMap<2, new HashMap<3, new ArrayList<Integer> > > >();
- //multipolygons.get(1, new HashMap<Integer, HashMap<Integer, ArrayList<Integer> > > );
- //2, new HashMap(3, new ArrayList<Intgeger>(Arrays.asList(10, 20, 30)) ) ) );
- //System.out.println(multipolygons.toString());
- List<List<Integer>> marks = new ArrayList<>();
- marks.add(new ArrayList<Integer>( Arrays.asList(10, 20, 30) ));
- marks.add(new ArrayList<Integer>( Arrays.asList(11, 22, 33) ));
- System.out.println(marks.toString());
- HashMap<String,ArrayList<Integer>> map = new HashMap<String,ArrayList<Integer>>();
- map.put("mango", new ArrayList<Integer>()); map.get("mango").add(4); map.get("mango").add(44);
- map.put("maMgo", new ArrayList<Integer>()); map.get("maMgo").add(45345); map.get("maMgo").add(5345); map.get("maMgo").add(34543);
- System.out.println(map.toString());
- HashMap< Integer, HashMap< Integer, ArrayList< Integer > > > map2 = new HashMap< Integer, HashMap< Integer, ArrayList< Integer > > >();
- map2.put(2, new HashMap< Integer, ArrayList< Integer > >() );
- map2.get(2).put(20, new ArrayList< Integer >() );
- map2.get(2).get(20).add(22); map2.get(2).get(20).add(23);
- System.out.println(map2.keySet() +" "+map2.toString());
- // Hash of ( Integer & ( Hash of ( Integer & ( Hash of ( Integer & ( Hash of ( Integer & Array of Integer ) ) ) ) ) ) )
- HashMap< Integer, HashMap< Integer, HashMap< Integer, ArrayList< Integer > > > > map3 =
- new HashMap< Integer, HashMap< Integer, HashMap< Integer, ArrayList< Integer > > > >();
- map3.put(3, new HashMap< Integer, HashMap< Integer, ArrayList< Integer > > >() );
- map3.get(3).put(20, new HashMap< Integer, ArrayList< Integer > >() );
- map3.get(3).get(20).put(33, new ArrayList< Integer >() );
- map3.get(3).get(20).get(33).add(41);
- map3.get(3).get(20).get(33).add(42);
- map3.get(3).get(20).get(33).add(43);
- System.out.println(map3.toString());
- //
- }
- }
- /*
- RESULT:
- q:>javac Geometry.java && java Geometry
- Hello World!
- Point@15db9742: 100.0, 100.0, 0.0
- [[10, 20, 30], [11, 22, 33]]
- {maMgo=[45345, 5345, 34543], mango=[4, 44]}
- [2] {2={20=[22, 23]}}
- {3={20={33=[41, 42, 43]}}}
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement