3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-30 04:15:51 +00:00
z3/src/api/java/com/Microsoft/Z3/ASTVector.java
Christoph M. Wintersteiger 520bcaf720 More Java API. This is still under heavy construction and cannot be used.
Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
2012-11-23 00:46:44 +00:00

107 lines
2.9 KiB
Java

/**
* This file was automatically generated from ASTVector.cs
**/
package com.Microsoft.Z3;
/* using System; */
/**
* Vectors of ASTs.
**/
class ASTVector extends Z3Object
{
/**
* The size of the vector
**/
public long Size() { return Native.astVectorSize(Context.nCtx, NativeObject); }
/**
* 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
**/
public AST get(long i)
{
return new AST(Context, Native.astVectorGet(Context.nCtx, NativeObject, i));
}
public void set(long i, AST value)
{
Native.astVectorSet(Context.nCtx, NativeObject, i, value.NativeObject);
}
/**
* Resize the vector to <paramref name="newSize"/>.
* <param name="newSize">The new size of the vector.</param>
**/
public void Resize(long newSize)
{
Native.astVectorResize(Context.nCtx, NativeObject, 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)
{
Native.astVectorPush(Context.nCtx, NativeObject, a.NativeObject);
}
/**
* Translates all ASTs in the vector to <paramref name="ctx"/>.
* <param name="ctx">A context</param>
* @return A new ASTVector
**/
public ASTVector Translate(Context ctx)
{
return new ASTVector(Context, Native.astVectorTranslate(Context.nCtx, NativeObject, ctx.nCtx));
}
/**
* Retrieves a string representation of the vector.
**/
public String toString()
{
return Native.astVectortoString(Context.nCtx, NativeObject);
}
ASTVector(Context ctx, IntPtr obj) { super(ctx, obj); }
ASTVector(Context ctx) { super(ctx, Native.mkAstVector(ctx.nCtx)); }
class DecRefQueue extends Z3.DecRefQueue
{
public void IncRef(Context ctx, IntPtr obj)
{
Native.astVectorIncRef(ctx.nCtx, obj);
}
public void DecRef(Context ctx, IntPtr obj)
{
Native.astVectorDecRef(ctx.nCtx, obj);
}
};
void IncRef(IntPtr o)
{
Context.ASTVector_DRQ.IncAndClear(Context, o);
super.IncRef(o);
}
void DecRef(IntPtr o)
{
Context.ASTVector_DRQ.Add(o);
super.DecRef(o);
}
}