From 9d85dd5aa92b2ba621c7cd938f9f6a16be4f9864 Mon Sep 17 00:00:00 2001 From: James Mudd Date: Thu, 20 Aug 2020 17:19:51 +0100 Subject: [PATCH] Make Attribute consistent with Dataset --- jhdf/src/main/java/io/jhdf/AttributeImpl.java | 2 +- jhdf/src/main/java/io/jhdf/api/Attribute.java | 6 +++--- jhdf/src/main/java/io/jhdf/api/Dataset.java | 2 +- jhdf/src/test/java/io/jhdf/AttributesTest.java | 2 +- jhdf/src/test/java/io/jhdf/examples/TestAllFiles.java | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/jhdf/src/main/java/io/jhdf/AttributeImpl.java b/jhdf/src/main/java/io/jhdf/AttributeImpl.java index 99d9db8f..514ee904 100644 --- a/jhdf/src/main/java/io/jhdf/AttributeImpl.java +++ b/jhdf/src/main/java/io/jhdf/AttributeImpl.java @@ -52,7 +52,7 @@ public long getSize() { } @Override - public long getDiskSize() { + public long getSizeInBytes() { return getSize() * message.getDataType().getSize(); } diff --git a/jhdf/src/main/java/io/jhdf/api/Attribute.java b/jhdf/src/main/java/io/jhdf/api/Attribute.java index c364e7df..669fdb61 100644 --- a/jhdf/src/main/java/io/jhdf/api/Attribute.java +++ b/jhdf/src/main/java/io/jhdf/api/Attribute.java @@ -51,12 +51,12 @@ public interface Attribute { long getSize(); /** - * Gets the size of this dataset.
i.e. number of elements * size of each element
+ * Gets the size of this dataset. i.e.
number of elements * size of each element
* - * @return the total number of bytes the dataset is using + * @return the total number of bytes this attributes dataset is using * @see Dataset#getSizeInBytes() */ - long getDiskSize(); + long getSizeInBytes(); /** * Gets the dimensions of this attributes dataset diff --git a/jhdf/src/main/java/io/jhdf/api/Dataset.java b/jhdf/src/main/java/io/jhdf/api/Dataset.java index 8192ac0a..c696cd64 100644 --- a/jhdf/src/main/java/io/jhdf/api/Dataset.java +++ b/jhdf/src/main/java/io/jhdf/api/Dataset.java @@ -27,7 +27,7 @@ public interface Dataset extends Node { long getSize(); /** - * Gets the size of this dataset.
i.e. number of elements * size of each element
+ * Gets the size of this dataset. i.e.
number of elements * size of each element
* * @return the total number of bytes the dataset is using */ diff --git a/jhdf/src/test/java/io/jhdf/AttributesTest.java b/jhdf/src/test/java/io/jhdf/AttributesTest.java index 9f6d74aa..d978fcc0 100644 --- a/jhdf/src/test/java/io/jhdf/AttributesTest.java +++ b/jhdf/src/test/java/io/jhdf/AttributesTest.java @@ -489,7 +489,7 @@ private Executable createTest(HdfFile file, String nodePath, String attributeNam assertThat(attribute.isEmpty(), is(true)); assertThat(attribute.isScalar(), is(false)); assertThat(attribute.getSize(), is(0L)); - assertThat(attribute.getDiskSize(), is(0L)); + assertThat(attribute.getSizeInBytes(), is(0L)); } else if (expectedData.getClass().isArray()) { // Array assertThat(attribute.getJavaType(), is(equalTo(getArrayType(expectedData)))); assertThat(attribute.isEmpty(), is(false)); diff --git a/jhdf/src/test/java/io/jhdf/examples/TestAllFiles.java b/jhdf/src/test/java/io/jhdf/examples/TestAllFiles.java index cccc0710..435e6d8d 100644 --- a/jhdf/src/test/java/io/jhdf/examples/TestAllFiles.java +++ b/jhdf/src/test/java/io/jhdf/examples/TestAllFiles.java @@ -112,16 +112,16 @@ private void verifyAttributes(Node node) { assertThat(attribute.getJavaType(), is(notNullValue())); if (attribute.isEmpty()) { assertThat(attribute.getSize(), is(equalTo(0L))); - assertThat(attribute.getDiskSize(), is(equalTo(0L))); + assertThat(attribute.getSizeInBytes(), is(equalTo(0L))); assertThat(attribute.getData(), is(nullValue())); } else if (attribute.isScalar()) { assertThat(attribute.getSize(), is(equalTo(1L))); - assertThat(attribute.getDiskSize(), is(greaterThan(0L))); + assertThat(attribute.getSizeInBytes(), is(greaterThan(0L))); assertThat(attribute.getData(), is(notNullValue())); assertThat(attribute.getBuffer(), is(notNullValue())); } else { assertThat(attribute.getSize(), is(greaterThan(0L))); - assertThat(attribute.getDiskSize(), is(greaterThan(0L))); + assertThat(attribute.getSizeInBytes(), is(greaterThan(0L))); assertThat(attribute.getData(), is(notNullValue())); assertThat(attribute.getBuffer(), is(notNullValue())); }