1 18 package org.objectweb.speedo.metadata; 19 20 import java.util.ArrayList ; 21 import java.util.List ; 22 23 24 29 public class SpeedoJoin extends SpeedoElement { 30 33 public String table; 34 35 38 public List columns = new ArrayList (); 39 40 private final static byte ALL = (byte) 0xFF; 41 private final static byte INDEXED = 1; 42 private final static byte OUTER_JOIN = 2; 43 private final static byte UNIQUE = 4; 44 private byte conditions = 0; 45 46 public final static byte ACTION_NONE = 1; 47 public final static byte ACTION_NULL = 2; 48 public final static byte ACTION_CASCADE = 3; 49 public final static byte ACTION_RESTRICT = 4; 50 public final static byte ACTION_DEFAULT = 5; 51 52 public byte deleteAction = ACTION_NONE; 53 54 public void setOuter(boolean v) { 55 setCondition(v, OUTER_JOIN); 56 } 57 public boolean getOuter() { 58 return getCondition(OUTER_JOIN); 59 } 60 61 public void setIndexed(boolean v) { 62 setCondition(v, INDEXED); 63 } 64 public boolean getIndexed() { 65 return getCondition(INDEXED); 66 } 67 68 public void setUnique(boolean v) { 69 setCondition(v, UNIQUE); 70 } 71 public boolean getUnique() { 72 return getCondition(UNIQUE); 73 } 74 75 private void setCondition(boolean v, byte condition) { 76 if (v) { 77 conditions = (byte) (conditions | condition); 78 } else { 79 conditions = (byte) (conditions & (ALL - condition)); 80 } 81 } 82 private boolean getCondition(byte condition) { 83 return (conditions & condition) == 1; 84 } 85 } 86 | Popular Tags |