com.exigen.ie.scheduler.ResourceUnary Maven / Gradle / Ivy
package com.exigen.ie.scheduler;
///////////////////////////////////////////////////////////////////////////////
/*
* Copyright Exigen Group 1998, 1999, 2000, 2002
* 320 Amboy Ave., Metuchen, NJ, 08840, USA, www.exigengroup.com
*
* The copyright to the computer program(s) herein
* is the property of Exigen Group, USA. All rights reserved.
* The program(s) may be used and/or copied only with
* the written permission of Exigen Group
* or in accordance with the terms and conditions
* stipulated in the agreement/contract under which
* the program(s) have been supplied.
*/
///////////////////////////////////////////////////////////////////////////////
import com.exigen.ie.constrainer.Failure;
import com.exigen.ie.constrainer.IntExp;
/**
* An interface for the representation of the unary Resources (people, machines, materials).
*
* Resource has diferent capacities (1 or 0, ie available or not) in different times.
* There are require-constraints between jobs and resources.
*
* Examples:
* Job job = schedule.addJob(duration,"job1");
* Resource resource = schedule.addUnaryResource("truck1");
*
* job.requires(resource).post();
*
*
* @see Job
* @see ResourceDiscrete
*/
public class ResourceUnary extends ResourceDiscrete
{
private IntExp _used;
public ResourceUnary(Schedule sch, int timeMin, int timeMax)
{
super(sch, timeMin, timeMax, 1);
_used = null;
}
public ResourceUnary(Schedule sch)
{
super(sch, 1);
_used = null;
}
/**
* Returns expression reflecting usage of resource
* It equals to number of moments when capacity = 0
* @return Expression reflecting usage of resource
* @throws Failure
*/
public IntExp getUsed() throws Failure
{
if (_used == null)
_used = new IntExpEmployed(this);
return _used;
}
}