Results 1 to 5 of 5
  1. #1
    Flipke is offline Member
    Join Date
    Apr 2009
    Posts
    2
    Rep Power
    0

    Default Time constraints on object state

    I'm working on a project and I've come across a new thing I'm really new at. I've checked forums, but basicly, I don't know what to look for. I’ll try to explain it as simple as possible and give you an example of what we have to implement.

    The project consists of builing a platform for a company to administrate contracts, transport requests etc. Each contract has, amongst other attributes like “contract period”, a ContractState, using the state pattern. States could be PROPOSED, SIGNED, EXPIRED, etc. We’re not using any kind of database for this, all contract objects are stored in a simple ArrayList.

    So an example of what we’re trying to achieve is that when the time hits ‘creationdate + contract period’ for any contract, that contract’s state automatically changes to EXPIRED. On top of that, we have to be able to jump forwards and backwards in time during execution, for demonstration purposes. We’re thinking about making a clock, relative to the real time by adding or deducting a set period and maybe using an Observer pattern.

    What is the best way to implement this?

    Any tips could be of great help,
    Thanks in advance.

  2. #2
    markw8500's Avatar
    markw8500 is offline Senior Member
    Join Date
    Jul 2008
    Location
    Pennsylvania, USA
    Posts
    136
    Rep Power
    0

    Default

    Will your contract's be expiring by the day or by the minute...

    Example of by the day would be like an apartment lease... It will expire on a certain day and hours, minutes do not matter...

    An example of hours/minutes/seconds would be an e-bay auction...

    Also... If you do not store your data in some type of database/filesystem then everytime you shut down your program, all your data will be lost... You might want to reconsider that...
    Who Cares... As Long As It Works...

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,232
    Rep Power
    19

  4. #4
    Flipke is offline Member
    Join Date
    Apr 2009
    Posts
    2
    Rep Power
    0

    Default

    The contract expires by minute, every date stored includes hours and minutes.

    We currently have no database because it's a project for school. It's a rather large one, but the emphasis lies not on how to store/query/.. data in a database, but on object oriented programming. A "world" is created each time you execute, which you can then manipulate through given use cases.

  5. #5
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    6

    Default

    you got your answer in the other forum. not exactly a new concept that requires research, just a basic one that requires application.

Similar Threads

  1. Replies: 1
    Last Post: 03-04-2009, 06:14 PM
  2. Checking toggle state of a menu item
    By xsive in forum SWT / JFace
    Replies: 1
    Last Post: 09-22-2008, 02:42 PM
  3. Replies: 0
    Last Post: 06-10-2008, 07:37 AM
  4. Concurrent Hierarchical State Machine 4.3
    By levent in forum Java Software
    Replies: 0
    Last Post: 08-03-2007, 04:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •