SoftwareEngineering

テーブル駆動方式

Java

  • createDecisionTableKey
    /**
     * デシジョンテーブルのキーを作成します。
     * 作成日 : (2014/02/19 11:57:13)
     * @return java.util.ArrayList
     * @param key java.lang.String
     */
    private ArrayList createDecisionTableKey(String key) {
        ArrayList list = new ArrayList(1);
        list.add(key);
        return list;
    }
     
    /**
     * デシジョンテーブルのキーを作成します。
     * 作成日 : (2013/05/24 14:17:39)
     * @return java.util.ArrayList
     * @param keys java.lang.String[]
     */
    private ArrayList createDecisionTableKeys(String[] keys) {
        ArrayList list = new ArrayList(keys.length);
    
        for (int index = 0; index < keys.length; index++) {
            list.add(keys[index]);
        }
        
        return list;
    }
  • keyFrom
    /**
     * ハッシュテーブルの参照キーに○○を変換します。
     * 作成日 : (2013/05/17 13:59:11)
     * @return ArrayList
     * @param idoJiyu java.lang.String
     */
    private ArrayList keyFrom○○(final String value) {
        String key = value.trim();
        if (EqualsUtil.areEqual("", key)) key = "未選択";
        
        ArrayList list = new ArrayList(1);
        list.add(key);
        
        return list;
    }
  • createEnableRuleTable
    private void createEnableRuleTable() {
        this.enableRuleTable = new HashMap();
        this.enableRuleTable.put(this.createDecisionTableKeys(new String[] {"参照", "無", "無"}), new Boolean[] {Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.TRUE , Boolean.FALSE, Boolean.FALSE});
        this.enableRuleTable.put(this.createDecisionTableKeys(new String[] {"参照", "有", "無"}), new Boolean[] {Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.TRUE , Boolean.FALSE, Boolean.FALSE});
        this.enableRuleTable.put(this.createDecisionTableKeys(new String[] {"参照", "有", "有"}), new Boolean[] {Boolean.TRUE , Boolean.FALSE, Boolean.FALSE, Boolean.TRUE , Boolean.FALSE, Boolean.FALSE, Boolean.TRUE , Boolean.FALSE, Boolean.FALSE});
        this.enableRuleTable.put(this.createDecisionTableKeys(new String[] {"発行", "無", "無"}), new Boolean[] {Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.TRUE , Boolean.FALSE, Boolean.FALSE});
        this.enableRuleTable.put(this.createDecisionTableKeys(new String[] {"発行", "有", "無"}), new Boolean[] {Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.TRUE , Boolean.FALSE, Boolean.FALSE});
        this.enableRuleTable.put(this.createDecisionTableKeys(new String[] {"発行", "有", "有"}), new Boolean[] {Boolean.TRUE , Boolean.FALSE, Boolean.FALSE, Boolean.TRUE , Boolean.TRUE , Boolean.TRUE , Boolean.TRUE , Boolean.FALSE, Boolean.TRUE });
        this.enableRuleTable.put(this.createDecisionTableKeys(new String[] {"更新", "無", "無"}), new Boolean[] {Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, Boolean.TRUE , Boolean.FALSE, Boolean.FALSE});
        this.enableRuleTable.put(this.createDecisionTableKeys(new String[] {"更新", "有", "無"}), new Boolean[] {Boolean.FALSE, Boolean.TRUE , Boolean.FALSE, Boolean.FALSE, Boolean.TRUE , Boolean.FALSE, Boolean.TRUE , Boolean.TRUE , Boolean.TRUE });
        this.enableRuleTable.put(this.createDecisionTableKeys(new String[] {"更新", "有", "有"}), new Boolean[] {Boolean.TRUE , Boolean.TRUE , Boolean.TRUE , Boolean.TRUE , Boolean.TRUE , Boolean.TRUE , Boolean.TRUE , Boolean.TRUE , Boolean.TRUE });
    }
  • サンプル
    final Boolean[] enableRules = (Boolean[]) this.enableRuleTable.get(keyFrom○○(key));

デシジョンテーブル

縦横を入れ替えたバージョン

条件アクション
              
            
フッター
ケース1  FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
ケース2  FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
ケース3  TRUETRUETRUETRUETRUETRUETRUETRUETRUETRUETRUEFALSE
ケース4  TRUETRUETRUETRUETRUETRUEFALSEFALSETRUETRUETRUEFALSE
ケース5  FALSEFALSETRUETRUETRUETRUETRUETRUETRUETRUETRUETRUE
ケース6  FALSEFALSETRUETRUETRUETRUEFALSEFALSETRUETRUETRUETRUE

トップ   差分 バックアップ リロード   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2014-08-04 (月) 23:05:13 (1927d)