view src/treecms/memory/OnMemoryNode.java @ 27:aecc55e87143 default tip

test commit
author Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
date Thu, 18 Aug 2011 17:37:03 +0900
parents 9cb971a68cc5
children
line wrap: on
line source

package treecms.memory;

import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;
import java.util.Set;

import treecms.api.Node;
import treecms.api.NodeAttributes;
import treecms.api.NodeID;
import treecms.tree.util.NodeData;

class OnMemoryNode implements Node
{
	private final NodeID m_id;
	private final NodeData<Node> m_data;
	
	private static final String ERR_READONLY = "this is a readonly node.";
	
	public OnMemoryNode(NodeID _id,NodeData<Node> _newData)
	{
		m_id = _id;
		m_data = new NodeData<Node>(_newData);
	}

	@Override
	public NodeID getID()
	{
		return m_id;
	}

	@Override
	public List<Node> getList()
	{
		return m_data.getList();
	}

	@Override
	public Map<ByteBuffer, ByteBuffer> asMap()
	{
		return m_data.asMap();
	}

	@Override
	public Set<ByteBuffer> getKeySet()
	{
		return m_data.getKeySet();
	}

	@Override
	public ByteBuffer get(ByteBuffer _name)
	{
		return m_data.get(_name);
	}

	@Override
	public NodeAttributes getAll()
	{
		return m_data.getAll();
	}

	@Override
	public Set<String> getFamilyIDSet()
	{
		return m_data.getFamilyIDSet();
	}

	@Override
	public Node get(String _uuid)
	{
		return m_data.get(_uuid);
	}

	@Override
	public Node get(int _index)
	{
		return m_data.get(_index);
	}

	@Override
	public boolean contains(NodeID _id)
	{
		return m_data.contains(_id);
	}

	@Override
	public OnMemoryNode create(NodeAttributes _attr)
	{
		throw new UnsupportedOperationException(ERR_READONLY);
	}

	@Override
	public OnMemoryNode remove(String _uuid)
	{
		throw new UnsupportedOperationException(ERR_READONLY);
	}

	@Override
	public OnMemoryNode remove(int _index)
	{
		throw new UnsupportedOperationException(ERR_READONLY);
	}

	@Override
	public boolean swap(String _uuid, String _uuid2)
	{
		throw new UnsupportedOperationException(ERR_READONLY);
	}

	@Override
	public void clearChildren()
	{
		throw new UnsupportedOperationException(ERR_READONLY);
	}

	@Override
	public void put(ByteBuffer _name, ByteBuffer _value)
	{
		throw new UnsupportedOperationException(ERR_READONLY);
	}

	@Override
	public void putAll(NodeAttributes _attrs)
	{
		throw new UnsupportedOperationException(ERR_READONLY);
	}

	@Override
	public void remove(ByteBuffer _name)
	{
		throw new UnsupportedOperationException(ERR_READONLY);
	}

	@Override
	public void removeAll(Set<ByteBuffer> _keySet)
	{
		throw new UnsupportedOperationException(ERR_READONLY);
	}

	@Override
	public void clearAttributes()
	{
		throw new UnsupportedOperationException(ERR_READONLY);
	}
	
	@Override
	public String toString()
	{
		return m_id.toString();
	}
}