当前位置: 首页>>代码示例>>Java>>正文


Java NotNull类代码示例

本文整理汇总了Java中com.feedzai.fos.common.validation.NotNull的典型用法代码示例。如果您正苦于以下问题:Java NotNull类的具体用法?Java NotNull怎么用?Java NotNull使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NotNull类属于com.feedzai.fos.common.validation包,在下文中一共展示了NotNull类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: score

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
/**
 * Score a single <code>scorable</code> with the given <code>modelId</code>.
 *
 * @param modelId   the id of the model
 * @param scorable  the instance to score
 * @return a list of scores with the same order as the scorable array
 * @throws FOSException when classification was not possible
 */
@Override
@NotNull
public double[] score(UUID modelId, Object[] scorable) throws FOSException {
    checkNotNull(scorable, "The scorable cannot be null");

    try {
        reloadModelsLock.readLock().lock();

        WekaThreadSafeScorer wekaThreadSafeScorer = getScorer(modelId);
        return wekaThreadSafeScorer.score(scorable);

    } finally {
        reloadModelsLock.readLock().unlock();
    }
}
 
开发者ID:feedzai,项目名称:fos-weka,代码行数:24,代码来源:WekaScorer.java

示例2: set

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
/**
 * Converts from <code>InstanceFields</code> to <code>InstanceSetters</code> (required for scorable manipulation).
 *
 * @param instanceFields The instance fields for which to create the converters
 * @param type           The type of instance to handle.
 * @return an array of <code>InstanceSetter</code> with one <code>InstanceSetter</code> for each <code>InstanceField</code>.
 */
@NotNull
public static InstanceSetter[] instanceFields2ValueSetters(final List<? extends Attribute> instanceFields, final InstanceType type) throws FOSException {
    InstanceSetter[] instanceSetters = new InstanceSetter[instanceFields.size()];

    for (int idx = 0; idx < instanceFields.size(); idx++) {
        final Attribute att = instanceFields.get(idx);
        instanceSetters[idx] = new InstanceSetter() {
            @Override
            public void set(Instance instance, weka.core.Attribute attribute, Object value) throws FOSException {
                instance.setValue(attribute, att.parseOrMissing(value));
            }
        };
    }
    return instanceSetters;
}
 
开发者ID:feedzai,项目名称:fos-weka,代码行数:23,代码来源:WekaUtils.java

示例3: get

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
/**
 * Gets a fresh clone of the object.
 *
 * @return a fresh clone
 * @throws IOException            when there were problems serializing the object
 * @throws ClassNotFoundException when the serialized objects's class was not found
 */
@NotNull
public T get() throws IOException, ClassNotFoundException {
    /* cannot be pre-instantiated to enable thread concurrency*/
    ByteArrayInputStream byteArrayInputStream = null;
    ObjectInputStream objectInputStream = null;
    try {
        byteArrayInputStream = new ByteArrayInputStream(this.serializedObject);
        objectInputStream = new ObjectInputStream(byteArrayInputStream);

        return (T) objectInputStream.readObject();
    } finally {
        IOUtils.closeQuietly(byteArrayInputStream);
        IOUtils.closeQuietly(objectInputStream);
    }
}
 
开发者ID:feedzai,项目名称:fos-weka,代码行数:23,代码来源:Cloner.java

示例4: listModels

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
@Override
@NotNull
public synchronized Map<UUID, ModelConfig> listModels() {
    Map<UUID, ModelConfig> result = new HashMap<>(modelConfigs.size());
    for (Map.Entry<UUID, WekaModelConfig> entry : modelConfigs.entrySet()) {
        result.put(entry.getKey(), entry.getValue().getModelConfig());
    }

    return result;
}
 
开发者ID:feedzai,项目名称:fos-weka,代码行数:11,代码来源:WekaManager.java

示例5: instanceFields2Attributes

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
/**
 * Converts the given instance fields into a fast vector with <code>Attributes</code>.
 *
 * @param classIndex     classifier index
 * @param instanceFields the list of instance fields that will generate the <code>Attributes</code>
 * @return a vector with one <code>Attribute</code> for each instanceFields (in the same order).
 */
@NotNull
public static FastVector instanceFields2Attributes(int classIndex, List<? extends Attribute> instanceFields) throws FOSException {
    checkNotNull(instanceFields, "Instance fields cannot be null");

    FastVector result = new FastVector(instanceFields.size());
    classIndex = classIndex == -1 ? instanceFields.size() - 1 : classIndex;

    int idx = 0;
    for (Attribute instanceField : instanceFields) {
        weka.core.Attribute attribute;

        Class<?> type = instanceField.getClass();
        if (type == CategoricalAttribute.class) {
            CategoricalAttribute categorical = (CategoricalAttribute) instanceField;
            List<String> instances = categorical.getCategoricalInstances();

            FastVector categoricalInstances = new FastVector(instances.size());
            for (String categoricalInstance : instances) {
                categoricalInstances.addElement(categoricalInstance);
            }

            attribute = new weka.core.Attribute(instanceField.getName(), categoricalInstances, idx);

        } else if (type == NumericAttribute.class) {
            attribute = new weka.core.Attribute(instanceField.getName(), idx);
        } else {
            throw new FOSException("Unknown instance class");
        }
        result.addElement(attribute);
        idx++;
    }

    return result;
}
 
开发者ID:feedzai,项目名称:fos-weka,代码行数:42,代码来源:WekaUtils.java

示例6: getSerialized

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
/**
 * Returns a copy of the serialized object.
 *
 * @return a copy (this object is immutable)
 */
@NotNull
public byte[] getSerialized() {
    byte[] result = new byte[serializedObject.length];
    System.arraycopy(serializedObject, 0, result, 0, serializedObject.length);

    return result;
}
 
开发者ID:feedzai,项目名称:fos-weka,代码行数:13,代码来源:Cloner.java

示例7: listModels

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
@Override
@NotNull
public synchronized Map<UUID, ModelConfig> listModels() {
    Map<UUID, ModelConfig> result = new HashMap<>(modelConfigs.size());
    for (Map.Entry<UUID, RModelConfig> entry : modelConfigs.entrySet()) {
        result.put(entry.getKey(), entry.getValue().getModelConfig());
    }

    return result;
}
 
开发者ID:feedzai,项目名称:fos-r,代码行数:11,代码来源:RManager.java

示例8: parseOrMissing

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
/**
 * Parses the provided value for the current Attribute configuration.
 *
 * @param original The original value of the field.
 * @return The value in the correct representation for the classifier or missing value.
 */
public double parseOrMissing(@NotNull Object original) {
    try {
        if (original.equals(MISSING_VALUE_STR)) {
            return MISSING_VALUE;
        }

        return this.parse(original);
    } catch (FOSException e) {
        logger.warn("Failed to parse {} using missing value instead", original);
        return MISSING_VALUE;
    }
}
 
开发者ID:feedzai,项目名称:fos-core,代码行数:19,代码来源:Attribute.java

示例9: getProperties

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
/**
 * Gets the custom properties of this configuration (unmodifiable).
 *
 * @return a map from custom property name to custom property value
 */
@NotNull
public Map<String, String> getProperties() {
    if (this.properties == null) {
        this.properties = new HashMap<>();
    }
    return properties;
}
 
开发者ID:feedzai,项目名称:fos-core,代码行数:13,代码来源:ModelConfig.java

示例10: score

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
/**
 * Score the <code>scorable</code> against the given <code>modelIds</code>.
 * <p/> The score must be between 0 and 1.
 * <p/> The resulting scores are returned by the same order as the <code>modelIds</code> (modelsIds(pos) » return(pos)).
 *
 * @param modelIds the list of models to score
 * @param scorable the instance data to score
 * @return a list of scores double[] where each list position contains the score for each classifier
 * @throws FOSException when scoring was not possible
 */
@NotNull
default List<double[]> score(List<UUID> modelIds, Object[] scorable) throws FOSException {
    ImmutableList.Builder<double[]> resultsBuilder = ImmutableList.builder();

    for (UUID modelId : modelIds) {
        resultsBuilder.add(score(modelId, scorable));
    }

    return resultsBuilder.build();
}
 
开发者ID:feedzai,项目名称:fos-core,代码行数:21,代码来源:Scorer.java

示例11: score

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
@Override
@NotNull
public List<double[]> score(List<UUID> modelIds,Object[] scorable) throws RemoteException {
    try {
        return this.scorer.score(modelIds, scorable);
    } catch (Exception e) {
        logger.error("Caught exception from underlying implementation",e);
        throw new RemoteException("Translated in RMI layer", e);
    }
}
 
开发者ID:feedzai,项目名称:fos-core,代码行数:11,代码来源:RemoteScorer.java

示例12: getScorer

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
@Override
@NotNull
public WekaScorer getScorer() {
    return wekaScorer;
}
 
开发者ID:feedzai,项目名称:fos-weka,代码行数:6,代码来源:WekaManager.java

示例13: getScorer

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
@Override
@NotNull
public RScorer getScorer() {
    return rScorer;
}
 
开发者ID:feedzai,项目名称:fos-r,代码行数:6,代码来源:RManager.java

示例14: getConfiguration

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
@NotNull
public File getConfiguration() {
    return configuration;
}
 
开发者ID:feedzai,项目名称:fos-core,代码行数:5,代码来源:StartupConfiguration.java

示例15: listModels

import com.feedzai.fos.common.validation.NotNull; //导入依赖的package包/类
@Override
@NotNull
public Map<UUID, ? extends ModelConfig> listModels() throws RemoteException, FOSException {
    return this.manager.listModels();

}
 
开发者ID:feedzai,项目名称:fos-core,代码行数:7,代码来源:RemoteManager.java


注:本文中的com.feedzai.fos.common.validation.NotNull类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。