/**
* 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(Context().nCtx(), NativeObject());
}
/**
* Retrieves the i-th object in the vector. May throw an
* IndexOutOfBoundsException when is out of
* range. Index
*
* @return An AST
* @throws Z3Exception
**/
public AST get(int i) throws Z3Exception
{
return new AST(Context(), Native.astVectorGet(Context().nCtx(),
NativeObject(), i));
}
public void set(int i, AST value) throws Z3Exception
{
Native.astVectorSet(Context().nCtx(), NativeObject(), i,
value.NativeObject());
}
/**
* Resize the vector to . The new size of the vector.
**/
public void Resize(int newSize) throws Z3Exception
{
Native.astVectorResize(Context().nCtx(), NativeObject(), newSize);
}
/**
* Add the AST to the back of the vector. The size is
* increased by 1. An AST
**/
public void Push(AST a) throws Z3Exception
{
Native.astVectorPush(Context().nCtx(), NativeObject(), a.NativeObject());
}
/**
* Translates all ASTs in the vector to . A context
*
* @return A new ASTVector
* @throws Z3Exception
**/
public ASTVector Translate(Context ctx) throws Z3Exception
{
return new ASTVector(Context(), Native.astVectorTranslate(Context()
.nCtx(), NativeObject(), ctx.nCtx()));
}
/**
* Retrieves a string representation of the vector.
**/
public String toString()
{
try
{
return Native.astVectorToString(Context().nCtx(), NativeObject());
} 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
{
Context().ASTVector_DRQ().IncAndClear(Context(), o);
super.IncRef(o);
}
void DecRef(long o) throws Z3Exception
{
Context().ASTVector_DRQ().Add(o);
super.DecRef(o);
}
}