3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-13 20:38:43 +00:00

Javadoc and indentation fixes

- A proper way to refer to the function in the same class is "#funcName"

- There is no point in "@param p" declaration if no description follows
it.
This commit is contained in:
George Karpenkov 2016-01-06 11:19:26 +01:00
parent 54e5bf2422
commit 8bb0010dc3
9 changed files with 91 additions and 110 deletions

View file

@ -326,13 +326,6 @@ public class Context extends IDisposable
/**
* Create a datatype constructor.
* @param name
* @param recognizer
* @param fieldNames
* @param sorts
* @param sortRefs
*
* @return
**/
public Constructor mkConstructor(String name, String recognizer,
String[] fieldNames, Sort[] sorts, int[] sortRefs)
@ -395,10 +388,6 @@ public class Context extends IDisposable
/**
* Create mutually recursive data-types.
* @param names
* @param c
*
* @return
**/
public DatatypeSort[] mkDatatypeSorts(String[] names, Constructor[][] c)
@ -410,7 +399,7 @@ public class Context extends IDisposable
* Update a datatype field at expression t with value v.
* The function performs a record update at t. The field
* that is passed in as argument is updated with value v,
* the remainig fields of t are unchanged.
* the remaining fields of t are unchanged.
**/
public Expr MkUpdateField(FuncDecl field, Expr t, Expr v)
throws Z3Exception
@ -506,8 +495,8 @@ public class Context extends IDisposable
/**
* Creates a fresh constant function declaration with a name prefixed with
* {@code prefix"}.
* @see mkFuncDecl(String,Sort,Sort)
* @see mkFuncDecl(String,Sort[],Sort)
* @see #mkFuncDecl(String,Sort,Sort)
* @see #mkFuncDecl(String,Sort[],Sort)
**/
public FuncDecl mkFreshConstDecl(String prefix, Sort range)
@ -1523,7 +1512,7 @@ public class Context extends IDisposable
{
checkContextMatch(t);
return new IntExpr(this, Native.mkBv2int(nCtx(), t.getNativeObject(),
(signed) ? true : false));
(signed)));
}
/**
@ -1663,8 +1652,8 @@ public class Context extends IDisposable
* {@code [domain -> range]}, and {@code i} must have the sort
* {@code domain}. The sort of the result is {@code range}.
*
* @see mkArraySort
* @see mkStore
* @see #mkArraySort
* @see #mkStore
**/
public Expr mkSelect(ArrayExpr a, Expr i)
@ -1689,8 +1678,8 @@ public class Context extends IDisposable
* {@code select}) on all indices except for {@code i}, where it
* maps to {@code v} (and the {@code select} of {@code a}
* with respect to {@code i} may be a different value).
* @see mkArraySort
* @see mkSelect
* @see #mkArraySort
* @see #mkSelect
**/
public ArrayExpr mkStore(ArrayExpr a, Expr i, Expr v)
@ -1707,8 +1696,8 @@ public class Context extends IDisposable
* Remarks: The resulting term is an array, such
* that a {@code select} on an arbitrary index produces the value
* {@code v}.
* @see mkArraySort
* @see mkSelect
* @see #mkArraySort
* @see #mkSelect
*
**/
public ArrayExpr mkConstArray(Sort domain, Expr v)
@ -1721,15 +1710,15 @@ public class Context extends IDisposable
/**
* Maps f on the argument arrays.
* Remarks: Eeach element of
* Remarks: Each element of
* {@code args} must be of an array sort
* {@code [domain_i -> range_i]}. The function declaration
* {@code f} must have type {@code range_1 .. range_n -> range}.
* {@code v} must have sort range. The sort of the result is
* {@code [domain_i -> range]}.
* @see mkArraySort
* @see mkSelect
* @see mkStore
* @see #mkArraySort
* @see #mkSelect
* @see #mkStore
**/
public ArrayExpr mkMap(FuncDecl f, ArrayExpr... args)
@ -2122,12 +2111,13 @@ public class Context extends IDisposable
*
* @return A Term with value {@code num}/{@code den}
* and sort Real
* @see mkNumeral(String,Sort)
* @see #mkNumeral(String,Sort)
**/
public RatNum mkReal(int num, int den)
{
if (den == 0)
if (den == 0) {
throw new Z3Exception("Denominator is zero");
}
return new RatNum(this, Native.mkReal(nCtx(), num, den));
}
@ -2257,7 +2247,7 @@ public class Context extends IDisposable
* 'names' of the bound variables, and {@code body} is the body
* of the quantifier. Quantifiers are associated with weights indicating the
* importance of using the quantifier during instantiation.
* Note that the bound variables are de-Bruijn indices created using {@link mkBound}.
* Note that the bound variables are de-Bruijn indices created using {@link #mkBound}.
* Z3 applies the convention that the last element in {@code names} and
* {@code sorts} refers to the variable with index 0, the second to last element
* of {@code names} and {@code sorts} refers to the variable
@ -2287,7 +2277,7 @@ public class Context extends IDisposable
/**
* Creates an existential quantifier using de-Brujin indexed variables.
* @see mkForall(Sort[],Symbol[],Expr,int,Pattern[],Expr[],Symbol,Symbol)
* @see #mkForall(Sort[],Symbol[],Expr,int,Pattern[],Expr[],Symbol,Symbol)
**/
public Quantifier mkExists(Sort[] sorts, Symbol[] names, Expr body,
int weight, Pattern[] patterns, Expr[] noPatterns,
@ -2414,7 +2404,7 @@ public class Context extends IDisposable
/**
* Parse the given file using the SMT-LIB parser.
* @see parseSMTLIBString
* @see #parseSMTLIBString
**/
public void parseSMTLIBFile(String fileName, Symbol[] sortNames,
Sort[] sorts, Symbol[] declNames, FuncDecl[] decls)
@ -2528,7 +2518,7 @@ public class Context extends IDisposable
/**
* Parse the given string using the SMT-LIB2 parser.
* @see parseSMTLIBString
* @see #parseSMTLIBString
*
* @return A conjunction of assertions in the scope (up to push/pop) at the
* end of the string.
@ -2542,8 +2532,9 @@ public class Context extends IDisposable
int cs = Sort.arrayLength(sorts);
int cdn = Symbol.arrayLength(declNames);
int cd = AST.arrayLength(decls);
if (csn != cs || cdn != cd)
if (csn != cs || cdn != cd) {
throw new Z3Exception("Argument size mismatch");
}
return (BoolExpr) Expr.create(this, Native.parseSmtlib2String(nCtx(),
str, AST.arrayLength(sorts), Symbol.arrayToNative(sortNames),
AST.arrayToNative(sorts), AST.arrayLength(decls),
@ -2552,13 +2543,12 @@ public class Context extends IDisposable
/**
* Parse the given file using the SMT-LIB2 parser.
* @see parseSMTLIB2String
* @see #parseSMTLIB2String
**/
public BoolExpr parseSMTLIB2File(String fileName, Symbol[] sortNames,
Sort[] sorts, Symbol[] declNames, FuncDecl[] decls)
{
int csn = Symbol.arrayLength(sortNames);
int cs = Sort.arrayLength(sorts);
int cdn = Symbol.arrayLength(declNames);
@ -2649,9 +2639,10 @@ public class Context extends IDisposable
if (ts != null && ts.length > 0)
{
last = ts[ts.length - 1].getNativeObject();
for (int i = ts.length - 2; i >= 0; i--)
for (int i = ts.length - 2; i >= 0; i--) {
last = Native.tacticAndThen(nCtx(), ts[i].getNativeObject(),
last);
last);
}
}
if (last != 0)
{
@ -2665,7 +2656,7 @@ public class Context extends IDisposable
/**
* Create a tactic that applies {@code t1} to a Goal and then
* {@code t2"/> to every subgoal produced by <paramref name="t1}.
* {@code t2} to every subgoal produced by {@code t1}
*
* Remarks: Shorthand for {@code AndThen}.
**/
@ -3000,7 +2991,7 @@ public class Context extends IDisposable
/**
* Creates a new (incremental) solver.
* @see mkSolver(Symbol)
* @see #mkSolver(Symbol)
**/
public Solver mkSolver(String logic)
{
@ -3840,7 +3831,7 @@ public class Context extends IDisposable
* that is returned must be handled externally and through native calls (see
* e.g.,
* @see Native#incRef
* @see wrapAST
* @see #wrapAST
* @param a The AST to unwrap.
**/
public long unwrapAST(AST a)
@ -3879,7 +3870,7 @@ public class Context extends IDisposable
}
protected long m_ctx = 0;
protected static Object creation_lock = new Object();
protected static final Object creation_lock = new Object();
long nCtx()
{
@ -4050,7 +4041,7 @@ public class Context extends IDisposable
m_Params_DRQ.clear(this);
m_Probe_DRQ.clear(this);
m_Solver_DRQ.clear(this);
m_Optimize_DRQ.clear(this);
m_Optimize_DRQ.clear(this);
m_Statistics_DRQ.clear(this);
m_Tactic_DRQ.clear(this);
m_Fixedpoint_DRQ.clear(this);

View file

@ -33,7 +33,6 @@ public class Expr extends AST
* Returns a simplified version of the expression
* @return Expr
* @throws Z3Exception on error
* @return an Expr
**/
public Expr simplify()
{
@ -48,7 +47,6 @@ public class Expr extends AST
* @see Context#SimplifyHelp
* @return an Expr
* @throws Z3Exception on error
* @return an Expr
**/
public Expr simplify(Params p)
{
@ -193,7 +191,6 @@ public class Expr extends AST
*
* @return A copy of the term which is associated with {@code ctx}
* @throws Z3Exception on error
* @return an Expr
**/
public Expr translate(Context ctx)
{
@ -229,9 +226,8 @@ public class Expr extends AST
/**
* Indicates whether the term is well-sorted.
*
* @return True if the term is well-sorted, false otherwise.
* @throws Z3Exception on error
* @return a boolean
* @return True if the term is well-sorted, false otherwise.
**/
public boolean isWellSorted()
{
@ -2043,7 +2039,7 @@ public class Expr extends AST
* identity, but in the context of a register machine allows for terms of
* kind {@code isRelationUnion} to perform destructive updates to
* the first argument.
* @see isRelationUnion
* @see #isRelationUnion
* @throws Z3Exception on error
* @return a boolean
**/

View file

@ -164,7 +164,7 @@ public class Fixedpoint extends Z3Object
/**
* Creates a backtracking point.
* @see pop
* @see #pop
**/
public void push()
{
@ -176,7 +176,7 @@ public class Fixedpoint extends Z3Object
* Remarks: Note that an exception is thrown if {@code pop}
* is called without a corresponding {@code push}
*
* @see push
* @see #push
**/
public void pop()
{

View file

@ -45,9 +45,6 @@ public class FuncDecl extends AST
other.getNativeObject()));
}
/**
* A string representations of the function declaration.
**/
@Override
public String toString()
{
@ -79,7 +76,7 @@ public class FuncDecl extends AST
/**
* The size of the domain of the function declaration
* @see getArity
* @see #getArity
**/
public int getDomainSize()
{
@ -362,9 +359,6 @@ public class FuncDecl extends AST
/**
* Create expression that applies function to arguments.
* @param args
*
* @return
**/
public Expr apply(Expr ... args)
{

View file

@ -68,7 +68,7 @@ public final class Global
* Restore the value of all global (and module) parameters.
* Remarks:
* This command will not affect already created objects (such as tactics and solvers)
* @see setParameter
* @see #setParameter
**/
public static void resetParameters()
{
@ -84,7 +84,7 @@ public final class Global
public static void ToggleWarningMessages(boolean enabled)
{
Native.toggleWarningMessages((enabled) ? true : false);
Native.toggleWarningMessages((enabled));
}
/**

View file

@ -244,8 +244,8 @@ public class Model extends Z3Object
* in a formula. The interpretation for a sort is a finite set of distinct
* values. We say this finite set is the "universe" of the sort.
*
* @see getNumSorts
* @see getSortUniverse
* @see #getNumSorts
* @see #getSortUniverse
*
* @throws Z3Exception
**/

View file

@ -32,7 +32,7 @@ public class Optimize extends Z3Object
**/
public String getHelp()
{
return Native.optimizeGetHelp(getContext().nCtx(), getNativeObject());
return Native.optimizeGetHelp(getContext().nCtx(), getNativeObject());
}
/**
@ -42,7 +42,7 @@ public class Optimize extends Z3Object
**/
public void setParameters(Params value)
{
Native.optimizeSetParams(getContext().nCtx(), getNativeObject(), value.getNativeObject());
Native.optimizeSetParams(getContext().nCtx(), getNativeObject(), value.getNativeObject());
}
/**
@ -50,7 +50,7 @@ public class Optimize extends Z3Object
**/
public ParamDescrs getParameterDescriptions()
{
return new ParamDescrs(getContext(), Native.optimizeGetParamDescrs(getContext().nCtx(), getNativeObject()));
return new ParamDescrs(getContext(), Native.optimizeGetParamDescrs(getContext().nCtx(), getNativeObject()));
}
/**
@ -129,9 +129,9 @@ public class Optimize extends Z3Object
public Handle AssertSoft(BoolExpr constraint, int weight, String group)
{
getContext().checkContextMatch(constraint);
Symbol s = getContext().mkSymbol(group);
return new Handle(this, Native.optimizeAssertSoft(getContext().nCtx(), getNativeObject(), constraint.getNativeObject(), Integer.toString(weight), s.getNativeObject()));
getContext().checkContextMatch(constraint);
Symbol s = getContext().mkSymbol(group);
return new Handle(this, Native.optimizeAssertSoft(getContext().nCtx(), getNativeObject(), constraint.getNativeObject(), Integer.toString(weight), s.getNativeObject()));
}
@ -143,15 +143,15 @@ public class Optimize extends Z3Object
public Status Check()
{
Z3_lbool r = Z3_lbool.fromInt(Native.optimizeCheck(getContext().nCtx(), getNativeObject()));
switch (r) {
case Z3_L_TRUE:
return Status.SATISFIABLE;
case Z3_L_FALSE:
return Status.UNSATISFIABLE;
default:
return Status.UNKNOWN;
}
Z3_lbool r = Z3_lbool.fromInt(Native.optimizeCheck(getContext().nCtx(), getNativeObject()));
switch (r) {
case Z3_L_TRUE:
return Status.SATISFIABLE;
case Z3_L_FALSE:
return Status.UNSATISFIABLE;
default:
return Status.UNKNOWN;
}
}
/**
@ -159,7 +159,7 @@ public class Optimize extends Z3Object
**/
public void Push()
{
Native.optimizePush(getContext().nCtx(), getNativeObject());
Native.optimizePush(getContext().nCtx(), getNativeObject());
}
@ -171,7 +171,7 @@ public class Optimize extends Z3Object
public void Pop()
{
Native.optimizePop(getContext().nCtx(), getNativeObject());
Native.optimizePop(getContext().nCtx(), getNativeObject());
}
@ -198,7 +198,7 @@ public class Optimize extends Z3Object
**/
public Handle MkMaximize(ArithExpr e)
{
return new Handle(this, Native.optimizeMaximize(getContext().nCtx(), getNativeObject(), e.getNativeObject()));
return new Handle(this, Native.optimizeMaximize(getContext().nCtx(), getNativeObject(), e.getNativeObject()));
}
/**
@ -207,7 +207,7 @@ public class Optimize extends Z3Object
**/
public Handle MkMinimize(ArithExpr e)
{
return new Handle(this, Native.optimizeMinimize(getContext().nCtx(), getNativeObject(), e.getNativeObject()));
return new Handle(this, Native.optimizeMinimize(getContext().nCtx(), getNativeObject(), e.getNativeObject()));
}
/**
@ -215,7 +215,7 @@ public class Optimize extends Z3Object
**/
private ArithExpr GetLower(int index)
{
return (ArithExpr)Expr.create(getContext(), Native.optimizeGetLower(getContext().nCtx(), getNativeObject(), index));
return (ArithExpr)Expr.create(getContext(), Native.optimizeGetLower(getContext().nCtx(), getNativeObject(), index));
}
@ -224,7 +224,7 @@ public class Optimize extends Z3Object
**/
private ArithExpr GetUpper(int index)
{
return (ArithExpr)Expr.create(getContext(), Native.optimizeGetUpper(getContext().nCtx(), getNativeObject(), index));
return (ArithExpr)Expr.create(getContext(), Native.optimizeGetUpper(getContext().nCtx(), getNativeObject(), index));
}
/**
@ -243,7 +243,7 @@ public class Optimize extends Z3Object
@Override
public String toString()
{
return Native.optimizeToString(getContext().nCtx(), getNativeObject());
return Native.optimizeToString(getContext().nCtx(), getNativeObject());
}
/**
@ -251,18 +251,18 @@ public class Optimize extends Z3Object
**/
public Statistics getStatistics()
{
return new Statistics(getContext(), Native.optimizeGetStatistics(getContext().nCtx(), getNativeObject()));
return new Statistics(getContext(), Native.optimizeGetStatistics(getContext().nCtx(), getNativeObject()));
}
Optimize(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
super(ctx, obj);
}
Optimize(Context ctx) throws Z3Exception
{
super(ctx, Native.mkOptimize(ctx.nCtx()));
super(ctx, Native.mkOptimize(ctx.nCtx()));
}
@Override

View file

@ -57,8 +57,8 @@ public class Solver extends Z3Object
/**
* The current number of backtracking points (scopes).
* @see pop
* @see push
* @see #pop
* @see #push
**/
public int getNumScopes()
{
@ -68,7 +68,7 @@ public class Solver extends Z3Object
/**
* Creates a backtracking point.
* @see pop
* @see #pop
**/
public void push()
{
@ -89,7 +89,7 @@ public class Solver extends Z3Object
* Remarks: Note that
* an exception is thrown if {@code n} is not smaller than
* {@code NumScopes}
* @see push
* @see #push
**/
public void pop(int n)
{
@ -127,24 +127,26 @@ public class Solver extends Z3Object
* using the Boolean constants in ps.
*
* Remarks:
* This API is an alternative to <see cref="Check"/> with assumptions for
* This API is an alternative to {@link #check} with assumptions for
* extracting unsat cores.
* Both APIs can be used in the same solver. The unsat core will contain a
* combination
* of the Boolean variables provided using <see cref="AssertAndTrack"/>
* of the Boolean variables provided using {@code assertAndTrack}
* and the Boolean literals
* provided using <see cref="Check"/> with assumptions.
* provided using {@link #check} with assumptions.
**/
public void assertAndTrack(BoolExpr[] constraints, BoolExpr[] ps)
{
getContext().checkContextMatch(constraints);
getContext().checkContextMatch(ps);
if (constraints.length != ps.length)
if (constraints.length != ps.length) {
throw new Z3Exception("Argument size mismatch");
}
for (int i = 0; i < constraints.length; i++)
for (int i = 0; i < constraints.length; i++) {
Native.solverAssertAndTrack(getContext().nCtx(), getNativeObject(),
constraints[i].getNativeObject(), ps[i].getNativeObject());
constraints[i].getNativeObject(), ps[i].getNativeObject());
}
}
/**
@ -152,13 +154,13 @@ public class Solver extends Z3Object
* using the Boolean constant p.
*
* Remarks:
* This API is an alternative to <see cref="Check"/> with assumptions for
* This API is an alternative to {@link #check} with assumptions for
* extracting unsat cores.
* Both APIs can be used in the same solver. The unsat core will contain a
* combination
* of the Boolean variables provided using <see cref="AssertAndTrack"/>
* of the Boolean variables provided using {@link #assertAndTrack}
* and the Boolean literals
* provided using <see cref="Check"/> with assumptions.
* provided using {@link #check} with assumptions.
*/
public void assertAndTrack(BoolExpr constraint, BoolExpr p)
{
@ -194,9 +196,9 @@ public class Solver extends Z3Object
/**
* Checks whether the assertions in the solver are consistent or not.
* Remarks:
* @see getModel
* @see getUnsatCore
* @see getProof
* @see #getModel
* @see #getUnsatCore
* @see #getProof
**/
public Status check(Expr... assumptions)
{
@ -223,9 +225,9 @@ public class Solver extends Z3Object
/**
* Checks whether the assertions in the solver are consistent or not.
* Remarks:
* @see getModel
* @see getUnsatCore
* @see getProof
* @see #getModel
* @see #getUnsatCore
* @see #getProof
**/
public Status check()
{

View file

@ -27,8 +27,6 @@ public class Sort extends AST
{
/**
* Equality operator for objects of type Sort.
* @param o
* @return
**/
@Override
public boolean equals(Object o)
@ -139,10 +137,10 @@ public class Sort extends AST
return new FPSort(ctx, obj);
case Z3_ROUNDING_MODE_SORT:
return new FPRMSort(ctx, obj);
case Z3_SEQ_SORT:
return new SeqSort(ctx, obj);
case Z3_RE_SORT:
return new ReSort(ctx, obj);
case Z3_SEQ_SORT:
return new SeqSort(ctx, obj);
case Z3_RE_SORT:
return new ReSort(ctx, obj);
default:
throw new Z3Exception("Unknown sort kind");
}