Esempio n. 1
0
  public static List range(BigInteger start, BigInteger end) {
    List l = new List();

    long st = start.longValue();
    long en = start.longValue();
    if (BigInteger.valueOf(st).equals(start) && BigInteger.valueOf(en).equals(end)) {
      int dir = st < en ? 1 : -1;
      while (st != en) {
        l.add(BigInteger.valueOf(st));
        st = st + dir;
      }
    } else {
      BigInteger dir;
      if (start.compareTo(end) < 0) {
        dir = BigInteger.ONE;
      } else {
        dir = BigInteger.valueOf(-1);
      }
      while (!start.equals(end)) {
        l.add(start);
        start = start.add(dir);
      }
    }

    return l;
  }
Esempio n. 2
0
  static String[] animate(int speed, String init) {
    List<List<Particle>> lists = new ArrayList<>();
    List<String> res = new ArrayList<>();

    for (int i = 0; i < init.length(); i++) {
      lists.add(new ArrayList<>());
      char c = init.charAt(i);
      if (c == 'R') {
        lists.get(i).add(new Particle(speed));
      } else if (c == 'L') {
        lists.get(i).add(new Particle(-speed));
      }
    }

    while (checkRemain(lists)) {
      res.add(convert(lists));
      lists = nextStep(lists);
    }
    res.add(convert(lists));
    String[] result = new String[res.size()];
    int index = 0;
    for (String s : res) {
      result[index++] = s;
    }
    return result;
  }
Esempio n. 3
0
  private static boolean bool(Text t, List<Object> valueList) {
    final boolean result;

    if (t.consume("true")) {
      valueList.add(Boolean.TRUE);
      result = true;
    } else if (t.consume("false")) {
      valueList.add(Boolean.FALSE);
      result = true;
    } else {
      result = false;
    }

    return result;
  }
  public void forgetClearTopDepByContTblIdx(long TenantId, long ContTableId) {
    if (indexByContTblIdx == null) {
      return;
    }
    CFBamClearTopDepByContTblIdxKey key =
        schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey();
    key.setRequiredTenantId(TenantId);
    key.setRequiredContTableId(ContTableId);
    if (indexByContTblIdx.containsKey(key)) {
      Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx = indexByContTblIdx.get(key);
      if (mapContTblIdx != null) {
        List<ICFBamClearTopDepObj> toForget = new LinkedList<ICFBamClearTopDepObj>();
        ICFBamClearTopDepObj cur = null;
        Iterator<ICFBamClearTopDepObj> iter = mapContTblIdx.values().iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          toForget.add(cur);
        }
        iter = toForget.iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          cur.forget(true);
        }
      }

      indexByContTblIdx.remove(key);
    }
  }
 public void deleteClearTopDepByContTblIdx(long TenantId, long ContTableId) {
   CFBamClearTopDepByContTblIdxKey key =
       schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredContTableId(ContTableId);
   if (indexByContTblIdx == null) {
     indexByContTblIdx =
         new HashMap<CFBamClearTopDepByContTblIdxKey, Map<CFBamScopePKey, ICFBamClearTopDepObj>>();
   }
   if (indexByContTblIdx.containsKey(key)) {
     Map<CFBamScopePKey, ICFBamClearTopDepObj> dict = indexByContTblIdx.get(key);
     schema
         .getBackingStore()
         .getTableClearTopDep()
         .deleteClearTopDepByContTblIdx(schema.getAuthorization(), TenantId, ContTableId);
     Iterator<ICFBamClearTopDepObj> iter = dict.values().iterator();
     ICFBamClearTopDepObj obj;
     List<ICFBamClearTopDepObj> toForget = new LinkedList<ICFBamClearTopDepObj>();
     while (iter.hasNext()) {
       obj = iter.next();
       toForget.add(obj);
     }
     iter = toForget.iterator();
     while (iter.hasNext()) {
       obj = iter.next();
       obj.forget(true);
     }
     indexByContTblIdx.remove(key);
   } else {
     schema
         .getBackingStore()
         .getTableClearTopDep()
         .deleteClearTopDepByContTblIdx(schema.getAuthorization(), TenantId, ContTableId);
   }
 }
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int n = scanner.nextInt();
    System.out.println("You entered integer " + n);

    List<BigDecimal> BD = new ArrayList<BigDecimal>();
    // System.out.println("Enter a string");
    // n = scanner.nextInt();
    /*  while(scanner.hasNext()){
    	  BD.add(new BigDecimal(scanner.next()));
    	  break;
    }

      for(BigDecimal bd :BD){
    	  System.out.println(bd);
    	  }  */

    for (int i = 0; i < n; i++) {
      BD.add(new BigDecimal(scanner.next()));
    }

    // Collections.reverse(BD);
    Collections.sort(BD, Collections.reverseOrder());
    for (BigDecimal bd : BD) {
      System.out.println(bd);
    }
  }
 public void deleteTaxByTenantIdx(long TenantId) {
   CFAccTaxByTenantIdxKey key =
       ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newTenantIdxKey();
   key.setRequiredTenantId(TenantId);
   if (indexByTenantIdx == null) {
     indexByTenantIdx = new HashMap<CFAccTaxByTenantIdxKey, Map<CFAccTaxPKey, ICFAccTaxObj>>();
   }
   if (indexByTenantIdx.containsKey(key)) {
     Map<CFAccTaxPKey, ICFAccTaxObj> dict = indexByTenantIdx.get(key);
     ((ICFAccSchema) schema.getBackingStore())
         .getTableTax()
         .deleteTaxByTenantIdx(schema.getAuthorization(), TenantId);
     Iterator<ICFAccTaxObj> iter = dict.values().iterator();
     ICFAccTaxObj obj;
     List<ICFAccTaxObj> toForget = new LinkedList<ICFAccTaxObj>();
     while (iter.hasNext()) {
       obj = iter.next();
       toForget.add(obj);
     }
     iter = toForget.iterator();
     while (iter.hasNext()) {
       obj = iter.next();
       obj.forget(true);
     }
     indexByTenantIdx.remove(key);
   } else {
     ((ICFAccSchema) schema.getBackingStore())
         .getTableTax()
         .deleteTaxByTenantIdx(schema.getAuthorization(), TenantId);
   }
 }
Esempio n. 8
0
  /*
  	-- This is a helper methid to run the morph files
  */
  private static void runMorphDataSet() throws Exception {

    String morph_directory =
        "../../thesis-datasets/morph/"; // directory where all the morph code is stored
    File d = new File(morph_directory);
    // get all the files from a directory
    File[] fList = d.listFiles();
    List<String> dir_list = new ArrayList<String>();
    for (File file : fList) {
      if (file.isDirectory()) {
        dir_list.add(file.getName());
      }
    }
    for (String dir : dir_list) {
      directory = morph_directory + dir + "/";
      System.out.println("Running TDDD " + directory);
      ReadFile.readFile(directory, fileList); // read the two files
      System.out.println(fileList.get(0) + " " + fileList.get(1));
      preliminaryStep(directory);
      startCDC();
      fileList.clear();
      fileArray.clear();
      hashed_File_List.clear();
    }
  }
  public void forgetSecGroupIncludeByIncludeIdx(long ClusterId, int IncludeGroupId) {
    if (indexByIncludeIdx == null) {
      return;
    }
    CFSecuritySecGroupIncludeByIncludeIdxKey key =
        ((ICFInternetSchema) schema.getBackingStore())
            .getFactorySecGroupInclude()
            .newIncludeIdxKey();
    key.setRequiredClusterId(ClusterId);
    key.setRequiredIncludeGroupId(IncludeGroupId);
    if (indexByIncludeIdx.containsKey(key)) {
      Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapIncludeIdx =
          indexByIncludeIdx.get(key);
      if (mapIncludeIdx != null) {
        List<ICFSecuritySecGroupIncludeObj> toForget =
            new LinkedList<ICFSecuritySecGroupIncludeObj>();
        ICFSecuritySecGroupIncludeObj cur = null;
        Iterator<ICFSecuritySecGroupIncludeObj> iter = mapIncludeIdx.values().iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          toForget.add(cur);
        }
        iter = toForget.iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          cur.forget(true);
        }
      }

      indexByIncludeIdx.remove(key);
    }
  }
Esempio n. 10
0
  private static boolean number(Text t, DataType requiredType, List<Object> valueList) {
    // posNumber
    // : cardinality
    // | '0b' BinaryDigits+ [zZ]?
    // | '0x' HexDigit+ [zZ]?
    // | '-'? Pint? ( '.' Digit+ ) ('e' Pint) [fF]
    // | '-'? Pint [zZfF]?
    // ;
    final boolean result;

    assert !t.isEof() : "Should have been checked by caller";

    if (binary(t, valueList, requiredType) || hex(t, valueList, requiredType)) {
      // ?todo I could allow negatives here
      // ( binary | hex | '0' )
      result = true;
    } else {
      // ( Int DecPart | Int | DecPart ) ( 'e' Int )? [zZfF]?

      final int start = t.cursor();

      if ((t.consumeInt() && (decPart(t) || true) && (exponent(t) || true))
          || (t.consume('-') || true) && decPart(t) && (exponent(t) || true)) {
        final String string = t.getString(start);
        final Object value = deriveType(string, requiredType, t, 10);
        valueList.add(value);
        result = true;
      } else {
        result = false;
      }
    }
    return result;
  }
  public void forgetISOCountryCurrencyByCurrencyIdx(short ISOCurrencyId) {
    if (indexByCurrencyIdx == null) {
      return;
    }
    CFSecurityISOCountryCurrencyByCurrencyIdxKey key =
        ((ICFInternetSchema) schema.getBackingStore())
            .getFactoryISOCountryCurrency()
            .newCurrencyIdxKey();
    key.setRequiredISOCurrencyId(ISOCurrencyId);
    if (indexByCurrencyIdx.containsKey(key)) {
      Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCurrencyIdx =
          indexByCurrencyIdx.get(key);
      if (mapCurrencyIdx != null) {
        List<ICFSecurityISOCountryCurrencyObj> toForget =
            new LinkedList<ICFSecurityISOCountryCurrencyObj>();
        ICFSecurityISOCountryCurrencyObj cur = null;
        Iterator<ICFSecurityISOCountryCurrencyObj> iter = mapCurrencyIdx.values().iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          toForget.add(cur);
        }
        iter = toForget.iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          cur.forget(true);
        }
      }

      indexByCurrencyIdx.remove(key);
    }
  }
 public String getPackedVersionString() {
   ICFLibAnyObj scopeDef;
   ICFBamVersionObj versionLeafDef = getVersionLeaf();
   List<String> invertedNodeNames = new ArrayList<String>();
   while (versionLeafDef != null) {
     invertedNodeNames.add(getVersionStringForLeafDef(versionLeafDef));
     scopeDef = versionLeafDef.getObjScope();
     if (scopeDef == null) {
       versionLeafDef = null;
     } else if (scopeDef instanceof ICFBamMinorVersionObj) {
       versionLeafDef = (ICFBamMinorVersionObj) scopeDef;
     } else if (scopeDef instanceof ICFBamMajorVersionObj) {
       versionLeafDef = (ICFBamMajorVersionObj) scopeDef;
     } else if (scopeDef instanceof ICFBamVersionObj) {
       versionLeafDef = (ICFBamVersionObj) scopeDef;
     } else {
       versionLeafDef = null;
     }
   }
   String ret = "";
   for (int idx = invertedNodeNames.size() - 1; idx >= 0; idx--) {
     if (ret.length() == 0) {
       ret = invertedNodeNames.get(idx);
     } else {
       ret = ret + invertedNodeNames.get(idx);
     }
   }
   return (ret);
 }
  public void forgetSecDeviceByUserIdx(UUID SecUserId) {
    if (indexByUserIdx == null) {
      return;
    }
    CFSecuritySecDeviceByUserIdxKey key =
        ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey();
    key.setRequiredSecUserId(SecUserId);
    if (indexByUserIdx.containsKey(key)) {
      Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> mapUserIdx = indexByUserIdx.get(key);
      if (mapUserIdx != null) {
        List<ICFSecuritySecDeviceObj> toForget = new LinkedList<ICFSecuritySecDeviceObj>();
        ICFSecuritySecDeviceObj cur = null;
        Iterator<ICFSecuritySecDeviceObj> iter = mapUserIdx.values().iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          toForget.add(cur);
        }
        iter = toForget.iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          cur.forget(true);
        }
      }

      indexByUserIdx.remove(key);
    }
  }
  public void forgetDomainBySubDomIdx(long TenantId, long SubDomainOfId) {
    if (indexBySubDomIdx == null) {
      return;
    }
    CFInternetDomainBySubDomIdxKey key =
        ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey();
    key.setRequiredTenantId(TenantId);
    key.setRequiredSubDomainOfId(SubDomainOfId);
    if (indexBySubDomIdx.containsKey(key)) {
      Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx = indexBySubDomIdx.get(key);
      if (mapSubDomIdx != null) {
        List<ICFInternetDomainObj> toForget = new LinkedList<ICFInternetDomainObj>();
        ICFInternetDomainObj cur = null;
        Iterator<ICFInternetDomainObj> iter = mapSubDomIdx.values().iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          toForget.add(cur);
        }
        iter = toForget.iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          cur.forget(true);
        }
      }

      indexBySubDomIdx.remove(key);
    }
  }
 public void deleteSecDeviceByUserIdx(UUID SecUserId) {
   CFSecuritySecDeviceByUserIdxKey key =
       ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey();
   key.setRequiredSecUserId(SecUserId);
   if (indexByUserIdx == null) {
     indexByUserIdx =
         new HashMap<
             CFSecuritySecDeviceByUserIdxKey,
             Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj>>();
   }
   if (indexByUserIdx.containsKey(key)) {
     Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> dict = indexByUserIdx.get(key);
     ((ICFSecuritySchema) schema.getBackingStore())
         .getTableSecDevice()
         .deleteSecDeviceByUserIdx(schema.getAuthorization(), SecUserId);
     Iterator<ICFSecuritySecDeviceObj> iter = dict.values().iterator();
     ICFSecuritySecDeviceObj obj;
     List<ICFSecuritySecDeviceObj> toForget = new LinkedList<ICFSecuritySecDeviceObj>();
     while (iter.hasNext()) {
       obj = iter.next();
       toForget.add(obj);
     }
     iter = toForget.iterator();
     while (iter.hasNext()) {
       obj = iter.next();
       obj.forget(true);
     }
     indexByUserIdx.remove(key);
   } else {
     ((ICFSecuritySchema) schema.getBackingStore())
         .getTableSecDevice()
         .deleteSecDeviceByUserIdx(schema.getAuthorization(), SecUserId);
   }
 }
Esempio n. 16
0
 /**
  * Coerce a string into a Whiley char list.
  *
  * @param str
  * @return
  */
 public static List str2cl(String str) {
   List r = new List(str.length());
   for (int i = 0; i != str.length(); ++i) {
     r.add(str.charAt(i));
   }
   return r;
 }
Esempio n. 17
0
 /**
  * Coerce a string into a Whiley int list.
  *
  * @param str
  * @return
  */
 public static List str2il(String str) {
   List r = new List(str.length());
   for (int i = 0; i != str.length(); ++i) {
     r.add(BigInteger.valueOf(str.charAt(i)));
   }
   return r;
 }
Esempio n. 18
0
 /**
  * This method is used to convert the arguments supplied to main (which have type <code>String[]
  * </code>) into an appropriate Whiley List.
  *
  * @param args
  * @return
  */
 public static List fromStringList(String[] args) {
   List r = new List(args.length);
   for (int i = 0; i != args.length; ++i) {
     r.add(args[i]);
   }
   return r;
 }
  public void forgetTaxByTenantIdx(long TenantId) {
    if (indexByTenantIdx == null) {
      return;
    }
    CFAccTaxByTenantIdxKey key =
        ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newTenantIdxKey();
    key.setRequiredTenantId(TenantId);
    if (indexByTenantIdx.containsKey(key)) {
      Map<CFAccTaxPKey, ICFAccTaxObj> mapTenantIdx = indexByTenantIdx.get(key);
      if (mapTenantIdx != null) {
        List<ICFAccTaxObj> toForget = new LinkedList<ICFAccTaxObj>();
        ICFAccTaxObj cur = null;
        Iterator<ICFAccTaxObj> iter = mapTenantIdx.values().iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          toForget.add(cur);
        }
        iter = toForget.iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          cur.forget(true);
        }
      }

      indexByTenantIdx.remove(key);
    }
  }
Esempio n. 20
0
  /**
   * Parse a value.
   *
   * @param tb Source.
   * @param type The type of the array, may be any..
   * @param valueList Result added here.
   * @return Return true if a value has been added to the valueList and the cursor advanced or false
   *     and the cursor is as it was.
   */
  private static boolean value(Text t, DataType type, List<Object> valueList) {
    boolean result;

    if (t.isEof()) {
      result = false;
    } else if (t.consume("null")) {
      valueList.add(null);
      result = true;
    } else {
      switch (type) {
        case z:
        case Z:
        case f:
        case F:
          result = number(t, type, valueList);
          break;

        case text:
          result = text(t, valueList);
          break;

        case identifier:
          result = identifier(t, valueList);
          break;

        case path:
          result = path(t, valueList);
          break;

        case datetime:
          result = datetime(t, valueList);
          break;

        case date:
          result = date(t, valueList);
          break;

        case time:
          result = time(t, valueList);
          break;

        case bool:
          result = bool(t, valueList);
          break;

        case cardinality:
          result = cardinality(t, valueList);
          break;

        case any:
          result = any(t, valueList);
          break;

        default:
          throw new UnexpectedException("value: " + type);
      }
    }

    return result;
  }
Esempio n. 21
0
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int arr[][] = new int[6][6];
    for (int i = 0; i < 6; i++) {
      for (int j = 0; j < 6; j++) {
        arr[i][j] = in.nextInt();
      }
    }

    List sum = new ArrayList();
    for (int i = 1; i < 5; i++) {
      for (int j = 1; j < 5; j++) {
        int temp =
            arr[i][j]
                + arr[i - 1][j - 1]
                + arr[i - 1][j]
                + arr[i - 1][j + 1]
                + arr[i + 1][j - 1]
                + arr[i + 1][j]
                + arr[i + 1][j + 1];
        sum.add(temp);
      }
    }

    System.out.println(Collections.max(sum));
  }
 public CFSecuritySecDeviceBuff[] readBuffByUserIdx(
     CFSecurityAuthorization Authorization, UUID SecUserId) {
   final String S_ProcName = "readBuffByUserIdx";
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     String sql =
         "call "
             + schema.getLowerDbSchemaName()
             + ".sp_read_secdev_by_useridx( ?, ?, ?, ?, ?"
             + ", "
             + "?"
             + " )";
     if (stmtReadBuffByUserIdx == null) {
       stmtReadBuffByUserIdx = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtReadBuffByUserIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByUserIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtReadBuffByUserIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtReadBuffByUserIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByUserIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtReadBuffByUserIdx.setString(argIdx++, SecUserId.toString());
     try {
       resultSet = stmtReadBuffByUserIdx.executeQuery();
     } catch (SQLException e) {
       if (e.getErrorCode() != 1329) {
         throw e;
       }
       resultSet = null;
     }
     List<CFSecuritySecDeviceBuff> buffList = new LinkedList<CFSecuritySecDeviceBuff>();
     while ((resultSet != null) && resultSet.next()) {
       CFSecuritySecDeviceBuff buff = unpackSecDeviceResultSetToBuff(resultSet);
       buffList.add(buff);
     }
     int idx = 0;
     CFSecuritySecDeviceBuff[] retBuff = new CFSecuritySecDeviceBuff[buffList.size()];
     Iterator<CFSecuritySecDeviceBuff> iter = buffList.iterator();
     while (iter.hasNext()) {
       retBuff[idx++] = iter.next();
     }
     return (retBuff);
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
 public CFSecurityISOCountryLanguageBuff[] readAllBuff(CFSecurityAuthorization Authorization) {
   final String S_ProcName = "readAllBuff";
   if (!schema.isTransactionOpen()) {
     throw CFLib.getDefaultExceptionFactory()
         .newUsageException(getClass(), S_ProcName, "Transaction not open");
   }
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     String sql =
         "call " + schema.getLowerDbSchemaName() + ".sp_read_iso_cntrylng_all( ?, ?, ?, ?, ? )";
     if (stmtReadAllBuff == null) {
       stmtReadAllBuff = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtReadAllBuff.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadAllBuff.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtReadAllBuff.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtReadAllBuff.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadAllBuff.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     try {
       resultSet = stmtReadAllBuff.executeQuery();
     } catch (SQLException e) {
       if (e.getErrorCode() != 1329) {
         throw e;
       }
       resultSet = null;
     }
     List<CFSecurityISOCountryLanguageBuff> buffList =
         new LinkedList<CFSecurityISOCountryLanguageBuff>();
     while ((resultSet != null) && resultSet.next()) {
       CFSecurityISOCountryLanguageBuff buff = unpackISOCountryLanguageResultSetToBuff(resultSet);
       buffList.add(buff);
     }
     int idx = 0;
     CFSecurityISOCountryLanguageBuff[] retBuff =
         new CFSecurityISOCountryLanguageBuff[buffList.size()];
     Iterator<CFSecurityISOCountryLanguageBuff> iter = buffList.iterator();
     while (iter.hasNext()) {
       retBuff[idx++] = iter.next();
     }
     return (retBuff);
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
 public CFCrmMemoDataBuff[] readBuffByMemoDataCtcIdx(
     CFSecurityAuthorization Authorization, long TenantId, long ContactId) {
   final String S_ProcName = "readBuffByMemoDataCtcIdx";
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     String sql =
         "{ call sp_read_memodata_by_memodatactcidx( ?, ?, ?, ?, ?"
             + ", "
             + "?"
             + ", "
             + "?"
             + " ) }";
     if (stmtReadBuffByMemoDataCtcIdx == null) {
       stmtReadBuffByMemoDataCtcIdx = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtReadBuffByMemoDataCtcIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByMemoDataCtcIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtReadBuffByMemoDataCtcIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtReadBuffByMemoDataCtcIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByMemoDataCtcIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtReadBuffByMemoDataCtcIdx.setLong(argIdx++, TenantId);
     stmtReadBuffByMemoDataCtcIdx.setLong(argIdx++, ContactId);
     resultSet = stmtReadBuffByMemoDataCtcIdx.executeQuery();
     List<CFCrmMemoDataBuff> buffList = new LinkedList<CFCrmMemoDataBuff>();
     if (resultSet != null) {
       while (resultSet.next()) {
         CFCrmMemoDataBuff buff = unpackMemoDataResultSetToBuff(resultSet);
         buffList.add(buff);
       }
     }
     int idx = 0;
     CFCrmMemoDataBuff[] retBuff = new CFCrmMemoDataBuff[buffList.size()];
     Iterator<CFCrmMemoDataBuff> iter = buffList.iterator();
     while (iter.hasNext()) {
       retBuff[idx++] = iter.next();
     }
     return (retBuff);
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
 public CFSecurityISOTimezoneBuff[] readBuffByOffsetIdx(
     CFSecurityAuthorization Authorization, short TZHourOffset, short TZMinOffset) {
   final String S_ProcName = "readBuffByOffsetIdx";
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     String sql =
         "SELECT * FROM "
             + schema.getLowerDbSchemaName()
             + ".sp_read_isotz_by_offsetidx( ?, ?, ?, ?, ?"
             + ", "
             + "?"
             + ", "
             + "?"
             + " )";
     if (stmtReadBuffByOffsetIdx == null) {
       stmtReadBuffByOffsetIdx = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtReadBuffByOffsetIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByOffsetIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtReadBuffByOffsetIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtReadBuffByOffsetIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByOffsetIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtReadBuffByOffsetIdx.setShort(argIdx++, TZHourOffset);
     stmtReadBuffByOffsetIdx.setShort(argIdx++, TZMinOffset);
     resultSet = stmtReadBuffByOffsetIdx.executeQuery();
     List<CFSecurityISOTimezoneBuff> buffList = new LinkedList<CFSecurityISOTimezoneBuff>();
     while (resultSet.next()) {
       CFSecurityISOTimezoneBuff buff = unpackISOTimezoneResultSetToBuff(resultSet);
       buffList.add(buff);
     }
     int idx = 0;
     CFSecurityISOTimezoneBuff[] retBuff = new CFSecurityISOTimezoneBuff[buffList.size()];
     Iterator<CFSecurityISOTimezoneBuff> iter = buffList.iterator();
     while (iter.hasNext()) {
       retBuff[idx++] = iter.next();
     }
     return (retBuff);
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
Esempio n. 26
0
 protected void listChildren(List<Property> childrenList) {
   super.listChildren(childrenList);
   childrenList.add(
       new Property(
           "value",
           "decimal",
           "The value of the measured amount. The value includes an implicit precision in the presentation of the value.",
           0,
           java.lang.Integer.MAX_VALUE,
           value));
   childrenList.add(
       new Property(
           "comparator",
           "code",
           "How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value.",
           0,
           java.lang.Integer.MAX_VALUE,
           comparator));
   childrenList.add(
       new Property(
           "unit",
           "string",
           "A human-readable form of the unit.",
           0,
           java.lang.Integer.MAX_VALUE,
           unit));
   childrenList.add(
       new Property(
           "system",
           "uri",
           "The identification of the system that provides the coded form of the unit.",
           0,
           java.lang.Integer.MAX_VALUE,
           system));
   childrenList.add(
       new Property(
           "code",
           "code",
           "A computer processable form of the unit in some unit representation system.",
           0,
           java.lang.Integer.MAX_VALUE,
           code));
 }
Esempio n. 27
0
  static {
    allLucky.add(4);
    allLucky.add(7);
    for (int i = 0; i < allLucky.size(); i++) {
      int j = allLucky.get(i);
      {
        long e = j * 10L + 4;
        if (e < Integer.MAX_VALUE) {
          allLucky.add((int) e);
        }
      }

      {
        long e = j * 10L + 7;
        if (e < Integer.MAX_VALUE) {
          allLucky.add((int) e);
        }
      }
    }
  }
 public CFSecurityTSecGroupBuff[] readBuffByTenantVisIdx(
     CFSecurityAuthorization Authorization, long TenantId, boolean IsVisible) {
   final String S_ProcName = "readBuffByTenantVisIdx";
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     String sql = "exec sp_read_tsecgrp_by_tenantvisidx ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?";
     if (stmtReadBuffByTenantVisIdx == null) {
       stmtReadBuffByTenantVisIdx = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtReadBuffByTenantVisIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByTenantVisIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtReadBuffByTenantVisIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtReadBuffByTenantVisIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByTenantVisIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtReadBuffByTenantVisIdx.setLong(argIdx++, TenantId);
     if (IsVisible) {
       stmtReadBuffByTenantVisIdx.setString(argIdx++, "Y");
     } else {
       stmtReadBuffByTenantVisIdx.setString(argIdx++, "N");
     }
     resultSet = stmtReadBuffByTenantVisIdx.executeQuery();
     List<CFSecurityTSecGroupBuff> buffList = new LinkedList<CFSecurityTSecGroupBuff>();
     while (resultSet.next()) {
       CFSecurityTSecGroupBuff buff = unpackTSecGroupResultSetToBuff(resultSet);
       buffList.add(buff);
     }
     int idx = 0;
     CFSecurityTSecGroupBuff[] retBuff = new CFSecurityTSecGroupBuff[buffList.size()];
     Iterator<CFSecurityTSecGroupBuff> iter = buffList.iterator();
     while (iter.hasNext()) {
       retBuff[idx++] = iter.next();
     }
     return (retBuff);
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
Esempio n. 29
0
  private static boolean path(Text t, List<Object> valueList) {
    final boolean result;

    final Path value = Path.parse(t);
    if (value == null) {
      result = false;
    } else {
      valueList.add(value);
      result = true;
    }

    return result;
  }
Esempio n. 30
0
  private static boolean cardinality(Text t, List<Object> valueList) {
    final boolean result;

    final Cardinality value = Cardinality.parse(t);
    if (value == null) {
      result = false;
    } else {
      valueList.add(value);
      result = true;
    }

    return result;
  }