Add --lte-restrict-inst-closure option. Push dt.size fairness constraints inside...
[cvc5.git] / src / util / unsat_core.i
1 %{
2 #include "util/unsat_core.h"
3
4 #ifdef SWIGJAVA
5
6 #include "bindings/java_iterator_adapter.h"
7 #include "bindings/java_stream_adapters.h"
8
9 #endif /* SWIGJAVA */
10 %}
11
12 %ignore CVC4::operator<<(std::ostream&, const UnsatCore&);
13
14 #ifdef SWIGJAVA
15
16 // Instead of UnsatCore::begin() and end(), create an
17 // iterator() method on the Java side that returns a Java-style
18 // Iterator.
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);
26 }
27 }
28
29 // UnsatCore is "iterable" on the Java side
30 %typemap(javainterfaces) CVC4::UnsatCore "java.lang.Iterable<edu.nyu.acsys.CVC4.Expr>";
31
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();
39 }
40
41 public edu.nyu.acsys.CVC4.Expr next() {
42 if(hasNext()) {
43 return getNext();
44 } else {
45 throw new java.util.NoSuchElementException();
46 }
47 }
48 "
49 // getNext() just allows C++ iterator access from Java-side next(), make it private
50 %javamethodmodifiers CVC4::JavaIteratorAdapter<CVC4::UnsatCore>::getNext() "private";
51
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; }
57
58 #endif /* SWIGJAVA */
59
60 %include "util/unsat_core.h"
61
62 #ifdef SWIGJAVA
63
64 %include "bindings/java_iterator_adapter.h"
65 %include "bindings/java_stream_adapters.h"
66
67 %template(JavaIteratorAdapter_UnsatCore) CVC4::JavaIteratorAdapter<CVC4::UnsatCore>;
68
69 #endif /* SWIGJAVA */