コード例 #1
0
 /**
  * Converts the molarity to the desired unit.
  *
  * @param before The molarity in mol/L
  * @return The molarity in the desired unit.
  */
 public double getMolarity(double before) {
   double after = molarity.getBlankAmount(before);
   if (after != before)
     steps.add(
         Function.latex(
             before
                 + " \\{mol}{L} = "
                 + after
                 + "\\frac{"
                 + molarity.getUnitName()
                 + "}{"
                 + molarity.getUnit2Name()
                 + "}"));
   return after;
 }
コード例 #2
0
 /**
  * Returns the value in the volume field, or Units.UNKNOWN_VALUE if blank.
  *
  * @return The entered volume.
  */
 public double getVolume() {
   double amount = volume.getAmount();
   if (amount == Units.UNKNOWN_VALUE)
     steps.add(Function.latex("\\text{" + name + " volume} =  ?"));
   else steps.add(Function.latex("\\text{" + name + " volume} = " + amount + " L"));
   return amount;
 }
コード例 #3
0
 /**
  * Returns the value in the molarity field, or Units.UNKNOWN_VALUE if blank.
  *
  * @return The entered molarity.
  */
 public double getMolarity() {
   double amount = molarity.getAmount();
   if (amount == Units.UNKNOWN_VALUE)
     steps.add(Function.latex("\\text{" + name + " molarity} =  ?"));
   else
     steps.add(Function.latex("\\text{" + name + " molarity} = " + amount + "\\frac{mol}{L}"));
   return amount;
 }
コード例 #4
0
 /**
  * Returns the smallest number of sig figs in these fields.
  *
  * @return The sig fig number to use.
  */
 public int getSigFigs() {
   int sigFigs1 = volume.getSigFigs(), sigFigs2 = molarity.getSigFigs();
   return sigFigs1 == -1 ? sigFigs2 : sigFigs2 == -1 ? sigFigs1 : Math.min(sigFigs2, sigFigs1);
 }
コード例 #5
0
 /**
  * Converts the volume to the desired unit.
  *
  * @param before The volume in L
  * @return The volume in the desired unit.
  */
 public double getVolume(double before) {
   double after = volume.getBlankAmount(before);
   unit = volume.getUnitName();
   if (after != before) steps.add(Function.latex(before + " L = " + after + " " + unit));
   return after;
 }
コード例 #6
0
 /**
  * Sets the value of the volume enter field.
  *
  * @param amount The value to set.
  */
 public void setVolume(double amount) {
   volume.setAmount(amount);
 }
コード例 #7
0
 /**
  * Sets the value of the molarity enter field.
  *
  * @param amount The value to set.
  */
 public void setMolarity(double amount) {
   molarity.setAmount(amount);
 }