MCPcopy Create free account
hub / github.com/dumbledore/AlbiteREADER / convertUnits

Method convertUnits

src/org/albite/albite/AlbiteMIDlet.java:2350–2371  ·  view source on GitHub ↗

Performs an action assigned to the convertUnits entry-point.

()

Source from the content-addressed store, hash-verified

2348 * Performs an action assigned to the convertUnits entry-point.
2349 */
2350 public void convertUnits() {//GEN-END:|683-entry|0|684-preAction
2351 // write pre-action user code here
2352
2353 /*
2354 * Converting units
2355 */
2356 UnitGroup group = UnitGroup.GROUPS[unitGroups.getSelectedIndex()];
2357 Unit[] units = group.units;
2358 Unit unitFrom = group.units[this.unitFrom.getSelectedIndex()];
2359 Unit unitTo = group.units[this.unitTo.getSelectedIndex()];
2360
2361 double quantityFrom =
2362 Double.parseDouble(numberBox.getString());
2363 double quantityTo = round(Unit.convert(quantityFrom, unitFrom, unitTo));
2364
2365 getResultFromQuantity().setText(Double.toString(quantityFrom));
2366 getResultFromUnit().setText(unitFrom.name);
2367 getResultToQuantity().setText(Double.toString(quantityTo));
2368 getResultToUnit().setText(unitTo.name);
2369 switchDisplayable(null, getConversionResult());//GEN-LINE:|683-entry|1|684-postAction
2370 // write post-action user code here
2371 }//GEN-BEGIN:|683-entry|2|
2372 //</editor-fold>//GEN-END:|683-entry|2|
2373
2374 //<editor-fold defaultstate="collapsed" desc=" Generated Getter: RESTART_COMMAND ">//GEN-BEGIN:|695-getter|0|695-preInit

Callers 1

commandActionMethod · 0.95

Calls 10

roundMethod · 0.95
convertMethod · 0.95
getResultFromQuantityMethod · 0.95
getResultFromUnitMethod · 0.95
getResultToQuantityMethod · 0.95
getResultToUnitMethod · 0.95
switchDisplayableMethod · 0.95
getConversionResultMethod · 0.95
toStringMethod · 0.80
setTextMethod · 0.45

Tested by

no test coverage detected