svnno****@sourc*****
svnno****@sourc*****
2009年 2月 12日 (木) 03:32:45 JST
Revision: 2654 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2654 Author: daisuke_m Date: 2009-02-12 03:32:45 +0900 (Thu, 12 Feb 2009) Log Message: ----------- refactor / javadoc Modified Paths: -------------- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/EventBrokerImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/FactoryExtension.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultSqlEmitter.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AnnotationUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DomUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ListUtils.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/XpathUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/dialect/DefaultSqlEmitterTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/XpathUtilTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/xml/JiemamyNamespaceContextTest.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewFactoryExtensionEnhancer.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/editcommand/CommandListener.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/formatter/SqlFormatter.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/Adapter.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DataTypeCategory.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/LiteralType.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/Adaptable.java zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/NodeProfile.java zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/geometory/JmColor.java zeus/trunk/jiemamy-spec-view/src/test/java/org/jiemamy/model/geometory/JmColorTest.java -------------- next part -------------- Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/EventBrokerImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/EventBrokerImpl.java 2009-02-11 17:34:17 UTC (rev 2653) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/EventBrokerImpl.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -1,3 +1,21 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/08 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ package org.jiemamy; import java.util.ArrayList; Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/FactoryExtension.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/FactoryExtension.java 2009-02-11 17:34:17 UTC (rev 2653) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/FactoryExtension.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -28,6 +28,7 @@ import java.util.TreeSet; import java.util.UUID; +import org.jiemamy.model.ElementReference; import org.jiemamy.model.JiemamyElement; import org.jiemamy.model.RootModel; import org.jiemamy.model.RootModelImpl; @@ -159,12 +160,12 @@ * * @author daisuke */ - protected enum EntityComparator implements Comparator<EntityModel> { + protected enum JiemamyElementComparator implements Comparator<JiemamyElement> { /** singleton instance */ INSTANCE; - public int compare(EntityModel o1, EntityModel o2) { + public int compare(JiemamyElement o1, JiemamyElement o2) { int classNameComparison = o1.getClass().getName().compareTo(o2.getClass().getName()); if (classNameComparison != 0) { return classNameComparison; @@ -174,36 +175,26 @@ } } - protected enum ForeignKeyComparator implements Comparator<ForeignKeyModel> { + /** + * TODO for daisuke + * + * @author daisuke + */ + protected static class ReferenceComparator implements Comparator<ElementReference<?>> { - /** singleton instance */ - INSTANCE; - - public int compare(ForeignKeyModel o1, ForeignKeyModel o2) { - int classNameComparison = o1.getClass().getName().compareTo(o2.getClass().getName()); - if (classNameComparison != 0) { - return classNameComparison; - } - - return o1.getId().compareTo(o2.getId()); - } - } - - protected static class TableRefComparator implements Comparator<TableRef> { - private final Jiemamy jiemamy; - TableRefComparator(Jiemamy jiemamy) { + ReferenceComparator(Jiemamy jiemamy) { this.jiemamy = jiemamy; } - public int compare(TableRef o1, TableRef o2) { + public int compare(ElementReference<?> o1, ElementReference<?> o2) { ReferenceResolver resolver = jiemamy.getReferenceResolver(); - TableModel t1 = resolver.resolve(o1); - TableModel t2 = resolver.resolve(o2); - return EntityComparator.INSTANCE.compare(t1, t2); + JiemamyElement e1 = resolver.resolve(o1); + JiemamyElement e2 = resolver.resolve(o2); + return JiemamyElementComparator.INSTANCE.compare(e1, e2); } } @@ -220,7 +211,7 @@ public <T>T newInstance(Jiemamy jiemamy, UUID id) { RootModelImpl rootModel = new RootModelImpl(jiemamy, id); rootModel.setDomains(new ArrayList<DomainModel>()); - rootModel.setEntities(new TreeSet<EntityModel>(EntityComparator.INSTANCE)); + rootModel.setEntities(new TreeSet<EntityModel>(JiemamyElementComparator.INSTANCE)); rootModel.setDataSets(new ArrayList<DataSetModel>()); return (T) rootModel; } @@ -338,7 +329,7 @@ public <T>T newInstance(Jiemamy jiemamy, UUID id) { DataSetModelImpl insertDataSetModel = new DataSetModelImpl(jiemamy, id); insertDataSetModel - .setRecords(new TreeMap<TableRef, List<RecordModel>>(new TableRefComparator(jiemamy))); + .setRecords(new TreeMap<TableRef, List<RecordModel>>(new ReferenceComparator(jiemamy))); return (T) insertDataSetModel; } }, Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultSqlEmitter.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultSqlEmitter.java 2009-02-11 17:34:17 UTC (rev 2653) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultSqlEmitter.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -18,12 +18,9 @@ */ package org.jiemamy.dialect; -import java.text.DateFormat; import java.util.List; -import java.util.Random; import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.SystemUtils; import org.jiemamy.ReferenceResolver; import org.jiemamy.model.RootModel; @@ -62,12 +59,6 @@ */ public class DefaultSqlEmitter implements SqlEmitter { - private static final String NL = SystemUtils.LINE_SEPARATOR; - - private Random rand = new Random(); - - private DateFormat df = DateFormat.getDateTimeInstance(); - private final DataTypeResolver dataTypeResolver; private ReferenceResolver referenceResolver; @@ -121,10 +112,10 @@ } /** - * TODO for daisuke + * CREATE SCHEMA文を出力する。 * - * @param schemaName - * @return + * @param schemaName スキーマ名 + * @return CREATE SCHEMA文 */ private SqlStatement emitCreateSchemaStatement(String schemaName) { List<Token> tokens = CollectionsUtil.newArrayList(); @@ -136,19 +127,24 @@ } /** - * TODO for daisuke + * DDLを出力する。 * - * @param entity - * @param config - * @return + * @param entity 対象エンティティ + * @param config 設定 + * @return DDL */ private SqlStatement emitDdl(EntityModel entity, EmitConfig config) { return EntityEmitStrategy.fromEntity(entity).emit(entity, dataTypeResolver, referenceResolver, tokenResolver); } + /** + * 属性の出力戦略。 + * + * @author daisuke + */ private enum AttributeEmitStrategy { - /***/ + /** カラムの出力戦略 */ COLUMN(ColumnModel.class) { @Override @@ -169,7 +165,7 @@ } }, - /***/ + /** 主キーの出力戦略 */ PK(PrimaryKeyModel.class) { @Override @@ -186,7 +182,7 @@ }, - /***/ + /** ユニークキーの出力戦略 */ UK(UniqueKeyModel.class) { @Override @@ -202,7 +198,7 @@ } }, - /***/ + /** 外部キーの出力戦略 */ FK(ForeignKeyModel.class) { @Override @@ -248,7 +244,7 @@ } }, - /***/ + /** NOT NULL制約の出力戦略 */ NN(NotNullConstraintModel.class) { @Override @@ -271,7 +267,7 @@ } }, - /***/ + /** CHECK制約の出力戦略 */ CHECK(CheckConstraintModel.class) { @Override @@ -289,17 +285,17 @@ }; /** - * TODO for daisuke + * 属性モデルから出力戦略を取得する。 * - * @param entity - * @return + * @param attribute 出力対象の属性モデル + * @return 出力戦略 */ - public static AttributeEmitStrategy fromAttribute(AttributeModel entity) { + public static AttributeEmitStrategy fromAttribute(AttributeModel attribute) { for (AttributeEmitStrategy s : values()) { - if (s.clazz == entity.getClass()) { + if (s.clazz == attribute.getClass()) { return s; } - for (Class<?> c : entity.getClass().getInterfaces()) { + for (Class<?> c : attribute.getClass().getInterfaces()) { if (s.clazz == c) { return s; } @@ -336,27 +332,33 @@ } /** - * TODO for daisuke + * 属性モデルからToken列を出力する。 * - * @param attributeModel + * @param attributeModel 属性モデル * @param resolver * @param referenceResolver - * @return + * @param tokenResolver + * @return Token列 */ public abstract List<Token> emit(AttributeModel attributeModel, DataTypeResolver resolver, ReferenceResolver referenceResolver, TokenResolver tokenResolver); } + /** + * エンティティの出力戦略。 + * + * @author daisuke + */ private enum EntityEmitStrategy { - /***/ + /** テーブルの出力戦略 */ TABLE(TableModel.class) { @Override - public SqlStatement emit(EntityModel entity, DataTypeResolver resolver, + public SqlStatement emit(EntityModel entityModel, DataTypeResolver resolver, ReferenceResolver referenceResolver, TokenResolver tokenResolver) { - TableModel tableModel = (TableModel) entity; + TableModel tableModel = (TableModel) entityModel; List<Token> tokens = CollectionsUtil.newArrayList(); tokens.add(Keyword.CREATE); tokens.add(Keyword.TABLE); @@ -376,13 +378,13 @@ } }, - /***/ + /** ビューの出力戦略 */ VIEW(ViewModel.class) { @Override - public SqlStatement emit(EntityModel entity, DataTypeResolver resolver, + public SqlStatement emit(EntityModel entityModel, DataTypeResolver resolver, ReferenceResolver referenceResolver, TokenResolver tokenResolver) { - ViewModel viewModel = (ViewModel) entity; + ViewModel viewModel = (ViewModel) entityModel; List<Token> tokens = CollectionsUtil.newArrayList(); tokens.add(Keyword.CREATE); tokens.add(Keyword.VIEW); @@ -395,10 +397,10 @@ }; /** - * TODO for daisuke + * エンティティモデルから出力戦略を取得する。 * - * @param entity - * @return + * @param entity 出力対象のエンティティモデル + * @return 出力戦略 */ public static EntityEmitStrategy fromEntity(EntityModel entity) { for (EntityEmitStrategy s : values()) { @@ -423,14 +425,15 @@ } /** - * TODO for daisuke + * エンティティモデルからToken列を出力する。 * - * @param entity + * @param entityModel エンティティモデル * @param resolver * @param referenceResolver - * @return + * @param tokenResolver + * @return Token列 */ - public abstract SqlStatement emit(EntityModel entity, DataTypeResolver resolver, + public abstract SqlStatement emit(EntityModel entityModel, DataTypeResolver resolver, ReferenceResolver referenceResolver, TokenResolver tokenResolver); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AnnotationUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AnnotationUtil.java 2009-02-11 17:34:17 UTC (rev 2653) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AnnotationUtil.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -20,22 +20,28 @@ import java.lang.annotation.Annotation; -import org.jiemamy.model.Adapter; - /** - * TODO for daisuke + * アノテーションを処理するユーティリティクラス。 * * @author daisuke */ public class AnnotationUtil { + /** + * target自身の型、及びそのインターフェイスのいずれかが持つアノテーションを取得する。 + * + * @param <T> アノテーションの型 + * @param target 調査対象オブジェクト + * @param annotationClass アノテーションの型 + * @return 取得したアノテーション + */ public static <T extends Annotation>T getTypeAnnotation(Object target, Class<T> annotationClass) { - Adapter classAnnotation = target.getClass().getAnnotation(Adapter.class); + Annotation classAnnotation = target.getClass().getAnnotation(annotationClass); if (classAnnotation != null) { return annotationClass.cast(classAnnotation); } for (Class<?> interf : target.getClass().getInterfaces()) { - Adapter interfaceAnnotation = interf.getAnnotation(Adapter.class); + Annotation interfaceAnnotation = interf.getAnnotation(annotationClass); if (interfaceAnnotation != null) { return annotationClass.cast(interfaceAnnotation); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DomUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DomUtil.java 2009-02-11 17:34:17 UTC (rev 2653) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DomUtil.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -23,8 +23,6 @@ import javax.xml.namespace.QName; import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -39,9 +37,6 @@ */ public final class DomUtil { - private static Logger logger = LoggerFactory.getLogger(DomUtil.class); - - /** * TODO for daisuke * Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ListUtils.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ListUtils.java 2009-02-11 17:34:17 UTC (rev 2653) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ListUtils.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -22,12 +22,17 @@ import java.util.List; /** - * TODO for daisuke + * {@link List}を扱うユーティリティクラス。 * * @author daisuke */ public class ListUtils { + /** + * リストの順序を反転させる。 + * + * @param list 対象リスト + */ public static void reverse(List<?> list) { int center = list.size() / 2; int end = list.size() - 1; Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/XpathUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/XpathUtil.java 2009-02-11 17:34:17 UTC (rev 2653) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/XpathUtil.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -23,8 +23,6 @@ import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.w3c.dom.Attr; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -42,13 +40,18 @@ /** XPathインスタンス */ public static final XPath XPATH = XPathFactory.newInstance().newXPath(); - private static Logger logger = LoggerFactory.getLogger(XpathUtil.class); - static { XPATH.setNamespaceContext(new JiemamyNamespaceContext()); } + /** + * XPath式で特定される{@link Attr}を取得する。 + * + * @param root 対象ノード + * @param strExpr XPath式 + * @return 取得した {@link Attr} + */ public static Attr getAttr(Node root, String strExpr) { try { return (Attr) XPATH.evaluate(strExpr, root, XPathConstants.NODE); @@ -60,7 +63,7 @@ /** * XPath式で特定される{@link Node}を取得する。 * - * @param root + * @param root 対象ノード * @param strExpr XPath式 * @return 取得した {@link Node} */ @@ -75,7 +78,7 @@ /** * XPath式で特定される{@link NodeList}を取得する。 * - * @param root + * @param root 対象ノード * @param strExpr XPath式 * @return 取得した {@link NodeList} */ @@ -90,7 +93,7 @@ /** * XPath式で特定される文字列を取得する。 * - * @param root + * @param root 対象ノード * @param strExpr XPath式 * @return 取得した文字列 */ @@ -103,16 +106,19 @@ } } + /** + * XPath式で特定されるノードの内容文字列を取得する。 + * + * @param root 対象ノード + * @param strExpr XPath式 + * @return 取得した文字列 + */ public static String getTextContent(Node root, String strExpr) { try { Node node = (Node) XPATH.evaluate(strExpr, root, XPathConstants.NODE); if (node == null) { return null; } - NodeList nullNodes = getNodes(node, "core:nullValue"); - if (nullNodes.getLength() > 0) { - return null; - } return node.getTextContent(); } catch (XPathExpressionException e) { throw new UnexpectedConditionError("XPath expression error: " + strExpr, e); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java 2009-02-11 17:34:17 UTC (rev 2653) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -53,7 +53,7 @@ /** * TODO for daisuke - * + * @param rootModel * @param refId * @return */ Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/dialect/DefaultSqlEmitterTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/dialect/DefaultSqlEmitterTest.java 2009-02-11 17:34:17 UTC (rev 2653) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/dialect/DefaultSqlEmitterTest.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -31,7 +31,7 @@ import org.jiemamy.test.TestModelBuilder2; /** - * TODO for daisuke + * {@link DefaultSqlEmitter}のテストクラス。 * * @author daisuke */ @@ -45,7 +45,7 @@ /** - * TODO for daisuke + * setup * * @throws java.lang.Exception */ @@ -58,7 +58,7 @@ } /** - * TODO for daisuke + * teardown * * @throws java.lang.Exception */ Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/XpathUtilTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/XpathUtilTest.java 2009-02-11 17:34:17 UTC (rev 2653) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/XpathUtilTest.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -31,8 +31,6 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.w3c.dom.Document; /** @@ -42,8 +40,6 @@ */ public class XpathUtilTest { - private static Logger logger = LoggerFactory.getLogger(XpathUtilTest.class); - private static final String XML = // "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" // + "<root xmlns=\"http://jiemamy.org/xml/ns/core\" xmlns:view=\"http://jiemamy.org/xml/ns/view\">\n" // Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/xml/JiemamyNamespaceContextTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/xml/JiemamyNamespaceContextTest.java 2009-02-11 17:34:17 UTC (rev 2653) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/xml/JiemamyNamespaceContextTest.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -26,7 +26,7 @@ import org.junit.Test; /** - * TODO for daisuke + * {@link JiemamyNamespaceContext}のテストクラス。 * * @author daisuke */ @@ -36,7 +36,7 @@ /** - * TODO for daisuke + * setup * * @throws java.lang.Exception */ @@ -46,7 +46,7 @@ } /** - * TODO for daisuke + * teardown * * @throws java.lang.Exception */ Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewFactoryExtensionEnhancer.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewFactoryExtensionEnhancer.java 2009-02-11 17:34:17 UTC (rev 2653) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewFactoryExtensionEnhancer.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -110,7 +110,7 @@ ForeignKeyModel f1 = o1.unwrap(); ForeignKeyModel f2 = o2.unwrap(); if (f1 != null && f2 != null) { - return FactoryExtension.ForeignKeyComparator.INSTANCE.compare(f1, f2); + return FactoryExtension.JiemamyElementComparator.INSTANCE.compare(f1, f2); } else if (f1 != null) { return 1; } else if (f2 != null) { @@ -150,7 +150,7 @@ EntityModel e1 = o1.unwrap(); EntityModel e2 = o2.unwrap(); if (e1 != null && e2 != null) { - return FactoryExtension.EntityComparator.INSTANCE.compare(e1, e2); + return FactoryExtension.JiemamyElementComparator.INSTANCE.compare(e1, e2); } else if (e1 != null) { return 1; } else if (e2 != null) { Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/editcommand/CommandListener.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/editcommand/CommandListener.java 2009-02-11 17:34:17 UTC (rev 2653) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/editcommand/CommandListener.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -1,3 +1,21 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/09 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ package org.jiemamy.editcommand; import org.jiemamy.EventBroker; Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/formatter/SqlFormatter.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/formatter/SqlFormatter.java 2009-02-11 17:34:17 UTC (rev 2653) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/formatter/SqlFormatter.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -21,17 +21,17 @@ import org.jiemamy.model.sql.SqlStatement; /** - * TODO for daisuke + * SQLを整形するフォーマッタインターフェイス。 * * @author daisuke */ public interface SqlFormatter { /** - * TODO for daisuke + * SQL文字列に整形する。 * - * @param tokens - * @return + * @param stmt SQL文 + * @return 整形済みSQL文字列 */ String format(SqlStatement stmt); Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/Adapter.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/Adapter.java 2009-02-11 17:34:17 UTC (rev 2653) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/Adapter.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -34,6 +34,11 @@ @Target(ElementType.TYPE) public @interface Adapter { + /** + * アダプタの種類。 + * + * @return アダプタの種類 + */ AdapterType value(); } Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DataTypeCategory.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DataTypeCategory.java 2009-02-11 17:34:17 UTC (rev 2653) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DataTypeCategory.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -85,10 +85,10 @@ OTHER(Types.OTHER, LiteralType.CHARACTER); /** - * TODO for daisuke + * {@link Types}の値から、カテゴリを取得する。 * - * @param sqlType - * @return + * @param sqlType {@link Types}の値 + * @return カテゴリ */ public static DataTypeCategory fromSqlType(int sqlType) { for (DataTypeCategory category : values()) { @@ -111,9 +111,9 @@ } /** - * TODO for daisuke + * このカテゴリのリテラルの種類を取得する。 * - * @return + * @return リテラルの種類 */ public LiteralType getLiteralType() { return literalType; Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/LiteralType.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/LiteralType.java 2009-02-11 17:34:17 UTC (rev 2653) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/LiteralType.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -1,109 +1,115 @@ package org.jiemamy.model.datatype; /** - * TODO for daisuke + * リテラルの種類。 * * @author daisuke */ public enum LiteralType { - /***/ + /** 文字(列)リテラル */ CHARACTER { @Override - public String convert(String string) { - if (string == null) { + public String convert(String value) { + if (value == null) { return "NULL"; } - return "'" + string + "'"; + return "'" + value + "'"; } }, - /***/ + /** 数字リテラル */ NUMERIC { @Override - public String convert(String string) { - if (string == null) { + public String convert(String value) { + if (value == null) { return "NULL"; } - return string; + return value; } }, - /***/ + /** 真偽値リテラル */ BOOLEAN { @Override - public String convert(String string) { - if (string == null) { + public String convert(String value) { + if (value == null) { return "NULL"; } - return string; + return value; } }, - /***/ + /** 日付リテラル */ DATE { @Override - public String convert(String string) { - if (string == null) { + public String convert(String value) { + if (value == null) { return "NULL"; } - return "DATE '" + string + "'"; + return "DATE '" + value + "'"; } }, - /***/ + /** 時間リテラル */ TIME { @Override - public String convert(String string) { - if (string == null) { + public String convert(String value) { + if (value == null) { return "NULL"; } - return "TIME '" + string + "'"; + return "TIME '" + value + "'"; } }, - /***/ + /** タイムスタンプリテラル */ TIMESTAMP { @Override - public String convert(String string) { - if (string == null) { + public String convert(String value) { + if (value == null) { return "NULL"; } - return "TIMESTAMP '" + string + "'"; + return "TIMESTAMP '" + value + "'"; } }, - /***/ + /** インターバルリテラル */ INTERVAL { @Override - public String convert(String string) { - if (string == null) { + public String convert(String value) { + if (value == null) { return "NULL"; } - return "INTERVAL " + string; + return "INTERVAL " + value; } }, - /***/ + /** NULLリテラル */ NULL { @Override - public String convert(String string) { + public String convert(String value) { return "NULL"; } }, - /***/ + /** SQLフラグメント */ FRAGMENT { @Override - public String convert(String string) { - if (string == null) { + public String convert(String value) { + if (value == null) { return ""; } - return string; + return value; } }; - public abstract String convert(String string); + /** + * 値をリテラル表記に変換する。 + * + * @param value 値 + * @return リテラル表記 + */ + public abstract String convert(String value); } Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/Adaptable.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/Adaptable.java 2009-02-11 17:34:17 UTC (rev 2653) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/Adaptable.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -75,7 +75,7 @@ * @param adapter 登録するアダプタ * @throws UnsupportedOperationException * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - * @throws IllegalArgumentException 引数のクラスに {@link ModelAdapter}, {@link LogicAdapter}いずれのアノテーションもついていない場合 + * @throws IllegalArgumentException 引数のクラスに{@link Adapter}アノテーションがついていない場合 */ void registerAdapter(Object adapter); } Modified: zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/NodeProfile.java =================================================================== --- zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/NodeProfile.java 2009-02-11 17:34:17 UTC (rev 2653) +++ zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/NodeProfile.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -40,8 +40,18 @@ */ JmRectangle getLayout(); + /** + * ノードの色情報を設定する。 + * + * @param color ノードの色情報 + */ void setColor(JmColor color); + /** + * ノードのレイアウト情報を設定する。 + * + * @param layout ノードのレイアウト情報 + */ void setLayout(JmRectangle layout); } Modified: zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/geometory/JmColor.java =================================================================== --- zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/geometory/JmColor.java 2009-02-11 17:34:17 UTC (rev 2653) +++ zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/geometory/JmColor.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -39,10 +39,12 @@ /** - * TODO for daisuke + * 文字列から{@link JmColor}を取得する。 * - * @param value - * @return + * <p>入力は、"#xxxxxx"形式の文字列とする。</p> + * + * @param value 文字列 + * @return {@link JmColor} */ public static JmColor parse(String value) { if (value == null || value.length() != 7) { Modified: zeus/trunk/jiemamy-spec-view/src/test/java/org/jiemamy/model/geometory/JmColorTest.java =================================================================== --- zeus/trunk/jiemamy-spec-view/src/test/java/org/jiemamy/model/geometory/JmColorTest.java 2009-02-11 17:34:17 UTC (rev 2653) +++ zeus/trunk/jiemamy-spec-view/src/test/java/org/jiemamy/model/geometory/JmColorTest.java 2009-02-11 18:32:45 UTC (rev 2654) @@ -50,6 +50,11 @@ public void tearDown() throws Exception { } + /** + * {@link #toString()}のテスト。 + * + * @throws Exception + */ @Test public void test01_toString() throws Exception { assertThat(new JmColor(0, 0, 0).toString(), is("#000000")); @@ -60,6 +65,11 @@ assertThat(new JmColor(255, 255, 255).toString(), is("#ffffff")); } + /** + * {@link JmColor#parse(String)}のテスト。 + * + * @throws Exception + */ @Test public void test02_parse() throws Exception { assertThat(JmColor.parse("#000000"), is(new JmColor(0, 0, 0)));