예제 #1
0
 public Model getAuto(String modelName) {
   _autoModel = _autoModelGroup.get(modelName);
   if (_autoModel == null) {
     System.err.println("Model not found! Model: " + modelName);
   }
   return _autoModel;
 }
예제 #2
0
 // prints to console based on if the model name is found
 public void printAuto(String modelName) {
   _autoModel = _autoModelGroup.get(modelName);
   if (_autoModel != null) {
     // using toStringWChoices to show optionChoice is functional
     System.out.println(_autoModel.toStringWChoices(true));
     System.out.print("Price with selected options(may be defaults):");
     System.out.println(_autoModel.getTotalPrice());
   } else System.out.print("Model name" + modelName + "not found");
 }
예제 #3
0
 public void updateOptionSetName(String modelName, String optionSetName, String newName) {
   int setIndex;
   _autoModel = _autoModelGroup.get(modelName);
   if (_autoModel != null) {
     setIndex = _autoModel.findOptionSetIndex(optionSetName);
     if (setIndex != -1) {
       _autoModel.updateOptionSetName(setIndex, newName);
     }
   }
 }
예제 #4
0
 // optionName goes with optionset, optVal is the String property in an option.
 public void updateOptionPrice(
     String modelName, String optionName, String optVal, float newprice) {
   int setIndex;
   _autoModel = _autoModelGroup.get(modelName);
   if (_autoModel != null) {
     setIndex = _autoModel.findOptionSetIndex(optionName);
     if (setIndex != -1) {
       _autoModel.updateOptionPrice(setIndex, optVal, newprice);
     }
   }
 }
예제 #5
0
 // optionName goes with optionset, optVal is the String property in an option.
 public void updateOptionValue(
     String modelName, String optionName, String oldOptVal, String newOptVal) {
   int setIndex;
   _autoModel = _autoModelGroup.get(modelName);
   if (_autoModel != null) {
     setIndex = _autoModel.findOptionSetIndex(optionName);
     if (setIndex != -1) {
       if (_autoModel.updateOptionName(setIndex, oldOptVal, newOptVal))
         System.out.println(newOptVal + " set!");
     }
   }
 }
예제 #6
0
 // a separate path with waits, just in case I forget to remove sleep() for the next lab.
 public void waitUpdateOptionValue(
     String modelName, String optionName, String oldOptVal, String newOptVal) {
   System.out.println(
       "Demonstrating Thread named "
           + Thread.currentThread().getName()
           + " and Setting "
           + oldOptVal
           + " to "
           + newOptVal);
   int setIndex;
   _autoModel = _autoModelGroup.get(modelName);
   if (_autoModel != null) {
     setIndex = _autoModel.findOptionSetIndex(optionName);
     if (setIndex != -1) {
       if (_autoModel.updateOptionName2(setIndex, oldOptVal, newOptVal)) {
         System.out.println(newOptVal + " set and updateOptionName2 exited.");
       } else {
         System.out.println(newOptVal + " NOT set but updateOptionName2 exited.");
       }
     }
   }
   System.out.println(Thread.currentThread().getName() + " done.");
 }
예제 #7
0
 public ArrayList<String> getModelNameList() {
   ArrayList<String> modelList = new ArrayList<String>();
   modelList.addAll(_autoModelGroup.keySet());
   return modelList;
 }
예제 #8
0
 public int countAutos() {
   return _autoModelGroup.size();
 }
예제 #9
0
 public boolean isAutoHere(String modelName) {
   return (_autoModelGroup.containsKey(modelName));
 }
예제 #10
0
 public void addAuto(Model autoModel) {
   if (!_autoModelGroup.containsKey(autoModel.getModelName())) {
     _autoModelGroup.put(autoModel.getModelName(), autoModel);
   }
 }
예제 #11
0
 public void removeAuto(String modelName) {
   _autoModelGroup.remove(modelName);
 }
예제 #12
0
 public void updateOptionChoice(String modelName, String optSetName, String optName) {
   _autoModel = _autoModelGroup.get(modelName);
   _autoModel.setOptionChoice(optSetName, optName);
 }
예제 #13
0
 public ArrayList<String> getOptionSetNames(String modelName) {
   return _autoModelGroup.get(modelName).getAllOptSetNames();
 }