Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hdu reader skip rows #349

Merged
merged 8 commits into from
May 3, 2018
Merged

Hdu reader skip rows #349

merged 8 commits into from
May 3, 2018

Conversation

tarrox
Copy link
Contributor

@tarrox tarrox commented Mar 16, 2018

Added the ability to skip rows in the HDU reader. This is nedded for the SamplePedestalEvent processor that is coming in a later pull request.

This is the second part of the pull request simplification of #246 and can be merged independently of #348.

@tarrox tarrox requested review from maxnoe and kbruegge March 16, 2018 12:50
@@ -35,6 +35,12 @@
final DataInputStream tableDataStream;
DataInputStream heapDataStream = null;

private final Header header;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not public final?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I learned not to expose any variables outside so I did that here, but yeah it is final it can be public. Changed it and removed the getter.

@@ -127,4 +127,8 @@ public Data readNext() throws Exception {

return item;
}

public Reader getReader() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just for tests? Then Reader could be package private and the getter is unnecessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need this also later in the SamplePedestal processor but I changed it to a skipToRow function as this is the only thing I need. No reason to expose the whole reader.

@Override
public void skipToRow(int num) throws IOException {
//calc zshrink problem
//num = num+1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove or explain

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed the error and thus the problem with zshrink

Copy link
Member

@kbruegge kbruegge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really nice. Made some minor suggestions.

@@ -141,4 +143,13 @@ private Serializable readArrayFromStream(BinTable.TableColumn c, DataInputStream
}
return null;
}

@Override
public void skipToRow(int num) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you write a little docstring here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure and done

@@ -127,4 +127,8 @@ public Data readNext() throws Exception {

return item;
}

public void skipToRow(int num) throws IOException{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some javadoc would be nice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* @param num The amount of rows to skip.
* @throws IOException
*/
void skipToRow(int num) throws IOException;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It skips 'num' rows right? So if i call 'skipToRow(4)' twice in a row im looking at row 8 right? I propose to change the name of the method to simply 'skipRows'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It skipped to the row from the beginning and could only be called from there, I changed it now to be able to skip rows whenever

@tarrox
Copy link
Contributor Author

tarrox commented Mar 19, 2018

As said in the reply to @mackaiver, the skipToRow function is now a skipRows function that allows to skip from any position in the file.

@tarrox
Copy link
Contributor Author

tarrox commented May 2, 2018

Removed the commented lines. If this was all it should be ready for merge.

@maxnoe maxnoe merged commit 4c38c40 into master May 3, 2018
@maxnoe maxnoe deleted the HDUReaderSkipRows branch May 3, 2018 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants