namefixes, some old content
This commit is contained in:
parent
72850e28b5
commit
1779073ba5
7
ws2009/gdi I/exercise/src/GDI Calendar/.classpath
Normal file
7
ws2009/gdi I/exercise/src/GDI Calendar/.classpath
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
ws2009/gdi I/exercise/src/GDI Calendar/.project
Normal file
17
ws2009/gdi I/exercise/src/GDI Calendar/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>GDI Calendar</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@ -0,0 +1,12 @@
|
||||
#Fri Dec 18 08:14:28 CET 2009
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
@ -0,0 +1,106 @@
|
||||
package GdICalendarTemplate;
|
||||
|
||||
/**
|
||||
* Import TimeClasses
|
||||
*/
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
/**
|
||||
* Instances of the Calendar class contain CalendarEntries.
|
||||
*
|
||||
* @author Ulf Gebhardt
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Calendar {
|
||||
|
||||
/**
|
||||
* Array of CalendarEntry. Startsize is 0.
|
||||
*/
|
||||
private CalendarEntry[] calendarEntries = new CalendarEntry[0];
|
||||
|
||||
/**
|
||||
* Constructor -> Not used, Std Constructor
|
||||
*/
|
||||
public Calendar()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a CalendarEntry to the array in Calendar.
|
||||
* @param calEntry
|
||||
*/
|
||||
public void addCalendarEntry(CalendarEntry calEntry)
|
||||
{
|
||||
CalendarEntry[] ce = calendarEntries;
|
||||
calendarEntries = new CalendarEntry[ce.length+1];
|
||||
System.arraycopy(ce, 0, calendarEntries, 0, ce.length);
|
||||
calendarEntries[calendarEntries.length-1] = calEntry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns String containing Entry.tostring values
|
||||
* separated by linebreak.
|
||||
* Does not include Private Elements from foreign
|
||||
* People.
|
||||
*
|
||||
* @param user
|
||||
* @return String
|
||||
*/
|
||||
public String listEntries(User user)
|
||||
{
|
||||
StringBuffer s = new StringBuffer();
|
||||
for (int i = 0; i < calendarEntries.length; i++)
|
||||
{
|
||||
if(!calendarEntries[i].isPrivate() || calendarEntries[i].getOwner() == user)
|
||||
{
|
||||
s.append(calendarEntries[i].toString());
|
||||
s.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the Programm,
|
||||
*
|
||||
* Add some Users, Entries, Print content.
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// please leave this method alone for now...
|
||||
// create a new calendar
|
||||
Calendar cal = new Calendar();
|
||||
|
||||
// create some users
|
||||
User paul = new User("Paul", "Anderson");
|
||||
User mary = new User("Mary", "Bobkins");
|
||||
User bob = new User("Adam", "Johanson");
|
||||
|
||||
// create some entries
|
||||
CalendarEntry plants = new CalendarEntry(
|
||||
new GregorianCalendar(2010, 3, 12, 14, 30),
|
||||
"Water the plants", paul);
|
||||
plants.setPrivate(true);
|
||||
cal.addCalendarEntry(plants);
|
||||
|
||||
CalendarEntry cinema = new CalendarEntry(
|
||||
new GregorianCalendar(2010, 3, 12, 18, 30),
|
||||
"Meet Mary for cinema", paul);
|
||||
cal.addCalendarEntry(cinema);
|
||||
|
||||
CalendarEntry call = new CalendarEntry(
|
||||
new GregorianCalendar(2010, 3, 13, 9, 30),
|
||||
"Call Susi for an appointment with Ron", mary);
|
||||
cal.addCalendarEntry(call);
|
||||
|
||||
CalendarEntry lunch = new CalendarEntry(
|
||||
new GregorianCalendar(2010, 3, 13, 12, 00),
|
||||
"Lunch with Paul", bob);
|
||||
lunch.setPrivate(true);
|
||||
cal.addCalendarEntry(lunch);
|
||||
|
||||
// print out the list of entries
|
||||
System.out.println(cal.listEntries(bob));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,151 @@
|
||||
package GdICalendarTemplate;
|
||||
|
||||
/**
|
||||
* Import Time/Date/Converter Functionality
|
||||
*/
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* All entries in the Calendar are instances of the class CalendarEntry.
|
||||
*
|
||||
* @author Ulf Gebhardt
|
||||
* @version 1.0
|
||||
*/
|
||||
public class CalendarEntry {
|
||||
|
||||
/**
|
||||
* DateTime Stamp
|
||||
*/
|
||||
private GregorianCalendar time;
|
||||
/**
|
||||
* Description what to do/remind
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* Owner of Entry
|
||||
*/
|
||||
private User owner;
|
||||
/**
|
||||
* Determines if Entry is visible for all.
|
||||
*/
|
||||
private boolean priv;
|
||||
|
||||
/**
|
||||
* Constructor of CalendarEntry
|
||||
*
|
||||
* @param time Timestamp (GregorianCalendar)
|
||||
* @param description Description(String)
|
||||
* @param owner (User)
|
||||
*/
|
||||
public CalendarEntry(GregorianCalendar time, String description, User owner)
|
||||
{
|
||||
setTime(time);
|
||||
setDescription(description);
|
||||
setOwner(owner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string-representation of
|
||||
* a CalendarEntry of the following form:
|
||||
*
|
||||
* DAYSTRING, DAY MONTH YEAR - HOUR:MIN:SEC by USERFIRSTNAME USERLASTNAME | DESCRIPTION
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
@Override public String toString()
|
||||
{
|
||||
StringBuffer temp = new StringBuffer();
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("E, dd MMMM yyyy - HH:mm:ss", Locale.GERMAN);
|
||||
|
||||
temp.append(sdf.format(time.getTime()));
|
||||
temp.append(" by ");
|
||||
temp.append(owner.toString());
|
||||
temp.append(" | ");
|
||||
temp.append(description);
|
||||
|
||||
return temp.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Timestamp
|
||||
*
|
||||
* @param newtime GregorianCalendar
|
||||
*/
|
||||
public void setTime(GregorianCalendar newtime)
|
||||
{
|
||||
time = newtime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Timestamp
|
||||
*
|
||||
* @return GregorianCalendar
|
||||
*/
|
||||
public GregorianCalendar getTime()
|
||||
{
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* set new Description
|
||||
*
|
||||
* @param newdesc String
|
||||
*/
|
||||
public void setDescription(String newdesc)
|
||||
{
|
||||
description = newdesc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Description
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set new Owner
|
||||
*
|
||||
* @param newowner User
|
||||
*/
|
||||
public void setOwner(User newowner)
|
||||
{
|
||||
owner = newowner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current Owner
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public User getOwner()
|
||||
{
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Private-Flag
|
||||
*
|
||||
* @param newpriv boolean
|
||||
*/
|
||||
public void setPrivate(boolean newpriv)
|
||||
{
|
||||
priv = newpriv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if Entry is Private.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isPrivate()
|
||||
{
|
||||
return priv;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package GdICalendarTemplate;
|
||||
|
||||
/**
|
||||
* User Class Definition
|
||||
* used by: CalendarEntries
|
||||
*
|
||||
* @author Ulf Gebhardt
|
||||
* @version 1.0
|
||||
*/
|
||||
public class User {
|
||||
|
||||
/**
|
||||
* FirstName of the User
|
||||
*/
|
||||
private String givenName;
|
||||
|
||||
/**
|
||||
* FamilyName of the User
|
||||
*/
|
||||
private String familyName;
|
||||
|
||||
/**
|
||||
* The constructor for User objects
|
||||
*
|
||||
* @param givenName FirstName
|
||||
* @param familyName LastName
|
||||
*/
|
||||
public User(String givenName, String familyName)
|
||||
{
|
||||
setGivenName(givenName);
|
||||
setFamilyName(familyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets givenName.
|
||||
* @param newname
|
||||
*/
|
||||
public void setGivenName(String newname)
|
||||
{
|
||||
givenName = newname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns givenName
|
||||
* @return String
|
||||
*/
|
||||
public String getGivenName()
|
||||
{
|
||||
return givenName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns familyName
|
||||
* @return String
|
||||
*/
|
||||
public String getFamilyName()
|
||||
{
|
||||
return familyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets familyName
|
||||
* @param newname
|
||||
*/
|
||||
public void setFamilyName(String newname)
|
||||
{
|
||||
familyName = newname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns String representing a User
|
||||
* @return String UserName + Lastname
|
||||
*/
|
||||
@Override public String toString()
|
||||
{
|
||||
return givenName + " " + familyName;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import GdICalendarTemplate.Calendar;
|
||||
import GdICalendarTemplate.Calendar;
|
||||
import GdICalendarTemplate.CalendarEntry;
|
||||
import GdICalendarTemplate.CalendarEntry;
|
||||
import GdICalendarTemplate.User;
|
||||
import GdICalendarTemplate.User;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Test the various calendar functionality.
|
||||
*/
|
||||
public class CalendarTest{
|
||||
@Test
|
||||
public void testUserCreation() {
|
||||
User sasha = new User("Sasha", "Dole");
|
||||
Assert.assertEquals(sasha.getGivenName(), "Sasha");
|
||||
Assert.assertEquals(sasha.getFamilyName(), "Dole");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCalendarEntryCreation() {
|
||||
CalendarEntry meeting = new CalendarEntry(new GregorianCalendar(2010,
|
||||
3, 12, 18, 30), "Meeting with Alex and Joseph", new User(
|
||||
"Sasha", "Dole"));
|
||||
Assert.assertFalse(meeting.isPrivate());
|
||||
Assert.assertEquals(meeting.getDescription(), "Meeting with Alex and Joseph");
|
||||
Assert.assertEquals(meeting.getOwner().getGivenName(), "Sasha");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCalendarCreation() {
|
||||
Calendar cal = new Calendar();
|
||||
User bob = new User("Bob", "Smith");
|
||||
CalendarEntry meeting = new CalendarEntry(new GregorianCalendar(2010,
|
||||
3, 12, 18, 30), "Meeting with Alex and Joseph", new User(
|
||||
"Sasha", "Dole"));
|
||||
cal.addCalendarEntry(meeting);
|
||||
Assert.assertTrue(cal.listEntries(bob).length() > 0);
|
||||
Assert.assertTrue(cal.listEntries(bob).contains("Sasha"));
|
||||
Assert.assertTrue(cal.listEntries(bob).contains("Meeting with Alex and Joseph"));
|
||||
Assert.assertTrue(cal.listEntries(bob).contains("2010"));
|
||||
Assert.assertTrue(cal.listEntries(bob).contains("April"));
|
||||
Assert.assertTrue(cal.listEntries(bob).contains("Mo"));
|
||||
}
|
||||
|
||||
}
|
||||
7
ws2009/gdi I/exercise/src/GDI Calendar2/.classpath
Normal file
7
ws2009/gdi I/exercise/src/GDI Calendar2/.classpath
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
ws2009/gdi I/exercise/src/GDI Calendar2/.project
Normal file
17
ws2009/gdi I/exercise/src/GDI Calendar2/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>GDI Calendar2</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@ -0,0 +1,12 @@
|
||||
#Sat Dec 19 17:46:19 CET 2009
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
190
ws2009/gdi I/exercise/src/GDI Calendar2/src/Calendar.java
Normal file
190
ws2009/gdi I/exercise/src/GDI Calendar2/src/Calendar.java
Normal file
@ -0,0 +1,190 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Instances of the Calendar class contain CalendarEntries.
|
||||
*
|
||||
* @author Stefan Radomski, Guido Roessling
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Calendar {
|
||||
|
||||
/**
|
||||
* the internal storage for calendar entries
|
||||
*/
|
||||
private List<CalendarEntry> calendarEntries;
|
||||
|
||||
/**
|
||||
* Construct a new calendar object.
|
||||
*/
|
||||
public Calendar()
|
||||
{
|
||||
calendarEntries = new ArrayList<CalendarEntry>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a CalendarEntry to this calendar instance.
|
||||
*
|
||||
* @param calEntry
|
||||
* The entry to add.
|
||||
*/
|
||||
public void addCalendarEntry(CalendarEntry calEntry)
|
||||
{
|
||||
if(!hasCalendarEntry(calEntry))
|
||||
{
|
||||
calendarEntries.add(calEntry);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a CalendarEntry of this calendar instance.
|
||||
*
|
||||
* @param calEntry Entry to be removed
|
||||
*/
|
||||
public void removeCalendarEntry(CalendarEntry calEntry)
|
||||
{
|
||||
calendarEntries.remove(calEntry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a CalendarEntry is part of this Calendar.
|
||||
*
|
||||
* @param calEntry CalendarEntry to be checked
|
||||
* @return boolean True if Entry is part of Calendar else false.
|
||||
*/
|
||||
public boolean hasCalendarEntry(CalendarEntry calEntry)
|
||||
{
|
||||
return calendarEntries.contains(calEntry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all CalendarEntries from Calendar and replace them
|
||||
* with given Array of CalendarEntries.
|
||||
*
|
||||
* No checks are performed if Entries are valid!
|
||||
*
|
||||
* @param calEntries Array of CalendarEntry
|
||||
*/
|
||||
public void setCalendarEntries(CalendarEntry[] calEntries)
|
||||
{
|
||||
calendarEntries = Arrays.asList(calEntries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all CalendarEntries in this Calendar.
|
||||
*
|
||||
* @return CalendarEntry[] Array of CalendarEntries of Calendar.
|
||||
*/
|
||||
public CalendarEntry[] getCalendarEntries()
|
||||
{
|
||||
CalendarEntry[] temparray = new CalendarEntry[calendarEntries.size()];
|
||||
calendarEntries.toArray(temparray);
|
||||
return temparray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a textual representation of all CalendarEntries visible for the
|
||||
* given user.
|
||||
*
|
||||
* @param user
|
||||
* The user object for whom to display the CalendarEntries.
|
||||
* @return A String representing all the CalendarEntries.
|
||||
*/
|
||||
public String listEntries(User user)
|
||||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
Iterator<CalendarEntry> it = calendarEntries.iterator();
|
||||
|
||||
while(it.hasNext())
|
||||
{
|
||||
CalendarEntry ce = it.next();
|
||||
if(ce.isVisible(user))
|
||||
{
|
||||
sb.append(ce.toString());
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new Calendar-Instance which contains only the Entries of
|
||||
* this Calendar with are between start- and end-Time.
|
||||
*
|
||||
* @param start GregorianCalendar
|
||||
* @param end GregorianCalendar
|
||||
* @return Calendar
|
||||
*/
|
||||
public Calendar getBetween(GregorianCalendar start, GregorianCalendar end)
|
||||
{
|
||||
Calendar tempcal = new Calendar();
|
||||
|
||||
Iterator<CalendarEntry> it = calendarEntries.iterator();
|
||||
|
||||
while(it.hasNext())
|
||||
{
|
||||
CalendarEntry ce = it.next();
|
||||
|
||||
if(ce.isBetween(start,end))
|
||||
{
|
||||
tempcal.addCalendarEntry(ce);
|
||||
}
|
||||
}
|
||||
|
||||
return tempcal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new calendar, three users and add some appointments to the
|
||||
* calendar.
|
||||
*
|
||||
* @param args
|
||||
* command-line arguments (ignored in this application)
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
Calendar cal = new Calendar();
|
||||
|
||||
Developer paul = new Developer("Paul", "Anderson");
|
||||
Developer mary = new Developer("Mary", "Bobkins");
|
||||
Secretary bob = new Secretary("Adam", "Johanson");
|
||||
|
||||
Reminder plants = new Reminder(
|
||||
new GregorianCalendar(2010, 3, 12, 14, 30),
|
||||
new GregorianCalendar(2010, 3, 12, 14, 20),
|
||||
"Water the plants", paul);
|
||||
plants.setPrivate(true);
|
||||
cal.addCalendarEntry(plants);
|
||||
|
||||
Meeting dailyScrum = new Meeting(
|
||||
new GregorianCalendar(2010, 3, 12, 10, 30),
|
||||
new GregorianCalendar(2010, 3, 12, 11, 30),
|
||||
"Discuss yesterdays work", paul);
|
||||
dailyScrum.addParticipant(mary);
|
||||
cal.addCalendarEntry(dailyScrum);
|
||||
|
||||
Vacation spain = new Vacation(
|
||||
new GregorianCalendar(2010, 2, 3),
|
||||
new GregorianCalendar(2010, 2, 13),
|
||||
"Enjoying the beach in spain", mary);
|
||||
spain.setDelegate(bob);
|
||||
cal.addCalendarEntry(spain);
|
||||
|
||||
Illness cold = new Illness(
|
||||
new GregorianCalendar(2010, 3, 3),
|
||||
new GregorianCalendar(2010, 3, 4),
|
||||
"Caught a cold, will be back tomorrow", bob);
|
||||
cold.setDelegate(mary);
|
||||
cal.addCalendarEntry(cold);
|
||||
|
||||
Calendar earlyApril = cal.getBetween(new GregorianCalendar(2010, 3, 3),
|
||||
new GregorianCalendar(2010, 3, 10));
|
||||
|
||||
System.out.println(cal.listEntries(bob));
|
||||
System.out.println(earlyApril.listEntries(bob));
|
||||
}
|
||||
}
|
||||
168
ws2009/gdi I/exercise/src/GDI Calendar2/src/CalendarEntry.java
Normal file
168
ws2009/gdi I/exercise/src/GDI Calendar2/src/CalendarEntry.java
Normal file
@ -0,0 +1,168 @@
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
/**
|
||||
* This class represents an entry in our calendar. All entries in the Calendar
|
||||
* are instances of the class CalendarEntry.
|
||||
*
|
||||
* @author Stefan Radomski, Guido Roessling
|
||||
* @version 1.0
|
||||
*/
|
||||
public abstract class CalendarEntry {
|
||||
|
||||
/**
|
||||
* the description of this calendar entry
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* the owner of this calendar entry
|
||||
*/
|
||||
private User owner;
|
||||
|
||||
/**
|
||||
* mark if this entry is private (only visible to the user)
|
||||
*/
|
||||
private boolean priv;
|
||||
|
||||
/**
|
||||
* the date and time for this entry
|
||||
*/
|
||||
protected GregorianCalendar time;
|
||||
|
||||
/**
|
||||
* Construct a new CalendarEntry object.
|
||||
*
|
||||
* @param time the GregorianCalendar representing the date and time of the
|
||||
* entry.
|
||||
* @param description a String describing the nature of the entry.
|
||||
* @param owner the User object who owns this entry.
|
||||
*/
|
||||
public CalendarEntry(GregorianCalendar time, String description, User owner)
|
||||
{
|
||||
this.time = time;
|
||||
this.description = description;
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this entry is visible for the given user.
|
||||
*
|
||||
* @param user The user who wants to see calendar entries.
|
||||
* @return A boolean value, indicating the visibility.
|
||||
*/
|
||||
public boolean isVisible(User user) {
|
||||
return (user.equals(owner) || !priv);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the description of this entry
|
||||
*
|
||||
* @return the description of this entry
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* assigns a new description for this entry
|
||||
*
|
||||
* @param description
|
||||
* the new description for this entry
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the owner of this entry
|
||||
*
|
||||
* @return the ower of this entry
|
||||
*/
|
||||
public User getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* assigns a new owner for this entry
|
||||
*
|
||||
* @param time the new owner for this entry
|
||||
*/
|
||||
public void setOwner(User owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this is a private entry.
|
||||
*
|
||||
* @return The privacy flag of the entry.
|
||||
*/
|
||||
public boolean isPrivate() {
|
||||
return priv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the privacy of this entry.
|
||||
*
|
||||
* @param priv set to true for private or false for public (default).
|
||||
*/
|
||||
public void setPrivate(boolean priv) {
|
||||
this.priv = priv;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the date and time of this entry
|
||||
*
|
||||
* @return the date and time of this entry
|
||||
*/
|
||||
public GregorianCalendar getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* assigns a new date and time for this entry
|
||||
*
|
||||
* @param time the new date and time for this entry
|
||||
*/
|
||||
public void setTime(GregorianCalendar time)
|
||||
{
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if CalendarEntry is between start- and end-Time else false.
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isBetween(GregorianCalendar start, GregorianCalendar end)
|
||||
{
|
||||
if( time.getTime().getTime() >= start.getTime().getTime() &&
|
||||
time.getTime().getTime() <= end.getTime().getTime() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a String representation of this CalendarEntry.
|
||||
*
|
||||
* @return a String representing this object
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("E, dd MMMM yyyy - kk:mm:ss");
|
||||
|
||||
sb.append(sdf.format(time.getTime()));
|
||||
sb.append(" von ").append(owner.getGivenName()).append(" ");
|
||||
sb.append(owner.getFamilyName());
|
||||
sb.append(" | ").append(description);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,199 @@
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
/**
|
||||
* This Class represents a CalendarEntry with a duration.
|
||||
*
|
||||
* @author Ulf Gebhardt
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CalendarEntryDuration extends CalendarEntry
|
||||
{
|
||||
/**
|
||||
* Start-Time of the Duration
|
||||
*/
|
||||
private GregorianCalendar startTime;
|
||||
|
||||
/**
|
||||
* End-Time of the Duration
|
||||
*/
|
||||
private GregorianCalendar endTime;
|
||||
|
||||
/**
|
||||
* Delegate which replaces absent Person
|
||||
*/
|
||||
private User delegate;
|
||||
|
||||
/**
|
||||
* Constructor of CalendarEntryDuration.
|
||||
*
|
||||
* You have to pass a aditional start- and end-Time.
|
||||
*
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @param description
|
||||
* @param owner
|
||||
*/
|
||||
public CalendarEntryDuration( GregorianCalendar startTime,
|
||||
GregorianCalendar endTime,
|
||||
String description,
|
||||
User owner)
|
||||
{
|
||||
super(startTime,description,owner);
|
||||
setStartTime(startTime);
|
||||
setEndTime(endTime);
|
||||
}
|
||||
|
||||
public GregorianCalendar getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(GregorianCalendar startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public GregorianCalendar getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(GregorianCalendar endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public User getDelegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
public void setDelegate(User delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns Duration of CalendarEntry on given field.
|
||||
*
|
||||
* @param field
|
||||
* @return integer
|
||||
*/
|
||||
public int getDuration(int field)
|
||||
{
|
||||
double timedif = endTime.getTimeInMillis() - startTime.getTimeInMillis();
|
||||
|
||||
switch(field)
|
||||
{
|
||||
case GregorianCalendar.DATE:
|
||||
{
|
||||
return (int) Math.floor(timedif / (1000*60*60*24));
|
||||
}
|
||||
case GregorianCalendar.HOUR:
|
||||
{
|
||||
return (int) Math.floor(timedif / (1000*60*60));
|
||||
}
|
||||
case GregorianCalendar.MINUTE:
|
||||
{
|
||||
return (int) Math.floor(timedif / (1000*60));
|
||||
}
|
||||
case GregorianCalendar.SECOND:
|
||||
{
|
||||
return (int) Math.floor(timedif / (1000));
|
||||
}
|
||||
default:
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public boolean spans(GregorianCalendar date)
|
||||
{
|
||||
if( (date.getTime().getTime() - startTime.getTime().getTime()) >= 0 &&
|
||||
(date.getTime().getTime() - endTime.getTime().getTime()) <= 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if CalendarEntry is between start- and end-Time else false.
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean isBetween(GregorianCalendar start, GregorianCalendar end)
|
||||
{
|
||||
if( (startTime.getTime().getTime() >= start.getTime().getTime() &&
|
||||
startTime.getTime().getTime() <= end.getTime().getTime() ) ||
|
||||
(endTime.getTime().getTime() >= start.getTime().getTime() &&
|
||||
endTime.getTime().getTime() <= end.getTime().getTime() ))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if given User is allowed to view this CalendarEntry.
|
||||
*
|
||||
* @param user
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean isVisible(User user)
|
||||
{
|
||||
if(user == this.getOwner() || !isPrivate() || user == delegate)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a String representation of this CalendarEntry.
|
||||
*
|
||||
* Warning, do not count months and years!!!
|
||||
*
|
||||
* @return a String representing this object
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
String result = super.toString() + " - about ";
|
||||
|
||||
if(getDuration(GregorianCalendar.DATE) > 0)
|
||||
{
|
||||
if(Math.floor((double)getDuration(GregorianCalendar.DATE) / 365) > 0)
|
||||
{
|
||||
return result + (int)Math.floor((double)getDuration(GregorianCalendar.DATE) / 365) + " year(s)";
|
||||
}
|
||||
|
||||
return result + getDuration(GregorianCalendar.DATE) + " day(s)";
|
||||
}
|
||||
|
||||
if(getDuration(GregorianCalendar.HOUR) > 0)
|
||||
{
|
||||
return result + getDuration(GregorianCalendar.HOUR) + " hour(s)";
|
||||
}
|
||||
|
||||
if(getDuration(GregorianCalendar.MINUTE) > 0)
|
||||
{
|
||||
return result + getDuration(GregorianCalendar.MINUTE) + " minute(s)";
|
||||
}
|
||||
|
||||
if(getDuration(GregorianCalendar.SECOND) > 0)
|
||||
{
|
||||
return result + getDuration(GregorianCalendar.SECOND) + " second(s)";
|
||||
}
|
||||
|
||||
return super.toString();
|
||||
}
|
||||
}
|
||||
20
ws2009/gdi I/exercise/src/GDI Calendar2/src/Developer.java
Normal file
20
ws2009/gdi I/exercise/src/GDI Calendar2/src/Developer.java
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* A Developer is a special type of user
|
||||
*
|
||||
*
|
||||
* @author Stefan Radomski, Guido Rößling
|
||||
* @version 1.0 2009-12-03
|
||||
*/
|
||||
public class Developer extends User{
|
||||
|
||||
/**
|
||||
* Create a new Developer.
|
||||
*
|
||||
* @param givenName The developers first name.
|
||||
* @param familyName The developers last name.
|
||||
*/
|
||||
public Developer(String givenName, String familyName)
|
||||
{
|
||||
super(givenName, familyName);
|
||||
}
|
||||
}
|
||||
27
ws2009/gdi I/exercise/src/GDI Calendar2/src/Illness.java
Normal file
27
ws2009/gdi I/exercise/src/GDI Calendar2/src/Illness.java
Normal file
@ -0,0 +1,27 @@
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
/**
|
||||
* Illness is a type of CalendarEntry that has a start and end time
|
||||
*
|
||||
* @author Stefan Radomski, Guido Rößling
|
||||
* @version 1.0 2009-12-03
|
||||
*/
|
||||
public class Illness extends CalendarEntryDuration {
|
||||
|
||||
/**
|
||||
* Create a new period of illness as it might be reported by a user.
|
||||
*
|
||||
* @param startTime The day the user went absent due to her illness.
|
||||
* @param endTime The day the user plans to return.
|
||||
* @param description Some additional information.
|
||||
* @param owner The user being ill.
|
||||
*/
|
||||
public Illness( GregorianCalendar startTime,
|
||||
GregorianCalendar endTime,
|
||||
String description,
|
||||
User owner)
|
||||
{
|
||||
super(startTime,endTime,description,owner);
|
||||
}
|
||||
|
||||
}
|
||||
112
ws2009/gdi I/exercise/src/GDI Calendar2/src/Meeting.java
Normal file
112
ws2009/gdi I/exercise/src/GDI Calendar2/src/Meeting.java
Normal file
@ -0,0 +1,112 @@
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* A Meeting is a calendar entry with participants and a start and
|
||||
* end time.
|
||||
*
|
||||
* @author Stefan Radomski, Guido Rößling
|
||||
* @version 1.0 2009-12-03
|
||||
*/
|
||||
public class Meeting extends CalendarEntryDuration
|
||||
{
|
||||
/**
|
||||
* Variable which stores participants of the meeting
|
||||
*/
|
||||
private List<User> participants;
|
||||
|
||||
/**
|
||||
* Create a new Meeting.
|
||||
*
|
||||
* @param startTime The time the meeting will start.
|
||||
* @param endTime The end time of the meeting.
|
||||
* @param description Additional information regarding the meetin.
|
||||
* @param owner The organizer of the meeting.
|
||||
*/
|
||||
public Meeting( GregorianCalendar startTime,
|
||||
GregorianCalendar endTime,
|
||||
String description,
|
||||
User owner)
|
||||
{
|
||||
super(startTime,endTime,description,owner);
|
||||
participants = new ArrayList<User>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user is Allowed to this Meeting
|
||||
*
|
||||
* @param user
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean isUserAllowed(User user)
|
||||
{
|
||||
return user.getClass() == Developer.class ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds User to Participant-List if user is allowed.
|
||||
*
|
||||
* @param newUser
|
||||
*/
|
||||
public void addParticipant(User newUser)
|
||||
{
|
||||
if(isUserAllowed(newUser) && !hasParticipant(newUser))
|
||||
{
|
||||
participants.add(newUser);
|
||||
}
|
||||
|
||||
//error here
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes given User from Participant-List
|
||||
*
|
||||
* Do not invoke error if User is not in List!
|
||||
*
|
||||
* @param user
|
||||
*/
|
||||
public void removeParticipant(User user)
|
||||
{
|
||||
participants.remove(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if User is in Participant-List.
|
||||
*
|
||||
* @param user
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean hasParticipant(User user)
|
||||
{
|
||||
return participants.contains(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Participant-List.
|
||||
* Users who are not allowed are removed from List.
|
||||
*
|
||||
* @param users
|
||||
*/
|
||||
public void setParticipants(User[] users)
|
||||
{
|
||||
participants.clear();
|
||||
|
||||
for(int i = 0; i < users.length; i++)
|
||||
{
|
||||
addParticipant(users[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Participant-List.
|
||||
*
|
||||
* @return User[]
|
||||
*/
|
||||
public User[] getParticipants()
|
||||
{
|
||||
User[] temparray = new User[participants.size()];
|
||||
participants.toArray(temparray);
|
||||
return temparray;
|
||||
}
|
||||
}
|
||||
35
ws2009/gdi I/exercise/src/GDI Calendar2/src/Note.java
Normal file
35
ws2009/gdi I/exercise/src/GDI Calendar2/src/Note.java
Normal file
@ -0,0 +1,35 @@
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
/**
|
||||
* A note is a calendar entry that stores details
|
||||
*
|
||||
* @author Stefan Radomski, Guido Rößling
|
||||
* @version 1.0 2009-12-03
|
||||
*/
|
||||
public class Note extends CalendarEntry
|
||||
{
|
||||
/**
|
||||
* Variable to store Details of the Note.
|
||||
*/
|
||||
private String details;
|
||||
|
||||
/**
|
||||
* Create a new note to be added to a calendar.
|
||||
*
|
||||
* @param time The time this note will become relevant.
|
||||
* @param description Additinal information.
|
||||
* @param owner The owner of the note.
|
||||
*/
|
||||
public Note(GregorianCalendar time, String description, User owner)
|
||||
{
|
||||
super(time, description, owner);
|
||||
}
|
||||
|
||||
public String getDetails() {
|
||||
return details;
|
||||
}
|
||||
|
||||
public void setDetails(String details) {
|
||||
this.details = details;
|
||||
}
|
||||
}
|
||||
44
ws2009/gdi I/exercise/src/GDI Calendar2/src/Reminder.java
Normal file
44
ws2009/gdi I/exercise/src/GDI Calendar2/src/Reminder.java
Normal file
@ -0,0 +1,44 @@
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
/**
|
||||
* A reminder is a calendar entry that appears at a defined
|
||||
* point in time but has no duration.
|
||||
*
|
||||
* @author Stefan Radomski, Guido Rößling
|
||||
* @version 1.0 2009-12-03
|
||||
*/
|
||||
public class Reminder extends CalendarEntry
|
||||
{
|
||||
/**
|
||||
* The time when to remind the owner about this entry.
|
||||
*/
|
||||
private GregorianCalendar alarmTime;
|
||||
|
||||
/**
|
||||
* Create a new reminder to be added in a calendar.
|
||||
*
|
||||
* @param time The time this reminder references.
|
||||
* @param alarmTime When to alert the owner about this reminder.
|
||||
* @param description Some descriptive information.
|
||||
* @param owner The user owning this entry.
|
||||
*/
|
||||
public Reminder(GregorianCalendar time,
|
||||
GregorianCalendar alarmTime,
|
||||
String description,
|
||||
User owner)
|
||||
{
|
||||
super(time,description,owner);
|
||||
setAlarmTime(alarmTime);
|
||||
}
|
||||
|
||||
public GregorianCalendar getAlarmTime() {
|
||||
return alarmTime;
|
||||
}
|
||||
|
||||
public void setAlarmTime(GregorianCalendar alarmTime) {
|
||||
if(alarmTime.before(time))
|
||||
{
|
||||
this.alarmTime = alarmTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
ws2009/gdi I/exercise/src/GDI Calendar2/src/Secretary.java
Normal file
19
ws2009/gdi I/exercise/src/GDI Calendar2/src/Secretary.java
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* A secretary is a special user for calendars.
|
||||
*
|
||||
* @author Stefan Radomski, Guido Rößling
|
||||
* @version 1.0 2009-12-03
|
||||
*/
|
||||
public class Secretary extends User{
|
||||
|
||||
/**
|
||||
* Creates a new secretary
|
||||
*
|
||||
* @param givenName The first name.
|
||||
* @param familyName The last name.
|
||||
*/
|
||||
public Secretary(String givenName, String familyName)
|
||||
{
|
||||
super(givenName,familyName);
|
||||
}
|
||||
}
|
||||
80
ws2009/gdi I/exercise/src/GDI Calendar2/src/User.java
Normal file
80
ws2009/gdi I/exercise/src/GDI Calendar2/src/User.java
Normal file
@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Instances of the user class own CalendarEntries
|
||||
*
|
||||
* @author Stefan Radomski, Guido Roessling
|
||||
* @version 1.0 2009-12-03
|
||||
*/
|
||||
public abstract class User {
|
||||
|
||||
/**
|
||||
* the given name of this user
|
||||
*/
|
||||
private String givenName;
|
||||
|
||||
/**
|
||||
* the family name of this user
|
||||
*/
|
||||
private String familyName;
|
||||
|
||||
/**
|
||||
* The constructor for User objects
|
||||
*
|
||||
* @param givenName the first name.
|
||||
* @param familyName the last name.
|
||||
*/
|
||||
public User(String givenName, String familyName) {
|
||||
this.givenName = givenName;
|
||||
this.familyName = familyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a textual representation of this user as a String
|
||||
*
|
||||
* @return the user in a String representation
|
||||
*/
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(givenName);
|
||||
if (givenName.length() > 0) {
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(familyName);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the given name of this user
|
||||
*
|
||||
* @return the given name of this user
|
||||
*/
|
||||
public String getGivenName() {
|
||||
return givenName;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the given name of this user
|
||||
*
|
||||
* @param givenName the new given name of the user
|
||||
*/
|
||||
public void setGivenName(String givenName) {
|
||||
this.givenName = givenName;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the family name of this user
|
||||
*
|
||||
* @return the family name of this user
|
||||
*/
|
||||
public String getFamilyName() {
|
||||
return familyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the family name of this user
|
||||
*
|
||||
* @param familyName the new family name of the user
|
||||
*/
|
||||
public void setFamilyName(String familyName) {
|
||||
this.familyName = familyName;
|
||||
}
|
||||
}
|
||||
27
ws2009/gdi I/exercise/src/GDI Calendar2/src/Vacation.java
Normal file
27
ws2009/gdi I/exercise/src/GDI Calendar2/src/Vacation.java
Normal file
@ -0,0 +1,27 @@
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
/**
|
||||
* Vacation represents an absence of a person due to a vacation
|
||||
*
|
||||
* @author Stefan Radomski, Guido Rößling
|
||||
* @version 1.0 2009-12-03
|
||||
*/
|
||||
public class Vacation extends CalendarEntryDuration
|
||||
{
|
||||
|
||||
/**
|
||||
* Create a new entry of a person's vacation.
|
||||
*
|
||||
* @param startTime When the vacation will start.
|
||||
* @param endTime When the person will be come back.
|
||||
* @param description Some additional information about the vacation.
|
||||
* @param owner The person going on vacation.
|
||||
*/
|
||||
public Vacation(GregorianCalendar startTime,
|
||||
GregorianCalendar endTime,
|
||||
String description,
|
||||
User owner)
|
||||
{
|
||||
super(startTime,endTime,description,owner);
|
||||
}
|
||||
}
|
||||
453
ws2009/gdi I/exercise/src/GDI Calendar2/tests/CalendarTest.java
Normal file
453
ws2009/gdi I/exercise/src/GDI Calendar2/tests/CalendarTest.java
Normal file
@ -0,0 +1,453 @@
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Test the various calendar functionality.
|
||||
*/
|
||||
public class CalendarTest {
|
||||
|
||||
/**
|
||||
* @author felix
|
||||
*/
|
||||
|
||||
private Calendar testCal;
|
||||
private Developer paul;
|
||||
private Developer mary;
|
||||
private Secretary bob;
|
||||
|
||||
private Note note;
|
||||
private Illness illness;
|
||||
private Reminder reminder;
|
||||
private Meeting meeting;
|
||||
private Vacation vacation;
|
||||
|
||||
@Before
|
||||
public void Init() {
|
||||
// test calendar object
|
||||
testCal = new Calendar();
|
||||
|
||||
// users init
|
||||
paul = new Developer("Paul", "Anderson");
|
||||
mary = new Developer("Mary", "Bobkins");
|
||||
bob = new Secretary("Adam", "Johanson");
|
||||
|
||||
// note init
|
||||
note = new Note(new GregorianCalendar(2009, 1, 0, 16, 0), "my note", paul);
|
||||
note.setDetails("test");
|
||||
testCal.addCalendarEntry(note);
|
||||
|
||||
// reminder init
|
||||
reminder = new Reminder(new GregorianCalendar(2010, 3, 12, 14, 30), new GregorianCalendar(2010, 3, 12, 14, 20), "Water the plants", mary);
|
||||
reminder.setPrivate(true);
|
||||
testCal.addCalendarEntry(reminder);
|
||||
|
||||
// meeting init
|
||||
meeting = new Meeting(new GregorianCalendar(2010, 1, 1, 16, 30), new GregorianCalendar(2010, 1, 1, 17, 0), "test meeting", bob);
|
||||
meeting.addParticipant(paul);
|
||||
meeting.addParticipant(mary);
|
||||
// meeting.addParticipant(bob); --> not possible - bob isn't a developer!
|
||||
|
||||
// illness init
|
||||
illness = new Illness(new GregorianCalendar(2010, 0, 1), new GregorianCalendar(2010, 0, 2), "bobs illness", bob);
|
||||
illness.setPrivate(true);
|
||||
testCal.addCalendarEntry(illness);
|
||||
|
||||
// vacation init
|
||||
vacation = new Vacation(new GregorianCalendar(2020, 0, 0, 0, 0), new GregorianCalendar(2020, 0, 0, 0, 1), "short vacation", paul);
|
||||
testCal.addCalendarEntry(vacation);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noteTest() {
|
||||
// has note the additional field details?
|
||||
Assert.assertEquals(note.getDetails(), "test");
|
||||
Assert.assertEquals(note.getDescription(), "my note");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void reminderTest() {
|
||||
// check current alarm time (should be set)
|
||||
Assert.assertEquals(reminder.getAlarmTime(), new GregorianCalendar(2010, 3, 12, 14, 20));
|
||||
|
||||
// set new alarm time after the actual time - this should not work
|
||||
// -> old alarm time should be set
|
||||
try {
|
||||
reminder.setAlarmTime(new GregorianCalendar(2010, 3, 12, 14, 40));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Assert.assertEquals(reminder.getAlarmTime(), new GregorianCalendar(2010, 3, 12, 14, 20));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void meetingTest() {
|
||||
// test method getParticipants
|
||||
String[] names = {"Paul", "Mary"};
|
||||
User[] participants = meeting.getParticipants();
|
||||
|
||||
for (int i=0; i<participants.length; i++) {
|
||||
Assert.assertEquals(names[i], participants[i].getGivenName());
|
||||
}
|
||||
|
||||
// test method setParticipants
|
||||
names[0] = "Mary";
|
||||
names[1] = "Paul";
|
||||
meeting.setParticipants(new Developer[] {mary, paul});
|
||||
participants = meeting.getParticipants();
|
||||
|
||||
for (int i=0; i<participants.length; i++)
|
||||
{
|
||||
Assert.assertEquals(names[i], participants[i].getGivenName());
|
||||
}
|
||||
|
||||
// test removeParticipant()
|
||||
meeting.removeParticipant(mary);
|
||||
Assert.assertEquals(1, meeting.getParticipants().length);
|
||||
Assert.assertEquals("Paul", meeting.getParticipants()[0].getGivenName());
|
||||
|
||||
// test addParticipant and hasParticipant
|
||||
meeting.addParticipant(mary);
|
||||
Assert.assertTrue(meeting.hasParticipant(mary));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void userClassesTest() {
|
||||
// check given name of a developer and a secretary
|
||||
Assert.assertEquals("Paul", paul.getGivenName());
|
||||
Assert.assertEquals("Adam", bob.getGivenName());
|
||||
|
||||
// check family name (of a developer and..)
|
||||
Assert.assertEquals("Anderson", paul.getFamilyName());
|
||||
Assert.assertEquals("Johanson", bob.getFamilyName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void delegateTest() {
|
||||
// check delegate for illness - paul is bobs delegate
|
||||
illness.setDelegate(paul);
|
||||
Assert.assertEquals(paul, illness.getDelegate());
|
||||
|
||||
// although bobs illness is private paul should see it, because he's his delegate
|
||||
Assert.assertTrue(illness.isPrivate());
|
||||
Assert.assertTrue(testCal.listEntries(paul).contains("bobs illness"));
|
||||
|
||||
// mary shouldn't see bobs illness (she isn't his delegate and his illness isn't public)
|
||||
Assert.assertFalse(testCal.listEntries(mary).contains("bobs illness"));
|
||||
|
||||
// test delegate for vacation
|
||||
vacation.setDelegate(bob);
|
||||
Assert.assertEquals("Adam", vacation.getDelegate().getGivenName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void durationTest() {
|
||||
// the meeting should be from 16:30 until 17:00 -> 30min
|
||||
|
||||
// check getDuration
|
||||
Assert.assertEquals(0, meeting.getDuration(GregorianCalendar.DATE));
|
||||
Assert.assertEquals(0, meeting.getDuration(GregorianCalendar.HOUR));
|
||||
Assert.assertEquals(30, meeting.getDuration(GregorianCalendar.MINUTE));
|
||||
Assert.assertEquals(1800, meeting.getDuration(GregorianCalendar.SECOND));
|
||||
|
||||
// check spans
|
||||
// 16:40 is within 16:30 - 17:00
|
||||
Assert.assertTrue(meeting.spans(new GregorianCalendar(2010, 1, 1, 16, 40)));
|
||||
// 16:00 is not within 16:30 - 17:00
|
||||
Assert.assertFalse(meeting.spans(new GregorianCalendar(2010, 1, 1, 16, 0)));
|
||||
|
||||
// check new toString()
|
||||
Assert.assertEquals("Mo, 01 Februar 2010 - 16:30:00 von Adam Johanson | test meeting - about 30 minute(s)", meeting.toString());
|
||||
meeting.setEndTime(new GregorianCalendar(2011, 1, 1, 18, 0));
|
||||
Assert.assertEquals("Mo, 01 Februar 2010 - 16:30:00 von Adam Johanson | test meeting - about 1 year(s)", meeting.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void calendarTest() {
|
||||
// test getBetween
|
||||
Calendar newCalendar = testCal.getBetween(new GregorianCalendar(2009, 0, 0, 0, 0), new GregorianCalendar(2010, 0, 0, 0, 0));
|
||||
|
||||
// pauls note is the only entry that's in 2009
|
||||
Assert.assertEquals("Sa, 31 Januar 2009 - 16:00:00 von Paul Anderson | my note\n", newCalendar.listEntries(paul));
|
||||
Assert.assertEquals(1, newCalendar.getCalendarEntries().length); // getCalendarEntries should work also for this test
|
||||
|
||||
// test addCalendarEntry and hasCalendarEntry
|
||||
Assert.assertTrue(newCalendar.hasCalendarEntry(note));
|
||||
newCalendar.addCalendarEntry(reminder);
|
||||
Assert.assertTrue(newCalendar.hasCalendarEntry(reminder));
|
||||
|
||||
// test removeCalendarEntry
|
||||
newCalendar.removeCalendarEntry(reminder);
|
||||
Assert.assertFalse(newCalendar.hasCalendarEntry(reminder));
|
||||
|
||||
// test getCalendarEntries and setCalendarEntries
|
||||
CalendarEntry[] testEntries = {meeting, illness};
|
||||
newCalendar.setCalendarEntries(testEntries);
|
||||
CalendarEntry[] actualEntries = newCalendar.getCalendarEntries();
|
||||
for (int i=0; i<testEntries.length; i++) {
|
||||
Assert.assertEquals(testEntries[i], actualEntries[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Ulf
|
||||
*/
|
||||
@Test
|
||||
public void testDeveloperCreation() {
|
||||
Developer sasha = new Developer("Sasha", "Dole");
|
||||
Assert.assertEquals(sasha.getGivenName(), "Sasha");
|
||||
Assert.assertEquals(sasha.getFamilyName(), "Dole");
|
||||
|
||||
//You can delete this stuff if you dont need this,
|
||||
//4 example if u use some fancy boolean or stuff to
|
||||
//determine if its a Secretary or a Developer
|
||||
Assert.assertEquals(sasha.getClass(), Developer.class);
|
||||
Assert.assertEquals(sasha.getClass().getSuperclass(), User.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSecretaryCreation() {
|
||||
Secretary sasha = new Secretary("Haris", "Pilton");
|
||||
Assert.assertEquals(sasha.getGivenName(), "Haris");
|
||||
Assert.assertEquals(sasha.getFamilyName(), "Pilton");
|
||||
|
||||
//You can delete this stuff if you dont need this,
|
||||
//4 example if u use some fancy boolean or stuff to
|
||||
//determine if its a Secretary or a Developer
|
||||
Assert.assertEquals(sasha.getClass(), Secretary.class);
|
||||
Assert.assertEquals(sasha.getClass().getSuperclass(), User.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMeetingCreation() {
|
||||
Meeting meeting = new Meeting( new GregorianCalendar(2010,4, 3, 18, 30),
|
||||
new GregorianCalendar(2010,4, 4, 18, 30),
|
||||
"Meeting some Dudes",
|
||||
new Developer("Sasha", "Dole"));
|
||||
Assert.assertFalse (meeting.isPrivate());
|
||||
Assert.assertEquals(meeting.getDescription(), "Meeting some Dudes");
|
||||
Assert.assertEquals(meeting.getOwner().getGivenName(), "Sasha");
|
||||
|
||||
Developer mrt = new Developer("Mr.","T.");
|
||||
meeting.addParticipant(mrt);
|
||||
|
||||
Assert.assertTrue(meeting.hasParticipant(mrt));
|
||||
|
||||
Secretary hp = new Secretary("Haris","Pilton");
|
||||
meeting.addParticipant(hp);
|
||||
|
||||
Assert.assertFalse(meeting.hasParticipant(hp));
|
||||
|
||||
meeting.removeParticipant(mrt);
|
||||
|
||||
Assert.assertFalse(meeting.hasParticipant(mrt));
|
||||
|
||||
Assert.assertEquals(meeting.toString(),"Mo, 03 Mai 2010 - 18:30:00 von Sasha Dole | Meeting some Dudes - about 1 day(s)" );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVacationCreation() {
|
||||
Vacation vacation = new Vacation( new GregorianCalendar(2010,4, 3, 18, 30),
|
||||
new GregorianCalendar(2011,5, 5, 18, 00),
|
||||
"PARTEY",
|
||||
new Developer("Mr.", "T."));
|
||||
vacation.setPrivate(true);
|
||||
|
||||
Assert.assertTrue(vacation.isPrivate());
|
||||
Assert.assertEquals(vacation.getDescription(), "PARTEY");
|
||||
Assert.assertEquals(vacation.getOwner().getGivenName(), "Mr.");
|
||||
|
||||
Assert.assertEquals(vacation.toString(),"Mo, 03 Mai 2010 - 18:30:00 von Mr. T. | PARTEY - about 1 year(s)" );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIllnessCreation() {
|
||||
Illness illness = new Illness( new GregorianCalendar(2010,4, 4, 18, 30),
|
||||
new GregorianCalendar(2010,4, 4, 18, 30, 5),
|
||||
"-17CC outa here - where is the greenhouse effect???",
|
||||
new Developer("Gott", "hat kein Nachnamen"));
|
||||
Assert.assertFalse (illness.isPrivate());
|
||||
Assert.assertEquals(illness.getDescription(), "-17CC outa here - where is the greenhouse effect???");
|
||||
Assert.assertEquals(illness.getOwner().getFamilyName(), "hat kein Nachnamen");
|
||||
|
||||
Assert.assertEquals(illness.toString(),"Di, 04 Mai 2010 - 18:30:00 von Gott hat kein Nachnamen | -17CC outa here - where is the greenhouse effect??? - about 5 second(s)" ); }
|
||||
|
||||
@Test
|
||||
public void testNoteCreation() {
|
||||
Note note = new Note( new GregorianCalendar(2010,1, 1, 1, 1),
|
||||
"download some illegal Stuff",
|
||||
new Developer("Anon", "Anonymous"));
|
||||
note.setPrivate(true);
|
||||
Assert.assertTrue (note.isPrivate());
|
||||
Assert.assertEquals(note.getDescription(), "download some illegal Stuff");
|
||||
Assert.assertEquals(note.getOwner().getFamilyName(), "Anonymous");
|
||||
Assert.assertEquals(note.getDetails(), null);
|
||||
|
||||
note.setDetails("/b/tards always provide something... nvm");
|
||||
|
||||
Assert.assertEquals(note.getDetails(), "/b/tards always provide something... nvm");
|
||||
Assert.assertEquals(note.toString(),"Mo, 01 Februar 2010 - 01:01:00 von Anon Anonymous | download some illegal Stuff" );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReminderCreation() {
|
||||
Reminder rem = new Reminder( new GregorianCalendar(2010,2, 1, 1, 1),
|
||||
new GregorianCalendar(2010,1, 1, 10, 0),
|
||||
"Call Mr. T",
|
||||
new Developer("Anon", "Anonymous"));
|
||||
rem.setPrivate(true);
|
||||
Assert.assertTrue (rem.isPrivate());
|
||||
Assert.assertEquals(rem.getDescription(), "Call Mr. T");
|
||||
Assert.assertEquals(rem.getOwner().getGivenName(), "Anon");
|
||||
Assert.assertEquals(rem.getAlarmTime(), new GregorianCalendar(2010,1, 1, 10, 0));
|
||||
|
||||
Assert.assertEquals(rem.toString(),"Mo, 01 März 2010 - 01:01:00 von Anon Anonymous | Call Mr. T" );
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCalendarCreation()
|
||||
{
|
||||
Calendar cal = new Calendar();
|
||||
Developer bob = new Developer("Bob", "Smith");
|
||||
Meeting meeting = new Meeting( new GregorianCalendar(2010, 3, 12, 18, 30),
|
||||
new GregorianCalendar(2010, 4, 12, 18, 30),
|
||||
"Meeting with Alex and Joseph",
|
||||
new Secretary("Nailin'", "Palin"));
|
||||
cal.addCalendarEntry(meeting);
|
||||
Assert.assertTrue(cal.listEntries(bob).length() > 0);
|
||||
Assert.assertTrue(cal.listEntries(bob).contains("Nailin'"));
|
||||
Assert.assertTrue(cal.listEntries(bob).contains("Meeting with Alex and Joseph"));
|
||||
Assert.assertTrue(cal.listEntries(bob).contains("2010"));
|
||||
Assert.assertTrue(cal.listEntries(bob).contains("April"));
|
||||
Assert.assertTrue(cal.listEntries(bob).contains("Mo"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCalendarCreationAgain()
|
||||
{
|
||||
Calendar cal = new Calendar();
|
||||
|
||||
Developer mrt = new Developer("Mr.", "T.");
|
||||
Assert.assertEquals(mrt.getGivenName(), "Mr.");
|
||||
Assert.assertEquals(mrt.getFamilyName(), "T.");
|
||||
|
||||
Developer god = new Developer("Gott", "braucht keinen Nachnamen");
|
||||
Assert.assertEquals(god.getGivenName(), "Gott");
|
||||
Assert.assertEquals(god.getFamilyName(), "braucht keinen Nachnamen");
|
||||
|
||||
Secretary hp = new Secretary("Haris", "Pilton");
|
||||
Assert.assertEquals(hp.getGivenName(), "Haris");
|
||||
Assert.assertEquals(hp.getFamilyName(), "Pilton");
|
||||
|
||||
Developer cn = new Developer("chuck", "norris");
|
||||
Assert.assertEquals(cn.getGivenName(), "chuck");
|
||||
Assert.assertEquals(cn.getFamilyName(), "norris");
|
||||
|
||||
Note note = new Note( new GregorianCalendar(2010, 3, 12, 14, 30),
|
||||
"Perform Roundhousekick",
|
||||
cn);
|
||||
|
||||
Assert.assertEquals(note.getDescription(), "Perform Roundhousekick");
|
||||
Assert.assertEquals(note.getDetails(),null);
|
||||
Assert.assertFalse(note.isPrivate());
|
||||
Assert.assertTrue(note.isVisible(mrt));
|
||||
Assert.assertTrue(note.isVisible(god));
|
||||
Assert.assertTrue(note.isVisible(hp));
|
||||
Assert.assertTrue(note.isVisible(cn));
|
||||
|
||||
note.setDetails("In Ya Face");
|
||||
|
||||
Assert.assertEquals(note.getDetails(),"In Ya Face");
|
||||
|
||||
note.setPrivate(true);
|
||||
|
||||
Assert.assertFalse(note.isVisible(mrt));
|
||||
Assert.assertFalse(note.isVisible(god));
|
||||
Assert.assertFalse(note.isVisible(hp));
|
||||
Assert.assertTrue(note.isVisible(cn));
|
||||
|
||||
note.setPrivate(false);
|
||||
|
||||
Reminder rem = new Reminder( new GregorianCalendar(2010, 3, 12, 14, 30),
|
||||
new GregorianCalendar(2010, 3, 12, 14, 20),
|
||||
"Tell some Chuck Norris Jokes",
|
||||
god);
|
||||
rem.setPrivate(true);
|
||||
|
||||
Assert.assertEquals(rem.getDescription(), "Tell some Chuck Norris Jokes");
|
||||
Assert.assertTrue(rem.isPrivate());
|
||||
Assert.assertFalse(rem.isVisible(mrt));
|
||||
Assert.assertTrue(rem.isVisible(god));
|
||||
Assert.assertFalse(rem.isVisible(hp));
|
||||
Assert.assertFalse(rem.isVisible(cn));
|
||||
|
||||
Meeting meet = new Meeting( new GregorianCalendar(2010, 3, 12, 10, 30),
|
||||
new GregorianCalendar(2010, 3, 12, 11, 30),
|
||||
"Meeting about ... wow shiny new shoes",
|
||||
hp);
|
||||
Assert.assertFalse(meet.hasParticipant(god));
|
||||
meet.addParticipant(god);
|
||||
Assert.assertTrue(meet.hasParticipant(god));
|
||||
|
||||
Assert.assertEquals(meet.getDescription(), "Meeting about ... wow shiny new shoes");
|
||||
Assert.assertFalse(meet.isPrivate());
|
||||
Assert.assertTrue(meet.isVisible(mrt));
|
||||
Assert.assertTrue(meet.isVisible(god));
|
||||
Assert.assertTrue(meet.isVisible(hp));
|
||||
Assert.assertTrue(meet.isVisible(cn));
|
||||
|
||||
Vacation vac = new Vacation( new GregorianCalendar(2010, 2, 3),
|
||||
new GregorianCalendar(2010, 2, 13),
|
||||
"Create Nightelf",
|
||||
mrt);
|
||||
|
||||
Assert.assertEquals(vac.getDelegate(),null);
|
||||
|
||||
vac.setDelegate(cn);
|
||||
|
||||
Assert.assertEquals(vac.getDelegate(),cn);
|
||||
|
||||
Assert.assertEquals(vac.getDescription(), "Create Nightelf");
|
||||
Assert.assertFalse(vac.isPrivate());
|
||||
Assert.assertTrue(vac.isVisible(mrt));
|
||||
Assert.assertTrue(vac.isVisible(god));
|
||||
Assert.assertTrue(vac.isVisible(hp));
|
||||
Assert.assertTrue(vac.isVisible(cn));
|
||||
|
||||
Illness ill = new Illness( new GregorianCalendar(2010, 3, 3),
|
||||
new GregorianCalendar(2010, 3, 4),
|
||||
"Chuck Norris f<>ngt sich keine Erk<72>ltung ein, eine Erk<72>ltung f<>ngt sich Eine von Chuck Norris ein",
|
||||
cn);
|
||||
|
||||
Assert.assertEquals(ill.getDelegate(),null);
|
||||
|
||||
ill.setDelegate(god);
|
||||
|
||||
Assert.assertEquals(ill.getDelegate(),god);
|
||||
|
||||
Assert.assertEquals(ill.getDescription(), "Chuck Norris f<>ngt sich keine Erk<72>ltung ein, eine Erk<72>ltung f<>ngt sich Eine von Chuck Norris ein");
|
||||
Assert.assertFalse(ill.isPrivate());
|
||||
Assert.assertTrue(ill.isVisible(mrt));
|
||||
Assert.assertTrue(ill.isVisible(god));
|
||||
Assert.assertTrue(ill.isVisible(hp));
|
||||
Assert.assertTrue(ill.isVisible(cn));
|
||||
|
||||
Calendar earlyApril = cal.getBetween( new GregorianCalendar(2010, 3, 3),
|
||||
new GregorianCalendar(2010, 3, 10));
|
||||
|
||||
cal.listEntries(mrt);
|
||||
cal.listEntries(god);
|
||||
cal.listEntries(hp);
|
||||
cal.listEntries(cn);
|
||||
|
||||
earlyApril.listEntries(mrt);
|
||||
earlyApril.listEntries(god);
|
||||
earlyApril.listEntries(hp);
|
||||
earlyApril.listEntries(cn);
|
||||
}
|
||||
|
||||
}
|
||||
8
ws2009/gdi I/exercise/src/Plumber/.classpath
Normal file
8
ws2009/gdi I/exercise/src/Plumber/.classpath
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry excluding="plumber/controller/exceptioncatcher/|plumber/model/events/levelset/|plumber/model/events/levelelement/Water.java|plumber/model/events/levelelement/UnWater.java" kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Translator"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
ws2009/gdi I/exercise/src/Plumber/.project
Normal file
17
ws2009/gdi I/exercise/src/Plumber/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Plumber</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@ -0,0 +1,12 @@
|
||||
#Thu Feb 25 22:27:38 CET 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
101
ws2009/gdi I/exercise/src/Plumber/Plumber.de_DE
Normal file
101
ws2009/gdi I/exercise/src/Plumber/Plumber.de_DE
Normal file
@ -0,0 +1,101 @@
|
||||
//about window
|
||||
credits = Impressum:
|
||||
names = Sascha, Yvonne, Ulf, Jana
|
||||
about = <html><center>Vier Leute fanden sich zusammen <br> in zwei Wochen <br> ein Spiel zu erstellen ...<\center><\html>
|
||||
|
||||
backButton.iconName=
|
||||
backButton.label=Zurueck
|
||||
backButton.mnemonic=z
|
||||
backButton.toolTipText=Druecken Sie diesen Knopf um zum Menue zu gehen
|
||||
|
||||
//options window
|
||||
aim = <html>Ziel des Spieles:<br>Durch rotieren der Rohre eine funktionierende Verbindung zwischen der Quelle und der Senke herstellen.<\html>
|
||||
control = <html>Steuerung:<br>Mit der Maus und/oder Tastatur (Pfeiltasten)<\html>
|
||||
rules = <html>Regeln:<br>Aus jeder Aktion und der Zeit wird der Punktestand errechnet. Sie können Schritte rueckgaengig machen und wiederholen lassen, auch ein Neustart ist möglich.<br>Achten Sie auf die ablaufende Zeit! Nach Ablauf der Zeit beginnt das Wasser automatisch zu fließen. Gefuellte Rohre sind nicht mehr drehbar.<\html>
|
||||
shortcuts = <html>Tastenbelegung:<br>[w] - Wasser starten<br>[n] - Neustart<br>[t] - Thema wechseln<br>[h] - Bestenliste<br>[q] - Beenden<br>[Leertaste] - rotieren<br>[Enter] - Wiederholen<br>[Backspace] - Zurueck<\html>
|
||||
|
||||
//highscore window
|
||||
time = Zeit
|
||||
points = Punkte
|
||||
highscore = Bestenliste
|
||||
|
||||
//main menu
|
||||
startButton.iconName=
|
||||
startButton.label= Starte Plumber
|
||||
startButton.mnemonic=s
|
||||
startButton.toolTipText=Druecken Sie diesen Knopf zum Starten
|
||||
|
||||
highscoreButton.iconName=
|
||||
highscoreButton.label= Highscore
|
||||
highscoreButton.mnemonic=h
|
||||
highscoreButton.toolTipText=Hier sehen Sie den Highscore
|
||||
|
||||
directionsButton.iconName=
|
||||
directionsButton.label= Anleitung
|
||||
directionsButton.mnemonic=o
|
||||
directionsButton.toolTipText=Klicken Sie hier fuer weiter Optionen
|
||||
|
||||
aboutButton.iconName=
|
||||
aboutButton.label= Informationen
|
||||
aboutButton.mnemonic=i
|
||||
aboutButton.toolTipText=Klicken Sie hier fuer weiter Informationen
|
||||
|
||||
|
||||
languageMenu.iconName=
|
||||
languageMenu.label= Sprache
|
||||
languageMenu.mnemonic=l
|
||||
languageMenu.toolTipText=Sprache hier auswaehlen
|
||||
|
||||
deutschItem.iconName=
|
||||
deutschItem.label=Deutsch
|
||||
deutschItem.mnemonic=d
|
||||
deutschItem.toolTipText=Waehle deutsch
|
||||
|
||||
englishItem.iconName=
|
||||
englishItem.label=English
|
||||
englishItem.mnemonic=e
|
||||
englishItem.toolTipText=Choose English
|
||||
|
||||
//window
|
||||
|
||||
timeLeft = Übrige Zeit:
|
||||
|
||||
restart.iconName=
|
||||
restart.label=Neustart
|
||||
restart.mnemonic=n
|
||||
restart.toolTipText=Druecken Sie diesen Knopf zum Neustarten
|
||||
|
||||
undo.iconName=
|
||||
undo.label=<<<
|
||||
undo.mnemonic=r
|
||||
undo.toolTipText=Druecken Sie diesen Knopf um den letzten Schritt rueckgaengig zu machen
|
||||
|
||||
redo.iconName=
|
||||
redo.label=>>>
|
||||
redo.mnemonic=w
|
||||
redo.toolTipText=Druecken Sie diesen Knopf um den letzten Schritt zu Wiederholen
|
||||
|
||||
exit.iconName=
|
||||
exit.label=Beenden
|
||||
exit.mnemonic=b
|
||||
exit.toolTipText=Druecken Sie diesen Knopf zum Beenden
|
||||
|
||||
theme.iconName=
|
||||
theme.label=Thema
|
||||
theme.mnemonic=t
|
||||
theme.toolTipText=Druecken Sie diesen Knopf um ein anderes Thema auszusuchen
|
||||
|
||||
Wasser.iconName=
|
||||
Wasser.label=Wasser
|
||||
Wasser.mnemonic=w
|
||||
Wasser.toolTipText=Druecken Sie diesen Knopf um das Wasser zu starten
|
||||
|
||||
Highscore.iconName=
|
||||
Highscore.label=Highscore
|
||||
Highscore.mnemonic=h
|
||||
Highscore.toolTipText=Zeigt Highscore fuer aktuelles Levelset
|
||||
|
||||
|
||||
gameover = Spiel vorbei!
|
||||
mastered = Level geschafft!
|
||||
ended = Das Levelpaket ist zu Ende. Bitte im Hauptmenü ein neues wählen.
|
||||
101
ws2009/gdi I/exercise/src/Plumber/Plumber.en_US
Normal file
101
ws2009/gdi I/exercise/src/Plumber/Plumber.en_US
Normal file
@ -0,0 +1,101 @@
|
||||
//about window
|
||||
credits = Credits:
|
||||
names = Sascha, Yvonne, Ulf, Jana
|
||||
about = <html><center>Four people came together<br> to create one game<br> in two weeks ...<\center><\html>
|
||||
|
||||
backButton.iconName=
|
||||
backButton.label= Back
|
||||
backButton.mnemonic=b
|
||||
backButton.toolTipText=Press Button to get back to the menu
|
||||
|
||||
//options window
|
||||
aim = <html>Goal:<br> The goal is to find a valid connection between the sink and the well <\html>
|
||||
control = <html>Control:<br> With the mouse or the arrow keys <\html>
|
||||
rules = <html>Rules:<br> Your Points are calculated according to every action and the time. You can undo and redo steps. A restart of a level is also possible. <br> Look at the time you have left. The water will start to flow after the time is down to zero. You can't move pipes that are filled with water.<\html>
|
||||
shortcuts = <html>Shortcuts:<br> [w] - start the water<br>[n] - restart<br>[t] - change the theme<br>[h] - Highscore<br>[q] - Quit<br>[space] - rotate<br>[Enter] - redo<br>[Backspace] - undo<\html>
|
||||
|
||||
//highscore window
|
||||
time = Time
|
||||
points = Points
|
||||
highscore = Highscore
|
||||
|
||||
//main menu
|
||||
startButton.iconName=
|
||||
startButton.label= Start Plumber
|
||||
startButton.mnemonic=s
|
||||
startButton.toolTipText=Press Button to start the game
|
||||
|
||||
highscoreButton.iconName=
|
||||
highscoreButton.label= Highscore
|
||||
highscoreButton.mnemonic=h
|
||||
highscoreButton.toolTipText=Press Button to see the highscore
|
||||
|
||||
directionsButton.iconName=
|
||||
directionsButton.label= Directions
|
||||
directionsButton.mnemonic=o
|
||||
directionsButton.toolTipText=Press Button for more options
|
||||
|
||||
aboutButton.iconName=
|
||||
aboutButton.label= About
|
||||
aboutButton.mnemonic=a
|
||||
aboutButton.toolTipText=Press Button to learn more about the game
|
||||
|
||||
|
||||
|
||||
languageMenu.iconName=
|
||||
languageMenu.label= Language
|
||||
languageMenu.mnemonic=l
|
||||
languageMenu.toolTipText=Choose language here
|
||||
|
||||
deutschItem.iconName=
|
||||
deutschItem.label=Deutsch
|
||||
deutschItem.mnemonic=d
|
||||
deutschItem.toolTipText=WŠhle deutsch
|
||||
|
||||
englishItem.iconName=
|
||||
englishItem.label=English
|
||||
englishItem.mnemonic=e
|
||||
englishItem.toolTipText=Choose English
|
||||
|
||||
//window
|
||||
|
||||
timeLeft = Time Left:
|
||||
|
||||
restart.iconName=
|
||||
restart.label=Restart
|
||||
restart.mnemonic=r
|
||||
restart.toolTipText=Press Button to restart the level
|
||||
|
||||
undo.iconName=
|
||||
undo.label=Undo
|
||||
undo.mnemonic=u
|
||||
undo.toolTipText=Press Button to undo last step
|
||||
|
||||
redo.iconName=
|
||||
redo.label=Redo
|
||||
redo.mnemonic=r
|
||||
redo.toolTipText=Press Button to redo last step
|
||||
|
||||
exit.iconName=
|
||||
exit.label=Exit
|
||||
exit.mnemonic=e
|
||||
exit.toolTipText=Press Button to exit
|
||||
|
||||
theme.iconName=
|
||||
theme.label=Theme
|
||||
theme.mnemonic=t
|
||||
theme.toolTipText=Press Button to choose a different theme
|
||||
|
||||
Wasser.iconName=
|
||||
Wasser.label=Water
|
||||
Wasser.mnemonic=w
|
||||
Wasser.toolTipText=Press Button to start the water flow
|
||||
|
||||
Highscore.iconName=
|
||||
Highscore.label=Highscore
|
||||
Highscore.mnemonic=h
|
||||
Highscore.toolTipText=Show highscore for current level
|
||||
|
||||
gameover = Game over!
|
||||
mastered = You mastered this level!
|
||||
ended = Levelset ended please go to mainmenu and select another one.
|
||||
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.
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.
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.
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.
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.
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.
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.
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.
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user