@Override public final boolean updateOccurrenceNumbers(ModifiableOntologyIndex index, OccurrenceIncrement increment) { if (negativeOccurrenceNo == 0 && increment.negativeIncrement > 0) { // first negative occurrence of this expression if (!ObjectUnionFromDisjunctRule.addRulesFor(this, index)) return false; } positiveOccurrenceNo += increment.positiveIncrement; negativeOccurrenceNo += increment.negativeIncrement; checkOccurrenceNumbers(); if (negativeOccurrenceNo == 0 && increment.negativeIncrement < 0) { // no negative occurrences of this expression left if (!ObjectUnionFromDisjunctRule.removeRulesFor(this, index)) { // revert all changes positiveOccurrenceNo -= increment.positiveIncrement; negativeOccurrenceNo -= increment.negativeIncrement; return false; } } for (int i = 0; i < Math.abs(increment.positiveIncrement); i++) { // for each indexed positive occurrence of this expression index.onIndexing(Occurrence.POSITIVE_OCCURRENCE_OF_OBJECT_UNION_OF); } return true; }
@Override public final boolean updateOccurrenceNumbers(ModifiableOntologyIndex index, OccurrenceIncrement increment) { if (negativeOccurrenceNo == 0 && increment.negativeIncrement > 0) { // first negative occurrence of this expression if (!ObjectUnionFromDisjunctRule.addRulesFor(this, index)) return false; } positiveOccurrenceNo += increment.positiveIncrement; negativeOccurrenceNo += increment.negativeIncrement; checkOccurrenceNumbers(); if (negativeOccurrenceNo == 0 && increment.negativeIncrement < 0) { // no negative occurrences of this expression left if (!ObjectUnionFromDisjunctRule.removeRulesFor(this, index)) { // revert all changes positiveOccurrenceNo -= increment.positiveIncrement; negativeOccurrenceNo -= increment.negativeIncrement; return false; } } for (int i = 0; i < Math.abs(increment.positiveIncrement); i++) { // for each indexed positive occurrence of this expression index.onIndexing(Occurrence.POSITIVE_OCCURRENCE_OF_OBJECT_UNION_OF); } return true; }
@Override public final boolean updateOccurrenceNumbers(ModifiableOntologyIndex index, OccurrenceIncrement increment) { if (negativeOccurrenceNo == 0 && increment.negativeIncrement > 0) { // first negative occurrence of this expression if (!ObjectUnionFromDisjunctRule.addRulesFor(this, index)) return false; } positiveOccurrenceNo += increment.positiveIncrement; negativeOccurrenceNo += increment.negativeIncrement; checkOccurrenceNumbers(); if (negativeOccurrenceNo == 0 && increment.negativeIncrement < 0) { // no negative occurrences of this expression left if (!ObjectUnionFromDisjunctRule.removeRulesFor(this, index)) { // revert all changes positiveOccurrenceNo -= increment.positiveIncrement; negativeOccurrenceNo -= increment.negativeIncrement; return false; } } for (int i = 0; i < Math.abs(increment.positiveIncrement); i++) { // for each indexed positive occurrence of this expression index.onIndexing(Occurrence.POSITIVE_OCCURRENCE_OF_OBJECT_UNION_OF); } return true; }