Mercurial > hg > Members > tatsuki > bench > jungle-core
view src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/AttributesImpl.java @ 10:a2c019a77c27
commit
author | Shoshi TAMAKI |
---|---|
date | Mon, 10 Dec 2012 18:50:53 +0900 |
parents | |
children |
line wrap: on
line source
package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl; import java.nio.ByteBuffer; import fj.Ord; import fj.data.Option; import fj.data.TreeMap; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.Attributes; public class AttributesImpl implements Attributes { private final TreeMap<String,ByteBuffer> attrs; private static final TreeMap<String,ByteBuffer> EMPTY = TreeMap.empty(Ord.stringOrd); public AttributesImpl() { this(EMPTY); } private AttributesImpl(TreeMap<String,ByteBuffer> _attrs) { attrs = _attrs; } public AttributesImpl remove(String _key) { return new AttributesImpl(attrs.delete(_key)); } public AttributesImpl put(String _key,ByteBuffer _value) { return new AttributesImpl(attrs.set(_key,_value)); } @Override public ByteBuffer get(String _key) { Option<ByteBuffer> result = attrs.get(_key); return result.isSome() ? result.some() : null; } }