Mercurial > hg > Database > Christie
changeset 0:c082039368f5
make project
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 07 Dec 2017 21:45:59 +0900 |
parents | |
children | 3ea61d0bfc34 |
files | .hgignore build.gradle settings.gradle src/main/java/christie/annotation/Take.java src/main/java/christie/codegear/CodeGear.java src/main/java/christie/codegear/GodeGearManager.java src/main/java/christie/codegear/InputDataGear.java src/main/java/christie/codegear/OutputDataGear.java src/main/java/christie/datagear/DataGear.java src/main/java/christie/datagear/DataGearManager.java src/main/java/christie/datagear/LocalDataGearManager.java src/main/java/christie/datagear/StringData.java src/main/java/christie/test/TestCodeGear.java |
diffstat | 13 files changed, 203 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Thu Dec 07 21:45:59 2017 +0900 @@ -0,0 +1,14 @@ +syntax: glob +.classpath + +syntax: regexp +^classes$ +syntax: regexp +^Alice\.jar$ +syntax: regexp +syntax: glob +.classpath + +build +.gradle +.idea
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build.gradle Thu Dec 07 21:45:59 2017 +0900 @@ -0,0 +1,24 @@ +apply plugin: 'java' + +sourceCompatibility = 1.9 + +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' +group = 'cr.ie.u_ryukyu.ac.jp' +version = '1.0' + +repositories { + mavenCentral() +} + +dependencies { + testCompile group: 'junit', name: 'junit', version: '4.11' +} + +jar { + exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA' + manifest { + attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version': version + } + from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } + archiveName = 'Christie.jar' +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/settings.gradle Thu Dec 07 21:45:59 2017 +0900 @@ -0,0 +1,2 @@ +rootProject.name = 'Christie' +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/annotation/Take.java Thu Dec 07 21:45:59 2017 +0900 @@ -0,0 +1,8 @@ +package christie.annotation; + +/** + * Created by e125769 on 12/7/17. + */ +public @interface Take { + String value(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/codegear/CodeGear.java Thu Dec 07 21:45:59 2017 +0900 @@ -0,0 +1,33 @@ +package christie.codegear; + +import christie.annotation.Take; +import christie.datagear.DataGear; +import christie.datagear.StringData; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; + +/** + * Created by e125769 on 12/7/17. + */ +public interface CodeGear extends Runnable { + InputDataGear idg = new InputDataGear(); + OutputDataGear odg = new OutputDataGear(); + + + default void setKey(){//AnnotationからInputDataGearをセット らidgに待ち合わせ + for (Field field : this.getClass().getDeclaredFields()) { + if (field.isAnnotationPresent(Take.class)){ + Take ano = field.getAnnotation(Take.class); + System.out.println(ano.value()); + //idg.dataGears.put(ano.value(), field.get()); + } + } + } + + default void setValue(){//Annotationから揃ったInputDataGearの値をキャスト + + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/codegear/GodeGearManager.java Thu Dec 07 21:45:59 2017 +0900 @@ -0,0 +1,14 @@ +package christie.codegear; + +import christie.datagear.DataGearManager; + +import java.util.HashMap; +import java.util.concurrent.ThreadPoolExecutor; + +/** + * Created by e125769 on 12/7/17. + */ +public class GodeGearManager{ + HashMap<String, DataGearManager> dataGearManagers = new HashMap<String, DataGearManager>(); + ThreadPoolExecutor codeGearExecutor; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/codegear/InputDataGear.java Thu Dec 07 21:45:59 2017 +0900 @@ -0,0 +1,12 @@ +package christie.codegear; + +import christie.datagear.DataGear; + +import java.util.HashMap; + +/** + * Created by e125769 on 12/7/17. + */ +public class InputDataGear { + HashMap<String, DataGear> dataGears = new HashMap<String, DataGear>(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/codegear/OutputDataGear.java Thu Dec 07 21:45:59 2017 +0900 @@ -0,0 +1,7 @@ +package christie.codegear; + +/** + * Created by e125769 on 12/7/17. + */ +public class OutputDataGear { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/datagear/DataGear.java Thu Dec 07 21:45:59 2017 +0900 @@ -0,0 +1,11 @@ +package christie.datagear; + +/** + * Created by e125769 on 12/7/17. + */ +public interface DataGear<T> { + Class getClazz(); + void setClazz(Class clazz); + T getData(); + void setData(T data); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/datagear/DataGearManager.java Thu Dec 07 21:45:59 2017 +0900 @@ -0,0 +1,14 @@ +package christie.datagear; + +import christie.datagear.DataGear; + +import java.util.TreeMap; + +/** + * Created by e125769 on 12/7/17. + */ +public interface DataGearManager { + TreeMap<String, DataGear> dataGears = new TreeMap<String, DataGear>(); + DataGear take(String key); + void put(String key, DataGear data); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/datagear/LocalDataGearManager.java Thu Dec 07 21:45:59 2017 +0900 @@ -0,0 +1,16 @@ +package christie.datagear; + +/** + * Created by e125769 on 12/7/17. + */ +public class LocalDataGearManager implements DataGearManager { + + + public DataGear take(String key) { + return null; + } + + public void put(String key, DataGear data) { + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/datagear/StringData.java Thu Dec 07 21:45:59 2017 +0900 @@ -0,0 +1,26 @@ +package christie.datagear; + +/** + * Created by e125769 on 12/7/17. + */ +public class StringData<T> implements DataGear { + + Class<T> clazz; + T data; + + public Class getClazz() { + return clazz; + } + + public void setClazz(Class clazz) { + this.clazz = clazz; + } + + public T getData() { + return data; + } + + public void setData(Object data) { + this.data = (T) data; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/test/TestCodeGear.java Thu Dec 07 21:45:59 2017 +0900 @@ -0,0 +1,22 @@ +package christie.test; + +import christie.annotation.Take; +import christie.codegear.CodeGear; +import christie.datagear.StringData; + +/** + * Created by e125769 on 12/7/17. + */ +public class TestCodeGear implements CodeGear { + + @Take("hoge") + StringData hoge; + + public static void main(String args[]){ + System.out.println("hello"); + } + + public void run() { + //System.out.println(hoge.getData()); + } +}