示例#1
0
文件: set.java 项目: wcyuan/Set
      public static void main(String[] args) {

        if (args.length < 3) return;

        int a = java.lang.Integer.parseInt(args[0]);
        int b = java.lang.Integer.parseInt(args[1]);
        int c = java.lang.Integer.parseInt(args[2]);
        int mask = 1, div = 3;
        int x, y, z;
        // a--; b--; c--;
        for (int i = 0; i < 4; i++) {
          x = (a % div);
          y = (b % div);
          z = (c % div);
          System.out.println(
              "mask: " + mask + " div: " + div + " x: " + x + " y: " + y + " z: " + z);
          x /= mask;
          y /= mask;
          z /= mask;
          if (!(x == y && x == z) && !(x != y && x != z && y != z)) {
            System.out.println(
                "mask: " + mask + " div: " + div + " x: " + x + " y: " + y + " z: " + z);
            return;
          }
          mask *= 3;
          div *= 3;
        }
        return;

        /*
          if (IsSet(java.lang.Integer.parseInt(args[0]),
          java.lang.Integer.parseInt(args[1]),
          java.lang.Integer.parseInt(args[2])))
          {
          System.out.println("YES");
          } else
          {
          System.out.println("NO");
          }

          Cards c = new Cards(21);
          for (int j = 0; j < 2; j++)
          for (int i = 0; i < 21; i++)
          {
          System.out.println(i + " " + c.NextCard());
          }
        */
      }
  /**
   * @param value
   * @param type
   * @return
   */
  private Object createTypedObject(String value, Class type) {
    if (java.lang.String.class == type) return value;
    else if (java.lang.Integer.class == type) return java.lang.Integer.parseInt(value);
    else if (java.lang.Long.class == type) return java.lang.Long.parseLong(value);
    else if (java.lang.Boolean.class == type) return java.lang.Boolean.parseBoolean(value);
    else if (java.lang.Float.class == type) return java.lang.Float.parseFloat(value);
    else if (java.lang.Double.class == type) return java.lang.Double.parseDouble(value);

    return null;
  }
  /** @return Domain[] */
  public Domain[] getAllDomains() throws AdminException {
    Domain[] valret = null;
    int i;

    try {
      // Set the OrganizationSchema (if not already done)
      getOrganizationSchema();

      // Get the domain information
      DomainRow[] drs = getOrganization().domain.getAllDomains();
      if ((drs == null) || (drs.length <= 0)) {
        throw new AdminException(
            "DomainDriverManager.getAllDomains",
            SilverpeasException.ERROR,
            "admin.EX_ERR_NO_DOMAIN_FOUND");
      }

      valret = new Domain[drs.length];
      for (i = 0; i < drs.length; i++) {
        valret[i] = new Domain();
        valret[i].setId(java.lang.Integer.toString(drs[i].id));
        valret[i].setName(drs[i].name);
        valret[i].setDescription(drs[i].description);
        valret[i].setDriverClassName(drs[i].className);
        valret[i].setPropFileName(drs[i].propFileName);
        valret[i].setAuthenticationServer(drs[i].authenticationServer);
        valret[i].setTheTimeStamp(drs[i].theTimeStamp);
      }
    } catch (AdminPersistenceException e) {
      throw new AdminException(
          "DomainDriverManager.getAllDomains",
          SilverpeasException.ERROR,
          "admin.EX_ERR_GET_ALL_DOMAINS",
          e);
    } finally {
      releaseOrganizationSchema();
    }
    return valret;
  }
示例#4
0
 public void setLineStyle(int id) {
   java.lang.Integer lineType = (java.lang.Integer) tools[id].data;
   toolSettings.commonLineStyle = lineType.intValue();
   updateToolSettings();
 }
示例#5
0
 public void setFillType(int id) {
   java.lang.Integer fillType = (java.lang.Integer) tools[id].data;
   toolSettings.commonFillType = fillType.intValue();
   updateToolSettings();
 }