1 21 22 package org.apache.derby.iapi.store.raw; 23 24 34 35 public final class ContainerLock { 36 37 private final int type; 38 39 private ContainerLock(int type) { 40 this.type = type; 41 } 42 43 private static String [] shortnames = {"IS", "IX", "S", "U", "X" }; 45 46 47 public static final ContainerLock CIS = new ContainerLock(0); 48 49 public static final ContainerLock CIX = new ContainerLock(1); 50 51 public static final ContainerLock CS = new ContainerLock(2); 52 53 public static final ContainerLock CU = new ContainerLock(3); 54 55 public static final ContainerLock CX = new ContainerLock(4); 56 57 58 public static final int C_NUMBER = 5; 59 60 61 private static final boolean[][] C_COMPAT = { 62 63 { true, true, true, false, false }, 67 { true, true, false, false, false }, 68 { true, false, true, false, false }, 69 { false, false, true, false, false }, 70 { false, false, false, false, false } 71 72 }; 73 74 80 public int getType() { 81 return type; 82 } 83 84 public boolean isCompatible(ContainerLock granted) { 85 86 return isCompatible(granted.getType()); 87 } 88 89 public boolean isCompatible(int granted) { 90 91 return C_COMPAT[getType()][granted]; 92 } 93 94 public String toString() { 95 96 return shortnames[getType()]; 97 } 98 } 99 | Popular Tags |