Пример #1
0
  @Override
  public Message toInternalMessage(Sms sms)
      throws IllegalArgumentException, UnknownProtocolException, UnknownStatusException,
          UnknownTypeException {
    Message message = new Message(-1); // set id later

    // determine type of message
    Type type = Type.toType(Objects.requireNonNull(sms.getType()));

    // internationalize contact / address
    Contact c = getNormalizedContact(sms.getContactName(), sms.getAddress());

    message.setContact(c);
    message.setType(type);
    message.setBody(sms.getBody());
    message.setDate(getDateOrNull(sms.getDate()));

    // if message type is not SENT, do not set the date sent!
    // this would result in duplicate messages on the phone later.
    message.setDateSent((type != Type.Sent) ? null : getDateOrNull(sms.getDateSent()));

    message.setProtocol(Protocol.toProtocol(Objects.requireNonNull(sms.getProtocol())));
    message.setRead(Integer.valueOf(sms.getRead()));
    message.setServiceCenter(sms.getServiceCenter());
    message.setStatus(Status.toStatus(Objects.requireNonNull(sms.getStatus())));
    message.setSubject(sms.getSubject());

    // keep original values
    message.setOriginalAddress(sms.getAddress());
    message.setOriginalContactName(sms.getContactName());

    return message;
  }
Пример #2
0
 /**
  * Executes a code block as a Future on an ExecutorService.
  *
  * @param executorService the ExecutorService to use. Will use the default ExecutorService if
  *     null.
  * @param callable a code block to be executed
  * @return a Future that contains the result of the execution
  */
 @Nonnull
 public <R> Future<R> runFuture(
     @Nonnull ExecutorService executorService, @Nonnull Callable<R> callable) {
   requireNonNull(executorService, "Argument 'executorService' must not be null");
   requireNonNull(callable, ERROR_CALLABLE_NULL);
   return executorService.submit(callable);
 }
 /**
  * Returns a composed {@link FloatBinaryOperator} that first applies the {@code before} predicates
  * to its input, and then applies this function to the result. If evaluation of either operation
  * throws an exception, it is relayed to the caller of the composed operation. This method is just
  * convenience, to provide the ability to execute an operation which accepts {@code float} input,
  * before this primitive function is executed.
  *
  * @param before1 The first predicate to apply before this function is applied
  * @param before2 The second predicate to apply before this function is applied
  * @return A composed {@code FloatBinaryOperator} that first applies the {@code before} predicates
  *     to its input, and then applies this function to the result.
  * @throws NullPointerException If given argument is {@code null}
  * @implSpec The input argument of this method is a able to handle primitive values. In this case
  *     this is {@code float}.
  */
 @Nonnull
 default FloatBinaryOperator composeFromFloat(
     @Nonnull final FloatPredicate before1, @Nonnull final FloatPredicate before2) {
   Objects.requireNonNull(before1);
   Objects.requireNonNull(before2);
   return (value1, value2) -> applyAsFloat(before1.test(value1), before2.test(value2));
 }
 @Override
 public DoubleArray estimate(DataFrame x, Vector y) {
   Objects.requireNonNull(x, "Input data required.");
   Objects.requireNonNull(y, "Input target required.");
   Check.argument(x.rows() == y.size(), "The size of input data and input target don't match.");
   return errorFunction.apply(classifier.estimate(x), y, classifier.getClasses());
 }
Пример #5
0
 @Override
 public V putIfAbsent(K key, V value) {
   AHTMapEntry<K, V> e =
       new AHTMapEntry<>(Objects.requireNonNull(key), Objects.requireNonNull(value));
   AHTMapEntry<K, V> r = put(e, (k, v) -> v == null ? e : v).reference;
   return r == null ? null : r.value;
 }
  /**
   * Execute a collection of modules.
   *
   * @param modules modules to execute.
   * @param executable execution logic to be performed for each module.
   * @return list of the outputs from the executable.
   */
  public List<V> executeModules(List<ScriptModule> modules, ScriptModuleExecutable<V> executable) {
    Objects.requireNonNull(modules, "modules");
    Objects.requireNonNull(executable, "executable");

    List<Future<V>> futureResults = new ArrayList<Future<V>>(modules.size());
    for (ScriptModule module : modules) {
      Future<V> future =
          new ScriptModuleExecutionCommand<V>(executorId, executable, module).queue();
      futureResults.add(future);

      ExecutionStatistics moduleStats = getOrCreateModuleStatistics(module.getModuleId());
      moduleStats.executionCount.incrementAndGet();
      moduleStats.lastExecutionTime.set(System.currentTimeMillis());
    }

    List<V> results = new ArrayList<V>(modules.size());
    for (int i = 0; i < futureResults.size(); i++) {
      Future<V> futureResult = futureResults.get(i);
      try {
        V result = futureResult.get();
        results.add(result);
      } catch (Exception e) {
        // the exception is already logged by the hystrix command, so just add some additional
        // context
        ScriptModule failedModule = modules.get(i);
        logger.error(
            "moduleId {} with creationTime: {} failed execution. see hystrix command log for deatils.",
            failedModule.getModuleId(),
            failedModule.getCreateTime());
        continue;
      }
    }
    return results;
  }
Пример #7
0
 private static Map<String, Method> addMethods(
     Map<String, Method> methods, Class<?> clazz, Predicate<Method> filter) {
   requireNonNull(methods);
   requireNonNull(filter);
   // clazz nullable (why?)
   if (clazz == Object.class) {
     return methods;
   }
   if (clazz == null) {
     return methods;
   }
   Stream.of(clazz.getDeclaredMethods())
       .filter(filter)
       .forEach(
           m -> {
             methods.putIfAbsent(m.getName(), m); // Put only the most recent
             // concrete version of the
             // method
           });
   addMethods(methods, clazz.getSuperclass(), filter); // Recursively add
   // the superclass
   // methods
   Stream.of(clazz.getInterfaces())
       .forEach(
           i -> {
             addMethods(methods, i, filter); // Recursively add the extended
             // interfaces (because they can
             // contain default methods)
           });
   return methods;
 }
  @Override
  public Session selectProfile(final String clientToken, String accessToken, UUID profile)
      throws AuthenticationException {
    Objects.requireNonNull(clientToken);
    Objects.requireNonNull(accessToken);

    final Map<String, Object> request = new HashMap<>();
    request.put("clientToken", clientToken);
    request.put("accessToken", accessToken);
    request.put("requestUser", true);

    if (profile != null) {
      JSONObject selectedProfile = new JSONObject();
      selectedProfile.put("id", UUIDUtils.unsign(profile));
      request.put("selectedProfile", selectedProfile);
    }

    return invokeOperation(
        new Callable<Session>() {

          @Override
          public Session call() throws Exception {
            return handleAuthResponse(
                requester.requestWithPayload(
                    "POST", api.refresh(), new JSONObject(request), CONTENT_TYPE_JSON),
                clientToken);
          }
        });
  }
  @Override
  public void resume(final IJobUpdateKey key, final AuditData auditData)
      throws UpdateStateException {

    requireNonNull(key);
    requireNonNull(auditData);
    LOG.info("Attempting to resume update " + key);
    storage.write(
        (NoResult<UpdateStateException>)
            storeProvider -> {
              IJobUpdateDetails details =
                  Iterables.getOnlyElement(
                      storeProvider.getJobUpdateStore().fetchJobUpdateDetails(queryByUpdate(key)),
                      null);

              if (details == null) {
                throw new UpdateStateException("Update does not exist: " + key);
              }

              IJobUpdate update = details.getUpdate();
              IJobUpdateKey key1 = update.getSummary().getKey();
              Function<JobUpdateStatus, JobUpdateStatus> stateChange =
                  isCoordinatedAndPulseExpired(key1, update.getInstructions())
                      ? GET_BLOCKED_RESUME_STATE
                      : GET_ACTIVE_RESUME_STATE;

              JobUpdateStatus newStatus =
                  stateChange.apply(update.getSummary().getState().getStatus());
              changeUpdateStatus(
                  storeProvider, update.getSummary(), addAuditData(newEvent(newStatus), auditData));
            });
  }
Пример #10
0
  /**
   * Look-up the value through the cache. This always evaluates the {@code subKeyFactory} function
   * and optionally evaluates {@code valueFactory} function if there is no entry in the cache for
   * given pair of (key, subKey) or the entry has already been cleared.
   *
   * @param key possibly null key
   * @param parameter parameter used together with key to create sub-key and value (should not be
   *     null)
   * @return the cached value (never null)
   * @throws NullPointerException if {@code parameter} passed in or {@code sub-key} calculated by
   *     {@code subKeyFactory} or {@code value} calculated by {@code valueFactory} is null.
   */
  public V get(K key, P parameter) {
    Objects.requireNonNull(parameter);

    expungeStaleEntries();

    Object cacheKey = CacheKey.valueOf(key, refQueue);

    // lazily install the 2nd level valuesMap for the particular cacheKey
    ConcurrentMap<Object, Supplier<V>> valuesMap = map.get(cacheKey);
    if (valuesMap == null) {
      ConcurrentMap<Object, Supplier<V>> oldValuesMap =
          map.putIfAbsent(cacheKey, valuesMap = new ConcurrentHashMap<>());
      if (oldValuesMap != null) {
        valuesMap = oldValuesMap;
      }
    }

    // create subKey and retrieve the possible Supplier<V> stored by that
    // subKey from valuesMap
    Object subKey = Objects.requireNonNull(subKeyFactory.apply(key, parameter));
    Supplier<V> supplier = valuesMap.get(subKey);
    Factory factory = null;

    while (true) {
      if (supplier != null) {
        // supplier might be a Factory or a CacheValue<V> instance
        V value = supplier.get();
        if (value != null) {
          return value;
        }
      }
      // else no supplier in cache
      // or a supplier that returned null (could be a cleared CacheValue
      // or a Factory that wasn't successful in installing the CacheValue)

      // lazily construct a Factory
      if (factory == null) {
        factory = new Factory(key, parameter, subKey, valuesMap);
      }

      if (supplier == null) {
        supplier = valuesMap.putIfAbsent(subKey, factory);
        if (supplier == null) {
          // successfully installed Factory
          supplier = factory;
        }
        // else retry with winning supplier
      } else {
        if (valuesMap.replace(subKey, supplier, factory)) {
          // successfully replaced
          // cleared CacheEntry / unsuccessful Factory
          // with our Factory
          supplier = factory;
        } else {
          // retry with current supplier
          supplier = valuesMap.get(subKey);
        }
      }
    }
  }
  @Override
  public Session login(String username, String password, final String clientToken)
      throws AuthenticationException {
    Objects.requireNonNull(username);
    Objects.requireNonNull(password);
    Objects.requireNonNull(clientToken);

    final Map<String, Object> request = new HashMap<>();
    request.put("agent", agent);
    request.put("username", username);
    request.put("password", password);
    request.put("clientToken", clientToken);
    request.put("requestUser", true);

    return invokeOperation(
        new Callable<Session>() {

          @Override
          public Session call() throws Exception {
            return handleAuthResponse(
                requester.requestWithPayload(
                    "POST", api.authenticate(), new JSONObject(request), CONTENT_TYPE_JSON),
                clientToken);
          }
        });
  }
 private BinaryOp(
     final Op2 operator, final AnnotatedTree<?> branch1, final AnnotatedTree<?> branch2) {
   super(branch1, branch2);
   Objects.requireNonNull(branch1);
   Objects.requireNonNull(branch2);
   op = operator;
 }
Пример #13
0
  @Override
  public synchronized void addSplits(PlanNodeId sourceId, Iterable<Split> splits) {
    try (SetThreadName ignored = new SetThreadName("HttpRemoteTask-%s", taskId)) {
      requireNonNull(sourceId, "sourceId is null");
      requireNonNull(splits, "splits is null");
      checkState(
          !noMoreSplits.contains(sourceId), "noMoreSplits has already been set for %s", sourceId);

      // only add pending split if not done
      if (!getTaskInfo().getState().isDone()) {
        int added = 0;
        for (Split split : splits) {
          if (pendingSplits.put(
              sourceId, new ScheduledSplit(nextSplitId.getAndIncrement(), split))) {
            added++;
          }
        }
        if (sourceId.equals(planFragment.getPartitionedSource())) {
          pendingSourceSplitCount += added;
          fireSplitCountChanged(added);
        }
        needsUpdate.set(true);
      }

      scheduleUpdate();
    }
  }
Пример #14
0
  public ServiceRefPodAppRoot(ServicesAmp manager, PodContainer podContainer) {
    Objects.requireNonNull(manager);
    Objects.requireNonNull(podContainer);

    _rampManager = manager;
    _podContainer = podContainer;
  }
Пример #15
0
 /**
  * Maps this elements to a {@code Monoid} and applies {@code foldLeft}, starting with {@code
  * monoid.zero()}:
  *
  * <pre><code>
  *  foldLeft(monoid.zero(), (ys, x) -&gt; monoid.combine(ys, mapper.apply(x)));
  * </code></pre>
  *
  * @param monoid A Monoid
  * @param foldable A foldable
  * @param mapper A mapper
  * @param <T> type of the foldable elements
  * @param <U> Component type of the given monoid.
  * @return the folded monoid value.
  * @throws NullPointerException if {@code monoid} or {@code mapper} is null
  */
 static <T, U> U foldMap(
     Monoid<U> monoid, Foldable<T> foldable, Function<? super T, ? extends U> mapper) {
   Objects.requireNonNull(monoid, "monoid is null");
   Objects.requireNonNull(foldable, "foldable is null");
   Objects.requireNonNull(mapper, "mapper is null");
   return foldable.foldLeft(monoid.zero(), (ys, x) -> monoid.combine(ys, mapper.apply(x)));
 }
  /**
   * @param address self server address
   * @param portPublic self server port
   * @param cluster self server port
   * @param displayName self server display name
   * @param machinePort index used to calculate the machine hash
   */
  public BartenderBuilderHeartbeat(
      Config config,
      String address,
      int portPublic,
      boolean isSSL,
      int portBartender,
      String cluster,
      String displayName,
      int machinePort,
      ServerHeartbeatBuilder selfBuilder) {
    Objects.requireNonNull(config);
    Objects.requireNonNull(address);
    Objects.requireNonNull(cluster);

    _config = config;

    String machineHash = createUniqueServerHash(machinePort);

    _root =
        new RootHeartbeat(
            address,
            portPublic,
            isSSL,
            portBartender,
            cluster,
            displayName,
            machineHash,
            selfBuilder);
  }
 @Nonnull
 @Override
 public String formatResource(@Nonnull String resource, @Nonnull List<?> args) {
   requireNonNull(resource, ERROR_RESOURCE_NULL);
   requireNonNull(args, ERROR_ARGS_NULL);
   return formatResource(resource, args.toArray(new Object[args.size()]));
 }
Пример #18
0
 /**
  * Sole constructor.
  *
  * @lucene.experimental
  */
 public FieldInfo(
     String name,
     int number,
     boolean storeTermVector,
     boolean omitNorms,
     boolean storePayloads,
     IndexOptions indexOptions,
     DocValuesType docValues,
     long dvGen,
     Map<String, String> attributes,
     int pointDimensionCount,
     int pointNumBytes) {
   this.name = Objects.requireNonNull(name);
   this.number = number;
   this.docValuesType =
       Objects.requireNonNull(docValues, "DocValuesType cannot be null (field: \"" + name + "\")");
   this.indexOptions =
       Objects.requireNonNull(
           indexOptions, "IndexOptions cannot be null (field: \"" + name + "\")");
   if (indexOptions != IndexOptions.NONE) {
     this.storeTermVector = storeTermVector;
     this.storePayloads = storePayloads;
     this.omitNorms = omitNorms;
   } else { // for non-indexed fields, leave defaults
     this.storeTermVector = false;
     this.storePayloads = false;
     this.omitNorms = false;
   }
   this.dvGen = dvGen;
   this.attributes = Objects.requireNonNull(attributes);
   this.pointDimensionCount = pointDimensionCount;
   this.pointNumBytes = pointNumBytes;
   assert checkConsistency();
 }
Пример #19
0
 private static boolean isExternalAndSecret(final Method method, final Class<?> clazz) {
   requireNonNull(method);
   requireNonNull(clazz);
   return Optional.ofNullable(getExternalFor(method, clazz))
       .filter(External::isSecret)
       .isPresent();
 }
Пример #20
0
 public TimeoutBackupStore(BackupStore store, String connectorId, Duration timeout) {
   requireNonNull(store, "store is null");
   requireNonNull(connectorId, "connectorId is null");
   requireNonNull(timeout, "timeout is null");
   this.executor = newCachedThreadPool(daemonThreadsNamed("backup-proxy-" + connectorId + "-%s"));
   this.store = timeLimited(store, BackupStore.class, timeout, executor);
 }
Пример #21
0
  public static External getExternalFor(final Method method, final Class<?> clazz) {
    requireNonNull(method);
    requireNonNull(clazz);
    if (method == null || clazz == null) {
      return null;
    }

    final External e = method.getAnnotation(External.class);
    if (e != null) {
      return e;
    }
    // Also try the superClass and all the interfaces it implements
    final List<Class<?>> classCandidates = new ArrayList<>(Arrays.asList(clazz.getInterfaces()));
    final Class<?> superClass = clazz.getSuperclass();

    if (superClass != null) {
      classCandidates.add(superClass);
    }

    for (final Class<?> classCandidate : classCandidates) {
      try {
        return getExternalFor(
            classCandidate.getMethod(method.getName(), method.getParameterTypes()), classCandidate);
      } catch (NoSuchMethodException | SecurityException ex) {
      }
    }

    return null;
  }
Пример #22
0
  public <T> T decodeProperty(String name, @Nullable String value, Class<T> type) {
    requireNonNull(name, "name is null");
    requireNonNull(type, "type is null");

    SessionProperty<?> sessionProperty = allSessionProperties.get(name);
    if (sessionProperty == null) {
      throw new PrestoException(INVALID_SESSION_PROPERTY, "Unknown session property " + name);
    }
    PropertyMetadata<?> metadata = sessionProperty.getMetadata();
    if (metadata.getJavaType() != type) {
      throw new PrestoException(
          INVALID_SESSION_PROPERTY,
          format(
              "Property %s is type %s, but requested type was %s",
              name, metadata.getJavaType().getName(), type.getName()));
    }
    if (value == null) {
      return type.cast(metadata.getDefaultValue());
    }
    Object objectValue = deserializeSessionProperty(metadata.getSqlType(), value);
    try {
      return type.cast(metadata.decode(objectValue));
    } catch (PrestoException e) {
      throw e;
    } catch (Exception e) {
      // the system property decoder can throw any exception
      throw new PrestoException(
          INVALID_SESSION_PROPERTY, format("%s is invalid: %s", name, value), e);
    }
  }
Пример #23
0
 /**
  * Returns a composed {@link BiIntToFloatFunction} that first applies the {@code before} functions
  * to its input, and then applies this function to the result. If evaluation of either operation
  * throws an exception, it is relayed to the caller of the composed operation. This method is just
  * convenience, to provide the ability to execute an operation which accepts {@code int} input,
  * before this primitive function is executed.
  *
  * @param before1 The first function to apply before this function is applied
  * @param before2 The second function to apply before this function is applied
  * @return A composed {@code BiIntToFloatFunction} that first applies the {@code before} functions
  *     to its input, and then applies this function to the result.
  * @throws NullPointerException If given argument is {@code null}
  * @implSpec The input argument of this method is a able to handle primitive values. In this case
  *     this is {@code int}.
  */
 @Nonnull
 default BiIntToFloatFunction composeFromInt(
     @Nonnull final IntFunction<? extends T> before1, @Nonnull final IntToDoubleFunction before2) {
   Objects.requireNonNull(before1);
   Objects.requireNonNull(before2);
   return (value1, value2) -> applyAsFloat(before1.apply(value1), before2.applyAsDouble(value2));
 }
  static ByteCodeExpression notEqual(ByteCodeExpression left, ByteCodeExpression right) {
    requireNonNull(left, "left is null");
    requireNonNull(right, "right is null");
    checkArgument(left.getType().equals(right.getType()), "left and right must be the same type");

    OpCode comparisonInstruction;
    OpCode noMatchJumpInstruction;

    Class<?> type = left.getType().getPrimitiveType();
    if (type == int.class) {
      comparisonInstruction = null;
      noMatchJumpInstruction = IF_ICMPEQ;
    } else if (type == long.class) {
      comparisonInstruction = LCMP;
      noMatchJumpInstruction = IFEQ;
    } else if (type == float.class) {
      comparisonInstruction = FCMPL;
      noMatchJumpInstruction = IFEQ;
    } else if (type == double.class) {
      comparisonInstruction = DCMPL;
      noMatchJumpInstruction = IFEQ;
    } else if (type == null) {
      comparisonInstruction = null;
      noMatchJumpInstruction = IF_ACMPEQ;
    } else {
      throw new IllegalArgumentException("Less than does not support " + type);
    }
    return new ComparisonByteCodeExpression(
        "!=", comparisonInstruction, noMatchJumpInstruction, left, right);
  }
Пример #25
0
  public Link(URL url, String label) {
    Objects.requireNonNull(url);
    Objects.requireNonNull(label);

    this.url = url.toString();
    this.label = label;
  }
Пример #26
0
  @Override
  public void free(ResourceUser resourceUser, Set<TCSResource> resources) {
    Objects.requireNonNull(resourceUser, "resourceUser is null");
    Objects.requireNonNull(resources, "resources is null");

    synchronized (inquiringTasks) {
      boolean freeSuccessful = false;
      // Loop until we could free the resources.
      do {
        if (releasable) {
          log.fine("releasable flag set, releasing resources...");
          Set<TCSResource> freeableResources = getFreeableResources(resources, resourceUser);
          // Decrement the reservation counter for freed resources.
          log.fine("Releasing resources: " + freeableResources);
          for (TCSResource curRes : freeableResources) {
            getReservationEntry(curRes).free();
          }
          checkWaitingRequests();
          freeSuccessful = true;
        } else {
          log.fine("releasable flag not set, waiting...");
          try {
            inquiringTasks.wait();
            log.fine("Woken up, trying again...");
          } catch (InterruptedException exc) {
            throw new IllegalStateException("Unexpectedly interrupted", exc);
          }
        }
      } while (!freeSuccessful);
    }
  }
Пример #27
0
 /**
  * Returns a composed {@link ToFloatBiFunction} that first applies the {@code before} predicates
  * to its input, and then applies this function to the result. If evaluation of either operation
  * throws an exception, it is relayed to the caller of the composed operation.
  *
  * @param <A> The type of the argument to the first given predicate, and of composed function
  * @param <B> The type of the argument to the second given predicate, and of composed function
  * @param before1 The first predicate to apply before this function is applied
  * @param before2 The second predicate to apply before this function is applied
  * @return A composed {@code ToFloatBiFunction} that first applies the {@code before} predicates
  *     to its input, and then applies this function to the result.
  * @throws NullPointerException If given argument is {@code null}
  * @implSpec The input argument of this method is able to handle every type.
  */
 @Nonnull
 default <A, B> ToFloatBiFunction<A, B> compose(
     @Nonnull final Predicate<? super A> before1, @Nonnull final Predicate<? super B> before2) {
   Objects.requireNonNull(before1);
   Objects.requireNonNull(before2);
   return (a, b) -> applyAsFloat(before1.test(a), before2.test(b));
 }
Пример #28
0
 public CallableMethod(Class<?> pojo, Method method) {
   Objects.requireNonNull(pojo, "Pojo cannot be null");
   Objects.requireNonNull(method, "Method cannot be null");
   this.pojo = pojo;
   this.method = method;
   this.paramTypes = method.getParameterTypes();
 }
Пример #29
0
 /**
  * Returns a composed {@link BiShortToFloatFunction} that first applies the {@code before}
  * predicates to its input, and then applies this function to the result. If evaluation of either
  * operation throws an exception, it is relayed to the caller of the composed operation. This
  * method is just convenience, to provide the ability to execute an operation which accepts {@code
  * short} input, before this primitive function is executed.
  *
  * @param before1 The first predicate to apply before this function is applied
  * @param before2 The second predicate to apply before this function is applied
  * @return A composed {@code BiShortToFloatFunction} that first applies the {@code before}
  *     predicates to its input, and then applies this function to the result.
  * @throws NullPointerException If given argument is {@code null}
  * @implSpec The input argument of this method is a able to handle primitive values. In this case
  *     this is {@code short}.
  */
 @Nonnull
 default BiShortToFloatFunction composeFromShort(
     @Nonnull final ShortPredicate before1, @Nonnull final ShortPredicate before2) {
   Objects.requireNonNull(before1);
   Objects.requireNonNull(before2);
   return (value1, value2) -> applyAsFloat(before1.test(value1), before2.test(value2));
 }
 @Override
 public InductiveConformalClassifier fit(DataFrame x, Vector y) {
   Objects.requireNonNull(x, "Input data is required.");
   Objects.requireNonNull(y, "Input target is required.");
   Check.argument(x.rows() == y.size(), "The size of input data and input target don't match.");
   return new InductiveConformalClassifier(learner.fit(x, y), Vectors.unique(y));
 }