# HG changeset patch # User riono # Date 1620127037 -32400 # Node ID 73a3c53c7568b16c22342e0b77350a4d41b1519b # Parent 8336f55a92e7eb360419d752be1294e97fa8fae8 fix sorucecode diff -r 8336f55a92e7 -r 73a3c53c7568 Paper/riono-sigos.tex --- 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$$(data) を使用する。Deserializeはジェネリスク関数であるため、$<>$内に解凍するデータのクラスを指定する。 Code \ref{code:csmspackEx} の21行目では、変数それぞれにkey を設定していることでjson に展開することが可能である。 - - - - - - \section{CodeGear 実行時のThreadPool からTask への変更} - +java では別Thread を \section{C\#への書き換え後のプログラムの例} diff -r 8336f55a92e7 -r 73a3c53c7568 Paper/src/CodeGearExecuter.cs --- /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; + } +} diff -r 8336f55a92e7 -r 73a3c53c7568 Paper/src/CodeGearExecuter.java --- /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; + } +} diff -r 8336f55a92e7 -r 73a3c53c7568 Paper/src/MessagePackEx.java --- 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. diff -r 8336f55a92e7 -r 73a3c53c7568 Paper/src/StartHelloWorld.cs --- 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 diff -r 8336f55a92e7 -r 73a3c53c7568 Paper/src/StartHelloWorld.java --- 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) { diff -r 8336f55a92e7 -r 73a3c53c7568 Paper/src/Take.cs --- 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 diff -r 8336f55a92e7 -r 73a3c53c7568 Paper/src/Take.java --- 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 { } diff -r 8336f55a92e7 -r 73a3c53c7568 Paper/src/ThreadPoolExecuter.cs --- /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