Mercurial > hg > Members > tatsuki > jungle-bench
changeset 0:81d5bb6831b2
fast commit
author | one |
---|---|
date | Tue, 04 Mar 2014 01:32:38 +0900 |
parents | |
children | 358d1797a35a |
files | pom.xml src/main/java/example/SimpleJungle.java |
diffstat | 2 files changed, 76 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pom.xml Tue Mar 04 01:32:38 2014 +0900 @@ -0,0 +1,33 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>jungle-bench</groupId> + <artifactId>jungle-bench</artifactId> + <version>0.0.1-SNAPSHOT</version> + <build> + <sourceDirectory>src/main/java</sourceDirectory> + <testSourceDirectory>src/test/java</testSourceDirectory> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.3.2</version> + <configuration> + <source>1.7</source> + <target>1.7</target> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + + <dependency> + <groupId>jungle</groupId> + <artifactId>jungle-core</artifactId> + <version>0.0.3-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.7</version> + </dependency> + </dependencies> +</project> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/example/SimpleJungle.java Tue Mar 04 01:32:38 2014 +0900 @@ -0,0 +1,43 @@ +package example; + +import java.nio.ByteBuffer; + +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.DefaultJungle; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.Jungle; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.Node; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.DefaultTraverser; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; +import junit.framework.Assert; + + +public class SimpleJungle { + + public static final String key = "name"; + public static final String valueString = "kanagawa"; + public static final ByteBuffer value = ByteBuffer.wrap(valueString.getBytes()); + + public static void main(String[] args) { + Jungle j = new DefaultJungle(null,"hogehoge",new DefaultTreeEditor(new DefaultTraverser())); + j.createNewTree("tree"); + JungleTree tree = j.getTreeByName("tree"); + JungleTreeEditor editor1 = tree.getTreeEditor(); + DefaultNodePath root = new DefaultNodePath(); + + Either<Error,JungleTreeEditor> either = editor1.putAttribute(root,key,value); + if(either.isA()){ + Assert.fail(); + } + editor1 = either.b(); + editor1.success(); + + Node node = tree.getRootNode(); + ByteBuffer v = node.getAttributes().get(key); + System.out.println(new String(v.array())); + + } +}