3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-15 13:28:47 +00:00
z3/src/api/java/IDecRefQueue.java
Christoph M. Wintersteiger eee3bf886d Java API: package renaming.
Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
2012-11-27 19:09:30 +00:00

49 lines
846 B
Java

/**
* 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();
}
}
}