mirror of
https://github.com/Z3Prover/z3
synced 2025-04-25 01:55:32 +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:
parent
fb947f50fb
commit
c6303fc8f5
153 changed files with 10063 additions and 9851 deletions
48
src/api/java/IDecRefQueue.java
Normal file
48
src/api/java/IDecRefQueue.java
Normal file
|
@ -0,0 +1,48 @@
|
|||
/**
|
||||
* This file was automatically generated from IDecRefQueue.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
abstract class IDecRefQueue
|
||||
{
|
||||
protected Object m_lock = new Object();
|
||||
protected LinkedList<Long> m_queue = new LinkedList<Long>();
|
||||
final int m_move_limit = 1024;
|
||||
|
||||
public abstract void IncRef(Context ctx, long obj);
|
||||
|
||||
public abstract void DecRef(Context ctx, long obj);
|
||||
|
||||
public void IncAndClear(Context ctx, long o)
|
||||
{
|
||||
IncRef(ctx, o);
|
||||
if (m_queue.size() >= m_move_limit)
|
||||
Clear(ctx);
|
||||
}
|
||||
|
||||
public void Add(long o)
|
||||
{
|
||||
if (o == 0)
|
||||
return;
|
||||
|
||||
synchronized (m_lock)
|
||||
{
|
||||
m_queue.add(o);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear(Context ctx)
|
||||
{
|
||||
synchronized (m_lock)
|
||||
{
|
||||
for (Long o : m_queue)
|
||||
DecRef(ctx, o);
|
||||
m_queue.clear();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue