@Override protected Record createInstance() { return new Record(); }
/** * Creates an exact copy of this record. * * @return An exact copy of this record. */ public Record createCopy() { final Record rec = new Record(); copyTo(rec); return rec; }
public static Record createRecord(Value[] fields) { final Record rec = new Record(); for (int i = 0; i < fields.length; i++) { rec.setField(i, fields[i]); } return rec; }
private Record generateFilledDenseRecord(int numFields) { Record record = new Record(); for (int i = 0; i < numFields; i++) { record.addField(new IntValue(this.rand.nextInt())); } return record; }
@Override protected Record getRecord(int index) { return new Record(new IntValue(index), new StringValue(String.valueOf(index))); }
@Test public void testEmptyRecordSerialization() { try { // test deserialize into self Record empty = new Record(); empty.write(this.out); empty.read(in); Assert.assertTrue("Deserialized Empty record is not another empty record.", empty.getNumFields() == 0); // test deserialize into new empty = new Record(); empty.write(this.out); empty = new Record(); empty.read(this.in); Assert.assertTrue("Deserialized Empty record is not another empty record.", empty.getNumFields() == 0); } catch (Throwable t) { Assert.fail("Test failed due to an exception: " + t.getMessage()); } }
Record rec = new Record(); for (int i = 0; i < values.length; i++) { final int pos = permutation1[i]; rec = new Record(); for (int i = 0; i < values.length; i++) { final int pos = permutation1[i]; rec = new Record(); int updatePos = rnd.nextInt(values.length + 1); for (int i = 0; i < values.length; i++) { rec = new Record(); for (int i = 0; i < values.length; i++) { final int pos = permutation1[i]; rec = new Record(); rec.read(reader); testAllRetrievalMethods(rec, permutation2, values); rec = new Record(); for (int i = 0; i < values.length; i++) { final int pos = permutation1[i]; rec = new Record(); updatePos = rnd.nextInt(values.length + 1); for (int i = 0; i < values.length; i++) { if (i == updatePos) { rec.write(writer);
@Test public void testClear() throws IOException { try { Record record = new Record(new IntValue(42)); record.write(this.out); Assert.assertEquals(42, record.getField(0, IntValue.class).getValue()); record.setField(0, new IntValue(23)); record.write(this.out); Assert.assertEquals(23, record.getField(0, IntValue.class).getValue()); record.clear(); Assert.assertEquals(0, record.getNumFields()); Record record2 = new Record(new IntValue(42)); record2.read(in); Assert.assertEquals(42, record2.getField(0, IntValue.class).getValue()); record2.read(in); Assert.assertEquals(23, record2.getField(0, IntValue.class).getValue()); } catch (Throwable t) { Assert.fail("Test failed due to an exception: " + t.getMessage()); } }
record = new Record(this.origVal1, this.origVal2); record.addField(this.origVal3); record.removeField(1);
rec1 = new Record();
/** * Creates an exact copy of this record. * * @return An exact copy of this record. */ public Record createCopy() { final Record rec = new Record(); copyTo(rec); return rec; }
/** * Creates an exact copy of this record. * * @return An exact copy of this record. */ public Record createCopy() { final Record rec = new Record(); copyTo(rec); return rec; }