• R/O
  • SSH

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版ba535a962764a34bf6ae85fef94f349166155a07 (tree)
时间2015-10-22 18:27:28
作者MirrgieRiana
CommiterMirrgieRiana

Log Message

ArgumentsGetComplex: add: setVariable

更改概述

差异

diff -r e53b2d39fbca -r ba535a962764 projects/mirrg.compile.lithiumbromide/src/test/java/mirrg/compile/lithiumbromide/ArgumentsGetComplex.java
--- a/projects/mirrg.compile.lithiumbromide/src/test/java/mirrg/compile/lithiumbromide/ArgumentsGetComplex.java Thu Oct 22 00:18:28 2015 +0900
+++ b/projects/mirrg.compile.lithiumbromide/src/test/java/mirrg/compile/lithiumbromide/ArgumentsGetComplex.java Thu Oct 22 18:27:28 2015 +0900
@@ -1,6 +1,7 @@
11 package mirrg.compile.lithiumbromide;
22
33 import java.util.ArrayList;
4+import java.util.Hashtable;
45
56 import mirrg.complex.hydrogen.StructureComplex;
67 import mirrg.complex.hydrogen.functions.Trigonometry;
@@ -8,14 +9,28 @@
89 public class ArgumentsGetComplex
910 {
1011
12+ public Hashtable<String, StructureComplex> variables = new Hashtable<>();
13+
14+ {
15+ variables.put("pi", new StructureComplex(Math.PI, 0));
16+ }
17+
18+ /**
19+ * @param complex
20+ * 破壊される可能性はない
21+ */
22+ public void setVariable(String name, StructureComplex complex)
23+ {
24+ variables.put(name, complex.copy());
25+ }
26+
27+ /**
28+ * @return 破壊可能
29+ */
1130 public StructureComplex getVariable(String name)
1231 {
13- switch (name) {
14- case "pi":
15- return new StructureComplex(Math.PI, 0);
16- default:
17- return null;
18- }
32+ StructureComplex complex = variables.get(name);
33+ return complex == null ? null : complex.copy();
1934 }
2035
2136 public StructureComplex callFunction(String name, ArrayList<INodeExpressionBase> arguments)