package jaclib.memory.heap;

import jaclib.memory.Buffer;
import jaclib.memory.Source;
import jaclib.memory.heap.NativeHeap;

public final class NativeHeapBuffer implements Buffer, Source {

   private int anInt556;
   public NativeHeap aNativeHeap557;
   private int anInt558;
   private boolean aBool559 = true;


   NativeHeapBuffer(NativeHeap var1, int var2, int var3) {
      this.aNativeHeap557 = var1;
      this.anInt558 = var2 * -586429803;
      this.anInt556 = var3 * 1687060025;
   }

   private final synchronized boolean method1289() {
      return this.aNativeHeap557.method824() && this.aBool559;
   }

   public final long method75() {
      return this.aNativeHeap557.getBufferAddress(-1699630915 * this.anInt558);
   }

   public final int method30() {
      return -1477832695 * this.anInt556;
   }

   public final synchronized void method79(byte[] var1, int var2, int var3, int var4) {
      if(!this.method1289() | null == var1 | var2 < 0 | var2 + var4 > var1.length | var3 < 0 | var3 + var4 > -1477832695 * this.anInt556) {
         throw new RuntimeException();
      } else {
         this.aNativeHeap557.put(this.anInt558 * -1699630915, var1, var2, var3, var4);
      }
   }

   public final synchronized void method1290() {
      if(this.method1289()) {
         this.aNativeHeap557.deallocateBuffer(-1699630915 * this.anInt558);
      }

      this.aBool559 = false;
   }

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

   protected final synchronized void method1291() throws Throwable {
      super.finalize();
      this.method1290();
   }

   protected final synchronized void method1292() throws Throwable {
      super.finalize();
      this.method1290();
   }

   protected final synchronized void method1293() throws Throwable {
      super.finalize();
      this.method1290();
   }

   public final int method31() {
      return -1477832695 * this.anInt556;
   }

   public final long method80() {
      return this.aNativeHeap557.getBufferAddress(-1699630915 * this.anInt558);
   }

   public final long method81() {
      return this.aNativeHeap557.getBufferAddress(-1699630915 * this.anInt558);
   }

   public final synchronized void method82(byte[] var1, int var2, int var3, int var4) {
      if(!this.method1289() | null == var1 | var2 < 0 | var2 + var4 > var1.length | var3 < 0 | var3 + var4 > -1477832695 * this.anInt556) {
         throw new RuntimeException();
      } else {
         this.aNativeHeap557.put(this.anInt558 * -1699630915, var1, var2, var3, var4);
      }
   }

   private final synchronized boolean method1294() {
      return this.aNativeHeap557.method824() && this.aBool559;
   }

   private final synchronized boolean method1295() {
      return this.aNativeHeap557.method824() && this.aBool559;
   }

   private final synchronized boolean method1296() {
      return this.aNativeHeap557.method824() && this.aBool559;
   }

   public final synchronized void method1297() {
      if(this.method1289()) {
         this.aNativeHeap557.deallocateBuffer(-1699630915 * this.anInt558);
      }

      this.aBool559 = false;
   }

   public final synchronized void method1298() {
      if(this.method1289()) {
         this.aNativeHeap557.deallocateBuffer(-1699630915 * this.anInt558);
      }

      this.aBool559 = false;
   }

   public final synchronized void method1299() {
      if(this.method1289()) {
         this.aNativeHeap557.deallocateBuffer(-1699630915 * this.anInt558);
      }

      this.aBool559 = false;
   }
}
