-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathASTVector.java
More file actions
109 lines (96 loc) · 2.78 KB
/
ASTVector.java
File metadata and controls
109 lines (96 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/**
* This file was automatically generated from ASTVector.cs
* w/ further modifications by:
* @author Christoph M. Wintersteiger (cwinter)
**/
package com.microsoft.z3;
/**
* Vectors of ASTs.
**/
class ASTVector extends Z3Object
{
/**
* The size of the vector
**/
public int size() throws Z3Exception
{
return Native.astVectorSize(getContext().nCtx(), getNativeObject());
}
/**
* Retrieves the i-th object in the vector. <remarks>May throw an
* IndexOutOfBoundsException when <paramref name="i"/> is out of
* range.</remarks> <param name="i">Index</param>
*
* @return An AST
* @throws Z3Exception
**/
public AST get(int i) throws Z3Exception
{
return new AST(getContext(), Native.astVectorGet(getContext().nCtx(),
getNativeObject(), i));
}
public void set(int i, AST value) throws Z3Exception
{
Native.astVectorSet(getContext().nCtx(), getNativeObject(), i,
value.getNativeObject());
}
/**
* Resize the vector to <paramref name="newSize"/>. <param
* name="newSize">The new size of the vector.</param>
**/
public void resize(int newSize) throws Z3Exception
{
Native.astVectorResize(getContext().nCtx(), getNativeObject(), newSize);
}
/**
* Add the AST <paramref name="a"/> to the back of the vector. The size is
* increased by 1. <param name="a">An AST</param>
**/
public void push(AST a) throws Z3Exception
{
Native.astVectorPush(getContext().nCtx(), getNativeObject(), a.getNativeObject());
}
/**
* Translates all ASTs in the vector to <paramref name="ctx"/>. <param
* name="ctx">A context</param>
*
* @return A new ASTVector
* @throws Z3Exception
**/
public ASTVector translate(Context ctx) throws Z3Exception
{
return new ASTVector(getContext(), Native.astVectorTranslate(getContext()
.nCtx(), getNativeObject(), ctx.nCtx()));
}
/**
* Retrieves a string representation of the vector.
**/
public String toString()
{
try
{
return Native.astVectorToString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e)
{
return "Z3Exception: " + e.getMessage();
}
}
ASTVector(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
ASTVector(Context ctx) throws Z3Exception
{
super(ctx, Native.mkAstVector(ctx.nCtx()));
}
void incRef(long o) throws Z3Exception
{
getContext().astvector_DRQ().incAndClear(getContext(), o);
super.incRef(o);
}
void decRef(long o) throws Z3Exception
{
getContext().astvector_DRQ().add(o);
super.decRef(o);
}
}