• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Logger类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中beast.core.Logger的典型用法代码示例。如果您正苦于以下问题:Java Logger类的具体用法?Java Logger怎么用?Java Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Logger类属于beast.core包,在下文中一共展示了Logger类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testScaleWithInt

import beast.core.Logger; //导入依赖的package包/类
@Test
public void testScaleWithInt() throws Exception {
    Randomizer.setSeed(1);

    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(
            new File("test/epiinf/xmltests/ScaleWithIntTest.xml"));
    Logger.FILE_MODE = Logger.LogFileMode.overwrite;
    runnable.run();


    List<Expectation> expectations = new ArrayList<>();
    expectations.add(new Expectation("x1", 0.5, 0.01));
    expectations.add(new Expectation("y1", 0.5, 0.01));
    expectations.add(new Expectation("y2", 0.5, 0.01));
    expectations.add(new Expectation("y3", 0.5, 0.01));
    expectations.add(new Expectation("n", 50.0, 1.0));
    LogAnalyser logAnalyser = new LogAnalyser("ScaleWithIntTest.log", expectations);

    try {
        for (Expectation expectation : expectations) {
            assertTrue(expectation.isValid());
            assertTrue(expectation.isPassed());
        }
    } catch (Exception e) {
        throw e;

    } finally {
        Files.deleteIfExists(Paths.get("ScaleWithIntTest.xml.state"));
        Files.deleteIfExists(Paths.get("ScaleWithIntTest.log"));
    }
}
 
开发者ID:tgvaughan,项目名称:EpiInf,代码行数:33,代码来源:OperatorTests.java


示例2: createDistribution

import beast.core.Logger; //导入依赖的package包/类
@Override
public List<Distribution> createDistribution(BeautiDoc doc) {
	MRCAPrior prior = new MRCAPrior();
    try {
	
        List<Tree> trees = new ArrayList<>();
        getDoc().scrubAll(true, false);
        State state = (State) doc.pluginmap.get("state");
        for (StateNode node : state.stateNodeInput.get()) {
            if (node instanceof Tree) { // && ((Tree) node).m_initial.get() != null) {
                trees.add((Tree) node);
            }
        }
        int treeIndex = 0;
        if (trees.size() > 1) {
            String[] treeIDs = new String[trees.size()];
            for (int j = 0; j < treeIDs.length; j++) {
                treeIDs[j] = trees.get(j).getID();
            }
            treeIndex = JOptionPane.showOptionDialog(null, "Select a tree", "MRCA selector",
                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null,
                    treeIDs, trees.get(0));
        }
        if (treeIndex < 0) {
            return null;
        }
        prior.treeInput.setValue(trees.get(treeIndex), prior);
        TaxonSet taxonSet = new TaxonSet();
	
        TaxonSetDialog dlg = new TaxonSetDialog(taxonSet, getTaxonCandidates(prior), doc);
        if (!dlg.showDialog() || dlg.taxonSet.getID() == null || dlg.taxonSet.getID().trim().equals("")) {
            return null;
        }
        taxonSet = dlg.taxonSet;
        if (taxonSet.taxonsetInput.get().size() == 0) {
        	JOptionPane.showMessageDialog(doc.beauti, "At least one taxon should be included in the taxon set",
        			"Error specifying taxon set", JOptionPane.ERROR_MESSAGE);
        	return null;
        }
        int i = 1;
        String id = taxonSet.getID();
        while (doc.pluginmap.containsKey(taxonSet.getID()) && doc.pluginmap.get(taxonSet.getID()) != taxonSet) {
        	taxonSet.setID(id + i);
        	i++;
        }
        BEASTObjectPanel.addPluginToMap(taxonSet, doc);
        prior.taxonsetInput.setValue(taxonSet, prior);
        prior.setID(taxonSet.getID() + ".prior");
        // this sets up the type
        prior.distInput.setValue(new OneOnX(), prior);
        // this removes the parametric distribution
        prior.distInput.setValue(null, prior);
	
        Logger logger = (Logger) doc.pluginmap.get("tracelog");
        logger.loggersInput.setValue(prior, logger);
    } catch (Exception e) {
        // TODO: handle exception
    }
    List<Distribution> selectedPlugins = new ArrayList<>();
    selectedPlugins.add(prior);
    g_collapsedIDs.add(prior.getID());
    return selectedPlugins;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:64,代码来源:PriorListInputEditor.java


示例3: analyse

import beast.core.Logger; //导入依赖的package包/类
public void analyse(int index_XML) throws Exception {
//        for (int i = 0; i < xmls.length; i++) {
//            if (giveExpectations(i).size() > 0) {
        Randomizer.setSeed(SEED);
        Logger.FILE_MODE = Logger.LogFileMode.overwrite;
        
        long beagleFlags = BeagleFlag.PROCESSOR_CPU.getMask() | BeagleFlag.VECTOR_SSE.getMask();
        System.setProperty("beagle.preferred.flags", Long.toString(beagleFlags));


        String fileName = dirName + xmls[index_XML];

        System.out.println("Processing " + fileName);
        XMLParser parser = new XMLParser();
        beast.core.Runnable runable = parser.parseFile(new File(fileName));
        runable.setStateFile("tmp.state", false);
//		   runable.setInputValue("preBurnin", 0);
//		   runable.setInputValue("chainLength", 1000);
        runable.run();

        String logFile = logDir + testFile + (useSeed ? SEED : "") + ".log";
        System.out.println("\nAnalysing log " + logFile);
        LogAnalyser logAnalyser = new LogAnalyser(logFile, giveExpectations(index_XML)); // burnIn = 0.1 * maxState

        for (Expectation expectation : logAnalyser.m_pExpectations.get()) {
            Assert.assertTrue(xmls[index_XML] + ": Expected " + expectation.traceName.get() + " delta mean: "
                    + expectation.expValue.get() + " - " + expectation.getTraceStatistics().getMean()
                    + " <= delta stdErr: 2*(" + expectation.getStdError() + " + "
                    + expectation.getTraceStatistics().getStdErrorOfMean() + ")", expectation.isPassed());

            if (checkESS)
            	Assert.assertTrue(xmls[index_XML] + ":  has very low effective sample sizes (ESS) "
                    + expectation.getTraceStatistics().getESS(), expectation.isValid());
        }

        System.out.println("\nSucceed " + fileName);
        System.out.println("\n***************************************\n");
//            }
//        }
    }
 
开发者ID:CompEvol,项目名称:beast2,代码行数:41,代码来源:TestFramework.java


示例4: assertTraceLogEqual

import beast.core.Logger; //导入依赖的package包/类
void assertTraceLogEqual(String... ids) {
	System.err.println("assertTraceLogEqual");
	Logger logger = (Logger) doc.pluginmap.get("tracelog");
	List<BEASTObject> logs = logger.loggersInput.get();
	asserListsEqual(logs, ids);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:7,代码来源:BeautiBase.java


示例5: testFileLog

import beast.core.Logger; //导入依赖的package包/类
@Test
    public void testFileLog() throws Exception {
        logger = new Logger();
        logger.initByName("fileName", "beast.log", "log", new RealParameter(new Double[]{0.3, 0.7}));
        File f_log = new File(logger.fileNameInput.get());
        if (f_log.exists()) {
            boolean log_deleted = f_log.delete();
            System.out.println("Delete log : " + f_log.getAbsolutePath() + " for testFileLog.");
        }

        logger.init();
        assertTrue("beast.log created successfully", f_log.exists());

        // rI >= 0
        int rI = new Random().nextInt(10000000);
        logger.log(-1);
        logger.log(rI);
        logger.close();

        //TODO cannot get "closing" status from PrintStream
//        assertNull("m_out is beast.log after close", logger.getM_out());

        BufferedReader in = new BufferedReader(new FileReader(f_log));
        // column names
        String line = in.readLine();
        // 1st sample
        String sample1 = in.readLine();
        String[] sp = sample1.split("\t", -1);
        assertFalse("check beast.log -1 not logged", sp[0].equals("-1"));
        assertEquals("check beast.log 1st sample", Integer.toString(rI), sp[0]);
    }
 
开发者ID:CompEvol,项目名称:beast2,代码行数:32,代码来源:LoggerTest.java


示例6: testScreenLog

import beast.core.Logger; //导入依赖的package包/类
@Test
public void testScreenLog() throws Exception {
    logger = new Logger();
    logger.initByName("fileName", "", "log", new RealParameter(new Double[]{0.3, 0.7}));

    logger.init();
    assertTrue("m_out is System.out", logger.getM_out() == System.out);

    logger.log(1);
    //TODO cannot extract content

    // close all file, except stdout
    logger.close();
    assertTrue("m_out is still System.out after close", logger.getM_out() == System.out);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:16,代码来源:LoggerTest.java


示例7: testGeomRandomWalk

import beast.core.Logger; //导入依赖的package包/类
@Test
public void testGeomRandomWalk() throws Exception {
    Randomizer.setSeed(1);

    XMLParser parser = new XMLParser();
    beast.core.Runnable runnable = parser.parseFile(
            new File("test/epiinf/xmltests/GeomRandomWalkTest.xml"));
    Logger.FILE_MODE = Logger.LogFileMode.overwrite;
    runnable.run();


    List<Expectation> expectations = new ArrayList<>();
    expectations.add(new Expectation("n", 50.0, 1.0));
    LogAnalyser logAnalyser = new LogAnalyser("GeomRandomWalkTest.log", expectations);

    try {
        for (Expectation expectation : expectations) {
            assertTrue(expectation.isValid());
            assertTrue(expectation.isPassed());
        }
    } catch (Exception e) {
        throw e;

    } finally {
        Files.deleteIfExists(Paths.get("GeomRandomWalkTest.xml.state"));
        Files.deleteIfExists(Paths.get("GeomRandomWalkTest.log"));
    }
}
 
开发者ID:tgvaughan,项目名称:EpiInf,代码行数:29,代码来源:OperatorTests.java


示例8: baseType

import beast.core.Logger; //导入依赖的package包/类
@Override
public Class<?> baseType() {
    return Logger.class;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:5,代码来源:LoggerListInputEditor.java


示例9: addSingleItem

import beast.core.Logger; //导入依赖的package包/类
@Override
protected void addSingleItem(BEASTInterface beastObject) {
	currentLogger = (Logger) beastObject;
	super.addSingleItem(beastObject);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:6,代码来源:LoggerListInputEditor.java


示例10: traceLogAsString

import beast.core.Logger; //导入依赖的package包/类
String traceLogAsString() {
	Logger logger = (Logger) doc.pluginmap.get("tracelog");
	List<BEASTObject> logs = logger.loggersInput.get();
	return "assertTraceLogEqual" + pluginListAsString(logs);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:6,代码来源:BeautiBase.java


示例11: setUp

import beast.core.Logger; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    logger = new Logger();
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:5,代码来源:LoggerTest.java



注:本文中的beast.core.Logger类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CourseDbLoader类代码示例发布时间:2022-05-23
下一篇:
Java SingleChronicleQueueBuilder类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap