+++ /dev/null
-/*--------------------------------------------------------------------------\r
- * Copyright 2009 Taro L. Saito\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *--------------------------------------------------------------------------*/\r
-//--------------------------------------\r
-// XerialJ\r
-//\r
-// SchemaBuilder.java\r
-// Since: 2009/05/14 18:09:30\r
-//\r
-// $URL$\r
-// $Author$\r
-//--------------------------------------\r
-package org.xerial.lens.relation.schema;\r
-\r
-import java.util.ArrayList;\r
-\r
-import org.xerial.lens.relation.DataType;\r
-import org.xerial.lens.relation.FD;\r
-\r
-public class SchemaBuilder {\r
- Schema parent = null;\r
- ArrayList<Schema> element = new ArrayList<Schema>();\r
- FD occurrence = FD.ONE_TO_ONE;\r
-\r
- public SchemaBuilder() {\r
-\r
- }\r
-\r
- public SchemaBuilder(Schema parent) {\r
- setParent(parent);\r
- }\r
-\r
- public SchemaBuilder setParent(Schema parent) {\r
- this.parent = parent;\r
- return this;\r
- }\r
-\r
- public SchemaBuilder setFD(FD fd) {\r
- this.occurrence = fd;\r
- return this;\r
- }\r
-\r
- public SchemaBuilder add(Schema elem) {\r
- this.element.add(elem);\r
- return this;\r
- }\r
-\r
- public SchemaBuilder add(String attribute) {\r
- this.element.add(new SchemaAtom(attribute.toLowerCase()));\r
- return this;\r
- }\r
-\r
- public SchemaBuilder add(String attribute, FD fd) {\r
- this.element.add(new SchemaAtom(attribute.toLowerCase(), fd));\r
- return this;\r
- }\r
-\r
- public SchemaBuilder add(String attribute, DataType type, FD fd) {\r
- this.element.add(new SchemaAtom(attribute.toLowerCase(), type, fd));\r
- return this;\r
- }\r
-\r
- public SchemaArray build() {\r
- return new SchemaArray(parent, element, occurrence);\r
- }\r
-\r
-}\r