Package org.integratedmodelling.riskwiz.io

Source Code of org.integratedmodelling.riskwiz.io.Converter

package org.integratedmodelling.riskwiz.io;


import java.io.FileInputStream;

import org.integratedmodelling.riskwiz.bn.BeliefNetwork;
import org.integratedmodelling.riskwiz.io.genie.GenieReader;
import org.integratedmodelling.riskwiz.io.genie.GenieWriter;
import org.integratedmodelling.riskwiz.io.riskwiz.RiskWizWriter;
import org.integratedmodelling.riskwiz.io.xmlbif.XmlBifReader;
import org.integratedmodelling.riskwiz.io.xmlbif.XmlBifWriter;


public class Converter {
 
    public static void bifToGenie(String fileIn, String fileOut) {
        XmlBifReader r = new XmlBifReader();
        GenieWriter w = new  GenieWriter();

        try {
            BeliefNetwork bn = r.load(new FileInputStream(fileIn));
            
            System.out.println("----------------------------------")
            w.save(System.out, bn);
            w.saveToFile(fileOut, bn);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
 
    public static void genieToBif(String fileIn, String fileOut) {
        GenieReader r = new GenieReader();
        XmlBifWriter w = new  XmlBifWriter();

        try {
            BeliefNetwork bn = r.load(new FileInputStream(fileIn));
            
            System.out.println("----------------------------------")
            w.save(System.out, bn);
            w.saveToFile(fileOut, bn);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
 
    public static void genieToRiskwiz(String fileIn, String fileOut) {
        GenieReader r = new GenieReader();
        RiskWizWriter w = new  RiskWizWriter();

        try {
            BeliefNetwork bn = r.load(new FileInputStream(fileIn));
            
            System.out.println("----------------------------------")
            w.save(System.out, bn);
            w.saveToFile(fileOut, bn);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
TOP

Related Classes of org.integratedmodelling.riskwiz.io.Converter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.