summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/ClipboardEntry.java
blob: 86a2d462171b4c9c611e32876f2c1780520ff4a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package NET.worlds.scape;

class ClipboardEntry {
   private SuperRoot original;
   private byte[] copy;
   private boolean canPasteOriginal;

   boolean copy(SuperRoot obj) {
      this.original = obj;
      this.copy = obj.getByteCopy();
      this.canPasteOriginal = false;
      return this.copy != null;
   }

   boolean cut(SuperRoot obj) {
      boolean var3;
      try {
         var3 = this.copy(obj);
      } finally {
         this.canPasteOriginal = true;
      }

      return var3;
   }

   SuperRoot paste() {
      if (this.copy != null) {
         if (this.canPasteOriginal) {
            this.canPasteOriginal = false;
            return this.original;
         } else {
            return SuperRoot.getCopyFromBytes(this.copy);
         }
      } else {
         return null;
      }
   }

   void unPaste(SuperRoot obj) {
      if (obj == this.original) {
         this.canPasteOriginal = true;
      }
   }
}