_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q179100
SqliteReal.isTypeOf
test
boolean isTypeOf(TypeMirror typeMirror) { if (realKinds.contains(typeMirror.getKind())) { return true; } if (realObjects.contains(typeMirror.toString())) { return true; } return false; }
java
{ "resource": "" }
q179101
OrderByBuilder.descending
test
public Builder<T> descending() { this.query.append(" DESC"); return new Builder<T>(shillelagh, tableObject, query); }
java
{ "resource": "" }
q179102
OneWireTemperatureSensor.readTemperature
test
public float readTemperature() throws IOException { byte[] encoded = Files.readAllBytes(new File(deviceFile, "w1_slave").toPath()); String tmp = new String(encoded); int tmpIndex = tmp.indexOf("t="); if (tmpIndex < 0) { throw new IOException("Could not read temperature!"); } ...
java
{ "resource": "" }
q179103
CursorFunctions.get
test
public static String get(String type) { final String returnValue = SUPPORTED_CURSOR_METHODS.get(type); return returnValue != null ? returnValue : SUPPORTED_CURSOR_METHODS.get(BLOB); }
java
{ "resource": "" }
q179104
ShillelaghLogger.n
test
void n(String message, Object... args) { messenger.printMessage(NOTE, formatString(message, args)); }
java
{ "resource": "" }
q179105
ShillelaghLogger.e
test
void e(String message, Object... args) { messenger.printMessage(ERROR, formatString(message, args)); }
java
{ "resource": "" }
q179106
Bundle.getIconFonts
test
public static List<IconFont> getIconFonts() { List<IconFont> list = new ArrayList<>(); list.add(GoogleMaterialDesignIcons.getIconFont()); list.add(Elusive.getIconFont()); list.add(Entypo.getIconFont()); list.add(FontAwesome.getIconFont()); list.add(Iconic.getIconFont()); ...
java
{ "resource": "" }
q179107
Bundle.getIcons
test
public static List<IconCode> getIcons() { List<IconCode> list = new ArrayList<>(); for (IconCode icon : GoogleMaterialDesignIcons.values()) { list.add(icon); } for (IconCode icon : Elusive.values()) { list.add(icon); } for (IconCode icon : Entypo....
java
{ "resource": "" }
q179108
SldEditorWidgetViewImpl.createSldEditorLayout
test
public VLayout createSldEditorLayout() { final VLayout vLayout = new VLayout(); toolStrip = new ToolStrip(); toolStrip.setWidth100(); codeMirrorPanel = new CodeMirrorPanel(); WidgetCanvas canvas = new WidgetCanvas(codeMirrorPanel); canvas.setWidth100(); canvas.setHeight100(); vLayout.addMember(toolS...
java
{ "resource": "" }
q179109
SldEditorPanel.getBackgroundDecoration
test
private HTMLFlow getBackgroundDecoration() { // Show some background content in the tab. HTMLFlow htmlFlow = new HTMLFlow(); htmlFlow.setWidth100(); htmlFlow.setHeight100(); String contents = "<div style='margin-left: 5px; font-size: 100pt; font-weight: bold; color:#DDFFDD'>GEOMAJAS</div>" + "<div styl...
java
{ "resource": "" }
q179110
IntPower.raise
test
public static double raise (final double px, final int pexponent) { double x = px; int exponent = pexponent; if (exponent < 0) return 1 / raise (x, -exponent); double power = 1; // Loop to compute x^exponent. while (exponent > 0) { // Is the rightmost exponent bit a 1? ...
java
{ "resource": "" }
q179111
ColumnVector.set
test
protected void set (final float values[]) { this.m_nRows = values.length; this.m_nCols = 1; this.m_aValues = new float [m_nRows] [1]; for (int r = 0; r < m_nRows; ++r) { this.m_aValues[r][0] = values[r]; } }
java
{ "resource": "" }
q179112
BigFunctions.intPower
test
public static BigDecimal intPower (@Nonnull final BigDecimal px, final long pexponent, final int scale) { BigDecimal x = px; long exponent = pexponent; // If the exponent is negative, compute 1/(x^-exponent). if (exponent < 0) { return BigDecimal.ONE.divide (intPower (x, -exponent, scale), ...
java
{ "resource": "" }
q179113
BigFunctions.intRoot
test
public static BigDecimal intRoot (@Nonnull final BigDecimal px, final long index, final int scale) { BigDecimal x = px; // Check that x >= 0. if (x.signum () < 0) { throw new IllegalArgumentException ("x < 0: " + x); } final int sp1 = scale + 1; final BigDecimal n = x; final Bi...
java
{ "resource": "" }
q179114
BigFunctions._expTaylor
test
private static BigDecimal _expTaylor (final BigDecimal x, final int scale) { BigDecimal factorial = BigDecimal.ONE; BigDecimal xPower = x; BigDecimal sumPrev; // 1 + x BigDecimal sum = x.add (BigDecimal.ONE); // Loop until the sums converge // (two successive sums are equal after roundin...
java
{ "resource": "" }
q179115
BigFunctions.ln
test
public static BigDecimal ln (@Nonnull final BigDecimal x, final int scale) { // Check that x > 0. if (x.signum () <= 0) { throw new IllegalArgumentException ("x <= 0: " + x); } // The number of digits to the left of the decimal point. final int magnitude = x.toString ().length () - x.sc...
java
{ "resource": "" }
q179116
BigFunctions._lnNewton
test
private static BigDecimal _lnNewton (@Nonnull final BigDecimal px, final int scale) { BigDecimal x = px; final int sp1 = scale + 1; final BigDecimal n = x; BigDecimal term; // Convergence tolerance = 5*(10^-(scale+1)) final BigDecimal tolerance = BigDecimal.valueOf (5).movePointLeft (sp1); ...
java
{ "resource": "" }
q179117
BigFunctions.arctan
test
public static BigDecimal arctan (@Nonnull final BigDecimal x, final int scale) { // Check that |x| < 1. if (x.abs ().compareTo (BigDecimal.ONE) >= 0) { throw new IllegalArgumentException ("|x| >= 1: " + x); } // If x is negative, return -arctan(-x). if (x.signum () == -1) { re...
java
{ "resource": "" }
q179118
BigFunctions._arctanTaylor
test
private static BigDecimal _arctanTaylor (final BigDecimal x, final int scale) { final int sp1 = scale + 1; int i = 3; boolean addFlag = false; BigDecimal power = x; BigDecimal sum = x; BigDecimal term; // Convergence tolerance = 5*(10^-(scale+1)) final BigDecimal tolerance = BigDecim...
java
{ "resource": "" }
q179119
BigFunctions.sqrt
test
public static BigDecimal sqrt (@Nonnull final BigDecimal x, final int scale) { // Check that x >= 0. if (x.signum () < 0) { throw new IllegalArgumentException ("x < 0: " + x); } // n = x*(10^(2*scale)) final BigInteger n = x.movePointRight (scale << 1).toBigInteger (); // The first...
java
{ "resource": "" }
q179120
AbstractPiFormula.printPi
test
protected void printPi (final String piString) { System.out.print ("\npi = " + piString.substring (0, 2)); int index = 2; int line = 0; int group = 0; final int length = piString.length (); // Loop for each group of 5 digits while (index + 5 < length) { System.out.print (piStri...
java
{ "resource": "" }
q179121
AbstractPiFormula.timestamp
test
protected String timestamp (final long time) { // Current time followed by elapsed time as (hh:mm:ss). final LocalDateTime aLDT = PDTFactory.getCurrentLocalDateTime (); final LocalDateTime aOld = PDTFactory.createLocalDateTime (time); return aLDT.toLocalTime ().toString () + " (" + Duration.between (...
java
{ "resource": "" }
q179122
Buckets.setLimits
test
public void setLimits (final float rMin, final float rMax) { this.m_fMin = rMin; this.m_fMax = rMax; this.m_fWidth = (rMax - rMin) / m_n; }
java
{ "resource": "" }
q179123
Buckets.put
test
public void put (final float r) { // Ignore the value if it's out of range. if ((r < m_fMin) || (r > m_fMax)) return; // Determine its interval and count it. final int i = (int) ((r - m_fMin) / m_fWidth); ++m_aCounters[i]; }
java
{ "resource": "" }
q179124
Buckets.print
test
public void print () { // Get the longest bar's length. int maxCount = 0; for (int i = 0; i < m_n; ++i) { maxCount = Math.max (maxCount, m_aCounters[i]); } // Compute the scaling factor. final float factor = ((float) MAX_BAR_SIZE) / maxCount; // Loop to print each bar. for ...
java
{ "resource": "" }
q179125
Complex.add
test
public Complex add (final Complex z) { return new Complex (m_fReal + z.real (), m_fImaginary + z.imaginary ()); }
java
{ "resource": "" }
q179126
Complex.subtract
test
public Complex subtract (final Complex z) { return new Complex (m_fReal - z.real (), m_fImaginary - z.imaginary ()); }
java
{ "resource": "" }
q179127
Complex.multiply
test
public Complex multiply (final Complex z) { return new Complex (m_fReal * z.real () - m_fImaginary * z.imaginary (), m_fReal * z.imaginary () + m_fImaginary * z.real ()); }
java
{ "resource": "" }
q179128
Complex.divide
test
public Complex divide (final Complex z) { final float denom = z.real () * z.real () + z.imaginary () * z.imaginary (); final float qr = (m_fReal * z.real () + m_fImaginary * z.imaginary ()) / denom; final float qi = (m_fImaginary * z.real () - m_fReal * z.imaginary ()) / denom; return new Complex (qr...
java
{ "resource": "" }
q179129
RowVector._set
test
private void _set (final Matrix m) { m_nRows = 1; m_nCols = m.m_nCols; m_aValues = m.m_aValues; }
java
{ "resource": "" }
q179130
Matrix.getRow
test
public RowVector getRow (final int r) throws MatrixException { if ((r < 0) || (r >= m_nRows)) { throw new MatrixException (MatrixException.INVALID_INDEX); } final RowVector rv = new RowVector (m_nCols); for (int c = 0; c < m_nCols; ++c) { rv.m_aValues[0][c] = m_aValues[r][c]; ...
java
{ "resource": "" }
q179131
Matrix.getColumn
test
public ColumnVector getColumn (final int c) throws MatrixException { if ((c < 0) || (c >= m_nCols)) { throw new MatrixException (MatrixException.INVALID_INDEX); } final ColumnVector cv = new ColumnVector (m_nRows); for (int r = 0; r < m_nRows; ++r) { cv.m_aValues[r][0] = m_aValues...
java
{ "resource": "" }
q179132
Matrix.set
test
protected void set (final float values[][]) { m_nRows = values.length; m_nCols = values[0].length; m_aValues = values; for (int r = 1; r < m_nRows; ++r) { m_nCols = Math.min (m_nCols, values[r].length); } }
java
{ "resource": "" }
q179133
Matrix.transpose
test
public Matrix transpose () { final float tv[][] = new float [m_nCols] [m_nRows]; // transposed values // Set the values of the transpose. for (int r = 0; r < m_nRows; ++r) { for (int c = 0; c < m_nCols; ++c) { tv[c][r] = m_aValues[r][c]; } } return new Matrix (tv); ...
java
{ "resource": "" }
q179134
Matrix.add
test
public Matrix add (final Matrix m) throws MatrixException { // Validate m's size. if ((m_nRows != m.m_nRows) && (m_nCols != m.m_nCols)) { throw new MatrixException (MatrixException.INVALID_DIMENSIONS); } final float sv[][] = new float [m_nRows] [m_nCols]; // sum values // Compute value...
java
{ "resource": "" }
q179135
Matrix.subtract
test
public Matrix subtract (final Matrix m) throws MatrixException { // Validate m's size. if ((m_nRows != m.m_nRows) && (m_nCols != m.m_nCols)) { throw new MatrixException (MatrixException.INVALID_DIMENSIONS); } final float dv[][] = new float [m_nRows] [m_nCols]; // difference values // C...
java
{ "resource": "" }
q179136
Matrix.multiply
test
public Matrix multiply (final float k) { final float pv[][] = new float [m_nRows] [m_nCols]; // product values // Compute values of the product. for (int r = 0; r < m_nRows; ++r) { for (int c = 0; c < m_nCols; ++c) { pv[r][c] = k * m_aValues[r][c]; } } return new Ma...
java
{ "resource": "" }
q179137
Matrix.multiply
test
public Matrix multiply (final Matrix m) throws MatrixException { // Validate m's dimensions. if (m_nCols != m.m_nRows) { throw new MatrixException (MatrixException.INVALID_DIMENSIONS); } final float pv[][] = new float [m_nRows] [m.m_nCols]; // product values // Compute values of the pr...
java
{ "resource": "" }
q179138
Matrix.print
test
public void print (final int width, @Nonnull final PrintStream aPS) { final SystemOutAlignRight ar = new SystemOutAlignRight (aPS); for (int r = 0; r < m_nRows; ++r) { ar.print ("Row ", 0); ar.print (r + 1, 2); ar.print (":", 0); for (int c = 0; c < m_nCols; ++c) { ...
java
{ "resource": "" }
q179139
SldEditorToolBarButton.setResource
test
public void setResource(ImageResource imageResource) { Image img = new Image(imageResource); DOM.insertChild(getElement(), img.getElement(), 0); }
java
{ "resource": "" }
q179140
RegressionLine._validateCoefficients
test
private void _validateCoefficients () { if (m_bCoefsValid) return; if (m_nDataPoints >= 2) { final float xBar = (float) m_dSumX / m_nDataPoints; final float yBar = (float) m_dSumY / m_nDataPoints; m_fA1 = (float) ((m_nDataPoints * m_dSumXY - m_dSumX * m_dSumY) / (m_nDataPoints * ...
java
{ "resource": "" }
q179141
FixedPointRootFinder.computeNextPosition
test
@Override protected void computeNextPosition () { m_fPrevXn = m_fXn; m_fXn = m_fGn; m_fGn = m_aFunction.at (m_fXn); }
java
{ "resource": "" }
q179142
SldModelImpl.clear
test
public void clear() { rawSld = new RawSld(); dirty = false; valid = false; template = null; sldDescriptor = null; }
java
{ "resource": "" }
q179143
InMemorySldServiceImpl.toXml
test
public RawSld toXml(StyledLayerDescriptorInfo sldi) throws SldException { try { if (sldi.getVersion() == null) { sldi.setVersion("1.0.0"); } return parseSldI(sldi); } catch (JiBXException e) { throw new SldException("Validation error", e); } }
java
{ "resource": "" }
q179144
InMemorySldServiceImpl.toSldI
test
public StyledLayerDescriptorInfo toSldI(RawSld sld) throws SldException { try { return parseXml(sld.getName(), sld.getXml()); } catch (JiBXException e) { throw new SldException("Validation error", e); } }
java
{ "resource": "" }
q179145
InMemorySldServiceImpl.validate
test
public void validate(StyledLayerDescriptorInfo sld) throws SldException { try { parseSldI(sld); } catch (JiBXException e) { throw new SldException("Validation error", e); } }
java
{ "resource": "" }
q179146
InMemorySldServiceImpl.validate
test
public boolean validate(RawSld sld) throws SldException { try { parseXml("", sld.getXml()); return true; } catch (JiBXException e) { return false; } }
java
{ "resource": "" }
q179147
TrapezoidalIntegrator._areaOf
test
private float _areaOf (final float x1, final float h) { final float x2 = x1 + h; // right bound of the region final float y1 = m_aIntegrand.at (x1); // value at left bound final float y2 = m_aIntegrand.at (x2); // value at right bound final float area = h * (y1 + y2) / 2; // area of the region re...
java
{ "resource": "" }
q179148
SquareMatrix._set
test
private void _set (final Matrix m) { this.m_nRows = this.m_nCols = Math.min (m.m_nRows, m.m_nCols); this.m_aValues = m.m_aValues; }
java
{ "resource": "" }
q179149
SquareMatrix.set
test
@Override protected void set (final float values[][]) { super.set (values); m_nRows = m_nCols = Math.min (m_nRows, m_nCols); }
java
{ "resource": "" }
q179150
InvertibleMatrix.inverse
test
public InvertibleMatrix inverse () throws MatrixException { final InvertibleMatrix inverse = new InvertibleMatrix (m_nRows); final IdentityMatrix identity = new IdentityMatrix (m_nRows); // Compute each column of the inverse matrix // using columns of the identity matrix. for (int c = 0; c < m_nC...
java
{ "resource": "" }
q179151
InvertibleMatrix.determinant
test
public float determinant () throws MatrixException { decompose (); // Each row exchange during forward elimination flips the sign // of the determinant, so check for an odd number of exchanges. float determinant = ((m_nExchangeCount & 1) == 0) ? 1 : -1; // Form the product of the diagonal elemen...
java
{ "resource": "" }
q179152
InvertibleMatrix.norm
test
public float norm () { float sum = 0; for (int r = 0; r < m_nRows; ++r) { for (int c = 0; c < m_nCols; ++c) { final float v = m_aValues[r][c]; sum += v * v; } } return (float) Math.sqrt (sum); }
java
{ "resource": "" }
q179153
LinearSystem.solve
test
public ColumnVector solve (final ColumnVector b, final boolean improve) throws MatrixException { // Validate b's size. if (b.m_nRows != m_nRows) { throw new MatrixException (MatrixException.INVALID_DIMENSIONS); } decompose (); // Solve Ly = b for y by forward substitution. // Solve...
java
{ "resource": "" }
q179154
LinearSystem.printDecomposed
test
public void printDecomposed (final int width, @Nonnull final PrintStream aPS) throws MatrixException { decompose (); final SystemOutAlignRight ar = new SystemOutAlignRight (aPS); for (int r = 0; r < m_nRows; ++r) { final int pr = m_aPermutation[r]; // permuted row index ar.print ("Row ",...
java
{ "resource": "" }
q179155
LinearSystem._forwardElimination
test
private void _forwardElimination (final float scales[]) throws MatrixException { // Loop once per pivot row 0..nRows-1. for (int rPivot = 0; rPivot < m_nRows - 1; ++rPivot) { float largestScaledElmt = 0; int rLargest = 0; // Starting from the pivot row rPivot, look down // column ...
java
{ "resource": "" }
q179156
LinearSystem._forwardSubstitution
test
private ColumnVector _forwardSubstitution (final ColumnVector b) throws MatrixException { final ColumnVector y = new ColumnVector (m_nRows); // Do forward substitution. for (int r = 0; r < m_nRows; ++r) { final int pr = m_aPermutation[r]; // permuted row index float dot = 0; for (in...
java
{ "resource": "" }
q179157
LinearSystem._backSubstitution
test
private ColumnVector _backSubstitution (final ColumnVector y) throws MatrixException { final ColumnVector x = new ColumnVector (m_nRows); // Do back substitution. for (int r = m_nRows - 1; r >= 0; --r) { final int pr = m_aPermutation[r]; // permuted row index float dot = 0; for (int...
java
{ "resource": "" }
q179158
LinearSystem._improve
test
private void _improve (final ColumnVector b, final ColumnVector x) throws MatrixException { // Find the largest x element. float largestX = 0; for (int r = 0; r < m_nRows; ++r) { final float absX = Math.abs (x.m_aValues[r][0]); if (largestX < absX) largestX = absX; } // Is...
java
{ "resource": "" }
q179159
IdentityMatrix.convert
test
public static void convert (final SquareMatrix sm) { for (int r = 0; r < sm.m_nRows; ++r) { for (int c = 0; c < sm.m_nCols; ++c) { sm.m_aValues[r][c] = (r == c) ? 1 : 0; } } }
java
{ "resource": "" }
q179160
RandomExponential.nextVonNeumann
test
public float nextVonNeumann () { int n; int k = 0; float u1; // Loop to try sequences of uniformly-distributed // random values. for (;;) { n = 1; u1 = GENERATOR.nextFloat (); float u = u1; float uPrev = Float.NaN; // Loop to generate a sequence of ramdom v...
java
{ "resource": "" }
q179161
RegulaFalsiRootFinder.doIterationProcedure
test
@Override protected void doIterationProcedure (final int n) { if (n == 1) return; // already initialized if (m_fFalse < 0) { m_fXNeg = m_fXFalse; // the root is in the xPos side m_fNeg = m_fFalse; } else { m_fXPos = m_fXFalse; // the root is in the xNeg side m_...
java
{ "resource": "" }
q179162
RegulaFalsiRootFinder.computeNextPosition
test
@Override protected void computeNextPosition () { m_fPrevXFalse = m_fXFalse; m_fXFalse = m_fXPos - m_fPos * (m_fXNeg - m_fXPos) / (m_fNeg - m_fPos); m_fFalse = m_aFunction.at (m_fXFalse); }
java
{ "resource": "" }
q179163
RegulaFalsiRootFinder.checkPosition
test
@Override protected void checkPosition () throws AbstractRootFinder.PositionUnchangedException { if (EqualsHelper.equals (m_fXFalse, m_fPrevXFalse)) { throw new AbstractRootFinder.PositionUnchangedException (); } }
java
{ "resource": "" }
q179164
ImprovedRegulaFalsiRootFinder.computeNextPosition
test
@Override protected void computeNextPosition () { m_fPrevXFalse = m_fXFalse; m_fPrevFFalse = m_fFalse; m_fXFalse = m_fXPos - m_fPos * (m_fXNeg - m_fXPos) / (m_fNeg - m_fPos); m_fFalse = m_aFunction.at (m_fXFalse); m_bDecreasePos = m_bDecreaseNeg = false; // If there was no sign change in f...
java
{ "resource": "" }
q179165
AbstractRootFinder.checkInterval
test
public void checkInterval (final float x1, final float x2) throws InvalidIntervalException { final float y1 = m_aFunction.at (x1); final float y2 = m_aFunction.at (x2); // The interval is invalid if y1 and y2 have the same signs. if (y1 * y2 > 0) throw new InvalidIntervalException (); }
java
{ "resource": "" }
q179166
KahanSummation.add
test
public void add (final float addend) { // Correct the addend value and add it to the running sum. m_fCorrectedAddend = addend + m_fCorrection; final float tempSum = m_fSum + m_fCorrectedAddend; // Compute the next correction and set the running sum. // The parentheses are necessary to compute the...
java
{ "resource": "" }
q179167
ModuloArithmetic.multiply
test
public static int multiply (final int pa, final int pb, final int m) { int a = pa; int b = pb; int product = 0; // Loop to compute product = (a*b)%m. while (a > 0) { // Does the rightmost bit of a == 1? if ((a & 1) == 1) { product += b; product %= m; }...
java
{ "resource": "" }
q179168
ModuloArithmetic.raise
test
public static int raise (final int pbase, final int pexponent, final int m) { int base = pbase; int exponent = pexponent; int power = 1; // Loop to compute power = (base^exponent)%m. while (exponent > 0) { // Does the rightmost bit of the exponent == 1? if ((exponent & 1) == 1) ...
java
{ "resource": "" }
q179169
SecantRootFinder.doIterationProcedure
test
@Override protected void doIterationProcedure (final int n) { if (n == 1) return; // already initialized // Use the latest two points. m_fXnm1 = m_fXn; // x[n-1] = x[n] m_fXn = m_fXnp1; // x[n] = x[n+1] m_fFnm1 = m_fFn; // f(x[n-1]) = f(x[n]) m_fFn = m_fFnp1; // f(x[n]) = f(x[n+1]) ...
java
{ "resource": "" }
q179170
SldEditor.getSldManager
test
public SldManager getSldManager() { if (sldManager == null) { sldManager = new SldManagerImpl(getEventBus(), getSldEditorServiceFactory().createSldGwtServiceAsync()); } return sldManager; }
java
{ "resource": "" }
q179171
IEEE754._toCharBitArray
test
private static char [] _toCharBitArray (final long pvalue, final int size) { long value = pvalue; final char bits[] = new char [size]; // Convert each bit from right to left. for (int i = size - 1; i >= 0; --i) { bits[i] = (value & 1) == 0 ? '0' : '1'; value >>>= 1; } return ...
java
{ "resource": "" }
q179172
IEEE754._decompose
test
private void _decompose (final char [] bits, final int bias, final int reserved, final int signIndex, final int signSize, final int exponentIndex, final int e...
java
{ "resource": "" }
q179173
IEEE754.print
test
public void print (@Nonnull final PrintStream aPW) { aPW.println ("------------------------------"); // Print the value. if (isDouble ()) aPW.println ("double value = " + doubleValue ()); else aPW.println ("float value = " + floatValue ()); // Print the sign. aPW.print ("sign=" +...
java
{ "resource": "" }
q179174
IEEE754.validateFloatBiasedExponent
test
public static void validateFloatBiasedExponent (final int biased) throws IEEE754Exception { if ((biased < 0) || (biased > IEEE754Constants.FLOAT_EXPONENT_RESERVED)) { throw new IEEE754Exception ("The biased exponent value should be " + "0 through " + ...
java
{ "resource": "" }
q179175
IEEE754.validateFloatUnbiasedExponent
test
public static void validateFloatUnbiasedExponent (final int unbiased) throws IEEE754Exception { if ((unbiased < -IEEE754Constants.FLOAT_EXPONENT_BIAS + 1) || (unbiased > IEEE754Constants.FLOAT_EXPONENT_BIAS)) { throw new IEEE754Exception ("The unbiased exponent value should be " + ...
java
{ "resource": "" }
q179176
IEEE754.validateDoubleBiasedExponent
test
public static void validateDoubleBiasedExponent (final int biased) throws IEEE754Exception { if ((biased < 0) || (biased > IEEE754Constants.DOUBLE_EXPONENT_RESERVED)) { throw new IEEE754Exception ("The biased exponent value should be " + "0 through " + ...
java
{ "resource": "" }
q179177
IEEE754.validateDoubleUnbiasedExponent
test
public static void validateDoubleUnbiasedExponent (final int unbiased) throws IEEE754Exception { if ((unbiased < -IEEE754Constants.DOUBLE_EXPONENT_BIAS + 1) || (unbiased > IEEE754Constants.DOUBLE_EXPONENT_BIAS)) { throw new IEEE754Exception ("The unbiased exponent value should be " + ...
java
{ "resource": "" }
q179178
SldEditorServiceFactory.createSldGwtServiceAsync
test
public SldGwtServiceAsync createSldGwtServiceAsync() { this.service = GWT.create(SldGwtService.class); ServiceDefTarget endpoint = (ServiceDefTarget) service; endpoint.setServiceEntryPoint(GWT.getHostPageBaseURL() + "d/sldTemplates"); return service; }
java
{ "resource": "" }
q179179
RandomNormal.nextCentral
test
public float nextCentral () { // Average 12 uniformly-distributed random values. float sum = 0.0f; for (int j = 0; j < 12; ++j) sum += GENERATOR.nextFloat (); // Subtract 6 to center about 0. return m_fStddev * (sum - 6) + m_fMean; }
java
{ "resource": "" }
q179180
RandomNormal.nextPolar
test
public float nextPolar () { // If there's a saved value, return it. if (m_bHaveNextPolar) { m_bHaveNextPolar = false; return m_fNextPolar; } // point coordinates and their radius float u1, u2, r; do { // u1 and u2 will be uniformly-distributed // random values...
java
{ "resource": "" }
q179181
RandomNormal.nextRatio
test
public float nextRatio () { float u, v, x, xx; do { // u and v are two uniformly-distributed random values // in [0, 1), and u != 0. while ((u = GENERATOR.nextFloat ()) == 0) { // try again if 0 } v = GENERATOR.nextFloat (); // y coord of point (u, y) ...
java
{ "resource": "" }
q179182
PrimeFactors.primeSieve
test
public static boolean [] primeSieve (final int n) { final int halfN = (n + 1) >> 1; final boolean sieve[] = new boolean [n + 1]; // Initialize every integer from 2 onwards to prime. for (int i = 2; i <= n; ++i) sieve[i] = true; int prime = 2; // first prime number // Loop to create th...
java
{ "resource": "" }
q179183
PrimeFactors.factorsOf
test
public static int [] factorsOf (final int pn) { int n = pn; final boolean isPrime[] = primeSieve (n); // primes <= n final ICommonsList <Integer> v = new CommonsArrayList<> (); // Loop to try prime divisors. for (int factor = 2; n > 1; ++factor) { if (isPrime[factor] && (n % factor == 0...
java
{ "resource": "" }
q179184
BisectionRootFinder.doIterationProcedure
test
@Override protected void doIterationProcedure (final int n) { if (n == 1) return; // already initialized if (m_fMid < 0) { m_fXNeg = m_fXMid; // the root is in the xPos half m_fNeg = m_fMid; } else { m_fXPos = m_fXMid; // the root is in the xNeg half m_fPos = m...
java
{ "resource": "" }
q179185
BisectionRootFinder.computeNextPosition
test
@Override protected void computeNextPosition () { m_fPrevXMid = m_fXMid; m_fXMid = (m_fXNeg + m_fXPos) / 2; m_fMid = m_aFunction.at (m_fXMid); }
java
{ "resource": "" }
q179186
BisectionRootFinder.checkPosition
test
@Override protected void checkPosition () throws AbstractRootFinder.PositionUnchangedException { if (EqualsHelper.equals (m_fXMid, m_fPrevXMid)) { throw new AbstractRootFinder.PositionUnchangedException (); } }
java
{ "resource": "" }
q179187
JavaFXExtension.setJavaFxApplication
test
public static void setJavaFxApplication(final CdiApplication javaFxApplication) { final CountDownLatch latch = new CountDownLatch(1); Platform.runLater(() -> { JAVA_FX_APPLICATION.set(javaFxApplication); latch.countDown(); }); if (!Platform.isFxApplicationThread...
java
{ "resource": "" }
q179188
Calabash.setConfiguration
test
public void setConfiguration(File configFile) { if (configFile == null) nextConfig = null; else try { XProcConfiguration config = new XProcConfiguration("he", false); nextConfig = config.getProcessor().newDocumentBuilder() .build(new SAXSource(new InputSource(new FileReader(configFile)))); } c...
java
{ "resource": "" }
q179189
Calabash.setDefaultConfiguration
test
public void setDefaultConfiguration(Reader defaultConfig) { XProcConfiguration config = new XProcConfiguration("he", false); try { nextDefaultConfig = config.getProcessor().newDocumentBuilder() .build(new SAXSource(new InputSource(defaultConfig))); } catch (SaxonApiException e) { throw new RuntimeExcept...
java
{ "resource": "" }
q179190
CdiFXMLLoaderFactory.initializeFXMLLoader
test
static void initializeFXMLLoader(final FXMLLoader fxmlLoader, final Class<?> targetClass, final String location, final String resources, final String charset) { checkAndSetLocation(fxmlLoader, targetClass, location); if (charset != null && !charset.equals(CHARSET_UNSPECIFIED)) { fxmlLoader....
java
{ "resource": "" }
q179191
ReverseGeocodeRequestBuilder.latlng
test
public ReverseGeocodeRequestBuilder latlng(Double lat, Double lng) { parameters.put("latlng", lat + "," + lng); return this; }
java
{ "resource": "" }
q179192
ServiceRegistryConfigurationProvider.getHostPortPair
test
public static InetSocketAddress getHostPortPair(Service svc) { try { return new InetSocketAddress(svc.getMetadata().get("service.host"), Integer.parseInt(svc.getMetadata().get("service.port"))); } catch (Exception e) { logger.error("Exception extracting metada...
java
{ "resource": "" }
q179193
AttrbuteFilterExpressionCollectionEvaluator.getApplicableAttributeDefinition
test
protected AttributeDefinition getApplicableAttributeDefinition(final UUID attributeDefinitionUuid, final List<AttributeDefinition> attributeDefinitions) { if (LOG.isTraceEnabled()) { LOG.entry(attributeDefinitionUuid, attributeDefinitions); } AttributeDefinition attributeDefinition = null; for (AttributeDefi...
java
{ "resource": "" }
q179194
AttrbuteFilterExpressionCollectionEvaluator.evaluate
test
protected boolean evaluate(final UUID attributeDefinitionUuid, final AttributeFilterExpression attributeFilter, final Map<UUID, String> eventAttributes, final List<AttributeDefinition> attributeDefinitions) throws ParseException { if (LOG.isTraceEnabled()) { LOG.entry(attributeDefinitionUuid, attributeFilter, even...
java
{ "resource": "" }
q179195
Utils.sanitizeTag
test
public static String sanitizeTag(String s) { // if > 55 chars, assume max entropy is at the end (like a class name). if (s.length() > MAX_TAG_LENGTH) { s = s.substring(s.length() - MAX_TAG_LENGTH); } return s; }
java
{ "resource": "" }
q179196
GeocodeRequestBuilder.address
test
public GeocodeRequestBuilder address(String address) { parameters.put("address", address != null ? address.replace(' ', '+') : address); return this; }
java
{ "resource": "" }
q179197
GeocodeRequestBuilder.componenets
test
public GeocodeRequestBuilder componenets(Map<String, String> components) { StringBuffer filters = new StringBuffer(); for (Iterator<Map.Entry<String, String>> iterator = components .entrySet().iterator(); iterator.hasNext();) { Map.Entry<String, String> entry = iterator.next(); filters.append(entry.getKey...
java
{ "resource": "" }
q179198
RSRServiceDiscoveryImpl.queryForNames
test
public Collection<String> queryForNames() throws Exception { Set<String> names = new HashSet<String>(); // todo: it would be better to do: // services = client.getServicesClient().list(options, typeTag); // but there are some validation problems (the tag is allowed to be written, but not...
java
{ "resource": "" }
q179199
RSRServiceDiscoveryImpl.queryForInstances
test
public Collection<ServiceInstance<T>> queryForInstances(String name) throws Exception { List<ServiceInstance<T>> serviceInstances = new ArrayList<ServiceInstance<T>>(); Iterator<Service> services = client.getServicesClient().list(new MethodOptions(100, null)); while (services.hasNext()) { ...
java
{ "resource": "" }