private void recordNewState(State state) {
    Object[] keyTable = this.binaryLocationsPerProject.keyTable;
    for (int i = 0, l = keyTable.length; i < l; i++) {
      IProject prereqProject = (IProject) keyTable[i];
      if (prereqProject != null && prereqProject != this.currentProject)
        state.recordStructuralDependency(prereqProject, getLastState(prereqProject));
    }

    if (DEBUG) System.out.println("JavaBuilder: Recording new state : " + state); // $NON-NLS-1$
    // state.dump();
    JavaModelManager.getJavaModelManager().setLastBuiltState(this.currentProject, state);
  }
 public static void writeState(Object state, DataOutputStream out) throws IOException {
   ((State) state).write(out);
 }
  private SimpleLookupTable findDeltas() {
    this.notifier.subTask(
        Messages.bind(Messages.build_readingDelta, this.currentProject.getName()));
    IResourceDelta delta = getDelta(this.currentProject);
    SimpleLookupTable deltas = new SimpleLookupTable(3);
    if (delta != null) {
      if (delta.getKind() != IResourceDelta.NO_CHANGE) {
        if (DEBUG)
          System.out.println(
              "JavaBuilder: Found source delta for: "
                  + this.currentProject.getName()); // $NON-NLS-1$
        deltas.put(this.currentProject, delta);
      }
    } else {
      if (DEBUG)
        System.out.println(
            "JavaBuilder: Missing delta for: " + this.currentProject.getName()); // $NON-NLS-1$
      this.notifier.subTask(""); // $NON-NLS-1$
      return null;
    }

    Object[] keyTable = this.binaryLocationsPerProject.keyTable;
    Object[] valueTable = this.binaryLocationsPerProject.valueTable;
    nextProject:
    for (int i = 0, l = keyTable.length; i < l; i++) {
      IProject p = (IProject) keyTable[i];
      if (p != null && p != this.currentProject) {
        State s = getLastState(p);
        if (!this.lastState.wasStructurallyChanged(p, s)) { // see if we can skip its delta
          if (s.wasNoopBuild())
            continue nextProject; // project has no source folders and can be skipped
          ClasspathLocation[] classFoldersAndJars = (ClasspathLocation[]) valueTable[i];
          boolean canSkip = true;
          for (int j = 0, m = classFoldersAndJars.length; j < m; j++) {
            if (classFoldersAndJars[j].isOutputFolder())
              classFoldersAndJars[j] =
                  null; // can ignore output folder since project was not structurally changed
            else canSkip = false;
          }
          if (canSkip)
            continue nextProject; // project has no structural changes in its output folders
        }

        this.notifier.subTask(Messages.bind(Messages.build_readingDelta, p.getName()));
        delta = getDelta(p);
        if (delta != null) {
          if (delta.getKind() != IResourceDelta.NO_CHANGE) {
            if (DEBUG)
              System.out.println(
                  "JavaBuilder: Found binary delta for: " + p.getName()); // $NON-NLS-1$
            deltas.put(p, delta);
          }
        } else {
          if (DEBUG)
            System.out.println("JavaBuilder: Missing delta for: " + p.getName()); // $NON-NLS-1$
          this.notifier.subTask(""); // $NON-NLS-1$
          return null;
        }
      }
    }
    this.notifier.subTask(""); // $NON-NLS-1$
    return deltas;
  }
 public static State readState(IProject project, DataInputStream in) throws IOException {
   return State.read(project, in);
 }