Skip to content

Commit

Permalink
Make Attribute consistent with Dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmudd committed Aug 20, 2020
1 parent 383c1a4 commit 9d85dd5
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion jhdf/src/main/java/io/jhdf/AttributeImpl.java
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ public long getSize() {
}

@Override
public long getDiskSize() {
public long getSizeInBytes() {
return getSize() * message.getDataType().getSize();
}

6 changes: 3 additions & 3 deletions jhdf/src/main/java/io/jhdf/api/Attribute.java
Original file line number Diff line number Diff line change
@@ -51,12 +51,12 @@ public interface Attribute {
long getSize();

/**
* Gets the size of this dataset. <blockquote>i.e. number of elements * size of each element</blockquote>
* Gets the size of this dataset. i.e. <blockquote>number of elements * size of each element</blockquote>
*
* @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
2 changes: 1 addition & 1 deletion jhdf/src/main/java/io/jhdf/api/Dataset.java
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ public interface Dataset extends Node {
long getSize();

/**
* Gets the size of this dataset. <blockquote>i.e. number of elements * size of each element</blockquote>
* Gets the size of this dataset. i.e. <blockquote>number of elements * size of each element</blockquote>
*
* @return the total number of bytes the dataset is using
*/
2 changes: 1 addition & 1 deletion jhdf/src/test/java/io/jhdf/AttributesTest.java
Original file line number Diff line number Diff line change
@@ -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));
6 changes: 3 additions & 3 deletions jhdf/src/test/java/io/jhdf/examples/TestAllFiles.java
Original file line number Diff line number Diff line change
@@ -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()));
}

0 comments on commit 9d85dd5

Please sign in to comment.