本文整理汇总了Java中org.ojalgo.ProgrammingError.throwIfNull方法的典型用法代码示例。如果您正苦于以下问题:Java ProgrammingError.throwIfNull方法的具体用法?Java ProgrammingError.throwIfNull怎么用?Java ProgrammingError.throwIfNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ojalgo.ProgrammingError
的用法示例。
在下文中一共展示了ProgrammingError.throwIfNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: from
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
public static CalendarDate from(final TemporalAccessor temporal) {
ProgrammingError.throwIfNull(temporal, "temporal");
if (temporal instanceof CalendarDate) {
return (CalendarDate) temporal;
} else if (temporal instanceof Instant) {
return new CalendarDate(((Instant) temporal).toEpochMilli());
} else {
try {
final long tmpSeconds = temporal.getLong(ChronoField.INSTANT_SECONDS);
final int tmpMillisOfSecond = temporal.get(ChronoField.MILLI_OF_SECOND);
return new CalendarDate((tmpSeconds * MILLIS_PER_SECOND) + tmpMillisOfSecond);
} catch (final DateTimeException ex) {
throw new DateTimeException("Unable to obtain CalendarDate from TemporalAccessor: " + temporal + " of type " + temporal.getClass().getName(),
ex);
}
}
}
示例2: getEigenvalues
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
/**
* @param realParts An array that will receive the real parts of the eigenvalues
* @param imaginaryParts An optional array that, if present, will receive the imaginary parts of the
* eigenvalues
*/
default void getEigenvalues(final double[] realParts, final Optional<double[]> imaginaryParts) {
ProgrammingError.throwIfNull(realParts, imaginaryParts);
final Array1D<ComplexNumber> values = this.getEigenvalues();
final int length = realParts.length;
if (imaginaryParts.isPresent()) {
final double[] imagParts = imaginaryParts.get();
for (int i = 0; i < length; i++) {
final ComplexNumber value = values.get(i);
realParts[i] = value.getReal();
imagParts[i] = value.getImaginary();
}
} else {
for (int i = 0; i < length; i++) {
realParts[i] = values.doubleValue(i);
}
}
}
示例3: objective
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
public Builder objective(final MatrixStore<Double> mtrxQ, final MatrixStore<Double> mtrxC) {
ProgrammingError.throwIfNull(mtrxQ);
if (mtrxQ == null) {
throw new IllegalArgumentException();
}
if (mtrxQ instanceof PhysicalStore) {
myQ = (PhysicalStore<Double>) mtrxQ;
} else {
myQ = mtrxQ.copy();
}
myC = mtrxC != null ? mtrxC : MatrixStore.PRIMITIVE.makeZero((int) mtrxQ.countRows(), 1).get();
return this;
}
示例4: compute
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
@Override
public Iterator<double[]> compute(final Partition partition, final TaskContext context) {
ProgrammingError.throwIfNull(partition, context);
if (partition instanceof Partition2D) {
return this.compute((Partition2D) partition, context);
} else {
throw new IllegalArgumentException();
}
}
示例5: compute
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
@Override
public Iterator<MatrixStore<N>> compute(final Partition partition, final TaskContext context) {
ProgrammingError.throwIfNull(partition, context);
if (partition instanceof Partition2D) {
return this.compute((Partition2D) partition, context);
} else {
throw new IllegalArgumentException();
}
}
示例6: mix
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
public double mix(final long index, final BinaryFunction<N> mixer, final double addend) {
ProgrammingError.throwIfNull(mixer);
if (index >= myActualCount) {
throw new ArrayIndexOutOfBoundsException();
} else {
synchronized (myStorage) {
final double oldValue = myStorage.doubleValue(index);
final double newValue = mixer.invoke(oldValue, addend);
myStorage.set(index, newValue);
return newValue;
}
}
}
示例7: mix
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
public double mix(final long[] reference, final BinaryFunction<N> mixer, final double addend) {
ProgrammingError.throwIfNull(mixer);
synchronized (myDelegate) {
final double oldValue = this.doubleValue(reference);
final double newValue = mixer.invoke(oldValue, addend);
this.set(reference, newValue);
return newValue;
}
}
示例8: mix
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
public double mix(final long key, final BinaryFunction<N> mixer, final double addend) {
ProgrammingError.throwIfNull(mixer);
synchronized (myStorage) {
final int tmpIndex = myStorage.index(key);
final double oldValue = tmpIndex >= 0 ? myStorage.doubleValueInternally(tmpIndex) : PrimitiveMath.NaN;
final double newValue = tmpIndex >= 0 ? mixer.invoke(oldValue, addend) : addend;
myStorage.put(key, tmpIndex, newValue);
return newValue;
}
}
示例9: mix
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
public double mix(final long row, final long col, final BinaryFunction<N> mixer, final double addend) {
ProgrammingError.throwIfNull(mixer);
synchronized (myDelegate) {
final double oldValue = this.doubleValue(row, col);
final double newValue = mixer.invoke(oldValue, addend);
this.set(row, col, newValue);
return newValue;
}
}
示例10: andThen
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
default NullaryFunction<N> andThen(final UnaryFunction<N> after) {
ProgrammingError.throwIfNull(after);
return new NullaryFunction<N>() {
public double doubleValue() {
return after.invoke(NullaryFunction.this.doubleValue());
}
public N invoke() {
return after.invoke(NullaryFunction.this.invoke());
}
};
}
示例11: getConfigurator
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public <T> Optional<T> getConfigurator(final Class<T> type) {
ProgrammingError.throwIfNull(type);
if ((myConfigurator != null) && type.isInstance(myConfigurator)) {
return Optional.of((T) myConfigurator);
} else {
return Optional.empty();
}
}
示例12: inequalities
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
public ConvexSolver.Builder inequalities(final Access2D<Double> mtrxAI, final MatrixStore<Double> mtrxBI) {
ProgrammingError.throwIfNull(mtrxAI, mtrxBI);
ProgrammingError.throwIfNotEqualRowDimensions(mtrxAI, mtrxBI);
if (mtrxAI instanceof RowsSupplier) {
myAI = (RowsSupplier<Double>) mtrxAI;
} else {
myAI = FACTORY.makeRowsSupplier((int) mtrxAI.countColumns());
myAI.addRows((int) mtrxAI.countRows());
if (mtrxAI instanceof SparseStore) {
((SparseStore<Double>) mtrxAI).nonzeros().forEach(nz -> myAI.getRow((int) nz.row()).set((int) nz.column(), nz.doubleValue()));
} else {
double value;
for (int i = 0; i < mtrxAI.countRows(); i++) {
final SparseArray<Double> tmpRow = myAI.getRow(i);
for (int j = 0; j < mtrxAI.countColumns(); j++) {
value = mtrxAI.doubleValue(i, j);
if (!NC.isZero(value)) {
tmpRow.set(j, value);
}
}
}
}
}
myBI = mtrxBI;
return this;
}
示例13: build
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
public <N extends Number> BasicSeries.NaturallySequenced<K, N> build(final DenseArray.Factory<N> arrayFactory) {
ProgrammingError.throwIfNull(arrayFactory);
return this.doBuild(arrayFactory, null);
}
示例14: swap
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
/**
* Replace the underlying samples and reset the sample set.
*/
public void swap(final Access1D<?> samples) {
ProgrammingError.throwIfNull(samples);
mySamples = samples;
this.reset();
}
示例15: parameter
import org.ojalgo.ProgrammingError; //导入方法依赖的package包/类
public ResourceLocator parameter(final String key, final String value) {
ProgrammingError.throwIfNull(key, value);
myQueryParameters.put(key, value);
return this;
}