示例#1
0
文件: Otv.java 项目: mey11/Orange
 public boolean isValidExchange(SerialNumber serialNumber, Exchange request) {
   // create upper bound for calculation of average
   SerialNumber validityCheckBound =
       new SerialNumber(serialNumber.getSerialNumber().add(ADD_FOR_BOUND));
   // find the set of serial #'s strictly greater than serialNumber and <= validityCheckBound
   NavigableSet<SerialNumber> temp =
       getExclusiveToInclusiveSubset(
           request.getCompatibleProducts(), serialNumber, validityCheckBound);
   // find the st of serial #'s strictly greater than serialNumber and less than average
   // if empty, no compatible product exists
   return !(getExclusiveSubset(request, serialNumber, average(temp)).isEmpty());
 }
  /**
   * Description of the Method
   *
   * @param ctx Description of the Parameter
   * @param conn Description of the Parameter
   * @param instance Description of the Parameter
   * @param msgs Description of the Parameter
   * @param manager Description of the Parameter
   * @param assistor Description of the Parameter
   * @return Description of the Return Value
   */
  public int preInsert(
      SessionContext ctx,
      DatabaseConnection conn,
      FormInstance instance,
      ErrorMessages msgs,
      EventManager manager,
      SqlAssistor assistor) {
    int seqNo = (int) SerialNumber.getNextSN("BMLOANADMCHANGE", "SEQNO");
    // System.out.println("Seqno:"+seqNo);

    instance.setValue("SEQNO", seqNo);
    assistor.setSqlFieldValue(assistor.getDefaultTbl(), "SEQNO", seqNo + "");
    MyDB.getInstance().addDBConn(conn);
    return InactLoanMan.loanAdmByChange(this.bmno, ctx.getParameter("NEWADM"));
  }
示例#3
0
文件: Otv.java 项目: mey11/Orange
 // returns validity of given serial number
 public static Boolean isValidSerialNumber(SerialNumber serialNumber) {
   // check whether even and the third bit is set
   return serialNumber.isOdd() && checkLowerBound(serialNumber);
 }