annotate Paper/riono-sigos.tex @ 15:2dd23f9603b3

update chapter Christie example
author riono <e165729@ie.u-ryukyu.ac.jp>
date Tue, 04 May 2021 23:41:09 +0900
parents 73a3c53c7568
children c65256380a80
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 %%
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 %% 研究報告用スイッチ
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 %% [techrep]
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 %%
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 %% 欧文表記無しのスイッチ(etitle,eabstractは任意)
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 %% [noauthor]
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 %%
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 %\documentclass[submit,techrep]{ipsj}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 \documentclass[submit,techrep,noauthor]{ipsj}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 \usepackage[dvips]{graphicx}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 \usepackage{latexsym}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 \usepackage{url}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 \usepackage{listings}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 \usepackage{caption}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 \def\Underline{\setbox0\hbox\bgroup\let\\\endUnderline}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 \def\endUnderline{\vphantom{y}\egroup\smash{\underline{\box0}}\\}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 \def\|{\verb|}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 %
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 %\setcounter{巻数}{59}%vol59=2018
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 %\setcounter{号数}{10}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 %\setcounter{page}{1}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28
8
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
29 \lstset{
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
30 language=java,
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
31 tabsize=2,
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
32 numbers=left,
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
33 frame=single,
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
34 basicstyle={\ttfamily\footnotesize}, %
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
35 identifierstyle={\footnotesize}, %
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
36 commentstyle={\footnotesize\itshape}, %
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
37 keywordstyle={\footnotesize\bfseries}, %
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
38 ndkeywordstyle={\footnotesize}, %
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
39 stringstyle={\footnotesize\ttfamily},
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
40 breaklines=true,
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
41 captionpos=t,
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
42 columns=[l]{fullflexible}, %
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
43 xrightmargin=0zw, %
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
44 xleftmargin=1zw, %
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
45 aboveskip=1zw,
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
46 numberstyle={\scriptsize}, %
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
47 stepnumber=1,
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
48 numbersep=0.5zw, %
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
49 lineskip=-0.5ex,
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
50 }
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
51
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
52 \renewcommand{\lstlistingname}{Code}
5
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 \begin{document}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 \title{継続を使用する並列分散フレームワークのUnity実装}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 %\etitle{How to Prepare Your Paper for IPSJ SIG Technical Report \\ (version 2018/10/29)}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 \affiliate{KIE}{琉球大学大学院理工学研究科情報工学専攻}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 \affiliate{IE}{琉球大学工学部工学科知能情報コース}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 \author{安田 亮}{Ryo Yasuda}{KIE}[riono210@cr.ie.u-ryukyu.ac.jp]
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 \author{河野 真治}{Shinji Kono}{IE}[kono@ie.u-ryukyu.ac.jp]
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 \begin{abstract}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 FPSやMMORPGなどのゲームにおける通信方式には、クライアントサーバ方式とp2p方式の2つが考えられる。しかし、クライアントの負荷軽減やチート対策などを理由にクライアントサーバ方式が主流である。データの同期にはサーバを経由するため低速である。
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 そこで本研究室で開発している分散フレームワークChristieを用いることで、高速かつ、安全に、データの同期を行いたいと考えた。
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 本研究ではChrisiteをゲームエンジンUnityに対応するため、C\#への書き換えを行う。
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 \end{abstract}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 %
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 %\begin{jkeyword}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 %情報処理学会論文誌ジャーナル,\LaTeX,スタイルファイル,べからず集
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 %\end{jkeyword}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 %
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 %\begin{eabstract}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 %This document is a guide to prepare a draft for submitting to IPSJ
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 %Journal, and the final camera-ready manuscript of a paper to appear in
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 %IPSJ Journal, using {\LaTeX} and special style files. Since this
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 %document itself is produced with the style files, it will help you to
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 %refer its source file which is distributed with the style files.
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 %\end{eabstract}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 %
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 %\begin{ekeyword}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 %IPSJ Journal, \LaTeX, style files, ``Dos and Dont's'' list
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 %\end{ekeyword}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 \maketitle
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 \section{オンラインゲームにおけるデータ通信}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96
15
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
97
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
98
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
99 \section{Chrisite のC\#への書き換えについて}
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
100 Chrisite はAlice というプロジェクトで開発が行われていた。しかしAlice には様々な問題点があった。
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
101
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
102
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
103
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
104
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
105
5
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 \section{Christieの基礎概念}
7
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
107 Chrisiteは当研究室で開発している分散通信フレームワークである。同じく当研究室で開発している GearsOSのファイルシステムに組み込まれる予定があるため、GearsOSを構成する言語 Continuation based Cと似た概念を持っている。 Chrisiteに存在する概念として以下のようなものがある。
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
108
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
109 \begin{itemize} %箇条書き
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
110 \item CodeGear
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
111 \item DataGear
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
112 \item CodeGearManager
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
113 \item DataGearManager
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
114 \end{itemize}
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
115
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
116 以下はjava版のChrisiteについて解説を行う。
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
117 CodeGearはクラスやスレッドに相当する。
8
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
118 DataGearは変数データに相当し、CodeGear内でannotationを用いて変数データを取得する。CodeGear内に記述した全てのDataGearの中にデータが格納された際に、初めてそのCodeGearが実行されるという仕組みになっている。
7
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
119 CodeGearManagerはノードであり、CodeGear、DataGear、DataGearManagerを管理する。
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
120 DataGearManagerはDataGearを管理するものであり、putという操作により変数データ、つまりDataGearを格納できる。DataGearManagerのput操作を行う際にはLocalとRemoteのどちらかを選び、変数のkeyとデータを引数として渡す。
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
121 Localであれば、LocalのCodeGearManagerが管理しているDataGearManagerに対しDataGearを格納していく。Remoteであれば、接続したRemote先のCodeGearManagerが管理しているDataGearManagerにDataGearを格納できる。
8
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
122 put操作を行った後は、対象のDataGearManagerの中にqueueとして保管される。DataGearを取り出す際には、CodeGearm内で宣言した変数データにannotationをつける。DataGearのannotationにはTake、Peek、TakeFrom、PeekFromの4つがある。
7
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
123
65d3256f35d1 update chapter Christie
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
124
8
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
125 \begin{description}
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
126 \item[Take] 先頭のDataGear を読み込み、そのDataGear を削除する。DataGearが複数ある場合、この動作を用いる
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
127 \item[Peek] 先頭のDataGear を読み込むが、DataGear が削除されない。そのため、特に操作をしない場合は同じデータを参照し続ける。
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
128 \item[TakeFrom (Remote DGM name)] Take と似ているが、Remote DGM nameを指定することで、その接続先(Remote) のDataGearManager からTake 操作を行える。
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
129 \item[PeekFrom (Remote DGM name)] Peek と似ているが、Remote DGM name を指定することで、その接続先(Remote) のDataGearManager からPeek 操作を行える。
9
c5abec609e35 add StartHelloWorld
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
130 \end{description}
8
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
131
9
c5abec609e35 add StartHelloWorld
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
132 \section{プログラムの例}
15
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
133 Code \ref{code:javaSHW} 、Code \ref{code:javaHWC} 、Code \ref{code:javaFHW} はChrisite の機能を使用してhello world を出力する例題である。
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
134
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
135 \lstinputlisting[caption=StartHelloWorld, label=code:javaSHW]{src/StartHelloWorld.java}
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
136 \lstinputlisting[caption=HelloWorldCodeGear, label=code:javaHWC]{src/HelloWorldCodeGear.java}
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
137 \lstinputlisting[caption=FinishHelloWorld, label=code:javaFHW]{src/FinishHelloWorld.java}
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
138
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
139 Code \ref{code:javaSHW} ではCodeGearManager を作り、setup(new CodeGear) を行うことで各CodeGear に記述されたDataGear の待ち合わせを行う。全てのDataGear が揃った場合にCodeGear が実行される。CodeGearaManager の作成方法はStartCodeGear を継承したものから、createCGM(port) を実行することにより、CodeGearManager が作成できる。
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
140
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
141 Code \ref{code:javaSHW} の11、12行目はput(key, data) を行うことでDataGearManager のqueue にデータを格納することができる。key はstring 型のみで格納したい変数名を指定する。11、12行目のput ではCode \ref{code:javaHWC} のフィールド変数helloWorld を指定し、データは"hello" と"world" を逐次的に格納している。
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
142
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
143 Code \ref{code:javaHWC} 、Code \ref{code:javaFHW} がCodeGearにあたる。それぞれのフィールド変数には@Take annotation が付いており、DataGearManager に格納されたkey を参照してデータを取得する。その後DataGearManger に格納されたデータは破棄される。
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
144
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
145 Code \ref{code:javaHWC} では最初にフィールド変数 helloWorld にstring 型の"hellow"を取得、print を行い、再びkey hello、data "hello" をDataGearManager にput している。また8行目で自らをsetpuしているため、再帰的にHelloWorldCodeGear が再実行される。2回目の実行ではフィールド変数 helloWorld に"world" が格納と出力がされ、key world、data "world" がDataGearManager に格納される。Code \ref{code:javaHWC} でput した"hello" と"world" は最終的に、Code \ref{code:javaFHW} の同名のフィールド変数に格納される。
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
146 2回目の実行でもsetup しているが、DataGearManagerにはkey helloWorld のデータが無いため、3回目以降は実行されない。
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
147
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
148 Code \ref{code:javaHWC} の2回の実行後、Code \ref{code:javaHWC} のローカル変数hello とworld が全て揃ったことによりCode \ref{code:javaHWC} が実行されプログラムは終了する。
9
c5abec609e35 add StartHelloWorld
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
149
c5abec609e35 add StartHelloWorld
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
150
15
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
151 \section{Unity}
9
c5abec609e35 add StartHelloWorld
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
152
5
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
153
14
73a3c53c7568 fix sorucecode
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
154
15
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
155 \section{C\# でのChristie}
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
156
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
157 Code \ref{code:javaSHW} 、Code \ref{code:javaHWC} 、Code \ref{code:javaFHW} がC\#ではこうなります
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
158
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
159 \lstinputlisting[caption=C\# StartHelloWorld, label=code:csSHW]{src/StartHelloWorld.cs}
14
73a3c53c7568 fix sorucecode
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
160
73a3c53c7568 fix sorucecode
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
161
73a3c53c7568 fix sorucecode
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
162
15
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
163 \section{Unityでの動作}
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
164
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
165
2dd23f9603b3 update chapter Christie example
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
166
5
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
167
8
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
168 \section{annotation の書き換え}
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
169 java 版ではDataGear を取得する際に、annotation という java の機能を用いて行った。C\#には annotation はなく、代わりにattribute を利用して DataGear の取得を行っている。
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
170 以下のCode \ref{code:javaTake}、Code \ref{code:csTake}はjava とC\# におけるTakeの実装である。
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
171
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
172 \lstinputlisting[caption=java における Take annotation, label=code:javaTake]{src/Take.java}
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
173
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
174 \lstinputlisting[caption=C\# における Take attribute, label=code:csTake]{src/Take.cs}
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
175
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
176 java でannotation を自作する際には、 @interfacs で宣言する。また、Code \ref{code:javaTake} の8行目ではannotation情報をどの段階まで保持するかを指定しており、Take の場合 JVMによって保存され、ランタイム環境で使用できる。9行目ではannotationの適用可能箇所を指定しており、フィールド変数に対して適応可能となっている。
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
177
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
178 C\# でattribute を作成する際には、 System.Attributeを継承する必要がある。attribute の適用可能箇所については、Code \ref{code:csTake} の4行目でフィールド変数を指定している。
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
179
48c1f1d9fc65 add src and update chapter attribute vs annotation
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
180 \section{MessagePackの相違点}
10
78129eaf8770 update chapter MessagePack java
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
181 Christie ではデータを送信する際に、MessagePack を使用してデータを圧縮し、送信している。java 版で使用しているMessagePack はバージョンが古く現在はサポートされてない。そのためMessagePack の最新版とは記述方法が異なっている。Code \ref{code:mspackEx} はMessagePack の使用方法を示したものである。
78129eaf8770 update chapter MessagePack java
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
182
12
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
183 \lstinputlisting[caption=java 版におけるMessagePack の使用方法, label=code:javamspackEx]{src/MessagePackEx.java}
10
78129eaf8770 update chapter MessagePack java
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
184
78129eaf8770 update chapter MessagePack java
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
185 MessagePack を使用するには圧縮するクラスに対して @Message annotationをつける必要がある。これにより、クラス内で定義したpublic変数が圧縮される。
12
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
186 Code \ref{code:javamspackEx} の17 - 21行目は圧縮解凍の例であり、MessagePackのインスタンスを作成後、msgpack.write(data) を行うことでbyte[] 型にdataを圧縮できる。
10
78129eaf8770 update chapter MessagePack java
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
187 解凍にはmsgpack.read を使用し、圧縮されたbyte[] 型と圧縮対象のクラスを渡すことで解凍できる。
78129eaf8770 update chapter MessagePack java
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
188
78129eaf8770 update chapter MessagePack java
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
189
13
8336f55a92e7 update chapter MessagePack
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
190 C\# のMessagePack は複数存在しており、java と同様な書き方をするMessagePack-CSharp を選択した。
10
78129eaf8770 update chapter MessagePack java
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
191
12
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
192 \lstinputlisting[caption=C\# 版におけるMessagePack の使用方法, label=code:csmspackEx]{src/MessagePackEx.cs}
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
193
13
8336f55a92e7 update chapter MessagePack
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
194 MessagePack-CSharp ではjava 版と同様にクラスに対して圧縮を行うためCode \ref{code:csmspackEx} の1行目で MessagePackObject attribute を追加している。また、圧縮する変数に対してkey を設定することができ、int やstring を指定することができる。
8336f55a92e7 update chapter MessagePack
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
195
8336f55a92e7 update chapter MessagePack
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
196
8336f55a92e7 update chapter MessagePack
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
197 データの圧縮にはMessagePackSerializer.Serialize (data) を使用し、byte[] 型に圧縮される。解凍にはMessagePackSerializer.Deserialize$<T>$(data) を使用する。Deserializeはジェネリスク関数であるため、$<>$内に解凍するデータのクラスを指定する。
8336f55a92e7 update chapter MessagePack
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
198 Code \ref{code:csmspackEx} の21行目では、変数それぞれにkey を設定していることでjson に展開することが可能である。
12
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
199
13
8336f55a92e7 update chapter MessagePack
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
200
12
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
201 \section{CodeGear 実行時のThreadPool からTask への変更}
14
73a3c53c7568 fix sorucecode
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
202 java では別Thread を
9
c5abec609e35 add StartHelloWorld
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
203
c5abec609e35 add StartHelloWorld
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
204
5
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
205
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 \section{チート対策について}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
207
9
c5abec609e35 add StartHelloWorld
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
208 \section{実装の現状}
5
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
209
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
210
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 \nocite{*}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 \bibliographystyle{ipsjunsrt}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 \bibliography{riono-sigos}
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
214
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
215
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
216
74259b2a6dfa Organize folders
riono <e165729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 \end{document}