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 public class RepairOrderDAGNode extends DoubleLinkedDAGNode { 00031 00032 Component comp; 00033 00034 public RepairOrderDAGNode(Component comp) { 00035 this.comp = comp; 00036 } 00037 00038 /* 00039 * Creates a clone of node. 00040 */ 00041 public RepairOrderDAGNode(RepairOrderDAGNode node) { 00042 super(node); 00043 this.comp = node.comp; 00044 } 00045 00046 public Object clone() { 00047 RepairOrderDAGNode node = new RepairOrderDAGNode(this); 00048 return node; 00049 } 00050 00051 public String toString() { 00052 return comp.getName(); 00053 } 00054 00055 protected boolean invariant() { 00056 00057 Iterator itParents = getParentsIterator(); 00058 while (itParents.hasNext()) { 00059 RepairOrderDAGNode parentNode = (RepairOrderDAGNode)itParents.next(); 00060 if (!comp.hasFDGParent(parentNode.comp)) return false; 00061 } 00062 00063 return true; 00064 } 00065 00066 public boolean equals(Object o) { 00067 if (!(o instanceof RepairOrderDAGNode)) return false; 00068 else { 00069 RepairOrderDAGNode otherNode = (RepairOrderDAGNode)o; 00070 boolean result = (comp.equals(otherNode.comp)); 00071 assert(result == (comp.name.equals(otherNode.comp.name))); 00072 return result; 00073 } 00074 } 00075 }