Package lupos.autocomplete.misc

Examples of lupos.autocomplete.misc.Item


    while ((token = p.getNextToken(content)) != null) {
      final String[] splittedTokenLine = token.toString().split(" ");
      if ((splittedTokenLine[2].equals("QUALIFIEDURI") || splittedTokenLine[2]
          .equals("VARIABLE") || splittedTokenLine[2].equals("PREFIXLABEL")|| splittedTokenLine[2].equals("URI"))
          && !(tokensList.contains(splittedTokenLine[9]))) {
        tokensList.add(new Item(splittedTokenLine[9], true));
      }
    }
    return tokensList;
  }
View Full Code Here


    final int indexBeforeCurrentWord = textDocument.substring(0, cursorPosition - currentWord.length()).length();
    final List<Item> tokensList = this.tokensToList(this.readerLocal, this.parserLocal, indexBeforeCurrentWord);

    for (int i = 0; i < tokensList.size(); i++) {
      final Item tl_element_i = tokensList.get(i);
      /*
       * Falls currenWord leer ist bzw aus einem Leerzeichen besteht
       * werden alle Elemente von tokensList hinzugefuegt
       */
      if (currentWord.equals("") || currentWord.equals(" ")) {
        returnList.add(tl_element_i);
        /*
         * die Laenge von currentWord muss <= aller Laengen der Elemente
         * von tokensList sein
         */
      } else if ((cwLength) <= tl_element_i.getValue().length()) {
        /*
         * Vergleicht i-tes Element von tokensList mit currentWord, auch
         * komplett gross bzw klein geschrieben
         */
        if (currentWord.substring(0, cwLength).equals(
            tl_element_i.getValue().substring(0, cwLength))) {
          returnList.add(tl_element_i);
        }
      }
    }
    for (int i = 0; i < this.reservedWords.size(); i++) {
      final Item rw_element_i = new Item(this.reservedWords.get(i).toString(), false);
      /*
       * Falls currenWord leer ist bzw aus einem Leerzeichen besteht
       * werden alle reservedWords hinzugefuegt
       */
      if (currentWord.equals("") || currentWord.equals(" ")) {
        returnList.add(rw_element_i);
        /*
         * die Laenge von currentWord muss <= aller Laengen der
         * reservedWords sein
         */
      } else if ((cwLength) <= rw_element_i.getValue().length()) {
        /*
         * Vergleicht i-tes reservedWord mit currentWord, auch komplett
         * gross bzw klein geschrieben
         */
        if (currentWord.substring(0, cwLength).equalsIgnoreCase(
            rw_element_i.getValue().substring(0, cwLength))) {
          returnList.add(rw_element_i);
        }
      }
    }

View Full Code Here

            possibilitiesList.addAll(this.findExistingElements(
                hashmapKey, testWord, indexBeforeCurrentWord,
                this.readerLocal, this.parserLocal));
          //ansonsten nur testWord
          } else {
            possibilitiesList.add(new Item(testWord, caseSensitiv));
          }
        //TestException = PE
        } else if (testException.substring(0, 2).equals("PE")) {
          if (this.parseErrorWordPE(testException).equals("<EOF>")) {
            //Analog
            if (hashmapKey != null) {
              possibilitiesList.addAll(this.findExistingElements(
                  hashmapKey, testWord,
                  indexBeforeCurrentWord, this.readerLocal,
                  this.parserLocal));

            } else {
              possibilitiesList.add(new Item(testWord,
                  caseSensitiv));
            }
          }
        }
View Full Code Here

            possibilitiesList.addAll(this.findExistingElements(
                hashmapKey, testWord, indexBeforeCurrentWord,
                this.readerLocal, this.parserLocal));
          //ansonsten nur testWord
          } else {
            possibilitiesList.add(new Item(testWord, caseSensitiv));
          }
        //TestException = PE
        } else if (testException.substring(0, 2).equals("PE")) {
          mainError = this.parseErrorWordPE(exception);
          subError = this.parseErrorWordPE(testException);
          if (subError.equals("<EOF>")) {
            //Analog
            if (hashmapKey != null) {
              possibilitiesList.addAll(this.findExistingElements(
                  hashmapKey, testWord,
                  indexBeforeCurrentWord, this.readerLocal,
                  this.parserLocal));

            } else {
              possibilitiesList.add(new Item(testWord,
                  caseSensitiv));
            }
          }
        }
      }
View Full Code Here

            possibilitiesList.addAll(this.findExistingElements(
                hashmapKey, testWord, indexBeforeCurrentWord,
                this.readerLocal, this.parserLocal));
          //ansonsten nur testWord
          } else {
            possibilitiesList.add(new Item(testWord, caseSensitiv));
          }
        //TestException = PE
        } else if (testException.substring(0, 2).equals("PE")) {
          mainError = this.parseErrorWordLE(exception);
          subError = this.parseErrorWordPE(testException);
          if (mainError.equals(subError) || subError.equals("<EOF>")) {
            //Analog
            if (hashmapKey != null) {
              possibilitiesList.addAll(this.findExistingElements(
                  hashmapKey, testWord,
                  indexBeforeCurrentWord, this.readerLocal,
                  this.parserLocal));

            } else {
              possibilitiesList.add(new Item(testWord,
                  caseSensitiv));
            }
          }
        }
      }
View Full Code Here

  public List<Item> findExistingElements(final String hashmapKey,
      final String hashmapValue, final int indexBeforeCurrentWord,
      final LuposDocumentReader r, final ILuposParser p) {
    final ArrayList<Item> arrayList = new ArrayList<Item>();
    if (hashmapKey.equals("<ANON>") || hashmapKey.equals("<NIL>")) {
      arrayList.add(new Item(hashmapValue, true));
      return arrayList;
    }
    String description;
    if (hashmapKey.equals("<IRI_REF>")) {
      description = "URI";
    } else if (hashmapKey.equals("<PNAME_LN>")) {
      description = "QUALIFIEDURI";
    } else if (hashmapKey.startsWith("<STRING_LITERAL")) {
      description = "LITERAL";
    } else if (hashmapKey.equals("<BLANKNODELABEL>")) {
      description = "BLANKNODE";
    } else if (hashmapKey.equals("<VAR>")) {
      description = "VARIABLE";
    } else if (hashmapKey.equals("<INTEGER>")) {
      description = "INTEGER";
    } else if (hashmapKey.equals("<DECIMAL>")
        || hashmapKey.equals("<DOUBLE>")) {
      description = "DECIMAL";
    } else {
      description = null;
    }
    if (description != null) {
      final String content = r.getText().substring(0,
          indexBeforeCurrentWord);
      p.setReaderTokenFriendly(r, 0, content.length());
      ILuposToken token;
      String[] splittedToken;
      while ((token = p.getNextToken(content)) != null) {
        splittedToken = token.toString().split(" ");
        if (splittedToken[2].equals(description)
            && !(arrayList.contains(splittedToken[9]))) {
          arrayList.add(new Item(splittedToken[9], true));

        }
      }

    }
View Full Code Here

                hashmapKey, testWord, indexBeforeCurrentWord,
                this.readerLocal, this.parserLocal));

          //ansonsten nur testWord
          } else {
            possibilitiesList.add(new Item(testWord, caseSensitiv));
          }
          //TestException = PE
        } else if (testException.substring(0, 2).equals("PE")) {
          if (this.parseErrorWordPE(testException).equals("<EOF>")) {
            //Analog
            if (hashmapKey != null) {
              possibilitiesList.addAll(this.findExistingElements(
                  hashmapKey, testWord,
                  indexBeforeCurrentWord, this.readerLocal,
                  this.parserLocal));

            } else {
              possibilitiesList.add(new Item(testWord,
                  caseSensitiv));
            }
          }
        }
View Full Code Here

  public List<Item> findExistingElements(final String hashmapKey,
      final String hashmapValue, final int indexBeforeCurrentWord,
      final LuposDocumentReader r, final ILuposParser p) {
    final ArrayList<Item> arrayList = new ArrayList<Item>();
    if (hashmapKey.equals("<ANON>") || hashmapKey.equals("<NIL>")) {
      arrayList.add(new Item(hashmapValue, true));
      return arrayList;
    }
    String description;
    if (hashmapKey.equals("<IRI_REF>")) {
      description = "URI";
    } else if (hashmapKey.equals("<PNAME_LN>")) {
      description = "QUALIFIEDURI";
    } else if (hashmapKey.startsWith("<STRING_LITERAL")) {
      description = "LITERAL";
    } else if (hashmapKey.equals("<BLANKNODELABEL>")) {
      description = "BLANKNODE";
    } else if (hashmapKey.equals("<VAR>")) {
      description = "VARIABLE";
    } else if (hashmapKey.equals("<INTEGER>")) {
      description = "INTEGER";
    } else if (hashmapKey.equals("<DECIMAL>")
        || hashmapKey.equals("<DOUBLE>")) {
      description = "DECIMAL";
    } else {
      description = null;
    }
    if (description != null) {
      final String content = r.getText().substring(0,
          indexBeforeCurrentWord);
      p.setReaderTokenFriendly(r, 0, content.length());
      ILuposToken token;
      String[] splittedToken;
      String tokenElement;
      int pos;
      while ((token = p.getNextToken(content)) != null) {
        splittedToken = token.toString().split(" ");
        if (!splittedToken[2].equals("ERROR")) {
          if (!splittedToken[9].startsWith("\"")) {
            tokenElement = splittedToken[9].toLowerCase();
          } else {
            pos = token.toString().indexOf("\"");
            tokenElement = token
                .toString()
                .substring(pos,
                    token.toString().length())
                .toLowerCase();
          }
          if (splittedToken[2].equals(description)
              && !(arrayList.contains(tokenElement))) {
            arrayList.add(new Item(tokenElement, true));
          }
        }

      }
View Full Code Here

            possibilitiesList.addAll(this.findExistingElements(
                hashmapKey, testWord, indexBeforeCurrentWord,
                this.readerLocal, this.parserLocal));
          //ansonsten nur testWord
          } else {
            possibilitiesList.add(new Item(testWord, caseSensitiv));
          }
        } else if (testException.substring(0, 2).equals("PE")) {
          if (hashmapKey != null) {
            possibilitiesList.addAll(this.findExistingElements(
                hashmapKey, testWord, indexBeforeCurrentWord,
                this.readerLocal, this.parserLocal));

          } else {
            possibilitiesList.add(new Item(testWord, caseSensitiv));
          }
        //TestException = PE
        } else if (testException.substring(0, 2).equals("PE")) {
          mainError = this.parseErrorWordPE(exception);
          subError = this.parseErrorWordPE(testException);
          if (mainError.equals(subError) || subError.equals("<EOF>")) {
            //Analog
            if (hashmapKey != null) {
              possibilitiesList.addAll(this.findExistingElements(
                  hashmapKey, testWord,
                  indexBeforeCurrentWord, this.readerLocal,
                  this.parserLocal));
              possibilitiesList.remove(currentWord);

            } else {
              possibilitiesList.add(new Item(testWord,
                  caseSensitiv));
            }
          }
        }
      }
View Full Code Here

            possibilitiesList.addAll(this.findExistingElements(
                hashmapKey, testWord, indexBeforeCurrentWord,
                this.readerLocal, this.parserLocal));
          //ansonsten nur testWord
          } else {
            possibilitiesList.add(new Item(testWord, caseSensitiv));
          }
        //TestException = PE
        } else if (testException.substring(0, 2).equals("PE")) {
          mainError = this.parseErrorWordLE(exception);
          subError = this.parseErrorWordPE(testException);
          if (mainError.equals(subError) || subError.equals("<EOF>")) {
            //Analog
            if (hashmapKey != null) {
              possibilitiesList.addAll(this.findExistingElements(
                  hashmapKey, testWord,
                  indexBeforeCurrentWord, this.readerLocal,
                  this.parserLocal));
              possibilitiesList.remove(currentWord);

            } else {
              possibilitiesList.add(new Item(testWord,
                  caseSensitiv));
            }
          }
        }
      }
View Full Code Here

TOP

Related Classes of lupos.autocomplete.misc.Item

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.