@Test public void testMakeString() { VariableSimpleBuilder builder = VariableSimpleBuilder.makeString("name", "desc", "units", 11).addAttribute(new Attribute("name", 3.45)); VariableSimpleIF vs = builder.build(); assertThat(vs.getShortName()).isEqualTo("name"); assertThat(vs.getFullName()).isEqualTo("name"); assertThat(vs.getDescription()).isEqualTo("desc"); assertThat(vs.getUnitsString()).isEqualTo("units"); assertThat(vs.getDataType()).isEqualTo(DataType.CHAR); assertThat(vs.getDimensions()).hasSize(1); assertThat(vs.getShape()).isEqualTo(new int[] {11}); assertThat(vs.getRank()).isEqualTo(1); assertThat(vs.attributes().findAttributeDouble("name", 0.0)).isEqualTo(3.45); }
public static VariableSimpleBuilder makeString(String name, String desc, String units, int str_len) { Dimension d = Dimension.builder(name + "_strlen", str_len).setIsShared(false).build(); return new VariableSimpleBuilder(name, desc, units, DataType.CHAR, Collections.singletonList(d)); }
VariableSimpleBuilder { public static VariableSimpleBuilder makeString(String name, String desc, String units, int str_len) { Dimension d = Dimension.builder(name + "_strlen", str_len).setIsShared(false).build(); return new VariableSimpleBuilder(name, desc, units, DataType.CHAR, Collections.singletonList(d)); } }
VariableSimpleBuilder { public static VariableSimpleBuilder makeString(String name, String desc, String units, int str_len) { Dimension d = Dimension.builder(name + "_strlen", str_len).setIsShared(false).build(); return new VariableSimpleBuilder(name, desc, units, DataType.CHAR, Collections.singletonList(d)); } VariableSimpleBuilder(String name, String desc, String units, DataType dt, List<Dimension> dims); }
VariableSimpleBuilder { public static VariableSimpleBuilder makeString(String name, String desc, String units, int str_len) { Dimension d = Dimension.builder(name + "_strlen", str_len).setIsShared(false).build(); return new VariableSimpleBuilder(name, desc, units, DataType.CHAR, Collections.singletonList(d)); } VariableSimpleBuilder(String name, String desc, String units, DataType dt, List<Dimension> dims); static VariableSimpleBuilder fromMember(StructureMembers.Member m); static VariableSimpleBuilder makeScalar(String name, String desc, String units, DataType dt); static VariableSimpleBuilder makeString(String name, String desc, String units, int str_len); VariableSimpleBuilder addAttribute(Attribute att); VariableSimpleBuilder addAttribute(String name, String value); VariableSimpleIF build(); }
VariableSimpleBuilder { public static VariableSimpleBuilder makeString(String name, String desc, String units, int str_len) { Dimension d = Dimension.builder(name + "_strlen", str_len).setIsShared(false).build(); return new VariableSimpleBuilder(name, desc, units, DataType.CHAR, Collections.singletonList(d)); } VariableSimpleBuilder(String name, String desc, String units, DataType dt, List<Dimension> dims); static VariableSimpleBuilder fromMember(StructureMembers.Member m); static VariableSimpleBuilder makeScalar(String name, String desc, String units, DataType dt); static VariableSimpleBuilder makeString(String name, String desc, String units, int str_len); VariableSimpleBuilder addAttribute(Attribute att); VariableSimpleBuilder addAttribute(String name, String value); VariableSimpleIF build();  }