repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
alkacon/opencms-core
src/org/opencms/ui/CmsVaadinUtils.java
CmsVaadinUtils.prepareComboBox
public static void prepareComboBox(ComboBox box, Map<?, String> options) { IndexedContainer container = new IndexedContainer(); container.addContainerProperty(PROPERTY_VALUE, Object.class, null); container.addContainerProperty(PROPERTY_LABEL, String.class, ""); for (Entry<?, String> entry : options.entrySet()) { Item item = container.addItem(entry.getKey()); item.getItemProperty(PROPERTY_VALUE).setValue(entry.getKey()); item.getItemProperty(PROPERTY_LABEL).setValue(entry.getValue()); } box.setContainerDataSource(container); box.setItemCaptionPropertyId(PROPERTY_LABEL); }
java
public static void prepareComboBox(ComboBox box, Map<?, String> options) { IndexedContainer container = new IndexedContainer(); container.addContainerProperty(PROPERTY_VALUE, Object.class, null); container.addContainerProperty(PROPERTY_LABEL, String.class, ""); for (Entry<?, String> entry : options.entrySet()) { Item item = container.addItem(entry.getKey()); item.getItemProperty(PROPERTY_VALUE).setValue(entry.getKey()); item.getItemProperty(PROPERTY_LABEL).setValue(entry.getValue()); } box.setContainerDataSource(container); box.setItemCaptionPropertyId(PROPERTY_LABEL); }
[ "public", "static", "void", "prepareComboBox", "(", "ComboBox", "box", ",", "Map", "<", "?", ",", "String", ">", "options", ")", "{", "IndexedContainer", "container", "=", "new", "IndexedContainer", "(", ")", ";", "container", ".", "addContainerProperty", "(",...
Generates the options items for the combo box using the map entry keys as values and the values as labels.<p> @param box the combo box to prepare @param options the box options
[ "Generates", "the", "options", "items", "for", "the", "combo", "box", "using", "the", "map", "entry", "keys", "as", "values", "and", "the", "values", "as", "labels", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L1025-L1037
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java
SftpClient.getFiles
public SftpFile[] getFiles(String remote, String local, boolean resume) throws FileNotFoundException, SftpStatusException, SshException, TransferCancelledException { return getFiles(remote, local, null, resume); }
java
public SftpFile[] getFiles(String remote, String local, boolean resume) throws FileNotFoundException, SftpStatusException, SshException, TransferCancelledException { return getFiles(remote, local, null, resume); }
[ "public", "SftpFile", "[", "]", "getFiles", "(", "String", "remote", ",", "String", "local", ",", "boolean", "resume", ")", "throws", "FileNotFoundException", ",", "SftpStatusException", ",", "SshException", ",", "TransferCancelledException", "{", "return", "getFile...
Download the remote files into the local file. @param remote @param local @param resume attempt to resume an interrupted download @return SftpFile[] @throws FileNotFoundException @throws SftpStatusException @throws SshException @throws TransferCancelledException
[ "Download", "the", "remote", "files", "into", "the", "local", "file", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L2993-L2997
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java
DeploymentsInner.exportTemplate
public DeploymentExportResultInner exportTemplate(String resourceGroupName, String deploymentName) { return exportTemplateWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body(); }
java
public DeploymentExportResultInner exportTemplate(String resourceGroupName, String deploymentName) { return exportTemplateWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body(); }
[ "public", "DeploymentExportResultInner", "exportTemplate", "(", "String", "resourceGroupName", ",", "String", "deploymentName", ")", "{", "return", "exportTemplateWithServiceResponseAsync", "(", "resourceGroupName", ",", "deploymentName", ")", ".", "toBlocking", "(", ")", ...
Exports the template used for specified deployment. @param resourceGroupName The name of the resource group. The name is case insensitive. @param deploymentName The name of the deployment from which to get the template. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DeploymentExportResultInner object if successful.
[ "Exports", "the", "template", "used", "for", "specified", "deployment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java#L830-L832
tweea/matrixjavalib-main-common
src/main/java/net/matrix/data/DefaultTree.java
DefaultTree.generateSubNode
private static <ID, DATA> void generateSubNode(final TreeSource<ID, DATA> source, final DefaultTree<ID, DATA> node) { List<ID> items = source.listChildrenId(node.getId()); if (items == null || items.isEmpty()) { return; } for (ID id : items) { DATA item = source.getItem(id); node.appendChildNode(id, item); } for (DefaultTree<ID, DATA> subNode : new ArrayList<>(node.getChildNodes().values())) { generateSubNode(source, subNode); } }
java
private static <ID, DATA> void generateSubNode(final TreeSource<ID, DATA> source, final DefaultTree<ID, DATA> node) { List<ID> items = source.listChildrenId(node.getId()); if (items == null || items.isEmpty()) { return; } for (ID id : items) { DATA item = source.getItem(id); node.appendChildNode(id, item); } for (DefaultTree<ID, DATA> subNode : new ArrayList<>(node.getChildNodes().values())) { generateSubNode(source, subNode); } }
[ "private", "static", "<", "ID", ",", "DATA", ">", "void", "generateSubNode", "(", "final", "TreeSource", "<", "ID", ",", "DATA", ">", "source", ",", "final", "DefaultTree", "<", "ID", ",", "DATA", ">", "node", ")", "{", "List", "<", "ID", ">", "items...
向 TreeSource 增加新的节点。 @param <ID> 数据标识 @param <DATA> 数据 @param source 节点构造源 @param node 父节点
[ "向", "TreeSource", "增加新的节点。" ]
train
https://github.com/tweea/matrixjavalib-main-common/blob/ac8f98322a422e3ef76c3e12d47b98268cec7006/src/main/java/net/matrix/data/DefaultTree.java#L411-L423
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java
PyExpressionGenerator._generate
protected XExpression _generate(XPostfixOperation operation, IAppendable it, IExtraLanguageGeneratorContext context) { appendReturnIfExpectedReturnedExpression(it, context); final String operator = getOperatorSymbol(operation); if (operator != null) { it.append("("); //$NON-NLS-1$ switch (operator) { case "++": //$NON-NLS-1$ generate(operation.getOperand(), it, context); it.append(" += 1"); //$NON-NLS-1$ break; case "--": //$NON-NLS-1$ generate(operation.getOperand(), it, context); it.append(" -= 1"); //$NON-NLS-1$ break; default: throw new IllegalArgumentException(MessageFormat.format(Messages.PyExpressionGenerator_0, operator)); } it.append(")"); //$NON-NLS-1$ } return operation; }
java
protected XExpression _generate(XPostfixOperation operation, IAppendable it, IExtraLanguageGeneratorContext context) { appendReturnIfExpectedReturnedExpression(it, context); final String operator = getOperatorSymbol(operation); if (operator != null) { it.append("("); //$NON-NLS-1$ switch (operator) { case "++": //$NON-NLS-1$ generate(operation.getOperand(), it, context); it.append(" += 1"); //$NON-NLS-1$ break; case "--": //$NON-NLS-1$ generate(operation.getOperand(), it, context); it.append(" -= 1"); //$NON-NLS-1$ break; default: throw new IllegalArgumentException(MessageFormat.format(Messages.PyExpressionGenerator_0, operator)); } it.append(")"); //$NON-NLS-1$ } return operation; }
[ "protected", "XExpression", "_generate", "(", "XPostfixOperation", "operation", ",", "IAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "appendReturnIfExpectedReturnedExpression", "(", "it", ",", "context", ")", ";", "final", "String", "ope...
Generate the given object. @param operation the postfix operator. @param it the target for the generated content. @param context the context. @return the operation.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L523-L543
Alluxio/alluxio
core/client/hdfs/src/main/java/alluxio/hadoop/AbstractFileSystem.java
AbstractFileSystem.mkdirs
@Override public boolean mkdirs(Path path, FsPermission permission) throws IOException { LOG.debug("mkdirs({}, {})", path, permission); if (mStatistics != null) { mStatistics.incrementWriteOps(1); } AlluxioURI uri = new AlluxioURI(HadoopUtils.getPathWithoutScheme(path)); CreateDirectoryPOptions options = CreateDirectoryPOptions.newBuilder().setRecursive(true) .setAllowExists(true).setMode(new Mode(permission.toShort()).toProto()).build(); try { mFileSystem.createDirectory(uri, options); return true; } catch (AlluxioException e) { throw new IOException(e); } }
java
@Override public boolean mkdirs(Path path, FsPermission permission) throws IOException { LOG.debug("mkdirs({}, {})", path, permission); if (mStatistics != null) { mStatistics.incrementWriteOps(1); } AlluxioURI uri = new AlluxioURI(HadoopUtils.getPathWithoutScheme(path)); CreateDirectoryPOptions options = CreateDirectoryPOptions.newBuilder().setRecursive(true) .setAllowExists(true).setMode(new Mode(permission.toShort()).toProto()).build(); try { mFileSystem.createDirectory(uri, options); return true; } catch (AlluxioException e) { throw new IOException(e); } }
[ "@", "Override", "public", "boolean", "mkdirs", "(", "Path", "path", ",", "FsPermission", "permission", ")", "throws", "IOException", "{", "LOG", ".", "debug", "(", "\"mkdirs({}, {})\"", ",", "path", ",", "permission", ")", ";", "if", "(", "mStatistics", "!=...
Attempts to create a folder with the specified path. Parent directories will be created. @param path path to create @param permission permissions to grant the created folder @return true if the indicated folder is created successfully or already exists
[ "Attempts", "to", "create", "a", "folder", "with", "the", "specified", "path", ".", "Parent", "directories", "will", "be", "created", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/hdfs/src/main/java/alluxio/hadoop/AbstractFileSystem.java#L637-L652
gallandarakhneorg/afc
core/references/src/main/java/org/arakhne/afc/references/WeakArrayList.java
WeakArrayList.assertRange
protected void assertRange(int index, boolean allowLast) { final int csize = expurge(); if (index < 0) { throw new IndexOutOfBoundsException(Locale.getString("E1", index)); //$NON-NLS-1$ } if (allowLast && (index > csize)) { throw new IndexOutOfBoundsException(Locale.getString("E2", csize, index)); //$NON-NLS-1$ } if (!allowLast && (index >= csize)) { throw new IndexOutOfBoundsException(Locale.getString("E3", csize, index)); //$NON-NLS-1$ } }
java
protected void assertRange(int index, boolean allowLast) { final int csize = expurge(); if (index < 0) { throw new IndexOutOfBoundsException(Locale.getString("E1", index)); //$NON-NLS-1$ } if (allowLast && (index > csize)) { throw new IndexOutOfBoundsException(Locale.getString("E2", csize, index)); //$NON-NLS-1$ } if (!allowLast && (index >= csize)) { throw new IndexOutOfBoundsException(Locale.getString("E3", csize, index)); //$NON-NLS-1$ } }
[ "protected", "void", "assertRange", "(", "int", "index", ",", "boolean", "allowLast", ")", "{", "final", "int", "csize", "=", "expurge", "(", ")", ";", "if", "(", "index", "<", "0", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "Locale", "....
Verify if the specified index is inside the array. @param index is the index totest @param allowLast indicates if the last elements is assumed to be valid or not.
[ "Verify", "if", "the", "specified", "index", "is", "inside", "the", "array", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/references/src/main/java/org/arakhne/afc/references/WeakArrayList.java#L271-L282
httl/httl
httl/src/main/java/httl/spi/engines/DefaultEngine.java
DefaultEngine.getProperty
@SuppressWarnings("unchecked") public <T> T getProperty(String key, Class<T> cls) { if (properties != null) { if (cls != null && cls != Object.class && cls != String.class && !cls.isInterface() && !cls.isArray()) { // engine.getProperty("loaders", ClasspathLoader.class); key = key + "=" + cls.getName(); } Object value = properties.get(key); if (value != null) { if (cls == String.class && value.getClass() != String.class) { return (T) value.getClass().getName(); } return (T) value; } } return null; }
java
@SuppressWarnings("unchecked") public <T> T getProperty(String key, Class<T> cls) { if (properties != null) { if (cls != null && cls != Object.class && cls != String.class && !cls.isInterface() && !cls.isArray()) { // engine.getProperty("loaders", ClasspathLoader.class); key = key + "=" + cls.getName(); } Object value = properties.get(key); if (value != null) { if (cls == String.class && value.getClass() != String.class) { return (T) value.getClass().getName(); } return (T) value; } } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "getProperty", "(", "String", "key", ",", "Class", "<", "T", ">", "cls", ")", "{", "if", "(", "properties", "!=", "null", ")", "{", "if", "(", "cls", "!=", "null", "&...
Get config instantiated value. @param key - config key @param cls - config value type @return config value @see #getEngine()
[ "Get", "config", "instantiated", "value", "." ]
train
https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/spi/engines/DefaultEngine.java#L120-L137
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.setText
public void setText(int index, String value) { set(selectField(TaskFieldLists.CUSTOM_TEXT, index), value); }
java
public void setText(int index, String value) { set(selectField(TaskFieldLists.CUSTOM_TEXT, index), value); }
[ "public", "void", "setText", "(", "int", "index", ",", "String", "value", ")", "{", "set", "(", "selectField", "(", "TaskFieldLists", ".", "CUSTOM_TEXT", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set a text value. @param index text index (1-30) @param value text value
[ "Set", "a", "text", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L2595-L2598
QSFT/Doradus
doradus-common/src/main/java/com/dell/doradus/common/Utils.java
Utils.formatDate
public static String formatDate(long time) { // Map date/time to a GregorianCalendar object (local time zone). GregorianCalendar date = new GregorianCalendar(); date.setTimeInMillis(time); return formatDate(date, Calendar.SECOND); }
java
public static String formatDate(long time) { // Map date/time to a GregorianCalendar object (local time zone). GregorianCalendar date = new GregorianCalendar(); date.setTimeInMillis(time); return formatDate(date, Calendar.SECOND); }
[ "public", "static", "String", "formatDate", "(", "long", "time", ")", "{", "// Map date/time to a GregorianCalendar object (local time zone).\r", "GregorianCalendar", "date", "=", "new", "GregorianCalendar", "(", ")", ";", "date", ".", "setTimeInMillis", "(", "time", ")...
Format a Date.getTime() value as "YYYY-MM-DD HH:mm:ss". This method creates a GregorianCalendar object using the <i>local</i> time zone and then calls {@link #formatDate(Calendar)}. @param time Date/time in Date.getTime() format (milliseconds since the epoch). @return "YYYY-MM-DD HH:mm:ss".
[ "Format", "a", "Date", ".", "getTime", "()", "value", "as", "YYYY", "-", "MM", "-", "DD", "HH", ":", "mm", ":", "ss", ".", "This", "method", "creates", "a", "GregorianCalendar", "object", "using", "the", "<i", ">", "local<", "/", "i", ">", "time", ...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/Utils.java#L794-L799
zaproxy/zaproxy
src/org/zaproxy/zap/utils/PausableScheduledThreadPoolExecutor.java
PausableScheduledThreadPoolExecutor.submit
@Override public Future<?> submit(Runnable task) { return schedule(task, getDefaultDelayForTask(), TimeUnit.MILLISECONDS); }
java
@Override public Future<?> submit(Runnable task) { return schedule(task, getDefaultDelayForTask(), TimeUnit.MILLISECONDS); }
[ "@", "Override", "public", "Future", "<", "?", ">", "submit", "(", "Runnable", "task", ")", "{", "return", "schedule", "(", "task", ",", "getDefaultDelayForTask", "(", ")", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}" ]
{@inheritDoc} <p> Overridden to schedule with default delay, when non zero. @throws RejectedExecutionException {@inheritDoc} @throws NullPointerException {@inheritDoc} @see #setIncrementalDefaultDelay(boolean) @see #schedule(Runnable, long, TimeUnit) @see #setDefaultDelay(long, TimeUnit)
[ "{", "@inheritDoc", "}", "<p", ">", "Overridden", "to", "schedule", "with", "default", "delay", "when", "non", "zero", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/PausableScheduledThreadPoolExecutor.java#L236-L239
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java
RTMPHandshake.initRC4Encryption
protected void initRC4Encryption(byte[] sharedSecret) { log.debug("Shared secret: {}", Hex.encodeHexString(sharedSecret)); // create output cipher log.debug("Outgoing public key [{}]: {}", outgoingPublicKey.length, Hex.encodeHexString(outgoingPublicKey)); byte[] rc4keyOut = new byte[32]; // digest is 32 bytes, but our key is 16 calculateHMAC_SHA256(outgoingPublicKey, 0, outgoingPublicKey.length, sharedSecret, KEY_LENGTH, rc4keyOut, 0); log.debug("RC4 Out Key: {}", Hex.encodeHexString(Arrays.copyOfRange(rc4keyOut, 0, 16))); try { cipherOut = Cipher.getInstance("RC4"); cipherOut.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(rc4keyOut, 0, 16, "RC4")); } catch (Exception e) { log.warn("Encryption cipher creation failed", e); } // create input cipher log.debug("Incoming public key [{}]: {}", incomingPublicKey.length, Hex.encodeHexString(incomingPublicKey)); // digest is 32 bytes, but our key is 16 byte[] rc4keyIn = new byte[32]; calculateHMAC_SHA256(incomingPublicKey, 0, incomingPublicKey.length, sharedSecret, KEY_LENGTH, rc4keyIn, 0); log.debug("RC4 In Key: {}", Hex.encodeHexString(Arrays.copyOfRange(rc4keyIn, 0, 16))); try { cipherIn = Cipher.getInstance("RC4"); cipherIn.init(Cipher.DECRYPT_MODE, new SecretKeySpec(rc4keyIn, 0, 16, "RC4")); } catch (Exception e) { log.warn("Decryption cipher creation failed", e); } }
java
protected void initRC4Encryption(byte[] sharedSecret) { log.debug("Shared secret: {}", Hex.encodeHexString(sharedSecret)); // create output cipher log.debug("Outgoing public key [{}]: {}", outgoingPublicKey.length, Hex.encodeHexString(outgoingPublicKey)); byte[] rc4keyOut = new byte[32]; // digest is 32 bytes, but our key is 16 calculateHMAC_SHA256(outgoingPublicKey, 0, outgoingPublicKey.length, sharedSecret, KEY_LENGTH, rc4keyOut, 0); log.debug("RC4 Out Key: {}", Hex.encodeHexString(Arrays.copyOfRange(rc4keyOut, 0, 16))); try { cipherOut = Cipher.getInstance("RC4"); cipherOut.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(rc4keyOut, 0, 16, "RC4")); } catch (Exception e) { log.warn("Encryption cipher creation failed", e); } // create input cipher log.debug("Incoming public key [{}]: {}", incomingPublicKey.length, Hex.encodeHexString(incomingPublicKey)); // digest is 32 bytes, but our key is 16 byte[] rc4keyIn = new byte[32]; calculateHMAC_SHA256(incomingPublicKey, 0, incomingPublicKey.length, sharedSecret, KEY_LENGTH, rc4keyIn, 0); log.debug("RC4 In Key: {}", Hex.encodeHexString(Arrays.copyOfRange(rc4keyIn, 0, 16))); try { cipherIn = Cipher.getInstance("RC4"); cipherIn.init(Cipher.DECRYPT_MODE, new SecretKeySpec(rc4keyIn, 0, 16, "RC4")); } catch (Exception e) { log.warn("Decryption cipher creation failed", e); } }
[ "protected", "void", "initRC4Encryption", "(", "byte", "[", "]", "sharedSecret", ")", "{", "log", ".", "debug", "(", "\"Shared secret: {}\"", ",", "Hex", ".", "encodeHexString", "(", "sharedSecret", ")", ")", ";", "// create output cipher\r", "log", ".", "debug"...
Prepare the ciphers. @param sharedSecret shared secret byte sequence
[ "Prepare", "the", "ciphers", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L213-L239
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeUtil.java
TreeUtil.getContextForId
public static UIContext getContextForId(final WComponent root, final String id) { return getContextForId(root, id, false); }
java
public static UIContext getContextForId(final WComponent root, final String id) { return getContextForId(root, id, false); }
[ "public", "static", "UIContext", "getContextForId", "(", "final", "WComponent", "root", ",", "final", "String", "id", ")", "{", "return", "getContextForId", "(", "root", ",", "id", ",", "false", ")", ";", "}" ]
Retrieves the context for the component with the given Id. <p> Searches visible and not visible components. </p> @param root the root component to search from. @param id the id to search for. @return the context for the component with the given id, or null if not found.
[ "Retrieves", "the", "context", "for", "the", "component", "with", "the", "given", "Id", ".", "<p", ">", "Searches", "visible", "and", "not", "visible", "components", ".", "<", "/", "p", ">" ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeUtil.java#L155-L157
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/Adapters.java
Adapters.createPutAdapter
public static PutAdapter createPutAdapter(Configuration config, BigtableOptions options) { boolean setClientTimestamp = !options.getRetryOptions().allowRetriesWithoutTimestamp(); return new PutAdapter(config.getInt("hbase.client.keyvalue.maxsize", -1), setClientTimestamp); }
java
public static PutAdapter createPutAdapter(Configuration config, BigtableOptions options) { boolean setClientTimestamp = !options.getRetryOptions().allowRetriesWithoutTimestamp(); return new PutAdapter(config.getInt("hbase.client.keyvalue.maxsize", -1), setClientTimestamp); }
[ "public", "static", "PutAdapter", "createPutAdapter", "(", "Configuration", "config", ",", "BigtableOptions", "options", ")", "{", "boolean", "setClientTimestamp", "=", "!", "options", ".", "getRetryOptions", "(", ")", ".", "allowRetriesWithoutTimestamp", "(", ")", ...
<p>createPutAdapter.</p> @param config a {@link org.apache.hadoop.conf.Configuration} object. @param options a {@link com.google.cloud.bigtable.config.BigtableOptions} object. @return a {@link com.google.cloud.bigtable.hbase.adapters.PutAdapter} object.
[ "<p", ">", "createPutAdapter", ".", "<", "/", "p", ">" ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/Adapters.java#L88-L91
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByFacebook
public Iterable<DContact> queryByFacebook(Object parent, java.lang.String facebook) { return queryByField(parent, DContactMapper.Field.FACEBOOK.getFieldName(), facebook); }
java
public Iterable<DContact> queryByFacebook(Object parent, java.lang.String facebook) { return queryByField(parent, DContactMapper.Field.FACEBOOK.getFieldName(), facebook); }
[ "public", "Iterable", "<", "DContact", ">", "queryByFacebook", "(", "Object", "parent", ",", "java", ".", "lang", ".", "String", "facebook", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "FACEBOOK", ".", "getFie...
query-by method for field facebook @param facebook the specified attribute @return an Iterable of DContacts for the specified facebook
[ "query", "-", "by", "method", "for", "field", "facebook" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L160-L162
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/ImagesInner.java
ImagesInner.beginUpdateAsync
public Observable<ImageInner> beginUpdateAsync(String resourceGroupName, String imageName, ImageUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters).map(new Func1<ServiceResponse<ImageInner>, ImageInner>() { @Override public ImageInner call(ServiceResponse<ImageInner> response) { return response.body(); } }); }
java
public Observable<ImageInner> beginUpdateAsync(String resourceGroupName, String imageName, ImageUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters).map(new Func1<ServiceResponse<ImageInner>, ImageInner>() { @Override public ImageInner call(ServiceResponse<ImageInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ImageInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "imageName", ",", "ImageUpdate", "parameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "imageName", "...
Update an image. @param resourceGroupName The name of the resource group. @param imageName The name of the image. @param parameters Parameters supplied to the Update Image operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ImageInner object
[ "Update", "an", "image", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/ImagesInner.java#L402-L409
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerImpl.java
LayerImpl.setResponse
protected InputStream setResponse(HttpServletRequest request, HttpServletResponse response, CacheEntry entry) throws IOException { InputStream result; MutableObject<byte[]> sourceMap = RequestUtil.isSourceMapRequest(request) ? new MutableObject<byte[]>() : null; result = entry.getInputStream(request, sourceMap); if (sourceMap != null && sourceMap.getValue() != null) { byte[] sm = sourceMap.getValue(); result = new ByteArrayInputStream(sm); setResponseHeaders(request, response, sm.length); } else { setResponseHeaders(request, response, entry.getSize()); } return result; }
java
protected InputStream setResponse(HttpServletRequest request, HttpServletResponse response, CacheEntry entry) throws IOException { InputStream result; MutableObject<byte[]> sourceMap = RequestUtil.isSourceMapRequest(request) ? new MutableObject<byte[]>() : null; result = entry.getInputStream(request, sourceMap); if (sourceMap != null && sourceMap.getValue() != null) { byte[] sm = sourceMap.getValue(); result = new ByteArrayInputStream(sm); setResponseHeaders(request, response, sm.length); } else { setResponseHeaders(request, response, entry.getSize()); } return result; }
[ "protected", "InputStream", "setResponse", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "CacheEntry", "entry", ")", "throws", "IOException", "{", "InputStream", "result", ";", "MutableObject", "<", "byte", "[", "]", ">", "source...
Sets the response data in the response object and calls {@link #setResponseHeaders(HttpServletRequest, HttpServletResponse, int)} to set the headers. @param request The servlet request object @param response The servlet response object @param entry The {@link CacheEntry} object containing the response data. @return The input stream to the response data @throws IOException
[ "Sets", "the", "response", "data", "in", "the", "response", "object", "and", "calls", "{", "@link", "#setResponseHeaders", "(", "HttpServletRequest", "HttpServletResponse", "int", ")", "}", "to", "set", "the", "headers", "." ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerImpl.java#L577-L589
Waikato/moa
moa/src/main/java/moa/core/Utils.java
Utils.kthSmallestValue
public static double kthSmallestValue(int[] array, int k) { int[] index = new int[array.length]; for (int i = 0; i < index.length; i++) { index[i] = i; } return array[index[select(array, index, 0, array.length - 1, k)]]; }
java
public static double kthSmallestValue(int[] array, int k) { int[] index = new int[array.length]; for (int i = 0; i < index.length; i++) { index[i] = i; } return array[index[select(array, index, 0, array.length - 1, k)]]; }
[ "public", "static", "double", "kthSmallestValue", "(", "int", "[", "]", "array", ",", "int", "k", ")", "{", "int", "[", "]", "index", "=", "new", "int", "[", "array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "in...
Returns the kth-smallest value in the array. @param array the array of integers @param k the value of k @return the kth-smallest value
[ "Returns", "the", "kth", "-", "smallest", "value", "in", "the", "array", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/core/Utils.java#L1027-L1036
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java
Whitebox.getInternalState
@Deprecated public static <T> T getInternalState(Object object, String fieldName, Class<?> where, Class<T> type) { return Whitebox.getInternalState(object, fieldName, where); }
java
@Deprecated public static <T> T getInternalState(Object object, String fieldName, Class<?> where, Class<T> type) { return Whitebox.getInternalState(object, fieldName, where); }
[ "@", "Deprecated", "public", "static", "<", "T", ">", "T", "getInternalState", "(", "Object", "object", ",", "String", "fieldName", ",", "Class", "<", "?", ">", "where", ",", "Class", "<", "T", ">", "type", ")", "{", "return", "Whitebox", ".", "getInte...
Get the value of a field using reflection. Use this method when you need to specify in which class the field is declared. This might be useful when you have mocked the instance you are trying to access. Use this method to avoid casting. @deprecated Use {@link #getInternalState(Object, String, Class)} instead. @param <T> the expected type of the field @param object the object to modify @param fieldName the name of the field @param where which class the field is defined @param type the expected type of the field
[ "Get", "the", "value", "of", "a", "field", "using", "reflection", ".", "Use", "this", "method", "when", "you", "need", "to", "specify", "in", "which", "class", "the", "field", "is", "declared", ".", "This", "might", "be", "useful", "when", "you", "have",...
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java#L330-L333
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java
BinarySerde.doByteBufferPutCompressed
public static void doByteBufferPutCompressed(INDArray arr, ByteBuffer allocated, boolean rewind) { CompressedDataBuffer compressedDataBuffer = (CompressedDataBuffer) arr.data(); CompressionDescriptor descriptor = compressedDataBuffer.getCompressionDescriptor(); ByteBuffer codecByteBuffer = descriptor.toByteBuffer(); ByteBuffer buffer = arr.data().pointer().asByteBuffer().order(ByteOrder.nativeOrder()); ByteBuffer shapeBuffer = arr.shapeInfoDataBuffer().pointer().asByteBuffer().order(ByteOrder.nativeOrder()); allocated.putInt(arr.rank()); //put data opType next so its self describing allocated.putInt(arr.data().dataType().ordinal()); //put shape next allocated.put(shapeBuffer); //put codec information next allocated.put(codecByteBuffer); //finally put the data allocated.put(buffer); if (rewind) allocated.rewind(); }
java
public static void doByteBufferPutCompressed(INDArray arr, ByteBuffer allocated, boolean rewind) { CompressedDataBuffer compressedDataBuffer = (CompressedDataBuffer) arr.data(); CompressionDescriptor descriptor = compressedDataBuffer.getCompressionDescriptor(); ByteBuffer codecByteBuffer = descriptor.toByteBuffer(); ByteBuffer buffer = arr.data().pointer().asByteBuffer().order(ByteOrder.nativeOrder()); ByteBuffer shapeBuffer = arr.shapeInfoDataBuffer().pointer().asByteBuffer().order(ByteOrder.nativeOrder()); allocated.putInt(arr.rank()); //put data opType next so its self describing allocated.putInt(arr.data().dataType().ordinal()); //put shape next allocated.put(shapeBuffer); //put codec information next allocated.put(codecByteBuffer); //finally put the data allocated.put(buffer); if (rewind) allocated.rewind(); }
[ "public", "static", "void", "doByteBufferPutCompressed", "(", "INDArray", "arr", ",", "ByteBuffer", "allocated", ",", "boolean", "rewind", ")", "{", "CompressedDataBuffer", "compressedDataBuffer", "=", "(", "CompressedDataBuffer", ")", "arr", ".", "data", "(", ")", ...
Setup the given byte buffer for serialization (note that this is for compressed INDArrays) 4 bytes for rank 4 bytes for data opType shape information codec information data opType @param arr the array to setup @param allocated the byte buffer to setup @param rewind whether to rewind the byte buffer or not
[ "Setup", "the", "given", "byte", "buffer", "for", "serialization", "(", "note", "that", "this", "is", "for", "compressed", "INDArrays", ")", "4", "bytes", "for", "rank", "4", "bytes", "for", "data", "opType", "shape", "information", "codec", "information", "...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java#L235-L252
ysc/word
src/main/java/org/apdplat/word/recognition/RecognitionTool.java
RecognitionTool.recog
public static boolean recog(final String text, final int start, final int len){ if(!RECOGNITION_TOOL_ENABLED){ return false; } return isEnglishAndNumberMix(text, start, len) || isFraction(text, start, len) || isQuantifier(text, start, len) || isChineseNumber(text, start, len); }
java
public static boolean recog(final String text, final int start, final int len){ if(!RECOGNITION_TOOL_ENABLED){ return false; } return isEnglishAndNumberMix(text, start, len) || isFraction(text, start, len) || isQuantifier(text, start, len) || isChineseNumber(text, start, len); }
[ "public", "static", "boolean", "recog", "(", "final", "String", "text", ",", "final", "int", "start", ",", "final", "int", "len", ")", "{", "if", "(", "!", "RECOGNITION_TOOL_ENABLED", ")", "{", "return", "false", ";", "}", "return", "isEnglishAndNumberMix", ...
识别文本(英文单词、数字、时间等) @param text 识别文本 @param start 待识别文本开始索引 @param len 识别长度 @return 是否识别
[ "识别文本(英文单词、数字、时间等)" ]
train
https://github.com/ysc/word/blob/5e45607f4e97207f55d1e3bc561abda6b34f7c54/src/main/java/org/apdplat/word/recognition/RecognitionTool.java#L51-L59
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java
MutateInBuilder.upsert
@Deprecated public <T> MutateInBuilder upsert(String path, T fragment, boolean createPath) { asyncBuilder.upsert(path, fragment, new SubdocOptionsBuilder().createPath(createPath)); return this; }
java
@Deprecated public <T> MutateInBuilder upsert(String path, T fragment, boolean createPath) { asyncBuilder.upsert(path, fragment, new SubdocOptionsBuilder().createPath(createPath)); return this; }
[ "@", "Deprecated", "public", "<", "T", ">", "MutateInBuilder", "upsert", "(", "String", "path", ",", "T", "fragment", ",", "boolean", "createPath", ")", "{", "asyncBuilder", ".", "upsert", "(", "path", ",", "fragment", ",", "new", "SubdocOptionsBuilder", "("...
Insert a fragment, replacing the old value if the path exists. @param path the path where to insert (or replace) a dictionary value. @param fragment the new dictionary value to be applied. @param createPath true to create missing intermediary nodes.
[ "Insert", "a", "fragment", "replacing", "the", "old", "value", "if", "the", "path", "exists", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java#L578-L582
Ordinastie/MalisisCore
src/main/java/net/malisis/core/client/gui/element/position/Positions.java
Positions.rightAligned
public static <T extends ISized & IChild<U>, U extends ISized> IntSupplier rightAligned(T owner, int spacing) { return () -> { U parent = owner.getParent(); if (parent == null) return 0; return parent.size().width() - owner.size().width() - Padding.of(parent).right() - spacing; }; }
java
public static <T extends ISized & IChild<U>, U extends ISized> IntSupplier rightAligned(T owner, int spacing) { return () -> { U parent = owner.getParent(); if (parent == null) return 0; return parent.size().width() - owner.size().width() - Padding.of(parent).right() - spacing; }; }
[ "public", "static", "<", "T", "extends", "ISized", "&", "IChild", "<", "U", ">", ",", "U", "extends", "ISized", ">", "IntSupplier", "rightAligned", "(", "T", "owner", ",", "int", "spacing", ")", "{", "return", "(", ")", "->", "{", "U", "parent", "=",...
Positions the owner to the right inside its parent.<br> Respects the parent padding. @param <T> the generic type @param <U> the generic type @param spacing the spacing @return the int supplier
[ "Positions", "the", "owner", "to", "the", "right", "inside", "its", "parent", ".", "<br", ">", "Respects", "the", "parent", "padding", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/element/position/Positions.java#L69-L78
unic/neba
core/src/main/java/io/neba/core/util/ReflectionUtil.java
ReflectionUtil.instantiateCollectionType
public static <K, T extends Collection<K>> Collection<K> instantiateCollectionType(Class<T> collectionType) { return instantiateCollectionType(collectionType, DEFAULT_COLLECTION_SIZE); }
java
public static <K, T extends Collection<K>> Collection<K> instantiateCollectionType(Class<T> collectionType) { return instantiateCollectionType(collectionType, DEFAULT_COLLECTION_SIZE); }
[ "public", "static", "<", "K", ",", "T", "extends", "Collection", "<", "K", ">", ">", "Collection", "<", "K", ">", "instantiateCollectionType", "(", "Class", "<", "T", ">", "collectionType", ")", "{", "return", "instantiateCollectionType", "(", "collectionType"...
Creates an instance with a default capacity. @see #instantiateCollectionType(Class, int)
[ "Creates", "an", "instance", "with", "a", "default", "capacity", "." ]
train
https://github.com/unic/neba/blob/4d762e60112a1fcb850926a56a9843d5aa424c4b/core/src/main/java/io/neba/core/util/ReflectionUtil.java#L160-L162
FudanNLP/fnlp
fnlp-core/src/main/java/org/fnlp/nlp/pipe/seq/DictLabel.java
DictLabel.getNextN
public WordInfo getNextN(String[] data, int index, int N) { StringBuilder sb = new StringBuilder(); int i = index; while(sb.length()<N&&i<data.length){ sb.append(data[i]); i++; } if(sb.length()<=N) return new WordInfo(sb.toString(),i-index); else return new WordInfo(sb.substring(0,N),i-index); }
java
public WordInfo getNextN(String[] data, int index, int N) { StringBuilder sb = new StringBuilder(); int i = index; while(sb.length()<N&&i<data.length){ sb.append(data[i]); i++; } if(sb.length()<=N) return new WordInfo(sb.toString(),i-index); else return new WordInfo(sb.substring(0,N),i-index); }
[ "public", "WordInfo", "getNextN", "(", "String", "[", "]", "data", ",", "int", "index", ",", "int", "N", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "int", "i", "=", "index", ";", "while", "(", "sb", ".", "length", ...
得到从位置index开始的长度为N的字串 @param data String[] @param index 起始位置 @param N 长度 @return
[ "得到从位置index开始的长度为N的字串" ]
train
https://github.com/FudanNLP/fnlp/blob/ce258f3e4a5add2ba0b5e4cbac7cab2190af6659/fnlp-core/src/main/java/org/fnlp/nlp/pipe/seq/DictLabel.java#L166-L177
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java
MapExtensions.operator_plus
@Pure @Inline(value = "$3.union($1, $2)", imported = MapExtensions.class) public static <K, V> Map<K, V> operator_plus(Map<K, V> left, Map<? extends K, ? extends V> right) { return union(left, right); }
java
@Pure @Inline(value = "$3.union($1, $2)", imported = MapExtensions.class) public static <K, V> Map<K, V> operator_plus(Map<K, V> left, Map<? extends K, ? extends V> right) { return union(left, right); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"$3.union($1, $2)\"", ",", "imported", "=", "MapExtensions", ".", "class", ")", "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "operator_plus", "(", "Map", "<", "K", ",", ...
Merge the two maps. <p> The replied map is a view on the given map. It means that any change in the original map is reflected to the result of this operation. </p> <p> If a key exists in the left and right operands, the value in the right operand is preferred. </p> @param <K> type of the map keys. @param <V> type of the map values. @param left the left map. @param right the right map. @return a map with the merged contents from the two maps. @throws IllegalArgumentException - when a right operand key exists in the left operand. @since 2.15
[ "Merge", "the", "two", "maps", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java#L189-L193
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SignatureConverter.java
SignatureConverter.convertMethodSignature
public static String convertMethodSignature(InvokeInstruction inv, ConstantPoolGen cpg) { return convertMethodSignature(inv.getClassName(cpg), inv.getName(cpg), inv.getSignature(cpg)); }
java
public static String convertMethodSignature(InvokeInstruction inv, ConstantPoolGen cpg) { return convertMethodSignature(inv.getClassName(cpg), inv.getName(cpg), inv.getSignature(cpg)); }
[ "public", "static", "String", "convertMethodSignature", "(", "InvokeInstruction", "inv", ",", "ConstantPoolGen", "cpg", ")", "{", "return", "convertMethodSignature", "(", "inv", ".", "getClassName", "(", "cpg", ")", ",", "inv", ".", "getName", "(", "cpg", ")", ...
Convenience method for generating a method signature in human readable form. @param inv an InvokeInstruction @param cpg the ConstantPoolGen for the class the instruction belongs to
[ "Convenience", "method", "for", "generating", "a", "method", "signature", "in", "human", "readable", "form", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SignatureConverter.java#L170-L172
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.touch
public static File touch(File parent, String path) throws IORuntimeException { return touch(file(parent, path)); }
java
public static File touch(File parent, String path) throws IORuntimeException { return touch(file(parent, path)); }
[ "public", "static", "File", "touch", "(", "File", "parent", ",", "String", "path", ")", "throws", "IORuntimeException", "{", "return", "touch", "(", "file", "(", "parent", ",", "path", ")", ")", ";", "}" ]
创建文件及其父目录,如果这个文件存在,直接返回这个文件<br> 此方法不对File对象类型做判断,如果File不存在,无法判断其类型 @param parent 父文件对象 @param path 文件路径 @return File @throws IORuntimeException IO异常
[ "创建文件及其父目录,如果这个文件存在,直接返回这个文件<br", ">", "此方法不对File对象类型做判断,如果File不存在,无法判断其类型" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L634-L636
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java
SpiderTransaction.addLinkValue
public void addLinkValue(String ownerObjID, FieldDefinition linkDef, String targetObjID) { addColumn(SpiderService.objectsStoreName(linkDef.getTableDef()), ownerObjID, SpiderService.linkColumnName(linkDef, targetObjID)); }
java
public void addLinkValue(String ownerObjID, FieldDefinition linkDef, String targetObjID) { addColumn(SpiderService.objectsStoreName(linkDef.getTableDef()), ownerObjID, SpiderService.linkColumnName(linkDef, targetObjID)); }
[ "public", "void", "addLinkValue", "(", "String", "ownerObjID", ",", "FieldDefinition", "linkDef", ",", "String", "targetObjID", ")", "{", "addColumn", "(", "SpiderService", ".", "objectsStoreName", "(", "linkDef", ".", "getTableDef", "(", ")", ")", ",", "ownerOb...
Add a link value column to the objects store of the given object ID. @param ownerObjID Object ID of object owns the link field. @param linkDef {@link FieldDefinition} of the link field. @param targetObjID Referenced (target) object ID.
[ "Add", "a", "link", "value", "column", "to", "the", "objects", "store", "of", "the", "given", "object", "ID", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java#L252-L256
orbisgis/h2gis
h2gis-network/src/main/java/org/h2gis/network/functions/GraphFunctionParser.java
GraphFunctionParser.parseWeightAndOrientation
public void parseWeightAndOrientation(String arg1, String arg2) { if ((arg1 == null && arg2 == null) || (isWeightString(arg1) && arg2 == null) || (arg1 == null && isWeightString(arg2))) { // Disable default orientations (D and WD). throw new IllegalArgumentException("You must specify the orientation."); } if (isWeightString(arg1) && isWeightString(arg2)) { throw new IllegalArgumentException("Cannot specify the weight column twice."); } if (isOrientationString(arg1) && isOrientationString(arg2)) { throw new IllegalArgumentException("Cannot specify the orientation twice."); } if (isWeightString(arg1) || isOrientationString(arg2)) { setWeightAndOrientation(arg1, arg2); } if (isOrientationString(arg1) || isWeightString(arg2)) { setWeightAndOrientation(arg2, arg1); } }
java
public void parseWeightAndOrientation(String arg1, String arg2) { if ((arg1 == null && arg2 == null) || (isWeightString(arg1) && arg2 == null) || (arg1 == null && isWeightString(arg2))) { // Disable default orientations (D and WD). throw new IllegalArgumentException("You must specify the orientation."); } if (isWeightString(arg1) && isWeightString(arg2)) { throw new IllegalArgumentException("Cannot specify the weight column twice."); } if (isOrientationString(arg1) && isOrientationString(arg2)) { throw new IllegalArgumentException("Cannot specify the orientation twice."); } if (isWeightString(arg1) || isOrientationString(arg2)) { setWeightAndOrientation(arg1, arg2); } if (isOrientationString(arg1) || isWeightString(arg2)) { setWeightAndOrientation(arg2, arg1); } }
[ "public", "void", "parseWeightAndOrientation", "(", "String", "arg1", ",", "String", "arg2", ")", "{", "if", "(", "(", "arg1", "==", "null", "&&", "arg2", "==", "null", ")", "||", "(", "isWeightString", "(", "arg1", ")", "&&", "arg2", "==", "null", ")"...
Parse the weight and orientation(s) from two strings, given in arbitrary order. @param arg1 Weight or orientation @param arg2 Weight or orientation
[ "Parse", "the", "weight", "and", "orientation", "(", "s", ")", "from", "two", "strings", "given", "in", "arbitrary", "order", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-network/src/main/java/org/h2gis/network/functions/GraphFunctionParser.java#L150-L169
google/closure-templates
java/src/com/google/template/soy/jbcsrc/restricted/Statement.java
Statement.writeMethod
public final void writeMethod(int access, Method method, ClassVisitor visitor) { writeMethodTo(new CodeBuilder(access, method, null, visitor)); }
java
public final void writeMethod(int access, Method method, ClassVisitor visitor) { writeMethodTo(new CodeBuilder(access, method, null, visitor)); }
[ "public", "final", "void", "writeMethod", "(", "int", "access", ",", "Method", "method", ",", "ClassVisitor", "visitor", ")", "{", "writeMethodTo", "(", "new", "CodeBuilder", "(", "access", ",", "method", ",", "null", ",", "visitor", ")", ")", ";", "}" ]
Writes this statement to the {@link ClassVisitor} as a method. @param access The access modifiers of the method @param method The method signature @param visitor The class visitor to write it to
[ "Writes", "this", "statement", "to", "the", "{", "@link", "ClassVisitor", "}", "as", "a", "method", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/Statement.java#L124-L126
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.java
BuildInfo.generateBuildProperties
@TaskAction public void generateBuildProperties() { try { new BuildPropertiesWriter(new File(getDestinationDir(), "build-info.properties")).writeBuildProperties(new ProjectDetails( this.properties.getGroup(), (this.properties.getArtifact() != null) ? this.properties.getArtifact() : "unspecified", this.properties.getVersion(), this.properties.getName(), this.properties.getTime(), coerceToStringValues(this.properties.getAdditional()))); } catch (IOException ex) { throw new TaskExecutionException(this, ex); } }
java
@TaskAction public void generateBuildProperties() { try { new BuildPropertiesWriter(new File(getDestinationDir(), "build-info.properties")).writeBuildProperties(new ProjectDetails( this.properties.getGroup(), (this.properties.getArtifact() != null) ? this.properties.getArtifact() : "unspecified", this.properties.getVersion(), this.properties.getName(), this.properties.getTime(), coerceToStringValues(this.properties.getAdditional()))); } catch (IOException ex) { throw new TaskExecutionException(this, ex); } }
[ "@", "TaskAction", "public", "void", "generateBuildProperties", "(", ")", "{", "try", "{", "new", "BuildPropertiesWriter", "(", "new", "File", "(", "getDestinationDir", "(", ")", ",", "\"build-info.properties\"", ")", ")", ".", "writeBuildProperties", "(", "new", ...
Generates the {@code build-info.properties} file in the configured {@link #setDestinationDir(File) destination}.
[ "Generates", "the", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.java#L53-L68
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsLock.java
CmsLock.buildDefaultConfirmationJS
public String buildDefaultConfirmationJS() { StringBuffer html = new StringBuffer(512); html.append("<script type='text/javascript'><!--\n"); html.append("function setConfirmationMessage(locks, blockinglocks) {\n"); html.append("\tvar confMsg = document.getElementById('conf-msg');\n"); html.append("\tif (locks > -1) {\n"); if (!getSettings().getUserSettings().getDialogShowLock() && (CmsLock.getDialogAction(getCms()) != CmsLock.TYPE_LOCKS)) { // auto commit if lock dialog disabled html.append("\t\tif (blockinglocks == 0) {\n"); html.append("\t\t\tsubmitAction('"); html.append(CmsDialog.DIALOG_OK); html.append("', null, 'main');\n"); html.append("\t\t\tdocument.forms['main'].submit();\n"); html.append("\t\t\treturn;\n"); html.append("\t\t}\n"); } html.append("\t\tdocument.getElementById('lock-body-id').className = '';\n"); html.append("\t\tif (locks > '0') {\n"); html.append("\t\t\tshowAjaxReportContent();\n"); html.append("\t\t\tconfMsg.innerHTML = '"); html.append(getConfirmationMessage(false)); html.append("';\n"); html.append("\t\t} else {\n"); html.append("\t\t\tshowAjaxOk();\n"); html.append("\t\t\tconfMsg.innerHTML = '"); html.append(getConfirmationMessage(true)); html.append("';\n"); html.append("\t\t}\n"); html.append("\t} else {\n"); html.append("\t\tconfMsg.innerHTML = '"); html.append(key(org.opencms.workplace.Messages.GUI_AJAX_REPORT_WAIT_0)); html.append("';\n"); html.append("\t}\n"); html.append("}\n"); html.append("// -->\n"); html.append("</script>\n"); return html.toString(); }
java
public String buildDefaultConfirmationJS() { StringBuffer html = new StringBuffer(512); html.append("<script type='text/javascript'><!--\n"); html.append("function setConfirmationMessage(locks, blockinglocks) {\n"); html.append("\tvar confMsg = document.getElementById('conf-msg');\n"); html.append("\tif (locks > -1) {\n"); if (!getSettings().getUserSettings().getDialogShowLock() && (CmsLock.getDialogAction(getCms()) != CmsLock.TYPE_LOCKS)) { // auto commit if lock dialog disabled html.append("\t\tif (blockinglocks == 0) {\n"); html.append("\t\t\tsubmitAction('"); html.append(CmsDialog.DIALOG_OK); html.append("', null, 'main');\n"); html.append("\t\t\tdocument.forms['main'].submit();\n"); html.append("\t\t\treturn;\n"); html.append("\t\t}\n"); } html.append("\t\tdocument.getElementById('lock-body-id').className = '';\n"); html.append("\t\tif (locks > '0') {\n"); html.append("\t\t\tshowAjaxReportContent();\n"); html.append("\t\t\tconfMsg.innerHTML = '"); html.append(getConfirmationMessage(false)); html.append("';\n"); html.append("\t\t} else {\n"); html.append("\t\t\tshowAjaxOk();\n"); html.append("\t\t\tconfMsg.innerHTML = '"); html.append(getConfirmationMessage(true)); html.append("';\n"); html.append("\t\t}\n"); html.append("\t} else {\n"); html.append("\t\tconfMsg.innerHTML = '"); html.append(key(org.opencms.workplace.Messages.GUI_AJAX_REPORT_WAIT_0)); html.append("';\n"); html.append("\t}\n"); html.append("}\n"); html.append("// -->\n"); html.append("</script>\n"); return html.toString(); }
[ "public", "String", "buildDefaultConfirmationJS", "(", ")", "{", "StringBuffer", "html", "=", "new", "StringBuffer", "(", "512", ")", ";", "html", ".", "append", "(", "\"<script type='text/javascript'><!--\\n\"", ")", ";", "html", ".", "append", "(", "\"function s...
Returns the html code to build the dialogs default confirmation message js.<p> @return html code
[ "Returns", "the", "html", "code", "to", "build", "the", "dialogs", "default", "confirmation", "message", "js", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsLock.java#L335-L374
Bedework/bw-util
bw-util-misc/src/main/java/org/bedework/util/misc/Util.java
Util.makeRandomString
public static String makeRandomString(int length, int maxVal) { if (length < 0) { return null; } length = Math.min(length, 1025); if (maxVal < 0) { return null; } maxVal = Math.min(maxVal, 35); StringBuffer res = new StringBuffer(); Random rand = new Random(); for (int i = 0; i <= length; i++) { res.append(randChars[rand.nextInt(maxVal + 1)]); } return res.toString(); }
java
public static String makeRandomString(int length, int maxVal) { if (length < 0) { return null; } length = Math.min(length, 1025); if (maxVal < 0) { return null; } maxVal = Math.min(maxVal, 35); StringBuffer res = new StringBuffer(); Random rand = new Random(); for (int i = 0; i <= length; i++) { res.append(randChars[rand.nextInt(maxVal + 1)]); } return res.toString(); }
[ "public", "static", "String", "makeRandomString", "(", "int", "length", ",", "int", "maxVal", ")", "{", "if", "(", "length", "<", "0", ")", "{", "return", "null", ";", "}", "length", "=", "Math", ".", "min", "(", "length", ",", "1025", ")", ";", "i...
Creates a string of given length where each character comes from a set of values 0-9 followed by A-Z. @param length returned string will be this long. Less than 1k + 1 @param maxVal maximum ordinal value of characters. If < than 0, return null. If > 35, 35 is used instead. @return String the random string
[ "Creates", "a", "string", "of", "given", "length", "where", "each", "character", "comes", "from", "a", "set", "of", "values", "0", "-", "9", "followed", "by", "A", "-", "Z", "." ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L456-L477
bremersee/sms
src/main/java/org/bremersee/sms/GoyyaSmsService.java
GoyyaSmsService.createSendTime
protected String createSendTime(final Date sendTime) { if (sendTime == null || new Date(System.currentTimeMillis() + 1000L * 60L).after(sendTime)) { return null; } String customSendTimePattern = StringUtils.isBlank(this.sendTimePattern) ? DEFAULT_SEND_TIME_PATTERN : this.sendTimePattern; SimpleDateFormat sdf = new SimpleDateFormat(customSendTimePattern, Locale.GERMANY); sdf.setTimeZone(TimeZone.getTimeZone("Europe/Berlin")); return sdf.format(sendTime); }
java
protected String createSendTime(final Date sendTime) { if (sendTime == null || new Date(System.currentTimeMillis() + 1000L * 60L).after(sendTime)) { return null; } String customSendTimePattern = StringUtils.isBlank(this.sendTimePattern) ? DEFAULT_SEND_TIME_PATTERN : this.sendTimePattern; SimpleDateFormat sdf = new SimpleDateFormat(customSendTimePattern, Locale.GERMANY); sdf.setTimeZone(TimeZone.getTimeZone("Europe/Berlin")); return sdf.format(sendTime); }
[ "protected", "String", "createSendTime", "(", "final", "Date", "sendTime", ")", "{", "if", "(", "sendTime", "==", "null", "||", "new", "Date", "(", "System", ".", "currentTimeMillis", "(", ")", "+", "1000L", "*", "60L", ")", ".", "after", "(", "sendTime"...
Creates the send time URL parameter value. @param sendTime the send time as {@link Date} @return the send time URL parameter value
[ "Creates", "the", "send", "time", "URL", "parameter", "value", "." ]
train
https://github.com/bremersee/sms/blob/4e5e87ea98616dd316573b544f54cac56750d2f9/src/main/java/org/bremersee/sms/GoyyaSmsService.java#L392-L402
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.ensureSubResourcesOfMovedFoldersPublished
protected void ensureSubResourcesOfMovedFoldersPublished(CmsObject cms, CmsDbContext dbc, CmsPublishList pubList) throws CmsException { List<CmsResource> topMovedFolders = pubList.getTopMovedFolders(cms); Iterator<CmsResource> folderIt = topMovedFolders.iterator(); while (folderIt.hasNext()) { CmsResource folder = folderIt.next(); addSubResources(dbc, pubList, folder); } List<CmsResource> missingSubResources = pubList.getMissingSubResources(cms, topMovedFolders); if (missingSubResources.isEmpty()) { return; } StringBuffer pathBuffer = new StringBuffer(); for (CmsResource missing : missingSubResources) { pathBuffer.append(missing.getRootPath()); pathBuffer.append(" "); } throw new CmsVfsException( Messages.get().container(Messages.RPT_CHILDREN_OF_MOVED_FOLDER_NOT_PUBLISHED_1, pathBuffer.toString())); }
java
protected void ensureSubResourcesOfMovedFoldersPublished(CmsObject cms, CmsDbContext dbc, CmsPublishList pubList) throws CmsException { List<CmsResource> topMovedFolders = pubList.getTopMovedFolders(cms); Iterator<CmsResource> folderIt = topMovedFolders.iterator(); while (folderIt.hasNext()) { CmsResource folder = folderIt.next(); addSubResources(dbc, pubList, folder); } List<CmsResource> missingSubResources = pubList.getMissingSubResources(cms, topMovedFolders); if (missingSubResources.isEmpty()) { return; } StringBuffer pathBuffer = new StringBuffer(); for (CmsResource missing : missingSubResources) { pathBuffer.append(missing.getRootPath()); pathBuffer.append(" "); } throw new CmsVfsException( Messages.get().container(Messages.RPT_CHILDREN_OF_MOVED_FOLDER_NOT_PUBLISHED_1, pathBuffer.toString())); }
[ "protected", "void", "ensureSubResourcesOfMovedFoldersPublished", "(", "CmsObject", "cms", ",", "CmsDbContext", "dbc", ",", "CmsPublishList", "pubList", ")", "throws", "CmsException", "{", "List", "<", "CmsResource", ">", "topMovedFolders", "=", "pubList", ".", "getTo...
Tries to add sub-resources of moved folders to the publish list and throws an exception if the publish list still does not contain some sub-resources of the moved folders.<p> @param cms the current CMS context @param dbc the current database context @param pubList the publish list @throws CmsException if something goes wrong
[ "Tries", "to", "add", "sub", "-", "resources", "of", "moved", "folders", "to", "the", "publish", "list", "and", "throws", "an", "exception", "if", "the", "publish", "list", "still", "does", "not", "contain", "some", "sub", "-", "resources", "of", "the", ...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L10385-L10408
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.rotateLocal
public Matrix4d rotateLocal(double ang, double x, double y, double z, Matrix4d dest) { if ((properties & PROPERTY_IDENTITY) != 0) return dest.rotation(ang, x, y, z); return rotateLocalGeneric(ang, x, y, z, dest); }
java
public Matrix4d rotateLocal(double ang, double x, double y, double z, Matrix4d dest) { if ((properties & PROPERTY_IDENTITY) != 0) return dest.rotation(ang, x, y, z); return rotateLocalGeneric(ang, x, y, z, dest); }
[ "public", "Matrix4d", "rotateLocal", "(", "double", "ang", ",", "double", "x", ",", "double", "y", ",", "double", "z", ",", "Matrix4d", "dest", ")", "{", "if", "(", "(", "properties", "&", "PROPERTY_IDENTITY", ")", "!=", "0", ")", "return", "dest", "."...
Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified <code>(x, y, z)</code> axis and store the result in <code>dest</code>. <p> The axis described by the three components needs to be a unit vector. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotation(double, double, double, double) rotation()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotation(double, double, double, double) @param ang the angle in radians @param x the x component of the axis @param y the y component of the axis @param z the z component of the axis @param dest will hold the result @return dest
[ "Pre", "-", "multiply", "a", "rotation", "to", "this", "matrix", "by", "rotating", "the", "given", "amount", "of", "radians", "about", "the", "specified", "<code", ">", "(", "x", "y", "z", ")", "<", "/", "code", ">", "axis", "and", "store", "the", "r...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L5193-L5197
epam/parso
src/main/java/com/epam/parso/impl/SasFileParser.java
SasFileParser.chooseSubheaderClass
private SubheaderIndexes chooseSubheaderClass(long subheaderSignature, int compression, int type) { SubheaderIndexes subheaderIndex = SUBHEADER_SIGNATURE_TO_INDEX.get(subheaderSignature); if (sasFileProperties.isCompressed() && subheaderIndex == null && (compression == COMPRESSED_SUBHEADER_ID || compression == 0) && type == COMPRESSED_SUBHEADER_TYPE) { subheaderIndex = SubheaderIndexes.DATA_SUBHEADER_INDEX; } return subheaderIndex; }
java
private SubheaderIndexes chooseSubheaderClass(long subheaderSignature, int compression, int type) { SubheaderIndexes subheaderIndex = SUBHEADER_SIGNATURE_TO_INDEX.get(subheaderSignature); if (sasFileProperties.isCompressed() && subheaderIndex == null && (compression == COMPRESSED_SUBHEADER_ID || compression == 0) && type == COMPRESSED_SUBHEADER_TYPE) { subheaderIndex = SubheaderIndexes.DATA_SUBHEADER_INDEX; } return subheaderIndex; }
[ "private", "SubheaderIndexes", "chooseSubheaderClass", "(", "long", "subheaderSignature", ",", "int", "compression", ",", "int", "type", ")", "{", "SubheaderIndexes", "subheaderIndex", "=", "SUBHEADER_SIGNATURE_TO_INDEX", ".", "get", "(", "subheaderSignature", ")", ";",...
The function to determine the subheader type by its signature, {@link SubheaderPointer#compression}, and {@link SubheaderPointer#type}. @param subheaderSignature the subheader signature to search for in the {@link SasFileParser#SUBHEADER_SIGNATURE_TO_INDEX} mapping @param compression the type of subheader compression ({@link SubheaderPointer#compression}) @param type the subheader type ({@link SubheaderPointer#type}) @return an element from the {@link SubheaderIndexes} enumeration that defines the type of the current subheader
[ "The", "function", "to", "determine", "the", "subheader", "type", "by", "its", "signature", "{", "@link", "SubheaderPointer#compression", "}", "and", "{", "@link", "SubheaderPointer#type", "}", "." ]
train
https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/SasFileParser.java#L439-L446
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java
HtmlBuilder.divStyleHtmlContent
public static String divStyleHtmlContent(String style, String... content) { return tagStyleHtmlContent(Html.Tag.DIV, style, content); }
java
public static String divStyleHtmlContent(String style, String... content) { return tagStyleHtmlContent(Html.Tag.DIV, style, content); }
[ "public", "static", "String", "divStyleHtmlContent", "(", "String", "style", ",", "String", "...", "content", ")", "{", "return", "tagStyleHtmlContent", "(", "Html", ".", "Tag", ".", "DIV", ",", "style", ",", "content", ")", ";", "}" ]
Build a HTML DIV with given style for a string. Use this method if given content contains HTML snippets, prepared with {@link HtmlBuilder#htmlEncode(String)}. @param style style for div (plain CSS) @param content content string @return HTML DIV element as string
[ "Build", "a", "HTML", "DIV", "with", "given", "style", "for", "a", "string", ".", "Use", "this", "method", "if", "given", "content", "contains", "HTML", "snippets", "prepared", "with", "{", "@link", "HtmlBuilder#htmlEncode", "(", "String", ")", "}", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L215-L217
sebastiangraf/jSCSI
bundles/commons/src/main/java/org/jscsi/parser/BasicHeaderSegment.java
BasicHeaderSegment.setOperationCode
final void setOperationCode (final ProtocolDataUnit protocolDataUnit, final OperationCode initOperationCode) { operationCode = initOperationCode; parser = MessageParserFactory.getParser(protocolDataUnit, initOperationCode); }
java
final void setOperationCode (final ProtocolDataUnit protocolDataUnit, final OperationCode initOperationCode) { operationCode = initOperationCode; parser = MessageParserFactory.getParser(protocolDataUnit, initOperationCode); }
[ "final", "void", "setOperationCode", "(", "final", "ProtocolDataUnit", "protocolDataUnit", ",", "final", "OperationCode", "initOperationCode", ")", "{", "operationCode", "=", "initOperationCode", ";", "parser", "=", "MessageParserFactory", ".", "getParser", "(", "protoc...
Set a new operation code for this BHS object. @param protocolDataUnit The reference <code>ProtocolDataUnit</code> instance, which contains this <code>BasicHeaderSegment</code> object. @param initOperationCode The new operation code.
[ "Set", "a", "new", "operation", "code", "for", "this", "BHS", "object", "." ]
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/commons/src/main/java/org/jscsi/parser/BasicHeaderSegment.java#L340-L344
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/MemoryPersistenceManagerImpl.java
MemoryPersistenceManagerImpl.getStepExecutionTopLevelFromJobExecutionIdAndStepName
private TopLevelStepExecutionEntity getStepExecutionTopLevelFromJobExecutionIdAndStepName(long jobExecutionId, String stepName) { JobExecutionEntity jobExecution = data.executionInstanceData.get(jobExecutionId); // Copy list to avoid ConcurrentModificationException for (StepThreadExecutionEntity stepExec : new ArrayList<StepThreadExecutionEntity>(jobExecution.getStepThreadExecutions())) { if (stepExec.getStepName().equals(stepName)) { if (stepExec instanceof TopLevelStepExecutionEntity) { return (TopLevelStepExecutionEntity) stepExec; } } } // Bad if we've gotten here. throw new IllegalStateException("Couldn't find top-level step execution for jobExecution = " + jobExecutionId + ", and stepName = " + stepName); }
java
private TopLevelStepExecutionEntity getStepExecutionTopLevelFromJobExecutionIdAndStepName(long jobExecutionId, String stepName) { JobExecutionEntity jobExecution = data.executionInstanceData.get(jobExecutionId); // Copy list to avoid ConcurrentModificationException for (StepThreadExecutionEntity stepExec : new ArrayList<StepThreadExecutionEntity>(jobExecution.getStepThreadExecutions())) { if (stepExec.getStepName().equals(stepName)) { if (stepExec instanceof TopLevelStepExecutionEntity) { return (TopLevelStepExecutionEntity) stepExec; } } } // Bad if we've gotten here. throw new IllegalStateException("Couldn't find top-level step execution for jobExecution = " + jobExecutionId + ", and stepName = " + stepName); }
[ "private", "TopLevelStepExecutionEntity", "getStepExecutionTopLevelFromJobExecutionIdAndStepName", "(", "long", "jobExecutionId", ",", "String", "stepName", ")", "{", "JobExecutionEntity", "jobExecution", "=", "data", ".", "executionInstanceData", ".", "get", "(", "jobExecuti...
Not well-suited to factor out into an interface method since for JPA it's embedded in a tran typically
[ "Not", "well", "-", "suited", "to", "factor", "out", "into", "an", "interface", "method", "since", "for", "JPA", "it", "s", "embedded", "in", "a", "tran", "typically" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/MemoryPersistenceManagerImpl.java#L791-L803
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/writable/Text.java
Text.encode
public static ByteBuffer encode(String string, boolean replace) throws CharacterCodingException { CharsetEncoder encoder = ENCODER_FACTORY.get(); if (replace) { encoder.onMalformedInput(CodingErrorAction.REPLACE); encoder.onUnmappableCharacter(CodingErrorAction.REPLACE); } ByteBuffer bytes = encoder.encode(CharBuffer.wrap(string.toCharArray())); if (replace) { encoder.onMalformedInput(CodingErrorAction.REPORT); encoder.onUnmappableCharacter(CodingErrorAction.REPORT); } return bytes; }
java
public static ByteBuffer encode(String string, boolean replace) throws CharacterCodingException { CharsetEncoder encoder = ENCODER_FACTORY.get(); if (replace) { encoder.onMalformedInput(CodingErrorAction.REPLACE); encoder.onUnmappableCharacter(CodingErrorAction.REPLACE); } ByteBuffer bytes = encoder.encode(CharBuffer.wrap(string.toCharArray())); if (replace) { encoder.onMalformedInput(CodingErrorAction.REPORT); encoder.onUnmappableCharacter(CodingErrorAction.REPORT); } return bytes; }
[ "public", "static", "ByteBuffer", "encode", "(", "String", "string", ",", "boolean", "replace", ")", "throws", "CharacterCodingException", "{", "CharsetEncoder", "encoder", "=", "ENCODER_FACTORY", ".", "get", "(", ")", ";", "if", "(", "replace", ")", "{", "enc...
Converts the provided String to bytes using the UTF-8 encoding. If <code>replace</code> is true, then malformed input is replaced with the substitution character, which is U+FFFD. Otherwise the method throws a MalformedInputException. @return ByteBuffer: bytes stores at ByteBuffer.array() and length is ByteBuffer.limit()
[ "Converts", "the", "provided", "String", "to", "bytes", "using", "the", "UTF", "-", "8", "encoding", ".", "If", "<code", ">", "replace<", "/", "code", ">", "is", "true", "then", "malformed", "input", "is", "replaced", "with", "the", "substitution", "charac...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/writable/Text.java#L374-L386
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java
TypesafeConfigUtils.loadConfig
public static Config loadConfig(URL configUrl, boolean useSystemEnvironment) { return loadConfig(ConfigParseOptions.defaults(), ConfigResolveOptions.defaults().setUseSystemEnvironment(useSystemEnvironment), configUrl); }
java
public static Config loadConfig(URL configUrl, boolean useSystemEnvironment) { return loadConfig(ConfigParseOptions.defaults(), ConfigResolveOptions.defaults().setUseSystemEnvironment(useSystemEnvironment), configUrl); }
[ "public", "static", "Config", "loadConfig", "(", "URL", "configUrl", ",", "boolean", "useSystemEnvironment", ")", "{", "return", "loadConfig", "(", "ConfigParseOptions", ".", "defaults", "(", ")", ",", "ConfigResolveOptions", ".", "defaults", "(", ")", ".", "set...
Load, Parse & Resolve configurations from a URL, with default parse & resolve options. @param configUrl @param useSystemEnvironment {@code true} to resolve substitutions falling back to environment variables @return
[ "Load", "Parse", "&", "Resolve", "configurations", "from", "a", "URL", "with", "default", "parse", "&", "resolve", "options", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java#L103-L107
aws/aws-cloudtrail-processing-library
src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/manager/SqsManager.java
SqsManager.pollQueue
public List<Message> pollQueue() { boolean success = false; ProgressStatus pollQueueStatus = new ProgressStatus(ProgressState.pollQueue, new BasicPollQueueInfo(0, success)); final Object reportObject = progressReporter.reportStart(pollQueueStatus); ReceiveMessageRequest request = new ReceiveMessageRequest().withAttributeNames(ALL_ATTRIBUTES); request.setQueueUrl(config.getSqsUrl()); request.setVisibilityTimeout(config.getVisibilityTimeout()); request.setMaxNumberOfMessages(DEFAULT_SQS_MESSAGE_SIZE_LIMIT); request.setWaitTimeSeconds(DEFAULT_WAIT_TIME_SECONDS); List<Message> sqsMessages = new ArrayList<Message>(); try { ReceiveMessageResult result = sqsClient.receiveMessage(request); sqsMessages = result.getMessages(); logger.info("Polled " + sqsMessages.size() + " sqs messages from " + config.getSqsUrl()); success = true; } catch (AmazonServiceException e) { LibraryUtils.handleException(exceptionHandler, pollQueueStatus, e, "Failed to poll sqs message."); } finally { LibraryUtils.endToProcess(progressReporter, success, pollQueueStatus, reportObject); } return sqsMessages; }
java
public List<Message> pollQueue() { boolean success = false; ProgressStatus pollQueueStatus = new ProgressStatus(ProgressState.pollQueue, new BasicPollQueueInfo(0, success)); final Object reportObject = progressReporter.reportStart(pollQueueStatus); ReceiveMessageRequest request = new ReceiveMessageRequest().withAttributeNames(ALL_ATTRIBUTES); request.setQueueUrl(config.getSqsUrl()); request.setVisibilityTimeout(config.getVisibilityTimeout()); request.setMaxNumberOfMessages(DEFAULT_SQS_MESSAGE_SIZE_LIMIT); request.setWaitTimeSeconds(DEFAULT_WAIT_TIME_SECONDS); List<Message> sqsMessages = new ArrayList<Message>(); try { ReceiveMessageResult result = sqsClient.receiveMessage(request); sqsMessages = result.getMessages(); logger.info("Polled " + sqsMessages.size() + " sqs messages from " + config.getSqsUrl()); success = true; } catch (AmazonServiceException e) { LibraryUtils.handleException(exceptionHandler, pollQueueStatus, e, "Failed to poll sqs message."); } finally { LibraryUtils.endToProcess(progressReporter, success, pollQueueStatus, reportObject); } return sqsMessages; }
[ "public", "List", "<", "Message", ">", "pollQueue", "(", ")", "{", "boolean", "success", "=", "false", ";", "ProgressStatus", "pollQueueStatus", "=", "new", "ProgressStatus", "(", "ProgressState", ".", "pollQueue", ",", "new", "BasicPollQueueInfo", "(", "0", "...
Poll SQS queue for incoming messages, filter them, and return a list of SQS Messages. @return a list of SQS messages.
[ "Poll", "SQS", "queue", "for", "incoming", "messages", "filter", "them", "and", "return", "a", "list", "of", "SQS", "Messages", "." ]
train
https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/manager/SqsManager.java#L113-L140
SonarSource/sonarqube
sonar-core/src/main/java/org/sonar/core/util/Protobuf.java
Protobuf.readStream
public static <MSG extends Message> CloseableIterator<MSG> readStream(File file, Parser<MSG> parser) { try { // the input stream is closed by the CloseableIterator BufferedInputStream input = new BufferedInputStream(new FileInputStream(file)); return readStream(input, parser); } catch (Exception e) { throw ContextException.of("Unable to read messages", e).addContext("file", file); } }
java
public static <MSG extends Message> CloseableIterator<MSG> readStream(File file, Parser<MSG> parser) { try { // the input stream is closed by the CloseableIterator BufferedInputStream input = new BufferedInputStream(new FileInputStream(file)); return readStream(input, parser); } catch (Exception e) { throw ContextException.of("Unable to read messages", e).addContext("file", file); } }
[ "public", "static", "<", "MSG", "extends", "Message", ">", "CloseableIterator", "<", "MSG", ">", "readStream", "(", "File", "file", ",", "Parser", "<", "MSG", ">", "parser", ")", "{", "try", "{", "// the input stream is closed by the CloseableIterator", "BufferedI...
Reads a stream of messages. This method returns an empty iterator if there are no messages. An exception is raised on IO error, if file does not exist or if messages have a different type than {@code parser}.
[ "Reads", "a", "stream", "of", "messages", ".", "This", "method", "returns", "an", "empty", "iterator", "if", "there", "are", "no", "messages", ".", "An", "exception", "is", "raised", "on", "IO", "error", "if", "file", "does", "not", "exist", "or", "if", ...
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/util/Protobuf.java#L126-L134
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/event/MethodExpressionActionListener.java
MethodExpressionActionListener.restoreState
public void restoreState(FacesContext context, Object state) { if (context == null) { throw new NullPointerException(); } if (state == null) { return; } methodExpressionOneArg = (MethodExpression) ((Object[]) state)[0]; methodExpressionZeroArg = (MethodExpression) ((Object[]) state)[1]; }
java
public void restoreState(FacesContext context, Object state) { if (context == null) { throw new NullPointerException(); } if (state == null) { return; } methodExpressionOneArg = (MethodExpression) ((Object[]) state)[0]; methodExpressionZeroArg = (MethodExpression) ((Object[]) state)[1]; }
[ "public", "void", "restoreState", "(", "FacesContext", "context", ",", "Object", "state", ")", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "if", "(", "state", "==", "null", ")", "{", "r...
<p class="changed_modified_2_0">Both {@link MethodExpression} instances described in the constructor must be restored.</p>
[ "<p", "class", "=", "changed_modified_2_0", ">", "Both", "{" ]
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/event/MethodExpressionActionListener.java#L182-L193
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/base64/Base64.java
Base64.safeDecode
@Nullable @ReturnsMutableCopy public static byte [] safeDecode (@Nullable final byte [] aEncodedBytes, @Nonnegative final int nOfs, @Nonnegative final int nLen) { return safeDecode (aEncodedBytes, nOfs, nLen, DONT_GUNZIP); }
java
@Nullable @ReturnsMutableCopy public static byte [] safeDecode (@Nullable final byte [] aEncodedBytes, @Nonnegative final int nOfs, @Nonnegative final int nLen) { return safeDecode (aEncodedBytes, nOfs, nLen, DONT_GUNZIP); }
[ "@", "Nullable", "@", "ReturnsMutableCopy", "public", "static", "byte", "[", "]", "safeDecode", "(", "@", "Nullable", "final", "byte", "[", "]", "aEncodedBytes", ",", "@", "Nonnegative", "final", "int", "nOfs", ",", "@", "Nonnegative", "final", "int", "nLen"...
Decode the byte array. @param aEncodedBytes The encoded byte array. @param nOfs The offset of where to begin decoding @param nLen The number of characters to decode @return <code>null</code> if decoding failed.
[ "Decode", "the", "byte", "array", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/base64/Base64.java#L2614-L2621
jbundle/jbundle
base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HScreenField.java
HScreenField.printInputControl
public void printInputControl(PrintWriter out, String strFieldDesc, String strFieldName, String strSize, String strMaxSize, String strValue, String strControlType, int iHtmlAttributes) { out.println("<td><input type=\"" + strControlType + "\" name=\"" + strFieldName + "\" size=\"" + strSize + "\" maxlength=\"" + strMaxSize + "\" value=\"" + strValue + "\"/></td>"); }
java
public void printInputControl(PrintWriter out, String strFieldDesc, String strFieldName, String strSize, String strMaxSize, String strValue, String strControlType, int iHtmlAttributes) { out.println("<td><input type=\"" + strControlType + "\" name=\"" + strFieldName + "\" size=\"" + strSize + "\" maxlength=\"" + strMaxSize + "\" value=\"" + strValue + "\"/></td>"); }
[ "public", "void", "printInputControl", "(", "PrintWriter", "out", ",", "String", "strFieldDesc", ",", "String", "strFieldName", ",", "String", "strSize", ",", "String", "strMaxSize", ",", "String", "strValue", ",", "String", "strControlType", ",", "int", "iHtmlAtt...
Display this field in html input format. @param out The html out stream. @param strFieldDesc The field description. @param strFieldName The field name. @param strSize The control size. @param strMaxSize The string max size. @param strValue The default value. @param strControlType The control type. @param iHtmlAttribures The attributes.
[ "Display", "this", "field", "in", "html", "input", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HScreenField.java#L92-L96
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.createSessionLoginToken
public Object createSessionLoginToken(Map<String, Object> queryParams, String allowedOrigin) throws OAuthSystemException, OAuthProblemException, URISyntaxException { cleanError(); prepareToken(); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); URIBuilder url = new URIBuilder(settings.getURL(Constants.SESSION_LOGIN_TOKEN_URL)); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); if (allowedOrigin != null) { headers.put("Custom-Allowed-Origin-Header-1", allowedOrigin); } bearerRequest.setHeaders(headers); String body = JSONUtils.buildJSON(queryParams); bearerRequest.setBody(body); Object sessionToken = null; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class); if (oAuthResponse.getResponseCode() == 200) { if (oAuthResponse.getType().equals("success")) { JSONObject data = oAuthResponse.getData(); if (oAuthResponse.getMessage().equals("Success")) { sessionToken = new SessionTokenInfo(data); } else if (oAuthResponse.getMessage().equals("MFA is required for this user")) { sessionToken = new SessionTokenMFAInfo(data); } } } else { error = oAuthResponse.getError(); errorDescription = oAuthResponse.getErrorDescription(); } return sessionToken; }
java
public Object createSessionLoginToken(Map<String, Object> queryParams, String allowedOrigin) throws OAuthSystemException, OAuthProblemException, URISyntaxException { cleanError(); prepareToken(); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); URIBuilder url = new URIBuilder(settings.getURL(Constants.SESSION_LOGIN_TOKEN_URL)); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); if (allowedOrigin != null) { headers.put("Custom-Allowed-Origin-Header-1", allowedOrigin); } bearerRequest.setHeaders(headers); String body = JSONUtils.buildJSON(queryParams); bearerRequest.setBody(body); Object sessionToken = null; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class); if (oAuthResponse.getResponseCode() == 200) { if (oAuthResponse.getType().equals("success")) { JSONObject data = oAuthResponse.getData(); if (oAuthResponse.getMessage().equals("Success")) { sessionToken = new SessionTokenInfo(data); } else if (oAuthResponse.getMessage().equals("MFA is required for this user")) { sessionToken = new SessionTokenMFAInfo(data); } } } else { error = oAuthResponse.getError(); errorDescription = oAuthResponse.getErrorDescription(); } return sessionToken; }
[ "public", "Object", "createSessionLoginToken", "(", "Map", "<", "String", ",", "Object", ">", "queryParams", ",", "String", "allowedOrigin", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "cleanError", "(", ")", ...
Generates a session login token in scenarios in which MFA may or may not be required. A session login token expires two minutes after creation. @param queryParams Query Parameters (username_or_email, password, subdomain, return_to_url, ip_address, browser_id) @param allowedOrigin Custom-Allowed-Origin-Header. Required for CORS requests only. Set to the Origin URI from which you are allowed to send a request using CORS. @return SessionTokenInfo or SessionTokenMFAInfo object if success @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/users/create-session-login-token">Create Session Login Token documentation</a>
[ "Generates", "a", "session", "login", "token", "in", "scenarios", "in", "which", "MFA", "may", "or", "may", "not", "be", "required", ".", "A", "session", "login", "token", "expires", "two", "minutes", "after", "creation", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L816-L853
EvidentSolutions/dalesbred
dalesbred/src/main/java/org/dalesbred/internal/instantiation/InstantiatorProvider.java
InstantiatorProvider.getConversionFromDbValue
public @NotNull TypeConversion getConversionFromDbValue(@NotNull Type source, @NotNull Type target) { TypeConversion conversion = findConversionFromDbValue(source, target).orElse(null); if (conversion != null) return conversion; else throw new InstantiationFailureException("could not find a conversion from " + source.getTypeName() + " to " + target.getTypeName()); }
java
public @NotNull TypeConversion getConversionFromDbValue(@NotNull Type source, @NotNull Type target) { TypeConversion conversion = findConversionFromDbValue(source, target).orElse(null); if (conversion != null) return conversion; else throw new InstantiationFailureException("could not find a conversion from " + source.getTypeName() + " to " + target.getTypeName()); }
[ "public", "@", "NotNull", "TypeConversion", "getConversionFromDbValue", "(", "@", "NotNull", "Type", "source", ",", "@", "NotNull", "Type", "target", ")", "{", "TypeConversion", "conversion", "=", "findConversionFromDbValue", "(", "source", ",", "target", ")", "."...
Returns conversion for converting value of source-type to target-type, or throws exception if there's no such conversion.
[ "Returns", "conversion", "for", "converting", "value", "of", "source", "-", "type", "to", "target", "-", "type", "or", "throws", "exception", "if", "there", "s", "no", "such", "conversion", "." ]
train
https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/internal/instantiation/InstantiatorProvider.java#L239-L245
casmi/casmi
src/main/java/casmi/graphics/color/HSBColor.java
HSBColor.lerpColor
public static Color lerpColor(ColorSet colorSet1, ColorSet colorSet2, double amt) { return lerpColor((HSBColor)HSBColor.color(colorSet1), (HSBColor)HSBColor.color(colorSet2), amt); }
java
public static Color lerpColor(ColorSet colorSet1, ColorSet colorSet2, double amt) { return lerpColor((HSBColor)HSBColor.color(colorSet1), (HSBColor)HSBColor.color(colorSet2), amt); }
[ "public", "static", "Color", "lerpColor", "(", "ColorSet", "colorSet1", ",", "ColorSet", "colorSet2", ",", "double", "amt", ")", "{", "return", "lerpColor", "(", "(", "HSBColor", ")", "HSBColor", ".", "color", "(", "colorSet1", ")", ",", "(", "HSBColor", "...
Calculates a color or colors between two color at a specific increment. @param colorSet1 interpolate from this color @param colorSet2 interpolate to this color @param amt between 0.0 and 1.0 @return The calculated color values.
[ "Calculates", "a", "color", "or", "colors", "between", "two", "color", "at", "a", "specific", "increment", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/color/HSBColor.java#L256-L258
op4j/op4j
src/main/java/org/op4j/Op.java
Op.onArray
public static <T> Level0ArrayOperator<BigInteger[],BigInteger> onArray(final BigInteger[] target) { return onArrayOf(Types.BIG_INTEGER, target); }
java
public static <T> Level0ArrayOperator<BigInteger[],BigInteger> onArray(final BigInteger[] target) { return onArrayOf(Types.BIG_INTEGER, target); }
[ "public", "static", "<", "T", ">", "Level0ArrayOperator", "<", "BigInteger", "[", "]", ",", "BigInteger", ">", "onArray", "(", "final", "BigInteger", "[", "]", "target", ")", "{", "return", "onArrayOf", "(", "Types", ".", "BIG_INTEGER", ",", "target", ")",...
<p> Creates an <i>operation expression</i> on the specified target object. </p> @param target the target object on which the expression will execute @return an operator, ready for chaining
[ "<p", ">", "Creates", "an", "<i", ">", "operation", "expression<", "/", "i", ">", "on", "the", "specified", "target", "object", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L780-L782
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/buffer/MutableRoaringArray.java
MutableRoaringArray.appendCopiesAfter
protected void appendCopiesAfter(PointableRoaringArray highLowContainer, short beforeStart) { int startLocation = highLowContainer.getIndex(beforeStart); if (startLocation >= 0) { startLocation++; } else { startLocation = -startLocation - 1; } extendArray(highLowContainer.size() - startLocation); for (int i = startLocation; i < highLowContainer.size(); ++i) { this.keys[this.size] = highLowContainer.getKeyAtIndex(i); this.values[this.size] = highLowContainer.getContainerAtIndex(i).clone(); this.size++; } }
java
protected void appendCopiesAfter(PointableRoaringArray highLowContainer, short beforeStart) { int startLocation = highLowContainer.getIndex(beforeStart); if (startLocation >= 0) { startLocation++; } else { startLocation = -startLocation - 1; } extendArray(highLowContainer.size() - startLocation); for (int i = startLocation; i < highLowContainer.size(); ++i) { this.keys[this.size] = highLowContainer.getKeyAtIndex(i); this.values[this.size] = highLowContainer.getContainerAtIndex(i).clone(); this.size++; } }
[ "protected", "void", "appendCopiesAfter", "(", "PointableRoaringArray", "highLowContainer", ",", "short", "beforeStart", ")", "{", "int", "startLocation", "=", "highLowContainer", ".", "getIndex", "(", "beforeStart", ")", ";", "if", "(", "startLocation", ">=", "0", ...
Append copies of the values AFTER a specified key (may or may not be present) to end. @param highLowContainer the other array @param beforeStart given key is the largest key that we won't copy
[ "Append", "copies", "of", "the", "values", "AFTER", "a", "specified", "key", "(", "may", "or", "may", "not", "be", "present", ")", "to", "end", "." ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/MutableRoaringArray.java#L143-L158
fcrepo4/fcrepo4
fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java
ContentExposingResource.parseDigestHeader
protected static Collection<String> parseDigestHeader(final String digest) throws UnsupportedAlgorithmException { try { final Map<String, String> digestPairs = RFC3230_SPLITTER.split(nullToEmpty(digest)); final boolean allSupportedAlgorithms = digestPairs.keySet().stream().allMatch( ContentDigest.DIGEST_ALGORITHM::isSupportedAlgorithm); // If you have one or more digests that are all valid or no digests. if (digestPairs.isEmpty() || allSupportedAlgorithms) { return digestPairs.entrySet().stream() .filter(entry -> ContentDigest.DIGEST_ALGORITHM.isSupportedAlgorithm(entry.getKey())) .map(entry -> ContentDigest.asURI(entry.getKey(), entry.getValue()).toString()) .collect(Collectors.toSet()); } else { throw new UnsupportedAlgorithmException(String.format("Unsupported Digest Algorithim: %1$s", digest)); } } catch (final RuntimeException e) { if (e instanceof IllegalArgumentException) { throw new ClientErrorException("Invalid Digest header: " + digest + "\n", BAD_REQUEST); } throw e; } }
java
protected static Collection<String> parseDigestHeader(final String digest) throws UnsupportedAlgorithmException { try { final Map<String, String> digestPairs = RFC3230_SPLITTER.split(nullToEmpty(digest)); final boolean allSupportedAlgorithms = digestPairs.keySet().stream().allMatch( ContentDigest.DIGEST_ALGORITHM::isSupportedAlgorithm); // If you have one or more digests that are all valid or no digests. if (digestPairs.isEmpty() || allSupportedAlgorithms) { return digestPairs.entrySet().stream() .filter(entry -> ContentDigest.DIGEST_ALGORITHM.isSupportedAlgorithm(entry.getKey())) .map(entry -> ContentDigest.asURI(entry.getKey(), entry.getValue()).toString()) .collect(Collectors.toSet()); } else { throw new UnsupportedAlgorithmException(String.format("Unsupported Digest Algorithim: %1$s", digest)); } } catch (final RuntimeException e) { if (e instanceof IllegalArgumentException) { throw new ClientErrorException("Invalid Digest header: " + digest + "\n", BAD_REQUEST); } throw e; } }
[ "protected", "static", "Collection", "<", "String", ">", "parseDigestHeader", "(", "final", "String", "digest", ")", "throws", "UnsupportedAlgorithmException", "{", "try", "{", "final", "Map", "<", "String", ",", "String", ">", "digestPairs", "=", "RFC3230_SPLITTE...
Parse the RFC-3230 Digest response header value. Look for a sha1 checksum and return it as a urn, if missing or malformed an empty string is returned. @param digest The Digest header value @return the sha1 checksum value @throws UnsupportedAlgorithmException if an unsupported digest is used
[ "Parse", "the", "RFC", "-", "3230", "Digest", "response", "header", "value", ".", "Look", "for", "a", "sha1", "checksum", "and", "return", "it", "as", "a", "urn", "if", "missing", "or", "malformed", "an", "empty", "string", "is", "returned", "." ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L1156-L1177
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/context/FlushManager.java
FlushManager.onRollBack
private void onRollBack(PersistenceDelegator delegator, Map<Object, EventLog> eventCol) { if (eventCol != null && !eventCol.isEmpty()) { Collection<EventLog> events = eventCol.values(); Iterator<EventLog> iter = events.iterator(); while (iter.hasNext()) { try { EventLog event = iter.next(); Node node = event.getNode(); Class clazz = node.getDataClass(); EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(delegator.getKunderaMetadata(), clazz); Client client = delegator.getClient(metadata); // do manual rollback, if data is processed, and running // without transaction or with kundera's default transaction // support! if (node.isProcessed() && (!delegator.isTransactionInProgress() || MetadataUtils .defaultTransactionSupported(metadata.getPersistenceUnit(), delegator.getKunderaMetadata()))) { if (node.getOriginalNode() == null) { Object entityId = node.getEntityId(); client.remove(node.getData(), entityId); } else { client.persist(node.getOriginalNode()); } } // mark it null for garbage collection. event = null; } catch (Exception ex) { log.warn("Caught exception during rollback, Caused by:", ex); // bypass to next event } } } // mark it null for garbage collection. eventCol = null; }
java
private void onRollBack(PersistenceDelegator delegator, Map<Object, EventLog> eventCol) { if (eventCol != null && !eventCol.isEmpty()) { Collection<EventLog> events = eventCol.values(); Iterator<EventLog> iter = events.iterator(); while (iter.hasNext()) { try { EventLog event = iter.next(); Node node = event.getNode(); Class clazz = node.getDataClass(); EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(delegator.getKunderaMetadata(), clazz); Client client = delegator.getClient(metadata); // do manual rollback, if data is processed, and running // without transaction or with kundera's default transaction // support! if (node.isProcessed() && (!delegator.isTransactionInProgress() || MetadataUtils .defaultTransactionSupported(metadata.getPersistenceUnit(), delegator.getKunderaMetadata()))) { if (node.getOriginalNode() == null) { Object entityId = node.getEntityId(); client.remove(node.getData(), entityId); } else { client.persist(node.getOriginalNode()); } } // mark it null for garbage collection. event = null; } catch (Exception ex) { log.warn("Caught exception during rollback, Caused by:", ex); // bypass to next event } } } // mark it null for garbage collection. eventCol = null; }
[ "private", "void", "onRollBack", "(", "PersistenceDelegator", "delegator", ",", "Map", "<", "Object", ",", "EventLog", ">", "eventCol", ")", "{", "if", "(", "eventCol", "!=", "null", "&&", "!", "eventCol", ".", "isEmpty", "(", ")", ")", "{", "Collection", ...
On roll back. @param delegator the delegator @param eventCol the event col
[ "On", "roll", "back", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/context/FlushManager.java#L456-L502
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/PassThruTable.java
PassThruTable.doRecordChange
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) // init this field override for other value { if (this.getNextTable() != null) return this.getNextTable().doRecordChange(field, iChangeType, bDisplayOption); // Pass it on. return super.doRecordChange(field, iChangeType, bDisplayOption); }
java
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) // init this field override for other value { if (this.getNextTable() != null) return this.getNextTable().doRecordChange(field, iChangeType, bDisplayOption); // Pass it on. return super.doRecordChange(field, iChangeType, bDisplayOption); }
[ "public", "int", "doRecordChange", "(", "FieldInfo", "field", ",", "int", "iChangeType", ",", "boolean", "bDisplayOption", ")", "// init this field override for other value", "{", "if", "(", "this", ".", "getNextTable", "(", ")", "!=", "null", ")", "return", "this...
Called when a change is the record status is about to happen/has happened. <p />NOTE: This is where the notification message is sent after an ADD, DELETE, or UPDATE. @param field If the change is due to a field, pass the field. @param iChangeType The type of change. @param bDisplayOption If true display the fields on the screen. @return An error code.
[ "Called", "when", "a", "change", "is", "the", "record", "status", "is", "about", "to", "happen", "/", "has", "happened", ".", "<p", "/", ">", "NOTE", ":", "This", "is", "where", "the", "notification", "message", "is", "sent", "after", "an", "ADD", "DEL...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/PassThruTable.java#L127-L132
jbundle/jbundle
base/model/src/main/java/org/jbundle/base/model/Utility.java
Utility.getAsFormattedString
public static String getAsFormattedString(Map<String,Object> map, String strKey, Class<?> classData, Object objDefault) { Object objData = map.get(strKey); try { return Converter.formatObjectToString(objData, classData, objDefault); } catch (Exception ex) { return null; } }
java
public static String getAsFormattedString(Map<String,Object> map, String strKey, Class<?> classData, Object objDefault) { Object objData = map.get(strKey); try { return Converter.formatObjectToString(objData, classData, objDefault); } catch (Exception ex) { return null; } }
[ "public", "static", "String", "getAsFormattedString", "(", "Map", "<", "String", ",", "Object", ">", "map", ",", "String", "strKey", ",", "Class", "<", "?", ">", "classData", ",", "Object", "objDefault", ")", "{", "Object", "objData", "=", "map", ".", "g...
Get this item from the map and convert it to the target class. Convert this object to an formatted string. @param map The map to pull the param from. @param strKey The property key. @param classData The java class to convert the data to. @param objDefault The default value. @return The propety value in the correct class.
[ "Get", "this", "item", "from", "the", "map", "and", "convert", "it", "to", "the", "target", "class", ".", "Convert", "this", "object", "to", "an", "formatted", "string", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L479-L487
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/data/SparkDataValidation.java
SparkDataValidation.validateDataSets
public static ValidationResult validateDataSets(JavaSparkContext sc, String path, int[] featuresShape, int[] labelsShape) { return validateDataSets(sc, path, true, false, featuresShape, labelsShape); }
java
public static ValidationResult validateDataSets(JavaSparkContext sc, String path, int[] featuresShape, int[] labelsShape) { return validateDataSets(sc, path, true, false, featuresShape, labelsShape); }
[ "public", "static", "ValidationResult", "validateDataSets", "(", "JavaSparkContext", "sc", ",", "String", "path", ",", "int", "[", "]", "featuresShape", ",", "int", "[", "]", "labelsShape", ")", "{", "return", "validateDataSets", "(", "sc", ",", "path", ",", ...
Validate DataSet objects saved to the specified directory on HDFS by attempting to load them and checking their contents. Assumes DataSets were saved using {@link org.nd4j.linalg.dataset.DataSet#save(OutputStream)}.<br> This method (optionally) additionally validates the arrays using the specified shapes for the features and labels. Note: this method will also consider all files in subdirectories (i.e., is recursive). @param sc Spark context @param path HDFS path of the directory containing the saved DataSet objects @param featuresShape May be null. If non-null: feature arrays must match the specified shape, for all values with shape > 0. For example, if featuresShape = {-1,10} then the features must be rank 2, can have any size for the first dimension, but must have size 10 for the second dimension. @param labelsShape As per featuresShape, but for the labels instead @return Results of the validation
[ "Validate", "DataSet", "objects", "saved", "to", "the", "specified", "directory", "on", "HDFS", "by", "attempting", "to", "load", "them", "and", "checking", "their", "contents", ".", "Assumes", "DataSets", "were", "saved", "using", "{", "@link", "org", ".", ...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/data/SparkDataValidation.java#L68-L70
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java
AFPChainer.calcGap
private static int calcGap(AFP afp1 , AFP afp2) { int g = (afp1.getP1() - afp2.getP1()) - (afp1.getP2() - afp2.getP2()); if(g < 0) g = -g; return g; }
java
private static int calcGap(AFP afp1 , AFP afp2) { int g = (afp1.getP1() - afp2.getP1()) - (afp1.getP2() - afp2.getP2()); if(g < 0) g = -g; return g; }
[ "private", "static", "int", "calcGap", "(", "AFP", "afp1", ",", "AFP", "afp2", ")", "{", "int", "g", "=", "(", "afp1", ".", "getP1", "(", ")", "-", "afp2", ".", "getP1", "(", ")", ")", "-", "(", "afp1", ".", "getP2", "(", ")", "-", "afp2", "....
return the gaps between this and afp requiring afp1 > afp2 ( operator % in C)
[ "return", "the", "gaps", "between", "this", "and", "afp", "requiring", "afp1", ">", "afp2", "(", "operator", "%", "in", "C", ")" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java#L365-L370
TheHolyWaffle/League-of-Legends-XMPP-Chat-Library
src/main/java/com/github/theholywaffle/lolchatapi/wrapper/FriendGroup.java
FriendGroup.getFriends
public List<Friend> getFriends() { final List<Friend> friends = new ArrayList<>(); for (final RosterEntry e : get().getEntries()) { friends.add(new Friend(api, con, e)); } return friends; }
java
public List<Friend> getFriends() { final List<Friend> friends = new ArrayList<>(); for (final RosterEntry e : get().getEntries()) { friends.add(new Friend(api, con, e)); } return friends; }
[ "public", "List", "<", "Friend", ">", "getFriends", "(", ")", "{", "final", "List", "<", "Friend", ">", "friends", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "final", "RosterEntry", "e", ":", "get", "(", ")", ".", "getEntries", "(", ...
Gets a list of all Friends in this FriendGroup. @return list of all Friends in this group
[ "Gets", "a", "list", "of", "all", "Friends", "in", "this", "FriendGroup", "." ]
train
https://github.com/TheHolyWaffle/League-of-Legends-XMPP-Chat-Library/blob/5e4d87d0c054ff2f6510545b0e9f838338695c70/src/main/java/com/github/theholywaffle/lolchatapi/wrapper/FriendGroup.java#L92-L98
sdl/Testy
src/main/java/com/sdl/selenium/utils/config/WebDriverConfig.java
WebDriverConfig.getWebDriver
public static WebDriver getWebDriver(String browserProperties, URL remoteUrl) throws IOException { URL resource = Thread.currentThread().getContextClassLoader().getResource(browserProperties); log.debug("File: {} " + (resource != null ? "exists" : "does not exist"), browserProperties); if (resource != null) { Browser browser = findBrowser(resource.openStream()); return getDriver(browser, resource.openStream(), remoteUrl); } return null; }
java
public static WebDriver getWebDriver(String browserProperties, URL remoteUrl) throws IOException { URL resource = Thread.currentThread().getContextClassLoader().getResource(browserProperties); log.debug("File: {} " + (resource != null ? "exists" : "does not exist"), browserProperties); if (resource != null) { Browser browser = findBrowser(resource.openStream()); return getDriver(browser, resource.openStream(), remoteUrl); } return null; }
[ "public", "static", "WebDriver", "getWebDriver", "(", "String", "browserProperties", ",", "URL", "remoteUrl", ")", "throws", "IOException", "{", "URL", "resource", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ".", "getRe...
Create and return new WebDriver or RemoteWebDriver based on properties file @param browserProperties path to browser.properties @param remoteUrl url @return WebDriver @throws IOException exception
[ "Create", "and", "return", "new", "WebDriver", "or", "RemoteWebDriver", "based", "on", "properties", "file" ]
train
https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/utils/config/WebDriverConfig.java#L173-L183
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/Utils.java
Utils.getUriFromResource
public static Uri getUriFromResource(@NonNull Context context, @AnyRes int resId) throws Resources.NotFoundException { /** Return a Resources instance for your application's package. */ Resources res = context.getResources(); /** * Creates a Uri which parses the given encoded URI string. * @param uriString an RFC 2396-compliant, encoded URI * @throws NullPointerException if uriString is null * @return Uri for this given uri string */ /** return uri */ return Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + res.getResourcePackageName(resId) + '/' + res.getResourceTypeName(resId) + '/' + res.getResourceEntryName(resId)); }
java
public static Uri getUriFromResource(@NonNull Context context, @AnyRes int resId) throws Resources.NotFoundException { /** Return a Resources instance for your application's package. */ Resources res = context.getResources(); /** * Creates a Uri which parses the given encoded URI string. * @param uriString an RFC 2396-compliant, encoded URI * @throws NullPointerException if uriString is null * @return Uri for this given uri string */ /** return uri */ return Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + res.getResourcePackageName(resId) + '/' + res.getResourceTypeName(resId) + '/' + res.getResourceEntryName(resId)); }
[ "public", "static", "Uri", "getUriFromResource", "(", "@", "NonNull", "Context", "context", ",", "@", "AnyRes", "int", "resId", ")", "throws", "Resources", ".", "NotFoundException", "{", "/** Return a Resources instance for your application's package. */", "Resources", "r...
Get uri to any resource type @param context - context @param resId - resource id @throws Resources.NotFoundException if the given ID does not exist. @return - Uri to resource by given id
[ "Get", "uri", "to", "any", "resource", "type" ]
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/Utils.java#L101-L115
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketImageExtensions.java
WicketImageExtensions.getNonCachingImage
public static NonCachingImage getNonCachingImage(final String wicketId, final String contentType, final byte[] data) { return new NonCachingImage(wicketId, new DatabaseImageResource(contentType, data)); }
java
public static NonCachingImage getNonCachingImage(final String wicketId, final String contentType, final byte[] data) { return new NonCachingImage(wicketId, new DatabaseImageResource(contentType, data)); }
[ "public", "static", "NonCachingImage", "getNonCachingImage", "(", "final", "String", "wicketId", ",", "final", "String", "contentType", ",", "final", "byte", "[", "]", "data", ")", "{", "return", "new", "NonCachingImage", "(", "wicketId", ",", "new", "DatabaseIm...
Gets a non caching image from the given wicketId, contentType and the byte array data. @param wicketId the id from the image for the html template. @param contentType the content type of the image. @param data the data for the image as an byte array. @return the non caching image
[ "Gets", "a", "non", "caching", "image", "from", "the", "given", "wicketId", "contentType", "and", "the", "byte", "array", "data", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketImageExtensions.java#L76-L80
apache/groovy
subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java
XmlUtil.newSAXParser
public static SAXParser newSAXParser(String schemaLanguage, Source... schemas) throws SAXException, ParserConfigurationException { return newSAXParser(schemaLanguage, true, false, schemas); }
java
public static SAXParser newSAXParser(String schemaLanguage, Source... schemas) throws SAXException, ParserConfigurationException { return newSAXParser(schemaLanguage, true, false, schemas); }
[ "public", "static", "SAXParser", "newSAXParser", "(", "String", "schemaLanguage", ",", "Source", "...", "schemas", ")", "throws", "SAXException", ",", "ParserConfigurationException", "{", "return", "newSAXParser", "(", "schemaLanguage", ",", "true", ",", "false", ",...
Factory method to create a SAXParser configured to validate according to a particular schema language and optionally providing the schema sources to validate with. The created SAXParser will be namespace-aware and not validate against DTDs. @param schemaLanguage the schema language used, e.g. XML Schema or RelaxNG (as per the String representation in javax.xml.XMLConstants) @param schemas the schemas to validate against @return the created SAXParser @throws SAXException @throws ParserConfigurationException @see #newSAXParser(String, boolean, boolean, Source...) @since 1.8.7
[ "Factory", "method", "to", "create", "a", "SAXParser", "configured", "to", "validate", "according", "to", "a", "particular", "schema", "language", "and", "optionally", "providing", "the", "schema", "sources", "to", "validate", "with", ".", "The", "created", "SAX...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java#L229-L231
Whiley/WhileyCompiler
src/main/java/wyc/io/WhileyFileParser.java
WhileyFileParser.parseRecordInitialiser
private Expr parseRecordInitialiser(Identifier name, EnclosingScope scope, boolean terminated) { int start = index; match(LeftCurly); HashSet<String> keys = new HashSet<>(); ArrayList<Identifier> fields = new ArrayList<>(); ArrayList<Expr> operands = new ArrayList<>(); boolean firstTime = true; while (eventuallyMatch(RightCurly) == null) { if (!firstTime) { match(Comma); } firstTime = false; // Parse field name being constructed Identifier field = parseIdentifier(); // Check field name is unique if (keys.contains(field.get())) { syntaxError("duplicate record key", field); } match(Colon); // Parse expression being assigned to field // NOTE: we require the following expression be a "non-tuple" // expression. That is, it cannot be composed using ',' unless // braces enclose the entire expression. This is because the outer // record constructor expression is used ',' to distinguish fields. // Also, expression is guaranteed to be terminated, either by '}' or // ','. Expr initialiser = parseExpression(scope, true); fields.add(field); operands.add(initialiser); keys.add(field.get()); } // handle naming // FIXME: Need to support named record initialisers. The suggestion here // is to support arbitrary named initialisers. The reason for this being // we could then support named arrays and other types as well? Not sure // what the real difference from a cast is though. return annotateSourceLocation(new Expr.RecordInitialiser(Type.Void, new Tuple<>(fields), new Tuple<>(operands)), start); }
java
private Expr parseRecordInitialiser(Identifier name, EnclosingScope scope, boolean terminated) { int start = index; match(LeftCurly); HashSet<String> keys = new HashSet<>(); ArrayList<Identifier> fields = new ArrayList<>(); ArrayList<Expr> operands = new ArrayList<>(); boolean firstTime = true; while (eventuallyMatch(RightCurly) == null) { if (!firstTime) { match(Comma); } firstTime = false; // Parse field name being constructed Identifier field = parseIdentifier(); // Check field name is unique if (keys.contains(field.get())) { syntaxError("duplicate record key", field); } match(Colon); // Parse expression being assigned to field // NOTE: we require the following expression be a "non-tuple" // expression. That is, it cannot be composed using ',' unless // braces enclose the entire expression. This is because the outer // record constructor expression is used ',' to distinguish fields. // Also, expression is guaranteed to be terminated, either by '}' or // ','. Expr initialiser = parseExpression(scope, true); fields.add(field); operands.add(initialiser); keys.add(field.get()); } // handle naming // FIXME: Need to support named record initialisers. The suggestion here // is to support arbitrary named initialisers. The reason for this being // we could then support named arrays and other types as well? Not sure // what the real difference from a cast is though. return annotateSourceLocation(new Expr.RecordInitialiser(Type.Void, new Tuple<>(fields), new Tuple<>(operands)), start); }
[ "private", "Expr", "parseRecordInitialiser", "(", "Identifier", "name", ",", "EnclosingScope", "scope", ",", "boolean", "terminated", ")", "{", "int", "start", "=", "index", ";", "match", "(", "LeftCurly", ")", ";", "HashSet", "<", "String", ">", "keys", "="...
Parse a record initialiser, which is of the form: <pre> RecordExpr ::= '{' Identifier ':' Expr (',' Identifier ':' Expr)* '}' </pre> During parsing, we additionally check that each identifier is unique; otherwise, an error is reported. @param name An optional name component for the record initialiser. If null, then this is an anonymous record initialiser. Otherwise, it is a named record initialiser. @param scope The enclosing scope for this statement, which determines the set of visible (i.e. declared) variables and also the current indentation level. @param terminated This indicates that the expression is known to be terminated (or not). An expression that's known to be terminated is one which is guaranteed to be followed by something. This is important because it means that we can ignore any newline characters encountered in parsing this expression, and that we'll never overrun the end of the expression (i.e. because there's guaranteed to be something which terminates this expression). A classic situation where terminated is true is when parsing an expression surrounded in braces. In such case, we know the right-brace will always terminate this expression. @return
[ "Parse", "a", "record", "initialiser", "which", "is", "of", "the", "form", ":" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L2775-L2815
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitConnectionsInner.java
ExpressRouteCircuitConnectionsInner.beginCreateOrUpdate
public ExpressRouteCircuitConnectionInner beginCreateOrUpdate(String resourceGroupName, String circuitName, String peeringName, String connectionName, ExpressRouteCircuitConnectionInner expressRouteCircuitConnectionParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters).toBlocking().single().body(); }
java
public ExpressRouteCircuitConnectionInner beginCreateOrUpdate(String resourceGroupName, String circuitName, String peeringName, String connectionName, ExpressRouteCircuitConnectionInner expressRouteCircuitConnectionParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters).toBlocking().single().body(); }
[ "public", "ExpressRouteCircuitConnectionInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "circuitName", ",", "String", "peeringName", ",", "String", "connectionName", ",", "ExpressRouteCircuitConnectionInner", "expressRouteCircuitConnectionParameter...
Creates or updates a Express Route Circuit Connection in the specified express route circuits. @param resourceGroupName The name of the resource group. @param circuitName The name of the express route circuit. @param peeringName The name of the peering. @param connectionName The name of the express route circuit connection. @param expressRouteCircuitConnectionParameters Parameters supplied to the create or update express route circuit circuit connection operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ExpressRouteCircuitConnectionInner object if successful.
[ "Creates", "or", "updates", "a", "Express", "Route", "Circuit", "Connection", "in", "the", "specified", "express", "route", "circuits", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitConnectionsInner.java#L459-L461
couchbase/java-dcp-client
src/main/java/com/couchbase/client/dcp/state/SessionState.java
SessionState.setFromJson
public void setFromJson(final byte[] persisted) { try { SessionState decoded = JACKSON.readValue(persisted, SessionState.class); decoded.foreachPartition(new Action1<PartitionState>() { int i = 0; @Override public void call(PartitionState dps) { partitionStates.set(i++, dps); } }); } catch (Exception ex) { throw new RuntimeException("Could not decode SessionState from JSON.", ex); } }
java
public void setFromJson(final byte[] persisted) { try { SessionState decoded = JACKSON.readValue(persisted, SessionState.class); decoded.foreachPartition(new Action1<PartitionState>() { int i = 0; @Override public void call(PartitionState dps) { partitionStates.set(i++, dps); } }); } catch (Exception ex) { throw new RuntimeException("Could not decode SessionState from JSON.", ex); } }
[ "public", "void", "setFromJson", "(", "final", "byte", "[", "]", "persisted", ")", "{", "try", "{", "SessionState", "decoded", "=", "JACKSON", ".", "readValue", "(", "persisted", ",", "SessionState", ".", "class", ")", ";", "decoded", ".", "foreachPartition"...
Recovers the session state from persisted JSON. @param persisted the persisted JSON format.
[ "Recovers", "the", "session", "state", "from", "persisted", "JSON", "." ]
train
https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/state/SessionState.java#L103-L117
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java
_ArrayMap.put
static public Object[] put(Object[] array, Object key, Object value) { if (array != null) { int length = array.length; for (int i = 0; i < length; i += 2) { Object curKey = array[i]; if (((curKey != null) && (curKey.equals(key))) || (curKey == key)) { array[i + 1] = value; return array; } } } return _addToArray(array, key, value, 1); }
java
static public Object[] put(Object[] array, Object key, Object value) { if (array != null) { int length = array.length; for (int i = 0; i < length; i += 2) { Object curKey = array[i]; if (((curKey != null) && (curKey.equals(key))) || (curKey == key)) { array[i + 1] = value; return array; } } } return _addToArray(array, key, value, 1); }
[ "static", "public", "Object", "[", "]", "put", "(", "Object", "[", "]", "array", ",", "Object", "key", ",", "Object", "value", ")", "{", "if", "(", "array", "!=", "null", ")", "{", "int", "length", "=", "array", ".", "length", ";", "for", "(", "i...
Adds the key/value pair to the array, returning a new array if necessary.
[ "Adds", "the", "key", "/", "value", "pair", "to", "the", "array", "returning", "a", "new", "array", "if", "necessary", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java#L198-L218
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/MultiPath.java
MultiPath.insertPoint
public void insertPoint(int pathIndex, int beforePointIndex, Point pt) { m_impl.insertPoint(pathIndex, beforePointIndex, pt); }
java
public void insertPoint(int pathIndex, int beforePointIndex, Point pt) { m_impl.insertPoint(pathIndex, beforePointIndex, pt); }
[ "public", "void", "insertPoint", "(", "int", "pathIndex", ",", "int", "beforePointIndex", ",", "Point", "pt", ")", "{", "m_impl", ".", "insertPoint", "(", "pathIndex", ",", "beforePointIndex", ",", "pt", ")", ";", "}" ]
Inserts a point. @param pathIndex The path index in this class to insert the point to. Must correspond to an existing path. @param beforePointIndex The point index in the given path of this multipath. This value must be between 0 and GetPathSize(pathIndex), or -1 to insert the point at the end of the given path. @param pt The point to be inserted.
[ "Inserts", "a", "point", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/MultiPath.java#L480-L482
strator-dev/greenpepper
greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/runner/XmlRpcRemoteRunner.java
XmlRpcRemoteRunner.runReference
public Reference runReference(SystemUnderTest sut, Specification specification, Requirement requirement, String locale) throws GreenPepperServerException { if (sut.getProject() == null) { throw new IllegalArgumentException("Missing Project in SystemUnderTest"); } if (specification.getRepository() == null) { throw new IllegalArgumentException("Missing Repository in Specification"); } if (requirement.getRepository() == null) { throw new IllegalArgumentException("Missing Repository in Requirement"); } Reference reference = Reference.newInstance(requirement, specification, sut); return runReference(reference, locale); }
java
public Reference runReference(SystemUnderTest sut, Specification specification, Requirement requirement, String locale) throws GreenPepperServerException { if (sut.getProject() == null) { throw new IllegalArgumentException("Missing Project in SystemUnderTest"); } if (specification.getRepository() == null) { throw new IllegalArgumentException("Missing Repository in Specification"); } if (requirement.getRepository() == null) { throw new IllegalArgumentException("Missing Repository in Requirement"); } Reference reference = Reference.newInstance(requirement, specification, sut); return runReference(reference, locale); }
[ "public", "Reference", "runReference", "(", "SystemUnderTest", "sut", ",", "Specification", "specification", ",", "Requirement", "requirement", ",", "String", "locale", ")", "throws", "GreenPepperServerException", "{", "if", "(", "sut", ".", "getProject", "(", ")", ...
<p>runReference.</p> @param sut a {@link com.greenpepper.server.domain.SystemUnderTest} object. @param specification a {@link com.greenpepper.server.domain.Specification} object. @param requirement a {@link com.greenpepper.server.domain.Requirement} object. @param locale a {@link java.lang.String} object. @return a {@link com.greenpepper.server.domain.Reference} object. @throws com.greenpepper.server.GreenPepperServerException if any.
[ "<p", ">", "runReference", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/runner/XmlRpcRemoteRunner.java#L198-L219
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/Stream.java
Stream.iterate
@NotNull public static <T> Stream<T> iterate( @Nullable final T seed, @NotNull final Predicate<? super T> predicate, @NotNull final UnaryOperator<T> op) { Objects.requireNonNull(predicate); return iterate(seed, op).takeWhile(predicate); }
java
@NotNull public static <T> Stream<T> iterate( @Nullable final T seed, @NotNull final Predicate<? super T> predicate, @NotNull final UnaryOperator<T> op) { Objects.requireNonNull(predicate); return iterate(seed, op).takeWhile(predicate); }
[ "@", "NotNull", "public", "static", "<", "T", ">", "Stream", "<", "T", ">", "iterate", "(", "@", "Nullable", "final", "T", "seed", ",", "@", "NotNull", "final", "Predicate", "<", "?", "super", "T", ">", "predicate", ",", "@", "NotNull", "final", "Una...
Creates a {@code Stream} by iterative application {@code UnaryOperator} function to an initial element {@code seed}, conditioned on satisfying the supplied predicate. <p>Example: <pre> seed: 0 predicate: (a) -&gt; a &lt; 20 op: (a) -&gt; a + 5 result: [0, 5, 10, 15] </pre> @param <T> the type of the stream elements @param seed the initial value @param predicate a predicate to determine when the stream must terminate @param op operator to produce new element by previous one @return the new stream @throws NullPointerException if {@code op} is null @since 1.1.5
[ "Creates", "a", "{", "@code", "Stream", "}", "by", "iterative", "application", "{", "@code", "UnaryOperator", "}", "function", "to", "an", "initial", "element", "{", "@code", "seed", "}", "conditioned", "on", "satisfying", "the", "supplied", "predicate", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Stream.java#L286-L293
mapsforge/mapsforge
mapsforge-poi/src/main/java/org/mapsforge/poi/storage/AbstractPoiPersistenceManager.java
AbstractPoiPersistenceManager.stringToTags
protected static Set<Tag> stringToTags(String data) { Set<Tag> tags = new HashSet<>(); String[] split = data.split("\r"); for (String s : split) { if (s.indexOf(Tag.KEY_VALUE_SEPARATOR) > -1) { String[] keyValue = s.split(String.valueOf(Tag.KEY_VALUE_SEPARATOR)); if (keyValue.length == 2) { tags.add(new Tag(keyValue[0], keyValue[1])); } } } return tags; }
java
protected static Set<Tag> stringToTags(String data) { Set<Tag> tags = new HashSet<>(); String[] split = data.split("\r"); for (String s : split) { if (s.indexOf(Tag.KEY_VALUE_SEPARATOR) > -1) { String[] keyValue = s.split(String.valueOf(Tag.KEY_VALUE_SEPARATOR)); if (keyValue.length == 2) { tags.add(new Tag(keyValue[0], keyValue[1])); } } } return tags; }
[ "protected", "static", "Set", "<", "Tag", ">", "stringToTags", "(", "String", "data", ")", "{", "Set", "<", "Tag", ">", "tags", "=", "new", "HashSet", "<>", "(", ")", ";", "String", "[", "]", "split", "=", "data", ".", "split", "(", "\"\\r\"", ")",...
Convert tags string representation with '\r' delimiter to collection.
[ "Convert", "tags", "string", "representation", "with", "\\", "r", "delimiter", "to", "collection", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi/src/main/java/org/mapsforge/poi/storage/AbstractPoiPersistenceManager.java#L124-L136
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Searcher.java
Searcher.getNumberOfUniqueViews
public <T extends View> int getNumberOfUniqueViews(Set<T>uniqueViews, ArrayList<T> views){ for(int i = 0; i < views.size(); i++){ uniqueViews.add(views.get(i)); } numberOfUniqueViews = uniqueViews.size(); return numberOfUniqueViews; }
java
public <T extends View> int getNumberOfUniqueViews(Set<T>uniqueViews, ArrayList<T> views){ for(int i = 0; i < views.size(); i++){ uniqueViews.add(views.get(i)); } numberOfUniqueViews = uniqueViews.size(); return numberOfUniqueViews; }
[ "public", "<", "T", "extends", "View", ">", "int", "getNumberOfUniqueViews", "(", "Set", "<", "T", ">", "uniqueViews", ",", "ArrayList", "<", "T", ">", "views", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "views", ".", "size", "(", ...
Returns the number of unique views. @param uniqueViews the set of unique views @param views the list of all views @return number of unique views
[ "Returns", "the", "number", "of", "unique", "views", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Searcher.java#L306-L312
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.recognizePrintedTextWithServiceResponseAsync
public Observable<ServiceResponse<OcrResult>> recognizePrintedTextWithServiceResponseAsync(boolean detectOrientation, String url, RecognizePrintedTextOptionalParameter recognizePrintedTextOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final OcrLanguages language = recognizePrintedTextOptionalParameter != null ? recognizePrintedTextOptionalParameter.language() : null; return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url, language); }
java
public Observable<ServiceResponse<OcrResult>> recognizePrintedTextWithServiceResponseAsync(boolean detectOrientation, String url, RecognizePrintedTextOptionalParameter recognizePrintedTextOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final OcrLanguages language = recognizePrintedTextOptionalParameter != null ? recognizePrintedTextOptionalParameter.language() : null; return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url, language); }
[ "public", "Observable", "<", "ServiceResponse", "<", "OcrResult", ">", ">", "recognizePrintedTextWithServiceResponseAsync", "(", "boolean", "detectOrientation", ",", "String", "url", ",", "RecognizePrintedTextOptionalParameter", "recognizePrintedTextOptionalParameter", ")", "{"...
Optical Character Recognition (OCR) detects printed text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError. @param detectOrientation Whether detect the text orientation in the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down). @param url Publicly reachable URL of an image @param recognizePrintedTextOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OcrResult object
[ "Optical", "Character", "Recognition", "(", "OCR", ")", "detects", "printed", "text", "in", "an", "image", "and", "extracts", "the", "recognized", "characters", "into", "a", "machine", "-", "usable", "character", "stream", ".", "Upon", "success", "the", "OCR",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L1945-L1955
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/impl/IOUtils.java
IOUtils.copyReader
public static void copyReader(Reader from, Writer to) throws IOException { char buffer[] = new char[2048]; int charsRead; while ((charsRead = from.read(buffer)) != -1) { to.write(buffer, 0, charsRead); } from.close(); to.flush(); }
java
public static void copyReader(Reader from, Writer to) throws IOException { char buffer[] = new char[2048]; int charsRead; while ((charsRead = from.read(buffer)) != -1) { to.write(buffer, 0, charsRead); } from.close(); to.flush(); }
[ "public", "static", "void", "copyReader", "(", "Reader", "from", ",", "Writer", "to", ")", "throws", "IOException", "{", "char", "buffer", "[", "]", "=", "new", "char", "[", "2048", "]", ";", "int", "charsRead", ";", "while", "(", "(", "charsRead", "="...
Copy the given Reader to the given Writer. This method is basically the same as copyStream; however Reader and Writer objects are cognizant of character encoding, whereas InputStream and OutputStreams objects deal only with bytes. Note: the Reader is closed when the copy is complete. The Writer is left open. The Write is flushed when the copy is complete.
[ "Copy", "the", "given", "Reader", "to", "the", "given", "Writer", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/impl/IOUtils.java#L46-L55
aws/aws-sdk-java
aws-java-sdk-servicediscovery/src/main/java/com/amazonaws/services/servicediscovery/model/HttpInstanceSummary.java
HttpInstanceSummary.withAttributes
public HttpInstanceSummary withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
java
public HttpInstanceSummary withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
[ "public", "HttpInstanceSummary", "withAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "setAttributes", "(", "attributes", ")", ";", "return", "this", ";", "}" ]
<p> If you included any attributes when you registered the instance, the values of those attributes. </p> @param attributes If you included any attributes when you registered the instance, the values of those attributes. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "If", "you", "included", "any", "attributes", "when", "you", "registered", "the", "instance", "the", "values", "of", "those", "attributes", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicediscovery/src/main/java/com/amazonaws/services/servicediscovery/model/HttpInstanceSummary.java#L277-L280
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipInputStream.java
ZipInputStream.get32
private static final long get32(byte b[], int off) { return (get16(b, off) | ((long)get16(b, off+2) << 16)) & 0xffffffffL; }
java
private static final long get32(byte b[], int off) { return (get16(b, off) | ((long)get16(b, off+2) << 16)) & 0xffffffffL; }
[ "private", "static", "final", "long", "get32", "(", "byte", "b", "[", "]", ",", "int", "off", ")", "{", "return", "(", "get16", "(", "b", ",", "off", ")", "|", "(", "(", "long", ")", "get16", "(", "b", ",", "off", "+", "2", ")", "<<", "16", ...
/* Fetches unsigned 32-bit value from byte array at specified offset. The bytes are assumed to be in Intel (little-endian) byte order.
[ "/", "*", "Fetches", "unsigned", "32", "-", "bit", "value", "from", "byte", "array", "at", "specified", "offset", ".", "The", "bytes", "are", "assumed", "to", "be", "in", "Intel", "(", "little", "-", "endian", ")", "byte", "order", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipInputStream.java#L454-L456
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/schema/api/AbstractSchemaManager.java
AbstractSchemaManager.exportSchema
protected void exportSchema(final String persistenceUnit, List<TableInfo> tables) { // Get persistence unit metadata this.puMetadata = kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit); String paramString = externalProperties != null ? (String) externalProperties .get(PersistenceProperties.KUNDERA_CLIENT_FACTORY) : null; if (clientFactory != null && ((clientFactory.equalsIgnoreCase(puMetadata.getProperties().getProperty( PersistenceProperties.KUNDERA_CLIENT_FACTORY))) || (paramString != null && clientFactory .equalsIgnoreCase(paramString)))) { readConfigProperties(puMetadata); // invoke handle operation. if (operation != null && initiateClient()) { tableInfos = tables; handleOperations(tables); } } }
java
protected void exportSchema(final String persistenceUnit, List<TableInfo> tables) { // Get persistence unit metadata this.puMetadata = kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit); String paramString = externalProperties != null ? (String) externalProperties .get(PersistenceProperties.KUNDERA_CLIENT_FACTORY) : null; if (clientFactory != null && ((clientFactory.equalsIgnoreCase(puMetadata.getProperties().getProperty( PersistenceProperties.KUNDERA_CLIENT_FACTORY))) || (paramString != null && clientFactory .equalsIgnoreCase(paramString)))) { readConfigProperties(puMetadata); // invoke handle operation. if (operation != null && initiateClient()) { tableInfos = tables; handleOperations(tables); } } }
[ "protected", "void", "exportSchema", "(", "final", "String", "persistenceUnit", ",", "List", "<", "TableInfo", ">", "tables", ")", "{", "// Get persistence unit metadata", "this", ".", "puMetadata", "=", "kunderaMetadata", ".", "getApplicationMetadata", "(", ")", "....
Export schema handles the handleOperation method. @param hbase
[ "Export", "schema", "handles", "the", "handleOperation", "method", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/schema/api/AbstractSchemaManager.java#L98-L118
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.readSiblings
public List<CmsResource> readSiblings(CmsDbContext dbc, CmsResource resource, CmsResourceFilter filter) throws CmsException { List<CmsResource> siblings = getVfsDriver( dbc).readSiblings(dbc, dbc.currentProject().getUuid(), resource, filter.includeDeleted()); // important: there is no permission check done on the returned list of siblings // this is because of possible issues with the "publish all siblings" option, // moreover the user has read permission for the content through // the selected sibling anyway return updateContextDates(dbc, siblings, filter); }
java
public List<CmsResource> readSiblings(CmsDbContext dbc, CmsResource resource, CmsResourceFilter filter) throws CmsException { List<CmsResource> siblings = getVfsDriver( dbc).readSiblings(dbc, dbc.currentProject().getUuid(), resource, filter.includeDeleted()); // important: there is no permission check done on the returned list of siblings // this is because of possible issues with the "publish all siblings" option, // moreover the user has read permission for the content through // the selected sibling anyway return updateContextDates(dbc, siblings, filter); }
[ "public", "List", "<", "CmsResource", ">", "readSiblings", "(", "CmsDbContext", "dbc", ",", "CmsResource", "resource", ",", "CmsResourceFilter", "filter", ")", "throws", "CmsException", "{", "List", "<", "CmsResource", ">", "siblings", "=", "getVfsDriver", "(", ...
Returns a List of all siblings of the specified resource, the specified resource being always part of the result set.<p> The result is a list of <code>{@link CmsResource}</code> objects.<p> @param dbc the current database context @param resource the resource to read the siblings for @param filter a filter object @return a list of <code>{@link CmsResource}</code> Objects that are siblings to the specified resource, including the specified resource itself @throws CmsException if something goes wrong
[ "Returns", "a", "List", "of", "all", "siblings", "of", "the", "specified", "resource", "the", "specified", "resource", "being", "always", "part", "of", "the", "result", "set", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L7914-L7925
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java
ValueEnforcer.isBetweenExclusive
public static long isBetweenExclusive (final long nValue, final String sName, final long nLowerBoundExclusive, final long nUpperBoundExclusive) { if (isEnabled ()) return isBetweenExclusive (nValue, () -> sName, nLowerBoundExclusive, nUpperBoundExclusive); return nValue; }
java
public static long isBetweenExclusive (final long nValue, final String sName, final long nLowerBoundExclusive, final long nUpperBoundExclusive) { if (isEnabled ()) return isBetweenExclusive (nValue, () -> sName, nLowerBoundExclusive, nUpperBoundExclusive); return nValue; }
[ "public", "static", "long", "isBetweenExclusive", "(", "final", "long", "nValue", ",", "final", "String", "sName", ",", "final", "long", "nLowerBoundExclusive", ",", "final", "long", "nUpperBoundExclusive", ")", "{", "if", "(", "isEnabled", "(", ")", ")", "ret...
Check if <code>nValue &gt; nLowerBoundInclusive &amp;&amp; nValue &lt; nUpperBoundInclusive</code> @param nValue Value @param sName Name @param nLowerBoundExclusive Lower bound @param nUpperBoundExclusive Upper bound @return The value
[ "Check", "if", "<code", ">", "nValue", "&gt", ";", "nLowerBoundInclusive", "&amp", ";", "&amp", ";", "nValue", "&lt", ";", "nUpperBoundInclusive<", "/", "code", ">" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L2731-L2739
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.getFragmentInSeconds
@GwtIncompatible("incompatible method") public static long getFragmentInSeconds(final Date date, final int fragment) { return getFragment(date, fragment, TimeUnit.SECONDS); }
java
@GwtIncompatible("incompatible method") public static long getFragmentInSeconds(final Date date, final int fragment) { return getFragment(date, fragment, TimeUnit.SECONDS); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "long", "getFragmentInSeconds", "(", "final", "Date", "date", ",", "final", "int", "fragment", ")", "{", "return", "getFragment", "(", "date", ",", "fragment", ",", "TimeUnit", ".",...
<p>Returns the number of seconds within the fragment. All datefields greater than the fragment will be ignored.</p> <p>Asking the seconds of any date will only return the number of seconds of the current minute (resulting in a number between 0 and 59). This method will retrieve the number of seconds for any fragment. For example, if you want to calculate the number of seconds past today, your fragment is Calendar.DATE or Calendar.DAY_OF_YEAR. The result will be all seconds of the past hour(s) and minutes(s).</p> <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND A fragment less than or equal to a SECOND field will return 0.</p> <ul> <li>January 1, 2008 7:15:10.538 with Calendar.MINUTE as fragment will return 10 (equivalent to deprecated date.getSeconds())</li> <li>January 6, 2008 7:15:10.538 with Calendar.MINUTE as fragment will return 10 (equivalent to deprecated date.getSeconds())</li> <li>January 6, 2008 7:15:10.538 with Calendar.DAY_OF_YEAR as fragment will return 26110 (7*3600 + 15*60 + 10)</li> <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0 (a millisecond cannot be split in seconds)</li> </ul> @param date the date to work with, not null @param fragment the {@code Calendar} field part of date to calculate @return number of seconds within the fragment of date @throws IllegalArgumentException if the date is <code>null</code> or fragment is not supported @since 2.4
[ "<p", ">", "Returns", "the", "number", "of", "seconds", "within", "the", "fragment", ".", "All", "datefields", "greater", "than", "the", "fragment", "will", "be", "ignored", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L1335-L1338
magro/memcached-session-manager
core/src/main/java/de/javakaffee/web/msm/LRUCache.java
LRUCache.getKeysSortedByValue
public List<K> getKeysSortedByValue( final Comparator<V> comparator ) { synchronized ( _map ) { @SuppressWarnings( "unchecked" ) final Entry<K, ManagedItem<V>>[] a = _map.entrySet().toArray( new Map.Entry[_map.size()] ); final Comparator<Entry<K, ManagedItem<V>>> c = new Comparator<Entry<K, ManagedItem<V>>>() { @Override public int compare( final Entry<K, ManagedItem<V>> o1, final Entry<K, ManagedItem<V>> o2 ) { return comparator.compare( o1.getValue()._value, o2.getValue()._value ); } }; Arrays.sort(a, c); return new LRUCache.ArrayList<K, V>( a ); } }
java
public List<K> getKeysSortedByValue( final Comparator<V> comparator ) { synchronized ( _map ) { @SuppressWarnings( "unchecked" ) final Entry<K, ManagedItem<V>>[] a = _map.entrySet().toArray( new Map.Entry[_map.size()] ); final Comparator<Entry<K, ManagedItem<V>>> c = new Comparator<Entry<K, ManagedItem<V>>>() { @Override public int compare( final Entry<K, ManagedItem<V>> o1, final Entry<K, ManagedItem<V>> o2 ) { return comparator.compare( o1.getValue()._value, o2.getValue()._value ); } }; Arrays.sort(a, c); return new LRUCache.ArrayList<K, V>( a ); } }
[ "public", "List", "<", "K", ">", "getKeysSortedByValue", "(", "final", "Comparator", "<", "V", ">", "comparator", ")", "{", "synchronized", "(", "_map", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "final", "Entry", "<", "K", ",", "Managed...
The keys sorted by the given value comparator. @return the underlying set, see {@link LinkedHashMap#keySet()}.
[ "The", "keys", "sorted", "by", "the", "given", "value", "comparator", "." ]
train
https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/LRUCache.java#L202-L218
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ChecksumsManager.java
ChecksumsManager.initChecksumProps
private Properties initChecksumProps(Map<String, Set<String>> useOldChecksums) { Properties checksumProps = new Properties(); for (Set<String> set : useOldChecksums.values()) { for (String s : set) { checksumProps.put(s, ""); } } return checksumProps; }
java
private Properties initChecksumProps(Map<String, Set<String>> useOldChecksums) { Properties checksumProps = new Properties(); for (Set<String> set : useOldChecksums.values()) { for (String s : set) { checksumProps.put(s, ""); } } return checksumProps; }
[ "private", "Properties", "initChecksumProps", "(", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "useOldChecksums", ")", "{", "Properties", "checksumProps", "=", "new", "Properties", "(", ")", ";", "for", "(", "Set", "<", "String", ">", "set",...
Populates a new property file with the inputed checksum map and empty strings. @param useOldChecksums a map of the old checksums @return a new Properties object containing the old checksums as keys and "" as value
[ "Populates", "a", "new", "property", "file", "with", "the", "inputed", "checksum", "map", "and", "empty", "strings", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ChecksumsManager.java#L181-L189
javagl/CommonUI
src/main/java/de/javagl/common/ui/JTrees.java
JTrees.collapseAll
public static void collapseAll(JTree tree, boolean omitRoot) { int rows = tree.getRowCount(); int limit = (omitRoot ? 1 : 0); for (int i = rows - 1; i >= limit; i--) { tree.collapseRow(i); } }
java
public static void collapseAll(JTree tree, boolean omitRoot) { int rows = tree.getRowCount(); int limit = (omitRoot ? 1 : 0); for (int i = rows - 1; i >= limit; i--) { tree.collapseRow(i); } }
[ "public", "static", "void", "collapseAll", "(", "JTree", "tree", ",", "boolean", "omitRoot", ")", "{", "int", "rows", "=", "tree", ".", "getRowCount", "(", ")", ";", "int", "limit", "=", "(", "omitRoot", "?", "1", ":", "0", ")", ";", "for", "(", "i...
Collapse all rows of the given tree @param tree The tree @param omitRoot Whether the root node should not be collapsed
[ "Collapse", "all", "rows", "of", "the", "given", "tree" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/JTrees.java#L163-L171
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsImageEditorForm.java
CmsImageEditorForm.fillContent
public void fillContent(CmsImageInfoBean imageInfo, CmsJSONMap imageAttributes, boolean initialFill) { m_initialImageAttributes = imageAttributes; for (Entry<Attribute, I_CmsFormWidget> entry : m_fields.entrySet()) { String val = imageAttributes.getString(entry.getKey().name()); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(val)) { entry.getValue().setFormValueAsString(val); } else { if (entry.getKey() == Attribute.alt) { entry.getValue().setFormValueAsString( imageInfo.getProperties().get(CmsClientProperty.PROPERTY_TITLE)); } if (entry.getKey() == Attribute.copyright) { entry.getValue().setFormValueAsString(imageInfo.getCopyright()); } if (initialFill && (entry.getKey() == Attribute.align)) { entry.getValue().setFormValueAsString("left"); } } } }
java
public void fillContent(CmsImageInfoBean imageInfo, CmsJSONMap imageAttributes, boolean initialFill) { m_initialImageAttributes = imageAttributes; for (Entry<Attribute, I_CmsFormWidget> entry : m_fields.entrySet()) { String val = imageAttributes.getString(entry.getKey().name()); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(val)) { entry.getValue().setFormValueAsString(val); } else { if (entry.getKey() == Attribute.alt) { entry.getValue().setFormValueAsString( imageInfo.getProperties().get(CmsClientProperty.PROPERTY_TITLE)); } if (entry.getKey() == Attribute.copyright) { entry.getValue().setFormValueAsString(imageInfo.getCopyright()); } if (initialFill && (entry.getKey() == Attribute.align)) { entry.getValue().setFormValueAsString("left"); } } } }
[ "public", "void", "fillContent", "(", "CmsImageInfoBean", "imageInfo", ",", "CmsJSONMap", "imageAttributes", ",", "boolean", "initialFill", ")", "{", "m_initialImageAttributes", "=", "imageAttributes", ";", "for", "(", "Entry", "<", "Attribute", ",", "I_CmsFormWidget"...
Displays the provided image information.<p> @param imageInfo the image information @param imageAttributes the image attributes @param initialFill flag to indicate that a new image has been selected
[ "Displays", "the", "provided", "image", "information", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsImageEditorForm.java#L225-L245
Harium/keel
src/main/java/com/harium/keel/catalano/math/Approximation.java
Approximation.atan2
public static double atan2(double y, double x) { double coeff_1 = 0.78539816339744830961566084581988;//Math.PI / 4d; double coeff_2 = 3d * coeff_1; double abs_y = Math.abs(y); double angle; if (x >= 0d) { double r = (x - abs_y) / (x + abs_y); angle = coeff_1 - coeff_1 * r; } else { double r = (x + abs_y) / (abs_y - x); angle = coeff_2 - coeff_1 * r; } return y < 0d ? -angle : angle - 0.06; }
java
public static double atan2(double y, double x) { double coeff_1 = 0.78539816339744830961566084581988;//Math.PI / 4d; double coeff_2 = 3d * coeff_1; double abs_y = Math.abs(y); double angle; if (x >= 0d) { double r = (x - abs_y) / (x + abs_y); angle = coeff_1 - coeff_1 * r; } else { double r = (x + abs_y) / (abs_y - x); angle = coeff_2 - coeff_1 * r; } return y < 0d ? -angle : angle - 0.06; }
[ "public", "static", "double", "atan2", "(", "double", "y", ",", "double", "x", ")", "{", "double", "coeff_1", "=", "0.78539816339744830961566084581988", ";", "//Math.PI / 4d;\r", "double", "coeff_2", "=", "3d", "*", "coeff_1", ";", "double", "abs_y", "=", "Mat...
Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta). This method computes the phase theta by computing an arc tangent of y/x in the range of -pi to pi. @param y Y axis coordinate. @param x X axis coordinate. @return The theta component of the point (r, theta) in polar coordinates that corresponds to the point (x, y) in Cartesian coordinates.
[ "Returns", "the", "angle", "theta", "from", "the", "conversion", "of", "rectangular", "coordinates", "(", "x", "y", ")", "to", "polar", "coordinates", "(", "r", "theta", ")", ".", "This", "method", "computes", "the", "phase", "theta", "by", "computing", "a...
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/Approximation.java#L171-L184
wcm-io/wcm-io-sling
commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java
RequestParam.getInt
public static int getInt(@NotNull ServletRequest request, @NotNull String param) { return getInt(request, param, 0); }
java
public static int getInt(@NotNull ServletRequest request, @NotNull String param) { return getInt(request, param, 0); }
[ "public", "static", "int", "getInt", "(", "@", "NotNull", "ServletRequest", "request", ",", "@", "NotNull", "String", "param", ")", "{", "return", "getInt", "(", "request", ",", "param", ",", "0", ")", ";", "}" ]
Returns a request parameter as integer. @param request Request. @param param Parameter name. @return Parameter value or 0 if it does not exist or is not a number.
[ "Returns", "a", "request", "parameter", "as", "integer", "." ]
train
https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java#L145-L147
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/ThreadContext.java
ThreadContext.setOutboundConnectionInfo
public void setOutboundConnectionInfo(Map<String, Object> connectionInfo) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "setOutboundConnectionInfo"); this.outboundConnectionInfo = connectionInfo; }
java
public void setOutboundConnectionInfo(Map<String, Object> connectionInfo) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "setOutboundConnectionInfo"); this.outboundConnectionInfo = connectionInfo; }
[ "public", "void", "setOutboundConnectionInfo", "(", "Map", "<", "String", ",", "Object", ">", "connectionInfo", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug",...
Set the outbound connection info of this context to the input value. @param connectionInfo
[ "Set", "the", "outbound", "connection", "info", "of", "this", "context", "to", "the", "input", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/ThreadContext.java#L202-L206
RKumsher/utils
src/main/java/com/github/rkumsher/collection/IterableUtils.java
IterableUtils.randomFrom
public static <T> T randomFrom(Iterable<T> iterable, Collection<T> excludes) { checkArgument(!Iterables.isEmpty(iterable), "Iterable cannot be empty"); checkArgument(!containsAll(excludes, iterable), "Iterable only consists of the given excludes"); Iterable<T> copy = Lists.newArrayList(iterable); Iterables.removeAll(copy, excludes); return randomFrom(copy); }
java
public static <T> T randomFrom(Iterable<T> iterable, Collection<T> excludes) { checkArgument(!Iterables.isEmpty(iterable), "Iterable cannot be empty"); checkArgument(!containsAll(excludes, iterable), "Iterable only consists of the given excludes"); Iterable<T> copy = Lists.newArrayList(iterable); Iterables.removeAll(copy, excludes); return randomFrom(copy); }
[ "public", "static", "<", "T", ">", "T", "randomFrom", "(", "Iterable", "<", "T", ">", "iterable", ",", "Collection", "<", "T", ">", "excludes", ")", "{", "checkArgument", "(", "!", "Iterables", ".", "isEmpty", "(", "iterable", ")", ",", "\"Iterable canno...
Returns a random element from the given {@link Iterable} that's not in the values to exclude. @param iterable {@link Iterable} to return random element from @param excludes values to exclude @param <T> the type of elements in the given iterable @return random element from the given {@link Iterable} that's not in the values to exclude @throws IllegalArgumentException if the iterable is empty
[ "Returns", "a", "random", "element", "from", "the", "given", "{", "@link", "Iterable", "}", "that", "s", "not", "in", "the", "values", "to", "exclude", "." ]
train
https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/collection/IterableUtils.java#L57-L63
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java
ChannelFrameworkImpl.getChannelState
public synchronized RuntimeState getChannelState(String channelName, Chain chain) { RuntimeState state = null; Channel channel = getRunningChannel(channelName, chain); if (channel != null) { ChannelContainer channelContainer = this.channelRunningMap.get(channel.getName()); if (null != channelContainer) { state = channelContainer.getState(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getChannelState: " + channelName + "=" + state); } return state; }
java
public synchronized RuntimeState getChannelState(String channelName, Chain chain) { RuntimeState state = null; Channel channel = getRunningChannel(channelName, chain); if (channel != null) { ChannelContainer channelContainer = this.channelRunningMap.get(channel.getName()); if (null != channelContainer) { state = channelContainer.getState(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getChannelState: " + channelName + "=" + state); } return state; }
[ "public", "synchronized", "RuntimeState", "getChannelState", "(", "String", "channelName", ",", "Chain", "chain", ")", "{", "RuntimeState", "state", "=", "null", ";", "Channel", "channel", "=", "getRunningChannel", "(", "channelName", ",", "chain", ")", ";", "if...
Return the state of the input runtime channel. @param channelName @param chain that includes this channel @return state of channel, or -1 if the channel cannot be found.
[ "Return", "the", "state", "of", "the", "input", "runtime", "channel", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java#L4075-L4089
lucee/Lucee
core/src/main/java/lucee/commons/sql/SQLUtil.java
SQLUtil.toClob
public static Clob toClob(Connection conn, Object value) throws PageException, SQLException { if (value instanceof Clob) return (Clob) value; // Java >= 1.6 if (SystemUtil.JAVA_VERSION >= SystemUtil.JAVA_VERSION_6) { Clob clob = conn.createClob(); clob.setString(1, Caster.toString(value)); return clob; } // Java < 1.6 if (isOracle(conn)) { Clob clob = OracleClob.createClob(conn, Caster.toString(value), null); if (clob != null) return clob; } return ClobImpl.toClob(value); }
java
public static Clob toClob(Connection conn, Object value) throws PageException, SQLException { if (value instanceof Clob) return (Clob) value; // Java >= 1.6 if (SystemUtil.JAVA_VERSION >= SystemUtil.JAVA_VERSION_6) { Clob clob = conn.createClob(); clob.setString(1, Caster.toString(value)); return clob; } // Java < 1.6 if (isOracle(conn)) { Clob clob = OracleClob.createClob(conn, Caster.toString(value), null); if (clob != null) return clob; } return ClobImpl.toClob(value); }
[ "public", "static", "Clob", "toClob", "(", "Connection", "conn", ",", "Object", "value", ")", "throws", "PageException", ",", "SQLException", "{", "if", "(", "value", "instanceof", "Clob", ")", "return", "(", "Clob", ")", "value", ";", "// Java >= 1.6", "if"...
create a clob Object @param conn @param value @return @throws PageException @throws SQLException
[ "create", "a", "clob", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/sql/SQLUtil.java#L157-L172
spotify/ssh-agent-proxy
src/main/java/com/spotify/sshagentproxy/AgentOutput.java
AgentOutput.writeField
private static void writeField(final OutputStream out, final byte[] bytes) throws IOException { // All protocol messages are prefixed with their length in bytes, encoded // as a 32 bit unsigned integer. final ByteBuffer buffer = ByteBuffer.allocate(INT_BYTES + bytes.length); buffer.putInt(bytes.length); buffer.put(bytes); out.write(buffer.array()); out.flush(); }
java
private static void writeField(final OutputStream out, final byte[] bytes) throws IOException { // All protocol messages are prefixed with their length in bytes, encoded // as a 32 bit unsigned integer. final ByteBuffer buffer = ByteBuffer.allocate(INT_BYTES + bytes.length); buffer.putInt(bytes.length); buffer.put(bytes); out.write(buffer.array()); out.flush(); }
[ "private", "static", "void", "writeField", "(", "final", "OutputStream", "out", ",", "final", "byte", "[", "]", "bytes", ")", "throws", "IOException", "{", "// All protocol messages are prefixed with their length in bytes, encoded", "// as a 32 bit unsigned integer.", "final"...
Write bytes to an {@link OutputStream} and prepend with four bytes indicating their length. @param out {@link OutputStream} @param bytes Array of bytes.
[ "Write", "bytes", "to", "an", "{" ]
train
https://github.com/spotify/ssh-agent-proxy/blob/b678792750c0157bd5ed3fb6a18895ff95effbc4/src/main/java/com/spotify/sshagentproxy/AgentOutput.java#L96-L105
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java
ExpressRouteCircuitsInner.getByResourceGroupAsync
public Observable<ExpressRouteCircuitInner> getByResourceGroupAsync(String resourceGroupName, String circuitName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, circuitName).map(new Func1<ServiceResponse<ExpressRouteCircuitInner>, ExpressRouteCircuitInner>() { @Override public ExpressRouteCircuitInner call(ServiceResponse<ExpressRouteCircuitInner> response) { return response.body(); } }); }
java
public Observable<ExpressRouteCircuitInner> getByResourceGroupAsync(String resourceGroupName, String circuitName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, circuitName).map(new Func1<ServiceResponse<ExpressRouteCircuitInner>, ExpressRouteCircuitInner>() { @Override public ExpressRouteCircuitInner call(ServiceResponse<ExpressRouteCircuitInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExpressRouteCircuitInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "circuitName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "circuitName", ")", "....
Gets information about the specified express route circuit. @param resourceGroupName The name of the resource group. @param circuitName The name of express route circuit. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExpressRouteCircuitInner object
[ "Gets", "information", "about", "the", "specified", "express", "route", "circuit", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java#L335-L342
SonarSource/sonarqube
server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandler.java
ChangesOnMyIssueNotificationHandler.isPeerChanged
private static boolean isPeerChanged(Change change, ChangedIssue issue) { Optional<User> assignee = issue.getAssignee(); return !assignee.isPresent() || !change.isAuthorLogin(assignee.get().getLogin()); }
java
private static boolean isPeerChanged(Change change, ChangedIssue issue) { Optional<User> assignee = issue.getAssignee(); return !assignee.isPresent() || !change.isAuthorLogin(assignee.get().getLogin()); }
[ "private", "static", "boolean", "isPeerChanged", "(", "Change", "change", ",", "ChangedIssue", "issue", ")", "{", "Optional", "<", "User", ">", "assignee", "=", "issue", ".", "getAssignee", "(", ")", ";", "return", "!", "assignee", ".", "isPresent", "(", "...
Is the author of the change the assignee of the specified issue? If not, it means the issue has been changed by a peer of the author of the change.
[ "Is", "the", "author", "of", "the", "change", "the", "assignee", "of", "the", "specified", "issue?", "If", "not", "it", "means", "the", "issue", "has", "been", "changed", "by", "a", "peer", "of", "the", "author", "of", "the", "change", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandler.java#L174-L177
yidongnan/grpc-spring-boot-starter
grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/channelfactory/AbstractChannelFactory.java
AbstractChannelFactory.configureLimits
protected void configureLimits(final T builder, final String name) { final GrpcChannelProperties properties = getPropertiesFor(name); final Integer maxInboundMessageSize = properties.getMaxInboundMessageSize(); if (maxInboundMessageSize != null) { builder.maxInboundMessageSize(maxInboundMessageSize); } }
java
protected void configureLimits(final T builder, final String name) { final GrpcChannelProperties properties = getPropertiesFor(name); final Integer maxInboundMessageSize = properties.getMaxInboundMessageSize(); if (maxInboundMessageSize != null) { builder.maxInboundMessageSize(maxInboundMessageSize); } }
[ "protected", "void", "configureLimits", "(", "final", "T", "builder", ",", "final", "String", "name", ")", "{", "final", "GrpcChannelProperties", "properties", "=", "getPropertiesFor", "(", "name", ")", ";", "final", "Integer", "maxInboundMessageSize", "=", "prope...
Configures limits such as max message sizes that should be used by the channel. @param builder The channel builder to configure. @param name The name of the client to configure.
[ "Configures", "limits", "such", "as", "max", "message", "sizes", "that", "should", "be", "used", "by", "the", "channel", "." ]
train
https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/channelfactory/AbstractChannelFactory.java#L230-L236
apache/groovy
src/main/groovy/groovy/lang/GroovyClassLoader.java
GroovyClassLoader.loadClass
protected Class loadClass(final String name, boolean resolve) throws ClassNotFoundException { return loadClass(name, true, true, resolve); }
java
protected Class loadClass(final String name, boolean resolve) throws ClassNotFoundException { return loadClass(name, true, true, resolve); }
[ "protected", "Class", "loadClass", "(", "final", "String", "name", ",", "boolean", "resolve", ")", "throws", "ClassNotFoundException", "{", "return", "loadClass", "(", "name", ",", "true", ",", "true", ",", "resolve", ")", ";", "}" ]
Implemented here to check package access prior to returning an already loaded class. @throws CompilationFailedException if the compilation failed @throws ClassNotFoundException if the class was not found @see java.lang.ClassLoader#loadClass(java.lang.String, boolean)
[ "Implemented", "here", "to", "check", "package", "access", "prior", "to", "returning", "an", "already", "loaded", "class", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L870-L872
lukas-krecan/JsonUnit
json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java
JsonAssert.isObject
public MapAssert<String, Object> isObject() { Node node = assertType(OBJECT); return new JsonMapAssert((Map<String, Object>) node.getValue(), path.asPrefix(), configuration) .as("Different value found in node \"%s\"", path); }
java
public MapAssert<String, Object> isObject() { Node node = assertType(OBJECT); return new JsonMapAssert((Map<String, Object>) node.getValue(), path.asPrefix(), configuration) .as("Different value found in node \"%s\"", path); }
[ "public", "MapAssert", "<", "String", ",", "Object", ">", "isObject", "(", ")", "{", "Node", "node", "=", "assertType", "(", "OBJECT", ")", ";", "return", "new", "JsonMapAssert", "(", "(", "Map", "<", "String", ",", "Object", ">", ")", "node", ".", "...
Asserts that given node is present and is of type object. @return MapAssert where the object is serialized as Map
[ "Asserts", "that", "given", "node", "is", "present", "and", "is", "of", "type", "object", "." ]
train
https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java#L130-L134
VoltDB/voltdb
examples/callcenter/procedures/callcenter/BeginCall.java
BeginCall.run
public long run(int agent_id, String phone_no, long call_id, TimestampType start_ts) { voltQueueSQL(findOpenCall, EXPECT_ZERO_OR_ONE_ROW, call_id, agent_id, phone_no); voltQueueSQL(findCompletedCall, EXPECT_ZERO_OR_ONE_ROW, call_id, agent_id, phone_no); VoltTable[] results = voltExecuteSQL(); boolean completedCall = results[1].getRowCount() > 0; if (completedCall) { return -1; } VoltTable openRowTable = results[0]; if (openRowTable.getRowCount() > 0) { VoltTableRow existingCall = openRowTable.fetchRow(0); // check if this is the second begin we've seen for this open call existingCall.getTimestampAsTimestamp("start_ts"); if (existingCall.wasNull() == false) { return -1; } // check if this completes the call TimestampType end_ts = existingCall.getTimestampAsTimestamp("end_ts"); if (existingCall.wasNull() == false) { int durationms = (int) ((end_ts.getTime() - start_ts.getTime()) / 1000); // update per-day running stddev calculation computeRunningStdDev(agent_id, end_ts, durationms); // completes the call voltQueueSQL(deleteOpenCall, EXPECT_SCALAR_MATCH(1), call_id, agent_id, phone_no); voltQueueSQL(insertCompletedCall, EXPECT_SCALAR_MATCH(1), call_id, agent_id, phone_no, start_ts, end_ts, durationms); voltExecuteSQL(true); return 0; } } voltQueueSQL(upsertOpenCall, EXPECT_SCALAR_MATCH(1), call_id, agent_id, phone_no, start_ts); voltExecuteSQL(true); return 0; }
java
public long run(int agent_id, String phone_no, long call_id, TimestampType start_ts) { voltQueueSQL(findOpenCall, EXPECT_ZERO_OR_ONE_ROW, call_id, agent_id, phone_no); voltQueueSQL(findCompletedCall, EXPECT_ZERO_OR_ONE_ROW, call_id, agent_id, phone_no); VoltTable[] results = voltExecuteSQL(); boolean completedCall = results[1].getRowCount() > 0; if (completedCall) { return -1; } VoltTable openRowTable = results[0]; if (openRowTable.getRowCount() > 0) { VoltTableRow existingCall = openRowTable.fetchRow(0); // check if this is the second begin we've seen for this open call existingCall.getTimestampAsTimestamp("start_ts"); if (existingCall.wasNull() == false) { return -1; } // check if this completes the call TimestampType end_ts = existingCall.getTimestampAsTimestamp("end_ts"); if (existingCall.wasNull() == false) { int durationms = (int) ((end_ts.getTime() - start_ts.getTime()) / 1000); // update per-day running stddev calculation computeRunningStdDev(agent_id, end_ts, durationms); // completes the call voltQueueSQL(deleteOpenCall, EXPECT_SCALAR_MATCH(1), call_id, agent_id, phone_no); voltQueueSQL(insertCompletedCall, EXPECT_SCALAR_MATCH(1), call_id, agent_id, phone_no, start_ts, end_ts, durationms); voltExecuteSQL(true); return 0; } } voltQueueSQL(upsertOpenCall, EXPECT_SCALAR_MATCH(1), call_id, agent_id, phone_no, start_ts); voltExecuteSQL(true); return 0; }
[ "public", "long", "run", "(", "int", "agent_id", ",", "String", "phone_no", ",", "long", "call_id", ",", "TimestampType", "start_ts", ")", "{", "voltQueueSQL", "(", "findOpenCall", ",", "EXPECT_ZERO_OR_ONE_ROW", ",", "call_id", ",", "agent_id", ",", "phone_no", ...
Procedure main logic. @param uuid Column value for tuple insertion and partitioning key for this procedure. @param val Column value for tuple insertion. @param update_ts Column value for tuple insertion. @param newestToDiscard Try to remove any tuples as old or older than this value. @param targetMaxRowsToDelete The upper limit on the number of rows to delete per transaction. @return The number of deleted rows. @throws VoltAbortException on bad input.
[ "Procedure", "main", "logic", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/examples/callcenter/procedures/callcenter/BeginCall.java#L82-L125
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/server/RemoteSessionServer.java
RemoteSessionServer.createRemoteTask
public RemoteTask createRemoteTask(Map<String, Object> properties) throws RemoteException { Utility.getLogger().info("createRemoteTask()"); RemoteTask remoteTask = this.getNewRemoteTask(properties); return remoteTask; }
java
public RemoteTask createRemoteTask(Map<String, Object> properties) throws RemoteException { Utility.getLogger().info("createRemoteTask()"); RemoteTask remoteTask = this.getNewRemoteTask(properties); return remoteTask; }
[ "public", "RemoteTask", "createRemoteTask", "(", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "RemoteException", "{", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"createRemoteTask()\"", ")", ";", "RemoteTask", "remoteTask...
Build a new remote session and initialize it. @return The remote Task.
[ "Build", "a", "new", "remote", "session", "and", "initialize", "it", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/server/RemoteSessionServer.java#L142-L147
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/common/UpdateUtils.java
UpdateUtils.updateFileFromUrl
public static void updateFileFromUrl(final String sourceUrl, final String destinationFilePath) throws UpdateException { updateFileFromUrl(sourceUrl, destinationFilePath, null, null); }
java
public static void updateFileFromUrl(final String sourceUrl, final String destinationFilePath) throws UpdateException { updateFileFromUrl(sourceUrl, destinationFilePath, null, null); }
[ "public", "static", "void", "updateFileFromUrl", "(", "final", "String", "sourceUrl", ",", "final", "String", "destinationFilePath", ")", "throws", "UpdateException", "{", "updateFileFromUrl", "(", "sourceUrl", ",", "destinationFilePath", ",", "null", ",", "null", "...
Get the source URL and store it to a destination file path @param sourceUrl url @param destinationFilePath destination @throws UpdateException on error
[ "Get", "the", "source", "URL", "and", "store", "it", "to", "a", "destination", "file", "path" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/UpdateUtils.java#L57-L60