-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11dbaee
commit 9a14d87
Showing
24 changed files
with
170 additions
and
60 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
java -jar ciao3.jar | ||
pause |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
.d8888. d8b db .d8b. j88D .d8888. db .d8b. .o88b. db dD | ||
88' YP 888o 88 d8' `8b j8~88 88' YP 88 d8' `8b d8P Y8 88 ,8P' | ||
`8bo. 88V8o 88 88ooo88 j8' 88 `8bo. 88 88ooo88 8P 88,8P | ||
`Y8b. 88 V8o88 88~~~88 V88888D `Y8b. 88 88~~~88 8b 88`8b | ||
db 8D 88 V888 88 88 88 db 8D 88booo. 88 88 Y8b d8 88 `88. | ||
`8888Y' VP V8P YP YP VP `8888Y' Y88888P YP YP `Y88P' YP YD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,64 @@ | ||
package testJSon; | ||
import com.google.gson.Gson; | ||
import java.io.FileNotFoundException; | ||
import java.io.FileReader; | ||
import java.io.IOException; | ||
import org.json.simple.parser.JSONParser; | ||
import org.json.simple.parser.ParseException; | ||
import org.json.simple.JSONArray; | ||
|
||
import com.google.gson.reflect.TypeToken; | ||
import java.util.ArrayList; | ||
|
||
public class Members { | ||
private ArrayList<Persona> membri; | ||
|
||
public Members(ArrayList<Persona> persone) { | ||
membri=persone; | ||
} | ||
|
||
public void listaMembri() { | ||
for(int i=0;i<membri.size();i++) { | ||
System.out.println(membri.get(i).getReal_name()); | ||
} | ||
} | ||
|
||
public void acquisisci(String path) { | ||
JSONParser parser = new JSONParser(); | ||
try { | ||
Gson a=new Gson(); | ||
Object obj = parser.parse(new FileReader("users.json"));//TO DO utilizzare la variabile path | ||
JSONArray jsonArray = (JSONArray) obj; | ||
String temp=jsonArray.toString(); | ||
java.lang.reflect.Type listType = new TypeToken<ArrayList<Persona>>() {}.getType(); | ||
membri=a.fromJson(temp,listType); | ||
// System.out.println(utenti.toString()); | ||
} catch (FileNotFoundException e) { | ||
e.printStackTrace(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} catch (ParseException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public String toString() { | ||
String temp=""; | ||
for(int i=0;i<membri.size();i++) { | ||
temp=temp+membri.get(i).toString(); | ||
} | ||
return temp; | ||
} | ||
|
||
public String getId(int index) { | ||
return membri.get(index).getId(); | ||
} | ||
|
||
public String getRealName(String codice) { | ||
for(int i=0;i<membri.size();i++) { | ||
if(membri.get(i).getId().equals(codice)) | ||
return membri.get(i).getReal_name(); | ||
} | ||
return null; | ||
} | ||
|
||
public String getRealName(int index) { | ||
return membri.get(index).getReal_name(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
java -jar ciao2.jar | ||
java -jar ciao3.jar | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
.d8888. d8b db .d8b. j88D .d8888. db .d8b. .o88b. db dD | ||
88' YP 888o 88 d8' `8b j8~88 88' YP 88 d8' `8b d8P Y8 88 ,8P' | ||
`8bo. 88V8o 88 88ooo88 j8' 88 `8bo. 88 88ooo88 8P 88,8P | ||
`Y8b. 88 V8o88 88~~~88 V88888D `Y8b. 88 88~~~88 8b 88`8b | ||
db 8D 88 V888 88 88 88 db 8D 88booo. 88 88 Y8b d8 88 `88. | ||
`8888Y' VP V8P YP YP VP `8888Y' Y88888P YP YP `Y88P' YP YD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6915,4 +6915,4 @@ | |
"updated": 1522055989, | ||
"is_app_user": false | ||
} | ||
] | ||
] |