示例#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);
  }
示例#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;
  }