repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/scene_objects/GVRCubeSceneObject.java
GVRCubeSceneObject.createSimpleCubeSixMeshes
private void createSimpleCubeSixMeshes(GVRContext gvrContext, boolean facingOut, String vertexDesc, ArrayList<GVRTexture> textureList) { GVRSceneObject[] children = new GVRSceneObject[6]; GVRMesh[] meshes = new GVRMesh[6]; GVRVertexBuffer vbuf = new GVRVertexBuffer(gvrContext, vertexDesc, SIMPLE_VERTICES.length / 3); if (facingOut) { vbuf.setFloatArray("a_position", SIMPLE_VERTICES, 3, 0); vbuf.setFloatArray("a_normal", SIMPLE_OUTWARD_NORMALS, 3, 0); vbuf.setFloatArray("a_texcoord", SIMPLE_OUTWARD_TEXCOORDS, 2, 0); meshes[0] = createMesh(vbuf, SIMPLE_OUTWARD_FRONT_INDICES); meshes[1] = createMesh(vbuf, SIMPLE_OUTWARD_RIGHT_INDICES); meshes[2] = createMesh(vbuf, SIMPLE_OUTWARD_BACK_INDICES); meshes[3] = createMesh(vbuf, SIMPLE_OUTWARD_LEFT_INDICES); meshes[4] = createMesh(vbuf, SIMPLE_OUTWARD_TOP_INDICES); meshes[5] = createMesh(vbuf, SIMPLE_OUTWARD_BOTTOM_INDICES); } else { vbuf.setFloatArray("a_position", SIMPLE_VERTICES, 3, 0); vbuf.setFloatArray("a_normal", SIMPLE_INWARD_NORMALS, 3, 0); vbuf.setFloatArray("a_texcoord", SIMPLE_INWARD_TEXCOORDS, 2, 0); meshes[0] = createMesh(vbuf, SIMPLE_INWARD_FRONT_INDICES); meshes[1] = createMesh(vbuf, SIMPLE_INWARD_RIGHT_INDICES); meshes[2] = createMesh(vbuf, SIMPLE_INWARD_BACK_INDICES); meshes[3] = createMesh(vbuf, SIMPLE_INWARD_LEFT_INDICES); meshes[4] = createMesh(vbuf, SIMPLE_INWARD_TOP_INDICES); meshes[5] = createMesh(vbuf, SIMPLE_INWARD_BOTTOM_INDICES); } for (int i = 0; i < 6; i++) { children[i] = new GVRSceneObject(gvrContext, meshes[i], textureList.get(i)); addChildObject(children[i]); } // attached an empty renderData for parent object, so that we can set some common properties GVRRenderData renderData = new GVRRenderData(gvrContext); attachRenderData(renderData); }
java
private void createSimpleCubeSixMeshes(GVRContext gvrContext, boolean facingOut, String vertexDesc, ArrayList<GVRTexture> textureList) { GVRSceneObject[] children = new GVRSceneObject[6]; GVRMesh[] meshes = new GVRMesh[6]; GVRVertexBuffer vbuf = new GVRVertexBuffer(gvrContext, vertexDesc, SIMPLE_VERTICES.length / 3); if (facingOut) { vbuf.setFloatArray("a_position", SIMPLE_VERTICES, 3, 0); vbuf.setFloatArray("a_normal", SIMPLE_OUTWARD_NORMALS, 3, 0); vbuf.setFloatArray("a_texcoord", SIMPLE_OUTWARD_TEXCOORDS, 2, 0); meshes[0] = createMesh(vbuf, SIMPLE_OUTWARD_FRONT_INDICES); meshes[1] = createMesh(vbuf, SIMPLE_OUTWARD_RIGHT_INDICES); meshes[2] = createMesh(vbuf, SIMPLE_OUTWARD_BACK_INDICES); meshes[3] = createMesh(vbuf, SIMPLE_OUTWARD_LEFT_INDICES); meshes[4] = createMesh(vbuf, SIMPLE_OUTWARD_TOP_INDICES); meshes[5] = createMesh(vbuf, SIMPLE_OUTWARD_BOTTOM_INDICES); } else { vbuf.setFloatArray("a_position", SIMPLE_VERTICES, 3, 0); vbuf.setFloatArray("a_normal", SIMPLE_INWARD_NORMALS, 3, 0); vbuf.setFloatArray("a_texcoord", SIMPLE_INWARD_TEXCOORDS, 2, 0); meshes[0] = createMesh(vbuf, SIMPLE_INWARD_FRONT_INDICES); meshes[1] = createMesh(vbuf, SIMPLE_INWARD_RIGHT_INDICES); meshes[2] = createMesh(vbuf, SIMPLE_INWARD_BACK_INDICES); meshes[3] = createMesh(vbuf, SIMPLE_INWARD_LEFT_INDICES); meshes[4] = createMesh(vbuf, SIMPLE_INWARD_TOP_INDICES); meshes[5] = createMesh(vbuf, SIMPLE_INWARD_BOTTOM_INDICES); } for (int i = 0; i < 6; i++) { children[i] = new GVRSceneObject(gvrContext, meshes[i], textureList.get(i)); addChildObject(children[i]); } // attached an empty renderData for parent object, so that we can set some common properties GVRRenderData renderData = new GVRRenderData(gvrContext); attachRenderData(renderData); }
[ "private", "void", "createSimpleCubeSixMeshes", "(", "GVRContext", "gvrContext", ",", "boolean", "facingOut", ",", "String", "vertexDesc", ",", "ArrayList", "<", "GVRTexture", ">", "textureList", ")", "{", "GVRSceneObject", "[", "]", "children", "=", "new", "GVRSc...
Creates a cube with each face as a separate mesh using a different texture. The meshes will share a common vertex array but will have separate index buffers. @param gvrContext context to use for creating cube @param facingOut true for outward normals, false for inward normals @param vertexDesc string describing which vertex components are desired @param textureList list of 6 textures, one for each face
[ "Creates", "a", "cube", "with", "each", "face", "as", "a", "separate", "mesh", "using", "a", "different", "texture", ".", "The", "meshes", "will", "share", "a", "common", "vertex", "array", "but", "will", "have", "separate", "index", "buffers", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/scene_objects/GVRCubeSceneObject.java#L553-L594
strator-dev/greenpepper
greenpepper-open/greenpepper-maven-runner/src/main/java/com/greenpepper/maven/runner/util/ReflectionUtils.java
ReflectionUtils.invokeMain
public static void invokeMain(Class<?> mainClass, List<String> args) throws Exception { Method mainMethod = mainClass.getMethod("main", Class.forName("[Ljava.lang.String;")); mainMethod.invoke(null, convertToArray(args)); }
java
public static void invokeMain(Class<?> mainClass, List<String> args) throws Exception { Method mainMethod = mainClass.getMethod("main", Class.forName("[Ljava.lang.String;")); mainMethod.invoke(null, convertToArray(args)); }
[ "public", "static", "void", "invokeMain", "(", "Class", "<", "?", ">", "mainClass", ",", "List", "<", "String", ">", "args", ")", "throws", "Exception", "{", "Method", "mainMethod", "=", "mainClass", ".", "getMethod", "(", "\"main\"", ",", "Class", ".", ...
<p>invokeMain.</p> @param mainClass a {@link java.lang.Class} object. @param args a {@link java.util.List} object. @throws java.lang.Exception if any.
[ "<p", ">", "invokeMain", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/greenpepper-maven-runner/src/main/java/com/greenpepper/maven/runner/util/ReflectionUtils.java#L58-L64
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.queryPredictions
public PredictionQueryResult queryPredictions(UUID projectId, PredictionQueryToken query) { return queryPredictionsWithServiceResponseAsync(projectId, query).toBlocking().single().body(); }
java
public PredictionQueryResult queryPredictions(UUID projectId, PredictionQueryToken query) { return queryPredictionsWithServiceResponseAsync(projectId, query).toBlocking().single().body(); }
[ "public", "PredictionQueryResult", "queryPredictions", "(", "UUID", "projectId", ",", "PredictionQueryToken", "query", ")", "{", "return", "queryPredictionsWithServiceResponseAsync", "(", "projectId", ",", "query", ")", ".", "toBlocking", "(", ")", ".", "single", "(",...
Get images that were sent to your prediction endpoint. @param projectId The project id @param query Parameters used to query the predictions. Limited to combining 2 tags @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 PredictionQueryResult object if successful.
[ "Get", "images", "that", "were", "sent", "to", "your", "prediction", "endpoint", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3003-L3005
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/DeployKeysApi.java
DeployKeysApi.deleteDeployKey
public void deleteDeployKey(Object projectIdOrPath, Integer keyId) throws GitLabApiException { if (keyId == null) { throw new RuntimeException("keyId cannot be null"); } delete(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "deploy_keys", keyId); }
java
public void deleteDeployKey(Object projectIdOrPath, Integer keyId) throws GitLabApiException { if (keyId == null) { throw new RuntimeException("keyId cannot be null"); } delete(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "deploy_keys", keyId); }
[ "public", "void", "deleteDeployKey", "(", "Object", "projectIdOrPath", ",", "Integer", "keyId", ")", "throws", "GitLabApiException", "{", "if", "(", "keyId", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"keyId cannot be null\"", ")", ";", "...
Removes a deploy key from the project. If the deploy key is used only for this project,it will be deleted from the system. <pre><code>GitLab Endpoint: DELETE /projects/:id/deploy_keys/:key_id</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param keyId the ID of the deploy key to delete @throws GitLabApiException if any exception occurs
[ "Removes", "a", "deploy", "key", "from", "the", "project", ".", "If", "the", "deploy", "key", "is", "used", "only", "for", "this", "project", "it", "will", "be", "deleted", "from", "the", "system", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/DeployKeysApi.java#L204-L211
moleculer-java/moleculer-java
src/main/java/services/moleculer/eventbus/EventEmitter.java
EventEmitter.broadcastLocal
public void broadcastLocal(String name, Tree payload) { eventbus.broadcast(name, payload, null, true); }
java
public void broadcastLocal(String name, Tree payload) { eventbus.broadcast(name, payload, null, true); }
[ "public", "void", "broadcastLocal", "(", "String", "name", ",", "Tree", "payload", ")", "{", "eventbus", ".", "broadcast", "(", "name", ",", "payload", ",", "null", ",", "true", ")", ";", "}" ]
Emits a <b>LOCAL</b> event to <b>ALL</b> listeners from ALL event groups, who are listening this event. Sample code:<br> <br> Tree params = new Tree();<br> params.put("a", true);<br> params.putList("b").add(1).add(2).add(3);<br> ctx.broadcastLocal("user.modified", params); @param name name of event (eg. "user.created") @param payload {@link Tree} structure (payload of the event)
[ "Emits", "a", "<b", ">", "LOCAL<", "/", "b", ">", "event", "to", "<b", ">", "ALL<", "/", "b", ">", "listeners", "from", "ALL", "event", "groups", "who", "are", "listening", "this", "event", ".", "Sample", "code", ":", "<br", ">", "<br", ">", "Tree"...
train
https://github.com/moleculer-java/moleculer-java/blob/27575c44b9ecacc17c4456ceacf5d1851abf1cc4/src/main/java/services/moleculer/eventbus/EventEmitter.java#L239-L241
mygreen/excel-cellformatter
src/main/java/com/github/mygreen/cellformatter/JXLCellFormatter.java
JXLCellFormatter.format
public CellFormatResult format(final Cell cell, final boolean isStartDate1904) { ArgUtils.notNull(cell, "cell"); return format(cell, Locale.getDefault(), isStartDate1904); }
java
public CellFormatResult format(final Cell cell, final boolean isStartDate1904) { ArgUtils.notNull(cell, "cell"); return format(cell, Locale.getDefault(), isStartDate1904); }
[ "public", "CellFormatResult", "format", "(", "final", "Cell", "cell", ",", "final", "boolean", "isStartDate1904", ")", "{", "ArgUtils", ".", "notNull", "(", "cell", ",", "\"cell\"", ")", ";", "return", "format", "(", "cell", ",", "Locale", ".", "getDefault",...
セルの値をフォーマットする。 @since 0.3 @param cell フォーマット対象のセル @param isStartDate1904 ファイルの設定が1904年始まりかどうか。 {@link JXLUtils#isDateStart1904(jxl.Sheet)}で値を調べます。 @return フォーマットしたセルの値。 @throws IllegalArgumentException cell is null.
[ "セルの値をフォーマットする。" ]
train
https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/JXLCellFormatter.java#L124-L127
atomix/atomix
core/src/main/java/io/atomix/core/multimap/impl/AbstractAtomicMultimapService.java
AbstractAtomicMultimapService.onChange
private void onChange(String key, byte[] oldValue, byte[] newValue) { listeners.forEach(id -> getSession(id).accept(client -> client.onChange(key, oldValue, newValue))); }
java
private void onChange(String key, byte[] oldValue, byte[] newValue) { listeners.forEach(id -> getSession(id).accept(client -> client.onChange(key, oldValue, newValue))); }
[ "private", "void", "onChange", "(", "String", "key", ",", "byte", "[", "]", "oldValue", ",", "byte", "[", "]", "newValue", ")", "{", "listeners", ".", "forEach", "(", "id", "->", "getSession", "(", "id", ")", ".", "accept", "(", "client", "->", "clie...
Sends a change event to listeners. @param key the changed key @param oldValue the old value @param newValue the new value
[ "Sends", "a", "change", "event", "to", "listeners", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/core/src/main/java/io/atomix/core/multimap/impl/AbstractAtomicMultimapService.java#L495-L497
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.deleteFromComputeNode
public void deleteFromComputeNode(String poolId, String nodeId, String filePath, Boolean recursive, FileDeleteFromComputeNodeOptions fileDeleteFromComputeNodeOptions) { deleteFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath, recursive, fileDeleteFromComputeNodeOptions).toBlocking().single().body(); }
java
public void deleteFromComputeNode(String poolId, String nodeId, String filePath, Boolean recursive, FileDeleteFromComputeNodeOptions fileDeleteFromComputeNodeOptions) { deleteFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath, recursive, fileDeleteFromComputeNodeOptions).toBlocking().single().body(); }
[ "public", "void", "deleteFromComputeNode", "(", "String", "poolId", ",", "String", "nodeId", ",", "String", "filePath", ",", "Boolean", "recursive", ",", "FileDeleteFromComputeNodeOptions", "fileDeleteFromComputeNodeOptions", ")", "{", "deleteFromComputeNodeWithServiceRespons...
Deletes the specified file from the compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node from which you want to delete the file. @param filePath The path to the file or directory that you want to delete. @param recursive Whether to delete children of a directory. If the filePath parameter represents a directory instead of a file, you can set recursive to true to delete the directory and all of the files and subdirectories in it. If recursive is false then the directory must be empty or deletion will fail. @param fileDeleteFromComputeNodeOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "the", "specified", "file", "from", "the", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L973-L975
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/wi/wisite_translationinternalip_binding.java
wisite_translationinternalip_binding.count_filtered
public static long count_filtered(nitro_service service, String sitepath, String filter) throws Exception{ wisite_translationinternalip_binding obj = new wisite_translationinternalip_binding(); obj.set_sitepath(sitepath); options option = new options(); option.set_count(true); option.set_filter(filter); wisite_translationinternalip_binding[] response = (wisite_translationinternalip_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
java
public static long count_filtered(nitro_service service, String sitepath, String filter) throws Exception{ wisite_translationinternalip_binding obj = new wisite_translationinternalip_binding(); obj.set_sitepath(sitepath); options option = new options(); option.set_count(true); option.set_filter(filter); wisite_translationinternalip_binding[] response = (wisite_translationinternalip_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
[ "public", "static", "long", "count_filtered", "(", "nitro_service", "service", ",", "String", "sitepath", ",", "String", "filter", ")", "throws", "Exception", "{", "wisite_translationinternalip_binding", "obj", "=", "new", "wisite_translationinternalip_binding", "(", ")...
Use this API to count the filtered set of wisite_translationinternalip_binding resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
[ "Use", "this", "API", "to", "count", "the", "filtered", "set", "of", "wisite_translationinternalip_binding", "resources", ".", "filter", "string", "should", "be", "in", "JSON", "format", ".", "eg", ":", "port", ":", "80", "servicetype", ":", "HTTP", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/wi/wisite_translationinternalip_binding.java#L322-L333
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_voicemail_serviceName_settings_PUT
public void billingAccount_voicemail_serviceName_settings_PUT(String billingAccount, String serviceName, OvhVoicemailProperties body) throws IOException { String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/settings"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_voicemail_serviceName_settings_PUT(String billingAccount, String serviceName, OvhVoicemailProperties body) throws IOException { String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/settings"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_voicemail_serviceName_settings_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhVoicemailProperties", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/voicemail/{serv...
Alter this object properties REST: PUT /telephony/{billingAccount}/voicemail/{serviceName}/settings @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8017-L8021
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optByte
public static byte optByte(@Nullable Bundle bundle, @Nullable String key) { return optByte(bundle, key, (byte) 0); }
java
public static byte optByte(@Nullable Bundle bundle, @Nullable String key) { return optByte(bundle, key, (byte) 0); }
[ "public", "static", "byte", "optByte", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ")", "{", "return", "optByte", "(", "bundle", ",", "key", ",", "(", "byte", ")", "0", ")", ";", "}" ]
Returns a optional byte value. In other words, returns the value mapped by key if it exists and is a byte. The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns (byte) 0. @param bundle a bundle. If the bundle is null, this method will return a fallback value. @param key a key for the value. @return a boolean value if exists, (byte) 0 otherwise. @see android.os.Bundle#getByte(String)
[ "Returns", "a", "optional", "byte", "value", ".", "In", "other", "words", "returns", "the", "value", "mapped", "by", "key", "if", "it", "exists", "and", "is", "a", "byte", ".", "The", "bundle", "argument", "is", "allowed", "to", "be", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L213-L215
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java
ContentSpecParser.parseTopic
protected SpecTopic parseTopic(final ParserData parserData, final String line, int lineNumber) throws ParsingException { // Read in the variables inside of the brackets final HashMap<ParserType, String[]> variableMap = getLineVariables(parserData, line, lineNumber, '[', ']', ',', false); if (!variableMap.containsKey(ParserType.NONE)) { throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_TOPIC_FORMAT_MSG, lineNumber, line)); } // Get the title final String title = ProcessorUtilities.replaceEscapeChars(getTitle(line, '[')); // Create the spec topic final SpecTopic tempTopic = new SpecTopic(title, lineNumber, line, null); // Add in the topic attributes addTopicAttributes(tempTopic, parserData, variableMap.get(ParserType.NONE), lineNumber, line); parserData.getSpecTopics().put(tempTopic.getUniqueId(), tempTopic); // Process the Topic Relationships processTopicRelationships(parserData, tempTopic, variableMap, line, lineNumber); // Throw an error for info if (variableMap.containsKey(ParserType.INFO)) { throw new ParsingException(format(ProcessorConstants.ERROR_TOPIC_WITH_INFO_TOPIC, lineNumber, line)); } return tempTopic; }
java
protected SpecTopic parseTopic(final ParserData parserData, final String line, int lineNumber) throws ParsingException { // Read in the variables inside of the brackets final HashMap<ParserType, String[]> variableMap = getLineVariables(parserData, line, lineNumber, '[', ']', ',', false); if (!variableMap.containsKey(ParserType.NONE)) { throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_TOPIC_FORMAT_MSG, lineNumber, line)); } // Get the title final String title = ProcessorUtilities.replaceEscapeChars(getTitle(line, '[')); // Create the spec topic final SpecTopic tempTopic = new SpecTopic(title, lineNumber, line, null); // Add in the topic attributes addTopicAttributes(tempTopic, parserData, variableMap.get(ParserType.NONE), lineNumber, line); parserData.getSpecTopics().put(tempTopic.getUniqueId(), tempTopic); // Process the Topic Relationships processTopicRelationships(parserData, tempTopic, variableMap, line, lineNumber); // Throw an error for info if (variableMap.containsKey(ParserType.INFO)) { throw new ParsingException(format(ProcessorConstants.ERROR_TOPIC_WITH_INFO_TOPIC, lineNumber, line)); } return tempTopic; }
[ "protected", "SpecTopic", "parseTopic", "(", "final", "ParserData", "parserData", ",", "final", "String", "line", ",", "int", "lineNumber", ")", "throws", "ParsingException", "{", "// Read in the variables inside of the brackets", "final", "HashMap", "<", "ParserType", ...
Processes the input to create a new topic @param parserData @param line The line of input to be processed @return A topics object initialised with the data from the input line. @throws ParsingException Thrown if the line can't be parsed as a Topic, due to incorrect syntax.
[ "Processes", "the", "input", "to", "create", "a", "new", "topic" ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L996-L1022
weld/core
environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java
Weld.addPackage
public Weld addPackage(boolean scanRecursively, Class<?> packageClass) { packages.add(new PackInfo(packageClass, scanRecursively)); return this; }
java
public Weld addPackage(boolean scanRecursively, Class<?> packageClass) { packages.add(new PackInfo(packageClass, scanRecursively)); return this; }
[ "public", "Weld", "addPackage", "(", "boolean", "scanRecursively", ",", "Class", "<", "?", ">", "packageClass", ")", "{", "packages", ".", "add", "(", "new", "PackInfo", "(", "packageClass", ",", "scanRecursively", ")", ")", ";", "return", "this", ";", "}"...
A package of the specified class will be scanned and found classes will be added to the set of bean classes for the synthetic bean archive. @param scanRecursively @param packageClass @return self
[ "A", "package", "of", "the", "specified", "class", "will", "be", "scanned", "and", "found", "classes", "will", "be", "added", "to", "the", "set", "of", "bean", "classes", "for", "the", "synthetic", "bean", "archive", "." ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L402-L405
algolia/instantsearch-android
ui/src/main/java/com/algolia/instantsearch/ui/utils/SearchViewFacade.java
SearchViewFacade.setQuery
public void setQuery(CharSequence query, boolean submit) { if (searchView != null) { searchView.setQuery(query, submit); } else if (supportView != null) { supportView.setQuery(query, submit); } else { throw new IllegalStateException(ERROR_NO_SEARCHVIEW); } }
java
public void setQuery(CharSequence query, boolean submit) { if (searchView != null) { searchView.setQuery(query, submit); } else if (supportView != null) { supportView.setQuery(query, submit); } else { throw new IllegalStateException(ERROR_NO_SEARCHVIEW); } }
[ "public", "void", "setQuery", "(", "CharSequence", "query", ",", "boolean", "submit", ")", "{", "if", "(", "searchView", "!=", "null", ")", "{", "searchView", ".", "setQuery", "(", "query", ",", "submit", ")", ";", "}", "else", "if", "(", "supportView", ...
Sets a query string in the text field and optionally submits the query as well. @param query the query string. This replaces any query text already present in the text field. @param submit whether to submit the query right now or only update the contents of text field.
[ "Sets", "a", "query", "string", "in", "the", "text", "field", "and", "optionally", "submits", "the", "query", "as", "well", "." ]
train
https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/utils/SearchViewFacade.java#L134-L142
sahan/RoboZombie
robozombie/src/main/java/org/apache/http42/client/utils/URIBuilder.java
URIBuilder.addParameter
public URIBuilder addParameter(final String param, final String value) { if (this.queryParams == null) { this.queryParams = new ArrayList<NameValuePair>(); } this.queryParams.add(new BasicNameValuePair(param, value)); this.encodedQuery = null; this.encodedSchemeSpecificPart = null; return this; }
java
public URIBuilder addParameter(final String param, final String value) { if (this.queryParams == null) { this.queryParams = new ArrayList<NameValuePair>(); } this.queryParams.add(new BasicNameValuePair(param, value)); this.encodedQuery = null; this.encodedSchemeSpecificPart = null; return this; }
[ "public", "URIBuilder", "addParameter", "(", "final", "String", "param", ",", "final", "String", "value", ")", "{", "if", "(", "this", ".", "queryParams", "==", "null", ")", "{", "this", ".", "queryParams", "=", "new", "ArrayList", "<", "NameValuePair", ">...
Adds parameter to URI query. The parameter name and value are expected to be unescaped and may contain non ASCII characters.
[ "Adds", "parameter", "to", "URI", "query", ".", "The", "parameter", "name", "and", "value", "are", "expected", "to", "be", "unescaped", "and", "may", "contain", "non", "ASCII", "characters", "." ]
train
https://github.com/sahan/RoboZombie/blob/2e02f0d41647612e9d89360c5c48811ea86b33c8/robozombie/src/main/java/org/apache/http42/client/utils/URIBuilder.java#L269-L277
attribyte/acp
src/main/java/org/attribyte/sql/pool/ConnectionPoolConnection.java
ConnectionPoolConnection.resolveIncompleteTransactions
private void resolveIncompleteTransactions() throws SQLException { switch(transactionState) { case COMPLETED: //All we know for certain is that at least one commit/rollback was called. Do nothing. break; case STARTED: //At least one statement was created with auto-commit false & no commit/rollback. //Follow the default policy. if(conn != null && openStatements.size() > 0) { switch(incompleteTransactionPolicy) { case REPORT: throw new SQLException("Statement closed with incomplete transaction", JDBConnection.SQLSTATE_INVALID_TRANSACTION_STATE); case COMMIT: if(!conn.isClosed()) { conn.commit(); } break; case ROLLBACK: if(!conn.isClosed()) { conn.rollback(); } } } break; } }
java
private void resolveIncompleteTransactions() throws SQLException { switch(transactionState) { case COMPLETED: //All we know for certain is that at least one commit/rollback was called. Do nothing. break; case STARTED: //At least one statement was created with auto-commit false & no commit/rollback. //Follow the default policy. if(conn != null && openStatements.size() > 0) { switch(incompleteTransactionPolicy) { case REPORT: throw new SQLException("Statement closed with incomplete transaction", JDBConnection.SQLSTATE_INVALID_TRANSACTION_STATE); case COMMIT: if(!conn.isClosed()) { conn.commit(); } break; case ROLLBACK: if(!conn.isClosed()) { conn.rollback(); } } } break; } }
[ "private", "void", "resolveIncompleteTransactions", "(", ")", "throws", "SQLException", "{", "switch", "(", "transactionState", ")", "{", "case", "COMPLETED", ":", "//All we know for certain is that at least one commit/rollback was called. Do nothing.", "break", ";", "case", ...
Attempt to deal with any transaction problems. @throws SQLException on invalid state.
[ "Attempt", "to", "deal", "with", "any", "transaction", "problems", "." ]
train
https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/ConnectionPoolConnection.java#L720-L746
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.getStreamStatistics
public GetStreamStatisticsResponse getStreamStatistics(GetStreamStatisticsRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getDomain(), "Domain should NOT be null"); checkStringNotEmpty(request.getApp(), "App should NOT be null"); checkStringNotEmpty(request.getStream(), "Stream should NOT be null"); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); if (request.getStartDate() != null) { internalRequest.addParameter("startDate", request.getStartDate()); } if (request.getEndDate() != null) { internalRequest.addParameter("endDate", request.getEndDate()); } if (request.getAggregate() != null) { internalRequest.addParameter("aggregate", request.getAggregate().toString()); } return invokeHttpClient(internalRequest, GetStreamStatisticsResponse.class); }
java
public GetStreamStatisticsResponse getStreamStatistics(GetStreamStatisticsRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getDomain(), "Domain should NOT be null"); checkStringNotEmpty(request.getApp(), "App should NOT be null"); checkStringNotEmpty(request.getStream(), "Stream should NOT be null"); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); if (request.getStartDate() != null) { internalRequest.addParameter("startDate", request.getStartDate()); } if (request.getEndDate() != null) { internalRequest.addParameter("endDate", request.getEndDate()); } if (request.getAggregate() != null) { internalRequest.addParameter("aggregate", request.getAggregate().toString()); } return invokeHttpClient(internalRequest, GetStreamStatisticsResponse.class); }
[ "public", "GetStreamStatisticsResponse", "getStreamStatistics", "(", "GetStreamStatisticsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getDomain", "("...
get a domain's all streams statistics in the live stream service. @param request The request object containing all options for getting a domain's all streams @return the response
[ "get", "a", "domain", "s", "all", "streams", "statistics", "in", "the", "live", "stream", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L2057-L2077
Ordinastie/MalisisCore
src/main/java/net/malisis/core/renderer/icon/Icon.java
Icon.initSprite
@Override public void initSprite(int width, int height, int x, int y, boolean rotated) { if (width == 0 || height == 0) { //assume block atlas width = BLOCK_TEXTURE_WIDTH; height = BLOCK_TEXTURE_HEIGHT; } this.sheetWidth = width; this.sheetHeight = height; super.initSprite(width, height, x, y, rotated); for (TextureAtlasSprite dep : dependants) { if (dep instanceof Icon) ((Icon) dep).initIcon(this, width, height, x, y, rotated); else dep.copyFrom(this); } }
java
@Override public void initSprite(int width, int height, int x, int y, boolean rotated) { if (width == 0 || height == 0) { //assume block atlas width = BLOCK_TEXTURE_WIDTH; height = BLOCK_TEXTURE_HEIGHT; } this.sheetWidth = width; this.sheetHeight = height; super.initSprite(width, height, x, y, rotated); for (TextureAtlasSprite dep : dependants) { if (dep instanceof Icon) ((Icon) dep).initIcon(this, width, height, x, y, rotated); else dep.copyFrom(this); } }
[ "@", "Override", "public", "void", "initSprite", "(", "int", "width", ",", "int", "height", ",", "int", "x", ",", "int", "y", ",", "boolean", "rotated", ")", "{", "if", "(", "width", "==", "0", "||", "height", "==", "0", ")", "{", "//assume block atl...
Called when the part represented by this {@link Icon} is stiched to the texture. Sets most of the icon fields. @param width the width @param height the height @param x the x @param y the y @param rotated the rotated
[ "Called", "when", "the", "part", "represented", "by", "this", "{", "@link", "Icon", "}", "is", "stiched", "to", "the", "texture", ".", "Sets", "most", "of", "the", "icon", "fields", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/icon/Icon.java#L369-L388
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java
PerspectiveOps.approximatePinhole
public static CameraPinhole approximatePinhole( Point2Transform2_F64 p2n , int width , int height ) { Point2D_F64 na = new Point2D_F64(); Point2D_F64 nb = new Point2D_F64(); // determine horizontal FOV using dot product of (na.x, na.y, 1 ) and (nb.x, nb.y, 1) p2n.compute(0,height/2,na); p2n.compute(width-1,height/2,nb); double abdot = na.x*nb.x + na.y*nb.y + 1; double normA = Math.sqrt(na.x*na.x + na.y*na.y + 1); double normB = Math.sqrt(nb.x*nb.x + nb.y*nb.y + 1); double hfov = Math.acos( abdot/(normA*normB)); // vertical FOV p2n.compute(width/2,0,na); p2n.compute(width/2,height-1,nb); abdot = na.x*nb.x + na.y*nb.y + 1; normA = Math.sqrt(na.x*na.x + na.y*na.y + 1); normB = Math.sqrt(nb.x*nb.x + nb.y*nb.y + 1); double vfov = Math.acos( abdot/(normA*normB)); return createIntrinsic(width,height, UtilAngle.degree(hfov), UtilAngle.degree(vfov)); }
java
public static CameraPinhole approximatePinhole( Point2Transform2_F64 p2n , int width , int height ) { Point2D_F64 na = new Point2D_F64(); Point2D_F64 nb = new Point2D_F64(); // determine horizontal FOV using dot product of (na.x, na.y, 1 ) and (nb.x, nb.y, 1) p2n.compute(0,height/2,na); p2n.compute(width-1,height/2,nb); double abdot = na.x*nb.x + na.y*nb.y + 1; double normA = Math.sqrt(na.x*na.x + na.y*na.y + 1); double normB = Math.sqrt(nb.x*nb.x + nb.y*nb.y + 1); double hfov = Math.acos( abdot/(normA*normB)); // vertical FOV p2n.compute(width/2,0,na); p2n.compute(width/2,height-1,nb); abdot = na.x*nb.x + na.y*nb.y + 1; normA = Math.sqrt(na.x*na.x + na.y*na.y + 1); normB = Math.sqrt(nb.x*nb.x + nb.y*nb.y + 1); double vfov = Math.acos( abdot/(normA*normB)); return createIntrinsic(width,height, UtilAngle.degree(hfov), UtilAngle.degree(vfov)); }
[ "public", "static", "CameraPinhole", "approximatePinhole", "(", "Point2Transform2_F64", "p2n", ",", "int", "width", ",", "int", "height", ")", "{", "Point2D_F64", "na", "=", "new", "Point2D_F64", "(", ")", ";", "Point2D_F64", "nb", "=", "new", "Point2D_F64", "...
Approximates a pinhole camera using the distoriton model @param p2n Distorted pixel to undistorted normalized image coordinates @return
[ "Approximates", "a", "pinhole", "camera", "using", "the", "distoriton", "model" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L59-L86
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/transform/XmlResponsesSaxParser.java
XmlResponsesSaxParser.parseListVersionsResponse
public ListVersionsHandler parseListVersionsResponse(InputStream inputStream, final boolean shouldSDKDecodeResponse) throws IOException { ListVersionsHandler handler = new ListVersionsHandler(shouldSDKDecodeResponse); parseXmlInputStream(handler, sanitizeXmlDocument(handler, inputStream)); return handler; }
java
public ListVersionsHandler parseListVersionsResponse(InputStream inputStream, final boolean shouldSDKDecodeResponse) throws IOException { ListVersionsHandler handler = new ListVersionsHandler(shouldSDKDecodeResponse); parseXmlInputStream(handler, sanitizeXmlDocument(handler, inputStream)); return handler; }
[ "public", "ListVersionsHandler", "parseListVersionsResponse", "(", "InputStream", "inputStream", ",", "final", "boolean", "shouldSDKDecodeResponse", ")", "throws", "IOException", "{", "ListVersionsHandler", "handler", "=", "new", "ListVersionsHandler", "(", "shouldSDKDecodeRe...
Parses a ListVersions response XML document from an input stream. @param inputStream XML data input stream. @return the XML handler object populated with data parsed from the XML stream. @throws SdkClientException
[ "Parses", "a", "ListVersions", "response", "XML", "document", "from", "an", "input", "stream", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/transform/XmlResponsesSaxParser.java#L353-L358
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.calStats
public static Number calStats(String statsString, IntStream numberStream) { return StatsField.valueOfAlias(statsString).calStats(numberStream); }
java
public static Number calStats(String statsString, IntStream numberStream) { return StatsField.valueOfAlias(statsString).calStats(numberStream); }
[ "public", "static", "Number", "calStats", "(", "String", "statsString", ",", "IntStream", "numberStream", ")", "{", "return", "StatsField", ".", "valueOfAlias", "(", "statsString", ")", ".", "calStats", "(", "numberStream", ")", ";", "}" ]
Cal stats number. @param statsString the stats string @param numberStream the number stream @return the number
[ "Cal", "stats", "number", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L64-L66
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/Record.java
Record.copyAllFields
public final void copyAllFields(Record record, FieldList fieldList) { for (int i = 0; i < fieldList.getFieldCount(); i++) { FieldInfo fieldInfo = fieldList.getField(i); BaseField field = record.getField(i); this.moveFieldToThin(fieldInfo, field, record); } }
java
public final void copyAllFields(Record record, FieldList fieldList) { for (int i = 0; i < fieldList.getFieldCount(); i++) { FieldInfo fieldInfo = fieldList.getField(i); BaseField field = record.getField(i); this.moveFieldToThin(fieldInfo, field, record); } }
[ "public", "final", "void", "copyAllFields", "(", "Record", "record", ",", "FieldList", "fieldList", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fieldList", ".", "getFieldCount", "(", ")", ";", "i", "++", ")", "{", "FieldInfo", "fieldInf...
Copy the data in this record to the thin version. @param fieldList
[ "Copy", "the", "data", "in", "this", "record", "to", "the", "thin", "version", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/Record.java#L3275-L3283
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/mock/servlet/MockHttpServletResponse.java
MockHttpServletResponse.getOutputAsString
public String getOutputAsString() { if (stringWriter != null) { return stringWriter.toString(); } else if (outputStream != null) { String outputStr = null; byte[] bytes = outputStream.getOutput(); if (bytes != null) { try { outputStr = new String(bytes, characterEncoding); } catch (UnsupportedEncodingException e) { outputStr = null; } } return outputStr; } return null; }
java
public String getOutputAsString() { if (stringWriter != null) { return stringWriter.toString(); } else if (outputStream != null) { String outputStr = null; byte[] bytes = outputStream.getOutput(); if (bytes != null) { try { outputStr = new String(bytes, characterEncoding); } catch (UnsupportedEncodingException e) { outputStr = null; } } return outputStr; } return null; }
[ "public", "String", "getOutputAsString", "(", ")", "{", "if", "(", "stringWriter", "!=", "null", ")", "{", "return", "stringWriter", ".", "toString", "(", ")", ";", "}", "else", "if", "(", "outputStream", "!=", "null", ")", "{", "String", "outputStr", "=...
Retrieves the content written to the response. @return the content written to the response outputStream or printWriter. Null is returned if neither {@link #getOutputStream()} or {@link #getWriter()} have been called.
[ "Retrieves", "the", "content", "written", "to", "the", "response", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/mock/servlet/MockHttpServletResponse.java#L428-L447
keenlabs/KeenClient-Java
core/src/main/java/io/keen/client/java/FileEventStore.java
FileEventStore.prepareCollectionDir
private File prepareCollectionDir(String projectId, String eventCollection) throws IOException { File collectionDir = getCollectionDir(projectId, eventCollection); // Make sure the max number of events has not been exceeded in this collection. If it has, // delete events to make room. File[] eventFiles = getFilesInDir(collectionDir); if (eventFiles.length >= getMaxEventsPerCollection()) { // need to age out old data so the cache doesn't grow too large KeenLogging.log(String.format(Locale.US, "Too many events in cache for %s, " + "aging out old data", eventCollection)); KeenLogging.log(String.format(Locale.US, "Count: %d and Max: %d", eventFiles.length, getMaxEventsPerCollection())); // delete the eldest (i.e. first we have to sort the list by name) List<File> fileList = Arrays.asList(eventFiles); Collections.sort(fileList, new Comparator<File>() { @Override public int compare(File file, File file1) { return file.getAbsolutePath().compareToIgnoreCase(file1.getAbsolutePath()); } }); for (int i = 0; i < getNumberEventsToForget(); i++) { File f = fileList.get(i); if (!f.delete()) { KeenLogging.log(String.format(Locale.US, "CRITICAL: can't delete file %s, cache is going to be too big", f.getAbsolutePath())); } } } return collectionDir; }
java
private File prepareCollectionDir(String projectId, String eventCollection) throws IOException { File collectionDir = getCollectionDir(projectId, eventCollection); // Make sure the max number of events has not been exceeded in this collection. If it has, // delete events to make room. File[] eventFiles = getFilesInDir(collectionDir); if (eventFiles.length >= getMaxEventsPerCollection()) { // need to age out old data so the cache doesn't grow too large KeenLogging.log(String.format(Locale.US, "Too many events in cache for %s, " + "aging out old data", eventCollection)); KeenLogging.log(String.format(Locale.US, "Count: %d and Max: %d", eventFiles.length, getMaxEventsPerCollection())); // delete the eldest (i.e. first we have to sort the list by name) List<File> fileList = Arrays.asList(eventFiles); Collections.sort(fileList, new Comparator<File>() { @Override public int compare(File file, File file1) { return file.getAbsolutePath().compareToIgnoreCase(file1.getAbsolutePath()); } }); for (int i = 0; i < getNumberEventsToForget(); i++) { File f = fileList.get(i); if (!f.delete()) { KeenLogging.log(String.format(Locale.US, "CRITICAL: can't delete file %s, cache is going to be too big", f.getAbsolutePath())); } } } return collectionDir; }
[ "private", "File", "prepareCollectionDir", "(", "String", "projectId", ",", "String", "eventCollection", ")", "throws", "IOException", "{", "File", "collectionDir", "=", "getCollectionDir", "(", "projectId", ",", "eventCollection", ")", ";", "// Make sure the max number...
Prepares the file cache for the given event collection for another event to be added. This method checks to make sure that the maximum number of events per collection hasn't been exceeded, and if it has, this method discards events to make room. @param projectId The project ID. @param eventCollection The name of the event collection. @return The prepared cache directory for the given project/collection. @throws IOException If there is an error creating the directory or validating/discarding events.
[ "Prepares", "the", "file", "cache", "for", "the", "given", "event", "collection", "for", "another", "event", "to", "be", "added", ".", "This", "method", "checks", "to", "make", "sure", "that", "the", "maximum", "number", "of", "events", "per", "collection", ...
train
https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/core/src/main/java/io/keen/client/java/FileEventStore.java#L372-L404
prolificinteractive/material-calendarview
library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java
MaterialCalendarView.setCurrentDate
public void setCurrentDate(@Nullable CalendarDay day, boolean useSmoothScroll) { if (day == null) { return; } int index = adapter.getIndexForDay(day); pager.setCurrentItem(index, useSmoothScroll); updateUi(); }
java
public void setCurrentDate(@Nullable CalendarDay day, boolean useSmoothScroll) { if (day == null) { return; } int index = adapter.getIndexForDay(day); pager.setCurrentItem(index, useSmoothScroll); updateUi(); }
[ "public", "void", "setCurrentDate", "(", "@", "Nullable", "CalendarDay", "day", ",", "boolean", "useSmoothScroll", ")", "{", "if", "(", "day", "==", "null", ")", "{", "return", ";", "}", "int", "index", "=", "adapter", ".", "getIndexForDay", "(", "day", ...
Set the calendar to a specific month or week based on a date. In month mode, the calendar will be set to the corresponding month. In week mode, the calendar will be set to the corresponding week. @param day a CalendarDay to focus the calendar on. Null will do nothing @param useSmoothScroll use smooth scroll when changing months.
[ "Set", "the", "calendar", "to", "a", "specific", "month", "or", "week", "based", "on", "a", "date", "." ]
train
https://github.com/prolificinteractive/material-calendarview/blob/04fae8175fd034d0a7131f8cb253cae883a88aa2/library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java#L880-L887
bazaarvoice/emodb
auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/util/CredentialEncrypter.java
CredentialEncrypter.decryptString
public String decryptString(String encryptedCredentials) { byte[] plaintextBytes = decryptBytes(encryptedCredentials); return new String(plaintextBytes, Charsets.UTF_8); }
java
public String decryptString(String encryptedCredentials) { byte[] plaintextBytes = decryptBytes(encryptedCredentials); return new String(plaintextBytes, Charsets.UTF_8); }
[ "public", "String", "decryptString", "(", "String", "encryptedCredentials", ")", "{", "byte", "[", "]", "plaintextBytes", "=", "decryptBytes", "(", "encryptedCredentials", ")", ";", "return", "new", "String", "(", "plaintextBytes", ",", "Charsets", ".", "UTF_8", ...
Recovers the plaintext String from the encrypted value returned by {@link #encryptString(String)}.
[ "Recovers", "the", "plaintext", "String", "from", "the", "encrypted", "value", "returned", "by", "{" ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/util/CredentialEncrypter.java#L139-L142
qos-ch/slf4j
slf4j-api/src/main/java/org/slf4j/MDC.java
MDC.setContextMap
public static void setContextMap(Map<String, String> contextMap) { if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.setContextMap(contextMap); }
java
public static void setContextMap(Map<String, String> contextMap) { if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.setContextMap(contextMap); }
[ "public", "static", "void", "setContextMap", "(", "Map", "<", "String", ",", "String", ">", "contextMap", ")", "{", "if", "(", "mdcAdapter", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"MDCAdapter cannot be null. See also \"", "+", "N...
Set the current thread's context map by first clearing any existing map and then copying the map passed as parameter. The context map passed as parameter must only contain keys and values of type String. @param contextMap must contain only keys and values of type String @since 1.5.1
[ "Set", "the", "current", "thread", "s", "context", "map", "by", "first", "clearing", "any", "existing", "map", "and", "then", "copying", "the", "map", "passed", "as", "parameter", ".", "The", "context", "map", "passed", "as", "parameter", "must", "only", "...
train
https://github.com/qos-ch/slf4j/blob/905443f39fadd88a8dd2c467e44affd8cb072a4d/slf4j-api/src/main/java/org/slf4j/MDC.java#L234-L239
recommenders/rival
rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/RecommendationRunner.java
RecommendationRunner.writeStats
public static void writeStats(final String path, final String statLabel, final long stat) { BufferedWriter out = null; try { out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path, true), "UTF-8")); out.write(statLabel + "\t" + stat + "\n"); out.flush(); out.close(); } catch (IOException e) { e.printStackTrace(); } finally { if (out != null) { try { out.close(); } catch (IOException e) { e.printStackTrace(); } } } }
java
public static void writeStats(final String path, final String statLabel, final long stat) { BufferedWriter out = null; try { out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path, true), "UTF-8")); out.write(statLabel + "\t" + stat + "\n"); out.flush(); out.close(); } catch (IOException e) { e.printStackTrace(); } finally { if (out != null) { try { out.close(); } catch (IOException e) { e.printStackTrace(); } } } }
[ "public", "static", "void", "writeStats", "(", "final", "String", "path", ",", "final", "String", "statLabel", ",", "final", "long", "stat", ")", "{", "BufferedWriter", "out", "=", "null", ";", "try", "{", "out", "=", "new", "BufferedWriter", "(", "new", ...
Write the system stats to file. @param path the path to write to @param statLabel what statistics is being written @param stat the value
[ "Write", "the", "system", "stats", "to", "file", "." ]
train
https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/RecommendationRunner.java#L208-L226
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/builder/ResourceUtils.java
ResourceUtils.addFiles
public static void addFiles(final Project findBugsProject, File clzDir, final Pattern pat) { if (clzDir.isDirectory()) { clzDir.listFiles(new FileCollector(pat, findBugsProject)); } }
java
public static void addFiles(final Project findBugsProject, File clzDir, final Pattern pat) { if (clzDir.isDirectory()) { clzDir.listFiles(new FileCollector(pat, findBugsProject)); } }
[ "public", "static", "void", "addFiles", "(", "final", "Project", "findBugsProject", ",", "File", "clzDir", ",", "final", "Pattern", "pat", ")", "{", "if", "(", "clzDir", ".", "isDirectory", "(", ")", ")", "{", "clzDir", ".", "listFiles", "(", "new", "Fil...
recurse add all the files matching given name pattern inside the given directory and all subdirectories
[ "recurse", "add", "all", "the", "files", "matching", "given", "name", "pattern", "inside", "the", "given", "directory", "and", "all", "subdirectories" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/builder/ResourceUtils.java#L107-L111
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.cloneActionState
public void cloneActionState(final ActionState source, final ActionState target) { source.getActionList().forEach(a -> target.getActionList().add(a)); source.getExitActionList().forEach(a -> target.getExitActionList().add(a)); source.getAttributes().asMap().forEach((k, v) -> target.getAttributes().put(k, v)); source.getTransitionSet().forEach(t -> target.getTransitionSet().addAll(t)); val field = ReflectionUtils.findField(target.getExceptionHandlerSet().getClass(), "exceptionHandlers"); ReflectionUtils.makeAccessible(field); val list = (List<FlowExecutionExceptionHandler>) ReflectionUtils.getField(field, target.getExceptionHandlerSet()); list.forEach(h -> source.getExceptionHandlerSet().add(h)); target.setDescription(source.getDescription()); target.setCaption(source.getCaption()); }
java
public void cloneActionState(final ActionState source, final ActionState target) { source.getActionList().forEach(a -> target.getActionList().add(a)); source.getExitActionList().forEach(a -> target.getExitActionList().add(a)); source.getAttributes().asMap().forEach((k, v) -> target.getAttributes().put(k, v)); source.getTransitionSet().forEach(t -> target.getTransitionSet().addAll(t)); val field = ReflectionUtils.findField(target.getExceptionHandlerSet().getClass(), "exceptionHandlers"); ReflectionUtils.makeAccessible(field); val list = (List<FlowExecutionExceptionHandler>) ReflectionUtils.getField(field, target.getExceptionHandlerSet()); list.forEach(h -> source.getExceptionHandlerSet().add(h)); target.setDescription(source.getDescription()); target.setCaption(source.getCaption()); }
[ "public", "void", "cloneActionState", "(", "final", "ActionState", "source", ",", "final", "ActionState", "target", ")", "{", "source", ".", "getActionList", "(", ")", ".", "forEach", "(", "a", "->", "target", ".", "getActionList", "(", ")", ".", "add", "(...
Clone action state. @param source the source @param target the target
[ "Clone", "action", "state", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L642-L653
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/commands/CommandInvoker.java
CommandInvoker.invoke
public ReturnValue invoke(final CommandDefinition cd, final String[] argsAry) { String pluginName = cd.getPluginName(); try { String[] commandLine = cd.getCommandLine(); if (acceptParams) { for (int j = 0; j < commandLine.length; j++) { for (int i = 0; i < argsAry.length; i++) { commandLine[j] = commandLine[j].replaceAll("\\$[Aa][Rr][Gg]" + (i + 1) + "\\$", Matcher.quoteReplacement(argsAry[i])); } } } PluginProxy plugin = (PluginProxy) pluginRepository.getPlugin(pluginName); if (plugin == null) { LOG.info(context, "Unable to instantiate plugin named " + pluginName); //context.getEventBus().post(new LogEvent(this, LogEventType.INFO, "Unable to instantiate plugin named " + pluginName)); //EventsUtil.sendEvent(listenersList, this, LogEvent.INFO, "Unable to instantiate plugin named " + pluginName); return new ReturnValue(Status.UNKNOWN, "Error instantiating plugin '" + pluginName + "' : bad plugin name?"); } //plugin.addListeners(listenersList); InjectionUtils.inject(plugin, context); //plugin.setContext(context); return plugin.execute(commandLine); } catch (Throwable thr) { LOG.error(context, "Plugin [" + pluginName + "] execution error", thr); //context.getEventBus().post(new LogEvent(this, LogEventType.ERROR, "Plugin [" + pluginName + "] execution error", thr)); return new ReturnValue(Status.UNKNOWN, "Plugin [" + pluginName + "] execution error: " + thr.getMessage()); } }
java
public ReturnValue invoke(final CommandDefinition cd, final String[] argsAry) { String pluginName = cd.getPluginName(); try { String[] commandLine = cd.getCommandLine(); if (acceptParams) { for (int j = 0; j < commandLine.length; j++) { for (int i = 0; i < argsAry.length; i++) { commandLine[j] = commandLine[j].replaceAll("\\$[Aa][Rr][Gg]" + (i + 1) + "\\$", Matcher.quoteReplacement(argsAry[i])); } } } PluginProxy plugin = (PluginProxy) pluginRepository.getPlugin(pluginName); if (plugin == null) { LOG.info(context, "Unable to instantiate plugin named " + pluginName); //context.getEventBus().post(new LogEvent(this, LogEventType.INFO, "Unable to instantiate plugin named " + pluginName)); //EventsUtil.sendEvent(listenersList, this, LogEvent.INFO, "Unable to instantiate plugin named " + pluginName); return new ReturnValue(Status.UNKNOWN, "Error instantiating plugin '" + pluginName + "' : bad plugin name?"); } //plugin.addListeners(listenersList); InjectionUtils.inject(plugin, context); //plugin.setContext(context); return plugin.execute(commandLine); } catch (Throwable thr) { LOG.error(context, "Plugin [" + pluginName + "] execution error", thr); //context.getEventBus().post(new LogEvent(this, LogEventType.ERROR, "Plugin [" + pluginName + "] execution error", thr)); return new ReturnValue(Status.UNKNOWN, "Plugin [" + pluginName + "] execution error: " + thr.getMessage()); } }
[ "public", "ReturnValue", "invoke", "(", "final", "CommandDefinition", "cd", ",", "final", "String", "[", "]", "argsAry", ")", "{", "String", "pluginName", "=", "cd", ".", "getPluginName", "(", ")", ";", "try", "{", "String", "[", "]", "commandLine", "=", ...
This method executes external commands (plugins) The methods also expands the $ARG?$ macros. @param cd The command definition @param argsAry The arguments to pass to the command as configured in the server configuration XML (with the $ARG?$ macros) @return The result of the command
[ "This", "method", "executes", "external", "commands", "(", "plugins", ")", "The", "methods", "also", "expands", "the", "$ARG?$", "macros", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/commands/CommandInvoker.java#L125-L158
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java
SeaGlassTableUI.createCustomCellRendererPane
private CellRendererPane createCustomCellRendererPane() { return new CellRendererPane() { @Override public void paintComponent(Graphics graphics, Component component, Container container, int x, int y, int w, int h, boolean shouldValidate) { int rowAtPoint = table.rowAtPoint(new Point(x, y)); boolean isSelected = table.isRowSelected(rowAtPoint); if (component instanceof JComponent && component instanceof UIResource) { JComponent jComponent = (JComponent) component; jComponent.setOpaque(true); jComponent.setBorder(isSelected ? getSelectedRowBorder() : getRowBorder()); jComponent.setBackground(isSelected ? jComponent.getBackground() : transparentColor); if (isSelected) { jComponent.setForeground(unwrap(table.getSelectionForeground())); jComponent.setBackground(unwrap(table.getSelectionBackground())); } else { jComponent.setForeground(unwrap(table.getForeground())); jComponent.setBackground(transparentColor); } } super.paintComponent(graphics, component, container, x, y, w, h, shouldValidate); } /** * DOCUMENT ME! * * @param c DOCUMENT ME! * * @return DOCUMENT ME! */ private Color unwrap(Color c) { if (c instanceof UIResource) { return new Color(c.getRGB()); } return c; } /** * @see javax.swing.JComponent#isOpaque() */ @SuppressWarnings("unused") public boolean isOpaque(int x, int y) { int rowAtPoint = table.rowAtPoint(new Point(x, y)); return table.isRowSelected(rowAtPoint) ? true : super.isOpaque(); } }; }
java
private CellRendererPane createCustomCellRendererPane() { return new CellRendererPane() { @Override public void paintComponent(Graphics graphics, Component component, Container container, int x, int y, int w, int h, boolean shouldValidate) { int rowAtPoint = table.rowAtPoint(new Point(x, y)); boolean isSelected = table.isRowSelected(rowAtPoint); if (component instanceof JComponent && component instanceof UIResource) { JComponent jComponent = (JComponent) component; jComponent.setOpaque(true); jComponent.setBorder(isSelected ? getSelectedRowBorder() : getRowBorder()); jComponent.setBackground(isSelected ? jComponent.getBackground() : transparentColor); if (isSelected) { jComponent.setForeground(unwrap(table.getSelectionForeground())); jComponent.setBackground(unwrap(table.getSelectionBackground())); } else { jComponent.setForeground(unwrap(table.getForeground())); jComponent.setBackground(transparentColor); } } super.paintComponent(graphics, component, container, x, y, w, h, shouldValidate); } /** * DOCUMENT ME! * * @param c DOCUMENT ME! * * @return DOCUMENT ME! */ private Color unwrap(Color c) { if (c instanceof UIResource) { return new Color(c.getRGB()); } return c; } /** * @see javax.swing.JComponent#isOpaque() */ @SuppressWarnings("unused") public boolean isOpaque(int x, int y) { int rowAtPoint = table.rowAtPoint(new Point(x, y)); return table.isRowSelected(rowAtPoint) ? true : super.isOpaque(); } }; }
[ "private", "CellRendererPane", "createCustomCellRendererPane", "(", ")", "{", "return", "new", "CellRendererPane", "(", ")", "{", "@", "Override", "public", "void", "paintComponent", "(", "Graphics", "graphics", ",", "Component", "component", ",", "Container", "cont...
Creates a custom {@link CellRendererPane} that sets the renderer component to be non-opqaque if the associated row isn't selected. This custom {@code CellRendererPane} is needed because a table UI delegate has no prepare renderer like {@link JTable} has. @return DOCUMENT ME!
[ "Creates", "a", "custom", "{", "@link", "CellRendererPane", "}", "that", "sets", "the", "renderer", "component", "to", "be", "non", "-", "opqaque", "if", "the", "associated", "row", "isn", "t", "selected", ".", "This", "custom", "{", "@code", "CellRendererPa...
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java#L1123-L1175
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/FieldCriteria.java
FieldCriteria.buildEqualToCriteria
static FieldCriteria buildEqualToCriteria(Object anAttribute, Object aValue, UserAlias anAlias) { return new FieldCriteria(anAttribute, aValue, EQUAL, anAlias); }
java
static FieldCriteria buildEqualToCriteria(Object anAttribute, Object aValue, UserAlias anAlias) { return new FieldCriteria(anAttribute, aValue, EQUAL, anAlias); }
[ "static", "FieldCriteria", "buildEqualToCriteria", "(", "Object", "anAttribute", ",", "Object", "aValue", ",", "UserAlias", "anAlias", ")", "{", "return", "new", "FieldCriteria", "(", "anAttribute", ",", "aValue", ",", "EQUAL", ",", "anAlias", ")", ";", "}" ]
static FieldCriteria buildEqualToCriteria(Object anAttribute, Object aValue, String anAlias)
[ "static", "FieldCriteria", "buildEqualToCriteria", "(", "Object", "anAttribute", "Object", "aValue", "String", "anAlias", ")" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/FieldCriteria.java#L28-L31
OpenLiberty/open-liberty
dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/VirtualHostMapper.java
VirtualHostMapper.addMapping
public void addMapping(String path, Object target) { vHostTable.put(normalize(path), target); }
java
public void addMapping(String path, Object target) { vHostTable.put(normalize(path), target); }
[ "public", "void", "addMapping", "(", "String", "path", ",", "Object", "target", ")", "{", "vHostTable", ".", "put", "(", "normalize", "(", "path", ")", ",", "target", ")", ";", "}" ]
method addMapping() This method is wildcard aware. It searches for wildcard characters {*} and normalizes the string so that it forms a valid regular expression @param path @param target
[ "method", "addMapping", "()" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/VirtualHostMapper.java#L49-L51
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/AccessAuditContext.java
AccessAuditContext.doAs
public static <T> T doAs(SecurityIdentity securityIdentity, InetAddress remoteAddress, PrivilegedExceptionAction<T> action) throws java.security.PrivilegedActionException { return doAs(false, securityIdentity, remoteAddress, action); }
java
public static <T> T doAs(SecurityIdentity securityIdentity, InetAddress remoteAddress, PrivilegedExceptionAction<T> action) throws java.security.PrivilegedActionException { return doAs(false, securityIdentity, remoteAddress, action); }
[ "public", "static", "<", "T", ">", "T", "doAs", "(", "SecurityIdentity", "securityIdentity", ",", "InetAddress", "remoteAddress", ",", "PrivilegedExceptionAction", "<", "T", ">", "action", ")", "throws", "java", ".", "security", ".", "PrivilegedActionException", "...
Perform work with a new {@code AccessAuditContext} as a particular {@code SecurityIdentity} @param securityIdentity the {@code SecurityIdentity} that the specified {@code action} will run as. May be {@code null} @param remoteAddress the remote address of the caller. @param action the work to perform. Cannot be {@code null} @param <T> the type of teh return value @return the value returned by the PrivilegedAction's <code>run</code> method @exception java.security.PrivilegedActionException if the <code>PrivilegedExceptionAction.run</code> method throws a checked exception. @exception NullPointerException if the specified <code>PrivilegedExceptionAction</code> is <code>null</code>. @exception SecurityException if the caller does not have permission to invoke this method.
[ "Perform", "work", "with", "a", "new", "{", "@code", "AccessAuditContext", "}", "as", "a", "particular", "{", "@code", "SecurityIdentity", "}", "@param", "securityIdentity", "the", "{", "@code", "SecurityIdentity", "}", "that", "the", "specified", "{", "@code", ...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AccessAuditContext.java#L223-L226
belaban/JGroups
src/org/jgroups/blocks/ReplicatedHashMap.java
ReplicatedHashMap.putAll
public void putAll(Map<? extends K,? extends V> m) { try { MethodCall call=new MethodCall(PUT_ALL, m); disp.callRemoteMethods(null, call, call_options); } catch(Throwable t) { throw new RuntimeException("putAll() failed", t); } }
java
public void putAll(Map<? extends K,? extends V> m) { try { MethodCall call=new MethodCall(PUT_ALL, m); disp.callRemoteMethods(null, call, call_options); } catch(Throwable t) { throw new RuntimeException("putAll() failed", t); } }
[ "public", "void", "putAll", "(", "Map", "<", "?", "extends", "K", ",", "?", "extends", "V", ">", "m", ")", "{", "try", "{", "MethodCall", "call", "=", "new", "MethodCall", "(", "PUT_ALL", ",", "m", ")", ";", "disp", ".", "callRemoteMethods", "(", "...
Copies all of the mappings from the specified map to this one. These mappings replace any mappings that this map had for any of the keys currently in the specified map. @param m mappings to be stored in this map
[ "Copies", "all", "of", "the", "mappings", "from", "the", "specified", "map", "to", "this", "one", ".", "These", "mappings", "replace", "any", "mappings", "that", "this", "map", "had", "for", "any", "of", "the", "keys", "currently", "in", "the", "specified"...
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/ReplicatedHashMap.java#L255-L263
jcuda/jnvgraph
JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java
JNvgraph.nvgraphAllocateVertexData
public static int nvgraphAllocateVertexData( nvgraphHandle handle, nvgraphGraphDescr descrG, long numsets, Pointer settypes) { return checkResult(nvgraphAllocateVertexDataNative(handle, descrG, numsets, settypes)); }
java
public static int nvgraphAllocateVertexData( nvgraphHandle handle, nvgraphGraphDescr descrG, long numsets, Pointer settypes) { return checkResult(nvgraphAllocateVertexDataNative(handle, descrG, numsets, settypes)); }
[ "public", "static", "int", "nvgraphAllocateVertexData", "(", "nvgraphHandle", "handle", ",", "nvgraphGraphDescr", "descrG", ",", "long", "numsets", ",", "Pointer", "settypes", ")", "{", "return", "checkResult", "(", "nvgraphAllocateVertexDataNative", "(", "handle", ",...
Allocate numsets vectors of size V reprensenting Vertex Data and attached them the graph. settypes[i] is the type of vector #i, currently all Vertex and Edge data should have the same type
[ "Allocate", "numsets", "vectors", "of", "size", "V", "reprensenting", "Vertex", "Data", "and", "attached", "them", "the", "graph", ".", "settypes", "[", "i", "]", "is", "the", "type", "of", "vector", "#i", "currently", "all", "Vertex", "and", "Edge", "data...
train
https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L239-L246
threerings/nenya
core/src/main/java/com/threerings/miso/tile/FringeConfiguration.java
FringeConfiguration.getFringe
public FringeTileSetRecord getFringe (int baseset, int hashValue) { FringeRecord f = _frecs.get(baseset); return f.tilesets.get( hashValue % f.tilesets.size()); }
java
public FringeTileSetRecord getFringe (int baseset, int hashValue) { FringeRecord f = _frecs.get(baseset); return f.tilesets.get( hashValue % f.tilesets.size()); }
[ "public", "FringeTileSetRecord", "getFringe", "(", "int", "baseset", ",", "int", "hashValue", ")", "{", "FringeRecord", "f", "=", "_frecs", ".", "get", "(", "baseset", ")", ";", "return", "f", ".", "tilesets", ".", "get", "(", "hashValue", "%", "f", ".",...
Get a random FringeTileSetRecord from amongst the ones listed for the specified base tileset.
[ "Get", "a", "random", "FringeTileSetRecord", "from", "amongst", "the", "ones", "listed", "for", "the", "specified", "base", "tileset", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/tile/FringeConfiguration.java#L146-L151
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.beginUpdateTags
public VirtualNetworkGatewayInner beginUpdateTags(String resourceGroupName, String virtualNetworkGatewayName) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body(); }
java
public VirtualNetworkGatewayInner beginUpdateTags(String resourceGroupName, String virtualNetworkGatewayName) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body(); }
[ "public", "VirtualNetworkGatewayInner", "beginUpdateTags", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ")", "{", "return", "beginUpdateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayName", ")", ".", "toBlo...
Updates a virtual network gateway tags. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @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 VirtualNetworkGatewayInner object if successful.
[ "Updates", "a", "virtual", "network", "gateway", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L754-L756
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/ItemRule.java
ItemRule.setValue
public void setValue(Map<String, Token[]> tokensMap) { if (type == null) { type = ItemType.MAP; } if (!isMappableType()) { throw new IllegalArgumentException("The type of this item must be 'map' or 'properties'"); } this.tokensMap = tokensMap; }
java
public void setValue(Map<String, Token[]> tokensMap) { if (type == null) { type = ItemType.MAP; } if (!isMappableType()) { throw new IllegalArgumentException("The type of this item must be 'map' or 'properties'"); } this.tokensMap = tokensMap; }
[ "public", "void", "setValue", "(", "Map", "<", "String", ",", "Token", "[", "]", ">", "tokensMap", ")", "{", "if", "(", "type", "==", "null", ")", "{", "type", "=", "ItemType", ".", "MAP", ";", "}", "if", "(", "!", "isMappableType", "(", ")", ")"...
Sets a value to this Map type item. @param tokensMap the tokens map
[ "Sets", "a", "value", "to", "this", "Map", "type", "item", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L268-L276
ravendb/ravendb-jvm-client
src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java
DocumentSubscriptions.getSubscriptionWorker
public <T> SubscriptionWorker<T> getSubscriptionWorker(Class<T> clazz, String subscriptionName) { return getSubscriptionWorker(clazz, subscriptionName, null); }
java
public <T> SubscriptionWorker<T> getSubscriptionWorker(Class<T> clazz, String subscriptionName) { return getSubscriptionWorker(clazz, subscriptionName, null); }
[ "public", "<", "T", ">", "SubscriptionWorker", "<", "T", ">", "getSubscriptionWorker", "(", "Class", "<", "T", ">", "clazz", ",", "String", "subscriptionName", ")", "{", "return", "getSubscriptionWorker", "(", "clazz", ",", "subscriptionName", ",", "null", ")"...
It opens a subscription and starts pulling documents since a last processed document for that subscription. The connection options determine client and server cooperation rules like document batch sizes or a timeout in a matter of which a client needs to acknowledge that batch has been processed. The acknowledgment is sent after all documents are processed by subscription's handlers. There can be only a single client that is connected to a subscription. @param clazz Entity class @param subscriptionName The name of subscription @param <T> Entity class @return Subscription object that allows to add/remove subscription handlers.
[ "It", "opens", "a", "subscription", "and", "starts", "pulling", "documents", "since", "a", "last", "processed", "document", "for", "that", "subscription", ".", "The", "connection", "options", "determine", "client", "and", "server", "cooperation", "rules", "like", ...
train
https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java#L250-L252
seedstack/seed
security/core/src/main/java/org/seedstack/seed/security/internal/securityexpr/SecurityExpressionUtils.java
SecurityExpressionUtils.hasRoleOn
public static boolean hasRoleOn(String role, String simpleScope) { return securitySupport.hasRole(role, new SimpleScope(simpleScope)); }
java
public static boolean hasRoleOn(String role, String simpleScope) { return securitySupport.hasRole(role, new SimpleScope(simpleScope)); }
[ "public", "static", "boolean", "hasRoleOn", "(", "String", "role", ",", "String", "simpleScope", ")", "{", "return", "securitySupport", ".", "hasRole", "(", "role", ",", "new", "SimpleScope", "(", "simpleScope", ")", ")", ";", "}" ]
Checks the current user role in the given scopes. @param role the role to check @param simpleScope the simple scope to check this role on. @return true if the user has the role for the given simple scope.
[ "Checks", "the", "current", "user", "role", "in", "the", "given", "scopes", "." ]
train
https://github.com/seedstack/seed/blob/d9cf33bfb2fffcdbb0976f4726e943acda90e828/security/core/src/main/java/org/seedstack/seed/security/internal/securityexpr/SecurityExpressionUtils.java#L45-L47
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_modem_wifi_wifiName_GET
public OvhWLAN serviceName_modem_wifi_wifiName_GET(String serviceName, String wifiName) throws IOException { String qPath = "/xdsl/{serviceName}/modem/wifi/{wifiName}"; StringBuilder sb = path(qPath, serviceName, wifiName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhWLAN.class); }
java
public OvhWLAN serviceName_modem_wifi_wifiName_GET(String serviceName, String wifiName) throws IOException { String qPath = "/xdsl/{serviceName}/modem/wifi/{wifiName}"; StringBuilder sb = path(qPath, serviceName, wifiName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhWLAN.class); }
[ "public", "OvhWLAN", "serviceName_modem_wifi_wifiName_GET", "(", "String", "serviceName", ",", "String", "wifiName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/modem/wifi/{wifiName}\"", ";", "StringBuilder", "sb", "=", "path", "(", ...
Get this object properties REST: GET /xdsl/{serviceName}/modem/wifi/{wifiName} @param serviceName [required] The internal name of your XDSL offer @param wifiName [required] Name of the Wifi
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1161-L1166
cqframework/clinical_quality_language
Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java
ElmBaseVisitor.visitTuple
public T visitTuple(Tuple elm, C context) { for (TupleElement element : elm.getElement()) { visitTupleElement(element, context); } return null; }
java
public T visitTuple(Tuple elm, C context) { for (TupleElement element : elm.getElement()) { visitTupleElement(element, context); } return null; }
[ "public", "T", "visitTuple", "(", "Tuple", "elm", ",", "C", "context", ")", "{", "for", "(", "TupleElement", "element", ":", "elm", ".", "getElement", "(", ")", ")", "{", "visitTupleElement", "(", "element", ",", "context", ")", ";", "}", "return", "nu...
Visit a Tuple. This method will be called for every node in the tree that is a Tuple. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result
[ "Visit", "a", "Tuple", ".", "This", "method", "will", "be", "called", "for", "every", "node", "in", "the", "tree", "that", "is", "a", "Tuple", "." ]
train
https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L468-L473
Azure/azure-sdk-for-java
cognitiveservices/data-plane/search/bingentitysearch/src/main/java/com/microsoft/azure/cognitiveservices/search/entitysearch/implementation/BingEntitiesImpl.java
BingEntitiesImpl.searchWithServiceResponseAsync
public Observable<ServiceResponse<SearchResponse>> searchWithServiceResponseAsync(String query, SearchOptionalParameter searchOptionalParameter) { if (query == null) { throw new IllegalArgumentException("Parameter query is required and cannot be null."); } final String acceptLanguage = searchOptionalParameter != null ? searchOptionalParameter.acceptLanguage() : null; final String pragma = searchOptionalParameter != null ? searchOptionalParameter.pragma() : null; final String userAgent = searchOptionalParameter != null ? searchOptionalParameter.userAgent() : this.client.userAgent(); final String clientId = searchOptionalParameter != null ? searchOptionalParameter.clientId() : null; final String clientIp = searchOptionalParameter != null ? searchOptionalParameter.clientIp() : null; final String location = searchOptionalParameter != null ? searchOptionalParameter.location() : null; final String countryCode = searchOptionalParameter != null ? searchOptionalParameter.countryCode() : null; final String market = searchOptionalParameter != null ? searchOptionalParameter.market() : null; final List<AnswerType> responseFilter = searchOptionalParameter != null ? searchOptionalParameter.responseFilter() : null; final List<ResponseFormat> responseFormat = searchOptionalParameter != null ? searchOptionalParameter.responseFormat() : null; final SafeSearch safeSearch = searchOptionalParameter != null ? searchOptionalParameter.safeSearch() : null; final String setLang = searchOptionalParameter != null ? searchOptionalParameter.setLang() : null; return searchWithServiceResponseAsync(query, acceptLanguage, pragma, userAgent, clientId, clientIp, location, countryCode, market, responseFilter, responseFormat, safeSearch, setLang); }
java
public Observable<ServiceResponse<SearchResponse>> searchWithServiceResponseAsync(String query, SearchOptionalParameter searchOptionalParameter) { if (query == null) { throw new IllegalArgumentException("Parameter query is required and cannot be null."); } final String acceptLanguage = searchOptionalParameter != null ? searchOptionalParameter.acceptLanguage() : null; final String pragma = searchOptionalParameter != null ? searchOptionalParameter.pragma() : null; final String userAgent = searchOptionalParameter != null ? searchOptionalParameter.userAgent() : this.client.userAgent(); final String clientId = searchOptionalParameter != null ? searchOptionalParameter.clientId() : null; final String clientIp = searchOptionalParameter != null ? searchOptionalParameter.clientIp() : null; final String location = searchOptionalParameter != null ? searchOptionalParameter.location() : null; final String countryCode = searchOptionalParameter != null ? searchOptionalParameter.countryCode() : null; final String market = searchOptionalParameter != null ? searchOptionalParameter.market() : null; final List<AnswerType> responseFilter = searchOptionalParameter != null ? searchOptionalParameter.responseFilter() : null; final List<ResponseFormat> responseFormat = searchOptionalParameter != null ? searchOptionalParameter.responseFormat() : null; final SafeSearch safeSearch = searchOptionalParameter != null ? searchOptionalParameter.safeSearch() : null; final String setLang = searchOptionalParameter != null ? searchOptionalParameter.setLang() : null; return searchWithServiceResponseAsync(query, acceptLanguage, pragma, userAgent, clientId, clientIp, location, countryCode, market, responseFilter, responseFormat, safeSearch, setLang); }
[ "public", "Observable", "<", "ServiceResponse", "<", "SearchResponse", ">", ">", "searchWithServiceResponseAsync", "(", "String", "query", ",", "SearchOptionalParameter", "searchOptionalParameter", ")", "{", "if", "(", "query", "==", "null", ")", "{", "throw", "new"...
The Entity Search API lets you send a search query to Bing and get back search results that include entities and places. Place results include restaurants, hotel, or other local businesses. For places, the query can specify the name of the local business or it can ask for a list (for example, restaurants near me). Entity results include persons, places, or things. Place in this context is tourist attractions, states, countries, etc. @param query The user's search term. @param searchOptionalParameter 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 SearchResponse object
[ "The", "Entity", "Search", "API", "lets", "you", "send", "a", "search", "query", "to", "Bing", "and", "get", "back", "search", "results", "that", "include", "entities", "and", "places", ".", "Place", "results", "include", "restaurants", "hotel", "or", "other...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingentitysearch/src/main/java/com/microsoft/azure/cognitiveservices/search/entitysearch/implementation/BingEntitiesImpl.java#L121-L139
stripe/stripe-android
stripe/src/main/java/com/stripe/android/view/AddSourceActivity.java
AddSourceActivity.newIntent
@NonNull public static Intent newIntent(@NonNull Context context, boolean requirePostalField, boolean updatesCustomer) { return new Intent(context, AddSourceActivity.class) .putExtra(EXTRA_SHOW_ZIP, requirePostalField) .putExtra(EXTRA_UPDATE_CUSTOMER, updatesCustomer); }
java
@NonNull public static Intent newIntent(@NonNull Context context, boolean requirePostalField, boolean updatesCustomer) { return new Intent(context, AddSourceActivity.class) .putExtra(EXTRA_SHOW_ZIP, requirePostalField) .putExtra(EXTRA_UPDATE_CUSTOMER, updatesCustomer); }
[ "@", "NonNull", "public", "static", "Intent", "newIntent", "(", "@", "NonNull", "Context", "context", ",", "boolean", "requirePostalField", ",", "boolean", "updatesCustomer", ")", "{", "return", "new", "Intent", "(", "context", ",", "AddSourceActivity", ".", "cl...
Create an {@link Intent} to start a {@link AddSourceActivity}. @param context the {@link Context} used to launch the activity @param requirePostalField {@code true} to require a postal code field @param updatesCustomer {@code true} if the activity should update using an already-initialized {@link CustomerSession}, or {@code false} if it should just return a source. @return an {@link Intent} that can be used to start this activity
[ "Create", "an", "{", "@link", "Intent", "}", "to", "start", "a", "{", "@link", "AddSourceActivity", "}", "." ]
train
https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/view/AddSourceActivity.java#L75-L82
greatman/GreatmancodeTools
src/main/java/com/greatmancode/tools/utils/Vector.java
Vector.getMinimum
public static Vector getMinimum(Vector v1, Vector v2) { return new Vector(Math.min(v1.x, v2.x), Math.min(v1.y, v2.y), Math.min(v1.z, v2.z)); }
java
public static Vector getMinimum(Vector v1, Vector v2) { return new Vector(Math.min(v1.x, v2.x), Math.min(v1.y, v2.y), Math.min(v1.z, v2.z)); }
[ "public", "static", "Vector", "getMinimum", "(", "Vector", "v1", ",", "Vector", "v2", ")", "{", "return", "new", "Vector", "(", "Math", ".", "min", "(", "v1", ".", "x", ",", "v2", ".", "x", ")", ",", "Math", ".", "min", "(", "v1", ".", "y", ","...
Gets the minimum components of two vectors. @param v1 The first vector. @param v2 The second vector. @return minimum
[ "Gets", "the", "minimum", "components", "of", "two", "vectors", "." ]
train
https://github.com/greatman/GreatmancodeTools/blob/4c9d2656c5c8298ff9e1f235c9be8b148e43c9f1/src/main/java/com/greatmancode/tools/utils/Vector.java#L599-L601
apache/incubator-druid
server/src/main/java/org/apache/druid/client/coordinator/CoordinatorClient.java
CoordinatorClient.isHandOffComplete
@Nullable public Boolean isHandOffComplete(String dataSource, SegmentDescriptor descriptor) { try { FullResponseHolder response = druidLeaderClient.go( druidLeaderClient.makeRequest( HttpMethod.GET, StringUtils.format( "/druid/coordinator/v1/datasources/%s/handoffComplete?interval=%s&partitionNumber=%d&version=%s", StringUtils.urlEncode(dataSource), descriptor.getInterval(), descriptor.getPartitionNumber(), descriptor.getVersion() ) ) ); if (response.getStatus().equals(HttpResponseStatus.NOT_FOUND)) { return null; } if (!response.getStatus().equals(HttpResponseStatus.OK)) { throw new ISE( "Error while fetching serverView status[%s] content[%s]", response.getStatus(), response.getContent() ); } return jsonMapper.readValue(response.getContent(), new TypeReference<Boolean>() { }); } catch (Exception e) { throw new RuntimeException(e); } }
java
@Nullable public Boolean isHandOffComplete(String dataSource, SegmentDescriptor descriptor) { try { FullResponseHolder response = druidLeaderClient.go( druidLeaderClient.makeRequest( HttpMethod.GET, StringUtils.format( "/druid/coordinator/v1/datasources/%s/handoffComplete?interval=%s&partitionNumber=%d&version=%s", StringUtils.urlEncode(dataSource), descriptor.getInterval(), descriptor.getPartitionNumber(), descriptor.getVersion() ) ) ); if (response.getStatus().equals(HttpResponseStatus.NOT_FOUND)) { return null; } if (!response.getStatus().equals(HttpResponseStatus.OK)) { throw new ISE( "Error while fetching serverView status[%s] content[%s]", response.getStatus(), response.getContent() ); } return jsonMapper.readValue(response.getContent(), new TypeReference<Boolean>() { }); } catch (Exception e) { throw new RuntimeException(e); } }
[ "@", "Nullable", "public", "Boolean", "isHandOffComplete", "(", "String", "dataSource", ",", "SegmentDescriptor", "descriptor", ")", "{", "try", "{", "FullResponseHolder", "response", "=", "druidLeaderClient", ".", "go", "(", "druidLeaderClient", ".", "makeRequest", ...
Checks the given segment is handed off or not. It can return null if the HTTP call returns 404 which can happen during rolling update.
[ "Checks", "the", "given", "segment", "is", "handed", "off", "or", "not", ".", "It", "can", "return", "null", "if", "the", "HTTP", "call", "returns", "404", "which", "can", "happen", "during", "rolling", "update", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/client/coordinator/CoordinatorClient.java#L59-L94
square/tape
tape/src/main/java/com/squareup/tape2/QueueFile.java
QueueFile.writeLong
private static void writeLong(byte[] buffer, int offset, long value) { buffer[offset ] = (byte) (value >> 56); buffer[offset + 1] = (byte) (value >> 48); buffer[offset + 2] = (byte) (value >> 40); buffer[offset + 3] = (byte) (value >> 32); buffer[offset + 4] = (byte) (value >> 24); buffer[offset + 5] = (byte) (value >> 16); buffer[offset + 6] = (byte) (value >> 8); buffer[offset + 7] = (byte) value; }
java
private static void writeLong(byte[] buffer, int offset, long value) { buffer[offset ] = (byte) (value >> 56); buffer[offset + 1] = (byte) (value >> 48); buffer[offset + 2] = (byte) (value >> 40); buffer[offset + 3] = (byte) (value >> 32); buffer[offset + 4] = (byte) (value >> 24); buffer[offset + 5] = (byte) (value >> 16); buffer[offset + 6] = (byte) (value >> 8); buffer[offset + 7] = (byte) value; }
[ "private", "static", "void", "writeLong", "(", "byte", "[", "]", "buffer", ",", "int", "offset", ",", "long", "value", ")", "{", "buffer", "[", "offset", "]", "=", "(", "byte", ")", "(", "value", ">>", "56", ")", ";", "buffer", "[", "offset", "+", ...
Stores an {@code long} in the {@code byte[]}. The behavior is equivalent to calling {@link RandomAccessFile#writeLong}.
[ "Stores", "an", "{" ]
train
https://github.com/square/tape/blob/445cd3fd0a7b3ec48c9ea3e0e86663fe6d3735d8/tape/src/main/java/com/squareup/tape2/QueueFile.java#L236-L245
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/marshal/TypeParser.java
TypeParser.stringifyAliasesParameters
public static String stringifyAliasesParameters(Map<Byte, AbstractType<?>> aliases) { StringBuilder sb = new StringBuilder(); sb.append('('); Iterator<Map.Entry<Byte, AbstractType<?>>> iter = aliases.entrySet().iterator(); if (iter.hasNext()) { Map.Entry<Byte, AbstractType<?>> entry = iter.next(); sb.append((char)(byte)entry.getKey()).append("=>").append(entry.getValue()); } while (iter.hasNext()) { Map.Entry<Byte, AbstractType<?>> entry = iter.next(); sb.append(',').append((char)(byte)entry.getKey()).append("=>").append(entry.getValue()); } sb.append(')'); return sb.toString(); }
java
public static String stringifyAliasesParameters(Map<Byte, AbstractType<?>> aliases) { StringBuilder sb = new StringBuilder(); sb.append('('); Iterator<Map.Entry<Byte, AbstractType<?>>> iter = aliases.entrySet().iterator(); if (iter.hasNext()) { Map.Entry<Byte, AbstractType<?>> entry = iter.next(); sb.append((char)(byte)entry.getKey()).append("=>").append(entry.getValue()); } while (iter.hasNext()) { Map.Entry<Byte, AbstractType<?>> entry = iter.next(); sb.append(',').append((char)(byte)entry.getKey()).append("=>").append(entry.getValue()); } sb.append(')'); return sb.toString(); }
[ "public", "static", "String", "stringifyAliasesParameters", "(", "Map", "<", "Byte", ",", "AbstractType", "<", "?", ">", ">", "aliases", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "'", "'", ")",...
Helper function to ease the writing of AbstractType.toString() methods.
[ "Helper", "function", "to", "ease", "the", "writing", "of", "AbstractType", ".", "toString", "()", "methods", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/marshal/TypeParser.java#L518-L535
k0shk0sh/PermissionHelper
permission/src/main/java/com/fastaccess/permission/base/PermissionFragmentHelper.java
PermissionFragmentHelper.isPermissionGranted
public static boolean isPermissionGranted(@NonNull Fragment context, @NonNull String permission) { return ActivityCompat.checkSelfPermission(context.getContext(), permission) == PackageManager.PERMISSION_GRANTED; }
java
public static boolean isPermissionGranted(@NonNull Fragment context, @NonNull String permission) { return ActivityCompat.checkSelfPermission(context.getContext(), permission) == PackageManager.PERMISSION_GRANTED; }
[ "public", "static", "boolean", "isPermissionGranted", "(", "@", "NonNull", "Fragment", "context", ",", "@", "NonNull", "String", "permission", ")", "{", "return", "ActivityCompat", ".", "checkSelfPermission", "(", "context", ".", "getContext", "(", ")", ",", "pe...
return true if permission is granted, false otherwise. <p/> can be used outside of activity.
[ "return", "true", "if", "permission", "is", "granted", "false", "otherwise", ".", "<p", "/", ">", "can", "be", "used", "outside", "of", "activity", "." ]
train
https://github.com/k0shk0sh/PermissionHelper/blob/04edce2af49981d1dd321bcdfbe981a1000b29d7/permission/src/main/java/com/fastaccess/permission/base/PermissionFragmentHelper.java#L339-L341
pravega/pravega
controller/src/main/java/io/pravega/controller/metrics/StreamMetrics.java
StreamMetrics.reportRetentionEvent
public static void reportRetentionEvent(String scope, String streamName) { DYNAMIC_LOGGER.recordMeterEvents(RETENTION_FREQUENCY, 1, streamTags(scope, streamName)); }
java
public static void reportRetentionEvent(String scope, String streamName) { DYNAMIC_LOGGER.recordMeterEvents(RETENTION_FREQUENCY, 1, streamTags(scope, streamName)); }
[ "public", "static", "void", "reportRetentionEvent", "(", "String", "scope", ",", "String", "streamName", ")", "{", "DYNAMIC_LOGGER", ".", "recordMeterEvents", "(", "RETENTION_FREQUENCY", ",", "1", ",", "streamTags", "(", "scope", ",", "streamName", ")", ")", ";"...
This method increments the Stream-specific counter of retention operations. @param scope Scope. @param streamName Name of the Stream.
[ "This", "method", "increments", "the", "Stream", "-", "specific", "counter", "of", "retention", "operations", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/StreamMetrics.java#L189-L191
elki-project/elki
elki-index/src/main/java/de/lmu/ifi/dbs/elki/index/tree/TreeIndexHeader.java
TreeIndexHeader.writeEmptyPages
public void writeEmptyPages(Stack<Integer> emptyPages, RandomAccessFile file) throws IOException { if(emptyPages.isEmpty()) { this.emptyPagesSize = 0; return; // nothing to write } ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(emptyPages); oos.flush(); byte[] bytes = baos.toByteArray(); this.emptyPagesSize = bytes.length; oos.close(); baos.close(); if(this.emptyPagesSize > 0) { file.seek(file.length()); file.write(bytes); } }
java
public void writeEmptyPages(Stack<Integer> emptyPages, RandomAccessFile file) throws IOException { if(emptyPages.isEmpty()) { this.emptyPagesSize = 0; return; // nothing to write } ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(emptyPages); oos.flush(); byte[] bytes = baos.toByteArray(); this.emptyPagesSize = bytes.length; oos.close(); baos.close(); if(this.emptyPagesSize > 0) { file.seek(file.length()); file.write(bytes); } }
[ "public", "void", "writeEmptyPages", "(", "Stack", "<", "Integer", ">", "emptyPages", ",", "RandomAccessFile", "file", ")", "throws", "IOException", "{", "if", "(", "emptyPages", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "emptyPagesSize", "=", "0", ...
Write the indices of empty pages the the end of <code>file</code>. Calling this method should be followed by a {@link #writeHeader(RandomAccessFile)}. @param emptyPages the stack of empty page ids which remain to be filled @param file File to work with @throws IOException thrown on IO errors
[ "Write", "the", "indices", "of", "empty", "pages", "the", "the", "end", "of", "<code", ">", "file<", "/", "code", ">", ".", "Calling", "this", "method", "should", "be", "followed", "by", "a", "{", "@link", "#writeHeader", "(", "RandomAccessFile", ")", "}...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index/src/main/java/de/lmu/ifi/dbs/elki/index/tree/TreeIndexHeader.java#L220-L237
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCBlob.java
JDBCBlob.getBinaryStream
public InputStream getBinaryStream(long pos, long length) throws SQLException { final byte[] ldata = data; checkValid(ldata); final int dlen = ldata.length; if (pos < MIN_POS || pos > dlen) { throw Util.outOfRangeArgument("pos: " + pos); } pos--; if (length < 0 || length > dlen - pos) { throw Util.outOfRangeArgument("length: " + length); } if (pos == 0 && length == dlen) { return new ByteArrayInputStream(ldata); } // Let client decide on policy. // // Zero-copy is (possibly much) faster because it does // not allocate extra memory and does not involve copy // processing. // // However, because it could lead to unexpected memory, // stress, it is not polite to always pass back a stream // whose buffer is the full size required to represent the // underlying BLOB value. // if (isGetBinaryStreamUsesCopy()) { final byte[] out = new byte[(int) length]; System.arraycopy(ldata, (int) pos, out, 0, (int) length); return new ByteArrayInputStream(out); // } else { // return new BinaryInputStream(ldata, pos, length); // } }
java
public InputStream getBinaryStream(long pos, long length) throws SQLException { final byte[] ldata = data; checkValid(ldata); final int dlen = ldata.length; if (pos < MIN_POS || pos > dlen) { throw Util.outOfRangeArgument("pos: " + pos); } pos--; if (length < 0 || length > dlen - pos) { throw Util.outOfRangeArgument("length: " + length); } if (pos == 0 && length == dlen) { return new ByteArrayInputStream(ldata); } // Let client decide on policy. // // Zero-copy is (possibly much) faster because it does // not allocate extra memory and does not involve copy // processing. // // However, because it could lead to unexpected memory, // stress, it is not polite to always pass back a stream // whose buffer is the full size required to represent the // underlying BLOB value. // if (isGetBinaryStreamUsesCopy()) { final byte[] out = new byte[(int) length]; System.arraycopy(ldata, (int) pos, out, 0, (int) length); return new ByteArrayInputStream(out); // } else { // return new BinaryInputStream(ldata, pos, length); // } }
[ "public", "InputStream", "getBinaryStream", "(", "long", "pos", ",", "long", "length", ")", "throws", "SQLException", "{", "final", "byte", "[", "]", "ldata", "=", "data", ";", "checkValid", "(", "ldata", ")", ";", "final", "int", "dlen", "=", "ldata", "...
Returns an <code>InputStream</code> object that contains a partial <code>Blob</code> value, starting with the byte specified by pos, which is length bytes in length. @param pos the offset to the first byte of the partial value to be retrieved. The first byte in the <code>Blob</code> is at position 1 @param length the length in bytes of the partial value to be retrieved @return <code>InputStream</code> through which the partial <code>Blob</code> value can be read. @throws SQLException if pos is less than 1 or if pos is greater than the number of bytes in the <code>Blob</code> or if pos + length is greater than the number of bytes in the <code>Blob</code> @exception SQLFeatureNotSupportedException if the JDBC driver does not support this method @since JDK 1.6, HSQLDB 1.9.0
[ "Returns", "an", "<code", ">", "InputStream<", "/", "code", ">", "object", "that", "contains", "a", "partial", "<code", ">", "Blob<", "/", "code", ">", "value", "starting", "with", "the", "byte", "specified", "by", "pos", "which", "is", "length", "bytes", ...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCBlob.java#L756-L799
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/config/ConfigValueHelper.java
ConfigValueHelper.checkPattern
protected static void checkPattern(String configKey, String configValue, Pattern pattern, String message) throws SofaRpcRuntimeException { if (configValue != null && !match(pattern, configValue)) { throw ExceptionUtils.buildRuntime(configKey, configValue, message); } }
java
protected static void checkPattern(String configKey, String configValue, Pattern pattern, String message) throws SofaRpcRuntimeException { if (configValue != null && !match(pattern, configValue)) { throw ExceptionUtils.buildRuntime(configKey, configValue, message); } }
[ "protected", "static", "void", "checkPattern", "(", "String", "configKey", ",", "String", "configValue", ",", "Pattern", "pattern", ",", "String", "message", ")", "throws", "SofaRpcRuntimeException", "{", "if", "(", "configValue", "!=", "null", "&&", "!", "match...
根据正则表达式检查字符串是否是正常值(含冒号),不是则抛出异常 @param configKey 配置项 @param configValue 配置值 @param pattern 正则表达式 @param message 消息 @throws SofaRpcRuntimeException
[ "根据正则表达式检查字符串是否是正常值(含冒号),不是则抛出异常" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/config/ConfigValueHelper.java#L144-L149
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java
PactDslRequestWithPath.matchHeader
public PactDslRequestWithPath matchHeader(String header, String regex) { return matchHeader(header, regex, new Generex(regex).random()); }
java
public PactDslRequestWithPath matchHeader(String header, String regex) { return matchHeader(header, regex, new Generex(regex).random()); }
[ "public", "PactDslRequestWithPath", "matchHeader", "(", "String", "header", ",", "String", "regex", ")", "{", "return", "matchHeader", "(", "header", ",", "regex", ",", "new", "Generex", "(", "regex", ")", ".", "random", "(", ")", ")", ";", "}" ]
Match a request header. A random example header value will be generated from the provided regular expression. @param header Header to match @param regex Regular expression to match
[ "Match", "a", "request", "header", ".", "A", "random", "example", "header", "value", "will", "be", "generated", "from", "the", "provided", "regular", "expression", "." ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java#L335-L337
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/stereo/StereoTool.java
StereoTool.getStereo
public static Stereo getStereo(IAtom atom1, IAtom atom2, IAtom atom3, IAtom atom4) { // a normal is calculated for the base atoms (2, 3, 4) and compared to // the first atom. PLUS indicates ACW. TetrahedralSign sign = StereoTool.getHandedness(atom2, atom3, atom4, atom1); if (sign == TetrahedralSign.PLUS) { return Stereo.ANTI_CLOCKWISE; } else { return Stereo.CLOCKWISE; } }
java
public static Stereo getStereo(IAtom atom1, IAtom atom2, IAtom atom3, IAtom atom4) { // a normal is calculated for the base atoms (2, 3, 4) and compared to // the first atom. PLUS indicates ACW. TetrahedralSign sign = StereoTool.getHandedness(atom2, atom3, atom4, atom1); if (sign == TetrahedralSign.PLUS) { return Stereo.ANTI_CLOCKWISE; } else { return Stereo.CLOCKWISE; } }
[ "public", "static", "Stereo", "getStereo", "(", "IAtom", "atom1", ",", "IAtom", "atom2", ",", "IAtom", "atom3", ",", "IAtom", "atom4", ")", "{", "// a normal is calculated for the base atoms (2, 3, 4) and compared to", "// the first atom. PLUS indicates ACW.", "TetrahedralSig...
Take four atoms, and return Stereo.CLOCKWISE or Stereo.ANTI_CLOCKWISE. The first atom is the one pointing towards the observer. @param atom1 the atom pointing towards the observer @param atom2 the second atom (points away) @param atom3 the third atom (points away) @param atom4 the fourth atom (points away) @return clockwise or anticlockwise
[ "Take", "four", "atoms", "and", "return", "Stereo", ".", "CLOCKWISE", "or", "Stereo", ".", "ANTI_CLOCKWISE", ".", "The", "first", "atom", "is", "the", "one", "pointing", "towards", "the", "observer", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/stereo/StereoTool.java#L280-L291
io7m/jaffirm
com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Preconditions.java
Preconditions.checkPreconditionD
public static double checkPreconditionD( final double value, final DoublePredicate predicate, final DoubleFunction<String> describer) { final boolean ok; try { ok = predicate.test(value); } catch (final Throwable e) { final Violations violations = singleViolation(failedPredicate(e)); throw new PreconditionViolationException( failedMessage(Double.valueOf(value), violations), e, violations.count()); } return innerCheckD(value, ok, describer); }
java
public static double checkPreconditionD( final double value, final DoublePredicate predicate, final DoubleFunction<String> describer) { final boolean ok; try { ok = predicate.test(value); } catch (final Throwable e) { final Violations violations = singleViolation(failedPredicate(e)); throw new PreconditionViolationException( failedMessage(Double.valueOf(value), violations), e, violations.count()); } return innerCheckD(value, ok, describer); }
[ "public", "static", "double", "checkPreconditionD", "(", "final", "double", "value", ",", "final", "DoublePredicate", "predicate", ",", "final", "DoubleFunction", "<", "String", ">", "describer", ")", "{", "final", "boolean", "ok", ";", "try", "{", "ok", "=", ...
A {@code double} specialized version of {@link #checkPrecondition(Object, Predicate, Function)} @param value The value @param predicate The predicate @param describer The describer of the predicate @return value @throws PreconditionViolationException If the predicate is false
[ "A", "{", "@code", "double", "}", "specialized", "version", "of", "{", "@link", "#checkPrecondition", "(", "Object", "Predicate", "Function", ")", "}" ]
train
https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Preconditions.java#L521-L536
vatbub/common
core/src/main/java/com/github/vatbub/common/core/Prefs.java
Prefs.getPreference
public String getPreference(String prefKey, String defaultValue) { return props.getProperty(prefKey, defaultValue); }
java
public String getPreference(String prefKey, String defaultValue) { return props.getProperty(prefKey, defaultValue); }
[ "public", "String", "getPreference", "(", "String", "prefKey", ",", "String", "defaultValue", ")", "{", "return", "props", ".", "getProperty", "(", "prefKey", ",", "defaultValue", ")", ";", "}" ]
Returns the value of the specified preference. @param prefKey The preference to look for @param defaultValue The value to be returned if the key was not found in the properties file @return The value of the specified preference or the {@code defaultValue} if the key was not found
[ "Returns", "the", "value", "of", "the", "specified", "preference", "." ]
train
https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/core/src/main/java/com/github/vatbub/common/core/Prefs.java#L85-L87
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.readHistoricalPrincipal
public CmsHistoryPrincipal readHistoricalPrincipal(CmsRequestContext context, CmsUUID principalId) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsHistoryPrincipal result = null; try { result = m_driverManager.readHistoricalPrincipal(dbc, principalId); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_HISTORY_PRINCIPAL_1, principalId), e); } finally { dbc.clear(); } return result; }
java
public CmsHistoryPrincipal readHistoricalPrincipal(CmsRequestContext context, CmsUUID principalId) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsHistoryPrincipal result = null; try { result = m_driverManager.readHistoricalPrincipal(dbc, principalId); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_HISTORY_PRINCIPAL_1, principalId), e); } finally { dbc.clear(); } return result; }
[ "public", "CmsHistoryPrincipal", "readHistoricalPrincipal", "(", "CmsRequestContext", "context", ",", "CmsUUID", "principalId", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "CmsHisto...
Reads a principal (an user or group) from the historical archive based on its ID.<p> @param context the current request context @param principalId the id of the principal to read @return the historical principal entry with the given id @throws CmsException if something goes wrong, ie. {@link CmsDbEntryNotFoundException} @see CmsObject#readUser(CmsUUID) @see CmsObject#readGroup(CmsUUID) @see CmsObject#readHistoryPrincipal(CmsUUID)
[ "Reads", "a", "principal", "(", "an", "user", "or", "group", ")", "from", "the", "historical", "archive", "based", "on", "its", "ID", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L4402-L4415
line/armeria
core/src/main/java/com/linecorp/armeria/server/file/AbstractHttpFileBuilder.java
AbstractHttpFileBuilder.cacheControl
public final B cacheControl(CacheControl cacheControl) { requireNonNull(cacheControl, "cacheControl"); return setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl); }
java
public final B cacheControl(CacheControl cacheControl) { requireNonNull(cacheControl, "cacheControl"); return setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl); }
[ "public", "final", "B", "cacheControl", "(", "CacheControl", "cacheControl", ")", "{", "requireNonNull", "(", "cacheControl", ",", "\"cacheControl\"", ")", ";", "return", "setHeader", "(", "HttpHeaderNames", ".", "CACHE_CONTROL", ",", "cacheControl", ")", ";", "}"...
Sets the {@code "cache-control"} header. This method is a shortcut of: <pre>{@code builder.setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl); }</pre>
[ "Sets", "the", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/file/AbstractHttpFileBuilder.java#L246-L249
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/linsol/qr/LinearSolverQr_DDRM.java
LinearSolverQr_DDRM.setMaxSize
public void setMaxSize( int maxRows , int maxCols ) { this.maxRows = maxRows; this.maxCols = maxCols; Q = new DMatrixRMaj(maxRows,maxRows); R = new DMatrixRMaj(maxRows,maxCols); Y = new DMatrixRMaj(maxRows,1); Z = new DMatrixRMaj(maxRows,1); }
java
public void setMaxSize( int maxRows , int maxCols ) { this.maxRows = maxRows; this.maxCols = maxCols; Q = new DMatrixRMaj(maxRows,maxRows); R = new DMatrixRMaj(maxRows,maxCols); Y = new DMatrixRMaj(maxRows,1); Z = new DMatrixRMaj(maxRows,1); }
[ "public", "void", "setMaxSize", "(", "int", "maxRows", ",", "int", "maxCols", ")", "{", "this", ".", "maxRows", "=", "maxRows", ";", "this", ".", "maxCols", "=", "maxCols", ";", "Q", "=", "new", "DMatrixRMaj", "(", "maxRows", ",", "maxRows", ")", ";", ...
Changes the size of the matrix it can solve for @param maxRows Maximum number of rows in the matrix it will decompose. @param maxCols Maximum number of columns in the matrix it will decompose.
[ "Changes", "the", "size", "of", "the", "matrix", "it", "can", "solve", "for" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/linsol/qr/LinearSolverQr_DDRM.java#L69-L78
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringParser.java
StringParser.parseShort
public static short parseShort (@Nullable final Object aObject, @Nonnegative final int nRadix, final short nDefault) { if (aObject == null) return nDefault; if (aObject instanceof Number) return ((Number) aObject).shortValue (); return parseShort (aObject.toString (), nRadix, nDefault); }
java
public static short parseShort (@Nullable final Object aObject, @Nonnegative final int nRadix, final short nDefault) { if (aObject == null) return nDefault; if (aObject instanceof Number) return ((Number) aObject).shortValue (); return parseShort (aObject.toString (), nRadix, nDefault); }
[ "public", "static", "short", "parseShort", "(", "@", "Nullable", "final", "Object", "aObject", ",", "@", "Nonnegative", "final", "int", "nRadix", ",", "final", "short", "nDefault", ")", "{", "if", "(", "aObject", "==", "null", ")", "return", "nDefault", ";...
Parse the given {@link Object} as short with the specified radix. @param aObject The object to parse. May be <code>null</code>. @param nRadix The radix to use. Must be &ge; {@link Character#MIN_RADIX} and &le; {@link Character#MAX_RADIX}. @param nDefault The default value to be returned if the passed object could not be converted to a valid value. @return The default value if the object does not represent a valid value.
[ "Parse", "the", "given", "{", "@link", "Object", "}", "as", "short", "with", "the", "specified", "radix", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L1200-L1207
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggersInner.java
WorkflowTriggersInner.runAsync
public Observable<Object> runAsync(String resourceGroupName, String workflowName, String triggerName) { return runWithServiceResponseAsync(resourceGroupName, workflowName, triggerName).map(new Func1<ServiceResponse<Object>, Object>() { @Override public Object call(ServiceResponse<Object> response) { return response.body(); } }); }
java
public Observable<Object> runAsync(String resourceGroupName, String workflowName, String triggerName) { return runWithServiceResponseAsync(resourceGroupName, workflowName, triggerName).map(new Func1<ServiceResponse<Object>, Object>() { @Override public Object call(ServiceResponse<Object> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Object", ">", "runAsync", "(", "String", "resourceGroupName", ",", "String", "workflowName", ",", "String", "triggerName", ")", "{", "return", "runWithServiceResponseAsync", "(", "resourceGroupName", ",", "workflowName", ",", "triggerName...
Runs a workflow trigger. @param resourceGroupName The resource group name. @param workflowName The workflow name. @param triggerName The workflow trigger name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Object object
[ "Runs", "a", "workflow", "trigger", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggersInner.java#L573-L580
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/LiveQuery.java
LiveQuery.addChangeListener
ListenerToken addChangeListener(Executor executor, QueryChangeListener listener) { synchronized (lock) { if (!observing) { start(); } return changeNotifier.addChangeListener(executor, listener); } }
java
ListenerToken addChangeListener(Executor executor, QueryChangeListener listener) { synchronized (lock) { if (!observing) { start(); } return changeNotifier.addChangeListener(executor, listener); } }
[ "ListenerToken", "addChangeListener", "(", "Executor", "executor", ",", "QueryChangeListener", "listener", ")", "{", "synchronized", "(", "lock", ")", "{", "if", "(", "!", "observing", ")", "{", "start", "(", ")", ";", "}", "return", "changeNotifier", ".", "...
Adds a change listener. <p> NOTE: this method is synchronized with Query level.
[ "Adds", "a", "change", "listener", ".", "<p", ">", "NOTE", ":", "this", "method", "is", "synchronized", "with", "Query", "level", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/LiveQuery.java#L134-L139
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/Query.java
Query.addSort
public Query addSort(final String propertyName, final SortDirection sortDirection) { sorts.put(propertyName, sortDirection); return this; }
java
public Query addSort(final String propertyName, final SortDirection sortDirection) { sorts.put(propertyName, sortDirection); return this; }
[ "public", "Query", "addSort", "(", "final", "String", "propertyName", ",", "final", "SortDirection", "sortDirection", ")", "{", "sorts", ".", "put", "(", "propertyName", ",", "sortDirection", ")", ";", "return", "this", ";", "}" ]
Adds sort for the specified property with the specified direction. @param propertyName the specified property name to sort @param sortDirection the specified sort @return the current query object
[ "Adds", "sort", "for", "the", "specified", "property", "with", "the", "specified", "direction", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/Query.java#L137-L141
Wootric/WootricSDK-Android
androidsdk/src/main/java/com/wootric/androidsdk/Wootric.java
Wootric.init
public static Wootric init(Activity activity, String clientId, String accountToken) { Wootric local = singleton; if(local == null) { synchronized (Wootric.class) { local = singleton; if (local == null) { checkNotNull(activity, "Activity"); checkNotNull(clientId, "Client Id"); checkNotNull(accountToken, "Account Token"); singleton = local = new Wootric(activity, clientId, accountToken); } } } return local; }
java
public static Wootric init(Activity activity, String clientId, String accountToken) { Wootric local = singleton; if(local == null) { synchronized (Wootric.class) { local = singleton; if (local == null) { checkNotNull(activity, "Activity"); checkNotNull(clientId, "Client Id"); checkNotNull(accountToken, "Account Token"); singleton = local = new Wootric(activity, clientId, accountToken); } } } return local; }
[ "public", "static", "Wootric", "init", "(", "Activity", "activity", ",", "String", "clientId", ",", "String", "accountToken", ")", "{", "Wootric", "local", "=", "singleton", ";", "if", "(", "local", "==", "null", ")", "{", "synchronized", "(", "Wootric", "...
It configures the SDK with required parameters. @param activity Activity where the survey will be presented. @param clientId Found in API section of the Wootric's admin panel. @param accountToken Found in Install section of the Wootric's admin panel.
[ "It", "configures", "the", "SDK", "with", "required", "parameters", "." ]
train
https://github.com/Wootric/WootricSDK-Android/blob/ba584f2317ce99452424b9a78d024e361ad6fec4/androidsdk/src/main/java/com/wootric/androidsdk/Wootric.java#L121-L136
mlhartme/sushi
src/main/java/net/oneandone/sushi/util/IntBitSet.java
IntBitSet.removeRange
public void removeRange(int first, int last) { int ele; for (ele = first; ele <= last; ele++) { remove(ele); } }
java
public void removeRange(int first, int last) { int ele; for (ele = first; ele <= last; ele++) { remove(ele); } }
[ "public", "void", "removeRange", "(", "int", "first", ",", "int", "last", ")", "{", "int", "ele", ";", "for", "(", "ele", "=", "first", ";", "ele", "<=", "last", ";", "ele", "++", ")", "{", "remove", "(", "ele", ")", ";", "}", "}" ]
Remove all elements in the indicated range. @param first first element to remove @param last last element to remove
[ "Remove", "all", "elements", "in", "the", "indicated", "range", "." ]
train
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L247-L253
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java
ProjectTreeController.addCalendars
private void addCalendars(MpxjTreeNode parentNode, ProjectFile file) { for (ProjectCalendar calendar : file.getCalendars()) { addCalendar(parentNode, calendar); } }
java
private void addCalendars(MpxjTreeNode parentNode, ProjectFile file) { for (ProjectCalendar calendar : file.getCalendars()) { addCalendar(parentNode, calendar); } }
[ "private", "void", "addCalendars", "(", "MpxjTreeNode", "parentNode", ",", "ProjectFile", "file", ")", "{", "for", "(", "ProjectCalendar", "calendar", ":", "file", ".", "getCalendars", "(", ")", ")", "{", "addCalendar", "(", "parentNode", ",", "calendar", ")",...
Add calendars to the tree. @param parentNode parent tree node @param file calendar container
[ "Add", "calendars", "to", "the", "tree", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java#L243-L249
CloudSlang/cs-actions
cs-powershell/src/main/java/io/cloudslang/content/services/WSManRemoteShellService.java
WSManRemoteShellService.buildResultFromResponseStreams
private String buildResultFromResponseStreams(String response, OutputStream outputStream) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { StringBuilder commandResult = new StringBuilder(); int noOfStreams = WSManUtils.countStreamElements(response); for (int streamNo = 0; streamNo < noOfStreams; streamNo++) { String stream = XMLUtils.parseXml(response, String.format(RECEIVE_RESPONSE_XPATH, outputStream.getValue(), streamNo)); if (!"DQo=".equals(stream)) { commandResult.append(EncoderDecoder.decodeBase64String(stream)); } } return commandResult.toString(); }
java
private String buildResultFromResponseStreams(String response, OutputStream outputStream) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { StringBuilder commandResult = new StringBuilder(); int noOfStreams = WSManUtils.countStreamElements(response); for (int streamNo = 0; streamNo < noOfStreams; streamNo++) { String stream = XMLUtils.parseXml(response, String.format(RECEIVE_RESPONSE_XPATH, outputStream.getValue(), streamNo)); if (!"DQo=".equals(stream)) { commandResult.append(EncoderDecoder.decodeBase64String(stream)); } } return commandResult.toString(); }
[ "private", "String", "buildResultFromResponseStreams", "(", "String", "response", ",", "OutputStream", "outputStream", ")", "throws", "ParserConfigurationException", ",", "SAXException", ",", "XPathExpressionException", ",", "IOException", "{", "StringBuilder", "commandResult...
Constructs the executed command response from multiple streams of data containing the encoded result of the execution. @param response @param outputStream @return the decoded result of the command in a string. @throws ParserConfigurationException @throws SAXException @throws XPathExpressionException @throws IOException
[ "Constructs", "the", "executed", "command", "response", "from", "multiple", "streams", "of", "data", "containing", "the", "encoded", "result", "of", "the", "execution", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-powershell/src/main/java/io/cloudslang/content/services/WSManRemoteShellService.java#L362-L372
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/moladb/model/Key.java
Key.withAttribute
public Key withAttribute(String attributeName, AttributeValue value) { if (this.attributes == null) { this.attributes = new HashMap<String, AttributeValue>(); } attributes.put(attributeName, value); return this; }
java
public Key withAttribute(String attributeName, AttributeValue value) { if (this.attributes == null) { this.attributes = new HashMap<String, AttributeValue>(); } attributes.put(attributeName, value); return this; }
[ "public", "Key", "withAttribute", "(", "String", "attributeName", ",", "AttributeValue", "value", ")", "{", "if", "(", "this", ".", "attributes", "==", "null", ")", "{", "this", ".", "attributes", "=", "new", "HashMap", "<", "String", ",", "AttributeValue", ...
The method set attribute name and attribute value with input parameters for a key. Returns a reference to this object so that method calls can be chained together. @param attributeName The attribute name to set for a key. @param value The attribute value to set for a key. @return A reference to this object so that method calls can be chained together.
[ "The", "method", "set", "attribute", "name", "and", "attribute", "value", "with", "input", "parameters", "for", "a", "key", ".", "Returns", "a", "reference", "to", "this", "object", "so", "that", "method", "calls", "can", "be", "chained", "together", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/moladb/model/Key.java#L79-L85
vanilladb/vanillacore
src/main/java/org/vanilladb/core/query/algebra/SelectPlan.java
SelectPlan.predHistogram
public static Histogram predHistogram(Histogram hist, Predicate pred) { if (Double.compare(hist.recordsOutput(), 1.0) < 0) return new Histogram(hist.fields()); // apply constant ranges Map<String, ConstantRange> cRanges = new HashMap<String, ConstantRange>(); for (String fld : hist.fields()) { ConstantRange cr = pred.constantRange(fld); if (cr != null) cRanges.put(fld, cr); } Histogram crHist = constantRangeHistogram(hist, cRanges); // apply field joins Histogram jfHist = crHist; Deque<String> flds = new LinkedList<String>(jfHist.fields()); while (!flds.isEmpty()) { String fld = flds.removeFirst(); Set<String> group = pred.joinFields(fld); if (group != null) { flds.removeAll(group); group.add(fld); jfHist = joinFieldsHistogram(jfHist, group); } } return jfHist; }
java
public static Histogram predHistogram(Histogram hist, Predicate pred) { if (Double.compare(hist.recordsOutput(), 1.0) < 0) return new Histogram(hist.fields()); // apply constant ranges Map<String, ConstantRange> cRanges = new HashMap<String, ConstantRange>(); for (String fld : hist.fields()) { ConstantRange cr = pred.constantRange(fld); if (cr != null) cRanges.put(fld, cr); } Histogram crHist = constantRangeHistogram(hist, cRanges); // apply field joins Histogram jfHist = crHist; Deque<String> flds = new LinkedList<String>(jfHist.fields()); while (!flds.isEmpty()) { String fld = flds.removeFirst(); Set<String> group = pred.joinFields(fld); if (group != null) { flds.removeAll(group); group.add(fld); jfHist = joinFieldsHistogram(jfHist, group); } } return jfHist; }
[ "public", "static", "Histogram", "predHistogram", "(", "Histogram", "hist", ",", "Predicate", "pred", ")", "{", "if", "(", "Double", ".", "compare", "(", "hist", ".", "recordsOutput", "(", ")", ",", "1.0", ")", "<", "0", ")", "return", "new", "Histogram"...
Returns a histogram that, for each field, approximates the distribution of field values from the specified histogram satisfying the specified predicate. <p> Assumes that: <ul> <li>Equality selection always finds matching records</li> <li>Values in a bucket have the same frequency (uniform frequency)</li> <li>Given values within two equal ranges (of two joinable fields), all values in the range having smaller number of values appear in the range having larger number of values</li> <li>Distributions of values in different fields are independent with each other</li> </ul> @param hist the input join distribution of field values @param pred the predicate @return a histogram that, for each field, approximates the distribution of field values satisfying the predicate
[ "Returns", "a", "histogram", "that", "for", "each", "field", "approximates", "the", "distribution", "of", "field", "values", "from", "the", "specified", "histogram", "satisfying", "the", "specified", "predicate", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/SelectPlan.java#L63-L89
micronaut-projects/micronaut-core
runtime/src/main/java/io/micronaut/discovery/cloud/ComputeInstanceMetadataResolverUtils.java
ComputeInstanceMetadataResolverUtils.readMetadataUrl
public static JsonNode readMetadataUrl(URL url, int connectionTimeoutMs, int readTimeoutMs, ObjectMapper objectMapper, Map<String, String> requestProperties) throws IOException { URLConnection urlConnection = url.openConnection(); if (url.getProtocol().equalsIgnoreCase("file")) { urlConnection.connect(); try (InputStream in = urlConnection.getInputStream()) { return objectMapper.readTree(in); } } else { HttpURLConnection uc = (HttpURLConnection) urlConnection; uc.setConnectTimeout(connectionTimeoutMs); requestProperties.forEach(uc::setRequestProperty); uc.setReadTimeout(readTimeoutMs); uc.setRequestMethod(HttpMethod.GET.name()); uc.setDoOutput(true); int responseCode = uc.getResponseCode(); try (InputStream in = uc.getInputStream()) { return objectMapper.readTree(in); } } }
java
public static JsonNode readMetadataUrl(URL url, int connectionTimeoutMs, int readTimeoutMs, ObjectMapper objectMapper, Map<String, String> requestProperties) throws IOException { URLConnection urlConnection = url.openConnection(); if (url.getProtocol().equalsIgnoreCase("file")) { urlConnection.connect(); try (InputStream in = urlConnection.getInputStream()) { return objectMapper.readTree(in); } } else { HttpURLConnection uc = (HttpURLConnection) urlConnection; uc.setConnectTimeout(connectionTimeoutMs); requestProperties.forEach(uc::setRequestProperty); uc.setReadTimeout(readTimeoutMs); uc.setRequestMethod(HttpMethod.GET.name()); uc.setDoOutput(true); int responseCode = uc.getResponseCode(); try (InputStream in = uc.getInputStream()) { return objectMapper.readTree(in); } } }
[ "public", "static", "JsonNode", "readMetadataUrl", "(", "URL", "url", ",", "int", "connectionTimeoutMs", ",", "int", "readTimeoutMs", ",", "ObjectMapper", "objectMapper", ",", "Map", "<", "String", ",", "String", ">", "requestProperties", ")", "throws", "IOExcepti...
Reads the result of a URL and parses it using the given {@link ObjectMapper}. @param url the URL to read @param connectionTimeoutMs connection timeout, in milliseconds @param readTimeoutMs read timeout, in milliseconds @param objectMapper Jackson's {@link ObjectMapper} @param requestProperties any request properties to pass @return a {@link JsonNode} instance @throws IOException if any I/O error occurs
[ "Reads", "the", "result", "of", "a", "URL", "and", "parses", "it", "using", "the", "given", "{", "@link", "ObjectMapper", "}", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/runtime/src/main/java/io/micronaut/discovery/cloud/ComputeInstanceMetadataResolverUtils.java#L52-L72
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/HTTPLoggingServiceImpl.java
HTTPLoggingServiceImpl.convertInt
private int convertInt(String input, int defaultValue) { try { return Integer.parseInt(input.trim()); } catch (NumberFormatException nfe) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Malformed input: " + input); } return defaultValue; } }
java
private int convertInt(String input, int defaultValue) { try { return Integer.parseInt(input.trim()); } catch (NumberFormatException nfe) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Malformed input: " + input); } return defaultValue; } }
[ "private", "int", "convertInt", "(", "String", "input", ",", "int", "defaultValue", ")", "{", "try", "{", "return", "Integer", ".", "parseInt", "(", "input", ".", "trim", "(", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "nfe", ")", "{", ...
Convert the input string to an int value. @param input @param defaultValue - if malformed, then return this instead @return int
[ "Convert", "the", "input", "string", "to", "an", "int", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/HTTPLoggingServiceImpl.java#L297-L306
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java
BackPropagationNet.setMomentum
public void setMomentum(double momentum) { if(momentum < 0 || Double.isNaN(momentum) || Double.isInfinite(momentum)) throw new ArithmeticException("Momentum must be non negative, not " + momentum); this.momentum = momentum; }
java
public void setMomentum(double momentum) { if(momentum < 0 || Double.isNaN(momentum) || Double.isInfinite(momentum)) throw new ArithmeticException("Momentum must be non negative, not " + momentum); this.momentum = momentum; }
[ "public", "void", "setMomentum", "(", "double", "momentum", ")", "{", "if", "(", "momentum", "<", "0", "||", "Double", ".", "isNaN", "(", "momentum", ")", "||", "Double", ".", "isInfinite", "(", "momentum", ")", ")", "throw", "new", "ArithmeticException", ...
Sets the non negative momentum used in training. @param momentum the momentum to apply to training
[ "Sets", "the", "non", "negative", "momentum", "used", "in", "training", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java#L315-L320
graknlabs/grakn
server/src/server/exception/TransactionException.java
TransactionException.illegalUnhasInherited
public static TransactionException illegalUnhasInherited(String type, String attributeType, boolean isKey) { return create(ErrorMessage.ILLEGAL_TYPE_UNHAS_ATTRIBUTE_INHERITED.getMessage(type, isKey ? "key" : "has", attributeType)); }
java
public static TransactionException illegalUnhasInherited(String type, String attributeType, boolean isKey) { return create(ErrorMessage.ILLEGAL_TYPE_UNHAS_ATTRIBUTE_INHERITED.getMessage(type, isKey ? "key" : "has", attributeType)); }
[ "public", "static", "TransactionException", "illegalUnhasInherited", "(", "String", "type", ",", "String", "attributeType", ",", "boolean", "isKey", ")", "{", "return", "create", "(", "ErrorMessage", ".", "ILLEGAL_TYPE_UNHAS_ATTRIBUTE_INHERITED", ".", "getMessage", "(",...
Thrown when there exists and instance of {@code type} HAS {@code attributeType} upon unlinking the AttributeType from the Type
[ "Thrown", "when", "there", "exists", "and", "instance", "of", "{" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L129-L131
line/armeria
core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java
ServerBuilder.serviceAt
@Deprecated public ServerBuilder serviceAt(String pathPattern, Service<HttpRequest, HttpResponse> service) { return service(pathPattern, service); }
java
@Deprecated public ServerBuilder serviceAt(String pathPattern, Service<HttpRequest, HttpResponse> service) { return service(pathPattern, service); }
[ "@", "Deprecated", "public", "ServerBuilder", "serviceAt", "(", "String", "pathPattern", ",", "Service", "<", "HttpRequest", ",", "HttpResponse", ">", "service", ")", "{", "return", "service", "(", "pathPattern", ",", "service", ")", ";", "}" ]
Binds the specified {@link Service} at the specified path pattern of the default {@link VirtualHost}. @deprecated Use {@link #service(String, Service)} instead.
[ "Binds", "the", "specified", "{", "@link", "Service", "}", "at", "the", "specified", "path", "pattern", "of", "the", "default", "{", "@link", "VirtualHost", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java#L880-L883
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/access/PortMapping.java
PortMapping.updateProperties
public void updateProperties(Map<String, Container.PortBinding> dockerObtainedDynamicBindings) { for (Map.Entry<String, Container.PortBinding> entry : dockerObtainedDynamicBindings.entrySet()) { String variable = entry.getKey(); Container.PortBinding portBinding = entry.getValue(); if (portBinding != null) { update(hostPortVariableMap, specToHostPortVariableMap.get(variable), portBinding.getHostPort()); String hostIp = portBinding.getHostIp(); // Use the docker host if binding is on all interfaces if ("0.0.0.0".equals(hostIp)) { hostIp = projProperties.getProperty("docker.host.address"); } update(hostIpVariableMap, specToHostIpVariableMap.get(variable), hostIp); } } updateDynamicProperties(hostPortVariableMap); updateDynamicProperties(hostIpVariableMap); }
java
public void updateProperties(Map<String, Container.PortBinding> dockerObtainedDynamicBindings) { for (Map.Entry<String, Container.PortBinding> entry : dockerObtainedDynamicBindings.entrySet()) { String variable = entry.getKey(); Container.PortBinding portBinding = entry.getValue(); if (portBinding != null) { update(hostPortVariableMap, specToHostPortVariableMap.get(variable), portBinding.getHostPort()); String hostIp = portBinding.getHostIp(); // Use the docker host if binding is on all interfaces if ("0.0.0.0".equals(hostIp)) { hostIp = projProperties.getProperty("docker.host.address"); } update(hostIpVariableMap, specToHostIpVariableMap.get(variable), hostIp); } } updateDynamicProperties(hostPortVariableMap); updateDynamicProperties(hostIpVariableMap); }
[ "public", "void", "updateProperties", "(", "Map", "<", "String", ",", "Container", ".", "PortBinding", ">", "dockerObtainedDynamicBindings", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Container", ".", "PortBinding", ">", "entry", ":", "d...
Update variable-to-port mappings with dynamically obtained ports and host ips. This should only be called once after this dynamically allocated parts has been be obtained. @param dockerObtainedDynamicBindings keys are the container ports, values are the dynamically mapped host ports and host ips.
[ "Update", "variable", "-", "to", "-", "port", "mappings", "with", "dynamically", "obtained", "ports", "and", "host", "ips", ".", "This", "should", "only", "be", "called", "once", "after", "this", "dynamically", "allocated", "parts", "has", "been", "be", "obt...
train
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/access/PortMapping.java#L104-L125
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteCrossConnectionPeeringsInner.java
ExpressRouteCrossConnectionPeeringsInner.beginCreateOrUpdate
public ExpressRouteCrossConnectionPeeringInner beginCreateOrUpdate(String resourceGroupName, String crossConnectionName, String peeringName, ExpressRouteCrossConnectionPeeringInner peeringParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, peeringParameters).toBlocking().single().body(); }
java
public ExpressRouteCrossConnectionPeeringInner beginCreateOrUpdate(String resourceGroupName, String crossConnectionName, String peeringName, ExpressRouteCrossConnectionPeeringInner peeringParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, peeringParameters).toBlocking().single().body(); }
[ "public", "ExpressRouteCrossConnectionPeeringInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "crossConnectionName", ",", "String", "peeringName", ",", "ExpressRouteCrossConnectionPeeringInner", "peeringParameters", ")", "{", "return", "beginCreat...
Creates or updates a peering in the specified ExpressRouteCrossConnection. @param resourceGroupName The name of the resource group. @param crossConnectionName The name of the ExpressRouteCrossConnection. @param peeringName The name of the peering. @param peeringParameters Parameters supplied to the create or update ExpressRouteCrossConnection peering 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 ExpressRouteCrossConnectionPeeringInner object if successful.
[ "Creates", "or", "updates", "a", "peering", "in", "the", "specified", "ExpressRouteCrossConnection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteCrossConnectionPeeringsInner.java#L565-L567
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/chunkblock/ChunkBlockHandler.java
ChunkBlockHandler.addCoord
private void addCoord(Chunk chunk, BlockPos pos) { chunks(chunk).add(chunk, pos); }
java
private void addCoord(Chunk chunk, BlockPos pos) { chunks(chunk).add(chunk, pos); }
[ "private", "void", "addCoord", "(", "Chunk", "chunk", ",", "BlockPos", "pos", ")", "{", "chunks", "(", "chunk", ")", ".", "add", "(", "chunk", ",", "pos", ")", ";", "}" ]
Adds a coordinate for the specified {@link Chunk}. @param chunk the chunk @param pos the pos
[ "Adds", "a", "coordinate", "for", "the", "specified", "{", "@link", "Chunk", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/chunkblock/ChunkBlockHandler.java#L159-L162
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/GitLabApiForm.java
GitLabApiForm.withParam
public <T> GitLabApiForm withParam(String name, List<T> values, boolean required) throws IllegalArgumentException { if (values == null || values.isEmpty()) { if (required) { throw new IllegalArgumentException(name + " cannot be empty or null"); } return (this); } for (T value : values) { if (value != null) { this.param(name + "[]", value.toString()); } } return (this); }
java
public <T> GitLabApiForm withParam(String name, List<T> values, boolean required) throws IllegalArgumentException { if (values == null || values.isEmpty()) { if (required) { throw new IllegalArgumentException(name + " cannot be empty or null"); } return (this); } for (T value : values) { if (value != null) { this.param(name + "[]", value.toString()); } } return (this); }
[ "public", "<", "T", ">", "GitLabApiForm", "withParam", "(", "String", "name", ",", "List", "<", "T", ">", "values", ",", "boolean", "required", ")", "throws", "IllegalArgumentException", "{", "if", "(", "values", "==", "null", "||", "values", ".", "isEmpty...
Fluent method for adding a List type query and form parameters to a get() or post() call. @param <T> the type contained by the List @param name the name of the field/attribute to add @param values a List containing the values of the field/attribute to add @param required the field is required flag @return this GitLabAPiForm instance @throws IllegalArgumentException if a required parameter is null or empty
[ "Fluent", "method", "for", "adding", "a", "List", "type", "query", "and", "form", "parameters", "to", "a", "get", "()", "or", "post", "()", "call", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GitLabApiForm.java#L120-L137
alkacon/opencms-core
src/org/opencms/jsp/CmsJspNavBuilder.java
CmsJspNavBuilder.getNavigationForFolder
public List<CmsJspNavElement> getNavigationForFolder( String folder, Visibility visibility, CmsResourceFilter resourceFilter) { folder = CmsFileUtil.removeTrailingSeparator(folder); List<CmsJspNavElement> result = new ArrayList<CmsJspNavElement>(); List<CmsResource> resources = null; try { resources = m_cms.getResourcesInFolder(folder, resourceFilter); } catch (Exception e) { // should never happen LOG.error(e.getLocalizedMessage(), e); } if (resources == null) { return Collections.<CmsJspNavElement> emptyList(); } boolean includeAll = visibility == Visibility.all; boolean includeHidden = visibility == Visibility.includeHidden; for (CmsResource r : resources) { CmsJspNavElement element = getNavigationForResource(m_cms.getSitePath(r), resourceFilter); if ((element != null) && (includeAll || (element.isInNavigation() && (includeHidden || !element.isHiddenNavigationEntry())))) { element.setNavContext(new NavContext(this, visibility, resourceFilter)); result.add(element); } } Collections.sort(result); return result; }
java
public List<CmsJspNavElement> getNavigationForFolder( String folder, Visibility visibility, CmsResourceFilter resourceFilter) { folder = CmsFileUtil.removeTrailingSeparator(folder); List<CmsJspNavElement> result = new ArrayList<CmsJspNavElement>(); List<CmsResource> resources = null; try { resources = m_cms.getResourcesInFolder(folder, resourceFilter); } catch (Exception e) { // should never happen LOG.error(e.getLocalizedMessage(), e); } if (resources == null) { return Collections.<CmsJspNavElement> emptyList(); } boolean includeAll = visibility == Visibility.all; boolean includeHidden = visibility == Visibility.includeHidden; for (CmsResource r : resources) { CmsJspNavElement element = getNavigationForResource(m_cms.getSitePath(r), resourceFilter); if ((element != null) && (includeAll || (element.isInNavigation() && (includeHidden || !element.isHiddenNavigationEntry())))) { element.setNavContext(new NavContext(this, visibility, resourceFilter)); result.add(element); } } Collections.sort(result); return result; }
[ "public", "List", "<", "CmsJspNavElement", ">", "getNavigationForFolder", "(", "String", "folder", ",", "Visibility", "visibility", ",", "CmsResourceFilter", "resourceFilter", ")", "{", "folder", "=", "CmsFileUtil", ".", "removeTrailingSeparator", "(", "folder", ")", ...
Collect all navigation elements from the files in the given folder.<p> @param folder the selected folder @param visibility the visibility mode @param resourceFilter the filter to use reading the resources @return A sorted (ascending to navigation position) list of navigation elements
[ "Collect", "all", "navigation", "elements", "from", "the", "files", "in", "the", "given", "folder", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspNavBuilder.java#L537-L569
srikalyc/Sql4D
Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/Joiner4All.java
Joiner4All.mapPkToRow
private static Tuple2<Object, List<Object>> mapPkToRow(String timestamp, JSONObject jsonRow, List<String> joinFields) { Object joinValue = null; List<Object> rowValues = new ArrayList<>(); rowValues.add(timestamp); for (Object key : jsonRow.keySet()) { String colName = key.toString(); rowValues.add(jsonRow.get(colName)); if (joinFields.contains(colName)) { joinValue = (joinValue == null)?jsonRow.get(colName):(joinValue + "\u0001" + jsonRow.get(colName)); } } if (joinFields.contains("timestamp")) {// Join field could contain timestamp(timestamp can be out of the actual data JSON, so we try this way) joinValue = (joinValue == null)?timestamp:(joinValue + "\u0001" + timestamp); } //Though join field could be specified like (a,timestamp,b) the value of the join, //field will be (a.value^Ab.value^Atimestamp.value) if b appears after a in the json //object. And timestamp value is always appended to last. return new Tuple2<>(joinValue, rowValues); }
java
private static Tuple2<Object, List<Object>> mapPkToRow(String timestamp, JSONObject jsonRow, List<String> joinFields) { Object joinValue = null; List<Object> rowValues = new ArrayList<>(); rowValues.add(timestamp); for (Object key : jsonRow.keySet()) { String colName = key.toString(); rowValues.add(jsonRow.get(colName)); if (joinFields.contains(colName)) { joinValue = (joinValue == null)?jsonRow.get(colName):(joinValue + "\u0001" + jsonRow.get(colName)); } } if (joinFields.contains("timestamp")) {// Join field could contain timestamp(timestamp can be out of the actual data JSON, so we try this way) joinValue = (joinValue == null)?timestamp:(joinValue + "\u0001" + timestamp); } //Though join field could be specified like (a,timestamp,b) the value of the join, //field will be (a.value^Ab.value^Atimestamp.value) if b appears after a in the json //object. And timestamp value is always appended to last. return new Tuple2<>(joinValue, rowValues); }
[ "private", "static", "Tuple2", "<", "Object", ",", "List", "<", "Object", ">", ">", "mapPkToRow", "(", "String", "timestamp", ",", "JSONObject", "jsonRow", ",", "List", "<", "String", ">", "joinFields", ")", "{", "Object", "joinValue", "=", "null", ";", ...
Extract fields(k,v) from json k = primary field(s) could be a composite key. v = all fields . The first field is always timestamp. Presumption is jsonRow object passed to this method should not have timestamp field. @param timestamp @param jsonRow (This is a jsonObject without timestamp(even for select query response though timestamp is present it is stripped off before passing it to this method) @param joinFields @return
[ "Extract", "fields", "(", "k", "v", ")", "from", "json", "k", "=", "primary", "field", "(", "s", ")", "could", "be", "a", "composite", "key", ".", "v", "=", "all", "fields", ".", "The", "first", "field", "is", "always", "timestamp", ".", "Presumption...
train
https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/Joiner4All.java#L111-L129
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions.java
EscapedFunctions.sqlmonthname
public static String sqlmonthname(List<?> parsedArgs) throws SQLException { if (parsedArgs.size() != 1) { throw new PSQLException(GT.tr("{0} function takes one and only one argument.", "monthname"), PSQLState.SYNTAX_ERROR); } return "to_char(" + parsedArgs.get(0) + ",'Month')"; }
java
public static String sqlmonthname(List<?> parsedArgs) throws SQLException { if (parsedArgs.size() != 1) { throw new PSQLException(GT.tr("{0} function takes one and only one argument.", "monthname"), PSQLState.SYNTAX_ERROR); } return "to_char(" + parsedArgs.get(0) + ",'Month')"; }
[ "public", "static", "String", "sqlmonthname", "(", "List", "<", "?", ">", "parsedArgs", ")", "throws", "SQLException", "{", "if", "(", "parsedArgs", ".", "size", "(", ")", "!=", "1", ")", "{", "throw", "new", "PSQLException", "(", "GT", ".", "tr", "(",...
monthname translation. @param parsedArgs arguments @return sql call @throws SQLException if something wrong happens
[ "monthname", "translation", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions.java#L522-L528
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java
ContinuousDistributions.gammaCdf
protected static double gammaCdf(double x, double a) { if(x<0) { throw new IllegalArgumentException("The x parameter must be positive."); } double GI; if (a>200) { double z=(x-a)/Math.sqrt(a); double y=gaussCdf(z); double b1=2/Math.sqrt(a); double phiz=0.39894228*Math.exp(-z*z/2); double w=y-b1*(z*z-1)*phiz/6; //Edgeworth1 double b2=6/a; int zXor4=((int)z)^4; double u=3*b2*(z*z-3)+b1*b1*(zXor4-10*z*z+15); GI=w-phiz*z*u/72; //Edgeworth2 } else if (x<a+1) { GI=gSer(x,a); } else { GI=gCf(x,a); } return GI; }
java
protected static double gammaCdf(double x, double a) { if(x<0) { throw new IllegalArgumentException("The x parameter must be positive."); } double GI; if (a>200) { double z=(x-a)/Math.sqrt(a); double y=gaussCdf(z); double b1=2/Math.sqrt(a); double phiz=0.39894228*Math.exp(-z*z/2); double w=y-b1*(z*z-1)*phiz/6; //Edgeworth1 double b2=6/a; int zXor4=((int)z)^4; double u=3*b2*(z*z-3)+b1*b1*(zXor4-10*z*z+15); GI=w-phiz*z*u/72; //Edgeworth2 } else if (x<a+1) { GI=gSer(x,a); } else { GI=gCf(x,a); } return GI; }
[ "protected", "static", "double", "gammaCdf", "(", "double", "x", ",", "double", "a", ")", "{", "if", "(", "x", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The x parameter must be positive.\"", ")", ";", "}", "double", "GI", ";", ...
Internal function used by gammaCdf @param x @param a @return
[ "Internal", "function", "used", "by", "gammaCdf" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java#L321-L346
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/returns/PackageUrl.java
PackageUrl.updatePackageUrl
public static MozuUrl updatePackageUrl(String packageId, String responseFields, String returnId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/returns/{returnId}/packages/{packageId}?responseFields={responseFields}"); formatter.formatUrl("packageId", packageId); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("returnId", returnId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updatePackageUrl(String packageId, String responseFields, String returnId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/returns/{returnId}/packages/{packageId}?responseFields={responseFields}"); formatter.formatUrl("packageId", packageId); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("returnId", returnId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updatePackageUrl", "(", "String", "packageId", ",", "String", "responseFields", ",", "String", "returnId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/returns/{returnId}/packages/{packageId}?respon...
Get Resource Url for UpdatePackage @param packageId Unique identifier of the package for which to retrieve the label. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param returnId Unique identifier of the return whose items you want to get. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdatePackage" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/returns/PackageUrl.java#L69-L76
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/ReOpenableHashPartition.java
ReOpenableHashPartition.restorePartitionBuffers
void restorePartitionBuffers(IOManager ioManager, List<MemorySegment> availableMemory) throws IOException { final BulkBlockChannelReader reader = ioManager.createBulkBlockChannelReader(this.initialBuildSideChannel, availableMemory, this.initialPartitionBuffersCount); reader.close(); final List<MemorySegment> partitionBuffersFromDisk = reader.getFullSegments(); this.partitionBuffers = (MemorySegment[]) partitionBuffersFromDisk.toArray(new MemorySegment[partitionBuffersFromDisk.size()]); this.overflowSegments = new MemorySegment[2]; this.numOverflowSegments = 0; this.nextOverflowBucket = 0; this.isRestored = true; }
java
void restorePartitionBuffers(IOManager ioManager, List<MemorySegment> availableMemory) throws IOException { final BulkBlockChannelReader reader = ioManager.createBulkBlockChannelReader(this.initialBuildSideChannel, availableMemory, this.initialPartitionBuffersCount); reader.close(); final List<MemorySegment> partitionBuffersFromDisk = reader.getFullSegments(); this.partitionBuffers = (MemorySegment[]) partitionBuffersFromDisk.toArray(new MemorySegment[partitionBuffersFromDisk.size()]); this.overflowSegments = new MemorySegment[2]; this.numOverflowSegments = 0; this.nextOverflowBucket = 0; this.isRestored = true; }
[ "void", "restorePartitionBuffers", "(", "IOManager", "ioManager", ",", "List", "<", "MemorySegment", ">", "availableMemory", ")", "throws", "IOException", "{", "final", "BulkBlockChannelReader", "reader", "=", "ioManager", ".", "createBulkBlockChannelReader", "(", "this...
This method is called every time a multi-match hash map is opened again for a new probe input. @param ioManager @param availableMemory @throws IOException
[ "This", "method", "is", "called", "every", "time", "a", "multi", "-", "match", "hash", "map", "is", "opened", "again", "for", "a", "new", "probe", "input", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/ReOpenableHashPartition.java#L124-L135
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java
ExpressionUtils.predicateTemplate
@Deprecated public static PredicateTemplate predicateTemplate(Template template, ImmutableList<?> args) { return new PredicateTemplate(template, args); }
java
@Deprecated public static PredicateTemplate predicateTemplate(Template template, ImmutableList<?> args) { return new PredicateTemplate(template, args); }
[ "@", "Deprecated", "public", "static", "PredicateTemplate", "predicateTemplate", "(", "Template", "template", ",", "ImmutableList", "<", "?", ">", "args", ")", "{", "return", "new", "PredicateTemplate", "(", "template", ",", "args", ")", ";", "}" ]
Create a new Template expression @deprecated Use {@link #predicateTemplate(Template, List)} instead. @param template template @param args template parameters @return template expression
[ "Create", "a", "new", "Template", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L189-L192
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/GeometryEngine.java
GeometryEngine.geometryToWkt
public static String geometryToWkt(Geometry geometry, int exportFlags) { OperatorExportToWkt op = (OperatorExportToWkt) factory .getOperator(Operator.Type.ExportToWkt); return op.execute(exportFlags, geometry, null); }
java
public static String geometryToWkt(Geometry geometry, int exportFlags) { OperatorExportToWkt op = (OperatorExportToWkt) factory .getOperator(Operator.Type.ExportToWkt); return op.execute(exportFlags, geometry, null); }
[ "public", "static", "String", "geometryToWkt", "(", "Geometry", "geometry", ",", "int", "exportFlags", ")", "{", "OperatorExportToWkt", "op", "=", "(", "OperatorExportToWkt", ")", "factory", ".", "getOperator", "(", "Operator", ".", "Type", ".", "ExportToWkt", "...
Exports a geometry to a string in WKT format. See OperatorExportToWkt. @param geometry The geometry to export. (null value is not allowed) @param exportFlags Use the {@link WktExportFlags} interface. @return A String containing the exported geometry in WKT format.
[ "Exports", "a", "geometry", "to", "a", "string", "in", "WKT", "format", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/GeometryEngine.java#L271-L275
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/AbstractBuilder.java
AbstractBuilder.isSubTypeOf
@Pure protected boolean isSubTypeOf(EObject context, JvmTypeReference subType, JvmTypeReference superType) { if (isTypeReference(superType) && isTypeReference(subType)) { StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(services, context); LightweightTypeReferenceFactory factory = new LightweightTypeReferenceFactory(owner, false); LightweightTypeReference reference = factory.toLightweightReference(subType); return reference.isSubtypeOf(superType.getType()); } return false; }
java
@Pure protected boolean isSubTypeOf(EObject context, JvmTypeReference subType, JvmTypeReference superType) { if (isTypeReference(superType) && isTypeReference(subType)) { StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(services, context); LightweightTypeReferenceFactory factory = new LightweightTypeReferenceFactory(owner, false); LightweightTypeReference reference = factory.toLightweightReference(subType); return reference.isSubtypeOf(superType.getType()); } return false; }
[ "@", "Pure", "protected", "boolean", "isSubTypeOf", "(", "EObject", "context", ",", "JvmTypeReference", "subType", ",", "JvmTypeReference", "superType", ")", "{", "if", "(", "isTypeReference", "(", "superType", ")", "&&", "isTypeReference", "(", "subType", ")", ...
Replies if the first parameter is a subtype of the second parameter. @param context the context. @param subType the subtype to test. @param superType the expected super type. @return the type reference.
[ "Replies", "if", "the", "first", "parameter", "is", "a", "subtype", "of", "the", "second", "parameter", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/AbstractBuilder.java#L226-L235
actorapp/droidkit-actors
actors/src/main/java/com/droidkit/actors/ActorSystem.java
ActorSystem.addDispatcher
public void addDispatcher(String dispatcherId, AbsActorDispatcher dispatcher) { synchronized (dispatchers) { if (dispatchers.containsKey(dispatcherId)) { return; } dispatchers.put(dispatcherId, dispatcher); } }
java
public void addDispatcher(String dispatcherId, AbsActorDispatcher dispatcher) { synchronized (dispatchers) { if (dispatchers.containsKey(dispatcherId)) { return; } dispatchers.put(dispatcherId, dispatcher); } }
[ "public", "void", "addDispatcher", "(", "String", "dispatcherId", ",", "AbsActorDispatcher", "dispatcher", ")", "{", "synchronized", "(", "dispatchers", ")", "{", "if", "(", "dispatchers", ".", "containsKey", "(", "dispatcherId", ")", ")", "{", "return", ";", ...
Registering custom dispatcher @param dispatcherId dispatcher id @param dispatcher dispatcher object
[ "Registering", "custom", "dispatcher" ]
train
https://github.com/actorapp/droidkit-actors/blob/fdb72fcfdd1c5e54a970f203a33a71fa54344217/actors/src/main/java/com/droidkit/actors/ActorSystem.java#L83-L90
helun/Ektorp
org.ektorp/src/main/java/org/ektorp/util/Base64.java
Base64.encodeBytes
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "DM_DEFAULT_ENCODING") public static String encodeBytes( byte[] source, int off, int len, int options ) throws java.io.IOException { byte[] encoded = encodeBytesToBytes( source, off, len, options ); // Return value according to relevant encoding. try { return new String( encoded, PREFERRED_ENCODING ); } // end try catch (java.io.UnsupportedEncodingException uue) { return new String( encoded ); } // end catch }
java
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "DM_DEFAULT_ENCODING") public static String encodeBytes( byte[] source, int off, int len, int options ) throws java.io.IOException { byte[] encoded = encodeBytesToBytes( source, off, len, options ); // Return value according to relevant encoding. try { return new String( encoded, PREFERRED_ENCODING ); } // end try catch (java.io.UnsupportedEncodingException uue) { return new String( encoded ); } // end catch }
[ "@", "edu", ".", "umd", ".", "cs", ".", "findbugs", ".", "annotations", ".", "SuppressWarnings", "(", "value", "=", "\"DM_DEFAULT_ENCODING\"", ")", "public", "static", "String", "encodeBytes", "(", "byte", "[", "]", "source", ",", "int", "off", ",", "int",...
Encodes a byte array into Base64 notation. <p> Example options:<pre> GZIP: gzip-compresses object before encoding it. DO_BREAK_LINES: break lines at 76 characters <i>Note: Technically, this makes your encoding non-compliant.</i> </pre> <p> Example: <code>encodeBytes( myData, Base64.GZIP )</code> or <p> Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DO_BREAK_LINES )</code> <p>As of v 2.3, if there is an error with the GZIP stream, the method will throw an java.io.IOException. <b>This is new to v2.3!</b> In earlier versions, it just returned a null value, but in retrospect that's a pretty poor way to handle it.</p> @param source The data to convert @param off Offset in array where conversion should begin @param len Length of data to convert @param options Specified options @return The Base64-encoded data as a String @see Base64#GZIP @see Base64#DO_BREAK_LINES @throws java.io.IOException if there is an error @throws NullPointerException if source array is null @throws IllegalArgumentException if source array, offset, or length are invalid @since 2.0
[ "Encodes", "a", "byte", "array", "into", "Base64", "notation", ".", "<p", ">", "Example", "options", ":", "<pre", ">", "GZIP", ":", "gzip", "-", "compresses", "object", "before", "encoding", "it", ".", "DO_BREAK_LINES", ":", "break", "lines", "at", "76", ...
train
https://github.com/helun/Ektorp/blob/b822c0d656aefb90a5e0cb5ec2de3daa969e3eaa/org.ektorp/src/main/java/org/ektorp/util/Base64.java#L670-L682
codelibs/jcifs
src/main/java/jcifs/smb1/util/Hexdump.java
Hexdump.toHexChars
public static void toHexChars( int val, char dst[], int dstIndex, int size ) { while( size > 0 ) { int i = dstIndex + size - 1; if( i < dst.length ) { dst[i] = HEX_DIGITS[val & 0x000F]; } if( val != 0 ) { val >>>= 4; } size--; } }
java
public static void toHexChars( int val, char dst[], int dstIndex, int size ) { while( size > 0 ) { int i = dstIndex + size - 1; if( i < dst.length ) { dst[i] = HEX_DIGITS[val & 0x000F]; } if( val != 0 ) { val >>>= 4; } size--; } }
[ "public", "static", "void", "toHexChars", "(", "int", "val", ",", "char", "dst", "[", "]", ",", "int", "dstIndex", ",", "int", "size", ")", "{", "while", "(", "size", ">", "0", ")", "{", "int", "i", "=", "dstIndex", "+", "size", "-", "1", ";", ...
This is the same as {@link jcifs.smb1.util.Hexdump#toHexString(int val, int size)} but provides a more practical form when trying to avoid {@link java.lang.String} concatenation and {@link java.lang.StringBuffer}.
[ "This", "is", "the", "same", "as", "{" ]
train
https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/util/Hexdump.java#L138-L149
primefaces/primefaces
src/main/java/org/primefaces/util/ComponentUtils.java
ComponentUtils.getConverter
public static Converter getConverter(FacesContext context, UIComponent component) { if (!(component instanceof ValueHolder)) { return null; } Converter converter = ((ValueHolder) component).getConverter(); if (converter != null) { return converter; } ValueExpression valueExpression = component.getValueExpression("value"); if (valueExpression == null) { return null; } Class<?> converterType = valueExpression.getType(context.getELContext()); if (converterType == null || converterType == Object.class) { // no conversion is needed return null; } if (converterType == String.class && !PrimeApplicationContext.getCurrentInstance(context).getConfig().isStringConverterAvailable()) { return null; } return context.getApplication().createConverter(converterType); }
java
public static Converter getConverter(FacesContext context, UIComponent component) { if (!(component instanceof ValueHolder)) { return null; } Converter converter = ((ValueHolder) component).getConverter(); if (converter != null) { return converter; } ValueExpression valueExpression = component.getValueExpression("value"); if (valueExpression == null) { return null; } Class<?> converterType = valueExpression.getType(context.getELContext()); if (converterType == null || converterType == Object.class) { // no conversion is needed return null; } if (converterType == String.class && !PrimeApplicationContext.getCurrentInstance(context).getConfig().isStringConverterAvailable()) { return null; } return context.getApplication().createConverter(converterType); }
[ "public", "static", "Converter", "getConverter", "(", "FacesContext", "context", ",", "UIComponent", "component", ")", "{", "if", "(", "!", "(", "component", "instanceof", "ValueHolder", ")", ")", "{", "return", "null", ";", "}", "Converter", "converter", "=",...
Finds appropriate converter for a given value holder @param context FacesContext instance @param component ValueHolder instance to look converter for @return Converter
[ "Finds", "appropriate", "converter", "for", "a", "given", "value", "holder" ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/util/ComponentUtils.java#L139-L166
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java
EqualityInference.rewriteExpression
public Expression rewriteExpression(Expression expression, Predicate<Symbol> symbolScope) { checkArgument(isDeterministic(expression), "Only deterministic expressions may be considered for rewrite"); return rewriteExpression(expression, symbolScope, true); }
java
public Expression rewriteExpression(Expression expression, Predicate<Symbol> symbolScope) { checkArgument(isDeterministic(expression), "Only deterministic expressions may be considered for rewrite"); return rewriteExpression(expression, symbolScope, true); }
[ "public", "Expression", "rewriteExpression", "(", "Expression", "expression", ",", "Predicate", "<", "Symbol", ">", "symbolScope", ")", "{", "checkArgument", "(", "isDeterministic", "(", "expression", ")", ",", "\"Only deterministic expressions may be considered for rewrite...
Attempts to rewrite an Expression in terms of the symbols allowed by the symbol scope given the known equalities. Returns null if unsuccessful. This method checks if rewritten expression is non-deterministic.
[ "Attempts", "to", "rewrite", "an", "Expression", "in", "terms", "of", "the", "symbols", "allowed", "by", "the", "symbol", "scope", "given", "the", "known", "equalities", ".", "Returns", "null", "if", "unsuccessful", ".", "This", "method", "checks", "if", "re...
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java#L99-L103
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsResourceTypeConfig.java
CmsResourceTypeConfig.getAddMenuVisibility
public AddMenuVisibility getAddMenuVisibility(CmsUUID elementViewId, AddMenuType menuType) { if (isAddDisabled()) { return AddMenuVisibility.disabled; } if (elementViewId.equals(getElementView())) { if (isCreateDisabled() && (menuType == AddMenuType.ade)) { return AddMenuVisibility.createDisabled; } return AddMenuVisibility.visible; } if (isShowInDefaultView() && elementViewId.equals(CmsElementView.DEFAULT_ELEMENT_VIEW.getId())) { return AddMenuVisibility.fromOtherView; } return AddMenuVisibility.disabled; }
java
public AddMenuVisibility getAddMenuVisibility(CmsUUID elementViewId, AddMenuType menuType) { if (isAddDisabled()) { return AddMenuVisibility.disabled; } if (elementViewId.equals(getElementView())) { if (isCreateDisabled() && (menuType == AddMenuType.ade)) { return AddMenuVisibility.createDisabled; } return AddMenuVisibility.visible; } if (isShowInDefaultView() && elementViewId.equals(CmsElementView.DEFAULT_ELEMENT_VIEW.getId())) { return AddMenuVisibility.fromOtherView; } return AddMenuVisibility.disabled; }
[ "public", "AddMenuVisibility", "getAddMenuVisibility", "(", "CmsUUID", "elementViewId", ",", "AddMenuType", "menuType", ")", "{", "if", "(", "isAddDisabled", "(", ")", ")", "{", "return", "AddMenuVisibility", ".", "disabled", ";", "}", "if", "(", "elementViewId", ...
Gets the visibility status in the 'add' menu for this type and the given element view.<p> @param elementViewId the id of the view for which to compute the visibility status @param menuType the menu type for which we want to evaluate the visibility @return the visibility status
[ "Gets", "the", "visibility", "status", "in", "the", "add", "menu", "for", "this", "type", "and", "the", "given", "element", "view", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsResourceTypeConfig.java#L417-L435
ddf-project/DDF
core/src/main/java/io/ddf/util/ConfigHandler.java
ConfigHandler.locateConfigFileName
private String locateConfigFileName(String configDir, String configFileName) throws IOException { String curDir = new File(".").getCanonicalPath(); String path = null; // Go for at most 10 levels up for (int i = 0; i < 10; i++) { path = String.format("%s/%s", curDir, configFileName); if (Utils.localFileExists(path)) break; String dir = String.format("%s/%s", curDir, configDir); if (Utils.dirExists(dir)) { path = String.format("%s/%s", dir, configFileName); if (Utils.localFileExists(path)) break; } curDir = String.format("%s/..", curDir); } mSource = path; if (Strings.isNullOrEmpty(path)) throw new IOException(String.format("Cannot locate DDF configuration file %s", configFileName)); mLog.debug(String.format("Using config file found at %s\n", path)); return path; }
java
private String locateConfigFileName(String configDir, String configFileName) throws IOException { String curDir = new File(".").getCanonicalPath(); String path = null; // Go for at most 10 levels up for (int i = 0; i < 10; i++) { path = String.format("%s/%s", curDir, configFileName); if (Utils.localFileExists(path)) break; String dir = String.format("%s/%s", curDir, configDir); if (Utils.dirExists(dir)) { path = String.format("%s/%s", dir, configFileName); if (Utils.localFileExists(path)) break; } curDir = String.format("%s/..", curDir); } mSource = path; if (Strings.isNullOrEmpty(path)) throw new IOException(String.format("Cannot locate DDF configuration file %s", configFileName)); mLog.debug(String.format("Using config file found at %s\n", path)); return path; }
[ "private", "String", "locateConfigFileName", "(", "String", "configDir", ",", "String", "configFileName", ")", "throws", "IOException", "{", "String", "curDir", "=", "new", "File", "(", "\".\"", ")", ".", "getCanonicalPath", "(", ")", ";", "String", "path", "=...
Search in current dir and working up, looking for the config file @return @throws IOException
[ "Search", "in", "current", "dir", "and", "working", "up", "looking", "for", "the", "config", "file" ]
train
https://github.com/ddf-project/DDF/blob/e4e68315dcec1ed8b287bf1ee73baa88e7e41eba/core/src/main/java/io/ddf/util/ConfigHandler.java#L201-L227
RestComm/sipunit
src/main/java/org/cafesip/sipunit/SipAssert.java
SipAssert.assertLastOperationSuccess
public static void assertLastOperationSuccess(String msg, SipActionObject op) { assertNotNull("Null assert object passed in", op); assertTrue(msg, op.getErrorMessage().length() == 0); }
java
public static void assertLastOperationSuccess(String msg, SipActionObject op) { assertNotNull("Null assert object passed in", op); assertTrue(msg, op.getErrorMessage().length() == 0); }
[ "public", "static", "void", "assertLastOperationSuccess", "(", "String", "msg", ",", "SipActionObject", "op", ")", "{", "assertNotNull", "(", "\"Null assert object passed in\"", ",", "op", ")", ";", "assertTrue", "(", "msg", ",", "op", ".", "getErrorMessage", "(",...
Asserts that the last SIP operation performed by the given object was successful. Assertion failure output includes the given message text. @param msg message text to output if the assertion fails. @param op the SipUnit object that executed an operation.
[ "Asserts", "that", "the", "last", "SIP", "operation", "performed", "by", "the", "given", "object", "was", "successful", ".", "Assertion", "failure", "output", "includes", "the", "given", "message", "text", "." ]
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipAssert.java#L77-L80
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java
EnvironmentsInner.getAsync
public Observable<EnvironmentInner> getAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, String expand) { return getWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, expand).map(new Func1<ServiceResponse<EnvironmentInner>, EnvironmentInner>() { @Override public EnvironmentInner call(ServiceResponse<EnvironmentInner> response) { return response.body(); } }); }
java
public Observable<EnvironmentInner> getAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, String expand) { return getWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, expand).map(new Func1<ServiceResponse<EnvironmentInner>, EnvironmentInner>() { @Override public EnvironmentInner call(ServiceResponse<EnvironmentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EnvironmentInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ",", "String", "environmentName", ",", "String", "expand", ")", ...
Get environment. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentName The name of the environment. @param expand Specify the $expand query. Example: 'properties($expand=networkInterface)' @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EnvironmentInner object
[ "Get", "environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L569-L576
bazaarvoice/emodb
common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java
EmoUriComponent.decodeOctets
private static int decodeOctets(int i, ByteBuffer bb, StringBuilder sb) { // If there is only one octet and is an ASCII character if (bb.limit() == 1 && (bb.get(0) & 0xFF) < 0x80) { // Octet can be appended directly sb.append((char) bb.get(0)); return i + 2; } else { // CharBuffer cb = UTF_8_CHARSET.decode(bb); sb.append(cb.toString()); return i + bb.limit() * 3 - 1; } }
java
private static int decodeOctets(int i, ByteBuffer bb, StringBuilder sb) { // If there is only one octet and is an ASCII character if (bb.limit() == 1 && (bb.get(0) & 0xFF) < 0x80) { // Octet can be appended directly sb.append((char) bb.get(0)); return i + 2; } else { // CharBuffer cb = UTF_8_CHARSET.decode(bb); sb.append(cb.toString()); return i + bb.limit() * 3 - 1; } }
[ "private", "static", "int", "decodeOctets", "(", "int", "i", ",", "ByteBuffer", "bb", ",", "StringBuilder", "sb", ")", "{", "// If there is only one octet and is an ASCII character", "if", "(", "bb", ".", "limit", "(", ")", "==", "1", "&&", "(", "bb", ".", "...
Decodes octets to characters using the UTF-8 decoding and appends the characters to a StringBuffer. @return the index to the next unchecked character in the string to decode
[ "Decodes", "octets", "to", "characters", "using", "the", "UTF", "-", "8", "decoding", "and", "appends", "the", "characters", "to", "a", "StringBuffer", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java#L822-L834