Bulletin17CResults.java [src/java/m/cfa/flood] Revision:   Date:
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" );
    }
}