Beispiel #1
0
  @Override
  protected void getCandidates(ChunkTypeRequest request, Set<IIdentifier> results) {
    boolean firstInsertion = true;
    FastSet<IIdentifier> tmp = FastSet.newInstance();

    for (IConditionalSlot slot : request.getConditionalSlots())
      if (slot.getName().equals(IAuralModule.KIND_SLOT)) {
        tmp.clear();
        String kind = transformKind(slot.getValue());
        switch (slot.getCondition()) {
          case IConditionalSlot.NOT_EQUALS:
            not(kind, tmp);
            break;
          default:
            equals(kind, tmp);
            break;
        }

        if (firstInsertion) {
          results.addAll(tmp);
          firstInsertion = false;
        } else results.retainAll(tmp);
      }

    FastSet.recycle(tmp);
  }
Beispiel #2
0
  protected boolean kindMatchesPattern(ChunkTypeRequest pattern, Object kind) {
    for (IConditionalSlot slot : pattern.getConditionalSlots())
      if (slot.getName().equalsIgnoreCase(IAuralModule.KIND_SLOT))
        if (!slot.matchesCondition(kind)) return false;

    return true;
  }
  protected String getText(IRequest request) {
    for (IConditionalSlot cSlot : ((ChunkTypeRequest) request).getConditionalSlots())
      if (cSlot.getName().equals(IVocalModule.STRING_SLOT)
          && cSlot.getCondition() == IConditionalSlot.EQUALS
          && cSlot.getValue() instanceof String) {
        return (String) cSlot.getValue();
      }

    return "";
  }