示例#1
0
 CompanyActionVO processDivident(String stockCode, PMDate date, String rawActionLine) {
   int st = rawActionLine.indexOf(DIV_STRING);
   if (st == -1) {
     return null;
   }
   String substring = rawActionLine.substring(st);
   NumberExtractor extractor = new NumberExtractor(substring);
   if (extractor.hasMoreElements()) {
     CompanyActionVO actionVO =
         new CompanyActionVO(
             COMPANY_ACTION_TYPE.Divident, date, stockCode, extractor.nextElement(), 1f);
     actionVO.setPercentageValue(extractor.isPercentage());
     st = extractor.getIndex();
     if (st < rawActionLine.length()) {
       int retVal = checkForAdditionalDivident(actionVO, substring.substring(st), SPL_STRING);
       if (retVal != -1) st = retVal;
       retVal = checkForAdditionalDivident(actionVO, substring.substring(st), INT_STRING);
       if (retVal != -1) st = retVal;
       st = getNextItem(substring, st); // check for items after /
       if (st != -1 && st < rawActionLine.length()) {
         checkForAdditionalDivident(actionVO, substring.substring(st), DIV_STRING);
       }
     }
     return actionVO;
   }
   return null;
 }
示例#2
0
  int checkForAdditionalDivident(
      CompanyActionVO actionVO, String rawActionLine, String otherDividentCode) {
    int st = rawActionLine.indexOf(otherDividentCode);
    if (st == -1) {
      return -1;
    }
    int en = rawActionLine.indexOf('/');
    if (en != -1 && en < st) {
      return -1;
    }

    NumberExtractor extractor = new NumberExtractor(rawActionLine.substring(st));
    if (extractor.hasMoreElements()) {
      actionVO.setDsbValue(actionVO.getDsbValue() + extractor.nextElement());
    }
    return extractor.getIndex();
  }