-
Notifications
You must be signed in to change notification settings - Fork 635
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
gowtkum
committed
Aug 14, 2021
1 parent
c77df60
commit da4f515
Showing
35 changed files
with
622 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
Binary file added
BIN
+1.52 KB
Event_calendar_flipkart/out/production/mcoding/com/sss/mcoding/Driver.class
Binary file not shown.
Binary file added
BIN
+3.33 KB
Event_calendar_flipkart/out/production/mcoding/com/sss/mcoding/app/EventCalendar.class
Binary file not shown.
Binary file added
BIN
+1.44 KB
Event_calendar_flipkart/out/production/mcoding/com/sss/mcoding/dao/TeamDao.class
Binary file not shown.
Binary file added
BIN
+1.97 KB
Event_calendar_flipkart/out/production/mcoding/com/sss/mcoding/dao/UserDao.class
Binary file not shown.
Binary file added
BIN
+4.08 KB
Event_calendar_flipkart/out/production/mcoding/com/sss/mcoding/managers/EventManager.class
Binary file not shown.
Binary file added
BIN
+2.52 KB
Event_calendar_flipkart/out/production/mcoding/com/sss/mcoding/managers/TeamManager.class
Binary file not shown.
Binary file added
BIN
+1.71 KB
Event_calendar_flipkart/out/production/mcoding/com/sss/mcoding/managers/UserManager.class
Binary file not shown.
Binary file added
BIN
+1.57 KB
Event_calendar_flipkart/out/production/mcoding/com/sss/mcoding/models/Event.class
Binary file not shown.
Binary file added
BIN
+491 Bytes
Event_calendar_flipkart/out/production/mcoding/com/sss/mcoding/models/Participant.class
Binary file not shown.
Binary file added
BIN
+930 Bytes
Event_calendar_flipkart/out/production/mcoding/com/sss/mcoding/models/Team.class
Binary file not shown.
Binary file added
BIN
+1.01 KB
Event_calendar_flipkart/out/production/mcoding/com/sss/mcoding/models/TimeSlot.class
Binary file not shown.
Binary file added
BIN
+1.46 KB
Event_calendar_flipkart/out/production/mcoding/com/sss/mcoding/models/User.class
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,53 @@ | ||
package com.sss.mcoding; | ||
|
||
import com.sss.mcoding.app.EventCalendar; | ||
|
||
import java.io.IOException; | ||
import java.text.ParseException; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.Date; | ||
|
||
public class Driver { | ||
|
||
|
||
|
||
public static void main(String args[]) throws IOException, ParseException { | ||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
EventCalendar eventCalendar = new EventCalendar(); | ||
|
||
eventCalendar.createUser("A", dateFormat.parse("2021-07-07 9:00:00"), dateFormat.parse("2021-07-07 21:00:00")); | ||
eventCalendar.createUser("B", dateFormat.parse("2021-07-07 9:00:00"), dateFormat.parse("2021-07-07 21:00:00")); | ||
eventCalendar.createUser("C", dateFormat.parse("2021-07-07 9:00:00"), dateFormat.parse("2021-07-07 21:00:00")); | ||
|
||
eventCalendar.createTeam("T1", Arrays.asList(new String[]{"A", "B"})); | ||
|
||
|
||
eventCalendar.createEvent("E1", Arrays.asList("C"), Arrays.asList("T1"), 1, | ||
dateFormat.parse("2021-07-07 13:00:00"), dateFormat.parse("2021-07-07 15:00:00")); | ||
|
||
// eventCalendar.createEvent("E2", Collections.emptyList(), Arrays.asList("T1"), 1, | ||
// dateFormat.parse("2021-07-07 13:00:00"), dateFormat.parse("2021-07-07 15:00:00")); | ||
|
||
|
||
eventCalendar.printUser("A"); | ||
eventCalendar.printUser("B"); | ||
eventCalendar.printUser("C"); | ||
|
||
eventCalendar.createEvent("E1", Arrays.asList("C"), Arrays.asList("T1"), 1, | ||
dateFormat.parse("2021-07-07 13:00:00"), dateFormat.parse("2021-07-07 15:00:00")); | ||
|
||
|
||
// eventCalendar.createEvent("E3", Collections.emptyList(), Arrays.asList("T1"), 1, | ||
// dateFormat.parse("2021-07-07 11:00:00"), dateFormat.parse("2021-07-07 13:00:00")); | ||
// | ||
// eventCalendar.createEvent("E4", Collections.emptyList(), Arrays.asList("T1"), 2, | ||
// dateFormat.parse("2021-07-07 15:00:00"), dateFormat.parse("2021-07-07 16:00:00")); | ||
// | ||
// eventCalendar.createEvent("E5", Collections.emptyList(), Arrays.asList("T1"), 3, | ||
// dateFormat.parse("2021-07-07 19:00:00"), dateFormat.parse("2021-07-07 20:00:00")); | ||
|
||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
Event_calendar_flipkart/src/com/sss/mcoding/app/EventCalendar.java
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,48 @@ | ||
package com.sss.mcoding.app; | ||
|
||
import com.sss.mcoding.managers.EventManager; | ||
import com.sss.mcoding.managers.TeamManager; | ||
import com.sss.mcoding.managers.UserManager; | ||
import com.sss.mcoding.models.Event; | ||
import com.sss.mcoding.models.TimeSlot; | ||
import com.sss.mcoding.models.User; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
public class EventCalendar { | ||
|
||
private UserManager userManager; | ||
private TeamManager teamManager; | ||
private EventManager eventManager; | ||
|
||
public EventCalendar() { | ||
userManager = new UserManager(); | ||
teamManager = new TeamManager(userManager); | ||
eventManager = new EventManager(userManager, teamManager); | ||
} | ||
|
||
public void createUser(String name, Date startTime, Date endTime) { | ||
TimeSlot workingHours = new TimeSlot(startTime, endTime); | ||
userManager.createUser(name, workingHours); | ||
} | ||
|
||
public void createTeam(String name, List<String> userNames) { | ||
teamManager.createTeam(name, userNames); | ||
} | ||
|
||
public void createEvent(String eventName, List<String> userNames, List<String> teamNames, int rep, Date startTime, Date endTime) { | ||
eventManager.createEvent(eventName, userNames, teamNames, rep, startTime, endTime); | ||
} | ||
|
||
public void printUser(String userId) { | ||
User user = userManager.getUser(userId); | ||
|
||
for (Event event : user.getEvents()) { | ||
System.out.println(userId + " - "+ event.getName() + " - " + event.getTimeSlot().getStartTime() + " - " + event.getTimeSlot().getEndTime()); | ||
} | ||
|
||
} | ||
|
||
|
||
} |
30 changes: 30 additions & 0 deletions
30
Event_calendar_flipkart/src/com/sss/mcoding/dao/TeamDao.java
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,30 @@ | ||
package com.sss.mcoding.dao; | ||
|
||
import com.sss.mcoding.models.Team; | ||
import com.sss.mcoding.models.TimeSlot; | ||
import com.sss.mcoding.models.User; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class TeamDao { | ||
private Map<String, Team> teamMap; | ||
|
||
public TeamDao() { | ||
teamMap = new HashMap<>(); | ||
} | ||
|
||
public void createTeam(Team team) { | ||
if (teamMap.containsKey(team.getName())) { | ||
throw new RuntimeException("Team exists with same name " + team.getName()); | ||
} | ||
teamMap.put(team.getName(), team); | ||
} | ||
|
||
public Team getTeam(String teamName) { | ||
if (!teamMap.containsKey(teamName)) { | ||
throw new RuntimeException("Team not found with name " + teamName); | ||
} | ||
return teamMap.get(teamName); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
Event_calendar_flipkart/src/com/sss/mcoding/dao/UserDao.java
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,39 @@ | ||
package com.sss.mcoding.dao; | ||
|
||
import com.sss.mcoding.models.Event; | ||
import com.sss.mcoding.models.Team; | ||
import com.sss.mcoding.models.TimeSlot; | ||
import com.sss.mcoding.models.User; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class UserDao { | ||
private Map<String, User> userMap; | ||
|
||
public UserDao() { | ||
userMap = new HashMap<>(); | ||
} | ||
|
||
public void addUser(User user) { | ||
if (userMap.containsKey(user.getName())) { | ||
throw new RuntimeException("User already exists with same name " + user.getName()); | ||
} | ||
userMap.put(user.getName(), user); | ||
} | ||
|
||
public User getUser(String userName) { | ||
if (!userMap.containsKey(userName)) { | ||
throw new RuntimeException("User not found with name " + userName); | ||
} | ||
return userMap.get(userName); | ||
} | ||
|
||
public void setTeam(User user, Team team) { | ||
user.setTeam(team); | ||
} | ||
|
||
public void addEvent(User user, Event event) { | ||
user.getEvents().add(event); | ||
} | ||
} |
Oops, something went wrong.