/** * Creates a new record containing only a single field, which is the given value. * * @param value The value for the single field of the record. */ public Record(Value value) { setField(0, value); }
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; }
for (int i = 0; i < values.length; i++) { final int pos = permutation1[i]; rec.setField(pos, values[pos]); for (int i = 0; i < values.length; i++) { final int pos = permutation1[i]; rec.setField(pos, values[pos]); rec.setField(pos, values[pos]); for (int i = 0; i < values.length; i++) { final int pos = permutation1[i]; rec.setField(pos, values[pos]); for (int i = 0; i < values.length; i++) { final int pos = permutation1[i]; rec.setField(pos, values[pos]); rec.setField(pos, values[pos]); rec.setField(pos, values[pos]); rec.setField(pos, values[pos]); rec.setField(pos, values[pos]);
r.setField(1, i1); r.setField(3, i2); i2 = new IntValue(4); r.setField(7, i1); r.setField(8, i2); r.setField(i, new IntValue(i)); r.read(this.in); r.setField(1, new IntValue(10)); r.setField(4, new StringValue("Some long value")); r.setField(5, new StringValue("An even longer value")); r.setField(10, new IntValue(10));
@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()); } }
/** * Creates a new record containing only a single field, which is the given value. * * @param value The value for the single field of the record. */ public Record(Value value) { setField(0, value); }
/** * Creates a new record containing only a single field, which is the given value. * * @param value The value for the single field of the record. */ public Record(Value value) { setField(0, value); }