1 25 package org.archive.crawler.extractor; 26 27 import java.io.Serializable ; 28 29 30 40 public class Link implements Serializable { 41 42 private static final long serialVersionUID = 7660959085498739376L; 43 44 46 47 public static final String EMBED_MISC = "=EMBED_MISC".intern(); 48 49 public static final String JS_MISC = "=JS_MISC".intern(); 50 51 public static final String NAVLINK_MISC = "=NAVLINK_MISC".intern(); 52 53 public static final String SPECULATIVE_MISC = "=SPECULATIVE_MISC".intern(); 54 55 public static final String PREREQ_MISC = "=PREREQ_MISC".intern(); 56 57 58 59 public static final char NAVLINK_HOP = 'L'; 61 public static final char PREREQ_HOP = 'P'; 62 63 public static final char EMBED_HOP = 'E'; 64 65 public static final char SPECULATIVE_HOP = 'X'; 66 67 public static final char REFER_HOP = 'R'; 68 69 70 private CharSequence source; 71 72 private CharSequence destination; 73 77 private CharSequence context; 78 79 private char hopType; 80 81 88 public Link(CharSequence source, CharSequence destination, 89 CharSequence context, char hopType) { 90 super(); 91 this.source = source; 92 this.destination = destination; 93 this.context = context; 94 this.hopType = hopType; 95 } 96 97 100 public CharSequence getContext() { 101 return context; 102 } 103 106 public CharSequence getDestination() { 107 return destination; 108 } 109 112 public CharSequence getSource() { 113 return source; 114 } 115 116 119 public char getHopType() { 120 return hopType; 121 } 122 123 131 public static CharSequence elementContext(CharSequence element, CharSequence attribute) { 132 return attribute == null? "": element + "/@" + attribute; 133 } 134 135 @Override 136 public String toString() { 137 return this.destination + " " + this.hopType + " " + this.context; 138 } 139 } 140 | Popular Tags |