Package beans.directory.mkb10

Examples of beans.directory.mkb10.MKBParser


        closeDBF(dbf);

    }

    private DirectoryMKB10Item getParent(String code) throws ParseException, ClipsException{
        MKBCode         decoded = MKBParser.decodeWellFormed(code);
        return dirScanRecursive(null, dirMKB.getItems(), decoded);
    }
View Full Code Here


    for (int i = 0; i < size; i++){
      DirectoryMKB10Item    item = selector.get(i);
      if (item.getID() == 0){
        continue;
      }
      MKBCode          itemCode = item.getDecodedCode();
      CompareResould      res = itemCode.advanceCompare(code);
            switch (res){
                case contains:
                    return dirScanRecursive(item, item.getItems(), code);
            }
        }
View Full Code Here

    for (int i = 0; i < size; i++){
      DirectoryMKB10Item    item = selector.get(i);
      if (item.getID() == 0){
        continue;
      }
      MKBCode          itemCode = item.getDecodedCode();
      CompareResould      res = code.advanceCompare(itemCode);
      switch (res){
        case less:
          break;
        case more:
View Full Code Here

        }
    }

    static void validateList(Selector<DirectoryMKB10Item> items, MKBCode parent) throws ParseException, ClipsException{
        int      size = items.size();
        MKBCode      last = null;
        for (int i = 0; i < size; i++){
            DirectoryMKB10Item  item = items.get(i);
            if (item.getID() == 0){
                continue;
            }
            MKBCode    mKBCode = item.getDecodedCode();
            if (parent != null
                    && (parent.advanceCompare(mKBCode) != MKBCode.CompareResould.contains
                    || mKBCode.advanceCompare(parent) != MKBCode.CompareResould.inside)){
                throw new ClipsException("Код " + parent + " не содержит в себе код " + mKBCode);
            }
            if (last != null
                    && (last.advanceCompare(mKBCode) != MKBCode.CompareResould.less
                    || mKBCode.advanceCompare(last) != MKBCode.CompareResould.more)){
                throw new ClipsException("Код " + mKBCode + " пересекается с кодом " + last + ", или неправильно расположен");
            }
        }
    }
View Full Code Here

            }
    }
  }

  public DirectoryMKB10Item getItemByCode(String code) throws ClipsException, ParseException {
    MKBCode        parsed;
    try{
      parsed = MKBParser.decodeWellFormed(code);
    }
    catch (ParseException ex){
      System.out.println("Incorect code \"" + code + "\", try to use advanced parse method");
View Full Code Here

      DirectoryMKB10Item    item = selector.get(i);
      if (item.getID() == 0){
        continue;
      }
      MKBCode          itemCode = item.getDecodedCode();
      CompareResould      res = itemCode.advanceCompare(code);
            switch (res){
                case contains:
                    return dirScanRecursive(item, item.getItems(), code);
            }
        }
View Full Code Here

      DirectoryMKB10Item    item = selector.get(i);
      if (item.getID() == 0){
        continue;
      }
      MKBCode          itemCode = item.getDecodedCode();
      CompareResould      res = code.advanceCompare(itemCode);
      switch (res){
        case less:
          break;
        case more:
          break;
View Full Code Here

    }
    if (curLine.getAlternativeMkbCode() == null || curLine.getAlternativeMkbCode().trim().isEmpty()){
      curLine.setItems(new int[0]);
      return;
    }
    MKBParser      parser = new MKBParser(MKBParser.ParseLevel.soft);
    try {
      ArrayList<MKBCode>        codes = parser.parse(curLine.getAlternativeMkbCode());
      DirectoryMKB10          mkbDir = DirectoryLocator.getDirectory(DirectoryMKB10.class);
      MKbSelector            selector = new MKbSelector(mkbDir, MKbSelector.SelectType.single);
      ArrayList<DirectoryMKB10Item>  mkbItems = selector.getSelectedItem(codes);
      int[]              ids = new int[mkbItems.size()];
      for (int i = 0; i < ids.length; i++) {
View Full Code Here

      parsed = MKBParser.decodeWellFormed(code);
    }
    catch (ParseException ex){
      System.out.println("Incorect code \"" + code + "\", try to use advanced parse method");
      if (parser == null){
        parser = new MKBParser(MKBParser.ParseLevel.hard);
      }
      ArrayList<MKBCode>      codes = parser.parse(code);
      if (codes.size() != 1){
        throw new ParseException("Строка \"" + code + "\" содержит более одного кода мкб", 0);
      }
View Full Code Here

        if (!mkbCode.matches("[A-Z_0-9_\\._\\-\\*]+")) {
            throwFormatError("mkbCode!  " + " ---> " + line);
        }
        String mkbStr = line.substring(mkbPos + 1, line.length()).trim();
        //System.out.println(mkbCode + (char)9 + mkbStr);
        return new MkbItem(mkbStr, mkbCode, null, null);
  }
View Full Code Here

TOP

Related Classes of beans.directory.mkb10.MKBParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.