Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
apete committed Mar 16, 2024
1 parent 76daab8 commit bfaff49
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.formatter.align_arrows_in_switch_on_columns=true
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line=false
Expand Down Expand Up @@ -194,6 +195,7 @@ org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case_after_arrow=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
Expand Down Expand Up @@ -456,6 +458,7 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.join_line_comments=false
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/ojalgo/array/ArrayFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ SegmentedArray<N> makeSegmented(final long... structure) {
/**
* There are several requirements on the segments:
* <ol>
* <li>All segements, except possibly the last, must have the same length/size/count.</li>
* <li>All segments, except possibly the last, must have the same length/size/count.</li>
* <li>That size must be a power of 2.</li>
* <li>The size of the last segment must be <= "the segment size".</li>
* </ol>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
package org.ojalgo.data.domain.finance.series;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;

import org.ojalgo.netio.TextLineReader;
import org.ojalgo.netio.TextLineReader.Parser;
Expand All @@ -35,7 +33,8 @@ public interface DataFetcher {
InputStream getInputStream();

default <T> AutoSupplier<T> getReader(final Parser<T> parser) {
TextLineReader reader = new TextLineReader(this.getInputStream());
InputStream stream = this.getInputStream();
TextLineReader reader = new TextLineReader(stream);
return reader.withFilteredParser(parser);
}

Expand All @@ -44,15 +43,6 @@ default <T> AutoSupplier<T> getReader(final Parser<T> parser) {
*/
CalendarDateUnit getResolution();

/**
* @return A stream reader that can be sent to a CSV parser
* @deprecated v52 Use {@link #getInputStream()} or {@link #getReader(Parser)} instead.
*/
@Deprecated
default Reader getStreamOfCSV() {
return new InputStreamReader(this.getInputStream());
}

/**
* @return Data identifier
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,53 @@ default <N extends Comparable<N>, DN extends MatrixDecomposition<N>> DN decompos
return retVal;
}

/**
* Will create a new decomposition instance suitable for typical/most cases.
* <p>
* To calculate the decomposition you then need to call the {@link #decompose(Access2D.Collectable)}
* method.
*
* @return A "decomposer" ready to decompose matrices.
*/
default D make() {
return this.make(TYPICAL);
}

default D make(final int numberOfRows, final int numberOfColumns) {
/**
* Will create a new decomposition instance suitable for matrices of the specified size.
* <p>
* To calculate the decomposition you then need to call the {@link #decompose(Access2D.Collectable)}
* method.
*
* @param nbRows The expected number of rows in the matrices to decompose
* @param nbCols The expected number of columns in the matrices to decompose
* @return A "decomposer" ready to decompose matrices.
*/
default D make(final int nbRows, final int nbCols) {
return this.make(new Structure2D() {

@Override
public int getColDim() {
return numberOfColumns;
return nbCols;
}

@Override
public int getRowDim() {
return numberOfRows;
return nbRows;
}
});
}

/**
* Will create a new decomposition instance suitable for matrices of the specified size.
* <p>
* To calculate the decomposition you then need to call the {@link #decompose(Access2D.Collectable)}
* method.
*
* @param typical A 2D structure of roughly the expected size with which this decomposition will be
* used.
* @return A "decomposer" ready to decompose matrices.
*/
D make(Structure2D typical);

}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/ojalgo/netio/TextLineReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public interface Parser<T> {
}

/**
* not null, not empty and is not a comment (starts with '#')
* not null, not empty, not blank and not a comment (starts with '#')
*/
public static boolean isLineOK(final String line) {
return line != null && line.length() > 0 && !line.startsWith("#");
return line != null && line.length() > 0 && !line.isBlank() && !line.startsWith("#");
}

public static TextLineReader of(final File file) {
Expand Down Expand Up @@ -87,10 +87,12 @@ public TextLineReader(final InputStream inputStream) {
myReader = new BufferedReader(delegate);
}

@Override
public void close() throws IOException {
myReader.close();
}

@Override
public String read() {
try {
return myReader.readLine();
Expand Down

0 comments on commit bfaff49

Please sign in to comment.