SHARE
TWEET

Untitled

a guest Nov 13th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package GrafPackage;
  2.  
  3. import sun.reflect.generics.reflectiveObjects.NotImplementedException;
  4.  
  5. import java.lang.reflect.Array;
  6. import java.util.ArrayList;
  7. import java.util.HashMap;
  8. import java.util.LinkedList;
  9. import java.util.List;
  10.  
  11. public class CGrafSkierowany <W,S> implements IGraf<W,S> {
  12.     public CGrafSkierowany (ArrayList<ArrayList<W>> vertices, ArrayList<ArrayList<S>> labels) {
  13.         list = new HashMap<>();
  14.         for (int i = 0; i < vertices.size(); i++){
  15.             W ver = vertices.get(i).get(0);
  16.             HashMap <W,S> map = new HashMap<>();
  17.             for (int j = 1; j < vertices.get(i).size(); j++){
  18.                 map.put(vertices.get(i).get(j),labels.get(i).get(j));
  19.             }
  20.             list.put(ver,map);
  21.         }
  22.         System.out.println(list.keySet());
  23.         System.out.println(list.values());
  24.     }
  25.     public List<W> wierzcholki() {
  26.         return new LinkedList<>(list.keySet());
  27.     }
  28.     public S krawedz(W w1, W w2) {
  29.         return list.get(w1).get(w2);
  30.     }
  31.     public List <W> krawedzie(W w) {
  32.         return new LinkedList<>(list.get(w).keySet());
  33.     }
  34.     private HashMap <W,HashMap<W,S>> list;
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top