1 11 package org.eclipse.debug.core.model; 12 13 14 25 public class MemoryByte { 26 27 30 public static final byte WRITABLE = 0x01; 31 32 37 public static final byte READABLE = 0x02; 38 39 45 public static final byte CHANGED = 0x04; 46 47 52 public static final byte HISTORY_KNOWN = 0x08; 53 54 59 public static final byte BIG_ENDIAN = 0x10; 60 61 66 public static final byte ENDIANESS_KNOWN = 0x20; 67 68 71 protected byte value; 72 73 80 protected byte flags; 81 82 87 public MemoryByte() { 88 this((byte)0, (byte)(WRITABLE | READABLE | ENDIANESS_KNOWN)); 89 } 90 91 99 public MemoryByte(byte byteValue) { 100 this(byteValue, (byte)(WRITABLE | READABLE | ENDIANESS_KNOWN)); 101 } 102 103 109 public MemoryByte(byte byteValue, byte byteFlags) { 110 value = byteValue; 111 flags = byteFlags; 112 } 113 114 119 public byte getFlags() { 120 return flags; 121 } 122 127 public void setFlags(byte flags) { 128 this.flags = flags; 129 } 130 131 136 public byte getValue() { 137 return value; 138 } 139 140 145 public void setValue(byte value) { 146 this.value = value; 147 } 148 149 156 public void setReadable(boolean readable) { 157 flags |= MemoryByte.READABLE; 158 if (!readable) 159 flags ^= MemoryByte.READABLE; 160 } 161 162 169 public boolean isReadable() { 170 return ((flags & MemoryByte.READABLE) == MemoryByte.READABLE); 171 } 172 173 178 public void setWritable(boolean writable) { 179 flags |= MemoryByte.WRITABLE; 180 if (!writable) 181 flags ^= MemoryByte.WRITABLE; 182 } 183 184 189 public boolean isWritable() { 190 return ((flags & MemoryByte.WRITABLE) == MemoryByte.WRITABLE); 191 } 192 193 198 public void setChanged(boolean changed) { 199 flags |= MemoryByte.CHANGED; 200 if (!changed) 201 flags ^= MemoryByte.CHANGED; 202 } 203 204 209 public boolean isChanged() { 210 return ((flags & MemoryByte.CHANGED) == MemoryByte.CHANGED); 211 } 212 213 219 public void setHistoryKnown(boolean known) { 220 flags |= MemoryByte.HISTORY_KNOWN; 221 if (!known) 222 flags ^= MemoryByte.HISTORY_KNOWN; 223 } 224 225 231 public boolean isHistoryKnown() { 232 return ((flags & MemoryByte.HISTORY_KNOWN) == MemoryByte.HISTORY_KNOWN); 233 } 234 235 240 public void setBigEndian(boolean isBigEndian) 241 { 242 flags |= MemoryByte.BIG_ENDIAN; 243 if (!isBigEndian) 244 flags ^= MemoryByte.BIG_ENDIAN; 245 } 246 247 252 public boolean isBigEndian() 253 { 254 return ((flags & MemoryByte.BIG_ENDIAN) == MemoryByte.BIG_ENDIAN); 255 } 256 257 264 public void setEndianessKnown(boolean isEndianessKnown) 265 { 266 flags |= MemoryByte.ENDIANESS_KNOWN; 267 if (!isEndianessKnown) 268 flags ^= MemoryByte.ENDIANESS_KNOWN; 269 } 270 271 278 public boolean isEndianessKnown() 279 { 280 return ((flags & MemoryByte.ENDIANESS_KNOWN) == MemoryByte.ENDIANESS_KNOWN); 281 } 282 283 } 284 | Popular Tags |