コード例 #1
0
ファイル: COSTmsg.java プロジェクト: RogerTangRT/FRODO
  /** @see java.io.Externalizable#readExternal(java.io.ObjectInput) */
  @SuppressWarnings("unchecked")
  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    this.sender = (String) in.readObject();
    this.receiver = (String) in.readObject();

    // Read the context
    short nbrVars = in.readShort();
    this.context = new HashMap<String, Val>(nbrVars);
    if (nbrVars > 0) {
      // Read the info about the first variable
      String var = (String) in.readObject();
      Val val = (Val) in.readObject();
      this.context.put(var, val);
      final boolean externalize = val.externalize();

      // Read the remaining variables
      for (short i = 1; i < nbrVars; i++) {
        var = (String) in.readObject();
        if (externalize) {
          val = val.getZero();
          val.readExternal(in);
          val = (Val) val.readResolve();
        } else val = (Val) in.readObject();
        this.context.put(var, val);
      }
    }

    // Read the bounds
    this.lb = (U) in.readObject();
    if (this.lb.externalize()) {
      this.ub = this.lb.getZero();
      this.ub.readExternal(in);
      this.ub = (U) this.ub.readResolve();
    } else this.ub = (U) in.readObject();
  }