package jaclib.memory.heap;

import jaclib.memory.heap.NativeHeapBuffer;

public final class NativeHeap {

   long peer;
   private int anInt343;
   private boolean aBool344;


   public NativeHeap(int var1) {
      this.anInt343 = -921550219 * var1;
      this.allocateHeap(this.anInt343 * -780927523);
      this.aBool344 = true;
   }

   synchronized boolean method824() {
      return this.aBool344;
   }

   public NativeHeapBuffer method825(int var1, boolean var2) {
      if(!this.aBool344) {
         throw new IllegalStateException();
      } else {
         return new NativeHeapBuffer(this, this.allocateBuffer(var1, var2), var1);
      }
   }

   public synchronized void method826() {
      if(this.aBool344) {
         this.deallocateHeap();
      }

      this.aBool344 = false;
   }

   private native void allocateHeap(int var1);

   private native void deallocateHeap();

   synchronized native int allocateBuffer(int var1, boolean var2);

   synchronized native long getBufferAddress(int var1);

   synchronized native void get(int var1, byte[] var2, int var3, int var4, int var5);

   synchronized native void put(int var1, byte[] var2, int var3, int var4, int var5);

   synchronized native void deallocateBuffer(int var1);

   public synchronized native void copy(long var1, long var3, int var5);

   protected synchronized void finalize() throws Throwable {
      super.finalize();
      this.method826();
   }

   protected synchronized void method827() throws Throwable {
      super.finalize();
      this.method826();
   }

   protected synchronized void method828() throws Throwable {
      super.finalize();
      this.method826();
   }

   protected synchronized void method829() throws Throwable {
      super.finalize();
      this.method826();
   }

   synchronized boolean method830() {
      return this.aBool344;
   }

   synchronized boolean method831() {
      return this.aBool344;
   }

   public NativeHeapBuffer method832(int var1, boolean var2) {
      if(!this.aBool344) {
         throw new IllegalStateException();
      } else {
         return new NativeHeapBuffer(this, this.allocateBuffer(var1, var2), var1);
      }
   }

   public NativeHeapBuffer method833(int var1, boolean var2) {
      if(!this.aBool344) {
         throw new IllegalStateException();
      } else {
         return new NativeHeapBuffer(this, this.allocateBuffer(var1, var2), var1);
      }
   }
}
