1 package com.nwalsh.xalan; 2 3 import org.w3c.dom.*; 4 5 33 public class Callout implements Comparable { 34 35 private int callout = 0; 36 37 private Element area = null; 38 39 private int line = 0; 40 41 private int col = 0; 42 43 private int type = 0; 44 45 private String otherType = null; 46 47 public static final int CALS_PAIR = 1; 48 public static final int LINE_COLUMN = 2; 49 public static final int LINE_COLUMN_PAIR = 3; 50 public static final int LINE_RANGE = 4; 51 public static final int OTHER = 5; 52 53 54 public Callout(int callout, Element area, int line, int col, int type) { 55 this.callout = callout; 56 this.area = area; 57 this.line = line; 58 this.col = col; 59 this.type = type; 60 this.otherType = null; 61 } 62 63 64 public Callout(int callout, Element area, int line, int col, String otherType) { 65 this.callout = callout; 66 this.area = area; 67 this.line = line; 68 this.col = col; 69 this.type = Callout.OTHER; 70 this.otherType = otherType; 71 } 72 73 85 public int compareTo (Object o) { 86 Callout c = (Callout) o; 87 88 if (line == c.getLine()) { 89 if (col > c.getColumn()) { 90 return 1; 91 } else if (col < c.getColumn()) { 92 return -1; 93 } else { 94 if (callout < c.getCallout()) { 95 return -1; 96 } else if (callout > c.getCallout()) { 97 return 1; 98 } else { 99 return 0; 100 } 101 } 102 } else { 103 if (line > c.getLine()) { 104 return 1; 105 } else { 106 return -1; 107 } 108 } 109 } 110 111 112 public Element getArea() { 113 return area; 114 } 115 116 117 public int getLine() { 118 return line; 119 } 120 121 122 public int getColumn() { 123 return col; 124 } 125 126 127 public int getCallout() { 128 return callout; 129 } 130 131 132 public int getType() { 133 return type; 134 } 135 136 137 public String getOtherType() { 138 return otherType; 139 } 140 141 142 } 143 144 | Popular Tags |