001/* 002 003 * BioJava development code 004 005 * 006 007 * This code may be freely distributed and modified under the 008 009 * terms of the GNU Lesser General Public Licence. This should 010 011 * be distributed with the code. If you do not have a copy, 012 013 * see: 014 015 * 016 017 * http://www.gnu.org/copyleft/lesser.html 018 019 * 020 021 * Copyright for this code is held jointly by the individual 022 023 * authors. These should be listed in @author doc comments. 024 025 * 026 027 * For more information on the BioJava project and its aims, 028 029 * or to join the biojava-l mailing list, visit the home page 030 031 * at: 032 033 * 034 035 * http://www.biojava.org/ 036 037 * 038 039 */ 040 041 042/** 043 * @author Primary author unknown 044 * @author Greg Cox 045 */ 046 047package org.biojava.bio.seq.io.agave; 048 049 050 051public class AGAVEProperty 052 053{ 054 055 public static final String SCI_PROPERTY = "sci_property" ; 056 057 public static final String RESULT_PROPERTY = "result_property" ; 058 059 public static final String XREF_PROPERTY = "xref_property" ; 060 061 public static final String QUALIFIER = "qualifier" ; 062 063 064 065 private String prop ; 066 067 private String data_type = "varchar"; 068 069 private String value ; 070 071 private String property_class = "result_property" ; 072 073 public AGAVEProperty(String property_class, String prop, String data_type, String value) 074 075 { 076 077 if( property_class != null && !( property_class.equals( SCI_PROPERTY) || 078 079 property_class.equals( RESULT_PROPERTY) || 080 081 property_class.equals( XREF_PROPERTY) || 082 083 property_class.equals( QUALIFIER)) ) 084 085 throw new RuntimeException("unkownn parameter for AGAVEProperty constructor :" + property_class) ; 086 087 if( property_class != null ) 088 089 this.property_class = property_class ; 090 091 this.prop = prop ; 092 093 if( data_type != null ) 094 095 this.data_type = data_type ; 096 097 this.value = value ; 098 099 } 100 101 public String getPropClass() 102 103 { 104 105 return property_class ; 106 107 } 108 109 public String getPropType() 110 111 { 112 113 return prop ; 114 115 } 116 117 public String getDataType() 118 119 { 120 121 return data_type; 122 123 } 124 125 public String getValue() 126 127 { 128 129 return value ; 130 131 } 132 133 public String toString(String indent, String indent_unit) 134 135 { 136 137 StringBuffer sb = new StringBuffer() ; 138 139 sb.append(indent + "<" + property_class ) ; 140 141 if( property_class.equals(QUALIFIER)) { 142 143 sb.append( " qualifier_type=\"" ) ; 144 145 } else { 146 147 sb.append( " prop_type=\"" ) ; // Fixed. Must be a bug, since it was giving duplicated attributes THOMASD 148 149 } 150 151 sb.append(prop); 152 153 sb.append("\" data_type=\"" + data_type + "\">" + value + "</" + property_class + ">" + "\n" ) ; 154 155 156 157 return sb.substring(0); 158 159 } 160 161 public String toString() 162 163 { 164 165 StringBuffer sb = new StringBuffer() ; 166 167 sb.append("<" + property_class ) ; 168 169 if( property_class.equals(QUALIFIER)) { 170 171 sb.append( " qualifier_type=\"" ) ; 172 173 } else { 174 175 sb.append( " prop_type=\"" ) ; // Fixed. Must be a bug, since it was giving duplicated attributes THOMASD 176 177 } 178 179 sb.append(prop); 180 181 sb.append("\" data_type=\"" + data_type + "\">" + value + "</" + property_class + ">" + "\n" ) ; 182 183 184 185 return sb.substring(0); 186 187 } 188 189} 190