Code example for Preferences

Methods: getDoublegetIntputDoubleputInt

0
      XMLStore store = XMLStore.createFromFile(storeFile, store1);
      PreferencesExt prefs = store.getPreferences();
      prefs.exportSubtree( System.out);
 
      Preferences node = prefs.node("/myApp");
      int ival  = node.getInt("extraOne", 0);
      assert ival == 1 : "testChain fail 1 " + ival;
 
      ival  = node.getInt("extraTwo", 0);
      assert ival == 2 : "testChain fail 1 " + ival;
 
      double dval  = node.getDouble("TestDouble", 0.0);
      assert Misc.closeEnough(dval, 3.14159) : "testChain fail 2 " + dval;
 
      node.putDouble("TestDouble", 3.14159);
      node.putDouble("TestFloat", -999.0);
      node.putInt("extraTwo", 2);
      //prefs.exportSubtree( System.out); 
      store.save();
 
      // things only get written to top store 
      store = XMLStore.createFromFile(chain2File, null);