1 31 36 37 package com.hp.hpl.jena.rdf.arp; 38 39 import java.util.*; 40 41 45 class ARPString implements ALiteral { 46 47 final static String RDFXMLLiteral = 48 "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"; 49 50 ARPString(String value,String lang,String parseType) { 51 this.value = value; 52 this.lang = ""; 53 this.isWellFormedXML = true; 54 this.parseType = parseType; 55 } 56 ARPString(String value,String lang) { 57 this.value = value; 58 this.lang = lang; 59 this.isWellFormedXML = false; 60 } 61 ARPString(StrToken t,String lang) { 62 this(t.value,lang); 63 } 64 65 ARPString(Vector v,String lang) { 66 this.lang = lang; 67 this.isWellFormedXML = false; 68 StringBuffer buf = new StringBuffer (256); 69 value = ""; 70 Iterator it = v.iterator(); 71 while (it.hasNext()) { 72 buf.append( ((StrToken)it.next()).value ); 73 } 74 value = new String (buf.toString()); 75 } 76 private String value; 77 private String lang; 78 private boolean isWellFormedXML; 79 private String parseType; 80 81 public String toString() { 82 return value; 83 } 84 85 public ARPString concatenate(ARPString s2) { 86 if (lang.equals(s2.lang)) { 87 return new ARPString(value+s2.value,lang); 88 } 89 throw 90 new IllegalArgumentException ("ARPStrings can only be concatenated if they have the same xml:lang attribute"); 91 } 92 ARPString quickConcatenate(ARPString s2) { 93 return new ARPString(value+s2.value,s2.lang); 94 } 95 96 public boolean isWellFormedXML() { 97 return this.isWellFormedXML; 98 } 99 public String getParseType() { 100 return parseType; 101 } 102 103 public String getLang() { 104 return lang; 105 } 106 public String getDatatypeURI() { 107 return isWellFormedXML?RDFXMLLiteral:null; 108 } 109 110 } 111 | Popular Tags |