@Override
  public String lookForExpiredAuction(int auctionId) throws RemoteException {
    ExpiredAuctionItem temp;
    StringBuffer sb = new StringBuffer();

    if ((temp = expiredAuctions.get(auctionId)) != null) {
      System.out.println("Expired auction found, results of this auction :" + temp.getResult());
      sb.append("Results of this auction :\n" + temp.getResult() + "\n");
      sb.append("General info of this auction : \n" + temp.toString() + "\n");
    }

    return sb.toString();
  }
 public String toString() {
   StringBuffer result = new StringBuffer();
   result.append("\nMighty Gumball, Inc.");
   result.append("\nJava-enabled Standing Gumball Model #2014");
   result.append("\nInventory: " + count + " gumball");
   if (count != 1) {
     result.append("s");
   }
   result.append("\n");
   result.append("Machine is " + state + "\n");
   return result.toString();
 }
  /**
   * create a 1-d String array from a network, for easy transmission to R. triples (source,
   * edgeType, target) are filled in to an array of length 3 * # of interactions
   *
   * @param network a gaggle network
   * @return the edge attributes of the network as a string array
   */
  protected String[] networkEdgeAttributesToStringArray(Network network) {
    Interaction[] interactions = network.getInteractions();
    String source, target, type;
    String[] attributeNames = network.getEdgeAttributeNames();
    ArrayList<String> list = new ArrayList<String>();

    for (Interaction interaction : interactions) {
      source = interaction.getSource();
      type = interaction.getType();
      target = interaction.getTarget();
      String edgeName = source + " (" + type + ") " + target;
      String terseEdgeName = source + "::" + target + "::" + type;
      for (String name : attributeNames) {
        HashMap hash = network.getEdgeAttributes(name);
        if (hash.containsKey(edgeName)) {
          Object value = hash.get(edgeName);
          StringBuffer sb = new StringBuffer();
          sb.append(terseEdgeName);
          sb.append("::");
          sb.append(name);
          sb.append("::");
          sb.append(value.toString());
          list.add(sb.toString());
        } else {
          System.out.println("no " + name + " attribute for " + edgeName);
        }
      } // for a
    } // for r

    return list.toArray(new String[0]);
  } // networkEdgeAttributesToStringArray
  public static void main(String[] args) {
    String host = args[0];
    int port = Integer.parseInt(args[1]);

    if (System.getSecurityManager() == null) {
      System.setSecurityManager(new RMISecurityManager());
    }

    String name = "//" + host + ":" + port + "/EquationSolver";

    double[][] A = {
      {4.0, 3.0, 1.0},
      {2.0, -6.0, 4.0},
      {7.0, 5.0, 3.0}
    };
    double[] b = {17.0, 8.0, 32.0};

    try {
      EquationSolver solver = (EquationSolver) Naming.lookup(name);
      double[] x = solver.solve(A, b);

      StringBuffer sb = new StringBuffer();
      for (int i = 0; i < x.length; i++) {
        sb.append(x[i]);
        sb.append(' ');
      }
      System.out.println(sb);

    } catch (RemoteException ex) {
      ex.printStackTrace(System.err);

    } catch (NotBoundException ex) {
      ex.printStackTrace(System.err);

    } catch (MalformedURLException ex) {
      ex.printStackTrace(System.err);
    }
  }
示例#5
0
  /**
   * Return a string representation of this GraphicsModeControlJ3D
   *
   * @return string that represents the state of this object.
   */
  public String toString() {
    StringBuffer buf = new StringBuffer("GraphicsModeControlJ3D[");

    buf.append("lw ");
    buf.append(lineWidth);
    buf.append(",ps ");
    buf.append(pointSize);

    buf.append(pointMode ? "pm" : "!pm");
    buf.append(textureEnable ? "te" : "!te");
    buf.append(scaleEnable ? "se" : "!se");
    buf.append(missingTransparent ? "mt" : "!mt");

    buf.append(",tm ");
    buf.append(transparencyMode);
    buf.append(",pp ");
    buf.append(projectionPolicy);
    buf.append(",pm ");
    buf.append(polygonMode);
    buf.append(",cm ");
    buf.append(colorMode);
    buf.append(",cs ");
    buf.append(curvedSize);
    buf.append(",po ");
    buf.append(polygonOffset);
    buf.append(",pof ");
    buf.append(polygonOffsetFactor);
    buf.append(adjustProjectionSeam ? "as" : "!as");
    buf.append(",t3dm ");
    buf.append(texture3DMode);
    buf.append(",ca ");
    buf.append(cacheAppearances);
    buf.append(",mg ");
    buf.append(mergeGeometries);

    buf.append(']');
    return buf.toString();
  }