Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 22:9fd57b7c6adb
added Either
author | Shoshi TAMAKI |
---|---|
date | Mon, 07 Jan 2013 23:22:36 +0900 |
parents | 848f73545c4d |
children | 3ef2a66a8c5d |
files | src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/DefaultChildren.java src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/DefaultNode.java src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/DefaultTreeEditor.java src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingNode.java src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/util/DefaultEither.java src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/util/Either.java |
diffstat | 6 files changed, 75 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/DefaultChildren.java Sun Jan 06 22:32:39 2013 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/DefaultChildren.java Mon Jan 07 23:22:36 2013 +0900 @@ -8,9 +8,11 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.Children; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.Node; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.EditableChildren; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.EditableNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.IterableWrapper; -public class DefaultChildren implements Children +public class DefaultChildren implements EditableChildren { private final List<DefaultNode> children; private static final List<DefaultNode> EMPTY = List.nil(); @@ -78,4 +80,17 @@ { return (new IterableWrapper<Node>(children)).iterator(); } + + @Override + public EditableNode addNewChildAt(int _pos) + { + + return null; + } + + @Override + public EditableNode deleteChildAt(int _pos) + { + return null; + } }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/DefaultNode.java Sun Jan 06 22:32:39 2013 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/DefaultNode.java Mon Jan 07 23:22:36 2013 +0900 @@ -1,10 +1,11 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.Attributes; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.Children; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.Node; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.EditableAttributes; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.EditableChildren; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.EditableNode; -public class DefaultNode implements Node +public class DefaultNode implements EditableNode { public final DefaultAttributes attrs; public final DefaultChildren children; @@ -21,13 +22,13 @@ } @Override - public DefaultChildren getChildren() + public EditableChildren getChildren() { return children; } @Override - public DefaultAttributes getAttributes() + public EditableAttributes getAttributes() { return attrs; }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/DefaultTreeEditor.java Sun Jan 06 22:32:39 2013 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/DefaultTreeEditor.java Mon Jan 07 23:22:36 2013 +0900 @@ -94,6 +94,8 @@ DefaultNode node = (DefaultNode)n; path.add(node); } + + }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingNode.java Sun Jan 06 22:32:39 2013 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingNode.java Mon Jan 07 23:22:36 2013 +0900 @@ -31,4 +31,9 @@ { return new LoggingChildren(wrap.getChildren(),log); } + + public Logger getLogger() + { + return log; + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/util/DefaultEither.java Mon Jan 07 23:22:36 2013 +0900 @@ -0,0 +1,37 @@ +package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util; + +public class DefaultEither<A,B> implements Either<A,B> +{ + private final A theA; + private final B theB; + + public DefaultEither(A _theA) + { + theA = _theA; + theB = null; + } + + @Override + public A a() + { + return theA; + } + + @Override + public boolean isA() + { + return (theA == null) ? true : false; + } + + @Override + public B b() + { + return theB; + } + + @Override + public boolean isB() + { + return (theB == null) ? true : false; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/util/Either.java Mon Jan 07 23:22:36 2013 +0900 @@ -0,0 +1,9 @@ +package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util; + +public interface Either<A,B> +{ + public A a(); + public boolean isA(); + public B b(); + public boolean isB(); +}