3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-27 10:55:50 +00:00

Java API: a first version that compiles. This is still untested.

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
Christoph M. Wintersteiger 2012-11-27 16:36:50 +00:00
parent fb947f50fb
commit c6303fc8f5
153 changed files with 10063 additions and 9851 deletions

81
src/api/java/Symbol.java Normal file
View file

@ -0,0 +1,81 @@
/**
* This file was automatically generated from Symbol.cs
* w/ further modifications by:
* @author Christoph M. Wintersteiger (cwinter)
**/
package com.Microsoft.Z3;
import com.Microsoft.Z3.Enumerations.*;
/**
* Symbols are used to name several term and type constructors.
**/
public class Symbol extends Z3Object
{
/**
* The kind of the symbol (int or string)
**/
protected Z3_symbol_kind Kind()
{
return Z3_symbol_kind.fromInt(Native.getSymbolKind(Context().nCtx(),
NativeObject()));
}
/**
* Indicates whether the symbol is of Int kind
**/
public boolean IsIntSymbol()
{
return Kind() == Z3_symbol_kind.Z3_INT_SYMBOL;
}
/**
* Indicates whether the symbol is of string kind.
**/
public boolean IsStringSymbol()
{
return Kind() == Z3_symbol_kind.Z3_STRING_SYMBOL;
}
/**
* A string representation of the symbol.
**/
public String toString()
{
try
{
if (IsIntSymbol())
return Integer.toString(((IntSymbol) this).Int());
else if (IsStringSymbol())
return ((StringSymbol) this).String();
else
return new String(
"Z3Exception: Unknown symbol kind encountered.");
} catch (Z3Exception ex)
{
return new String("Z3Exception: " + ex.getMessage());
}
}
/**
* Symbol constructor
**/
protected Symbol(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
static Symbol Create(Context ctx, long obj) throws Z3Exception
{
switch (Z3_symbol_kind.fromInt(Native.getSymbolKind(ctx.nCtx(), obj)))
{
case Z3_INT_SYMBOL:
return new IntSymbol(ctx, obj);
case Z3_STRING_SYMBOL:
return new StringSymbol(ctx, obj);
default:
throw new Z3Exception("Unknown symbol kind encountered");
}
}
}