All pastes #488858 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-05-15 06:30 UTC
rendered paste body
while(scan.hasNextLine()){
            String line = scan.nextLine();
            if(opts.echo && opts.silent == false){
               out.println(" * " + line);
            }
            String[] words = line.split("\\s+");
            if(words.length != 2){
                syslib.warn("bad line");
            }else{
                String key1 = words[0];
                String key2 = words[1];
                int index1 = 0;
                int index2 = 0;
                int totalfactor1= 1;
                int totalfactor2 = 1;
                String baseunit1 = key1;
                String baseunit2 = key2;
                boolean  indexcheck = false;
                unitmap.unit myunit;
                while((myunit = map.get(baseunit1)) != null){

                    if(opts.tableconvert){
                        out.printf("%s =" + opts.format + "%s%n", baseunit1,
                                    myunit.factor, myunit.baseunit);
                    }
                    totalfactor1 *= myunit.factor;
                    baseunit1 = myunit.baseunit;
                    index1 ++;
                    if(index1 == 32){
                       indexcheck = true;
                       break;
                    }
                }
                if(indexcheck == true){
                    syslib.warn("circular definition");
                    continue;
                }
                while ((myunit = map.get(baseunit2))!= null){
                    if(opts.tableconvert){
                        out.printf("junits debug: %s =" + opts.format + "%s%n", baseunit2,
                                   myunit.factor, myunit.baseunit);
                    }
                    totalfactor2 *= myunit.factor;
                    baseunit2 = myunit.baseunit;
                    index2++;
                    if(index2 == 32){
                        indexcheck = true;
                        break;
                    }
                }
                    if(indexcheck == true){
                       syslib.warn("circular definition");
                       continue;
                    }