Bulletin17CResults.java [src/java/m/cfa/flood] Revision: c886055fa7b2663dd934712e99616e8e51098bcd  Date: Thu Apr 25 13:58:07 MDT 2024
package m.cfa.flood;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.util.ArrayList;

/**
 *
 * @author Lucas Yaege
 */
public class Bulletin17CResults {

    public ArrayList<Bulletin17CFreqResult> frequencyResults;
    public ArrayList<BulletinC17WYResult> waterYearResults;

    public Bulletin17CResults() {
        frequencyResults = new ArrayList<>();
        waterYearResults = new ArrayList<>();
    }

    public void addResult( Bulletin17CFreqResult res ) {
        frequencyResults.add( res );
    }

    public void addResult( BulletinC17WYResult res ) {
        waterYearResults.add( res );
    }

    public String toJSON() {
        Gson gson = new GsonBuilder().serializeSpecialFloatingPointValues().create();
        return gson.toJson( this ).replaceAll( "Infinity", "-9999999" );
    }
}