Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#82 Make OWLAxiomChange.isAdd() public

closed
nobody
None
5
2012-11-17
2012-11-07
Anonymous
No

Currently the OWLAxiomChange.isAdd() is protected.

This makes me write such code:
if (change instanceof AddAxiom) {}
instead of
if (change.isAdd()) {}

Using instanceof is considered in most cases a bad practice.

By the way, isAxiomChange() and isImportChange() are public.

Discussion

  • In most uses of instanceof AddAxiom|RemoveAxiom, the variable is an OWLOntologyChange, so replacement requires the method to be moved one level up. A Visitor would be nice, but all in all I don't think there is enough to be gained from that, so I'll just move the method up and see if any more are needed.

     
    • status: open --> closed
     
  • Correction: a visitor is there, so technically all variations of is...() methods could be implemented with a few visitors. For convenience and uniformity, I've added isAddAxiom/isRemoveAxiom and upgraded most of the instanceof checks.