Project

General

Profile

Three methods realization and explanation - Code JAVA » History » Version 1

Guanji Wang, 17/03/2016 16:40

1 1 Guanji Wang
h1. Three methods realization and explanation - Code JAVA
2 1 Guanji Wang
3 1 Guanji Wang
h2.  _*Attention:    For better view, all the code pictures are captured by guanji in his git source, you can find the link at the end of the page. Thank you for your comprehension.*_
4 1 Guanji Wang
5 1 Guanji Wang
h2. *1 - Situation1 - One HMI-seires to one target .fits file, ex: hmi.m_720s*
6 1 Guanji Wang
7 1 Guanji Wang
!Selection_082.png!
8 1 Guanji Wang
9 1 Guanji Wang
10 1 Guanji Wang
h3. Define the .fits file name and save the series and filename into hashmap as a fast index, other code in the git source
11 1 Guanji Wang
12 1 Guanji Wang
!Selection_084.png!
13 1 Guanji Wang
14 1 Guanji Wang
h2. *2 - Situation2 - One HMI-series to multi-targets .fits files, ex: hmi.sharp_720s_nrt*
15 1 Guanji Wang
16 1 Guanji Wang
!Selection_081.png!
17 1 Guanji Wang
18 1 Guanji Wang
h3. Define all target files into a Arraylist, create new object - FileOrderResource then loop all series and files name into a List<Object> listf which Object = FileOrderResource. 
19 1 Guanji Wang
h3. The code is annotated(// or /* */) as we will use the method 3, you can get the source code in the git source here : https://git.ias.u-psud.fr/gwang/Sitools2-V3.0/commits/dev-3
20 1 Guanji Wang
21 1 Guanji Wang
!Selection_085.png!
22 1 Guanji Wang
23 1 Guanji Wang
The create a hashmap which key value equals series name and the content equals the filelist, 
24 1 Guanji Wang
!Selection_086.png!
25 1 Guanji Wang
26 1 Guanji Wang
Use if or switch to set and get the map values for creation of  the reference list
27 1 Guanji Wang
!Selection_087.png!
28 1 Guanji Wang
29 1 Guanji Wang
h2. *3 - Situation3 - Multi HMI-series to multi-targets .fits files*
30 1 Guanji Wang
31 1 Guanji Wang
!Selection_083.png!
32 1 Guanji Wang
33 1 Guanji Wang
h3. Delete all list and hashmap defined above, in case more or less target files in the target directory,
34 1 Guanji Wang
      use the java.io.File to find the target .fits files recursively, don't forget to throw exception and log for analyzing the process of order.
35 1 Guanji Wang
      Here is the codes well-encapsulated by guanji :
36 1 Guanji Wang
!Selection_088.png!
37 1 Guanji Wang
38 1 Guanji Wang
!Selection_089.png!
39 1 Guanji Wang
40 1 Guanji Wang
41 1 Guanji Wang
h2. *The creation for the Object - FileOrderResource*
42 1 Guanji Wang
 
43 1 Guanji Wang
     h3. It contains 2 elements(reference.getPath(), filename with wave and series information), it is modificable according to the user needs.
44 1 Guanji Wang
45 1 Guanji Wang
!Selection_090.png!
46 1 Guanji Wang
47 1 Guanji Wang
48 1 Guanji Wang
h2. *4 - When and how to use the 3 method:*
49 1 Guanji Wang
50 1 Guanji Wang
h3. 
51 1 Guanji Wang
# If the target files are certain and for saving time, use the first 2 methods.
52 1 Guanji Wang
# If the target files are uncertain and too many to define the list, use the last one. 
53 1 Guanji Wang
54 1 Guanji Wang
55 1 Guanji Wang
56 1 Guanji Wang
h2. *5 - You can find all commits and resources related in the link:*
57 1 Guanji Wang
58 1 Guanji Wang
h3. https://git.ias.u-psud.fr/gwang/Sitools2-V3.0/commit/341a4a2f4941fd12384a2bdc37069fb0bdaab596