feat: refactor Chain module

This commit is contained in:
michael 2024-01-18 16:17:39 +08:00
parent 643231c643
commit 0f4fb9fc43
3 changed files with 41 additions and 5 deletions

View File

@ -19,10 +19,22 @@ import java.io.Serializable;
public class Chain implements Serializable {
private String id;
private ChainContext context;
private Invoker[] invokers;
private int index = 0;
protected String id;
protected ChainContext context;
protected Invoker[] invokers;
protected int index = 0;
public Chain(Invoker[] invokers) {
this.invokers = invokers;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public ChainContext getContext() {
return context;
@ -32,6 +44,22 @@ public class Chain implements Serializable {
this.context = context;
}
public Invoker[] getInvokers() {
return invokers;
}
public void setInvokers(Invoker[] invokers) {
this.invokers = invokers;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public void start() {
doComplete();
}

View File

@ -16,6 +16,10 @@
package com.agentsflex.chain;
public class ParallelChain extends Chain implements Invoker{
public ParallelChain(Invoker[] invokers) {
super(invokers);
}
@Override
public Chain getChain() {
return null;

View File

@ -15,7 +15,11 @@
*/
package com.agentsflex.chain;
public class SequentialChain extends Chain implements Invoker{
public class SequentialChain extends Chain implements Invoker {
public SequentialChain(Invoker[] invokers) {
super(invokers);
}
@Override
public Chain getChain() {
return null;