Mercurial > hg > Papers > 2021 > riono-sigos
changeset 14:73a3c53c7568
fix sorucecode
author | riono <e165729@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 04 May 2021 20:17:17 +0900 |
parents | 8336f55a92e7 |
children | 2dd23f9603b3 |
files | Paper/riono-sigos.tex Paper/src/CodeGearExecuter.cs Paper/src/CodeGearExecuter.java Paper/src/MessagePackEx.java Paper/src/StartHelloWorld.cs Paper/src/StartHelloWorld.java Paper/src/Take.cs Paper/src/Take.java Paper/src/ThreadPoolExecuter.cs |
diffstat | 9 files changed, 72 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/Paper/riono-sigos.tex Tue May 04 18:35:43 2021 +0900 +++ b/Paper/riono-sigos.tex Tue May 04 20:17:17 2021 +0900 @@ -128,6 +128,11 @@ \lstinputlisting[caption=StartHelloWorld, label=code:javaSHW]{src/StartHelloWorld.java} + +\section{歴史について} + + + \section{Unity} \section{annotation の書き換え} @@ -162,15 +167,9 @@ データの圧縮にはMessagePackSerializer.Serialize (data) を使用し、byte[] 型に圧縮される。解凍にはMessagePackSerializer.Deserialize$<T>$(data) を使用する。Deserializeはジェネリスク関数であるため、$<>$内に解凍するデータのクラスを指定する。 Code \ref{code:csmspackEx} の21行目では、変数それぞれにkey を設定していることでjson に展開することが可能である。 - - - - - - \section{CodeGear 実行時のThreadPool からTask への変更} - +java では別Thread を \section{C\#への書き換え後のプログラムの例}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Paper/src/CodeGearExecuter.cs Tue May 04 20:17:17 2021 +0900 @@ -0,0 +1,23 @@ +public class CodeGearExecutor { + private CodeGear cg; + private CodeGearManager cgm; + private int priority = 5; + + public CodeGearExecutor(CodeGear cg, CodeGearManager cgm, int priority) { + this.cg = cg; + this.cgm = cgm; + this.priority = priority; + } + + public void Run() { + cg.Run(cgm); + } + + public int GetPriority() { + return priority; + } + + public void SetPriority(int priority) { + this.priority = priority; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Paper/src/CodeGearExecuter.java Tue May 04 20:17:17 2021 +0900 @@ -0,0 +1,24 @@ +public class CodeGearExecutor implements Runnable { + CodeGear cg; + CodeGearManager cgm; + private int priority = Thread.NORM_PRIORITY; + + public CodeGearExecutor(CodeGear cg, CodeGearManager cgm, int priority){ + this.cg = cg; + this.cgm = cgm; + this.priority = priority; + } + + @Override + public void run() { + cg.run(cgm); + } + + public int getPriority() { + return priority; + } + + public void setPriority(int priority) { + this.priority = priority; + } +}
--- a/Paper/src/MessagePackEx.java Tue May 04 18:35:43 2021 +0900 +++ b/Paper/src/MessagePackEx.java Tue May 04 20:17:17 2021 +0900 @@ -1,7 +1,4 @@ -import org.msgpack.MessagePack; -import org.msgpack.annotation.Message; - -public class Main1 { +public class MessagePackExample { @Message // Annotation public static class MyMessage { // public fields are serialized.
--- a/Paper/src/StartHelloWorld.cs Tue May 04 18:35:43 2021 +0900 +++ b/Paper/src/StartHelloWorld.cs Tue May 04 20:17:17 2021 +0900 @@ -1,6 +1,3 @@ -using Christie_net.codegear; - -namespace Christie_net.Test.Example.HelloWorld { public class StartHelloWorld : StartCodeGear { public StartHelloWorld(CodeGearManager cgm) : base(cgm) { } @@ -14,4 +11,3 @@ } } -} \ No newline at end of file
--- a/Paper/src/StartHelloWorld.java Tue May 04 18:35:43 2021 +0900 +++ b/Paper/src/StartHelloWorld.java Tue May 04 20:17:17 2021 +0900 @@ -1,8 +1,3 @@ -package christie.example.HelloWorld; - -import christie.codegear.CodeGearManager; -import christie.codegear.StartCodeGear; - public class StartHelloWorld extends StartCodeGear { public StartHelloWorld(CodeGearManager cgm) {
--- a/Paper/src/Take.cs Tue May 04 18:35:43 2021 +0900 +++ b/Paper/src/Take.cs Tue May 04 20:17:17 2021 +0900 @@ -1,6 +1,2 @@ -using System; - -namespace Christie_net.annotation { [AttributeUsage(AttributeTargets.Field)] public class Take : Attribute { } -} \ No newline at end of file
--- a/Paper/src/Take.java Tue May 04 18:35:43 2021 +0900 +++ b/Paper/src/Take.java Tue May 04 20:17:17 2021 +0900 @@ -1,11 +1,3 @@ -package christie.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) -public @interface Take { -} +public @interface Take { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Paper/src/ThreadPoolExecuter.cs Tue May 04 20:17:17 2021 +0900 @@ -0,0 +1,17 @@ +public class ThreadPoolExecutors { + + public ThreadPoolExecutors() { + int nWorkerThreads; + int nIOThreads; + ThreadPool.GetMinThreads(out nWorkerThreads, out nIOThreads); + ThreadPool.SetMinThreads(nWorkerThreads, nIOThreads); + } + + public ThreadPoolExecutors(int nWorkerThreads, int nIOThreads) { + ThreadPool.SetMinThreads(nWorkerThreads, nIOThreads); + } + + public void Execute(CodeGearExecutor command) { + Task.Factory.StartNew(() => command.Run()); + } +} \ No newline at end of file