OSDN Git Service

Renamed Cell as TupleElement
[xerial/xerial-core.git] / src / main / java / org / xerial / lens / relation / NodeBase.java
index 228a16a..90260e8 100644 (file)
@@ -35,18 +35,14 @@ import org.xerial.core.XerialErrorCode;
  * \r
  * @param <NodeType>\r
  */\r
-public abstract class NodeBase<NodeType> implements Cell<NodeType>\r
-{\r
-    protected NodeBase()\r
-    {}\r
+public abstract class NodeBase<NodeType> implements TupleElement<NodeType> {\r
+    protected NodeBase() {}\r
 \r
-    public boolean isNode()\r
-    {\r
+    public boolean isNode() {\r
         return true;\r
     }\r
 \r
-    public boolean isTuple()\r
-    {\r
+    public boolean isTuple() {\r
         return false;\r
     }\r
 \r
@@ -55,27 +51,23 @@ public abstract class NodeBase<NodeType> implements Cell<NodeType>
      * \r
      * @return\r
      */\r
-    public int size()\r
-    {\r
+    public int size() {\r
         return 1;\r
     }\r
 \r
-    public Tuple<NodeType> getTuple()\r
-    {\r
-        throw new XerialError(XerialErrorCode.UNSUPPORTED);\r
+    public Tuple<NodeType> castToTuple() {\r
+        return null;\r
     }\r
 \r
-    public Cell<NodeType> get(TupleIndex index)\r
-    {\r
+    public TupleElement<NodeType> get(TupleIndex index) {\r
         if (index.size() == 0 && index.get(0) == 0)\r
-            return (Cell<NodeType>) this;\r
+            return (TupleElement<NodeType>) this;\r
         else\r
             throw new XerialError(XerialErrorCode.INVALID_STATE);\r
     }\r
 \r
     @SuppressWarnings("unchecked")\r
-    public NodeType getNode(TupleIndex index)\r
-    {\r
+    public NodeType getElement(TupleIndex index) {\r
         if (!(index.size() == 1 && index.get(0) == 0))\r
             throw new XerialError(XerialErrorCode.INVALID_STATE);\r
         else\r
@@ -83,14 +75,12 @@ public abstract class NodeBase<NodeType> implements Cell<NodeType>
     }\r
 \r
     @SuppressWarnings("unchecked")\r
-    public NodeType getNode()\r
-    {\r
+    public NodeType castToNode() {\r
         return (NodeType) this;\r
     }\r
 \r
     @SuppressWarnings("unchecked")\r
-    public void accept(CellVisitor<NodeType> visitor)\r
-    {\r
+    public void accept(TupleElementVisitor<NodeType> visitor) {\r
         visitor.visitNode((NodeType) this);\r
     }\r
 \r