Skip to content

Commit

Permalink
#20052 対応
Browse files Browse the repository at this point in the history
  • Loading branch information
nakag committed Oct 11, 2015
1 parent f01a058 commit a30bbba
Show file tree
Hide file tree
Showing 29 changed files with 942 additions and 186 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
/*
* Copyright 2009-2015 TMD-Maker Project <http://tmdmaker.sourceforge.jp/>
*
* 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 jp.sourceforge.tmdmaker.model;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import jp.sourceforge.tmdmaker.model.other.Memo;

/**
* モデル毎の特徴の差異のテスト
*
* @author nakag
*
*/
public class ModelFeatureTest {
/**
* モデル毎のサブセットの作成可否をテスト
*/
@Test
public void testCanCreateSubset() {
CombinationTable t = new CombinationTable();
assertEquals(true, t.canCreateSubset());

Entity e = new Entity();
assertEquals(true, e.canCreateSubset());

Detail d = new Detail();
assertEquals(true, d.canCreateSubset());

Laputa l = new Laputa();
assertEquals(false, l.canCreateSubset());

MappingList m = new MappingList();
assertEquals(true, m.canCreateSubset());

MultivalueAndSuperset ms = new MultivalueAndSuperset();
assertEquals(false, ms.canCreateSubset());

MultivalueOrEntity mo = new MultivalueOrEntity();
assertEquals(true, mo.canCreateSubset());

RecursiveTable r = new RecursiveTable();
assertEquals(true, r.canCreateSubset());

SubsetEntity s = new SubsetEntity();
assertEquals(true, s.canCreateSubset());

VirtualEntity v = new VirtualEntity();
assertEquals(false, v.canCreateSubset());

VirtualSuperset vs = new VirtualSuperset();
assertEquals(false, vs.canCreateSubset());

Memo mm = new Memo();
assertEquals(false, mm.canCreateSubset());

}

/**
* モデル毎の多値のOR作成可否をテスト
*/
@Test
public void testCanCreateMultivalueOr() {
CombinationTable t = new CombinationTable();
assertEquals(true, t.canCreateMultivalueOr());

Entity e = new Entity();
assertEquals(true, e.canCreateMultivalueOr());

Detail d = new Detail();
assertEquals(true, d.canCreateMultivalueOr());

Laputa l = new Laputa();
assertEquals(false, l.canCreateMultivalueOr());

MappingList m = new MappingList();
assertEquals(true, m.canCreateMultivalueOr());

MultivalueAndSuperset ms = new MultivalueAndSuperset();
assertEquals(false, ms.canCreateMultivalueOr());

MultivalueOrEntity mo = new MultivalueOrEntity();
assertEquals(true, mo.canCreateMultivalueOr());

RecursiveTable r = new RecursiveTable();
assertEquals(true, r.canCreateMultivalueOr());

SubsetEntity s = new SubsetEntity();
assertEquals(true, s.canCreateMultivalueOr());

VirtualEntity v = new VirtualEntity();
assertEquals(false, v.canCreateMultivalueOr());

VirtualSuperset vs = new VirtualSuperset();
assertEquals(false, vs.canCreateMultivalueOr());

Memo mm = new Memo();
assertEquals(false, mm.canCreateMultivalueOr());

}

/**
* モデル毎のみなしエンティティ作成可否をテスト
*/
@Test
public void testCanCreateVirtualEntity() {
CombinationTable t = new CombinationTable();
assertEquals(true, t.canCreateVirtualEntity());

Entity e = new Entity();
assertEquals(true, e.canCreateVirtualEntity());

Detail d = new Detail();
assertEquals(true, d.canCreateVirtualEntity());

Laputa l = new Laputa();
assertEquals(false, l.canCreateVirtualEntity());

MappingList m = new MappingList();
assertEquals(true, m.canCreateVirtualEntity());

MultivalueAndSuperset ms = new MultivalueAndSuperset();
assertEquals(false, ms.canCreateVirtualEntity());

MultivalueOrEntity mo = new MultivalueOrEntity();
assertEquals(true, mo.canCreateVirtualEntity());

RecursiveTable r = new RecursiveTable();
assertEquals(true, r.canCreateVirtualEntity());

SubsetEntity s = new SubsetEntity();
assertEquals(true, s.canCreateVirtualEntity());

VirtualEntity v = new VirtualEntity();
assertEquals(false, v.canCreateVirtualEntity());

VirtualSuperset vs = new VirtualSuperset();
assertEquals(false, vs.canCreateVirtualEntity());

Memo mm = new Memo();
assertEquals(false, mm.canCreateVirtualEntity());

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public Map<AbstractEntityModel, ReusedIdentifier> getReusedIdentifieres() {
* @param reusedIdentifieres
* the reusedIdentifieres to set
*/
public void setReusedIdentifieres(Map<AbstractEntityModel, ReusedIdentifier> reusedIdentifieres) {
public void setReusedIdentifieres(
Map<AbstractEntityModel, ReusedIdentifier> reusedIdentifieres) {
this.reusedIdentifieres = reusedIdentifieres;
}

Expand Down Expand Up @@ -226,12 +227,14 @@ public SubsetType findSubsetType() {
* @return VirtualSupersetType。存在しない場合はnullを返す。
*/
public VirtualSupersetType findVirtualSupersetType() {
List<AbstractConnectionModel> results = findRelationshipFromSourceConnections(Entity2VirtualSupersetTypeRelationship.class);
List<AbstractConnectionModel> results = findRelationshipFromSourceConnections(
Entity2VirtualSupersetTypeRelationship.class);
if (results.size() != 0) {
return (VirtualSupersetType) ((Entity2VirtualSupersetTypeRelationship) results.get(0))
.getTarget();
}
results = findRelationshipFromTargetConnections(Entity2VirtualSupersetTypeRelationship.class);
results = findRelationshipFromTargetConnections(
Entity2VirtualSupersetTypeRelationship.class);
if (results.size() != 0) {
return (VirtualSupersetType) ((Entity2VirtualSupersetTypeRelationship) results.get(0))
.getTarget();
Expand Down Expand Up @@ -564,4 +567,35 @@ private void removeSubsetTypeIfEmpty(SubsetType subsetType) {
getDiagram().removeChild(subsetType);
}
}

/**
* {@inheritDoc}
*
* @see jp.sourceforge.tmdmaker.model.ModelElement#canCreateSubset()
*/
@Override
public boolean canCreateSubset() {
return true;
}

/**
* {@inheritDoc}
*
* @see jp.sourceforge.tmdmaker.model.ModelElement#canCreateMultivalueOr()
*/
@Override
public boolean canCreateMultivalueOr() {
return true;
}

/**
* {@inheritDoc}
*
* @see jp.sourceforge.tmdmaker.model.ModelElement#canCreateVirtualEntity()
*/
@Override
public boolean canCreateVirtualEntity() {
return true;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2010 TMD-Maker Project <http://tmdmaker.sourceforge.jp/>
* Copyright 2009-2015 TMD-Maker Project <http://tmdmaker.sourceforge.jp/>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,7 +32,8 @@ public enum EntityType {
MA("多値のAND", "MA"),
/** みなしエンティティ */
VE("みなしエンティティ", "VE"),
LAPUTA("ラピュタ", "");
LAPUTA("ラピュタ", ""),
TURBO("ターボファイル", "TB");

/** ダイアグラム表示用 */
private String label;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2014 TMD-Maker Project <http://tmdmaker.sourceforge.jp/>
* Copyright 2009-2015 TMD-Maker Project <http://tmdmaker.sourceforge.jp/>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,7 @@
package jp.sourceforge.tmdmaker.model;

import jp.sourceforge.tmdmaker.model.other.Memo;
import jp.sourceforge.tmdmaker.model.other.TurboFile;

/**
* Visitorパターンの訪問者側
Expand Down Expand Up @@ -51,4 +52,6 @@ public interface IVisitor {
void visit(VirtualSuperset entity);
void visit(VirtualSupersetType type);
void visit(Memo model);
void visit(TurboFile entity);
void visit(TurboFileRelationship relationship);
}
44 changes: 43 additions & 1 deletion tmdmaker.core/src/jp/sourceforge/tmdmaker/model/Laputa.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2010 TMD-Maker Project <http://tmdmaker.sourceforge.jp/>
* Copyright 2009-2015 TMD-Maker Project <http://tmdmaker.sourceforge.jp/>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -96,4 +96,46 @@ public boolean isEntityTypeEditable() {
public void accept(IVisitor visitor) {
visitor.visit(this);
}

/**
* {@inheritDoc}
*
* @see jp.sourceforge.tmdmaker.model.AbstractEntityModel#isNotImplement()
*/
@Override
public boolean isNotImplement() {
// Laputaは実装しない
return true;
}

/**
* {@inheritDoc}
*
* @see jp.sourceforge.tmdmaker.model.AbstractEntityModel#canCreateSubset()
*/
@Override
public boolean canCreateSubset() {
return false;
}

/**
* {@inheritDoc}
*
* @see jp.sourceforge.tmdmaker.model.AbstractEntityModel#canCreateMultivalueOr()
*/
@Override
public boolean canCreateMultivalueOr() {
return false;
}

/**
* {@inheritDoc}
*
* @see jp.sourceforge.tmdmaker.model.AbstractEntityModel#canCreateVirtualEntity()
*/
@Override
public boolean canCreateVirtualEntity() {
return false;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2010 TMD-Maker Project <http://tmdmaker.sourceforge.jp/>
* Copyright 2009-2015 TMD-Maker Project <http://tmdmaker.sourceforge.jp/>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -115,4 +115,28 @@ public void move(int x, int y) {
newPosition.y = y;
setConstraint(newPosition);
}
/**
* サブセットを作成可能か?
*
* @return サブセットを作成可能な場合はtrueを返す
*/
public boolean canCreateSubset() {
return false;
}
/**
* 多値のORを作成可能か?
*
* @return 多値のORを作成可能な場合はtrueを返す
*/
public boolean canCreateMultivalueOr() {
return false;
}
/**
* みなしエンティティを作成可能か?
*
* @return みなしエンティティを作成可能な場合はtrueを返す
*/
public boolean canCreateVirtualEntity() {
return false;
}
}

0 comments on commit a30bbba

Please sign in to comment.