3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-26 18:45:33 +00:00

Java API: Added exception wrappers and build dependencies.

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
Christoph M. Wintersteiger 2012-11-30 15:39:25 +00:00
parent 654c02701c
commit 0c1f2a8281
47 changed files with 4908 additions and 4554 deletions

View file

@ -11,106 +11,114 @@ package com.microsoft.z3;
**/
class ASTMap extends Z3Object
{
/**
* Checks whether the map contains the key <paramref name="k"/>. <param
* name="k">An AST</param>
*
* @return True if <paramref name="k"/> is a key in the map, false
* otherwise.
**/
public boolean Contains(AST k)
{
/**
* Checks whether the map contains the key <paramref name="k"/>. <param
* name="k">An AST</param>
*
* @return True if <paramref name="k"/> is a key in the map, false
* otherwise.
**/
public boolean Contains(AST k) throws Z3Exception
{
return Native.astMapContains(Context().nCtx(), NativeObject(),
k.NativeObject());
}
return Native.astMapContains(Context().nCtx(), NativeObject(),
k.NativeObject());
}
/**
* Finds the value associated with the key <paramref name="k"/>. <remarks>
* This function signs an error when <paramref name="k"/> is not a key in
* the map. </remarks> <param name="k">An AST</param>
* @throws Z3Exception
**/
public AST Find(AST k) throws Z3Exception
{
return new AST(Context(), Native.astMapFind(Context().nCtx(),
NativeObject(), k.NativeObject()));
}
/**
* Finds the value associated with the key <paramref name="k"/>. <remarks>
* This function signs an error when <paramref name="k"/> is not a key in
* the map. </remarks> <param name="k">An AST</param>
*
* @throws Z3Exception
**/
public AST Find(AST k) throws Z3Exception
{
return new AST(Context(), Native.astMapFind(Context().nCtx(),
NativeObject(), k.NativeObject()));
}
/**
* Stores or replaces a new key/value pair in the map. <param name="k">The
* key AST</param> <param name="v">The value AST</param>
**/
public void Insert(AST k, AST v)
{
/**
* Stores or replaces a new key/value pair in the map. <param name="k">The
* key AST</param> <param name="v">The value AST</param>
**/
public void Insert(AST k, AST v) throws Z3Exception
{
Native.astMapInsert(Context().nCtx(), NativeObject(), k.NativeObject(),
v.NativeObject());
}
Native.astMapInsert(Context().nCtx(), NativeObject(), k.NativeObject(),
v.NativeObject());
}
/**
* Erases the key <paramref name="k"/> from the map. <param name="k">An
* AST</param>
**/
public void Erase(AST k)
{
/**
* Erases the key <paramref name="k"/> from the map. <param name="k">An
* AST</param>
**/
public void Erase(AST k) throws Z3Exception
{
Native.astMapErase(Context().nCtx(), NativeObject(), k.NativeObject());
}
Native.astMapErase(Context().nCtx(), NativeObject(), k.NativeObject());
}
/**
* Removes all keys from the map.
**/
public void Reset()
{
Native.astMapReset(Context().nCtx(), NativeObject());
}
/**
* Removes all keys from the map.
**/
public void Reset() throws Z3Exception
{
Native.astMapReset(Context().nCtx(), NativeObject());
}
/**
* The size of the map
**/
public int Size()
{
return Native.astMapSize(Context().nCtx(), NativeObject());
}
/**
* The size of the map
**/
public int Size() throws Z3Exception
{
return Native.astMapSize(Context().nCtx(), NativeObject());
}
/**
* The keys stored in the map.
* @throws Z3Exception
**/
public ASTVector Keys() throws Z3Exception
{
return new ASTVector(Context(), Native.astMapKeys(Context().nCtx(),
NativeObject()));
}
/**
* The keys stored in the map.
*
* @throws Z3Exception
**/
public ASTVector Keys() throws Z3Exception
{
return new ASTVector(Context(), Native.astMapKeys(Context().nCtx(),
NativeObject()));
}
/**
* Retrieves a string representation of the map.
**/
public String toString()
{
return Native.astMapToString(Context().nCtx(), NativeObject());
}
/**
* Retrieves a string representation of the map.
**/
public String toString()
{
try
{
return Native.astMapToString(Context().nCtx(), NativeObject());
} catch (Z3Exception e)
{
return "Z3Exception: " + e.getMessage();
}
}
ASTMap(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
ASTMap(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
ASTMap(Context ctx) throws Z3Exception
{
super(ctx, Native.mkAstMap(ctx.nCtx()));
}
ASTMap(Context ctx) throws Z3Exception
{
super(ctx, Native.mkAstMap(ctx.nCtx()));
}
void IncRef(long o) throws Z3Exception
{
Context().ASTMap_DRQ().IncAndClear(Context(), o);
super.IncRef(o);
}
void IncRef(long o) throws Z3Exception
{
Context().ASTMap_DRQ().IncAndClear(Context(), o);
super.IncRef(o);
}
void DecRef(long o) throws Z3Exception
{
Context().ASTMap_DRQ().Add(o);
super.DecRef(o);
}
void DecRef(long o) throws Z3Exception
{
Context().ASTMap_DRQ().Add(o);
super.DecRef(o);
}
}