public StringConstructor getoBJECT() { if (!org.intermine.model.bio.SequenceVariantShadow.class.equals(getClass())) { return NotXmlRenderer.render(this); } StringConstructor sb = new StringConstructor(); sb.append("$_^org.intermine.model.bio.SequenceVariant"); if (id != null) { sb.append("$_^aid$_^").append(id); } return sb; } public void setoBJECT(String notXml, ObjectStore os) {
/** * Writes the given StringConstructor to the stream in modified UTF-8 format, following its * length in bytes as a four-byte integer. * * @param str the StringConstructor * @return the number of bytes written to the OutputStream * @throws IOException if there is an error writing to the underlying OutputStream */ public int writeLargeUTF(StringConstructor str) throws IOException { return writeLargeUTF(str.getStrings()); }
/** * Calculates the size of an array, in bytes. * * @param array the array * @return an int */ protected static int sizeOfArray(Object[] array) { int retval = 0; for (int i = 0; i < array.length; i++) { if (array[i] instanceof String) { retval += ((String) array[i]).length() * 2 + 12; } else if (array[i] instanceof StringConstructor) { retval += ((StringConstructor) array[i]).length() * 2 + 12; } else if ((array[i] instanceof Long) || (array[i] instanceof Double)) { retval += 8; } else if (array[i] instanceof BigDecimal) { retval += 50; } else { retval += 4; } } return retval; }
/** * Appends an Object onto the end of this object. * * @param o an Object * @return this */ public StringConstructor append(Object o) { return append(o.toString()); }
public void test1() throws Exception { Employee e = new Employee(); Department d = new Department(); e.setId(new Integer(1234)); e.setName("Employee1"); d.setId(new Integer(5678)); e.setDepartment(d); String expected = NotXmlParser.DELIM + "org.intermine.model.testmodel.Employee" + NotXmlParser.DELIM + "aage" + NotXmlParser.DELIM + "0" + NotXmlParser.DELIM + "rdepartment" + NotXmlParser.DELIM + "5678" + NotXmlParser.DELIM + "afullTime" + NotXmlParser.DELIM + "false" + NotXmlParser.DELIM + "aid" + NotXmlParser.DELIM + "1234" + NotXmlParser.DELIM + "aname" + NotXmlParser.DELIM + "Employee1"; String got = NotXmlRenderer.render(e).toString(); assertEquals(got, expected, got); }
/** * Appends a double onto the end of this object. * * @param d a double * @return this */ public StringConstructor append(double d) { return append(String.valueOf(d)); }
public void testHandleDelims() throws Exception { Employee e = new Employee(); e.setId(new Integer(2874)); e.setName("Flibble $_^ Wotsit"); String notXml = NotXmlRenderer.render(e).toString(); Employee reparsed = (Employee) NotXmlParser.parse(notXml, os); assertEquals(e.getName(), reparsed.getName()); assertEquals(e.getId(), reparsed.getId()); }
public StringConstructor getoBJECT() { if (!org.intermine.model.bio.SyntenyBlockShadow.class.equals(getClass())) { return NotXmlRenderer.render(this); } StringConstructor sb = new StringConstructor(); sb.append("$_^org.intermine.model.bio.SyntenyBlock"); if (id != null) { sb.append("$_^aid$_^").append(id); } return sb; } public void setoBJECT(String notXml, ObjectStore os) {
/** * Appends a boolean onto the end of this object. * * @param b a boolean * @return this */ public StringConstructor append(boolean b) { return append(String.valueOf(b)); }
/** * Writes the given StringConstructor to the stream in modified UTF-8 format, following its * length in bytes as a four-byte integer. * * @param str the StringConstructor * @return the number of bytes written to the OutputStream * @throws IOException if there is an error writing to the underlying OutputStream */ public int writeLargeUTF(StringConstructor str) throws IOException { return writeLargeUTF(str.getStrings()); }
/** * Calculates the size of an array, in bytes. * * @param array the array * @return an int */ protected static int sizeOfArray(Object[] array) { int retval = 0; for (int i = 0; i < array.length; i++) { if (array[i] instanceof String) { retval += ((String) array[i]).length() * 2 + 12; } else if (array[i] instanceof StringConstructor) { retval += ((StringConstructor) array[i]).length() * 2 + 12; } else if ((array[i] instanceof Long) || (array[i] instanceof Double)) { retval += 8; } else if (array[i] instanceof BigDecimal) { retval += 50; } else { retval += 4; } } return retval; }
public StringConstructor getoBJECT() { if (!org.intermine.model.bio.InteractorShadow.class.equals(getClass())) { return NotXmlRenderer.render(this); } StringConstructor sb = new StringConstructor(); sb.append("$_^org.intermine.model.bio.Interactor"); if (id != null) { sb.append("$_^aid$_^").append(id); } return sb; } public void setoBJECT(String notXml, ObjectStore os) {
/** * Appends an int onto the end of this object. * * @param i an int * @return this */ public StringConstructor append(int i) { return append(String.valueOf(i)); }
public StringConstructor getoBJECT() { if (!org.intermine.model.bio.SyntenyBlockShadow.class.equals(getClass())) { return NotXmlRenderer.render(this); } StringConstructor sb = new StringConstructor(); sb.append("$_^org.intermine.model.bio.SyntenyBlock"); if (id != null) { sb.append("$_^aid$_^").append(id); } return sb; } public void setoBJECT(String notXml, ObjectStore os) {
/** * Appends a float onto the end of this object. * * @param f a float * @return this */ public StringConstructor append(float f) { return append(String.valueOf(f)); }
public StringConstructor getoBJECT() { if (!org.intermine.model.bio.SequenceVariantShadow.class.equals(getClass())) { return NotXmlRenderer.render(this); } StringConstructor sb = new StringConstructor(); sb.append("$_^org.intermine.model.bio.SequenceVariant"); if (id != null) { sb.append("$_^aid$_^").append(id); } return sb; } public void setoBJECT(String notXml, ObjectStore os) {
/** * Appends a double onto the end of this object. * * @param d a double * @return this */ public StringConstructor append(double d) { return append(String.valueOf(d)); }
public StringConstructor getoBJECT() { if (!org.intermine.model.bio.OntologyEvidenceShadow.class.equals(getClass())) { return NotXmlRenderer.render(this); } StringConstructor sb = new StringConstructor(); sb.append("$_^org.intermine.model.bio.OntologyEvidence"); if (code != null) { sb.append("$_^rcode$_^").append(code.getId()); } if (id != null) { sb.append("$_^aid$_^").append(id); } return sb; } public void setoBJECT(String notXml, ObjectStore os) {
/** * Appends a float onto the end of this object. * * @param f a float * @return this */ public StringConstructor append(float f) { return append(String.valueOf(f)); }
public StringConstructor getoBJECT() { if (!org.intermine.model.bio.OntologyEvidenceShadow.class.equals(getClass())) { return NotXmlRenderer.render(this); } StringConstructor sb = new StringConstructor(); sb.append("$_^org.intermine.model.bio.OntologyEvidence"); if (code != null) { sb.append("$_^rcode$_^").append(code.getId()); } if (id != null) { sb.append("$_^aid$_^").append(id); } return sb; } public void setoBJECT(String notXml, ObjectStore os) {