method2testcases stringlengths 118 6.63k |
|---|
### Question:
SequentialActionGroup extends ActionGroupBase { @Override public final void execute() { if (mCurrentAction == null) { startNextAction(); } handleCurrentAction(); } SequentialActionGroup(Scheduler scheduler, Clock clock,
Collection<Action> actions, Queue<ActionContext> actionQueue... |
### Question:
PeriodicAction extends ActionBase { @Override public void execute() { if (!mNextRun.isValid() || mClock.currentTime().largerThanOrEquals(mNextRun)) { mRunnable.run(); mNextRun = mClock.currentTime().add(mPeriod); } } PeriodicAction(Clock clock, Runnable runnable, Time period, Time nextRun); PeriodicActio... |
### Question:
DoubleBuffer { public void write(T value) { int index = mReadIndex.get(); mArray.set(index, value); mReadIndex.updateAndGet(mReadIndexUpdater); } DoubleBuffer(AtomicReferenceArray<T> array, AtomicInteger readIndex); DoubleBuffer(); T read(); void write(T value); }### Answer:
@Test public void write_ofOb... |
### Question:
Time implements Comparable<Time> { public boolean equals(Time other) { return CompareResult.EQUAL_TO.is(compareTo(other)); } Time(long value, TimeUnit unit); static Time of(long value, TimeUnit unit); static Time milliseconds(long valueMs); static Time seconds(long valueSeconds); static Time seconds(doubl... |
### Question:
DoubleBuffer { public T read() { T value = mArray.get(mReadIndex.get()); if (value == null) { throw new NoSuchElementException("nothing to read"); } return value; } DoubleBuffer(AtomicReferenceArray<T> array, AtomicInteger readIndex); DoubleBuffer(); T read(); void write(T value); }### Answer:
@Test pub... |
### Question:
SyncPipeJunction implements Pipeline<T> { @Override public void process(T input) throws VisionException { for (Pipeline<? super T> pipeline : mPipelines) { pipeline.process(input); } } SyncPipeJunction(Collection<Pipeline<? super T>> pipelines); @SafeVarargs SyncPipeJunction(Pipeline<? super T>... pipeli... |
### Question:
SyncPipeJunction implements Pipeline<T> { @Override public Pipeline<T> divergeTo(Pipeline<? super T> pipeline) { mPipelines.add(pipeline); return this; } SyncPipeJunction(Collection<Pipeline<? super T>> pipelines); @SafeVarargs SyncPipeJunction(Pipeline<? super T>... pipelines); @Override void process(T ... |
### Question:
ProcessorChain implements Processor { @SuppressWarnings("unchecked") @Override public Object process(Object input) throws VisionException { Object out = input; for (Processor processor : mProcessors) { out = processor.process(out); } return out; } ProcessorChain(Collection<Processor> processors); Proces... |
### Question:
ProcessorPair implements Processor<T, R2> { @Override public R2 process(T input) throws VisionException { R out = mIn.process(input); return mOut.process(out); } ProcessorPair(Processor<T, R> in, Processor<? super R, R2> out); @Override R2 process(T input); }### Answer:
@Test public void process_forInput... |
### Question:
RequirementsControl { public void updateRequirementsNoCurrentAction(Action action) { for (Requirement requirement : action.getConfiguration().getRequirements()) { mActionsOnRequirement.remove(requirement); } } RequirementsControl(Logger logger, Map<Requirement, Action> actionsOnRequirement, Map<Subsystem,... |
### Question:
InProcessorJunction implements Processor<T, R> { @Override public R process(T input) throws VisionException { mPipeline.process(input); return mProcessor.process(input); } InProcessorJunction(Processor<T, R> processor, Pipeline<? super T> pipeline); @Override R process(T input); @Override Processor<T, R> ... |
### Question:
OutProcessorJunction implements Processor<T, R> { @Override public R process(T input) throws VisionException { R out = mProcessor.process(input); mPipeline.process(out); return out; } OutProcessorJunction(Processor<T, R> processor, Pipeline<? super R> pipeline); @Override R process(T input); @Override Pro... |
### Question:
RequirementsControl { public void updateRequirementsWithNewRunningAction(Action action) { for (Requirement requirement : action.getConfiguration().getRequirements()) { if (mActionsOnRequirement.containsKey(requirement)) { Action currentAction = mActionsOnRequirement.get(requirement); currentAction.cancel(... |
### Question:
SPARQLBasedTrivialInconsistencyFinder extends AbstractTrivialInconsistencyFinder { @Override public void run(boolean resume) { for(AbstractTrivialInconsistencyFinder checker : incFinders){ if(!(checker instanceof InverseFunctionalityBasedInconsistencyFinder) || isApplyUniqueNameAssumption()){ try { checke... |
### Question:
GenerateTradeData { public List<Trade> createRandomData(int number) throws Exception { return null; } Trade createTradeData(int number, List<Party> partyList,
List<Instrument> instrumentList); List<Trade> createRandomData(int number); }### Answer:
@Test public void testGenerateRandomInstrument() thro... |
### Question:
SegmentedLog { public void truncateSuffix(long newEndIndex) { if (newEndIndex >= getLastLogIndex()) { return; } LOG.info("Truncating log from old end index {} to new end index {}", getLastLogIndex(), newEndIndex); while (!startLogIndexSegmentMap.isEmpty()) { Segment segment = startLogIndexSegmentMap.lastE... |
### Question:
Snapshot { public TreeMap<String, SnapshotDataFile> openSnapshotDataFiles() { TreeMap<String, SnapshotDataFile> snapshotDataFileMap = new TreeMap<>(); String snapshotDataDir = snapshotDir + File.separator + "data"; try { Path snapshotDataPath = FileSystems.getDefault().getPath(snapshotDataDir); snapshotDa... |
### Question:
MergedItem { static MergedItem newInjectedRow(int type) { return new MergedItem(type, type, true); } private MergedItem(int type, long id, boolean injected); @Override boolean equals(Object o); }### Answer:
@Test public void testNewInjectedRowBuilder() { MergedItem mergedItem = MergedItem.newInjectedRow... |
### Question:
MergedItem { static MergedItem newRow(int type, long id) { return new MergedItem(type, id, false); } private MergedItem(int type, long id, boolean injected); @Override boolean equals(Object o); }### Answer:
@Test public void testNewRowBuilder() { MergedItem mergedItem = MergedItem.newRow(1, 2L); assertT... |
### Question:
VectorCalculator { int[] calculateFromChildItemPositionTranslationVector() { int maxInjectedItemPosition = getMaxInjectedItemPosition(); if (maxInjectedItemPosition != NO_POSITION) { int vectorSize = maxInjectedItemPosition - dataProvider.getInjectedItemCount() + 2; int[] vector = new int[vectorSize]; int... |
### Question:
VectorCalculator { int[] calculateNumberOfInjectedItemsUpToPosition() { int maxInjectedItemPosition = getMaxInjectedItemPosition(); if (maxInjectedItemPosition != NO_POSITION) { int[] vector = new int[maxInjectedItemPosition + 1]; int previousValue = 0; for (int i = 0; i < vector.length; i++) { vector[i] ... |
### Question:
MergedListDiffer extends DiffUtil.Callback { void updateData(List<MergedItem> oldList, List<MergedItem> newList) { this.oldList = oldList; this.newList = newList; } @Override int getOldListSize(); @Override int getNewListSize(); @Override boolean areItemsTheSame(int oldItemPosition, int newItemPosition);... |
### Question:
MergedListDiffer extends DiffUtil.Callback { @Override public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) { MergedItem oldRow = oldList.get(oldItemPosition); MergedItem newRow = newList.get(newItemPosition); return oldRow.type == newRow.type && oldRow.id == newRow.id; } @Override in... |
### Question:
MergedListDiffer extends DiffUtil.Callback { @Override public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) { return true; } @Override int getOldListSize(); @Override int getNewListSize(); @Override boolean areItemsTheSame(int oldItemPosition, int newItemPosition); @Override boolea... |
### Question:
Parameter implements Cloneable { public Parameter(String name) { setNameAndParent(name,null); } Parameter(String name); Parameter(String name, boolean value); Parameter(String name, int value); Parameter(String name, long value); Parameter(String name, float value); Parameter(String name, double valu... |
### Question:
DMatrixSvd { public int rank() { double eps = ulp(1.0); double tol = max(_m,_n)*_s[0]*eps; int r = 0; for (int i=0; i<_mn; ++i) { if (_s[i]>tol) ++r; } return r; } DMatrixSvd(DMatrix a); DMatrix getU(); DMatrix getS(); double[] getSingularValues(); DMatrix getV(); DMatrix getVTranspose(); double norm2(); ... |
### Question:
TridiagonalFMatrix { public void solve(float[] r, float[] u) { if (_w==null) _w = new float[_n]; float t = _b[0]; u[0] = r[0]/t; for (int j=1; j<_n; ++j) { _w[j] = _c[j-1]/t; t = _b[j]-_a[j]*_w[j]; u[j] = (r[j]-_a[j]*u[j-1])/t; } for (int j=_n-1; j>0; --j) u[j-1] -= _w[j]*u[j]; } TridiagonalFMatrix(int n)... |
### Question:
DMatrixQrd { public boolean isFullRank() { for (int j=0; j<_n; ++j) { if (_rdiag[j]==0.0) return false; } return true; } DMatrixQrd(DMatrix a); boolean isFullRank(); DMatrix getQ(); DMatrix getR(); DMatrix solve(DMatrix b); }### Answer:
@Test public void testRankDeficient() { DMatrix a = new DMatrix(new ... |
### Question:
Units implements Cloneable { public static synchronized boolean define(String name, boolean plural, String definition) throws UnitsFormatException { return addDefinition(name,plural,definition); } Units(); Units(String definition); Object clone(); boolean equals(Object object); boolean equals(Units units... |
### Question:
SincInterpolator { public static SincInterpolator fromErrorAndFrequency( double emax, double fmax) { return new SincInterpolator(emax,fmax,0); } SincInterpolator(); private SincInterpolator(double emax,double fmax,int lmax); static SincInterpolator fromErrorAndLength(
double emax, int lmax); static S... |
### Question:
SincInterpolator { public static SincInterpolator fromErrorAndLength( double emax, int lmax) { return new SincInterpolator(emax,0.0,lmax); } SincInterpolator(); private SincInterpolator(double emax,double fmax,int lmax); static SincInterpolator fromErrorAndLength(
double emax, int lmax); static SincI... |
### Question:
SincInterpolator { public static SincInterpolator fromFrequencyAndLength( double fmax, int lmax) { return new SincInterpolator(0.0,fmax,lmax); } SincInterpolator(); private SincInterpolator(double emax,double fmax,int lmax); static SincInterpolator fromErrorAndLength(
double emax, int lmax); static S... |
### Question:
RecursiveExponentialFilter { public void apply(float[] x, float[] y) { apply1(x,y); } RecursiveExponentialFilter(double sigma); RecursiveExponentialFilter(double sigma1, double sigma23); RecursiveExponentialFilter(
double sigma1, double sigma2, double sigma3); void setEdges(Edges edges); void apply(... |
### Question:
HilbertTransformFilter { public void apply(int n, float[] x, float[] y) { Conv.conv(_filter.length,-(_filter.length-1)/2,_filter,n,0,x,n,0,y); } HilbertTransformFilter(); HilbertTransformFilter(int nmax, float emax,
float fmin, float fmax); void apply(int n, float[] x, fl... |
### Question:
Parallel { public static void loop(int end, LoopInt body) { loop(0,end,1,1,body); } static void loop(int end, LoopInt body); static void loop(int begin, int end, LoopInt body); static void loop(int begin, int end, int step, LoopInt body); static void loop(
int begin, int end, int step, int chunk, Loo... |
### Question:
Eigen { public static void solveSymmetric22(float[][] a, float[][] v, float[] d) { float a00 = a[0][0]; float a01 = a[0][1], a11 = a[1][1]; float v00 = 1.0f, v01 = 0.0f; float v10 = 0.0f, v11 = 1.0f; if (a01!=0.0f) { float tiny = 0.1f*sqrt(FLT_EPSILON); float c,r,s,t,u,vpr,vqr; u = a11-a00; if (abs(a01)<t... |
### Question:
Eigen { public static void solveSymmetric33(double[][] a, double[][] v, double[] d) { solveSymmetric33Jacobi(a,v,d); } static void solveSymmetric22(float[][] a, float[][] v, float[] d); static void solveSymmetric22(double[][] a, double[][] v, double[] d); static void solveSymmetric33(double[][] a, double... |
### Question:
Real1 { public Real1 plus(Real1 ra) { return add(this,ra); } Real1(Sampling s); Real1(float[] v); Real1(Sampling s, float[] v); Real1(int n, double d, double f); Real1(int n, double d, double f, float[] v); Real1(Real1 r); Sampling getSampling(); float[] getValues(); Real1 resample(Sampling s); Real1... |
### Question:
Real1 { public Real1 resample(Sampling s) { Sampling t = _s; int[] overlap = t.overlapWith(s); if (overlap!=null) { int ni = overlap[0]; int it = overlap[1]; int is = overlap[2]; Real1 rt = this; Real1 rs = new Real1(s); float[] xt = rt.getValues(); float[] xs = rs.getValues(); while (--ni>=0) xs[is++] = ... |
### Question:
RecursiveGaussianFilter { public void apply0(float[] x, float[] y) { _filter.applyN(0,x,y); } RecursiveGaussianFilter(double sigma, Method method); RecursiveGaussianFilter(double sigma); void apply0(float[] x, float[] y); void apply1(float[] x, float[] y); void apply2(float[] x, float[] y); void apply0X(... |
### Question:
MedianFinder { public float findMedian(float[] x) { Check.argument(_n==x.length,"length of x is valid"); copy(x,_x); int k = (_n-1)/2; quickPartialSort(k,_x); float xmed = _x[k]; if (_n%2==0) { float xmin = _x[_n-1]; for (int i=_n-2; i>k; --i) if (_x[i]<xmin) xmin = _x[i]; xmed = 0.5f*(xmed+xmin); } retur... |
### Question:
RecursiveGaussianFilter { public void apply00(float[][] x, float[][] y) { _filter.applyXN(0,x,y); _filter.applyNX(0,y,y); } RecursiveGaussianFilter(double sigma, Method method); RecursiveGaussianFilter(double sigma); void apply0(float[] x, float[] y); void apply1(float[] x, float[] y); void apply2(float[... |
### Question:
RecursiveGaussianFilter { public void apply000(float[][][] x, float[][][] y) { _filter.applyXXN(0,x,y); _filter.applyXNX(0,y,y); _filter.applyNXX(0,y,y); } RecursiveGaussianFilter(double sigma, Method method); RecursiveGaussianFilter(double sigma); void apply0(float[] x, float[] y); void apply1(float[] x... |
### Question:
SymmetricTridiagonalFilter { private static SymmetricTridiagonalFilter makeRandomFilter() { java.util.Random r = new java.util.Random(); float af,ai,al,b; boolean aeq2b = r.nextBoolean(); boolean abneg = r.nextBoolean(); boolean afzs = r.nextBoolean(); boolean alzs = r.nextBoolean(); if (aeq2b && afzs==tr... |
### Question:
LocalShiftFinder { public void find1( int min1, int max1, float[] f, float[] g, float[] u) { findShifts(min1,max1,f,g,u,null,null); } LocalShiftFinder(double sigma); LocalShiftFinder(double sigma1, double sigma2); LocalShiftFinder(double sigma1, double sigma2, double sigma3); void setInterpolateDisplace... |
### Question:
ArrayQueue { public E first() { if (_size==0) throw new NoSuchElementException(); @SuppressWarnings("unchecked") E e = (E)_array[_first]; return e; } ArrayQueue(); ArrayQueue(int capacity); void add(E e); E first(); E remove(); boolean isEmpty(); void ensureCapacity(int capacity); int size(); void trimTo... |
### Question:
Projector { public AxisScale getScale() { return _scaleType; } Projector(double v0, double v1); Projector(double v0, double v1, AxisScale scale); Projector(double v0, double v1, double u0, double u1); Projector(double v0, double v1, double u0, double u1, AxisScale s); Projector(Projector p); double u(... |
### Question:
ArrayQueue { public E remove() { if (_size==0) throw new NoSuchElementException(); @SuppressWarnings("unchecked") E e = (E)_array[_first]; ++_first; if (_first==_length) _first = 0; --_size; if (_size*3<_length) resize(_size*2); return e; } ArrayQueue(); ArrayQueue(int capacity); void add(E e); E first()... |
### Question:
AtomicFloat extends Number implements java.io.Serializable { public final float get() { return f(_ai.get()); } AtomicFloat(); AtomicFloat(float value); final float get(); final void set(float value); final float getAndSet(float value); final boolean compareAndSet(float expect, float update); final boolea... |
### Question:
AtomicFloat extends Number implements java.io.Serializable { public final void set(float value) { _ai.set(i(value)); } AtomicFloat(); AtomicFloat(float value); final float get(); final void set(float value); final float getAndSet(float value); final boolean compareAndSet(float expect, float update); fina... |
### Question:
AtomicFloat extends Number implements java.io.Serializable { public final float addAndGet(float delta) { for (;;) { int iexpect = _ai.get(); float expect = f(iexpect); float update = expect+delta; int iupdate = i(update); if (_ai.compareAndSet(iexpect,iupdate)) return update; } } AtomicFloat(); AtomicFlo... |
### Question:
CleanFormatter extends Formatter { @Override public synchronized String format(LogRecord record) { String message = formatMessage(record); if (message == null) return null; if (message.length() == 0) return message; message = Localize.filter(message, record.getResourceBundle()); if (message.endsWith("\\")... |
### Question:
AtomicFloat extends Number implements java.io.Serializable { public final boolean compareAndSet(float expect, float update) { return _ai.compareAndSet(i(expect),i(update)); } AtomicFloat(); AtomicFloat(float value); final float get(); final void set(float value); final float getAndSet(float value); final... |
### Question:
AtomicFloat extends Number implements java.io.Serializable { public final boolean weakCompareAndSet(float expect, float update) { return _ai.weakCompareAndSet(i(expect),i(update)); } AtomicFloat(); AtomicFloat(float value); final float get(); final void set(float value); final float getAndSet(float value... |
### Question:
AtomicFloat extends Number implements java.io.Serializable { public final float incrementAndGet() { return addAndGet(1.0f); } AtomicFloat(); AtomicFloat(float value); final float get(); final void set(float value); final float getAndSet(float value); final boolean compareAndSet(float expect, float update... |
### Question:
AtomicFloat extends Number implements java.io.Serializable { public final float decrementAndGet() { return addAndGet(-1.0f); } AtomicFloat(); AtomicFloat(float value); final float get(); final void set(float value); final float getAndSet(float value); final boolean compareAndSet(float expect, float updat... |
### Question:
AtomicFloat extends Number implements java.io.Serializable { public final float getAndIncrement() { return getAndAdd(1.0f); } AtomicFloat(); AtomicFloat(float value); final float get(); final void set(float value); final float getAndSet(float value); final boolean compareAndSet(float expect, float update... |
### Question:
AtomicFloat extends Number implements java.io.Serializable { public final float getAndDecrement() { return getAndAdd(-1.0f); } AtomicFloat(); AtomicFloat(float value); final float get(); final void set(float value); final float getAndSet(float value); final boolean compareAndSet(float expect, float updat... |
### Question:
AtomicFloat extends Number implements java.io.Serializable { public final float getAndSet(float value) { return f(_ai.getAndSet(i(value))); } AtomicFloat(); AtomicFloat(float value); final float get(); final void set(float value); final float getAndSet(float value); final boolean compareAndSet(float expe... |
### Question:
AtomicDouble extends Number implements java.io.Serializable { public final double get() { return d(_al.get()); } AtomicDouble(); AtomicDouble(double value); final double get(); final void set(double value); final double getAndSet(double value); final boolean compareAndSet(double expect, double update); f... |
### Question:
AtomicDouble extends Number implements java.io.Serializable { public final void set(double value) { _al.set(l(value)); } AtomicDouble(); AtomicDouble(double value); final double get(); final void set(double value); final double getAndSet(double value); final boolean compareAndSet(double expect, double up... |
### Question:
CleanFormatter extends Formatter { public static String prependToLines(String prepend, String lines) { if (lines == null) return null; if (prepend == null) return lines; StringBuilder result = new StringBuilder(); boolean hasFinalNL = lines.endsWith(NL); StringTokenizer divided = new StringTokenizer(lines... |
### Question:
AtomicDouble extends Number implements java.io.Serializable { public final double addAndGet(double delta) { for (;;) { long lexpect = _al.get(); double expect = d(lexpect); double update = expect+delta; long lupdate = l(update); if (_al.compareAndSet(lexpect,lupdate)) return update; } } AtomicDouble(); A... |
### Question:
AtomicDouble extends Number implements java.io.Serializable { public final boolean compareAndSet(double expect, double update) { return _al.compareAndSet(l(expect),l(update)); } AtomicDouble(); AtomicDouble(double value); final double get(); final void set(double value); final double getAndSet(double val... |
### Question:
AtomicDouble extends Number implements java.io.Serializable { public final boolean weakCompareAndSet(double expect, double update) { return _al.weakCompareAndSet(l(expect),l(update)); } AtomicDouble(); AtomicDouble(double value); final double get(); final void set(double value); final double getAndSet(do... |
### Question:
AtomicDouble extends Number implements java.io.Serializable { public final double incrementAndGet() { return addAndGet(1.0); } AtomicDouble(); AtomicDouble(double value); final double get(); final void set(double value); final double getAndSet(double value); final boolean compareAndSet(double expect, dou... |
### Question:
AtomicDouble extends Number implements java.io.Serializable { public final double decrementAndGet() { return addAndGet(-1.0); } AtomicDouble(); AtomicDouble(double value); final double get(); final void set(double value); final double getAndSet(double value); final boolean compareAndSet(double expect, do... |
### Question:
AtomicDouble extends Number implements java.io.Serializable { public final double getAndIncrement() { return getAndAdd(1.0); } AtomicDouble(); AtomicDouble(double value); final double get(); final void set(double value); final double getAndSet(double value); final boolean compareAndSet(double expect, dou... |
### Question:
AtomicDouble extends Number implements java.io.Serializable { public final double getAndDecrement() { return getAndAdd(-1.0); } AtomicDouble(); AtomicDouble(double value); final double get(); final void set(double value); final double getAndSet(double value); final boolean compareAndSet(double expect, do... |
### Question:
AtomicDouble extends Number implements java.io.Serializable { public final double getAndSet(double value) { return d(_al.getAndSet(l(value))); } AtomicDouble(); AtomicDouble(double value); final double get(); final void set(double value); final double getAndSet(double value); final boolean compareAndSet(... |
### Question:
Localize { public Localize(final Class<?> clazz) { this(clazz, null); } Localize(final Class<?> clazz); Localize(final Class<?> clazz, final String resourceBundleName); Localize(final Class<?> clazz, final String resourceBundleName, final Locale locale); String format(final String key, final Object... a... |
### Question:
Localize { public static String getMessage(final Throwable throwable) { if (throwable.getCause() == null) { final String localizedMessage = throwable.getLocalizedMessage(); if (localizedMessage != null) { return localizedMessage; } final String message = throwable.getMessage(); if (message != null) { retu... |
### Question:
RTree extends AbstractSet<Object> { public Iterator<Object> iterator() { return new RTreeIterator(); } RTree(int ndim, int nmin, int nmax); RTree(int ndim, int nmin, int nmax, Boxer boxer); int size(); void clear(); boolean isEmpty(); boolean add(Object object); int addPacked(Object[] objects); boolean r... |
### Question:
Localize { public static String timeWords(long seconds) { if (seconds == 0) { return filter("0 ${seconds}", Localize.class); } String result = ""; long minutes = seconds/60; long hours = minutes/60; long days = hours/24; seconds %= 60; minutes %= 60; hours %= 24; if (days >= 10) { if (hours >=12) ++days; ... |
### Question:
Almost implements Serializable, Comparator<Number> { public double divide(final double top, final double bottom, final boolean limitIsOne) { return divide(top, bottom, (limitIsOne) ? 1.0 : 0.0); } Almost(); Almost(final double epsilon, final double minValue); Almost(final double epsilon); Almost(int si... |
### Question:
Almost implements Serializable, Comparator<Number> { public double reciprocal(final double value) { return divide(1.0, value, 0.0); } Almost(); Almost(final double epsilon, final double minValue); Almost(final double epsilon); Almost(int significantDigits); Almost(final boolean isDouble); double getEp... |
### Question:
Almost implements Serializable, Comparator<Number> { public boolean between(final double x, final double x1, final double x2) { return ((cmp(x, x1) * cmp(x, x2)) <= 0); } Almost(); Almost(final double epsilon, final double minValue); Almost(final double epsilon); Almost(int significantDigits); Almost(... |
### Question:
Almost implements Serializable, Comparator<Number> { public int outside(final double x, final double x1, final double x2) { int i = 0; if (between(x, x1, x2)) { i = 0; } else if (between(x1, x, x2)) { i = -1; } else if (between(x2, x, x1)) { i = 1; } return i; } Almost(); Almost(final double epsilon, fin... |
### Question:
Almost implements Serializable, Comparator<Number> { @Override public int compare(final Number n1, final Number n2) { return cmp(n1.doubleValue(), n2.doubleValue()); } Almost(); Almost(final double epsilon, final double minValue); Almost(final double epsilon); Almost(int significantDigits); Almost(fin... |
### Question:
Almost implements Serializable, Comparator<Number> { public boolean zero(double r) { if (r < 0.0) { r = -r; } return (r < _minValue); } Almost(); Almost(final double epsilon, final double minValue); Almost(final double epsilon); Almost(int significantDigits); Almost(final boolean isDouble); double get... |
### Question:
Almost implements Serializable, Comparator<Number> { public double getEpsilon() { return _epsilon; } Almost(); Almost(final double epsilon, final double minValue); Almost(final double epsilon); Almost(int significantDigits); Almost(final boolean isDouble); double getEpsilon(); double getMinValue(); bo... |
### Question:
Almost implements Serializable, Comparator<Number> { public double getMinValue() { return _minValue; } Almost(); Almost(final double epsilon, final double minValue); Almost(final double epsilon); Almost(int significantDigits); Almost(final boolean isDouble); double getEpsilon(); double getMinValue(); ... |
### Question:
ArgsParser { public static boolean toBoolean(String s) throws OptionException { s = s.toLowerCase(); if (s.equals("true")) return true; if (s.equals("false")) return false; throw new OptionException("the value "+s+" is not a valid boolean"); } ArgsParser(String[] args, String shortOpts); ArgsParser(Strin... |
### Question:
Almost implements Serializable, Comparator<Number> { public boolean equal(final double r1, final double r2) { return (cmp(r1, r2) == 0); } Almost(); Almost(final double epsilon, final double minValue); Almost(final double epsilon); Almost(int significantDigits); Almost(final boolean isDouble); double ... |
### Question:
ParameterSet implements Cloneable, Externalizable { public Object clone() throws CloneNotSupportedException { try { ParameterSet ps = (ParameterSet)super.clone(); ps._parent = null; ps._pars = new LinkedHashMap<String, Parameter>(); ps._parsets = new LinkedHashMap<String, ParameterSet>(); return ps.replac... |
### Question:
UnitSphereSampling { private static void testSymmetry(UnitSphereSampling uss) { int mi = uss.getMaxIndex(); for (int i=1,j=-i; i<=mi; ++i,j=-i) { float[] p = uss.getPoint(i); float[] q = uss.getPoint(j); assert p[0]==-q[0]; assert p[1]==-q[1]; assert p[2]==-q[2]; } int npoint = 10000; for (int ipoint=0; i... |
### Question:
UnitSphereSampling { private static void testInterpolation(UnitSphereSampling uss) { int mi = uss.getMaxIndex(); int nf = 1+2*mi; float[] fi = new float[nf]; for (int i=1; i<=mi; ++i) { float[] p = uss.getPoint( i); float[] q = uss.getPoint(-i); fi[i ] = func(p[0],p[1],p[2]); fi[nf-i] = func(q[0],q[1],q[2... |
### Question:
UnitSphereSampling { private static void testTriangle(UnitSphereSampling uss) { int npoint = 1000000; for (int ipoint=0; ipoint<npoint; ++ipoint) { float[] p = randomPoint(); int i = uss.getIndex(p); int[] abc = uss.getTriangle(p); int ia = abc[0], ib = abc[1], ic = abc[2]; float[] q = uss.getPoint(i); fl... |
### Question:
ArgsParser { public static double toDouble(String s) throws OptionException { try { return Double.valueOf(s); } catch (NumberFormatException e) { throw new OptionException("the value "+s+" is not a valid double"); } } ArgsParser(String[] args, String shortOpts); ArgsParser(String[] args, String shortOpts... |
### Question:
ArgsParser { public static float toFloat(String s) throws OptionException { try { return Float.valueOf(s); } catch (NumberFormatException e) { throw new OptionException("the value "+s+" is not a valid float"); } } ArgsParser(String[] args, String shortOpts); ArgsParser(String[] args, String shortOpts, St... |
### Question:
ArgsParser { public static int toInt(String s) throws OptionException { try { return Integer.parseInt(s); } catch (NumberFormatException e) { throw new OptionException("the value "+s+" is not a valid int"); } } ArgsParser(String[] args, String shortOpts); ArgsParser(String[] args, String shortOpts, Strin... |
### Question:
BrentMinFinder { public double findMin(double a, double b, double tol) { double x = a+GSI*(b-a); double v = x; double w = x; double fx = f(x); double fv = fx; double fw = fx; double d = 0.0; double e = 0.0; for (double xm = 0.5*(a+b), tol1 = EPS*abs(x)+tol/3.0, tol2 = 2.0*tol1; abs(x-xm) > tol2-0.5*(b-a);... |
### Question:
ArgsParser { public static long toLong(String s) throws OptionException { try { return Long.parseLong(s); } catch (NumberFormatException e) { throw new OptionException("the value "+s+" is not a valid long"); } } ArgsParser(String[] args, String shortOpts); ArgsParser(String[] args, String shortOpts, Stri... |
### Question:
BrentZeroFinder { public double findZero(double a, double b, double tol) { double fa = _f.evaluate(a); double fb = _f.evaluate(b); return findZero(a,fa,b,fb,tol); } BrentZeroFinder(Function f); double f(double x); double findZero(double a, double b, double tol); double findZero(
double a, double fa, d... |
### Question:
BoundingBoxTree { public Node getRoot() { return _root; } BoundingBoxTree(int minSize, float[] xyz); BoundingBoxTree(int minSize, float[] x, float[] y, float[] z); Node getRoot(); }### Answer:
@Test public void testRandom() { int minSize = 10; int n = 10000; float[] x = randfloat(n); float[] y = randflo... |
### Question:
DMatrixChd { public double det() { return _det; } DMatrixChd(DMatrix a); boolean isPositiveDefinite(); DMatrix getL(); double det(); DMatrix solve(DMatrix b); }### Answer:
@Test public void testSimple() { DMatrix a = new DMatrix(new double[][]{ {1.0, 1.0}, {1.0, 4.0}, }); test(a); DMatrixChd chd = new DM... |
### Question:
DMatrixLud { public double det() { Check.argument(_m==_n,"A is square"); return _det; } DMatrixLud(DMatrix a); boolean isSingular(); DMatrix getL(); DMatrix getU(); DMatrix getP(); int[] getPivotIndices(); double det(); DMatrix solve(DMatrix b); }### Answer:
@Test public void testSimple() { DMatrix a = n... |
### Question:
DMatrixQrd { public boolean isFullRank() { for (int j=0; j<_n; ++j) { if (_qr[j+j*_m]==0.0) return false; } return true; } DMatrixQrd(DMatrix a); boolean isFullRank(); DMatrix getQ(); DMatrix getR(); DMatrix solve(DMatrix b); }### Answer:
@Test public void testRankDeficient() { DMatrix a = new DMatrix(ne... |
### Question:
DMatrixSvd { public double cond() { return _s[0]/_s[_mn-1]; } DMatrixSvd(DMatrix a); DMatrix getU(); DMatrix getS(); double[] getSingularValues(); DMatrix getV(); DMatrix getVTranspose(); double norm2(); double cond(); int rank(); }### Answer:
@Test public void testCond() { DMatrix a = new DMatrix(new do... |
### Question:
ArgsParser { public ArgsParser(String[] args, String shortOpts) throws OptionException { _args = args; _shortOpts = shortOpts; _longOpts = new String[0]; init(); } ArgsParser(String[] args, String shortOpts); ArgsParser(String[] args, String shortOpts, String[] longOpts); String[] getOptions(); String[] ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.