1// BEGIN LICENSE BLOCK 2// Version: CMPL 1.1 3// 4// The contents of this file are subject to the Cisco-style Mozilla Public 5// License Version 1.1 (the "License"); you may not use this file except 6// in compliance with the License. You may obtain a copy of the License 7// at www.eclipse-clp.org/license. 8// 9// Software distributed under the License is distributed on an "AS IS" 10// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 11// the License for the specific language governing rights and limitations 12// under the License. 13// 14// The Original Code is CPViz Constraint Visualization System 15// The Initial Developer of the Original Code is Helmut Simonis 16// Portions created by the Initial Developer are 17// Copyright (C) 2009-2010 Helmut Simonis 18// 19// Contributor(s): Helmut Simonis, 4C, Univerity College Cork, Cork 20// 21// 22// END LICENSE BLOCK 23// ---------------------------------------------------------------------- 24package ie.ucc.cccc.viz; 25 26/** 27 * This enum describes the different results of the invariant checks for the visualizers. 28 * @author hsimonis 29 * 30 */ 31public enum InvariantType { 32 /** 33 * the invariant checker succeeded 34 */ 35 TRUE, 36 /** 37 * the invariant checker detects something interesting 38 */ 39 INTERESTING, 40 /** 41 * the invariant checker detected some missing propagation 42 */ 43 MISSING_PROPAGATION, 44 /** 45 * a partial assignment is inconsistent 46 */ 47 INCONSISTENT, 48 /** 49 * the ground instance should not be satisfied 50 */ 51 FALSE; 52 53 /** 54 * Compute the maximum severity of the current and a new violation. This is simple 55 * stratified by level, 56 * no clever attempts to maximize performance 57 * @param update InvariantType 58 * @return InvariantType the stronger of the current and the new type 59 */ 60 InvariantType update(InvariantType update){ 61 if (this == FALSE || update == FALSE) { 62 return FALSE; 63 } else if (this == INCONSISTENT || update == INCONSISTENT) { 64 return INCONSISTENT; 65 } else if (this == MISSING_PROPAGATION || update == MISSING_PROPAGATION) { 66 return MISSING_PROPAGATION; 67 } else if (this == INTERESTING || update == INTERESTING) { 68 return INTERESTING; 69 } else { 70 return TRUE; 71 } 72 } 73} 74