2 #include "util/unsat_core.h"
6 #include "bindings/java_iterator_adapter.h"
7 #include "bindings/java_stream_adapters.h"
12 %ignore CVC4::operator<<(std::ostream&, const UnsatCore&);
16 // Instead of UnsatCore::begin() and end(), create an
17 // iterator() method on the Java side that returns a Java-style
19 %ignore CVC4::UnsatCore::begin();
20 %ignore CVC4::UnsatCore::end();
21 %ignore CVC4::UnsatCore::begin() const;
22 %ignore CVC4::UnsatCore::end() const;
23 %extend CVC4::UnsatCore {
24 CVC4::JavaIteratorAdapter<CVC4::UnsatCore> iterator() {
25 return CVC4::JavaIteratorAdapter<CVC4::UnsatCore>(*$self);
29 // UnsatCore is "iterable" on the Java side
30 %typemap(javainterfaces) CVC4::UnsatCore "java.lang.Iterable<edu.nyu.acsys.CVC4.Expr>";
32 // the JavaIteratorAdapter should not be public, and implements Iterator
33 %typemap(javaclassmodifiers) CVC4::JavaIteratorAdapter<CVC4::UnsatCore> "class";
34 %typemap(javainterfaces) CVC4::JavaIteratorAdapter<CVC4::UnsatCore> "java.util.Iterator<edu.nyu.acsys.CVC4.Expr>";
35 // add some functions to the Java side (do it here because there's no way to do these in C++)
36 %typemap(javacode) CVC4::JavaIteratorAdapter<CVC4::UnsatCore> "
37 public void remove() {
38 throw new java.lang.UnsupportedOperationException();
41 public edu.nyu.acsys.CVC4.Expr next() {
45 throw new java.util.NoSuchElementException();
49 // getNext() just allows C++ iterator access from Java-side next(), make it private
50 %javamethodmodifiers CVC4::JavaIteratorAdapter<CVC4::UnsatCore>::getNext() "private";
52 // map the types appropriately
53 %typemap(jni) CVC4::UnsatCore::const_iterator::value_type "jobject";
54 %typemap(jtype) CVC4::UnsatCore::const_iterator::value_type "edu.nyu.acsys.CVC4.Expr";
55 %typemap(jstype) CVC4::UnsatCore::const_iterator::value_type "edu.nyu.acsys.CVC4.Expr";
56 %typemap(javaout) CVC4::UnsatCore::const_iterator::value_type { return $jnicall; }
60 %include "util/unsat_core.h"
64 %include "bindings/java_iterator_adapter.h"
65 %include "bindings/java_stream_adapters.h"
67 %template(JavaIteratorAdapter_UnsatCore) CVC4::JavaIteratorAdapter<CVC4::UnsatCore>;