Commits

gigadot committed 3ad239f

nasa7 can now be exported to xml

  • Participants
  • Parent commits 253e6c8

Comments (0)

Files changed (12)

File model/src/main/java/gigadot/chom/model/Brownie.java

 package gigadot.chom.model;
 
+import gigadot.chom.model.brownie.Atom;
+import gigadot.chom.model.brownie.Identifier;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlTransient;
 import org.hibernate.annotations.GenericGenerator;
 
 @Inheritance(strategy = InheritanceType.JOINED)
 @XmlTransient
 @XmlAccessorType(XmlAccessType.NONE)
+@XmlSeeAlso({Cookie.class, Atom.class, Identifier.class})
 public abstract class Brownie {
 
     private String id = null;

File model/src/main/java/gigadot/chom/model/Cookie.java

 package gigadot.chom.model;
 
+import gigadot.chom.model.cookie.EnthalpyOfFormation;
+import gigadot.chom.model.cookie.NASA7;
+import gigadot.chom.model.cookie.Species;
+import gigadot.chom.model.cookie.Thermochemistry;
 import java.util.HashSet;
 import java.util.Set;
 import javax.persistence.CascadeType;
 import javax.persistence.JoinColumn;
 import javax.persistence.JoinTable;
 import javax.persistence.OneToMany;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlTransient;
 
 /**
 @Entity
 @Inheritance(strategy = InheritanceType.JOINED)
 @XmlTransient
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlSeeAlso({NASA7.class, EnthalpyOfFormation.class, Species.class, Thermochemistry.class})
 public abstract class Cookie extends Brownie {
 
     private Set<FileObject> fileObjects = new HashSet<FileObject>();

File model/src/main/java/gigadot/chom/model/cookie/EnthalpyOfFormation.java

 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.eclipse.persistence.oxm.annotations.XmlPath;
 
 /**
  *

File model/src/main/java/gigadot/chom/model/cookie/NASA7.java

 package gigadot.chom.model.cookie;
 
+import gigadot.chom.model.internal.jaxb.BasicProperty;
+import gigadot.chom.model.internal.jaxb.Coefficients;
+import gigadot.chom.model.internal.jaxb.CoefficientsAdaptor;
+import gigadot.chom.model.internal.jaxb.PropertyAdaptors;
 import java.text.DecimalFormat;
+import java.util.Arrays;
+import java.util.List;
 import java.util.regex.Pattern;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Transient;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.apache.commons.lang.ArrayUtils;
+import org.eclipse.persistence.oxm.annotations.XmlPath;
 
 /**
  *
  * @author Weerapong Phadungsuakanan
  */
 @Entity
+@XmlAccessorType(XmlAccessType.NONE)
 public class NASA7 extends Thermochemistry {
 
     private static final int n_poly = 7;
     private double[] a_high = new double[n_poly];
     private int polynomialCount = 2;
 
-    /**
-     * Default constructor of 7-term
-     * <code>NASAPolynomial</code>.
-     */
-    public NASA7() {
-    }
-
     @Transient
     public double[] getA_high() {
         return a_high;
         this.a_low = a_low;
     }
 
-    protected double getAl_1() {
-        return a_low[0];
-    }
-
-    protected void setAl_1(double al_1) {
-        this.a_low[0] = al_1;
-    }
-
-    protected double getAl_2() {
-        return a_low[1];
-    }
-
-    protected void setAl_2(double al_2) {
-        this.a_low[1] = al_2;
-    }
-
-    protected double getAl_3() {
-        return a_low[2];
-    }
-
-    protected void setAl_3(double al_3) {
-        this.a_low[2] = al_3;
-    }
-
-    protected double getAl_4() {
-        return a_low[3];
-    }
-
-    protected void setAl_4(double al_4) {
-        this.a_low[3] = al_4;
-    }
-
-    protected double getAl_5() {
-        return a_low[4];
-    }
-
-    protected void setAl_5(double al_5) {
-        this.a_low[4] = al_5;
-    }
-
-    protected double getAl_6() {
-        return a_low[5];
-    }
-
-    protected void setAl_6(double al_6) {
-        this.a_low[5] = al_6;
-    }
-
-    protected double getAl_7() {
-        return a_low[6];
-    }
-
-    protected void setAl_7(double al_7) {
-        this.a_low[6] = al_7;
-    }
-
-    protected double getAh_1() {
-        return a_high[0];
-    }
-
-    protected void setAh_1(double ah_1) {
-        this.a_high[0] = ah_1;
-    }
-
-    protected double getAh_2() {
-        return a_high[1];
-    }
-
-    protected void setAh_2(double ah_2) {
-        this.a_high[1] = ah_2;
-    }
-
-    protected double getAh_3() {
-        return a_high[2];
-    }
-
-    protected void setAh_3(double ah_3) {
-        this.a_high[2] = ah_3;
-    }
-
-    protected double getAh_4() {
-        return a_high[3];
-    }
-
-    protected void setAh_4(double ah_4) {
-        this.a_high[3] = ah_4;
-    }
-
-    protected double getAh_5() {
-        return a_high[4];
-    }
-
-    protected void setAh_5(double ah_5) {
-        this.a_high[4] = ah_5;
-    }
-
-    protected double getAh_6() {
-        return a_high[5];
-    }
-
-    protected void setAh_6(double ah_6) {
-        this.a_high[5] = ah_6;
-    }
-
-    protected double getAh_7() {
-        return a_high[6];
-    }
-
-    protected void setAh_7(double ah_7) {
-        this.a_high[6] = ah_7;
-    }
-
     /**
-     * Get pointer to the coefficient array depending on temperature range. if T equals T_mid, the upper
-     * coefficients are returned.
+     * Get pointer to the coefficient array depending on temperature range. if T equals T_mid, the upper coefficients
+     * are returned.
+     *
      * @param T Temperature (K)
      * @return Coefficient array depending on temperature range.
      */
     }
 
     @Column(name = "polynomial_count")
+    @XmlPath("nasaPolynomials[@type='nasa7']/@count")
     public int getPolynomialCount() {
         return polynomialCount;
     }
      * @return
      */
     @Column(name = "T_min")
+    @XmlPath("nasaPolynomials[@type='nasa7']/Tmin/")
+    @XmlJavaTypeAdapter(value = PropertyAdaptors.TemperaturePropertyAdaptor.class, type = BasicProperty.class)
     public double getTemperatureLowerBound() {
         return T_min;
     }
      * @return
      */
     @Column(name = "T_mid")
+    @XmlPath("nasaPolynomials[@type='nasa7']/Tmid/")
+    @XmlJavaTypeAdapter(value = PropertyAdaptors.TemperaturePropertyAdaptor.class, type = BasicProperty.class)
     public double getTemperatureMidPoint() {
         return T_mid;
     }
      * @return
      */
     @Column(name = "T_max")
+    @XmlPath("nasaPolynomials[@type='nasa7']/Tmax/")
+    @XmlJavaTypeAdapter(value = PropertyAdaptors.TemperaturePropertyAdaptor.class, type = BasicProperty.class)
     public double getTemperatureUpperBound() {
         return T_max;
     }
     }
 
     /**
-     * Copy constructor of
-     * <code>NASAPolynomial</code>
-     *
-     * @param nasa7 <code>NASAPolynomial</code> object to be copied.
-     */
-    public NASA7(NASA7 nasa7) {
-        this.T_max = nasa7.T_max;
-        this.T_mid = nasa7.T_mid;
-        this.T_min = nasa7.T_min;
-        System.arraycopy(nasa7.a_low, 0, this.a_low, 0, n_poly);
-        System.arraycopy(nasa7.a_high, 0, this.a_high, 0, n_poly);
-    }
-
-    /**
      * Get number of coefficients
      *
      * @return integer number of coefficients.
     private static String formatTemperature(double T) {
         return dfTemp.format(T);
     }
+
+    /*
+     * ================================================================================
+     * WARNING: The getter and setter methods below here are to be used by JPA only.
+     *
+     * They should be modified if there are changes to the fields of this class.
+     * ================================================================================
+     */
+    protected double getAl_1() {
+        return a_low[0];
+    }
+
+    protected void setAl_1(double al_1) {
+        this.a_low[0] = al_1;
+    }
+
+    protected double getAl_2() {
+        return a_low[1];
+    }
+
+    protected void setAl_2(double al_2) {
+        this.a_low[1] = al_2;
+    }
+
+    protected double getAl_3() {
+        return a_low[2];
+    }
+
+    protected void setAl_3(double al_3) {
+        this.a_low[2] = al_3;
+    }
+
+    protected double getAl_4() {
+        return a_low[3];
+    }
+
+    protected void setAl_4(double al_4) {
+        this.a_low[3] = al_4;
+    }
+
+    protected double getAl_5() {
+        return a_low[4];
+    }
+
+    protected void setAl_5(double al_5) {
+        this.a_low[4] = al_5;
+    }
+
+    protected double getAl_6() {
+        return a_low[5];
+    }
+
+    protected void setAl_6(double al_6) {
+        this.a_low[5] = al_6;
+    }
+
+    protected double getAl_7() {
+        return a_low[6];
+    }
+
+    protected void setAl_7(double al_7) {
+        this.a_low[6] = al_7;
+    }
+
+    protected double getAh_1() {
+        return a_high[0];
+    }
+
+    protected void setAh_1(double ah_1) {
+        this.a_high[0] = ah_1;
+    }
+
+    protected double getAh_2() {
+        return a_high[1];
+    }
+
+    protected void setAh_2(double ah_2) {
+        this.a_high[1] = ah_2;
+    }
+
+    protected double getAh_3() {
+        return a_high[2];
+    }
+
+    protected void setAh_3(double ah_3) {
+        this.a_high[2] = ah_3;
+    }
+
+    protected double getAh_4() {
+        return a_high[3];
+    }
+
+    protected void setAh_4(double ah_4) {
+        this.a_high[3] = ah_4;
+    }
+
+    protected double getAh_5() {
+        return a_high[4];
+    }
+
+    protected void setAh_5(double ah_5) {
+        this.a_high[4] = ah_5;
+    }
+
+    protected double getAh_6() {
+        return a_high[5];
+    }
+
+    protected void setAh_6(double ah_6) {
+        this.a_high[5] = ah_6;
+    }
+
+    protected double getAh_7() {
+        return a_high[6];
+    }
+
+    protected void setAh_7(double ah_7) {
+        this.a_high[6] = ah_7;
+    }
+    /*
+     * ================================================================================
+     * WARNING: The getter and setter methods below here are to be used by JAXB only.
+     *
+     * They should be modified if there are changes to the fields of this class.
+     * ================================================================================
+     */
+
+    @Transient
+    @XmlPath("nasaPolynomials[@type='nasa7']/coefficients[@range='upper']/")
+    @XmlJavaTypeAdapter(value = CoefficientsAdaptor.class, type = Coefficients.class)
+    protected List<Double> getCoeffsAHigh() {
+        if (polynomialCount == 1) {
+            return null;
+        } else if (polynomialCount == 2) {
+            return Arrays.asList(ArrayUtils.toObject(a_high));
+        } else {
+            throw new RuntimeException("Number of coffiecient count cannot exceed 2 [" + polynomialCount + " were found].");
+        }
+    }
+
+    protected void seCoeffstAHigh(List<Double> a_high) {
+        if (a_high.size() != n_poly) {
+            throw new RuntimeException("NASA polynomials require 7 coefficients but " + a_high.size() + " are found.");
+        }
+        System.arraycopy(ArrayUtils.toPrimitive(a_high.toArray(new Double[n_poly])), 0, this.a_high, 0, n_poly);
+    }
+
+    @Transient
+    @XmlPath("nasaPolynomials[@type='nasa7']/coefficients[@range='lower']/")
+    @XmlJavaTypeAdapter(value = CoefficientsAdaptor.class, type = Coefficients.class)
+    protected List<Double> getCoeffsALow() {
+        return Arrays.asList(ArrayUtils.toObject(a_low));
+    }
+
+    protected void setCoeffsALow(List<Double> a_low) {
+        if (a_low.size() != n_poly) {
+            throw new RuntimeException("NASA polynomials require 7 coefficients but " + a_low.size() + " are found.");
+        }
+        System.arraycopy(ArrayUtils.toPrimitive(a_low.toArray(new Double[n_poly])), 0, this.a_low, 0, n_poly);
+    }
 }

File model/src/main/java/gigadot/chom/model/cookie/Species.java

 import gigadot.chom.model.Cookie;
 import gigadot.chom.model.brownie.Atom;
 import gigadot.chom.model.brownie.Identifier;
-import gigadot.chom.model.internal.jaxb.BasicProperty;
-import gigadot.chom.model.internal.jaxb.PropertyAdaptors;
 import gigadot.chom.model.util.ModelUtils;
-import gigadot.chom.model.util.MolDocNamespaceConstants;
 import java.util.ArrayList;
 import java.util.List;
 import javax.persistence.CascadeType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
 /**
  *

File model/src/main/java/gigadot/chom/model/cookie/Thermochemistry.java

 
 import gigadot.chom.model.Cookie;
 import gigadot.chom.model.enumeration.Phase;
-import gigadot.chom.model.util.MolDocNamespaceConstants;
 import javax.persistence.Entity;
 import javax.persistence.EnumType;
 import javax.persistence.Enumerated;
-import javax.persistence.Transient;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlTransient;
 
 /**
  *
  * @author wp214
  */
 @Entity
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlSeeAlso({NASA7.class})
 public abstract class Thermochemistry extends Cookie {
 
     private Phase phase = Phase.Unknown;
      *
      * @return the value of name
      */
+    @XmlElement
     public String getName() {
         return name;
     }
     }
 
     @Enumerated(EnumType.ORDINAL)
+    @XmlElement
     public Phase getPhase() {
         return phase;
     }

File model/src/main/java/gigadot/chom/model/internal/jaxb/Coefficients.java

+package gigadot.chom.model.internal.jaxb;
+
+import java.util.Arrays;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.commons.lang.ArrayUtils;
+
+/**
+ *
+ * @author wp214
+ */
+@XmlRootElement
+@XmlType(name = "coefficients")
+//@XmlAccessorType(XmlAccessType.)
+public class Coefficients {
+
+    private double[] a = new double[7];
+
+    public Coefficients(List<Double> values) {
+        for (int i = 0; i < values.size(); i++) {
+            a[i] = values.get(i);
+        }
+    }
+
+    public Coefficients(double[] values) {
+        System.arraycopy(values, 0, a, 0, 7);
+    }
+
+    public List<Double> toDoubleList() {
+        return Arrays.asList(ArrayUtils.toObject(a));
+    }
+
+    public double getA1() {
+        return a[0];
+    }
+
+    public Coefficients() {
+    }
+
+    public void setA1(double a1) {
+        this.a[0] = a1;
+    }
+
+    public double getA2() {
+        return a[1];
+    }
+
+    public void setA2(double a2) {
+        this.a[1] = a2;
+    }
+
+    public double getA3() {
+        return a[2];
+    }
+
+    public void setA3(double a3) {
+        this.a[2] = a3;
+    }
+
+    public double getA4() {
+        return a[3];
+    }
+
+    public void setA4(double a4) {
+        this.a[3] = a4;
+    }
+
+    public double getA5() {
+        return a[4];
+    }
+
+    public void setA5(double a5) {
+        this.a[4] = a5;
+    }
+
+    public double getA6() {
+        return a[5];
+    }
+
+    public void setA6(double a6) {
+        this.a[5] = a6;
+    }
+
+    public double getA7() {
+        return a[6];
+    }
+
+    public void setA7(double a7) {
+        this.a[6] = a7;
+    }
+}

File model/src/main/java/gigadot/chom/model/internal/jaxb/CoefficientsAdaptor.java

+package gigadot.chom.model.internal.jaxb;
+
+import java.util.List;
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+public class CoefficientsAdaptor extends XmlAdapter<Coefficients, List<Double>> {
+
+    @Override
+    public List<Double> unmarshal(Coefficients v) throws Exception {
+        return v.toDoubleList();
+    }
+
+    @Override
+    public Coefficients marshal(List<Double> v) throws Exception {
+        if (v != null) {
+            return new Coefficients(v);
+        } else {
+            return null;
+        }
+    }
+}

File model/src/main/java/gigadot/chom/model/jaxb/MolDocPersistenceManager.java

  */
 package gigadot.chom.model.jaxb;
 
+import gigadot.chom.model.Brownie;
+import gigadot.chom.model.Cookie;
 import gigadot.chom.model.brownie.Atom;
 import gigadot.chom.model.cookie.EnthalpyOfFormation;
 import gigadot.chom.model.cookie.Species;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
-import javax.xml.stream.XMLStreamException;
 import org.eclipse.persistence.jaxb.JAXBContextProperties;
 
 /**
  */
 public class MolDocPersistenceManager {
 
-    private static final Class[] knownJAXBClasses = {Atom.class, Species.class, EnthalpyOfFormation.class, IdentifierType.class};
+    private static final Class[] knownJAXBClasses = {Brownie.class, Cookie.class};
     private MolDocBinderScanner binderScanner = new MolDocBinderScanner();
     // these are not to be accessed internally directly. use jaxbContext(), marshaller() and unmarshaller() instead.
     private JAXBContext jaxbContext = null;

File model/src/test/java/gigadot/chom/model/jaxb/MolDocPersistenceManagerTest.java

 import gigadot.chom.model.brownie.Atom;
 import gigadot.chom.model.brownie.Identifier;
 import gigadot.chom.model.cookie.EnthalpyOfFormation;
+import gigadot.chom.model.cookie.NASA7;
 import gigadot.chom.model.cookie.Species;
 import gigadot.chom.model.enumeration.IdentifierType;
 import gigatools.lite.constant.PhysicalConstants;
  */
 public class MolDocPersistenceManagerTest {
 
-    /**
-     * Test of generateSchema method, of class MolDocPersistenceManager.
-     */
     @Test
+    @Ignore
     public void testGenerateSchema() {
         File directory = new File("target");
         MolDocPersistenceManager molDocPersistenceManager = new MolDocPersistenceManager();
     }
 
     @Test
+    @Ignore
     public void marshalAtom() {
         Atom carbon = new Atom("C");
         MolDocPersistenceManager molDocPersistenceManager = new MolDocPersistenceManager();
             fail();
         }
     }
+    private NASA7 createNASA7Ref1() {
+        NASA7 nasa = new NASA7();
+        nasa.setAHigh(0, 0.47238333E+00);
+        nasa.setALow(0, 0.38717898E+01);
+        nasa.setAHigh(1, 0.12680758E-01);
+        nasa.setALow(1, -0.42480466E-02);
+        nasa.setAHigh(2, -0.55093741E-05);
+        nasa.setALow(2, 0.24540181E-04);
+        nasa.setAHigh(3, 0.11295575E-08);
+        nasa.setALow(3, -0.21780766E-07);
+        nasa.setAHigh(4, -0.89103779E-13);
+        nasa.setALow(4, 0.63010622E-11);
+        nasa.setAHigh(5, -0.96424500E+04);
+        nasa.setALow(5, -0.10144425E+05);
+        nasa.setAHigh(6, 0.16199090E+02);
+        nasa.setALow(6, 0.66008135E+00);
+        return nasa;
+    }
+
+    @Test
+    public void marshalNASA7() throws JAXBException {
+        NASA7 nasa7 = createNASA7Ref1();
+        nasa7.setPolynomialCount(2);
+        MolDocPersistenceManager molDocPersistenceManager = new MolDocPersistenceManager();
+        molDocPersistenceManager.setRules(XmlTransientRules.STANDARD);
+        try {
+            molDocPersistenceManager.marshal(nasa7, System.out);
+        } catch (MolDocPersistenceException ex) {
+            ex.printStackTrace();
+            fail();
+        }
+
+    }
 
     @Test
     @Ignore

File thermo/src/test/java/gigadot/chom/thermo/calculator/NASA7ThermoCalculatorTest.java

  */
 public class NASA7ThermoCalculatorTest extends AbstractUnitTest {
 
+    private NASA7 createNASA7Ref1() {
+        NASA7 nasa = new NASA7();
+        nasa.setAHigh(0, 0.47238333E+00);
+        nasa.setALow(0, 0.38717898E+01);
+        nasa.setAHigh(1, 0.12680758E-01);
+        nasa.setALow(1, -0.42480466E-02);
+        nasa.setAHigh(2, -0.55093741E-05);
+        nasa.setALow(2, 0.24540181E-04);
+        nasa.setAHigh(3, 0.11295575E-08);
+        nasa.setALow(3, -0.21780766E-07);
+        nasa.setAHigh(4, -0.89103779E-13);
+        nasa.setALow(4, 0.63010622E-11);
+        nasa.setAHigh(5, -0.96424500E+04);
+        nasa.setALow(5, -0.10144425E+05);
+        nasa.setAHigh(6, 0.16199090E+02);
+        nasa.setALow(6, 0.66008135E+00);
+        return nasa;
+    }
+
     /**
      * Test of getThermochemistry method, of class NASAPolynomial.
      */
     @Test
     public void testCalculation() {
-        NASA7 nasa = new NASA7();
-        nasa.setAHigh(0,  0.47238333E+00); nasa.setALow(0,  0.38717898E+01);
-        nasa.setAHigh(1,  0.12680758E-01); nasa.setALow(1, -0.42480466E-02);
-        nasa.setAHigh(2, -0.55093741E-05); nasa.setALow(2,  0.24540181E-04);
-        nasa.setAHigh(3,  0.11295575E-08); nasa.setALow(3, -0.21780766E-07);
-        nasa.setAHigh(4, -0.89103779E-13); nasa.setALow(4,  0.63010622E-11);
-        nasa.setAHigh(5, -0.96424500E+04); nasa.setALow(5, -0.10144425E+05);
-        nasa.setAHigh(6,  0.16199090E+02); nasa.setALow(6,  0.66008135E+00);
         printTestTitle("getThermochemistry");
-        NASA7 nasa_t = new NASA7(nasa);
-        ThermoState thermo = null;
+        NASA7 nasa_t = createNASA7Ref1();
 
         logger.info("Setting up O2 thermochemistry");
         //O2_3SIG-          110203O   2    0    0    0G   300.000  4000.000 1000.00    0 1
         //-0.55926514E-08 0.15414997E-11-0.10573216E+04 0.36633473E+01                   4
         //nasa.setTemperatureLowerBound(300);
         nasa_t.setTemperatureLowerBound(300);
-        nasa_t.setAHigh(0,  0.30715933E+01); nasa_t.setALow(0,  0.37508882E+01);
-        nasa_t.setAHigh(1,  0.16557108E-02); nasa_t.setALow(1, -0.23577033E-02);
-        nasa_t.setAHigh(2, -0.79202103E-06); nasa_t.setALow(2,  0.67528791E-05);
-        nasa_t.setAHigh(3,  0.17408653E-09); nasa_t.setALow(3, -0.55926514E-08);
-        nasa_t.setAHigh(4, -0.14457201E-13); nasa_t.setALow(4,  0.15414997E-11);
-        nasa_t.setAHigh(5, -0.10002600E+04); nasa_t.setALow(5, -0.10573216E+04);
-        nasa_t.setAHigh(6,  0.65815300E+01); nasa_t.setALow(6,  0.36633473E+01);
+        nasa_t.setAHigh(0, 0.30715933E+01);
+        nasa_t.setALow(0, 0.37508882E+01);
+        nasa_t.setAHigh(1, 0.16557108E-02);
+        nasa_t.setALow(1, -0.23577033E-02);
+        nasa_t.setAHigh(2, -0.79202103E-06);
+        nasa_t.setALow(2, 0.67528791E-05);
+        nasa_t.setAHigh(3, 0.17408653E-09);
+        nasa_t.setALow(3, -0.55926514E-08);
+        nasa_t.setAHigh(4, -0.14457201E-13);
+        nasa_t.setALow(4, 0.15414997E-11);
+        nasa_t.setAHigh(5, -0.10002600E+04);
+        nasa_t.setALow(5, -0.10573216E+04);
+        nasa_t.setAHigh(6, 0.65815300E+01);
+        nasa_t.setALow(6, 0.36633473E+01);
 
         logger.info("Testing getting O2 thermochemistries at the boundaries...");
         NASA7ThermoCalculator nasa7Cal_t = new NASA7ThermoCalculator(nasa_t);
-        thermo = nasa7Cal_t.getThermoState(nasa_t.getTemperatureLowerBound());
+        ThermoState thermo = nasa7Cal_t.getThermoState(nasa_t.getTemperatureLowerBound());
         assertNotNull(thermo);
-            assertEquals(204.59384465465334, thermo.S, 0.0001);
-            assertEquals(20.89278047837479, thermo.Cv, 0.0001);
-            assertEquals(29.20725309826836, thermo.Cp, 0.0001);
-            assertEquals(8.891245699557114*1000, thermo.delta_H, 0.1);
-            assertEquals(0.10017420593504998*1000, thermo.H, 0.1);
-            assertEquals(-61.277979190460954*1000, thermo.G, 0.1);
+        assertEquals(204.59384465465334, thermo.S, 0.0001);
+        assertEquals(20.89278047837479, thermo.Cv, 0.0001);
+        assertEquals(29.20725309826836, thermo.Cp, 0.0001);
+        assertEquals(8.891245699557114 * 1000, thermo.delta_H, 0.1);
+        assertEquals(0.10017420593504998 * 1000, thermo.H, 0.1);
+        assertEquals(-61.277979190460954 * 1000, thermo.G, 0.1);
         thermo = nasa7Cal_t.getThermoState(nasa_t.getTemperatureMidPoint());
         assertNotNull(thermo);
-            assertEquals(242.06306322213047, thermo.S, 0.0001);
-            assertEquals(25.732564402454628, thermo.Cv, 0.0001);
-            assertEquals(34.0470370223482, thermo.Cp, 0.0001);
-            assertEquals(31.039036124991297*1000, thermo.delta_H, 0.1);
-            assertEquals(22.247964631369232*1000, thermo.H, 0.1);
-            assertEquals(-219.81509859076124*1000, thermo.G, 0.1);
+        assertEquals(242.06306322213047, thermo.S, 0.0001);
+        assertEquals(25.732564402454628, thermo.Cv, 0.0001);
+        assertEquals(34.0470370223482, thermo.Cp, 0.0001);
+        assertEquals(31.039036124991297 * 1000, thermo.delta_H, 0.1);
+        assertEquals(22.247964631369232 * 1000, thermo.H, 0.1);
+        assertEquals(-219.81509859076124 * 1000, thermo.G, 0.1);
         thermo = nasa7Cal_t.getThermoState(nasa_t.getTemperatureUpperBound());
         assertNotNull(thermo);
-            assertEquals(292.1101829558573, thermo.S, 0.0001);
-            assertEquals(28.7896470310125, thermo.Cv, 0.0001);
-            assertEquals(37.10411965090607, thermo.Cp, 0.0001);
-            assertEquals(140.2932203892075*1000, thermo.delta_H, 0.1);
-            assertEquals(131.50214889558544*1000, thermo.H, 0.1);
-            assertEquals(-1036.9385829278438*1000, thermo.G, 0.1);
+        assertEquals(292.1101829558573, thermo.S, 0.0001);
+        assertEquals(28.7896470310125, thermo.Cv, 0.0001);
+        assertEquals(37.10411965090607, thermo.Cp, 0.0001);
+        assertEquals(140.2932203892075 * 1000, thermo.delta_H, 0.1);
+        assertEquals(131.50214889558544 * 1000, thermo.H, 0.1);
+        assertEquals(-1036.9385829278438 * 1000, thermo.G, 0.1);
 
         logger.info("Setting up CH4 thermochemistry");
         //CH4               110203H   4C   1    0    0G   300.000  4000.000 1000.00    0 1
         //-0.96424500E+04 0.16199090E+02 0.38717898E+01-0.42480466E-02 0.24540181E-04    3
         //-0.21780766E-07 0.63010622E-11-0.10144425E+05 0.66008135E+00                   4
         nasa_t.setTemperatureLowerBound(300);
-        nasa_t.setAHigh(0,  0.47238333E+00); nasa_t.setALow(0,  0.38717898E+01);
-        nasa_t.setAHigh(1,  0.12680758E-01); nasa_t.setALow(1, -0.42480466E-02);
-        nasa_t.setAHigh(2, -0.55093741E-05); nasa_t.setALow(2,  0.24540181E-04);
-        nasa_t.setAHigh(3,  0.11295575E-08); nasa_t.setALow(3, -0.21780766E-07);
-        nasa_t.setAHigh(4, -0.89103779E-13); nasa_t.setALow(4,  0.63010622E-11);
-        nasa_t.setAHigh(5, -0.96424500E+04); nasa_t.setALow(5, -0.10144425E+05);
-        nasa_t.setAHigh(6,  0.16199090E+02); nasa_t.setALow(6,  0.66008135E+00);
+        nasa_t.setAHigh(0, 0.47238333E+00);
+        nasa_t.setALow(0, 0.38717898E+01);
+        nasa_t.setAHigh(1, 0.12680758E-01);
+        nasa_t.setALow(1, -0.42480466E-02);
+        nasa_t.setAHigh(2, -0.55093741E-05);
+        nasa_t.setALow(2, 0.24540181E-04);
+        nasa_t.setAHigh(3, 0.11295575E-08);
+        nasa_t.setALow(3, -0.21780766E-07);
+        nasa_t.setAHigh(4, -0.89103779E-13);
+        nasa_t.setALow(4, 0.63010622E-11);
+        nasa_t.setAHigh(5, -0.96424500E+04);
+        nasa_t.setALow(5, -0.10144425E+05);
+        nasa_t.setAHigh(6, 0.16199090E+02);
+        nasa_t.setALow(6, 0.66008135E+00);
 
         logger.info("Testing getting CH4 thermochemistries at the boundaries...");
         thermo = nasa7Cal_t.getThermoState(300);
         assertNotNull(thermo);
-            assertEquals(186.16565714646623, thermo.S, 0.0001);
-            assertEquals(27.17959553536761, thermo.Cv, 0.0001);
-            assertEquals(35.49406815526118, thermo.Cp, 0.0001);
-            assertEquals(9.563246020045452*1000, thermo.delta_H, 0.1);
-            assertEquals(-74.78229788701839*1000, thermo.H, 0.1);
-            assertEquals(-130.63199503095825*1000, thermo.G, 0.1);
+        assertEquals(186.16565714646623, thermo.S, 0.0001);
+        assertEquals(27.17959553536761, thermo.Cv, 0.0001);
+        assertEquals(35.49406815526118, thermo.Cp, 0.0001);
+        assertEquals(9.563246020045452 * 1000, thermo.delta_H, 0.1);
+        assertEquals(-74.78229788701839 * 1000, thermo.H, 0.1);
+        assertEquals(-130.63199503095825 * 1000, thermo.G, 0.1);
         thermo = nasa7Cal_t.getThermoState(1000);
         assertNotNull(thermo);
-            assertEquals(247.29330677118074, thermo.S, 0.0001);
-            assertEquals(63.89024470230205, thermo.Cv, 0.0001);
-            assertEquals(72.20471732219562, thermo.Cp, 0.0001);
-            assertEquals(47.748751756686244*1000, thermo.delta_H, 0.1);
-            assertEquals(-36.596792150377595*1000, thermo.H, 0.1);
-            assertEquals(-283.8900989215584*1000, thermo.G, 0.1);
+        assertEquals(247.29330677118074, thermo.S, 0.0001);
+        assertEquals(63.89024470230205, thermo.Cv, 0.0001);
+        assertEquals(72.20471732219562, thermo.Cp, 0.0001);
+        assertEquals(47.748751756686244 * 1000, thermo.delta_H, 0.1);
+        assertEquals(-36.596792150377595 * 1000, thermo.H, 0.1);
+        assertEquals(-283.8900989215584 * 1000, thermo.G, 0.1);
         thermo = nasa7Cal_t.getThermoState(4000);
         assertNotNull(thermo);
-            assertEquals(375.47896278300715, thermo.S, 0.0001);
-            assertEquals(95.83712040528195, thermo.Cv, 0.0001);
-            assertEquals(104.15159302517553, thermo.Cp, 0.0001);
-            assertEquals(335.4680530571488*1000, thermo.delta_H, 0.1);
-            assertEquals(251.122509150085*1000, thermo.H, 0.1);
-            assertEquals(-1250.7933419819435*1000, thermo.G, 0.1);
+        assertEquals(375.47896278300715, thermo.S, 0.0001);
+        assertEquals(95.83712040528195, thermo.Cv, 0.0001);
+        assertEquals(104.15159302517553, thermo.Cp, 0.0001);
+        assertEquals(335.4680530571488 * 1000, thermo.delta_H, 0.1);
+        assertEquals(251.122509150085 * 1000, thermo.H, 0.1);
+        assertEquals(-1250.7933419819435 * 1000, thermo.G, 0.1);
     }
-
 }

File thermo/src/test/java/gigadot/chom/thermo/property/NASA7Test.java

 
 import gigadot.chom.model.cookie.NASA7;
 import gigadot.chom.thermo.AbstractUnitTest;
+import static org.junit.Assert.*;
 import org.junit.Test;
-import static org.junit.Assert.*;
 
 /**
  *
  */
 public class NASA7Test extends AbstractUnitTest {
 
-    private NASA7 nasa = null;
-
-    public NASA7Test() {
-        nasa = new NASA7();
+    private NASA7 createNASA7Ref1() {
+        NASA7 nasa = new NASA7();
         nasa.setAHigh(0, 0.47238333E+00);
         nasa.setALow(0, 0.38717898E+01);
         nasa.setAHigh(1, 0.12680758E-01);
         nasa.setALow(5, -0.10144425E+05);
         nasa.setAHigh(6, 0.16199090E+02);
         nasa.setALow(6, 0.66008135E+00);
+        return nasa;
     }
 
     /**
     @Test
     public void testSetTemperatureLowerBound() {
         printTestTitle("setTemperatureLowerBound");
-        NASA7 nasa_t = new NASA7(nasa);
+        NASA7 nasa_t = createNASA7Ref1();
         logger.info("Testing set the lower bound to mid point and upper bound value.");
         assertEquals(nasa_t.getTemperatureLowerBound(), 20.0, 0);
         nasa_t.setTemperatureLowerBound(300);
     @Test
     public void testSetTemperatureMidPoint() {
         printTestTitle("setTemperatureMidPoint");
-        NASA7 nasa_t = new NASA7(nasa);
+        NASA7 nasa_t = createNASA7Ref1();
         assertEquals(nasa_t.getTemperatureMidPoint(), 1000.0, 0);
         nasa_t.setTemperatureMidPoint(300);
         assertEquals(nasa_t.getTemperatureMidPoint(), 300.0, 0);
     @Test
     public void testSetTemperatureUpperBound() {
         printTestTitle("setTemperatureUpperBound");
-        NASA7 nasa_t = new NASA7(nasa);
+        NASA7 nasa_t = createNASA7Ref1();
         assertEquals(nasa_t.getTemperatureUpperBound(), 4000.0, 0);
         nasa_t.setTemperatureUpperBound(5000);
         assertEquals(nasa_t.getTemperatureUpperBound(), 5000.0, 0);
     @Test
     public void testToString() {
         printTestTitle("toString");
+        NASA7 nasa = createNASA7Ref1();
         logger.info("\n" + nasa);
         nasa.setTemperatureLowerBound(300);
         logger.info("\n" + nasa);
     }
-
-    /**
-     * Test of toString method, of class NASAPolynomial.
-     */
-    @Test
-    public void testNASACopyConstructor() {
-        printTestTitle("NASACopyConstructor");
-        logger.info("Testing passing null object to NASAPolynomial copy constructor");
-        NASA7 nasa2;
-        NASA7 nasa3 = null;
-        try {
-            nasa2 = new NASA7(nasa3);
-            fail("Failed to catch NullPointerException");
-        } catch (NullPointerException ex) {
-            assertTrue(true);
-        }
-        nasa2 = new NASA7(nasa);
-        logger.info("Testing values in copy constructor");
-        assertEquals(nasa.getTemperatureLowerBound(), nasa2.getTemperatureLowerBound(), 0);
-        assertEquals(nasa.getTemperatureMidPoint(), nasa2.getTemperatureMidPoint(), 0);
-        assertEquals(nasa.getTemperatureUpperBound(), nasa2.getTemperatureUpperBound(), 0);
-        assertEquals(nasa.getNumCoefficients(), nasa2.getNumCoefficients());
-        for (int i = 0; i < nasa.getNumCoefficients(); i++) {
-            assertEquals(nasa.getALow(i), nasa2.getALow(i), 0);
-            assertEquals(nasa.getAHigh(i), nasa2.getAHigh(i), 0);
-        }
-    }
 }