Mercurial > hg > Members > nobuyasu > jungle-network
view src/alice/jungle/persistence/PersistentJungleTree.java @ 88:0c98717f186e
Removed cast code
author | one |
---|---|
date | Tue, 05 Nov 2013 09:13:30 +0900 |
parents | e641f559559c |
children | fcce7ca4adb9 |
line wrap: on
line source
package alice.jungle.persistence; 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.persistent.ChangeListWriter; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.ChangeSet; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.TreeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.AtomicReservableReference; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultJungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.TreeContext; public class PersistentJungleTree <T extends TreeNode<T>> implements JungleTree { private final AtomicReservableReference<TreeContext<T>> repository; private final String uuid; private final String treeName; private final ChangeListWriter writer; private final TreeEditor editor; public PersistentJungleTree(String _treeName, TreeContext<T> _tc,String _uuid, ChangeListWriter _writer,TreeEditor _editor) { treeName = _treeName; repository = new AtomicReservableReference<TreeContext<T>>(_tc); uuid = _uuid; writer = _writer; editor = _editor; } @Override public JungleTreeEditor getTreeEditor() { TreeContext<T> tc = repository.get(); PersistentTransactionManager<T> txManager = new PersistentTransactionManager<T>(treeName, writer,tc,repository,uuid); T root = tc.getTreeNode(); return new DefaultJungleTreeEditor<T>(root,txManager,editor); } @Override public Node getRootNode() { TreeContext<T> tc = repository.get(); ChangeSet cs = tc.getChangeSet(); return cs.getRoot(); } }