diff --git a/src/main/java/com/iflytop/uf/UfCommand.java b/src/main/java/com/iflytop/uf/UfCommand.java new file mode 100644 index 0000000..99c9957 --- /dev/null +++ b/src/main/java/com/iflytop/uf/UfCommand.java @@ -0,0 +1,6 @@ +package com.iflytop.uf; +import java.util.List; +public interface UfCommand { + // execute + void execute( List args ); +} diff --git a/src/main/java/com/iflytop/uf/command/UfCmdDelay.java b/src/main/java/com/iflytop/uf/command/UfCmdDelay.java new file mode 100644 index 0000000..1d94ccf --- /dev/null +++ b/src/main/java/com/iflytop/uf/command/UfCmdDelay.java @@ -0,0 +1,16 @@ +package com.iflytop.uf.command; +import com.iflytop.uf.UfCommand; +import java.util.List; +public class UfCmdDelay implements UfCommand { + @Override + public void execute( List args ) { + // get delay time + int delayTime = Integer.parseInt(args.get(0)); + // sleep + try { + Thread.sleep(delayTime); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } +}