Exemplo n.º 1
0
  public GridPoint getQueueLocation(String name, Grid grid) {
    GridPoint queueLoc = null;
    QueueSim queueR = null;
    context = ContextUtils.getContext(this);

    for (Object o : context.getObjects(QueueSim.class)) {
      queueR = (QueueSim) o;
      if (queueR.getName() == name) {
        queueLoc = grid.getLocation(o);
        // System.out.println("**** "+ queueR.getId()+ " "
        // + queueLoc);
        break;
      }
    }
    return queueLoc;
  }
Exemplo n.º 2
0
  protected Resource findResourceAvailable(String resourceType) {
    Resource rAvailable = null;
    context = getContext();
    for (Object o : context.getObjects(Resource.class)) {
      Resource resource = (Resource) o;
      if (resource.getResourceType() == resourceType) {
        System.out.println(
            "resource type? "
                + resourceType
                + " is required here, looking if "
                + resource.getId()
                + " is available? "
                + resource.isAvailable());
        if (resource.isAvailable() == true) {
          rAvailable = resource;
          break;
        } else {

        }
      }
    }
    return rAvailable;
  }