1 package net.sf.saxon.trans; 2 import net.sf.saxon.expr.Expression; 3 import net.sf.saxon.instruct.InstructionDetails; 4 import net.sf.saxon.instruct.Procedure; 5 import net.sf.saxon.instruct.SlotManager; 6 import net.sf.saxon.pattern.Pattern; 7 import net.sf.saxon.style.StandardNames; 8 import net.sf.saxon.trace.InstructionInfo; 9 import net.sf.saxon.trace.InstructionInfoProvider; 10 11 import java.io.Serializable ; 12 import java.text.Collator ; 13 14 18 19 public class KeyDefinition extends Procedure implements Serializable , InstructionInfoProvider { 20 21 private Pattern match; private Collator collation; private String collationName; private boolean backwardsCompatible = false; 25 26 29 30 public KeyDefinition(Pattern match, Expression use, String collationName, Collator collation) { 31 this.match = match; 32 setBody(use); 33 this.collation = collation; 34 this.collationName = collationName; 35 } 36 37 41 42 public void setBackwardsCompatible(boolean bc) { 43 backwardsCompatible = bc; 44 } 45 46 49 50 public boolean isBackwardsCompatible() { 51 return backwardsCompatible; 52 } 53 54 57 58 public void setStackFrameMap(SlotManager map) { 59 if (map != null && map.getNumberOfVariables() > 0) { 60 super.setStackFrameMap(map); 61 } 62 } 63 64 67 68 public void setLocation(String systemId, int lineNumber) { 69 setSystemId(systemId); 70 setLineNumber(lineNumber); 71 } 72 73 77 78 public Pattern getMatch() { 79 return match; 80 } 81 82 86 87 public Expression getUse() { 88 return getBody(); 89 } 90 91 95 96 public String getCollationName() { 97 return collationName; 98 } 99 100 104 105 public Collator getCollation() { 106 return collation; 107 } 108 109 113 114 public InstructionInfo getInstructionInfo() { 115 InstructionDetails details = new InstructionDetails(); 116 details.setConstructType(StandardNames.XSL_KEY); 117 details.setSystemId(getSystemId()); 118 details.setLineNumber(getLineNumber()); 119 details.setProperty("key", this); 120 return details; 121 } 122 } 123 124 | Popular Tags |