Exemple #1
0
  @Override
  public final IFuzzyValue<Boolean> execute(
      final IContext p_context,
      final boolean p_parallel,
      final List<ITerm> p_argument,
      final List<ITerm> p_return,
      final List<ITerm> p_annotation) {
    final Key l_key = p_argument.get(0).raw();
    final EAlgorithm l_algorithm = EAlgorithm.from(l_key.getAlgorithm());

    p_argument
        .subList(1, p_argument.size())
        .stream()
        .map(i -> Base64.getDecoder().decode(i.<String>raw()))
        .map(
            i -> {
              try {
                return l_algorithm.getDecryptCipher(l_key).doFinal(i);
              } catch (final NoSuchPaddingException
                  | NoSuchAlgorithmException
                  | InvalidKeyException
                  | BadPaddingException
                  | IllegalBlockSizeException l_exception) {
                return null;
              }
            })
        .filter(Objects::nonNull)
        .map(i -> CRawTerm.from(SerializationUtils.deserialize(i)))
        .forEach(p_return::add);

    return CFuzzyValue.from(true);
  }
 @Override
 public final IFuzzyValue<Boolean> execute(
     final IContext p_context,
     final boolean p_parallel,
     final List<ITerm> p_argument,
     final List<ITerm> p_return,
     final List<ITerm> p_annotation) {
   CCommon.flatcollection(p_argument)
       .stream()
       .map(i -> CombinatoricsUtils.factorial(i.<Number>raw().intValue()))
       .map(CRawTerm::from)
       .forEach(p_return::add);
   return CFuzzyValue.from(true);
 }
Exemple #3
0
  @Override
  public final IFuzzyValue<Boolean> execute(
      final IContext p_context,
      final boolean p_parallel,
      final List<ITerm> p_argument,
      final List<ITerm> p_return,
      final List<ITerm> p_annotation) {
    final Map<ITerm, AbstractMap.Entry<Long, Long>> l_map = new HashMap<>();
    p_context
        .agent()
        .plans()
        .values()
        .forEach(
            i ->
                l_map.put(
                    i.getLeft().getTrigger().getLiteral(),
                    new AbstractMap.SimpleImmutableEntry<>(
                        i.getMiddle().get(), i.getRight().get())));

    p_return.add(CRawTerm.from(p_parallel ? Collections.synchronizedMap(l_map) : l_map));

    return CFuzzyValue.from(true);
  }