3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-14 21:08:46 +00:00
z3/src/api/java/com/Microsoft/Z3/DecRefQUeue.java
Christoph M. Wintersteiger 520bcaf720 More Java API. This is still under heavy construction and cannot be used.
Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
2012-11-23 00:46:44 +00:00

71 lines
1.5 KiB
Java

/**
* This file was automatically generated from DecRefQUeue.cs
**/
package com.Microsoft.Z3;
/* using System; */
/* using System.Collections; */
/* using System.Collections.Generic; */
/* using System.Threading; */
abstract class DecRefQueue
{
private void ObjectInvariant()
{
}
protected Object m_lock = new Object();
protected List<IntPtr> m_queue = new List<IntPtr>();
final long m_move_limit = 1024;
public abstract void IncRef(Context ctx, IntPtr obj);
public abstract void DecRef(Context ctx, IntPtr obj);
public void IncAndClear(Context ctx, IntPtr o)
{
IncRef(ctx, o);
if (m_queue.Count >= m_move_limit) Clear(ctx);
}
public void Add(IntPtr o)
{
if (o == IntPtr.Zero) return;
synchronized (m_lock)
{
m_queue.Add(o);
}
}
public void Clear(Context ctx)
{
synchronized (m_lock)
{
for (IntPtr.Iterator o = m_queue.iterator(); o.hasNext(); )
DecRef(ctx, o);
m_queue.Clear();
}
}
}
abstract class DecRefQueueContracts extends DecRefQueue
{
public void IncRef(Context ctx, IntPtr obj)
{
}
public void DecRef(Context ctx, IntPtr obj)
{
}
}