    001    package calhoun.analysis.crf.solver;
    002
    003    import java.io.BufferedWriter;
    004
    005    import calhoun.util.FileUtil;
    006
    007    public final class LogFiles {
    008            public String alphaFile = null;
    009            public String alphaLengthFile = null;
    010            public String betaLengthFile = null;
    011            public String expectFile = null;
    012            public String expectLengthFile = null;
    013            public String nodeMarginalFile = null;
    014            public String scoreAlphaFile = null;
    015            public String expectedProductFile = null;
    016            public String marginalsFile = null;
    017            public BufferedWriter alphaWriter = null;
    018            public BufferedWriter alphaLengthWriter = null;
    019            public BufferedWriter betaLengthWriter = null;
    020            public BufferedWriter expectWriter = null;
    021            public BufferedWriter expectLengthWriter = null;
    022            public BufferedWriter nodeMarginalWriter = null;
    023            public BufferedWriter scoreAlphaWriter = null;
    024            public BufferedWriter expectedProductWriter = null;
    025            public BufferedWriter marginalsWriter = null;
    026
    027            public final void open() {
    028                    alphaWriter = FileUtil.safeOpen(alphaFile);
    029                    alphaLengthWriter = FileUtil.safeOpen(alphaLengthFile);
    030                    betaLengthWriter = FileUtil.safeOpen(betaLengthFile);
    031                    expectWriter = FileUtil.safeOpen(expectFile);
    032                    expectLengthWriter = FileUtil.safeOpen(expectLengthFile);
    033                    nodeMarginalWriter = FileUtil.safeOpen(nodeMarginalFile);
    034                    scoreAlphaWriter = FileUtil.safeOpen(scoreAlphaFile);
    035                    expectedProductWriter = FileUtil.safeOpen(expectedProductFile);
    036                    marginalsWriter = FileUtil.safeOpen(marginalsFile);
    037            }
    038
    039            public final void close() {
    040                    FileUtil.safeClose(alphaWriter);
    041                    FileUtil.safeClose(alphaLengthWriter);
    042                    FileUtil.safeClose(betaLengthWriter);
    043                    FileUtil.safeClose(expectWriter);
    044                    FileUtil.safeClose(expectLengthWriter);
    045                    FileUtil.safeClose(nodeMarginalWriter);
    046                    FileUtil.safeClose(scoreAlphaWriter);
    047                    FileUtil.safeClose(expectedProductWriter);
    048                    FileUtil.safeClose(marginalsWriter);
    049            }
    050    }