Skip to content

Commit

Permalink
More structural changes for multi-instrument channels.
Browse files Browse the repository at this point in the history
  • Loading branch information
WuhrlWuhrd committed Feb 7, 2024
1 parent 5ab6505 commit aa73776
Show file tree
Hide file tree
Showing 27 changed files with 338 additions and 589 deletions.
1 change: 1 addition & 0 deletions .idea/dictionaries/william.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified JISA.jar
Binary file not shown.
16 changes: 4 additions & 12 deletions src/jisa/Main.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package jisa;

import javafx.application.Platform;
import jisa.addresses.Address;
import jisa.gui.ConnectorGrid;
import jisa.gui.DeviceShell;
import jisa.gui.Doc;
import jisa.gui.GUI;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.time.LocalDateTime;

public class Main {
Expand Down Expand Up @@ -99,15 +95,11 @@ public static void main(String[] args) {
}

} catch (Exception | Error e) {
Util.sleep(500);
StringWriter w = new StringWriter();
w.append(e.getMessage());
w.append("\n\n");
e.printStackTrace(new PrintWriter(w));
e.printStackTrace();
GUI.errorAlert("JISA Library", "Exception Encountered", w.toString(), 800);
Platform.exit();

GUI.showException(e);
GUI.stopGUI();
System.exit(0);

}

}
Expand Down
20 changes: 10 additions & 10 deletions src/jisa/devices/interfaces/MCSMU.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Abstract class defining the standard interface for Multiple-Channel SMUs.
*/
public interface MCSMU extends Instrument, MultiInstrument, Iterable<SMU> {
public interface MCSMU<T extends SMU> extends Instrument, MultiInstrument, Iterable<T> {

static String getDescription() {
return "Multi-Channel Source Measure Unit";
Expand All @@ -21,23 +21,23 @@ static String getDescription() {
*
* @return List of SMU channels
*/
List<SMU> getSMUChannels();
List<T> getSMUChannels();

/**
* Returns a list of all SMU channels in this multi-channel SMU.
* Alias for backwards compatibility.
*
* @return List of SMU channels
*/
default List<SMU> getChannels() {
default List<T> getChannels() {
return getSMUChannels();
}

default SMU getSMUChannel(int index) {
default T getSMUChannel(int index) {
return getSMUChannels().get(index);
}

default SMU getChannel(int index) {
default T getChannel(int index) {
return getSMUChannel(index);
}

Expand All @@ -56,23 +56,23 @@ default void turnOffAll() throws IOException, DeviceException {
forEachSMU(SMU::turnOff);
}

default void forEachSMU(SMUAcceptor forEach) throws IOException, DeviceException {
default void forEachSMU(SMUAcceptor<T> forEach) throws IOException, DeviceException {

for (SMU smu : this) {
for (T smu : this) {
forEach.accept(smu);
}

}

@NotNull
@Override
default Iterator<SMU> iterator() {
default Iterator<T> iterator() {
return getSMUChannels().iterator();
}

interface SMUAcceptor {
interface SMUAcceptor<T extends SMU> {

void accept(SMU smu) throws DeviceException, IOException;
void accept(T smu) throws DeviceException, IOException;

}

Expand Down
94 changes: 0 additions & 94 deletions src/jisa/devices/interfaces/MSTCouple.java

This file was deleted.

Loading

0 comments on commit aa73776

Please sign in to comment.