Beispiel #1
0
  private void createJobs() {
    // method to generate synthetic jobs

    logger.info("  Generating base year jobs");
    TableDataSet jobs =
        SiloUtil.readCSVfile(
            ResourceUtil.getProperty(rb, JobDataManager.PROPERTIES_JOB_CONTROL_TOTAL));
    new JobType(rb);

    // jobInventory by [industry][taz]
    float[][] jobInventory =
        new float[JobType.getNumberOfJobTypes()][geoData.getHighestZonalId() + 1];
    tazByWorkZonePuma =
        new HashMap<>(); // this HashMap has same content as "HashMap tazByPuma", though is kept
                         // separately in case external workzones will be defined

    // read employment data
    // For reasons that are not explained in the documentation, some of the PUMA work zones were
    // aggregated to the
    // next higher level. Keep this information.

    for (int row = 1; row <= jobs.getRowCount(); row++) {
      int taz = (int) jobs.getValueAt(row, "SMZ");
      int pumaOfWorkZone = geoData.getSimplifiedPUMAofZone(taz);
      if (tazByWorkZonePuma.containsKey(pumaOfWorkZone)) {
        int[] list = tazByWorkZonePuma.get(pumaOfWorkZone);
        int[] newList = SiloUtil.expandArrayByOneElement(list, taz);
        tazByWorkZonePuma.put(pumaOfWorkZone, newList);
      } else {
        tazByWorkZonePuma.put(pumaOfWorkZone, new int[] {taz});
      }
      for (int jobTp = 0; jobTp < JobType.getNumberOfJobTypes(); jobTp++) {
        jobInventory[jobTp][taz] = jobs.getValueAt(row, JobType.getJobType(jobTp) + "00");
      }
    }

    // create base year employment
    for (int zone : geoData.getZones()) {
      for (int jobTp = 0; jobTp < JobType.getNumberOfJobTypes(); jobTp++) {
        if (jobInventory[jobTp][zone] > 0) {
          for (int i = 1; i <= jobInventory[jobTp][zone]; i++) {
            int id = JobDataManager.getNextJobId();
            new Job(id, zone, -1, JobType.getJobType(jobTp));
            if (id == SiloUtil.trackJj) {
              SiloUtil.trackWriter.println("Generated job with following attributes:");
              Job.getJobFromId(id).logAttributes(SiloUtil.trackWriter);
            }
          }
        }
      }
    }
    identifyVacantJobsByZone();
  }
 public void notifyCompleted(final boolean success) {
   log.info("Completed - layer:", layerId, "type:", type, "success:", success);
   Map<String, Object> output = createCommonResponse("completed");
   output.put("success", success);
   output.put("type", type.toString());
   this.service.addResults(session.getClient(), ResultProcessor.CHANNEL_STATUS, output);
 }
 public static JobTypeCollection buildFromBeanCollection(ims.vo.LookupInstanceBean[] beans) {
   JobTypeCollection coll = new JobTypeCollection();
   if (beans == null) return coll;
   for (int x = 0; x < beans.length; x++) {
     coll.add(JobType.buildLookup(beans[x]));
   }
   return coll;
 }
 public void notifyError(String error) {
   if (error == null) {
     error = "Something went wrong";
   }
   log.error("On Error - layer:", layerId, "type:", type, "msg:", error);
   Map<String, Object> output = createCommonResponse(error);
   output.put("type", type.toString());
   this.service.addResults(session.getClient(), ResultProcessor.CHANNEL_ERROR, output);
 }
 public static JobTypeCollection buildFromBeanCollection(java.util.Collection beans) {
   JobTypeCollection coll = new JobTypeCollection();
   if (beans == null) return coll;
   java.util.Iterator iter = beans.iterator();
   while (iter.hasNext()) {
     coll.add(JobType.buildLookup((ims.vo.LookupInstanceBean) iter.next()));
   }
   return coll;
 }
Beispiel #6
0
 @Factory("jobTypes")
 public JobType[] getJobTypes() {
   return JobType.values();
 }
 /**
  * The type of job for this cluster. Currently, the only job type supported for clusters is <code>
  * LOCAL_USE</code>.
  *
  * @param jobType The type of job for this cluster. Currently, the only job type supported for
  *     clusters is <code>LOCAL_USE</code>.
  * @see JobType
  */
 public void setJobType(JobType jobType) {
   this.jobType = jobType.toString();
 }
 public Object clone() {
   JobTypeCollection newCol = new JobTypeCollection();
   JobType item;
   for (int i = 0; i < super.size(); i++) {
     item = this.get(i);
     newCol.add(
         new JobType(
             item.getID(),
             item.getText(),
             item.isActive(),
             item.getParent(),
             item.getImage(),
             item.getColor(),
             item.getOrder()));
   }
   for (int i = 0; i < newCol.size(); i++) {
     item = newCol.get(i);
     if (item.getParent() != null) {
       int parentIndex = this.indexOf(item.getParent());
       if (parentIndex >= 0) item.setParent(newCol.get(parentIndex));
       else item.setParent((JobType) item.getParent().clone());
     }
   }
   return newCol;
 }