@Test public void testFromStringParameter() { Parameter p = new Parameter("name", "svalue"); Attribute att = Attribute.fromParameter(p); assertThat(att).isEqualTo(new Attribute("name", "svalue")); }
public static Attribute fromParameter(Parameter param) { Preconditions.checkNotNull(param); Builder b = builder(param.getName()); if (param.isString()) { b.setStringValue(param.getStringValue()); } else { double[] values = param.getNumericValues(); assert values != null; int n = values.length; Array<?> vala = Arrays.factory(DataType.DOUBLE, new int[] {n}, values); b.setArrayValues(vala); } return b.build(); }
Attribute { public static Attribute fromParameter(Parameter param) { Preconditions.checkNotNull(param); Builder b = builder(param.getName()); if (param.isString()) { b.setStringValue(param.getStringValue()); } else { double[] values = param.getNumericValues(); assert values != null; int n = values.length; Array<?> vala = Arrays.factory(DataType.DOUBLE, new int[] {n}, values); b.setArrayValues(vala); } return b.build(); } }
Attribute { public static Attribute fromParameter(Parameter param) { Preconditions.checkNotNull(param); Builder b = builder(param.getName()); if (param.isString()) { b.setStringValue(param.getStringValue()); } else { double[] values = param.getNumericValues(); assert values != null; int n = values.length; Array<?> vala = Arrays.factory(DataType.DOUBLE, new int[] {n}, values); b.setArrayValues(vala); } return b.build(); } Attribute(String name, @Nullable String val);  Attribute(String name, Number val); private  Attribute(Builder builder); }
Attribute { public static Attribute fromParameter(Parameter param) { Preconditions.checkNotNull(param); Builder b = builder(param.getName()); if (param.isString()) { b.setStringValue(param.getStringValue()); } else { double[] values = param.getNumericValues(); assert values != null; int n = values.length; Array<?> vala = Arrays.factory(DataType.DOUBLE, new int[] {n}, values); b.setArrayValues(vala); } return b.build(); } Attribute(String name, @Nullable String val);  Attribute(String name, Number val); private  Attribute(Builder builder); static Attribute fromParameter(Parameter param); static Attribute fromArray(String name, ucar.ma2.Array values); static Attribute fromArray(String name, Array<?> values); static Attribute emptyValued(String name, DataType dtype); DataType getDataType(); @Nullable EnumTypedef getEnumType(); int getLength(); String getName(); @Nullable Number getNumericValue(); @Nullable Number getNumericValue(int index); String getShortName(); @Nullable String getStringValue(); @Nullable String getStringValue(int index); @Nullable Object getValue(int index); @Nullable ucar.ma2.Array getValues(); @Nullable ucar.array.Array<?> getArrayValues(); boolean isArray(); boolean isString(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); Builder toBuilder(); static Builder builder(); static Builder builder(String name); }
Attribute { public static Attribute fromParameter(Parameter param) { Preconditions.checkNotNull(param); Builder b = builder(param.getName()); if (param.isString()) { b.setStringValue(param.getStringValue()); } else { double[] values = param.getNumericValues(); assert values != null; int n = values.length; Array<?> vala = Arrays.factory(DataType.DOUBLE, new int[] {n}, values); b.setArrayValues(vala); } return b.build(); } Attribute(String name, @Nullable String val);  Attribute(String name, Number val); private  Attribute(Builder builder); static Attribute fromParameter(Parameter param); static Attribute fromArray(String name, ucar.ma2.Array values); static Attribute fromArray(String name, Array<?> values); static Attribute emptyValued(String name, DataType dtype); DataType getDataType(); @Nullable EnumTypedef getEnumType(); int getLength(); String getName(); @Nullable Number getNumericValue(); @Nullable Number getNumericValue(int index); String getShortName(); @Nullable String getStringValue(); @Nullable String getStringValue(int index); @Nullable Object getValue(int index); @Nullable ucar.ma2.Array getValues(); @Nullable ucar.array.Array<?> getArrayValues(); boolean isArray(); boolean isString(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); Builder toBuilder(); static Builder builder(); static Builder builder(String name);  }