view src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/test/readTreeAttributeThread.java @ 182:67d4c68578cf

add Jungle benchMark
author tatsuki
date Fri, 20 Mar 2015 15:35:53 +0900
parents 2e6ca84686da
children 066d9c5758dc
line wrap: on
line source

package jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.test;

import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree;
import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode;

/**
 * Created by e115731 on 15/03/17.
 */
public class readTreeAttributeThread extends JungleBenchMarkThread {

    JungleTree tree;
    private long findCount;

    boolean loop = true;

    public readTreeAttributeThread(JungleTree tree) {
        this.tree = tree;
        this.findCount = 0;
    }

    @Override
    public long getFindCount() {
        System.out.println("thread count = " + findCount);
        return findCount;
    }

    public void set(boolean loop) {
        this.loop = loop;
    }

    @Override
    public void run() {
        while (loop) {
            TreeNode root = tree.getRootNode();
            if (root != null)
                findCount++;
                   String attribute = root.getAttributes().getString("test");
                 if (attribute.equals("test"))
                   findCount++;
                 else
                   System.out.println("faild");
        }
    }
}