description
stringlengths
11
2.86k
focal_method
stringlengths
70
6.25k
test_case
stringlengths
96
15.3k
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p...
b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ...
@Test public void copyDirectBufferToNativeMemory() { final byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7}; final ByteBuffer buf = ByteBuffer.allocateDirect(bytes.length); buf.put(bytes).rewind(); assertEquals(8, buf.remaining()); final Pointer ptr = BufferUtils....
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p...
b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ...
@Test public void copySlicedDirectBufferToNativeMemory() { final byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7}; final byte[] slicedBytes = new byte[] {2, 3, 4, 5}; final ByteBuffer buf = ByteBuffer.allocateDirect(bytes.length); buf.put(bytes).rewind(); // slice...
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p...
b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ...
@Test public void copyNullFloatArrayToNativeMemory() { final float[] values = null; // test case final int offset = 0; final int length = 0; assertThrows( IllegalArgumentException.class, () -> BufferUtils.copyToNativeMemory(values, offset, len...
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p...
b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ...
@Test public void copyNegativeOffsetFloatArrayToNativeMemory() { final float[] values = new float[] {0f, 1f, 2f, 3f}; final int offset = -1; // test case final int length = values.length; assertThrows( ArrayIndexOutOfBoundsException.class, () ...
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p...
b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ...
@Test public void copyNegativeLengthFloatArrayToNativeMemory() { final float[] values = new float[] {0f, 1f, 2f, 3f}; final int offset = 0; final int length = -1; // test case assertThrows( IllegalArgumentException.class, () -> BufferUtils.cop...
["('/**\\\\n * Throws {@link MenohException} if the <code>errorCode</code> of a native Menoh function is\\\\n * non-zero. This method must be called right after the invocation because it uses <code>\\\\n * menoh_get_last_error_message</code>.\\\\n *\\\\n * @param errorCode an error code returned fro...
b'/**\n * Throws {@link MenohException} if the <code>errorCode</code> of a native Menoh function is\n * non-zero. This method must be called right after the invocation because it uses <code>\n * menoh_get_last_error_message</code>.\n *\n * @param errorCode an error code returned from the Menoh funct...
@Test public void checkErrorSuccess() { checkError(ErrorCode.SUCCESS.getId()); }
["('/**\\\\n * Loads an ONNX model from the specified file.\\\\n */', '')"]
b'/**\n * Loads an ONNX model from the specified file.\n */'public static ModelData fromOnnxFile(String onnxModelPath) throws MenohException { final PointerByReference handle = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_model_data_from_onnx(onnxModelPath, handle)); ...
@Test public void makeFromNonExistentOnnxFile() { MenohException e = assertThrows( MenohException.class, () -> ModelData.fromOnnxFile("__NON_EXISTENT_FILENAME__")); assertAll("non-existent onnx file", () -> assertEquals(ErrorCode.INVALID_FILENAME, e.getErrorCode(...
["('/**\\\\n * Loads an ONNX model from the specified file.\\\\n */', '')"]
b'/**\n * Loads an ONNX model from the specified file.\n */'public static ModelData fromOnnxFile(String onnxModelPath) throws MenohException { final PointerByReference handle = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_model_data_from_onnx(onnxModelPath, handle)); ...
@Test public void makeFromInvalidOnnxFile() throws Exception { final String path = getResourceFilePath("models/invalid_format.onnx"); MenohException e = assertThrows(MenohException.class, () -> ModelData.fromOnnxFile(path)); assertAll("invalid onnx file", () -> assertE...
["('/**\\\\n * Loads an ONNX model from the specified file.\\\\n */', '')"]
b'/**\n * Loads an ONNX model from the specified file.\n */'public static ModelData fromOnnxFile(String onnxModelPath) throws MenohException { final PointerByReference handle = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_model_data_from_onnx(onnxModelPath, handle)); ...
@Test public void makeFromUnsupportedOnnxOpsetVersionFile() throws Exception { // Note: This file is a copy of and_op.onnx which is edited the last byte to 127 (0x7e) final String path = getResourceFilePath("models/unsupported_onnx_opset_version.onnx"); MenohException e = assertThrows(...
["('/**\\\\n * Creates a {@link ModelBuilder}.\\\\n */', '')"]
b'/**\n * Creates a {@link ModelBuilder}.\n */'public static ModelBuilder builder(VariableProfileTable vpt) throws MenohException { final PointerByReference ref = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_model_builder(vpt.nativeHandle(), ref)); return new...
@Test public void buildModelIfBackendNotFound() throws Exception { final String path = getResourceFilePath("models/and_op.onnx"); final int batchSize = 4; final int inputDim = 2; final String backendName = "__non_existent_backend__"; // test case final String backendCon...
["('/**\\\\n * Creates a {@link VariableProfileTableBuilder}.\\\\n */', '')"]
b'/**\n * Creates a {@link VariableProfileTableBuilder}.\n */'public static VariableProfileTableBuilder builder() throws MenohException { final PointerByReference ref = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref)); return ...
@Test public void addValidInputProfile() { try (VariableProfileTableBuilder builder = VariableProfileTable.builder()) { builder.addInputProfile("foo", DType.FLOAT, new int[] {1, 1}); } }
["('/**\\\\n * Creates a {@link VariableProfileTableBuilder}.\\\\n */', '')"]
b'/**\n * Creates a {@link VariableProfileTableBuilder}.\n */'public static VariableProfileTableBuilder builder() throws MenohException { final PointerByReference ref = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref)); return ...
@Test public void addValidInputProfileWithInvalidDims() { try (VariableProfileTableBuilder builder = VariableProfileTable.builder()) { MenohException e = assertThrows(MenohException.class, // test case: dims.length == 1 () -> builder.addInputProfile("...
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p...
b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ...
@Test public void copyEmptyDirectBufferToNativeMemory() { final ByteBuffer buf = ByteBuffer.allocateDirect(0); assertEquals(0, buf.remaining()); assertThrows( IllegalArgumentException.class, () -> BufferUtils.copyToNativeMemory(buf)); }
["('/**\\\\n * Creates a {@link VariableProfileTableBuilder}.\\\\n */', '')"]
b'/**\n * Creates a {@link VariableProfileTableBuilder}.\n */'public static VariableProfileTableBuilder builder() throws MenohException { final PointerByReference ref = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref)); return ...
@Test public void addValidOutputProfile() { try (VariableProfileTableBuilder builder = VariableProfileTable.builder()) { builder.addOutputProfile("foo", DType.FLOAT); } }
["('/**\\\\n * Creates a {@link VariableProfileTableBuilder}.\\\\n */', '')"]
b'/**\n * Creates a {@link VariableProfileTableBuilder}.\n */'public static VariableProfileTableBuilder builder() throws MenohException { final PointerByReference ref = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref)); return ...
@Test public void buildVariableProfileTableIfInputProfileNameNotFound() throws Exception { final String path = getResourceFilePath("models/and_op.onnx"); final int batchSize = 1; final int inputDim = 2; final String inputProfileName = "__non_existent_variable__"; // test case ...
["('/**\\\\n * Creates a {@link VariableProfileTableBuilder}.\\\\n */', '')"]
b'/**\n * Creates a {@link VariableProfileTableBuilder}.\n */'public static VariableProfileTableBuilder builder() throws MenohException { final PointerByReference ref = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref)); return ...
@Test public void buildVariableProfileTableIfInputProfileDimsMismatched() throws Exception { final String path = getResourceFilePath("models/and_op.onnx"); final int batchSize = 1; final int inputDim = 3; // test case final String inputProfileName = "input"; final Strin...
["('/**\\\\n * Creates a {@link VariableProfileTableBuilder}.\\\\n */', '')"]
b'/**\n * Creates a {@link VariableProfileTableBuilder}.\n */'public static VariableProfileTableBuilder builder() throws MenohException { final PointerByReference ref = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref)); return ...
@Test public void buildVariableProfileTableIfOutputProfileNameNotFound() throws Exception { final String path = getResourceFilePath("models/and_op.onnx"); final int batchSize = 1; final int inputDim = 2; final String inputProfileName = "input"; final String outputProfil...
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p...
b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ...
@Test public void copyArrayBackedBufferToNativeMemory() { final byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7}; final ByteBuffer buf = ByteBuffer.wrap(bytes); assertEquals(8, buf.remaining()); final Pointer ptr = BufferUtils.copyToNativeMemory(buf); assertNotNul...
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p...
b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ...
@Test public void copySlicedArrayBackedBufferToNativeMemory() { final byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7}; final byte[] slicedBytes = new byte[] {2, 3, 4, 5}; final ByteBuffer buf = ByteBuffer.wrap(bytes, 1, 6).slice(); assertAll("non-zero array offset", ...
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p...
b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ...
@Test public void copyReadOnlyBufferToNativeMemory() { final byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7}; final ByteBuffer buf = ByteBuffer.wrap(bytes).asReadOnlyBuffer(); assertEquals(8, buf.remaining()); final Pointer ptr = BufferUtils.copyToNativeMemory(buf); ...
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p...
b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ...
@Test public void copySlicedReadOnlyBufferToNativeMemory() { final byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7}; final byte[] slicedBytes = new byte[] {2, 3, 4, 5}; final ByteBuffer buf = ByteBuffer.wrap(bytes).asReadOnlyBuffer(); // slice 4 bytes buf.position...
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p...
b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ...
@Test public void copyFloatArrayToNativeMemory() { final float[] values = new float[] {0f, 1f, 2f, 3f}; final ByteBuffer valuesBuf = ByteBuffer.allocate(values.length * 4).order(ByteOrder.nativeOrder()); valuesBuf.asFloatBuffer().put(values); final int offset = 0; final...
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p...
b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ...
@Test public void copySlicedFloatArrayToNativeMemory() { final float[] values = new float[] {0f, 1f, 2f, 3f}; final float[] slicedValues = new float[] {1f, 2f}; final ByteBuffer slicedValuesBuf = ByteBuffer.allocate(slicedValues.length * 4).order(ByteOrder.nativeOrder()); sliced...
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p...
b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ...
@Test public void copyEmptyFloatArrayToNativeMemory() { final float[] values = new float[] {}; // test case final int offset = 0; final int length = values.length; assertThrows( IllegalArgumentException.class, () -> BufferUtils.copyToNativeMem...
["('', '// Append meta data.\\n')"]
Uri getAuthorizationUri(URL baseOAuthUrl, String clientId) { try { final Uri.Builder builder = Uri.parse(new URL(baseOAuthUrl, ApiConstants.AUTHORIZE).toURI().toString()) .buildUpon() .appendQueryParameter(ARG_RESPONSE_TYPE, "code") .a...
@Test public void shouldBuildCorrectUri() throws Exception { // Given final String clientId = "clientId"; final Uri redirectUri = Uri.parse("coinbase://some-app"); final String scope = "user:read"; final String baseOauthUrl = "https://www.coinbase.com/authorize"; ...
["('/**\\\\n * Creates an instance of {@link PaginationParams} to get next page items.\\\\n * <p>\\\\n * Keeps limit and order from original {@link PaginationParams}.\\\\n *\\\\n * @param pagination current page pagination params.\\\\n * @return {@link PaginationParams} to get next items page.\\...
b'/**\n * Creates an instance of {@link PaginationParams} to get next page items.\n * <p>\n * Keeps limit and order from original {@link PaginationParams}.\n *\n * @param pagination current page pagination params.\n * @return {@link PaginationParams} to get next items page.\n * @throws Illeg...
@Test public void noNextPageNull_ParamsNull() { // Given PagedResponse.Pagination pagination = new PagedResponse.Pagination(); // When PaginationParams paginationParams = PaginationParams.nextPage(pagination); // Then assertThat(paginationParams).isNull(); ...
["('/**\\\\n * Creates an instance of {@link PaginationParams} to get previous page items.\\\\n * <p>\\\\n * Keeps limit and order from original {@link PaginationParams}.\\\\n *\\\\n * @param pagination current page pagination params.\\\\n * @return {@link PaginationParams} to get previous items...
b'/**\n * Creates an instance of {@link PaginationParams} to get previous page items.\n * <p>\n * Keeps limit and order from original {@link PaginationParams}.\n *\n * @param pagination current page pagination params.\n * @return {@link PaginationParams} to get previous items page.\n * @thro...
@Test public void noPreviousPageNull_ParamsNull() { // Given PagedResponse.Pagination pagination = new PagedResponse.Pagination(); // When PaginationParams paginationParams = PaginationParams.previousPage(pagination); // Then assertThat(paginationParams).is...
["('/**\\\\n * Creates an instance of {@link PaginationParams} to get next page items.\\\\n * <p>\\\\n * Keeps limit and order from original {@link PaginationParams}.\\\\n *\\\\n * @param pagination current page pagination params.\\\\n * @return {@link PaginationParams} to get next items page.\\...
b'/**\n * Creates an instance of {@link PaginationParams} to get next page items.\n * <p>\n * Keeps limit and order from original {@link PaginationParams}.\n *\n * @param pagination current page pagination params.\n * @return {@link PaginationParams} to get next items page.\n * @throws Illeg...
@Test(expected = IllegalArgumentException.class) public void noNextPage_nextIdNotProvided_ExceptionThrown() { // Given PagedResponse.Pagination pagination = new PagedResponse.Pagination(); pagination.setNextUri("/path"); // When PaginationParams.nextPage(pagination); ...
["('/**\\\\n * Creates an instance of {@link PaginationParams} to get previous page items.\\\\n * <p>\\\\n * Keeps limit and order from original {@link PaginationParams}.\\\\n *\\\\n * @param pagination current page pagination params.\\\\n * @return {@link PaginationParams} to get previous items...
b'/**\n * Creates an instance of {@link PaginationParams} to get previous page items.\n * <p>\n * Keeps limit and order from original {@link PaginationParams}.\n *\n * @param pagination current page pagination params.\n * @return {@link PaginationParams} to get previous items page.\n * @thro...
@Test(expected = IllegalArgumentException.class) public void noPreviousPage_previousIdNotProvided_ExceptionThrown() { // Given PagedResponse.Pagination pagination = new PagedResponse.Pagination(); pagination.setPreviousUri("/path"); // When PaginationParams.previousPa...
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"...
b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre...
@Test public void testUsingDeploymentForService() throws Exception { ServiceDeployment deployment = new ServiceDeployment(); deployment.setImpl("foo.Impl"); deployment.setConfig("-"); deployment.setServiceType("foo.Interface"); deployment.setName("The Great and wonderfu...
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"...
b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre...
@Test public void setDeploymentWebsterUrl() throws IOException, ConfigurationException, URISyntaxException, ResolverException { ServiceDeployment deployment = new ServiceDeployment(); deployment.setConfig(getConfigDir() + "/TestIP.groovy"); deployment.setWebsterUrl("http://spongebob:8080...
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"...
b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre...
@Test public void testFixedUsingConfiguration() throws URISyntaxException, ResolverException, ConfigurationException, IOException { ServiceDeployment deployment = new ServiceDeployment(); deployment.setConfig(getConfigDir()+"/fixedConfig.config"); ServiceElement service = ServiceElementF...
Get the DataService data directory The @link DataServiceDATADIR system property is first consulted if that property is not setValue the default is either the TMPDIR SystemgetPropertyjavaiotmpdirsorceruserdata is used and the @link DataServiceDATADIR system property is setValue @return The DataService data directory
b'/**\n * Get the DataService data directory. The {@link DataService#DATA_DIR} system property is first\n * consulted, if that property is not setValue, the default is either the TMPDIR\n * System.getProperty("java.io.tmpdir")/sorcer/user/data is used and the {@link DataService#DATA_DIR}\n * system prop...
@Test public void testGetDataDir() { String tmpDir = System.getenv("TMPDIR")==null?System.getProperty("java.io.tmpdir"):System.getenv("TMPDIR"); String dataDirName = new File(String.format(String.format("%s%ssorcer-%s%sdata", tmpD...
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"...
b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre...
@Test public void setDeploymentWebsterOperator() throws IOException, ConfigurationException, URISyntaxException, ResolverException { NetSignature methodEN = new NetSignature("executeFoo", ServiceProvider.class, ...
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"...
b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre...
@Test public void setDeploymentWebsterFromConfig() throws IOException, ConfigurationException, URISyntaxException, ResolverException { ServiceDeployment deployment = new ServiceDeployment(); deployment.setConfig(getConfigDir() + "/testWebster.config"); ServiceElement serviceElement = Ser...
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"...
b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre...
@Test public void testIPAddresses() throws Exception { ServiceDeployment deployment = new ServiceDeployment(); deployment.setIps("10.0.1.9", "canebay.local"); deployment.setExcludeIps("10.0.1.7", "stingray.foo.local.net"); deployment.setConfig("-"); ServiceElement servi...
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"...
b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre...
@Test public void testIPAddressestisingConfiguration() throws IOException, ConfigurationException, URISyntaxException, ResolverException { ServiceDeployment deployment = new ServiceDeployment(); deployment.setConfig(getConfigDir() + "/testIP.config"); verifyServiceElement(ServiceElementF...
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"...
b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre...
@Test public void testIPAddressesUsingGroovyConfiguration() throws IOException, ConfigurationException, URISyntaxException, ResolverException { ServiceDeployment deployment = new ServiceDeployment(); deployment.setConfig(getConfigDir()+"/TestIP.groovy"); verifyServiceElement(ServiceEleme...
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"...
b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre...
@Test public void testPlannedUsingGroovyConfiguration() throws URISyntaxException, ResolverException, ConfigurationException, IOException { ServiceDeployment deployment = new ServiceDeployment(); deployment.setConfig(getConfigDir()+"/PlannedConfig.groovy"); ServiceElement service = Servi...
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"...
b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre...
@Test public void testFixedUsingGroovyConfiguration() throws URISyntaxException, ResolverException, ConfigurationException, IOException { ServiceDeployment deployment = new ServiceDeployment(); deployment.setConfig(getConfigDir()+"/FixedConfig.groovy"); ServiceElement service = ServiceEl...
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"...
b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre...
@Test public void testPlannedUsingConfiguration() throws URISyntaxException, ResolverException, ConfigurationException, IOException { ServiceDeployment deployment = new ServiceDeployment(); deployment.setConfig(getConfigDir()+"/plannedConfig.config"); ServiceElement service = ServiceElem...
["('/**\\\\n * Compute the set of literals common to all models of the formula.\\\\n * \\\\n * @param s\\\\n * a solver already feeded\\\\n * @return the set of literals common to all models of the formula contained\\\\n * in the solver, in dimacs format.\\\\n * @throws Ti...
b'/**\n * Compute the set of literals common to all models of the formula.\n * \n * @param s\n * a solver already feeded\n * @return the set of literals common to all models of the formula contained\n * in the solver, in dimacs format.\n * @throws TimeoutException\n */...
@Test public void testBugUnitClauses() throws ContradictionException, TimeoutException { ISolver solver1 = SolverFactory.newDefault(); ISolver solver2 = SolverFactory.newDefault(); ISolver solver3 = SolverFactory.newDefault(); int[][] cnf1 = new int[][] { new int[...
["('/**\\\\n * Translate an optimization function into constraints and provides the\\\\n * binary literals in results. Works only when the value of the objective\\\\n * function is positive.\\\\n * \\\\n * @since 2.2\\\\n */', '')", "('', '// filling the buckets\\n')", "('', '// creating the add...
b'/**\n * Translate an optimization function into constraints and provides the\n * binary literals in results. Works only when the value of the objective\n * function is positive.\n * \n * @since 2.2\n */'public void optimisationFunction(IVecInt literals, IVec<BigInteger> coefs, IVe...
@Test public void testTwoValues() throws ContradictionException { IVecInt literals = new VecInt().push(1).push(2); IVec<BigInteger> coefs = new Vec<BigInteger>().push( BigInteger.valueOf(3)).push(BigInteger.valueOf(6)); IVecInt result = new VecInt(); this.gator....
["('/**\\\\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y &lt;=&gt; (x1 -> ...
b'/**\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept...
@Test public void testSATIfThen1() throws ContradictionException, TimeoutException { gator.it(1, 2, 3); assertTrue(gator.isSatisfiable(new VecInt(new int[] { 1, 2, 3 }))); }
["('/**\\\\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y &lt;=&gt; (x1 -> ...
b'/**\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept...
@Test public void testSATIfThen2() throws ContradictionException, TimeoutException { gator.it(1, 2, 3); assertFalse(gator.isSatisfiable(new VecInt(new int[] { 1, 2, -3 }))); }
["('/**\\\\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y &lt;=&gt; (x1 -> ...
b'/**\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept...
@Test public void testSATIfThen3() throws ContradictionException, TimeoutException { gator.it(1, 2, 3); assertTrue(gator.isSatisfiable(new VecInt(new int[] { 1, -2, 3 }))); }
["('/**\\\\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y &lt;=&gt; (x1 -> ...
b'/**\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept...
@Test public void testSATIfThen() throws ContradictionException, TimeoutException { gator.it(1, 2, 3); assertTrue(gator.isSatisfiable(new VecInt(new int[] { 1, -2, -3 }))); }
["('/**\\\\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y &lt;=&gt; (x1 -> ...
b'/**\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept...
@Test public void testSATIfThen5() throws ContradictionException, TimeoutException { gator.it(1, 2, 3); assertFalse(gator.isSatisfiable(new VecInt(new int[] { -1, 2, 3 }))); }
["('/**\\\\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y &lt;=&gt; (x1 -> ...
b'/**\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept...
@Test public void testSATIfThen6() throws ContradictionException, TimeoutException { gator.it(1, 2, 3); assertTrue(gator.isSatisfiable(new VecInt(new int[] { -1, 2, -3 }))); }
["('/**\\\\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y &lt;=&gt; (x1 -> ...
b'/**\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept...
@Test public void testSATIfThen7() throws ContradictionException, TimeoutException { gator.it(1, 2, 3); assertFalse(gator.isSatisfiable(new VecInt(new int[] { -1, -2, 3 }))); }
["('/**\\\\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y &lt;=&gt; (x1 -> ...
b'/**\n * translate <code>y &lt;=&gt; (x1 =&gt; x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept...
@Test public void testSATIfThen8() throws ContradictionException, TimeoutException { gator.it(1, 2, 3); assertFalse(gator.isSatisfiable(new VecInt(new int[] { -1, -2, -3 }))); }
Get the date of the first day of the current year @return date
b'/**\n * Get the date of the first day of the current year\n *\n * @return date\n */'public static Date yearStart() { final GregorianCalendar calendar = new GregorianCalendar(US); calendar.set(DAY_OF_YEAR, 1); return calendar.getTime(); }
@Test public void yearStart() { Date date = DateUtils.yearStart(); assertNotNull(date); GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); assertEquals(1, calendar.get(DAY_OF_YEAR)); }
Get the date of the last day of the current year @return date
b'/**\n * Get the date of the last day of the current year\n *\n * @return date\n */'public static Date yearEnd() { final GregorianCalendar calendar = new GregorianCalendar(US); calendar.add(YEAR, 1); calendar.set(DAY_OF_YEAR, 1); calendar.add(DAY_OF_YEAR, -1); return calendar.getTime()...
@Test public void yearEnd() { Date date = DateUtils.yearEnd(); assertNotNull(date); GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); assertEquals(11, calendar.get(MONTH)); assertEquals(31, calendar.get(DAY_OF_MONTH)); }
["('/**\\\\n\\\\t * Returns true if the double is a denormal.\\\\n\\\\t */', '')"]
b'/**\n\t * Returns true if the double is a denormal.\n\t */'public static boolean isDenormal(@Unsigned long v) { return (v & EXPONENT_MASK) == 0L; }
@Test public void double_IsDenormal() { @Unsigned long min_double64 = 0x00000000_00000001L; CHECK(Doubles.isDenormal(min_double64)); @Unsigned long bits = 0x000FFFFF_FFFFFFFFL; CHECK(Doubles.isDenormal(bits)); bits = 0x00100000_00000000L; CHECK(!Doubles.isDenormal(bits)); }
["('/**\\\\n\\\\t * We consider denormals not to be special.\\\\n\\\\t * Hence only Infinity and NaN are special.\\\\n\\\\t */', '')"]
b'/**\n\t * We consider denormals not to be special.\n\t * Hence only Infinity and NaN are special.\n\t */'public static boolean isSpecial(@Unsigned long value) { return (value & EXPONENT_MASK) == EXPONENT_MASK; }
@Test public void double_IsSpecial() { CHECK(Doubles.isSpecial(Double.POSITIVE_INFINITY)); CHECK(Doubles.isSpecial(-Double.POSITIVE_INFINITY)); CHECK(Doubles.isSpecial(Double.NaN)); @Unsigned long bits = 0xFFF12345_00000000L; CHECK(Doubles.isSpecial(bits)); // Denormals are not special: CHECK(!Do...
t Computes a decimal representation with a fixed number of digits after thet decimal point The last emitted digit is roundedt pt bExamplesbbrt codet toFixed312 1 31brt toFixed31415 3 3142brt toFixed123456789 4 12345679brt toFixed123 5 123000brt toFixed01 4 01000brt toFixed1e30 2 100000000000000001988462483865600b...
b'/**\n\t * Computes a decimal representation with a fixed number of digits after the\n\t * decimal point. The last emitted digit is rounded.\n\t * <p/>\n\t * <b>Examples:</b><br/>\n\t * <code>\n\t * toFixed(3.12, 1) -> "3.1"<br/>\n\t * toFixed(3.1415, 3) -> "3.142"<br/>\n\t * toFixed(1234.56789, 4) -> "1234.5679"<br/>...
@Test void toFixed() { // TODO: conv = DoubleToStringConverter.ecmaScriptConverter(); testFixed("3.1", 3.12, 1); testFixed("3.142", 3.1415, 3); testFixed("1234.5679", 1234.56789, 4); testFixed("1.23000", 1.23, 5); testFixed("0.1000", 0.1, 4); testFixed("1000000000000000019884624838656.00", 1e30...
t Computes a representation in exponential format with coderequestedDigitscodet after the decimal point The last emitted digit is roundedt pt Examples with bEMITPOSITIVEEXPONENTSIGNb deactivated andt exponentcharacter set to codeecodet pt codet toExponential312 1 31e0brt toExponential50 3 5000e0brt toExponential0001 ...
b'/**\n\t * Computes a representation in exponential format with <code>requestedDigits</code>\n\t * after the decimal point. The last emitted digit is rounded.\n\t * <p/>\n\t * Examples with <b>EMIT_POSITIVE_EXPONENT_SIGN</b> deactivated, and\n\t * exponent_character set to <code>\'e\'</code>.\n\t * <p/>\n\t * <code>\n...
@Test void toExponential() { testExp("3.1e+00", 3.12, 1); testExp("5.000e+00", 5.0, 3); testExp("1.00e-03", 0.001, 2); testExp("3.1415e+00", 3.1415, 4); testExp("3.142e+00", 3.1415, 3); testExp("1.235e+14", 123456789000000.0, 3); testExp("1.00000000000000001988462483865600e+30", 10000000000000000...
t Computes precision leading digits of the given value and returns themt either in exponential or decimal format depending ont PrecisionPolicymaxLeadingTrailingZeros given to thet constructort pt The last computed digit is roundedt pt Example with PrecisionPolicymaxLeadingZeros 6t pt codet toPrecision00000012345 2 00...
b'/**\n\t * Computes \'precision\' leading digits of the given \'value\' and returns them\n\t * either in exponential or decimal format, depending on\n\t * PrecisionPolicy.max{Leading|Trailing}Zeros (given to the\n\t * constructor).\n\t * <p/>\n\t * The last computed digit is rounded.\n\t * </p>\n\t * Example with Prec...
@Test void toPrecision() { testPrec("0.00012", 0.00012345, 2); testPrec("1.2e-05", 0.000012345, 2); testPrec("2", 2.0, 2, DEFAULT); testPrec("2.0", 2.0, 2, WITH_TRAILING); // maxTrailingZeros = 3; testPrec("123450", 123450.0, 6); testPrec("1.2345e+05", 123450.0, 5); testPrec("1.235e+05", 1...
t Computes a representation in hexadecimal exponential format with coderequestedDigitscode after the decimalt point The last emitted digit is roundedt t @param value The value to formatt @param requestedDigits The number of digits after the decimal place or @code 1t @param formatOptions Additional options for this numb...
b"/**\n\t * Computes a representation in hexadecimal exponential format with <code>requestedDigits</code> after the decimal\n\t * point. The last emitted digit is rounded.\n\t *\n\t * @param value The value to format.\n\t * @param requestedDigits The number of digits after the decimal place, or {@code -1}.\n\...
@Test void toHex() { testHex("0x0p+0", 0.0, -1, DEFAULT); testHex("0x1p+0", 1.0, -1, DEFAULT); testHex("0x1.8p+1", 3.0, -1, DEFAULT); testHex("0x1.8ae147ae147aep+3", 12.34, -1, DEFAULT); testHex("0x2p+3", 12.34, 0, DEFAULT); testHex("0x1.0ap+1", 0x1.0ap+1, -1, DEFAULT); }
["('/**\\\\n\\\\t * Provides a decimal representation of v.\\\\n\\\\t * The result should be interpreted as buffer * 10^(point - outLength).\\\\n\\\\t * <p>\\\\n\\\\t * Precondition:\\\\n\\\\t * * v must be a strictly positive finite double.\\\\n\\\\t * <p>\\\\n\\\\t * Returns true if it succeeds, otherwise the result ...
b'/**\n\t * Provides a decimal representation of v.\n\t * The result should be interpreted as buffer * 10^(point - outLength).\n\t * <p>\n\t * Precondition:\n\t * * v must be a strictly positive finite double.\n\t * <p>\n\t * Returns true if it succeeds, otherwise the result can not be trusted.\n\t * If the function re...
@Test public void precisionVariousDoubles() { DecimalRepBuf buffer = new DecimalRepBuf(BUFFER_SIZE); boolean status; status = FastDtoa.fastDtoa(1.0, 3, buffer); CHECK(status); CHECK_GE(3, buffer.length()); buffer.truncateAllZeros(); CHECK_EQ("1", buffer); CHECK_EQ(1, buffer.getPointPosition(...
["('/**\\\\n\\\\t * Provides a decimal representation of v.\\\\n\\\\t * The result should be interpreted as buffer * 10^(point - outLength).\\\\n\\\\t * <p>\\\\n\\\\t * Precondition:\\\\n\\\\t * * v must be a strictly positive finite double.\\\\n\\\\t * <p>\\\\n\\\\t * Returns true if it succeeds, otherwise the result ...
b'/**\n\t * Provides a decimal representation of v.\n\t * The result should be interpreted as buffer * 10^(point - outLength).\n\t * <p>\n\t * Precondition:\n\t * * v must be a strictly positive finite double.\n\t * <p>\n\t * Returns true if it succeeds, otherwise the result can not be trusted.\n\t * If the function re...
@Test public void gayPrecision() throws Exception { PrecisionState state = new PrecisionState(); DoubleTestHelper.eachPrecision(state, (st, v, numberDigits, representation, decimalPoint) -> { boolean status; st.total++; st.underTest = String.format("Using {%g, %d, \"%s\", %d}", v, numberDigits, ...
["('', '// v = significand * 2^exponent (with significand a 53bit integer).\\n')", "('', '// If the exponent is larger than 20 (i.e. we may have a 73bit number) then we\\n')", '(\'\', "// don\'t know how to compute the representation. 2^73 ~= 9.5*10^21.\\n")', '(\'\', "// If necessary this limit could probably be incre...
public static boolean fastFixedDtoa(double v, int fractionalCount, DecimalRepBuf buf) { final @Unsigned long kMaxUInt32 = 0xFFFF_FFFFL; @Unsigned long significand = Doubles.significand(v); int exponent = Doubles.exponent(v); // v = significand * 2^exponent (with significand a 53bit integer). // If the ex...
@Test public void variousDoubles() { DecimalRepBuf buffer = new DecimalRepBuf(kBufferSize); CHECK(FixedDtoa.fastFixedDtoa(1.0, 1, buffer)); CHECK_EQ("1", buffer); CHECK_EQ(1, buffer.getPointPosition()); CHECK(FixedDtoa.fastFixedDtoa(1.0, 15, buffer)); CHECK_EQ("1", buffer); CHECK_EQ(1, buffer...
["('', '// v = significand * 2^exponent (with significand a 53bit integer).\\n')", "('', '// If the exponent is larger than 20 (i.e. we may have a 73bit number) then we\\n')", '(\'\', "// don\'t know how to compute the representation. 2^73 ~= 9.5*10^21.\\n")', '(\'\', "// If necessary this limit could probably be incre...
public static boolean fastFixedDtoa(double v, int fractionalCount, DecimalRepBuf buf) { final @Unsigned long kMaxUInt32 = 0xFFFF_FFFFL; @Unsigned long significand = Doubles.significand(v); int exponent = Doubles.exponent(v); // v = significand * 2^exponent (with significand a 53bit integer). // If the ex...
@Test public void gayFixed() throws Exception { DtoaTest.DataTestState state = new DtoaTest.DataTestState(); DoubleTestHelper.eachFixed(state, (st, v, numberDigits, representation, decimalPoint) -> { st.total++; st.underTest = String.format("Using {%g, \"%s\", %d}", v, representation, decimalPoint); ...
values verified positive at beginning of method remainder quotient
@SuppressWarnings("return.type.incompatible") // values verified positive at beginning of method @Unsigned int divideModuloIntBignum(Bignum other) { requireState(val.signum() >= 0 && other.val.signum() >= 0, "values must be positive"); BigInteger[] rets = val.divideAndRemainder(other.val); val = rets[1]; // ...
@Test public void divideModuloIntBignum() { char[] buffer = new char[kBufferSize]; Bignum bignum = new Bignum(); Bignum other = new Bignum(); Bignum third = new Bignum(); bignum.assignUInt16((short) 10); other.assignUInt16((short) 2); CHECK_EQ(5, bignum.divideModuloIntBignum(other)); CHECK_E...
['("/**\\\\n * Creates Jetty\'s {@link ShutdownHandler}.\\\\n * \\\\n * @param environment the environment\\\\n * @return an instance of {@link ShutdownHandler} if\\\\n * {@link Environment#SERVER_SHUTDOWN_TOKEN_KEY} is\\\\n * available; otherwise <code>null</code>\\\\n */", \'\')']
b"/**\n * Creates Jetty's {@link ShutdownHandler}.\n * \n * @param environment the environment\n * @return an instance of {@link ShutdownHandler} if\n * {@link Environment#SERVER_SHUTDOWN_TOKEN_KEY} is\n * available; otherwise <code>null</code>\n */"protected ShutdownHandler createShutdown...
@Test public void createShutdownHandlerReturnsNullWithNoToken() throws Exception { HandlerCollectionLoader hcl = new HandlerCollectionLoader(); ShutdownHandler shutdownHandler = hcl.createShutdownHandler(env); assertThat(shutdownHandler).isNull(); }
['("/**\\\\n * Creates Jetty\'s {@link ShutdownHandler}.\\\\n * \\\\n * @param environment the environment\\\\n * @return an instance of {@link ShutdownHandler} if\\\\n * {@link Environment#SERVER_SHUTDOWN_TOKEN_KEY} is\\\\n * available; otherwise <code>null</code>\\\\n */", \'\')']
b"/**\n * Creates Jetty's {@link ShutdownHandler}.\n * \n * @param environment the environment\n * @return an instance of {@link ShutdownHandler} if\n * {@link Environment#SERVER_SHUTDOWN_TOKEN_KEY} is\n * available; otherwise <code>null</code>\n */"protected ShutdownHandler createShutdown...
@Test public void createShutdownHandlerObserversShutdownTokenWhenPresent() throws Exception { HandlerCollectionLoader hcl = new HandlerCollectionLoader(); String token = UUID.randomUUID().toString(); defaultEnv.put(Environment.SERVER_SHUTDOWN_TOKEN_KEY, token); env = Environment.createEnvironment...
['("/*\\n\\t\\t\\t\\t * we don\'t know for sure why the thread was interrupted, so we\\n\\t\\t\\t\\t * need to obey; if interrupt was not relevant, the process will\\n\\t\\t\\t\\t * restart; we need to restore the interrupt status so that the\\n\\t\\t\\t\\t * called methods know that there was an interrupt\\n\\t\\t\\t\...
@Override public synchronized void load(ElkAxiomProcessor axiomInserter, ElkAxiomProcessor axiomDeleter) throws ElkLoadingException { if (finished_) return; if (!started_) { parserThread_.start(); started_ = true; } ArrayList<ElkAxiom> nextBatch; for (;;) { if (isInterrupted()...
@Test(expected = ElkLoadingException.class) public void expectedLoadingExceptionOnSyntaxError() throws ElkLoadingException { String ontology = ""// + "Prefix( : = <http://example.org/> )"// + "Ontology((((()("// + "EquivalentClasses(:B :C)"// + "SubClassOf(:A ObjectSomeValuesFrom(:R :B))"//...
['("/*\\n\\t\\t\\t\\t * we don\'t know for sure why the thread was interrupted, so we\\n\\t\\t\\t\\t * need to obey; if interrupt was not relevant, the process will\\n\\t\\t\\t\\t * restart; we need to restore the interrupt status so that the\\n\\t\\t\\t\\t * called methods know that there was an interrupt\\n\\t\\t\\t\...
@Override public synchronized void load(ElkAxiomProcessor axiomInserter, ElkAxiomProcessor axiomDeleter) throws ElkLoadingException { if (finished_) return; if (!started_) { parserThread_.start(); started_ = true; } ArrayList<ElkAxiom> nextBatch; for (;;) { if (isInterrupted()...
@Test(expected = ElkLoadingException.class) public void expectedLoadingExceptionOnLexicalError() throws Exception { String ontology = ""// + "Prefix( : = <http://example.org/> )"// + "Ontology-LEXICAL-ERROR("// + "EquivalentClasses(:B :C)"// + "SubClassOf(:A ObjectSomeValuesFrom(:R :B))"// ...
["('/**\\\\n\\\\t * @param prefix\\\\n\\\\t * the prefix of configuration options to be loaded\\\\n\\\\t * @param configClass\\\\n\\\\t * the class to be instantiated with the loaded options\\\\n\\\\t * @return the {@link BaseConfiguration} for the specified parameters\\\\n\\\\t * @throws Configur...
b'/**\n\t * @param prefix\n\t * the prefix of configuration options to be loaded\n\t * @param configClass\n\t * the class to be instantiated with the loaded options\n\t * @return the {@link BaseConfiguration} for the specified parameters\n\t * @throws ConfigurationException\n\t * if lo...
@SuppressWarnings("static-method") @Test public void getDefaultConfiguration() { BaseConfiguration defaultConfig = new ConfigurationFactory() .getConfiguration("elk", BaseConfiguration.class); assertEquals(3, defaultConfig.getParameterNames().size()); }
["('/**\\\\n\\\\t * @param prefix\\\\n\\\\t * the prefix of configuration options to be loaded\\\\n\\\\t * @param configClass\\\\n\\\\t * the class to be instantiated with the loaded options\\\\n\\\\t * @return the {@link BaseConfiguration} for the specified parameters\\\\n\\\\t * @throws Configur...
b'/**\n\t * @param prefix\n\t * the prefix of configuration options to be loaded\n\t * @param configClass\n\t * the class to be instantiated with the loaded options\n\t * @return the {@link BaseConfiguration} for the specified parameters\n\t * @throws ConfigurationException\n\t * if lo...
@SuppressWarnings("static-method") @Test public void getDefaultConfigurationWithPrefix() { BaseConfiguration defaultConfig = new ConfigurationFactory() .getConfiguration("elk.reasoner", BaseConfiguration.class); assertEquals(2, defaultConfig.getParameterNames().size()); defaultConfig = new Configu...
["('/**\\\\n\\\\t * @param prefix\\\\n\\\\t * the prefix of configuration options to be loaded\\\\n\\\\t * @param configClass\\\\n\\\\t * the class to be instantiated with the loaded options\\\\n\\\\t * @return the {@link BaseConfiguration} for the specified parameters\\\\n\\\\t * @throws Configur...
b'/**\n\t * @param prefix\n\t * the prefix of configuration options to be loaded\n\t * @param configClass\n\t * the class to be instantiated with the loaded options\n\t * @return the {@link BaseConfiguration} for the specified parameters\n\t * @throws ConfigurationException\n\t * if lo...
@Test public void getConfigurationFromStream() throws ConfigurationException, IOException { InputStream stream = null; try { stream = this.getClass().getClassLoader() .getResourceAsStream("elk.properties"); BaseConfiguration config = new ConfigurationFactory() .getConfiguration(strea...
["('', '// Add a token for end of sentence\\n')"]
public String[] tokenize(String s) { InputStream modelIn = null; List<String> tokens = new ArrayList<String>(); try { modelIn = new FileInputStream(sentenceModelFile); SentenceModel model = new SentenceModel(modelIn); SentenceDetector sentenceDetector = new SentenceDetectorME(model); ...
@Test public void testTokenization() { String text = "This, is the first sentence. This: is the second sentence "; String[] tokenizedText = tokenizer.tokenize(text); System.out.println(Arrays.toString(tokenizedText)); }
Creates a new codeFormattedEntityIdRowFiltercode instance The row key format must have an encoding of @link RowKeyEncodingFORMATTED and if there is a salt defined it must not be set to suppress key materialization If key materialization were suppressed then there would be no component fields to match against @param row...
b'/**\n * Creates a new <code>FormattedEntityIdRowFilter</code> instance. The row key\n * format must have an encoding of {@link RowKeyEncoding#FORMATTED}, and if\n * there is a salt defined, it must not be set to suppress key\n * materialization. If key materialization were suppressed, then there would\n * ...
@Test public void testFormattedEntityIdRowFilter() throws Exception { FormattedEntityIdRowFilter filter = createFilter(mRowKeyFormat, 100, null, "value"); runTest(mRowKeyFormat, filter, mFactory, INCLUDE, 100, 2000L, "value"); runTest(mRowKeyFormat, filter, mFactory, EXCLUDE, 100, null, null); ru...
["('/** {@inheritDoc} */', '')", "('', '// In the case that we have enough information to generate a prefix, we will\\n')", '(\'\', "// construct a PrefixFilter that is AND\'ed with the RowFilter. This way,\\n")', "('', '// when the scan passes the end of the prefix, it can end the filtering\\n')", "('', '// process q...
b'/** {@inheritDoc} */'@Override public Filter toHBaseFilter(Context context) throws IOException { // In the case that we have enough information to generate a prefix, we will // construct a PrefixFilter that is AND'ed with the RowFilter. This way, // when the scan passes the end of the prefix, it ca...
@Test public void testLatinNewlineCharacterInclusion() throws Exception { RowKeyFormat2 rowKeyFormat = createRowKeyFormat(1, INTEGER, LONG); EntityIdFactory factory = EntityIdFactory.getFactory(rowKeyFormat); // Create and serialize a filter. FormattedEntityIdRowFilter filter = createFilter(row...
['(\'/**\\\\n * Gets a builder configured with default Kiji URI fields.\\\\n *\\\\n * More precisely, the following defaults are initialized:\\\\n * <ul>\\\\n * <li>The Zookeeper quorum and client port is taken from the Hadoop <tt>Configuration</tt></li>\\\\n * <li>The Kiji instance name is set to <tt>K...
b'/**\n * Gets a builder configured with default Kiji URI fields.\n *\n * More precisely, the following defaults are initialized:\n * <ul>\n * <li>The Zookeeper quorum and client port is taken from the Hadoop <tt>Configuration</tt></li>\n * <li>The Kiji instance name is set to <tt>KConstants.DEFAULT_INS...
@Test public void testSingleHost() { final KijiURI uri = KijiURI.newBuilder("kiji-hbase://zkhost:1234/instance/table/col").build(); assertEquals("kiji-hbase", uri.getScheme()); assertEquals("zkhost", uri.getZookeeperQuorum().get(0)); assertEquals(1234, uri.getZookeeperClientPort()); assertEq...
["('/**\\\\n * Creates and returns a new KijiTableLayout instance as specified by an Avro TableLayoutDesc\\\\n * description record.\\\\n *\\\\n * @param layout The Avro TableLayoutDesc descriptor record that describes the actual layout.\\\\n * of the table.\\\\n * @return A new table layout.\\\\n * @thro...
b'/**\n * Creates and returns a new KijiTableLayout instance as specified by an Avro TableLayoutDesc\n * description record.\n *\n * @param layout The Avro TableLayoutDesc descriptor record that describes the actual layout.\n * of the table.\n * @return A new table layout.\n * @throws InvalidLayoutExcepti...
@Test public void badHashSizeRKF() throws InvalidLayoutException { final TableLayoutDesc desc = TableLayoutDesc.newBuilder() .setName("table_name") .setKeysFormat(badHashSizeRowKeyFormat()) .setVersion(TABLE_LAYOUT_VERSION) .build(); try { final KijiTableLayout kt...
["('/**\\\\n * Creates and returns a new KijiTableLayout instance as specified by an Avro TableLayoutDesc\\\\n * description record.\\\\n *\\\\n * @param layout The Avro TableLayoutDesc descriptor record that describes the actual layout.\\\\n * of the table.\\\\n * @return A new table layout.\\\\n * @thro...
b'/**\n * Creates and returns a new KijiTableLayout instance as specified by an Avro TableLayoutDesc\n * description record.\n *\n * @param layout The Avro TableLayoutDesc descriptor record that describes the actual layout.\n * of the table.\n * @return A new table layout.\n * @throws InvalidLayoutExcepti...
@Test public void repeatedNamesRKF() throws InvalidLayoutException { final TableLayoutDesc desc = TableLayoutDesc.newBuilder() .setName("table_name") .setKeysFormat(repeatedNamesRowKeyFormat()) .setVersion(TABLE_LAYOUT_VERSION) .build(); try { final KijiTableLayou...
["('/**\\\\n * Creates and returns a new KijiTableLayout instance as specified by an Avro TableLayoutDesc\\\\n * description record.\\\\n *\\\\n * @param layout The Avro TableLayoutDesc descriptor record that describes the actual layout.\\\\n * of the table.\\\\n * @return A new table layout.\\\\n * @thro...
b'/**\n * Creates and returns a new KijiTableLayout instance as specified by an Avro TableLayoutDesc\n * description record.\n *\n * @param layout The Avro TableLayoutDesc descriptor record that describes the actual layout.\n * of the table.\n * @return A new table layout.\n * @throws InvalidLayoutExcepti...
@Test public void tooHighRangeScanIndexRKF() throws InvalidLayoutException { final TableLayoutDesc desc = TableLayoutDesc.newBuilder() .setName("table_name") .setKeysFormat(tooHighRangeScanIndexRowKeyFormat()) .setVersion(TABLE_LAYOUT_VERSION) .build(); try { fina...
["('/**\\\\n * Creates and returns a new KijiTableLayout instance as specified by an Avro TableLayoutDesc\\\\n * description record.\\\\n *\\\\n * @param layout The Avro TableLayoutDesc descriptor record that describes the actual layout.\\\\n * of the table.\\\\n * @return A new table layout.\\\\n * @thro...
b'/**\n * Creates and returns a new KijiTableLayout instance as specified by an Avro TableLayoutDesc\n * description record.\n *\n * @param layout The Avro TableLayoutDesc descriptor record that describes the actual layout.\n * of the table.\n * @return A new table layout.\n * @throws InvalidLayoutExcepti...
@Test public void zeroNullableIndexRKF() throws InvalidLayoutException { final TableLayoutDesc desc = TableLayoutDesc.newBuilder() .setName("table_name") .setKeysFormat(zeroNullableIndexRowKeyFormat()) .setVersion(TABLE_LAYOUT_VERSION) .build(); try { final KijiTa...
["('/**\\\\n * Creates and returns a new KijiTableLayout instance as specified by an Avro TableLayoutDesc\\\\n * description record.\\\\n *\\\\n * @param layout The Avro TableLayoutDesc descriptor record that describes the actual layout.\\\\n * of the table.\\\\n * @return A new table layout.\\\\n * @thro...
b'/**\n * Creates and returns a new KijiTableLayout instance as specified by an Avro TableLayoutDesc\n * description record.\n *\n * @param layout The Avro TableLayoutDesc descriptor record that describes the actual layout.\n * of the table.\n * @return A new table layout.\n * @throws InvalidLayoutExcepti...
@Test public void tooHighNullableScanIndexRKF() throws InvalidLayoutException { final TableLayoutDesc desc = TableLayoutDesc.newBuilder() .setName("table_name") .setKeysFormat(tooHighNullableIndexRowKeyFormat()) .setVersion(TABLE_LAYOUT_VERSION) .build(); try { fi...
["('/**\\\\n * Creates and returns a new KijiTableLayout instance as specified by an Avro TableLayoutDesc\\\\n * description record.\\\\n *\\\\n * @param layout The Avro TableLayoutDesc descriptor record that describes the actual layout.\\\\n * of the table.\\\\n * @return A new table layout.\\\\n * @thro...
b'/**\n * Creates and returns a new KijiTableLayout instance as specified by an Avro TableLayoutDesc\n * description record.\n *\n * @param layout The Avro TableLayoutDesc descriptor record that describes the actual layout.\n * of the table.\n * @return A new table layout.\n * @throws InvalidLayoutExcepti...
@Test public void emptyCompNameRKF() throws InvalidLayoutException { final TableLayoutDesc desc = TableLayoutDesc.newBuilder() .setName("table_name") .setKeysFormat(emptyCompNameRowKeyFormat()) .setVersion(TABLE_LAYOUT_VERSION) .build(); try { final KijiTableLayou...
["('/**\\\\n * Build a new table layout descriptor.\\\\n *\\\\n * @return a built table layout descriptor.\\\\n */', '')"]
b'/**\n * Build a new table layout descriptor.\n *\n * @return a built table layout descriptor.\n */'public TableLayoutDesc build() { return mDescBuilder.build(); }
@Test public void testTableLayoutSafeMutation() throws IOException { final KijiTableLayout layout = KijiTableLayouts.getTableLayout(TEST_LAYOUT); final TableLayoutDesc tld = layout.getDesc(); final TableLayoutBuilder tlb = new TableLayoutBuilder(tld, getKiji()); tld.setName("blastoise"); fin...
["('/**\\\\n * Register a reader schema to a column.\\\\n *\\\\n * @param columnName at which to register the schema.\\\\n * @param schema to register.\\\\n * @throws IOException If the parameters are invalid.\\\\n * @return this.\\\\n */', '')"]
b'/**\n * Register a reader schema to a column.\n *\n * @param columnName at which to register the schema.\n * @param schema to register.\n * @throws IOException If the parameters are invalid.\n * @return this.\n */'public TableLayoutBuilder withReader( final KijiColumnName columnName, final...
@Test public void testSchemaRegistrationAtBadColumns() throws IOException { final KijiTableLayout layout = KijiTableLayouts.getTableLayout(TEST_LAYOUT); final TableLayoutBuilder tlb = new TableLayoutBuilder(layout.getDesc(), getKiji()); final Schema.Parser p = new Schema.Parser(); Schema stringSc...
["('/**\\\\n * Adds the jars from a directory into the distributed cache of a job.\\\\n *\\\\n * @param job The job to configure.\\\\n * @param jarDirectory A path to a directory of jar files.\\\\n * @throws IOException If there is a problem reading from the file system.\\\\n */', '')"]
b'/**\n * Adds the jars from a directory into the distributed cache of a job.\n *\n * @param job The job to configure.\n * @param jarDirectory A path to a directory of jar files.\n * @throws IOException If there is a problem reading from the file system.\n */'public static void addJarsToDistributedCache(Job...
@Test public void testJarsDeDupe() throws IOException { // Jar list should de-dupe to {"myjar_a, "myjar_b", "myjar_0", "myjar_1"} Set<String> dedupedJarNames = new HashSet<String>(4); dedupedJarNames.add("myjar_a.jar"); dedupedJarNames.add("myjar_b.jar"); dedupedJarNames.add("myjar_0.jar"); ...
["('/** {@inheritDoc} */', '')"]
b'/** {@inheritDoc} */'@Override public void close() throws IOException { mVersionPager.close(); }
@Test public void testQualifiersIterator() throws IOException { final EntityId eid = mTable.getEntityId("me"); final KijiDataRequest dataRequest = KijiDataRequest.builder() .addColumns(ColumnsDef.create() .withMaxVersions(HConstants.ALL_VERSIONS).withPageSize(1).addFamily("jobs")) ...
['(\'/**\\\\n * Gets a builder configured with default Kiji URI fields.\\\\n *\\\\n * More precisely, the following defaults are initialized:\\\\n * <ul>\\\\n * <li>The Zookeeper quorum and client port is taken from the Hadoop <tt>Configuration</tt></li>\\\\n * <li>The Kiji instance name is set to <tt>K...
b'/**\n * Gets a builder configured with default Kiji URI fields.\n *\n * More precisely, the following defaults are initialized:\n * <ul>\n * <li>The Zookeeper quorum and client port is taken from the Hadoop <tt>Configuration</tt></li>\n * <li>The Kiji instance name is set to <tt>KConstants.DEFAULT_INS...
@Test public void testSingleHostGroupColumn() { final KijiURI uri = KijiURI.newBuilder("kiji-hbase://zkhost:1234/instance/table/family:qualifier").build(); assertEquals("kiji-hbase", uri.getScheme()); assertEquals("zkhost", uri.getZookeeperQuorum().get(0)); assertEquals(1234, uri.getZook...
@inheritDoc
b'/** {@inheritDoc} */'@Override public boolean equals(Object object) { if (object instanceof KijiCell) { final KijiCell<?> that = (KijiCell<?>) object; return this.mColumn.equals(that.mColumn) && (this.mTimestamp == that.mTimestamp) && this.mDecodedCell.equals(that.mDecodedC...
@Test public void testEquals() { final KijiCell<Integer> cell1 = KijiCell.create(KijiColumnName.create("family", "qualifier"), 1234L, new DecodedCell<Integer>(Schema.create(Schema.Type.INT), 31415)); final KijiCell<Integer> cell2 = KijiCell.create(KijiColumnName.create("fam...
["('/**\\\\n * Create a new KijiColumnName from a family and qualifier.\\\\n *\\\\n * @param family Family of the Kiji column for which to create a name.\\\\n * @param qualifier Qualifier of the Kiji column for which to create a name.\\\\n * @return a new KijiColumnName from the given family and qualifier.\\\...
b'/**\n * Create a new KijiColumnName from a family and qualifier.\n *\n * @param family Family of the Kiji column for which to create a name.\n * @param qualifier Qualifier of the Kiji column for which to create a name.\n * @return a new KijiColumnName from the given family and qualifier.\n */'public stati...
@Test public void testNull() { try { KijiColumnName.create(null); fail("An exception should have been thrown."); } catch (IllegalArgumentException iae) { assertEquals("Column name may not be null. At least specify family", iae.getMessage()); } }
["('/**\\\\n * Create a new KijiColumnName from a family and qualifier.\\\\n *\\\\n * @param family Family of the Kiji column for which to create a name.\\\\n * @param qualifier Qualifier of the Kiji column for which to create a name.\\\\n * @return a new KijiColumnName from the given family and qualifier.\\\...
b'/**\n * Create a new KijiColumnName from a family and qualifier.\n *\n * @param family Family of the Kiji column for which to create a name.\n * @param qualifier Qualifier of the Kiji column for which to create a name.\n * @return a new KijiColumnName from the given family and qualifier.\n */'public stati...
@Test public void testNullFamily() { try { KijiColumnName.create(null, "qualifier"); fail("An exception should have been thrown."); } catch (IllegalArgumentException iae) { assertEquals("Family name may not be null.", iae.getMessage()); } }
["('/**\\\\n * Create a new KijiColumnName from a family and qualifier.\\\\n *\\\\n * @param family Family of the Kiji column for which to create a name.\\\\n * @param qualifier Qualifier of the Kiji column for which to create a name.\\\\n * @return a new KijiColumnName from the given family and qualifier.\\\...
b'/**\n * Create a new KijiColumnName from a family and qualifier.\n *\n * @param family Family of the Kiji column for which to create a name.\n * @param qualifier Qualifier of the Kiji column for which to create a name.\n * @return a new KijiColumnName from the given family and qualifier.\n */'public stati...
@Test public void testInvalidFamilyName() { try { KijiColumnName.create("1:qualifier"); fail("An exception should have been thrown."); } catch (KijiInvalidNameException kine) { assertEquals("Invalid family name: 1 Name must match pattern: [a-zA-Z_][a-zA-Z0-9_]*", kine.getMes...
@inheritDoc
b'/** {@inheritDoc} */'@Override public boolean equals(Object otherObj) { if (otherObj == this) { return true; } else if (null == otherObj) { return false; } else if (!otherObj.getClass().equals(getClass())) { return false; } final KijiColumnName other = (KijiColumnName)...
@Test public void testEquals() { KijiColumnName columnA = KijiColumnName.create("family", "qualifier1"); KijiColumnName columnC = KijiColumnName.create("family", null); KijiColumnName columnD = KijiColumnName.create("family", "qualifier2"); assertTrue(columnA.equals(columnA)); // reflexive a...
@inheritDoc
b'/** {@inheritDoc} */'@Override public int hashCode() { return new HashCodeBuilder().append(mFamily).append(mQualifier).toHashCode(); }
@Test public void testHashCode() { KijiColumnName columnA = KijiColumnName.create("family", "qualifier"); KijiColumnName columnB = KijiColumnName.create("family:qualifier"); assertEquals(columnA.hashCode(), columnB.hashCode()); }
@inheritDoc
b'/** {@inheritDoc} */'@Override public int compareTo(KijiColumnName otherObj) { final int comparison = this.mFamily.compareTo(otherObj.mFamily); if (0 == comparison) { return (this.isFullyQualified() ? mQualifier : "") .compareTo(otherObj.isFullyQualified() ? otherObj.getQualifier() : ""...
@Test public void testCompareTo() { KijiColumnName columnA = KijiColumnName.create("family"); KijiColumnName columnB = KijiColumnName.create("familyTwo"); KijiColumnName columnC = KijiColumnName.create("family:qualifier"); assertTrue(0 == columnA.compareTo(columnA)); assertTrue(0 > columnA.c...
["('/**\\\\n * Creates a new {@link KijiDataRequestBuilder}. Use this to configure a KijiDataRequest,\\\\n * then create one with the {@link KijiDataRequestBuilder#build()} method.\\\\n *\\\\n * @return a new KijiDataRequestBuilder.\\\\n */', '')"]
b'/**\n * Creates a new {@link KijiDataRequestBuilder}. Use this to configure a KijiDataRequest,\n * then create one with the {@link KijiDataRequestBuilder#build()} method.\n *\n * @return a new KijiDataRequestBuilder.\n */'public static KijiDataRequestBuilder builder() { return new KijiDataRequestBuilde...
@Test public void testDataRequestEquals() { KijiDataRequestBuilder builder0 = KijiDataRequest.builder() .withTimeRange(3L, 4L); builder0.newColumnsDef().withMaxVersions(2).addFamily("foo"); builder0.newColumnsDef().withMaxVersions(5).add("bar", "baz"); KijiDataRequest request0 = builder0...
Creates a new data request representing the union of this data request and the data request specified as an argument pThis method merges data requests using the widestpossible treatment of parameters This may result in cells being included in the result set that were not specified by either data set For example if requ...
b"/**\n * Creates a new data request representing the union of this data request and the\n * data request specified as an argument.\n *\n * <p>This method merges data requests using the widest-possible treatment of\n * parameters. This may result in cells being included in the result set that\n * were not s...
@Test public void testMerge() { KijiDataRequestBuilder builder1 = KijiDataRequest.builder().withTimeRange(3, 4); builder1.newColumnsDef().withMaxVersions(2).add("foo", "bar"); KijiDataRequest first = builder1.build(); KijiDataRequestBuilder builder2 = KijiDataRequest.builder().withTimeRange(2, ...
["('/**\\\\n * Creates a new {@link KijiDataRequestBuilder}. Use this to configure a KijiDataRequest,\\\\n * then create one with the {@link KijiDataRequestBuilder#build()} method.\\\\n *\\\\n * @return a new KijiDataRequestBuilder.\\\\n */', '')"]
b'/**\n * Creates a new {@link KijiDataRequestBuilder}. Use this to configure a KijiDataRequest,\n * then create one with the {@link KijiDataRequestBuilder#build()} method.\n *\n * @return a new KijiDataRequestBuilder.\n */'public static KijiDataRequestBuilder builder() { return new KijiDataRequestBuilde...
@Test public void testInvalidColumnSpec() { // The user really wants 'builder.columns().add("family", "qualifier")'. // This will throw an exception. try { KijiDataRequest.builder().newColumnsDef().addFamily("family:qualifier"); fail("An exception should have been thrown."); } catch...
['(\'/**\\\\n * Gets a builder configured with default Kiji URI fields.\\\\n *\\\\n * More precisely, the following defaults are initialized:\\\\n * <ul>\\\\n * <li>The Zookeeper quorum and client port is taken from the Hadoop <tt>Configuration</tt></li>\\\\n * <li>The Kiji instance name is set to <tt>K...
b'/**\n * Gets a builder configured with default Kiji URI fields.\n *\n * More precisely, the following defaults are initialized:\n * <ul>\n * <li>The Zookeeper quorum and client port is taken from the Hadoop <tt>Configuration</tt></li>\n * <li>The Kiji instance name is set to <tt>KConstants.DEFAULT_INS...
@Test public void testSingleHostDefaultInstance() { final KijiURI uri = KijiURI.newBuilder("kiji-hbase://zkhost:1234/default/table/col").build(); assertEquals("kiji-hbase", uri.getScheme()); assertEquals("zkhost", uri.getZookeeperQuorum().get(0)); assertEquals(1, uri.getZookeeperQuorum().size());...
Construct a new KijiDataRequest based on the configuration specified in this builder and its associated column builders pAfter calling build you may not use the builder anymorep @return a new KijiDataRequest object containing the column requests associated with this KijiDataRequestBuilder Entire families for which ...
b'/**\n * Construct a new KijiDataRequest based on the configuration specified in this builder\n * and its associated column builders.\n *\n * <p>After calling build(), you may not use the builder anymore.</p>\n *\n * @return a new KijiDataRequest object containing the column requests associated\n * w...
@Test public void testBuild() { KijiDataRequestBuilder builder = KijiDataRequest.builder(); builder.newColumnsDef().add("info", "foo"); KijiDataRequest request = builder.build(); // We should be able to use KijiDataRequest's create() method to similar effect. KijiDataRequest request2 = Kij...
["('/**\\\\n * Return a builder for columns associated with this KijiDataRequestBuilder.\\\\n *\\\\n * <p>Creates an object that allows you to specify a set of related columns attached\\\\n * to the same KijiDataRequest that all share the same retrieval properties, like\\\\n * the number of max versions.</p>\...
b'/**\n * Return a builder for columns associated with this KijiDataRequestBuilder.\n *\n * <p>Creates an object that allows you to specify a set of related columns attached\n * to the same KijiDataRequest that all share the same retrieval properties, like\n * the number of max versions.</p>\n *\n * @retu...
@Test public void testNoRedundantColumn() { KijiDataRequestBuilder builder = KijiDataRequest.builder(); try { builder.newColumnsDef().add("info", "foo").add("info", "foo"); fail("Should have thrown exception for redundant add"); } catch (IllegalArgumentException ise) { assertEqual...
["('/**\\\\n * Return a builder for columns associated with this KijiDataRequestBuilder.\\\\n *\\\\n * <p>Creates an object that allows you to specify a set of related columns attached\\\\n * to the same KijiDataRequest that all share the same retrieval properties, like\\\\n * the number of max versions.</p>\...
b'/**\n * Return a builder for columns associated with this KijiDataRequestBuilder.\n *\n * <p>Creates an object that allows you to specify a set of related columns attached\n * to the same KijiDataRequest that all share the same retrieval properties, like\n * the number of max versions.</p>\n *\n * @retu...
@Test public void testNoNegativeMaxVer() { KijiDataRequestBuilder builder = KijiDataRequest.builder(); try { builder.newColumnsDef().withMaxVersions(-5).addFamily("info"); fail("An exception should have been thrown."); } catch (IllegalArgumentException iae) { assertEquals("Maximum...