/** * Utility to check whether this class is consistent in a "merged" context * * @return a ConsistencyCheck instance whose boolean attribute (consistent) * indicates if this class is consistent and whose String attribute * (message) * indicates why this class is not consistent if it is not */ @Override public ConsistencyCheck modelConsistency() { BitSet intersection = new BitSet(this.minBitset.length()); intersection.or(this.minBitset); // we create a copy of minBitSet intersection.and(this.currentBitset); boolean consistent = (this.minBitset.equals(intersection)); StringBuilder message = new StringBuilder(""); if (!consistent) { message.append(getMessageForConsistency(this.minBitset)); } return new ConsistencyCheck(consistent, message.toString()); }
/** * Utility to check whether this class is consistent according to a subset * * @param subset * the subset defining the context in which to check whether this class is consistent * @return a ConsistencyCheck instance whose boolean attribute (consistent) * indicates if this class is consistent and whose String attribute * (message) * indicates why this class is not consistent if it is not */ @Override public ConsistencyCheck modelConsistency(final Subset subset) { BitSet intersection = new BitSet(this.minBitsets.get(subset).length()); intersection.or(this.minBitsets.get(subset)); // we create a copy of minBitsets.get(subset) intersection.and(this.currentBitset); boolean consistent = (this.minBitsets.get(subset).equals(intersection)); StringBuilder message = new StringBuilder(""); if (!consistent) { message.append(getMessageForConsistency(this.minBitsets.get(subset))); } return new ConsistencyCheck(consistent, message.toString()); }