Class ReactionBalancer

java.lang.Object
org.episteme.natural.chemistry.ReactionBalancer

public class ReactionBalancer extends Object
Utility for balancing chemical equations.
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Details

    • balance

      public static ChemicalReaction balance(String equation)
      Balances a chemical equation string. Example: "H2 + O2 = H2O" -> "2H2 + O2 -> 2H2O"
      Parameters:
      equation - The unbalanced reaction equation.
      Returns:
      A balanced ChemicalReaction object.
    • balance

      public static Map<String,Integer> balance(List<String> compounds, List<Boolean> isProduct)
      Balances coefficients for a given set of reactants and products.
      Parameters:
      compounds - List of all compound formulas involved. Reactants first, then Products.
      isProduct - Boolean array corresponding to compounds.
      Returns:
      Map of Compound -> Coefficient