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); } } }
// 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); } } }
// 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!"); } } }
// 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."); }