ifs.example.tt
Class Location

java.lang.Object
  extended by ifs.model.Value
      extended by ifs.example.tt.Location
All Implemented Interfaces:
Comparable

public class Location
extends Value

Location (value, i.e., a single placement of the activity). Location encodes a slot and a selection of resources.

Version:
1.0
Author:
Tomáš Müller

Field Summary
 
Fields inherited from class ifs.model.Value
iValue
 
Constructor Summary
Location(Activity activity, int day, int hour, Resource[] resources)
          Constructor. slot = nrHours * day + hour
Location(Activity activity, int slot, Resource[] resources)
          Constructor.
 
Method Summary
 int computeNrOfDiscouragedSlots()
          Computes number of discouraged slots (over all resources and the activity)
 boolean containResource(Resource resource)
          Returns true if the given resource is used by this location
 String getName()
          Values name -- for printing purposes (E.g., Monday 7:30)
 int getNrOfDiscouragedSlots()
          Number of slots (over all resources) which are discouraged
 Resource getResource(int idx)
          Gets given resource
 Resource[] getResources()
          Gets selection of resources
 int getSlot()
          Gets slot
 boolean hasIntersection(Location location)
          Returns true if the location intersects with another location.
 boolean isProhibited()
          Returns true if the location is prohibited.
 int toInt()
          Int value (for optimization) -- getNrOfDiscouragedSlots() is returned
 
Methods inherited from class ifs.model.Value
assigned, compareTo, conflicts, countAssignments, equals, getDescription, getExtra, getId, hashCode, lastAssignmentIteration, lastUnassignmentIteration, setExtra, setVariable, toString, unassigned, valueEquals, variable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Location

public Location(Activity activity,
                int slot,
                Resource[] resources)
Constructor.

Parameters:
activity - parent activity
slot - starting time
resources - selection of resources

Location

public Location(Activity activity,
                int day,
                int hour,
                Resource[] resources)
Constructor. slot = nrHours * day + hour

Parameters:
activity - parent activity
day - day
hour - starting hour
resources - required resources
Method Detail

getSlot

public int getSlot()
Gets slot


getResources

public Resource[] getResources()
Gets selection of resources


getResource

public Resource getResource(int idx)
Gets given resource


containResource

public boolean containResource(Resource resource)
Returns true if the given resource is used by this location


getNrOfDiscouragedSlots

public int getNrOfDiscouragedSlots()
Number of slots (over all resources) which are discouraged


toInt

public int toInt()
Int value (for optimization) -- getNrOfDiscouragedSlots() is returned

Overrides:
toInt in class Value

computeNrOfDiscouragedSlots

public int computeNrOfDiscouragedSlots()
Computes number of discouraged slots (over all resources and the activity)


hasIntersection

public boolean hasIntersection(Location location)
Returns true if the location intersects with another location. This means the same resource is used in the same time.


isProhibited

public boolean isProhibited()
Returns true if the location is prohibited. This means that the activity or a required resource has a time slot which is used by this location prohibited.


getName

public String getName()
Description copied from class: Value
Values name -- for printing purposes (E.g., Monday 7:30)

Overrides:
getName in class Value


Copyright © 2005 Tomáš Müller