Skip to content

Commit

Permalink
Add trimToSize to ConcurrentOWLOntologyImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
sesuncedu committed Jul 7, 2015
1 parent 2722ca1 commit 51635cd
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
import org.semanticweb.owlapi.model.parameters.Imports;
import org.semanticweb.owlapi.model.parameters.Navigation;
import org.semanticweb.owlapi.util.OWLAxiomSearchFilter;
import uk.ac.manchester.cs.owl.owlapi.HasTrimToSize;

/**
* Matthew Horridge Stanford Center for Biomedical Informatics Research 03/04/15
*/
public class ConcurrentOWLOntologyImpl implements OWLMutableOntology {
public class ConcurrentOWLOntologyImpl implements OWLMutableOntology,HasTrimToSize {

private final OWLOntology delegate;
private final ReadWriteLock readWriteLock;
Expand All @@ -50,6 +51,20 @@ public ConcurrentOWLOntologyImpl(@Nonnull OWLOntology delegate, @Nonnull ReadWri
this.writeLock = verifyNotNull(readWriteLock).writeLock();
}

@Override
public void trimToSize() {
writeLock.lock();
try {
if (delegate instanceof HasTrimToSize) {
HasTrimToSize trimmableDelegate = (HasTrimToSize) delegate;
trimmableDelegate.trimToSize();
}
} finally {
writeLock.unlock();
}

}

@Override
public void accept(@Nonnull OWLNamedObjectVisitor owlNamedObjectVisitor) {
delegate.accept(owlNamedObjectVisitor);
Expand Down

0 comments on commit 51635cd

Please sign in to comment.