/******************************************************************* Copyright (c) 2001-2010 Apprisant Technologies Inc. All rights reserved. Apprisant Technologies permits non-exclusive royalty free use, copying and modification of this demo program source code for the purposes of evaluating the Apprisant Toolkit or building applications that use it. This software and documentation is provided "AS IS". APPRISANT TECHNOLOGIES DISCLAIMS ANY REPRESENTATIONS AND WARRANTIES, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTY OF MERCHANTABILITY AND FITNESS OF THIS PRODUCT FOR ANY PARTICULAR PURPOSE. APPRISANT TECHNOLOGIES SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY ANY PARTY, INCLUDING LOST PROFITS, ARISING FROM THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ITS DERIVATIONS. ********************************************************************/ package staffsched; import java.io.*; import java.util.*; import apprisant.diagram.data.*; import apprisant.diagram.env.AGLog; /* Data model class for the Staff Schedule demo. Holds an Appointment instance corresponding to each staff appointment. */ public class StaffData extends SimpleDataModel { enum Staff { Tom, Dick, Harry, Peter, Paul, Mary } static final int NUM_STAFF = 6; static final int NUM_DAYS = 3; static final int HOUR_START = 8; static final int HOUR_END = 18; public StaffData() { super(); createData(); } /* Creates the appointments and adds them to the data model. */ public void createData() { super.clear(); int key = 1; ArrayList d = new ArrayList(); // Tom d.add(new Appointment (key, Staff.Tom, "Client A", 0, 9, 1.5)); key++; d.add(new Appointment (key, Staff.Tom, "Client B", 0, 11, 1)); key++; d.add(new Appointment (key, Staff.Tom, "Lunch", 0, 12, 1)); key++; d.add(new Appointment (key, Staff.Tom, "Client C", 0, 14.5, 2)); key++; d.add(new Appointment (key, Staff.Tom, "Client D", 1, 9.5, 1.5)); key++; d.add(new Appointment (key, Staff.Tom, "Lunch", 1, 12, 1)); key++; d.add(new Appointment (key, Staff.Tom, "Client Q", 1, 14.5, 2)); key++; d.add(new Appointment (key, Staff.Tom, "Client B", 2, 8, 3)); key++; d.add(new Appointment (key, Staff.Tom, "Lunch", 2, 12, 1)); key++; d.add(new Appointment (key, Staff.Tom, "Golf", 2, 14.5, 2)); key++; // Dick d.add(new Appointment (key, Staff.Dick, "Client D", 0, 8, 1.5)); key++; d.add(new Appointment (key, Staff.Dick, "Client M", 0, 11.5, 2)); key++; d.add(new Appointment (key, Staff.Dick, "Client W", 0, 14.5, 2)); key++; d.add(new Appointment (key, Staff.Dick, "Client N", 1, 8, 1)); key++; d.add(new Appointment (key, Staff.Dick, "Client N", 1, 10, 1.5)); key++; d.add(new Appointment (key, Staff.Dick, "Lunch", 1, 12, 1.5)); key++; d.add(new Appointment (key, Staff.Dick, "Golf", 1, 15, 2)); key++; d.add(new Appointment (key, Staff.Dick, "Client H", 2, 10, 1)); key++; d.add(new Appointment (key, Staff.Dick, "Lunch", 2, 12, 1)); key++; d.add(new Appointment (key, Staff.Dick, "Client Q", 2, 13.5, 2)); key++; // Harry d.add(new Appointment (key, Staff.Harry, "Client K", 0, 8.5, 7)); key++; d.add(new Appointment (key, Staff.Harry, "Client D", 1, 9.5, 1.5)); key++; d.add(new Appointment (key, Staff.Harry, "Lunch", 1, 12, 1)); key++; d.add(new Appointment (key, Staff.Harry, "Client Q", 1, 14.5, 2)); key++; d.add(new Appointment (key, Staff.Harry, "Client B", 2, 8, 1)); key++; d.add(new Appointment (key, Staff.Harry, "Client R", 2, 9, 1.5)); key++; d.add(new Appointment (key, Staff.Harry, "Lunch", 2, 12, 1)); key++; d.add(new Appointment (key, Staff.Harry, "Board Meeting", 2, 13, 4)); key++; // Peter d.add(new Appointment (key, Staff.Peter, "Client E", 0, 9, 1.5)); key++; d.add(new Appointment (key, Staff.Peter, "Client M", 0, 11, 1)); key++; d.add(new Appointment (key, Staff.Peter, "Lunch", 0, 12, 1)); key++; d.add(new Appointment (key, Staff.Peter, "Out", 0, 14.5, 2)); key++; d.add(new Appointment (key, Staff.Peter, "Client B", 1, 9.5, 1.5)); key++; d.add(new Appointment (key, Staff.Peter, "Lunch", 1, 12, 1)); key++; d.add(new Appointment (key, Staff.Peter, "Client Q", 1, 14.5, 2)); key++; d.add(new Appointment (key, Staff.Peter, "Client W", 2, 8, 1.5)); key++; d.add(new Appointment (key, Staff.Peter, "Client X", 2, 10, 1.5)); key++; d.add(new Appointment (key, Staff.Peter, "Lunch", 2, 12, 1)); key++; d.add(new Appointment (key, Staff.Peter, "Client Y", 2, 13, 2)); key++; // Paul d.add(new Appointment (key, Staff.Paul, "Orientation", 0, 8, 4)); key++; d.add(new Appointment (key, Staff.Paul, "Lunch", 0, 12, 1)); key++; d.add(new Appointment (key, Staff.Paul, "Client B", 1, 8, 2)); key++; d.add(new Appointment (key, Staff.Paul, "Lunch", 1, 11.5, 1)); key++; d.add(new Appointment (key, Staff.Paul, "Client B", 2, 8, 2)); key++; d.add(new Appointment (key, Staff.Paul, "Lunch", 2, 12, 2)); key++; // Mary d.add(new Appointment (key, Staff.Mary, "Orientation", 0, 8, 4)); key++; d.add(new Appointment (key, Staff.Mary, "Lunch", 0, 12, 1)); key++; d.add(new Appointment (key, Staff.Mary, "Lunch", 1, 12, 1.5)); key++; d.add(new Appointment (key, Staff.Mary, "Client H", 1, 14.5, 2)); key++; d.add(new Appointment (key, Staff.Mary, "Lunch", 2, 12, 1)); key++; d.add(new Appointment (key, Staff.Mary, "Client P", 2, 13.5, 1.5)); key++; super.add(d); } }