Mercurial > hg > Members > shoshi > TreeCMSv1
changeset 24:f0c35d444982
commit
author | ShoshiTAMAKI |
---|---|
date | Sun, 24 Oct 2010 15:45:13 +0900 |
parents | a3f8f5da4947 |
children | 99346c04a3cf |
files | src/treecms/proto/merge/MergedTreeBuilder.java src/treecms/proto/simple/SimpleTreeBuilder.java src/treecms/proto/util/NodeUUIDComparator.java |
diffstat | 3 files changed, 36 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/treecms/proto/merge/MergedTreeBuilder.java Sun Oct 24 13:49:29 2010 +0900 +++ b/src/treecms/proto/merge/MergedTreeBuilder.java Sun Oct 24 15:45:13 2010 +0900 @@ -5,6 +5,8 @@ public class MergedTreeBuilder implements TreeBuilder { + private Node m_root; + private TreeBuilder m_target1; private TreeBuilder m_target2; @@ -14,11 +16,18 @@ m_target2 = _target2; } + public Node merge(Node _root1,Node _root2) + { + Node root = null; + + return root; + } + @Override public Node getContents() { // TODO Auto-generated method stub - return null; + return m_root; } @Override
--- a/src/treecms/proto/simple/SimpleTreeBuilder.java Sun Oct 24 13:49:29 2010 +0900 +++ b/src/treecms/proto/simple/SimpleTreeBuilder.java Sun Oct 24 15:45:13 2010 +0900 @@ -2,6 +2,8 @@ import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicLong; + import treecms.proto.api.Node; import treecms.proto.api.TreeBuilder; @@ -9,11 +11,14 @@ { private Node m_root; + private AtomicLong m_ids; private ConcurrentHashMap<Thread,NodeUUID> m_idMap; public SimpleTreeBuilder() { m_idMap = new ConcurrentHashMap<Thread,NodeUUID>(); + m_ids = new AtomicLong(); + m_root = new SimpleNode(generateUUID()); } @@ -29,6 +34,18 @@ public String generateUUID() { + return generateUUID_AtomicLong(); + //return generateUUID_ThreadLocal(); + } + + public String generateUUID_AtomicLong() + { + //blocking? + return Long.toString(m_ids.getAndIncrement()); + } + + public String generateUUID_ThreadLocal() + { NodeUUID uuid; uuid = m_idMap.get(Thread.currentThread()); if(uuid == null){
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/treecms/proto/util/NodeUUIDComparator.java Sun Oct 24 15:45:13 2010 +0900 @@ -0,0 +1,9 @@ +package treecms.proto.util; + +public class NodeUUIDComparator +{ + public static String compare(String _target1,String _target2) + { + return Long.toString(Math.min(Long.parseLong(_target1),Long.parseLong(_target2))); + } +}