Mercurial > hg > Members > tatsuki > bench > jungle-core
view src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/EditCache.java @ 16:35c661de095d
added Parameter ... etc..
author | Shoshi TAMAKI |
---|---|
date | Wed, 19 Dec 2012 23:20:00 +0900 |
parents | |
children | 703f0be5368a |
line wrap: on
line source
package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer; import java.nio.ByteBuffer; import fj.Ord; import fj.data.List; import fj.data.Option; import fj.data.TreeMap; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.Children; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.Operation; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.Parameter; public class EditCache { private final List<Operation> operations; private final TreeMap<String,Operation> attrCache; private final List<Operation> childrenCache; public EditCache() { operations = List.nil(); attrCache = TreeMap.empty(Ord.stringOrd); childrenCache = List.nil(); } private EditCache(List<Operation> _operations,TreeMap<String,Operation> _attrCache,List<Operation> _childrenCache) { operations = _operations; attrCache = _attrCache; childrenCache = _childrenCache; } public EditCache setAttribute(final String _key,final ByteBuffer _value) { Operation op = new Operation(){ @Override public Command getCommand(){ return Command.PUT_ATTRIBUTE; } @Override public <T> T getParameter(Parameter<T> _param){ if(_param == jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.SetAttribute.KEY){ return _key; } return ; } }; } public EditCache deleteAttribute(String _key) { } public EditCache appendChildAt(int _pos) { } public EditCache deleteChildAt(int _pos) { } public Operation getAttribute(String _key) { Option<Operation> result = attrCache.get(_key); if(result.isSome()){ return result.some(); } return null; } public List<Operation> operations() { return operations; } public List<Operation> childrenOperations() { return childrenCache; } }