Skip to content

Commit

Permalink
Merge branch 'development' into releases
Browse files Browse the repository at this point in the history
  • Loading branch information
kotik-coder committed Jan 9, 2023
2 parents f1cb168 + caf3237 commit f72862b
Show file tree
Hide file tree
Showing 71 changed files with 1,216 additions and 636 deletions.
13 changes: 6 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>kotik-coder</groupId>
<artifactId>PULsE</artifactId>
<version>1.97</version>
<version>1.97b</version>
<name>PULsE</name>
<description>Processing Unit for Laser flash Experiments</description>
<developers>
Expand All @@ -18,20 +18,19 @@
<name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

</licenses>
<dependencies>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>com.weblookandfeel</groupId>
<artifactId>weblaf-ui</artifactId>
<version>1.2.13</version>
<groupId>com.formdev</groupId>
<artifactId>flatlaf</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pulse/baseline/LinearBaseline.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public LinearBaseline(double intercept, double slope) {
super(intercept, slope);
}

public LinearBaseline(LinearBaseline baseline) {
public LinearBaseline(AdjustableBaseline baseline) {
super( (double) baseline.getIntercept().getValue(),
(double) baseline.getSlope().getValue()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@

import java.io.FileOutputStream;
import java.io.IOException;
import javax.swing.JEditorPane;

import javax.swing.text.BadLocationException;
import javax.swing.text.html.HTMLEditorKit;

import pulse.ui.components.LogPane;
import pulse.ui.components.TextLogPane;

/**
* Similar to a {@code LogExporter}, except that it works only on the contents
* of a {@code LogPane} currently being displayed to the user.
*
*/
public class LogPaneExporter implements Exporter<LogPane> {
public class TextLogPaneExporter implements Exporter<TextLogPane> {

private static LogPaneExporter instance = new LogPaneExporter();
private static TextLogPaneExporter instance = new TextLogPaneExporter();

private LogPaneExporter() {
private TextLogPaneExporter() {
// intentionally blank
}

Expand All @@ -29,10 +30,11 @@ private LogPaneExporter() {
* argument is ignored. After exporting, the stream is explicitly closed.
*/
@Override
public void printToStream(LogPane pane, FileOutputStream fos, Extension extension) {
var kit = (HTMLEditorKit) pane.getEditorKit();
public void printToStream(TextLogPane pane, FileOutputStream fos, Extension extension) {
var editorPane = (JEditorPane) pane.getGUIComponent();
var kit = (HTMLEditorKit) editorPane.getEditorKit();
try {
kit.write(fos, pane.getDocument(), 0, pane.getDocument().getLength());
kit.write(fos, editorPane.getDocument(), 0, editorPane.getDocument().getLength());
} catch (IOException | BadLocationException e) {
System.err.println("Could not export the log pane!");
e.printStackTrace();
Expand All @@ -50,16 +52,16 @@ public void printToStream(LogPane pane, FileOutputStream fos, Extension extensio
*
* @return an instance of{@code LogPaneExporter}.
*/
public static LogPaneExporter getInstance() {
public static TextLogPaneExporter getInstance() {
return instance;
}

/**
* @return {@code LogPane.class}.
*/
@Override
public Class<LogPane> target() {
return LogPane.class;
public Class<TextLogPane> target() {
return TextLogPane.class;
}

/**
Expand All @@ -70,4 +72,4 @@ public Extension[] getSupportedExtensions() {
return new Extension[]{HTML};
}

}
}
31 changes: 22 additions & 9 deletions src/main/java/pulse/math/ParameterIdentifier.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package pulse.math;

import java.util.Objects;
import pulse.properties.NumericPropertyKeyword;

public class ParameterIdentifier {
Expand All @@ -15,6 +16,14 @@ public ParameterIdentifier(NumericPropertyKeyword keyword, int index) {
public ParameterIdentifier(NumericPropertyKeyword keyword) {
this(keyword, 0);
}

@Override
public int hashCode() {
int hash = 7;
hash = 29 * hash + Objects.hashCode(this.keyword);
hash = 29 * hash + this.index;
return hash;
}

public ParameterIdentifier(int index) {
this.index = index;
Expand All @@ -30,24 +39,28 @@ public int getIndex() {

@Override
public boolean equals(Object id) {
if(!id.getClass().equals(ParameterIdentifier.class)) {
if(id.getClass() == null) {
return false;
}

var pid = (ParameterIdentifier) id;

boolean result = true;
var classA = id.getClass();
var classB = this.getClass();

if(keyword != pid.keyword || index != pid.index)
result = false;

return result;
if(classA != classB) {
return false;
}

var pid = (ParameterIdentifier) id;
return keyword == pid.keyword && Math.abs(index - pid.index) < 1;
}

@Override
public String toString() {
return keyword + " # " + index;
StringBuilder sb = new StringBuilder("").append(keyword);
if(index > 0) {
sb.append(" # ").append(index);
}
return sb.toString();
}

}
Loading

0 comments on commit f72862b

Please sign in to comment.