Skip to content

Commit

Permalink
[#72] Java packages to zscript
Browse files Browse the repository at this point in the history
  • Loading branch information
susanw1 committed Aug 1, 2023
1 parent cf93c82 commit 410fe7e
Show file tree
Hide file tree
Showing 161 changed files with 779 additions and 704 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.zcode.javareceiver.Zcode;
import org.zcode.javareceiver.ZcodeBusInterruptSource;
import org.zcode.javareceiver.ZcodeParameters;
import org.zcode.javareceiver.commands.ZcodeActivateCommand;
import org.zcode.javareceiver.commands.ZcodeCapabilitiesCommand;
import org.zcode.javareceiver.commands.ZcodeEchoCommand;
import org.zcode.javareceiver.parsing.ZcodeCommandChannel;
import org.zcode.zcode_acceptance_tests.ZcodeAcceptanceTestConnectionManager;

import io.cucumber.java.en.Given;
import net.zscript.javareceiver.Zcode;
import net.zscript.javareceiver.ZcodeBusInterruptSource;
import net.zscript.javareceiver.ZcodeParameters;
import net.zscript.javareceiver.commands.ZcodeActivateCommand;
import net.zscript.javareceiver.commands.ZcodeCapabilitiesCommand;
import net.zscript.javareceiver.commands.ZcodeEchoCommand;
import net.zscript.javareceiver.parsing.ZcodeCommandChannel;

public class JavaReceiverCucumberStartup {
private static boolean hasStarted = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
import java.util.List;
import java.util.function.Consumer;

import org.zcode.javareceiver.AbstractZcodeOutStream;
import org.zcode.javareceiver.Zcode;
import org.zcode.javareceiver.ZcodeOutStream;
import org.zcode.javareceiver.ZcodeParameters;
import org.zcode.javareceiver.instreams.ZcodeChannelInStream;
import org.zcode.javareceiver.parsing.ZcodeCommandChannel;
import org.zcode.javareceiver.parsing.ZcodeCommandSequence;
import org.zcode.zcode_acceptance_tests.acceptancetest_asserts.ZcodeAcceptanceTestConnection;

import net.zscript.javareceiver.AbstractZcodeOutStream;
import net.zscript.javareceiver.Zcode;
import net.zscript.javareceiver.ZcodeOutStream;
import net.zscript.javareceiver.ZcodeParameters;
import net.zscript.javareceiver.instreams.ZcodeChannelInStream;
import net.zscript.javareceiver.parsing.ZcodeCommandChannel;
import net.zscript.javareceiver.parsing.ZcodeCommandSequence;

public class LocalTestConnection implements ZcodeAcceptanceTestConnection, ZcodeCommandChannel {
private final List<Consumer<byte[]>> handlers = new ArrayList<>();
private final ZcodeQueueSequenceInStream queueIn = new ZcodeQueueSequenceInStream();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.zcode.javareceiver_acceptancetests;

import org.zcode.javareceiver.ZcodeLockSet;
import org.zcode.javareceiver.ZcodeOutStream;
import org.zcode.javareceiver.ZcodeResponseStatus;
import org.zcode.javareceiver.commands.ZcodeCommand;
import org.zcode.javareceiver.parsing.ZcodeCommandSequence;
import org.zcode.javareceiver.parsing.ZcodeCommandSlot;
import net.zscript.javareceiver.ZcodeLockSet;
import net.zscript.javareceiver.ZcodeOutStream;
import net.zscript.javareceiver.ZcodeResponseStatus;
import net.zscript.javareceiver.commands.ZcodeCommand;
import net.zscript.javareceiver.parsing.ZcodeCommandSequence;
import net.zscript.javareceiver.parsing.ZcodeCommandSlot;

public class ZcodeIdentifyCommand implements ZcodeCommand {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import java.util.LinkedList;
import java.util.Queue;

import org.zcode.javareceiver.instreams.ZcodeChannelInStream;
import org.zcode.javareceiver.instreams.ZcodeLookaheadStream;
import org.zcode.javareceiver.instreams.ZcodeSequenceInStream;
import net.zscript.javareceiver.instreams.ZcodeChannelInStream;
import net.zscript.javareceiver.instreams.ZcodeLookaheadStream;
import net.zscript.javareceiver.instreams.ZcodeSequenceInStream;

public class ZcodeQueueSequenceInStream implements ZcodeChannelInStream {
private final Queue<byte[]> messages = new LinkedList<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javaclient.responseParser;
package net.zscript.javaclient.responseParser;

import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javaclient.responseParser;
package net.zscript.javaclient.responseParser;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand All @@ -8,9 +8,9 @@
import java.util.Queue;
import java.util.function.Consumer;

import org.zcode.javaclient.responseParser.ZcodeResponseParser.ResponseHeader;
import org.zcode.javaclient.zcodeApi.CommandSeqElement;
import org.zcode.javaclient.zcodeApi.ZcodeCommandBuilder;
import net.zscript.javaclient.responseParser.ZcodeResponseParser.ResponseHeader;
import net.zscript.javaclient.zcodeApi.CommandSeqElement;
import net.zscript.javaclient.zcodeApi.ZcodeCommandBuilder;

public class ZcodeCommandResponseQueue implements ZcodeCommandResponseSystem {
private static final int MAX_SENT = 10;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.zcode.javaclient.responseParser;
package net.zscript.javaclient.responseParser;

import java.util.function.Consumer;

import org.zcode.javaclient.zcodeApi.CommandSeqElement;
import net.zscript.javaclient.zcodeApi.CommandSeqElement;

public interface ZcodeCommandResponseSystem {
void send(CommandSeqElement seq);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javaclient.responseParser;
package net.zscript.javaclient.responseParser;

import java.util.function.Consumer;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javaclient.responseParser;
package net.zscript.javaclient.responseParser;

import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package org.zcode.javaclient.responseParser;
package net.zscript.javaclient.responseParser;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;

import org.zcode.javaclient.zcodeApi.CommandSeqElement;
import org.zcode.javaclient.zcodeApi.ZcodeCommand;
import org.zcode.javaclient.zcodeApi.ZcodeCommand.ZcodeSequencePath;
import org.zcode.javaclient.zcodeApi.ZcodeUnparsedCommandResponse;
import org.zcode.javareceiver.tokenizer.OptIterator;
import org.zcode.javareceiver.tokenizer.ZcodeTokenBuffer;
import org.zcode.javareceiver.tokenizer.ZcodeTokenBuffer.TokenReader;
import org.zcode.javareceiver.tokenizer.ZcodeTokenBuffer.TokenReader.ReadToken;
import org.zcode.javareceiver.tokenizer.ZcodeTokenExtendingBuffer;
import org.zcode.javareceiver.tokenizer.ZcodeTokenizer;
import net.zscript.javaclient.zcodeApi.CommandSeqElement;
import net.zscript.javaclient.zcodeApi.ZcodeCommand;
import net.zscript.javaclient.zcodeApi.ZcodeUnparsedCommandResponse;
import net.zscript.javaclient.zcodeApi.ZcodeCommand.ZcodeSequencePath;
import net.zscript.javareceiver.tokenizer.OptIterator;
import net.zscript.javareceiver.tokenizer.ZcodeTokenBuffer;
import net.zscript.javareceiver.tokenizer.ZcodeTokenExtendingBuffer;
import net.zscript.javareceiver.tokenizer.ZcodeTokenizer;
import net.zscript.javareceiver.tokenizer.ZcodeTokenBuffer.TokenReader;
import net.zscript.javareceiver.tokenizer.ZcodeTokenBuffer.TokenReader.ReadToken;

public class ZcodeResponseParser {
static class ResponseHeader {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javaclient.zcodeApi;
package net.zscript.javaclient.zcodeApi;

public abstract class CommandSeqElement {
protected CommandSeqElement parent = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javaclient.zcodeApi;
package net.zscript.javaclient.zcodeApi;

import java.nio.charset.StandardCharsets;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javaclient.zcodeApi;
package net.zscript.javaclient.zcodeApi;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javaclient.zcodeApi;
package net.zscript.javaclient.zcodeApi;

public class ZcodeBlankCommand extends ZcodeCommand {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javaclient.zcodeApi;
package net.zscript.javaclient.zcodeApi;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javaclient.zcodeApi;
package net.zscript.javaclient.zcodeApi;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javaclient.zcodeApi;
package net.zscript.javaclient.zcodeApi;

import java.nio.charset.StandardCharsets;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javaclient.zcodeApi;
package net.zscript.javaclient.zcodeApi;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package net.zscript.javaclient.zcodeApi;

public interface ZcodeResponse {

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javaclient.zcodeApi;
package net.zscript.javaclient.zcodeApi;

public interface ZcodeResponseListener<T extends ZcodeResponse> {
void accept(T resp);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.zcode.javaclient.zcodeApi;
package net.zscript.javaclient.zcodeApi;

import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Optional;

import org.zcode.javareceiver.tokenizer.BlockIterator;
import org.zcode.javareceiver.tokenizer.OptIterator;
import org.zcode.javareceiver.tokenizer.Zchars;
import org.zcode.javareceiver.tokenizer.ZcodeTokenBuffer.TokenReader.ReadToken;
import net.zscript.javareceiver.tokenizer.BlockIterator;
import net.zscript.javareceiver.tokenizer.OptIterator;
import net.zscript.javareceiver.tokenizer.Zchars;
import net.zscript.javareceiver.tokenizer.ZcodeTokenBuffer.TokenReader.ReadToken;

public class ZcodeUnparsedCommandResponse {
private final ReadToken first;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.zcode.javareceiver.core;
package net.zscript.javareceiver.core;

import java.util.ArrayList;
import java.util.List;

import org.zcode.javareceiver.execution.ActionSource;
import org.zcode.javareceiver.execution.ZcodeExecutor;
import org.zcode.javareceiver.modules.ZcodeModule;
import org.zcode.javareceiver.modules.ZcodeModuleRegistry;
import org.zcode.javareceiver.notifications.ZcodeNotificationSource;
import net.zscript.javareceiver.execution.ActionSource;
import net.zscript.javareceiver.execution.ZcodeExecutor;
import net.zscript.javareceiver.modules.ZcodeModule;
import net.zscript.javareceiver.modules.ZcodeModuleRegistry;
import net.zscript.javareceiver.notifications.ZcodeNotificationSource;

public class Zcode {
private final ZcodeModuleRegistry moduleRegistry = new ZcodeModuleRegistry();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.zcode.javareceiver.core;
package net.zscript.javareceiver.core;

import java.nio.charset.StandardCharsets;

import org.zcode.javareceiver.execution.ZcodeField;
import org.zcode.javareceiver.tokenizer.BlockIterator;
import org.zcode.javareceiver.tokenizer.Zchars;
import net.zscript.javareceiver.execution.ZcodeField;
import net.zscript.javareceiver.tokenizer.BlockIterator;
import net.zscript.javareceiver.tokenizer.Zchars;

public abstract class ZcodeAbstractOutStream implements ZcodeOutStream, ZcodeCommandOutStream {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.zcode.javareceiver.core;

import org.zcode.javareceiver.execution.ActionSource;
import org.zcode.javareceiver.execution.ZcodeCommandContext;
import org.zcode.javareceiver.semanticParser.ExecutionActionFactory;
import org.zcode.javareceiver.semanticParser.SemanticParser;
import org.zcode.javareceiver.semanticParser.ZcodeSemanticAction;
import org.zcode.javareceiver.tokenizer.ZcodeTokenBuffer;
package net.zscript.javareceiver.core;

import net.zscript.javareceiver.execution.ActionSource;
import net.zscript.javareceiver.execution.ZcodeCommandContext;
import net.zscript.javareceiver.semanticParser.ExecutionActionFactory;
import net.zscript.javareceiver.semanticParser.SemanticParser;
import net.zscript.javareceiver.semanticParser.ZcodeSemanticAction;
import net.zscript.javareceiver.tokenizer.ZcodeTokenBuffer;

public abstract class ZcodeChannel implements ActionSource {
protected final SemanticParser p;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.zcode.javareceiver.core;
package net.zscript.javareceiver.core;

import org.zcode.javareceiver.execution.ZcodeField;
import net.zscript.javareceiver.execution.ZcodeField;

/**
* Defines the operations on the response OutStream available to a command via the ZcodeCommandContext.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javareceiver.core;
package net.zscript.javareceiver.core;

import java.util.Iterator;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javareceiver.core;
package net.zscript.javareceiver.core;

public class ZcodeLocks {
public static final int LOCK_BYTENUM = 32;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javareceiver.core;
package net.zscript.javareceiver.core;

/**
* Defines the sequence-level life-cycle operations that allow responses to be sent back up to a channel.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zcode.javareceiver.core;
package net.zscript.javareceiver.core;

public class ZcodeStatus {
/** command success */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.zcode.javareceiver.execution;
package net.zscript.javareceiver.execution;

import org.zcode.javareceiver.semanticParser.ContextView;
import org.zcode.javareceiver.semanticParser.ContextView.AsyncActionNotifier;
import net.zscript.javareceiver.semanticParser.ContextView;
import net.zscript.javareceiver.semanticParser.ContextView.AsyncActionNotifier;

abstract class AbstractContext {
protected final ContextView contextView;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package net.zscript.javareceiver.execution;

import net.zscript.javareceiver.core.Zcode;
import net.zscript.javareceiver.core.ZcodeOutStream;

public interface ActionSource {
ZcodeAction getAction();

ZcodeOutStream getOutStream(Zcode zcode);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.zcode.javareceiver.execution;
package net.zscript.javareceiver.execution;

import org.zcode.javareceiver.core.Zcode;
import org.zcode.javareceiver.core.ZcodeOutStream;
import net.zscript.javareceiver.core.Zcode;
import net.zscript.javareceiver.core.ZcodeOutStream;

public interface ZcodeAction {
boolean isEmptyAction();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.zcode.javareceiver.execution;
package net.zscript.javareceiver.execution;

import java.util.Optional;

import org.zcode.javareceiver.core.ZcodeStatus;
import org.zcode.javareceiver.semanticParser.ContextView;
import org.zcode.javareceiver.tokenizer.BlockIterator;
import org.zcode.javareceiver.tokenizer.OptIterator;
import org.zcode.javareceiver.tokenizer.Zchars;
import org.zcode.javareceiver.tokenizer.ZcodeTokenBuffer.TokenReader.ReadToken;
import org.zcode.javareceiver.tokenizer.ZcodeTokenizer;
import net.zscript.javareceiver.core.ZcodeStatus;
import net.zscript.javareceiver.semanticParser.ContextView;
import net.zscript.javareceiver.tokenizer.BlockIterator;
import net.zscript.javareceiver.tokenizer.OptIterator;
import net.zscript.javareceiver.tokenizer.Zchars;
import net.zscript.javareceiver.tokenizer.ZcodeTokenizer;
import net.zscript.javareceiver.tokenizer.ZcodeTokenBuffer.TokenReader.ReadToken;

public class ZcodeAddressingContext extends AbstractContext {
public ZcodeAddressingContext(final ContextView contextView) {
Expand Down
Loading

0 comments on commit 410fe7e

Please sign in to comment.