ConflictSet.java
Go to the documentation of this file.
00001 /*
00002  * (c) copyright 2008, Technische Universitaet Graz and Technische Universitaet Wien
00003  *
00004  * This file is part of jdiagengine.
00005  *
00006  * jdiagengine is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, either version 3 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * jdiagengine is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * You should have received a copy of the GNU General Public License
00016  * along with jdiagengine. If not, see <http://www.gnu.org/licenses/>.
00017  *
00018  * Authors: Joerg Weber, Franz Wotawa
00019  * Contact: jweber@ist.tugraz.at (preferred), or fwotawa@ist.tugraz.at
00020  *
00021  */
00022 
00023 
00024 package dfengine;
00025 
00026 import java.util.*;
00027 
00028 import utils.*;
00029 
00030 
00031 
00032 public class ConflictSet extends ModeAssignment {
00033 
00034     /*
00035      * This algorithm determines if this conflict set conflicts with ma, i.e.,
00036      * if "SDD |_| OBS |_| ma " must be inconsistent.
00037      *
00038      * Note: if a component c is not in ma, then NAB(c) is assumed to be implicitely in ma.
00039      *
00040      * Precondition: ma must not contain any "AB".
00041      */
00042     public boolean conflictsWith(ModeAssignment ma) {
00043 
00044         assert(!ma.hasMode(Mode.MODE_AB));
00045 
00046         Iterator itPairs = modes.values().iterator();
00047         while (itPairs.hasNext()) {
00048             ModeNodePair pair = (ModeNodePair)itPairs.next();
00049             Component c = pair.mode.getComponent();
00050             Mode om = ma.getMode(c);
00051             if (om == null) om = c.getModeNAB();
00052 
00053             if ((om != pair.mode) && !(((pair.mode.getType() == Mode.MODE_IF)) && (om.getType() == Mode.MODE_DF))) {
00054                 return false;
00055             }
00056         }
00057 
00058         //System.out.println("CS conflicts with mode assignment! CS: [" + this.toStringShort() + "];  MA: [" + ma.toStringShort() + "]");
00059 
00060         return true;
00061     }
00062 
00063 }


tug_ist_diagnosis_engine
Author(s): Safdar Zaman, Gerald Steinbauer
autogenerated on Mon Jan 6 2014 11:51:16