Back to project page StudySpaces.
The source code is released under:
Apache License
If you think the Android project StudySpaces listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.pennstudyspaces.api; //from w ww. ja v a2 s . c om import java.io.IOException; import java.util.ArrayList; public class StudySpacesData { private ApiRequest request; private Building[] buildingData; private RoomKind[] roomKindsData; public StudySpacesData (ApiRequest request) throws IOException { if (request == null) throw new IllegalArgumentException("Request cannot be null"); this.request = request; this.buildingData = null; this.roomKindsData = null; pullData(); } private void pullData() throws IOException { JsonData jsonData = JsonData.sendRequest(request); this.buildingData = jsonData.getBuildings().toArray(new Building[1]); ArrayList<RoomKind> roomKinds = new ArrayList<RoomKind>(getBuildings().length * 5); for (Building building : this.buildingData) { roomKinds.addAll(building.getRoomKinds()); } this.roomKindsData = roomKinds.toArray(new RoomKind[1]); } public ApiRequest getApiRequest() { return request; } private Building[] getBuildings() { return this.buildingData; } public RoomKind[] getRoomKinds() { return this.roomKindsData; } }