SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Machine {
  2.  
  3.     int machineId;
  4.     int capacity; //what to doooo..
  5.     boolean originalCopy;
  6.     HashMap<Integer, boolean> elementMap; //ElementId, isOriginal || isCopy
  7.     HashMap<Integer, Edges> edgesIn;
  8.     HashMap<Integer, Edges> edgesOut;  
  9. }
  10.  
  11. class Edge {
  12.  
  13.     Machine machine;
  14.    
  15.     Edge(Machine machine) {
  16.         this.machine = machine;
  17.     }
  18.  
  19. }
  20.  
  21. class Oblig3 {
  22.    
  23.     //new NetworkSimulator();
  24.     //new fileReader(networksimulator);
  25.     //filereader.readConfigFile();
  26.     //filereader.readDataFile();
  27.     //networksimulator.promptRequest();
  28.         //printOptions();
  29.         //
  30.  
  31. }
  32.  
  33. class NetworkSimulator {
  34.  
  35.     HashMap<Integer, Machine> machineMap;
  36.  
  37.     SimulateNetwork() {
  38.        
  39.     }
  40.  
  41.     promptRequest() {
  42.        
  43.         //printOptions();
  44.         //order loop
  45.         //Handle user input and call findCheapestPath,
  46.         //findShortestPath or findShortestAndCheapestPath  
  47.  
  48.         //Use containsInNetwork on elements specified by user  
  49.         //Use containsMachine on machine ID specified by user.
  50.  
  51.     }
  52.  
  53.     printOptions() {
  54.         System.out.println("Valid search preferences: {T, C, B}");
  55.         System.out.println(" - T = Minimize time used. ");
  56.         System.out.println(" - C = Minimize cost used. ");
  57.         System.out.println(" - B = Minimize both time and cost used. ");
  58.        
  59.         System.out.println(" Valid ownership preferences: {O, A}");
  60.         System.out.println(" - O = Original copies only. ");
  61.         System.out.println(" - A = Any copy accepted. ");
  62.  
  63.         System.out.println("Example of legal input:");
  64.         System.out.println("Machine_id:search_preference:ownership_preference:
  65.                          " + list_of_data_elements");
  66.         System.out.println("1:C:O:57 15 296 83");
  67.     }
  68.  
  69.     containsInNetwork(int machineId, int elementKey) {
  70.         if(!containsMachine(machineId) {
  71.             return false;
  72.         } else {
  73.             Machine temp = machineMap.get(machineId);
  74.             if(temp.elementMap.contains(elementKey) {
  75.                 return true;
  76.             }
  77.             return false;
  78.         }
  79.     }
  80.  
  81.     containsMachine(int machineId) {
  82.         if(machineMap.contains(machineid)) {
  83.             return true;
  84.         } else {
  85.             System.err.println("Machine " + machineId + " does not exist in                                  network.")
  86.             return false;
  87.         }
  88.     }
  89.  
  90.     findCheapestPath() {
  91.  
  92.     }
  93.  
  94.     findShortestPath() {
  95.  
  96.     }
  97.  
  98.     findCheapestAndShortestPath() {
  99.  
  100.     }
  101.  
  102.  
  103. }
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