Example #1
0
 @Override
 public void setParms(String newParm) {
   super.setParms(newParm);
   rates.clear();
   cut = 0.05;
   spaceMaxCut = 0.0;
   spaceMaxDistance = SpaceObject.Distance.GalaxyRadius.dm;
   newParm = newParm.toUpperCase();
   int x = newParm.indexOf('=');
   while (x > 0) {
     int lastSp = newParm.lastIndexOf(' ', x);
     if (lastSp < 0) lastSp = 0;
     if ((lastSp >= 0) && (lastSp < x - 1) && (Character.isLetter(newParm.charAt(x - 1)))) {
       String parm = newParm.substring(lastSp, x).trim().toUpperCase();
       while ((x < newParm.length()) && (newParm.charAt(x) != '=')) x++;
       if (x < newParm.length()) {
         while ((x < newParm.length())
             && (!Character.isDigit(newParm.charAt(x)))
             && (newParm.charAt(x) != '.')) x++;
         if (x < newParm.length()) {
           newParm = newParm.substring(x);
           x = 0;
           while ((x < newParm.length())
               && ((Character.isDigit(newParm.charAt(x))) || (newParm.charAt(x) == '.'))) x++;
           double val = CMath.s_double(newParm.substring(0, x));
           if (newParm.substring(0, x).indexOf('.') < 0)
             val = CMath.s_long(newParm.substring(0, x));
           if (x < newParm.length()) newParm = newParm.substring(x + 1);
           else newParm = "";
           if (parm.equalsIgnoreCase("default")) parm = "";
           if (parm.equalsIgnoreCase("spacemaxcut")) spaceMaxCut = val / 100.0;
           else if (parm.equalsIgnoreCase("spacemaxdistance"))
             spaceMaxDistance =
                 Math.round(CMath.mul(SpaceObject.Distance.GalaxyRadius.dm, val / 100.0));
           else if (parm.equalsIgnoreCase("cut")) cut = val / 100.0;
           else rates.put(parm, Double.valueOf(val / 100.0));
         }
       }
     }
     x = newParm.indexOf('=');
   }
 }