javax.constraints.scheduler.impl.BasicConsumptionTable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsr331-scheduler Show documentation
Show all versions of jsr331-scheduler Show documentation
This is a JSR331 package for scheduling and resource allocation problems
The newest version!
//=============================================
// J A V A C O M M U N I T Y P R O C E S S
//
// J S R 3 3 1
//
// Specification
//
//=============================================
package javax.constraints.scheduler.impl;
import java.util.ArrayList;
import javax.constraints.Var;
import javax.constraints.scheduler.Resource;
import javax.constraints.scheduler.Schedule;
import javax.constraints.scheduler.ConsumptionTable;
/**
* This is a basic implementation of consumption tables used by resources.
* A consumption table consists of columns of lists with constrained integer variables
* representing consumption of this resource by various activities.
*
*/
public class BasicConsumptionTable implements ConsumptionTable {
Resource resource;
int from;
int to;
VectorVar[] table;
public BasicConsumptionTable(Resource resource, int from, int to) {
this.resource = resource;
this.from = from;
this.to = to;
int size = to - from +1;
table = new VectorVar[size];
for(int time = from; time < to; time++) {
table[time] = new VectorVar();
}
}
/**
*
* @return a related resource
*/
public Resource getResource() {
return null;
}
/**
* Adds a var to the list of variables for the column "time"
* @param time
* @param var
*/
public void addVar(int time, Var var) {
Schedule s = resource.getSchedule();
// System.out.println();
// if (time == 1)
// System.out.println("*** time == 1");
//
// for(int j=0; j