repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
SG-O/miIO
src/main/java/de/sg_o/app/miio/vacuum/Vacuum.java
Vacuum.setCarpetMode
public boolean setCarpetMode(boolean enabled, int high, int low, int integral, int stallTime) throws CommandExecutionException { """ Change the carped cleaning settings. @param enabled Weather the carped cleanup mode should be enabled. @param high The high parameter of the carped cleanup. @param low The low parameter of the carped cleanup. @param integral The integral parameter of the carped cleanup. @param stallTime The stall time parameter of the carped cleanup. @return True if the command has been received successfully. @throws CommandExecutionException When there has been a error during the communication or the response was invalid. """ JSONObject payload = new JSONObject(); payload.put("enable", enabled ? 1:0); payload.put("current_high", high); payload.put("current_low", low); payload.put("current_integral", integral); payload.put("stall_time", stallTime); JSONArray send = new JSONArray(); send.put(payload); return sendOk("set_carpet_mode", send); }
java
public boolean setCarpetMode(boolean enabled, int high, int low, int integral, int stallTime) throws CommandExecutionException { JSONObject payload = new JSONObject(); payload.put("enable", enabled ? 1:0); payload.put("current_high", high); payload.put("current_low", low); payload.put("current_integral", integral); payload.put("stall_time", stallTime); JSONArray send = new JSONArray(); send.put(payload); return sendOk("set_carpet_mode", send); }
[ "public", "boolean", "setCarpetMode", "(", "boolean", "enabled", ",", "int", "high", ",", "int", "low", ",", "int", "integral", ",", "int", "stallTime", ")", "throws", "CommandExecutionException", "{", "JSONObject", "payload", "=", "new", "JSONObject", "(", ")...
Change the carped cleaning settings. @param enabled Weather the carped cleanup mode should be enabled. @param high The high parameter of the carped cleanup. @param low The low parameter of the carped cleanup. @param integral The integral parameter of the carped cleanup. @param stallTime The stall time parameter of the carped cleanup. @return True if the command has been received successfully. @throws CommandExecutionException When there has been a error during the communication or the response was invalid.
[ "Change", "the", "carped", "cleaning", "settings", "." ]
train
https://github.com/SG-O/miIO/blob/f352dbd2a699d2cdb1b412ca5e6cbb0c38ca779b/src/main/java/de/sg_o/app/miio/vacuum/Vacuum.java#L560-L570
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_http_frontend_POST
public OvhFrontendHttp serviceName_http_frontend_POST(String serviceName, String[] allowedSource, String[] dedicatedIpfo, Long defaultFarmId, Long defaultSslId, Boolean disabled, String displayName, Boolean hsts, String[] httpHeader, String port, String redirectLocation, Boolean ssl, String zone) throws IOException { """ Add a new http frontend on your IP Load Balancing REST: POST /ipLoadbalancing/{serviceName}/http/frontend @param dedicatedIpfo [required] Only attach frontend on these ip. No restriction if null @param redirectLocation [required] HTTP redirection (Ex : http://www.ovh.com) @param port [required] Port(s) attached to your frontend. Supports single port (numerical value), range (2 dash-delimited increasing ports) and comma-separated list of 'single port' and/or 'range'. Each port must be in the [1;49151] range. @param disabled [required] Disable your frontend. Default: 'false' @param defaultFarmId [required] Default HTTP Farm of your frontend @param displayName [required] Human readable name for your frontend, this field is for you @param httpHeader [required] Add header to your frontend. Useful variables admitted : %ci <=> client_ip, %cp <=> client_port @param hsts [required] HTTP Strict Transport Security. Default: 'false' @param allowedSource [required] Restrict IP Load Balancing access to these ip block. No restriction if null @param defaultSslId [required] Default ssl served to your customer @param zone [required] Zone of your frontend. Use "all" for all owned zone. @param ssl [required] SSL deciphering. Default: 'false' @param serviceName [required] The internal name of your IP load balancing """ String qPath = "/ipLoadbalancing/{serviceName}/http/frontend"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "allowedSource", allowedSource); addBody(o, "dedicatedIpfo", dedicatedIpfo); addBody(o, "defaultFarmId", defaultFarmId); addBody(o, "defaultSslId", defaultSslId); addBody(o, "disabled", disabled); addBody(o, "displayName", displayName); addBody(o, "hsts", hsts); addBody(o, "httpHeader", httpHeader); addBody(o, "port", port); addBody(o, "redirectLocation", redirectLocation); addBody(o, "ssl", ssl); addBody(o, "zone", zone); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhFrontendHttp.class); }
java
public OvhFrontendHttp serviceName_http_frontend_POST(String serviceName, String[] allowedSource, String[] dedicatedIpfo, Long defaultFarmId, Long defaultSslId, Boolean disabled, String displayName, Boolean hsts, String[] httpHeader, String port, String redirectLocation, Boolean ssl, String zone) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/http/frontend"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "allowedSource", allowedSource); addBody(o, "dedicatedIpfo", dedicatedIpfo); addBody(o, "defaultFarmId", defaultFarmId); addBody(o, "defaultSslId", defaultSslId); addBody(o, "disabled", disabled); addBody(o, "displayName", displayName); addBody(o, "hsts", hsts); addBody(o, "httpHeader", httpHeader); addBody(o, "port", port); addBody(o, "redirectLocation", redirectLocation); addBody(o, "ssl", ssl); addBody(o, "zone", zone); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhFrontendHttp.class); }
[ "public", "OvhFrontendHttp", "serviceName_http_frontend_POST", "(", "String", "serviceName", ",", "String", "[", "]", "allowedSource", ",", "String", "[", "]", "dedicatedIpfo", ",", "Long", "defaultFarmId", ",", "Long", "defaultSslId", ",", "Boolean", "disabled", ",...
Add a new http frontend on your IP Load Balancing REST: POST /ipLoadbalancing/{serviceName}/http/frontend @param dedicatedIpfo [required] Only attach frontend on these ip. No restriction if null @param redirectLocation [required] HTTP redirection (Ex : http://www.ovh.com) @param port [required] Port(s) attached to your frontend. Supports single port (numerical value), range (2 dash-delimited increasing ports) and comma-separated list of 'single port' and/or 'range'. Each port must be in the [1;49151] range. @param disabled [required] Disable your frontend. Default: 'false' @param defaultFarmId [required] Default HTTP Farm of your frontend @param displayName [required] Human readable name for your frontend, this field is for you @param httpHeader [required] Add header to your frontend. Useful variables admitted : %ci <=> client_ip, %cp <=> client_port @param hsts [required] HTTP Strict Transport Security. Default: 'false' @param allowedSource [required] Restrict IP Load Balancing access to these ip block. No restriction if null @param defaultSslId [required] Default ssl served to your customer @param zone [required] Zone of your frontend. Use "all" for all owned zone. @param ssl [required] SSL deciphering. Default: 'false' @param serviceName [required] The internal name of your IP load balancing
[ "Add", "a", "new", "http", "frontend", "on", "your", "IP", "Load", "Balancing" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L296-L314
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/MethodFinder.java
MethodFinder.findMatchingMethod
private static Method findMatchingMethod(Method originalMethod, String methodName, Type classToSearch, ResolutionContext ctx, Class<?> originalClass) { """ Recursively search the class hierarchy of {@code clazzToCheck} to find a method named {@code methodName} with the same signature as {@code originalMethod} @param originalMethod the original method @param methodName the name of the method to search for @param classToSearch the class to search @param ctx the resolution context @param originalClass the class which declared {@code originalMethod} @return a method named {@code methodName}, in the class hierarchy of {@code clazzToCheck}, which matches the signature of {@code originalMethod}, or {@code null} if one cannot be found """ // Check self Method result = findMethodOnClass(originalMethod, methodName, classToSearch, ctx, originalClass); // Check interfaces if (result == null) { for (Type iface : getClass(classToSearch).getGenericInterfaces()) { ctx.push(iface); result = findMatchingMethod(originalMethod, methodName, iface, ctx, originalClass); ctx.pop(); if (result != null) { break; } } } // Check superclass if (result == null) { Type superclass = getClass(classToSearch).getGenericSuperclass(); if (superclass != null) { ctx.push(superclass); result = findMatchingMethod(originalMethod, methodName, superclass, ctx, originalClass); ctx.pop(); } } return result; }
java
private static Method findMatchingMethod(Method originalMethod, String methodName, Type classToSearch, ResolutionContext ctx, Class<?> originalClass) { // Check self Method result = findMethodOnClass(originalMethod, methodName, classToSearch, ctx, originalClass); // Check interfaces if (result == null) { for (Type iface : getClass(classToSearch).getGenericInterfaces()) { ctx.push(iface); result = findMatchingMethod(originalMethod, methodName, iface, ctx, originalClass); ctx.pop(); if (result != null) { break; } } } // Check superclass if (result == null) { Type superclass = getClass(classToSearch).getGenericSuperclass(); if (superclass != null) { ctx.push(superclass); result = findMatchingMethod(originalMethod, methodName, superclass, ctx, originalClass); ctx.pop(); } } return result; }
[ "private", "static", "Method", "findMatchingMethod", "(", "Method", "originalMethod", ",", "String", "methodName", ",", "Type", "classToSearch", ",", "ResolutionContext", "ctx", ",", "Class", "<", "?", ">", "originalClass", ")", "{", "// Check self", "Method", "re...
Recursively search the class hierarchy of {@code clazzToCheck} to find a method named {@code methodName} with the same signature as {@code originalMethod} @param originalMethod the original method @param methodName the name of the method to search for @param classToSearch the class to search @param ctx the resolution context @param originalClass the class which declared {@code originalMethod} @return a method named {@code methodName}, in the class hierarchy of {@code clazzToCheck}, which matches the signature of {@code originalMethod}, or {@code null} if one cannot be found
[ "Recursively", "search", "the", "class", "hierarchy", "of", "{", "@code", "clazzToCheck", "}", "to", "find", "a", "method", "named", "{", "@code", "methodName", "}", "with", "the", "same", "signature", "as", "{", "@code", "originalMethod", "}" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/MethodFinder.java#L62-L89
OpenBEL/openbel-framework
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java
PhaseThreeApplication.stage5Statement
private void stage5Statement(final ProtoNetwork network, int pct) { """ Stage five statement equivalencing. @param network the {@link ProtoNetwork network} to equivalence @param pct the parameter equivalencing count to control output """ if (pct > 0) { stageOutput("Equivalencing statements"); int sct = p2.stage3EquivalenceStatements(network); stageOutput("(" + sct + " equivalences)"); } else { stageOutput("Skipping statement equivalencing"); } }
java
private void stage5Statement(final ProtoNetwork network, int pct) { if (pct > 0) { stageOutput("Equivalencing statements"); int sct = p2.stage3EquivalenceStatements(network); stageOutput("(" + sct + " equivalences)"); } else { stageOutput("Skipping statement equivalencing"); } }
[ "private", "void", "stage5Statement", "(", "final", "ProtoNetwork", "network", ",", "int", "pct", ")", "{", "if", "(", "pct", ">", "0", ")", "{", "stageOutput", "(", "\"Equivalencing statements\"", ")", ";", "int", "sct", "=", "p2", ".", "stage3EquivalenceSt...
Stage five statement equivalencing. @param network the {@link ProtoNetwork network} to equivalence @param pct the parameter equivalencing count to control output
[ "Stage", "five", "statement", "equivalencing", "." ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java#L1263-L1271
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/DisplayUtil.java
DisplayUtil.dpToPixels
public static long dpToPixels(@NonNull final Context context, final long dp) { """ Converts an {@link Integer} value, which is measured in dp, into a value, which is measured in pixels. @param context The context, which should be used, as an instance of the class {@link Context}. The context may not be null @param dp The dp value, which should be converted, as an {@link Integer} value @return The calculated pixel value as an {@link Integer} value. The value might be rounded """ Condition.INSTANCE.ensureNotNull(context, "The context may not be null"); DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); return Math.round(dp * (displayMetrics.densityDpi / PIXEL_DP_RATIO)); }
java
public static long dpToPixels(@NonNull final Context context, final long dp) { Condition.INSTANCE.ensureNotNull(context, "The context may not be null"); DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); return Math.round(dp * (displayMetrics.densityDpi / PIXEL_DP_RATIO)); }
[ "public", "static", "long", "dpToPixels", "(", "@", "NonNull", "final", "Context", "context", ",", "final", "long", "dp", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "context", ",", "\"The context may not be null\"", ")", ";", "DisplayMetr...
Converts an {@link Integer} value, which is measured in dp, into a value, which is measured in pixels. @param context The context, which should be used, as an instance of the class {@link Context}. The context may not be null @param dp The dp value, which should be converted, as an {@link Integer} value @return The calculated pixel value as an {@link Integer} value. The value might be rounded
[ "Converts", "an", "{", "@link", "Integer", "}", "value", "which", "is", "measured", "in", "dp", "into", "a", "value", "which", "is", "measured", "in", "pixels", "." ]
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/DisplayUtil.java#L232-L236
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java
SVGPlot.elementCoordinatesFromEvent
public SVGPoint elementCoordinatesFromEvent(Element tag, Event evt) { """ Convert screen coordinates to element coordinates. @param tag Element to convert the coordinates for @param evt Event object @return Coordinates """ return SVGUtil.elementCoordinatesFromEvent(document, tag, evt); }
java
public SVGPoint elementCoordinatesFromEvent(Element tag, Event evt) { return SVGUtil.elementCoordinatesFromEvent(document, tag, evt); }
[ "public", "SVGPoint", "elementCoordinatesFromEvent", "(", "Element", "tag", ",", "Event", "evt", ")", "{", "return", "SVGUtil", ".", "elementCoordinatesFromEvent", "(", "document", ",", "tag", ",", "evt", ")", ";", "}" ]
Convert screen coordinates to element coordinates. @param tag Element to convert the coordinates for @param evt Event object @return Coordinates
[ "Convert", "screen", "coordinates", "to", "element", "coordinates", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java#L302-L304
apache/incubator-heron
heron/api/src/java/org/apache/heron/api/HeronSubmitter.java
HeronSubmitter.submitTopology
public static void submitTopology(String name, Config heronConfig, HeronTopology topology) throws AlreadyAliveException, InvalidTopologyException { """ Submits a topology to run on the cluster. A topology runs forever or until explicitly killed. @param name the name of the topology. @param heronConfig the topology-specific configuration. See {@link Config}. @param topology the processing to execute. @throws AlreadyAliveException if a topology with this name is already running @throws InvalidTopologyException if an invalid topology was submitted """ Map<String, String> heronCmdOptions = getHeronCmdOptions(); // We would read the topology initial state from arguments from heron-cli TopologyAPI.TopologyState initialState; if (heronCmdOptions.get(CMD_TOPOLOGY_INITIAL_STATE) != null) { initialState = TopologyAPI.TopologyState.valueOf( heronCmdOptions.get(CMD_TOPOLOGY_INITIAL_STATE)); } else { initialState = TopologyAPI.TopologyState.RUNNING; } LOG.log(Level.FINE, "To deploy a topology in initial state {0}", initialState); // add role and environment if present final String role = heronCmdOptions.get(CMD_TOPOLOGY_ROLE); if (role != null) { heronConfig.putIfAbsent(Config.TOPOLOGY_TEAM_NAME, role); } final String environment = heronCmdOptions.get(CMD_TOPOLOGY_ENVIRONMENT); if (environment != null) { heronConfig.putIfAbsent(Config.TOPOLOGY_TEAM_ENVIRONMENT, environment); } TopologyAPI.Topology fTopology = topology.setConfig(heronConfig). setName(name). setState(initialState). getTopology(); TopologyUtils.validateTopology(fTopology); assert fTopology.isInitialized(); submitTopologyToFile(fTopology, heronCmdOptions); }
java
public static void submitTopology(String name, Config heronConfig, HeronTopology topology) throws AlreadyAliveException, InvalidTopologyException { Map<String, String> heronCmdOptions = getHeronCmdOptions(); // We would read the topology initial state from arguments from heron-cli TopologyAPI.TopologyState initialState; if (heronCmdOptions.get(CMD_TOPOLOGY_INITIAL_STATE) != null) { initialState = TopologyAPI.TopologyState.valueOf( heronCmdOptions.get(CMD_TOPOLOGY_INITIAL_STATE)); } else { initialState = TopologyAPI.TopologyState.RUNNING; } LOG.log(Level.FINE, "To deploy a topology in initial state {0}", initialState); // add role and environment if present final String role = heronCmdOptions.get(CMD_TOPOLOGY_ROLE); if (role != null) { heronConfig.putIfAbsent(Config.TOPOLOGY_TEAM_NAME, role); } final String environment = heronCmdOptions.get(CMD_TOPOLOGY_ENVIRONMENT); if (environment != null) { heronConfig.putIfAbsent(Config.TOPOLOGY_TEAM_ENVIRONMENT, environment); } TopologyAPI.Topology fTopology = topology.setConfig(heronConfig). setName(name). setState(initialState). getTopology(); TopologyUtils.validateTopology(fTopology); assert fTopology.isInitialized(); submitTopologyToFile(fTopology, heronCmdOptions); }
[ "public", "static", "void", "submitTopology", "(", "String", "name", ",", "Config", "heronConfig", ",", "HeronTopology", "topology", ")", "throws", "AlreadyAliveException", ",", "InvalidTopologyException", "{", "Map", "<", "String", ",", "String", ">", "heronCmdOpti...
Submits a topology to run on the cluster. A topology runs forever or until explicitly killed. @param name the name of the topology. @param heronConfig the topology-specific configuration. See {@link Config}. @param topology the processing to execute. @throws AlreadyAliveException if a topology with this name is already running @throws InvalidTopologyException if an invalid topology was submitted
[ "Submits", "a", "topology", "to", "run", "on", "the", "cluster", ".", "A", "topology", "runs", "forever", "or", "until", "explicitly", "killed", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/HeronSubmitter.java#L66-L102
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/ExpressionResolverImpl.java
ExpressionResolverImpl.resolveStandardExpression
private static String resolveStandardExpression(final ModelNode unresolved) throws OperationFailedException { """ Perform a standard {@link org.jboss.dmr.ModelNode#resolve()} on the given {@code unresolved} node. @param unresolved the unresolved node, which should be of type {@link org.jboss.dmr.ModelType#EXPRESSION} @return a node of type {@link ModelType#STRING} @throws OperationFailedException if {@code ignoreFailures} is {@code false} and the expression cannot be resolved """ try { return unresolved.resolve().asString(); } catch (SecurityException e) { // A security exception should propagate no matter what the value of ignoreUnresolvable is. The first call to // this method for any expression will have ignoreUnresolvable set to 'false' which means a basic test of // ability to read system properties will have already passed. So a failure with ignoreUnresolvable set to // true means a specific property caused the failure, and that should not be ignored throw new OperationFailedException(ControllerLogger.ROOT_LOGGER.noPermissionToResolveExpression(unresolved, e)); } catch (IllegalStateException e) { return unresolved.asString(); } }
java
private static String resolveStandardExpression(final ModelNode unresolved) throws OperationFailedException { try { return unresolved.resolve().asString(); } catch (SecurityException e) { // A security exception should propagate no matter what the value of ignoreUnresolvable is. The first call to // this method for any expression will have ignoreUnresolvable set to 'false' which means a basic test of // ability to read system properties will have already passed. So a failure with ignoreUnresolvable set to // true means a specific property caused the failure, and that should not be ignored throw new OperationFailedException(ControllerLogger.ROOT_LOGGER.noPermissionToResolveExpression(unresolved, e)); } catch (IllegalStateException e) { return unresolved.asString(); } }
[ "private", "static", "String", "resolveStandardExpression", "(", "final", "ModelNode", "unresolved", ")", "throws", "OperationFailedException", "{", "try", "{", "return", "unresolved", ".", "resolve", "(", ")", ".", "asString", "(", ")", ";", "}", "catch", "(", ...
Perform a standard {@link org.jboss.dmr.ModelNode#resolve()} on the given {@code unresolved} node. @param unresolved the unresolved node, which should be of type {@link org.jboss.dmr.ModelType#EXPRESSION} @return a node of type {@link ModelType#STRING} @throws OperationFailedException if {@code ignoreFailures} is {@code false} and the expression cannot be resolved
[ "Perform", "a", "standard", "{", "@link", "org", ".", "jboss", ".", "dmr", ".", "ModelNode#resolve", "()", "}", "on", "the", "given", "{", "@code", "unresolved", "}", "node", ".", "@param", "unresolved", "the", "unresolved", "node", "which", "should", "be"...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ExpressionResolverImpl.java#L365-L378
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java
ObjectInputStream.readContent
private Object readContent(byte tc) throws ClassNotFoundException, IOException { """ Reads the content of the receiver based on the previously read token {@code tc}. @param tc The token code for the next item in the stream @return the object read from the stream @throws IOException If an IO exception happened when reading the class descriptor. @throws ClassNotFoundException If the class corresponding to the object being read could not be found. """ switch (tc) { case TC_BLOCKDATA: return readBlockData(); case TC_BLOCKDATALONG: return readBlockDataLong(); case TC_CLASS: return readNewClass(false); case TC_CLASSDESC: return readNewClassDesc(false); case TC_ARRAY: return readNewArray(false); case TC_OBJECT: return readNewObject(false); case TC_STRING: return readNewString(false); case TC_LONGSTRING: return readNewLongString(false); case TC_REFERENCE: return readCyclicReference(); case TC_NULL: return null; case TC_EXCEPTION: Exception exc = readException(); throw new WriteAbortedException("Read an exception", exc); case TC_RESET: resetState(); return null; default: throw corruptStream(tc); } }
java
private Object readContent(byte tc) throws ClassNotFoundException, IOException { switch (tc) { case TC_BLOCKDATA: return readBlockData(); case TC_BLOCKDATALONG: return readBlockDataLong(); case TC_CLASS: return readNewClass(false); case TC_CLASSDESC: return readNewClassDesc(false); case TC_ARRAY: return readNewArray(false); case TC_OBJECT: return readNewObject(false); case TC_STRING: return readNewString(false); case TC_LONGSTRING: return readNewLongString(false); case TC_REFERENCE: return readCyclicReference(); case TC_NULL: return null; case TC_EXCEPTION: Exception exc = readException(); throw new WriteAbortedException("Read an exception", exc); case TC_RESET: resetState(); return null; default: throw corruptStream(tc); } }
[ "private", "Object", "readContent", "(", "byte", "tc", ")", "throws", "ClassNotFoundException", ",", "IOException", "{", "switch", "(", "tc", ")", "{", "case", "TC_BLOCKDATA", ":", "return", "readBlockData", "(", ")", ";", "case", "TC_BLOCKDATALONG", ":", "ret...
Reads the content of the receiver based on the previously read token {@code tc}. @param tc The token code for the next item in the stream @return the object read from the stream @throws IOException If an IO exception happened when reading the class descriptor. @throws ClassNotFoundException If the class corresponding to the object being read could not be found.
[ "Reads", "the", "content", "of", "the", "receiver", "based", "on", "the", "previously", "read", "token", "{", "@code", "tc", "}", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java#L721-L753
greenmail-mail-test/greenmail
greenmail-core/src/main/java/com/icegreen/greenmail/imap/ImapResponse.java
ImapResponse.okResponse
public void okResponse(String responseCode, String message) { """ Writes an untagged OK response, with the supplied response code, and an optional message. @param responseCode The response code, included in []. @param message The message to follow the [] """ untagged(); message(OK); responseCode(responseCode); message(message); end(); }
java
public void okResponse(String responseCode, String message) { untagged(); message(OK); responseCode(responseCode); message(message); end(); }
[ "public", "void", "okResponse", "(", "String", "responseCode", ",", "String", "message", ")", "{", "untagged", "(", ")", ";", "message", "(", "OK", ")", ";", "responseCode", "(", "responseCode", ")", ";", "message", "(", "message", ")", ";", "end", "(", ...
Writes an untagged OK response, with the supplied response code, and an optional message. @param responseCode The response code, included in []. @param message The message to follow the []
[ "Writes", "an", "untagged", "OK", "response", "with", "the", "supplied", "response", "code", "and", "an", "optional", "message", "." ]
train
https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/imap/ImapResponse.java#L129-L135
groovy/groovy-core
src/main/groovy/lang/MetaProperty.java
MetaProperty.getGetterName
public static String getGetterName(String propertyName, Class type) { """ Gets the name for the getter for this property @return The name of the property. The name is "get"+ the capitalized propertyName or, in the case of boolean values, "is" + the capitalized propertyName """ String prefix = type == boolean.class || type == Boolean.class ? "is" : "get"; return prefix + MetaClassHelper.capitalize(propertyName); }
java
public static String getGetterName(String propertyName, Class type) { String prefix = type == boolean.class || type == Boolean.class ? "is" : "get"; return prefix + MetaClassHelper.capitalize(propertyName); }
[ "public", "static", "String", "getGetterName", "(", "String", "propertyName", ",", "Class", "type", ")", "{", "String", "prefix", "=", "type", "==", "boolean", ".", "class", "||", "type", "==", "Boolean", ".", "class", "?", "\"is\"", ":", "\"get\"", ";", ...
Gets the name for the getter for this property @return The name of the property. The name is "get"+ the capitalized propertyName or, in the case of boolean values, "is" + the capitalized propertyName
[ "Gets", "the", "name", "for", "the", "getter", "for", "this", "property" ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/MetaProperty.java#L90-L93
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.appendQuoted
public static void appendQuoted (@Nonnull final StringBuilder aTarget, @Nullable final String sSource) { """ Append the provided string quoted or unquoted if it is <code>null</code>. @param aTarget The target to write to. May not be <code>null</code>. @param sSource Source string. May be <code>null</code>. @see #getQuoted(String) @since 9.2.0 """ if (sSource == null) aTarget.append ("null"); else aTarget.append ('\'').append (sSource).append ('\''); }
java
public static void appendQuoted (@Nonnull final StringBuilder aTarget, @Nullable final String sSource) { if (sSource == null) aTarget.append ("null"); else aTarget.append ('\'').append (sSource).append ('\''); }
[ "public", "static", "void", "appendQuoted", "(", "@", "Nonnull", "final", "StringBuilder", "aTarget", ",", "@", "Nullable", "final", "String", "sSource", ")", "{", "if", "(", "sSource", "==", "null", ")", "aTarget", ".", "append", "(", "\"null\"", ")", ";"...
Append the provided string quoted or unquoted if it is <code>null</code>. @param aTarget The target to write to. May not be <code>null</code>. @param sSource Source string. May be <code>null</code>. @see #getQuoted(String) @since 9.2.0
[ "Append", "the", "provided", "string", "quoted", "or", "unquoted", "if", "it", "is", "<code", ">", "null<", "/", "code", ">", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2511-L2517
wdullaer/MaterialDateTimePicker
library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java
RadialPickerLayout.roundToValidTime
private Timepoint roundToValidTime(Timepoint newSelection, int currentItemShowing) { """ Snap the input to a selectable value @param newSelection Timepoint - Time which should be rounded @param currentItemShowing int - The index of the current view @return Timepoint - the rounded value """ switch(currentItemShowing) { case HOUR_INDEX: return mController.roundToNearest(newSelection, null); case MINUTE_INDEX: return mController.roundToNearest(newSelection, Timepoint.TYPE.HOUR); default: return mController.roundToNearest(newSelection, Timepoint.TYPE.MINUTE); } }
java
private Timepoint roundToValidTime(Timepoint newSelection, int currentItemShowing) { switch(currentItemShowing) { case HOUR_INDEX: return mController.roundToNearest(newSelection, null); case MINUTE_INDEX: return mController.roundToNearest(newSelection, Timepoint.TYPE.HOUR); default: return mController.roundToNearest(newSelection, Timepoint.TYPE.MINUTE); } }
[ "private", "Timepoint", "roundToValidTime", "(", "Timepoint", "newSelection", ",", "int", "currentItemShowing", ")", "{", "switch", "(", "currentItemShowing", ")", "{", "case", "HOUR_INDEX", ":", "return", "mController", ".", "roundToNearest", "(", "newSelection", "...
Snap the input to a selectable value @param newSelection Timepoint - Time which should be rounded @param currentItemShowing int - The index of the current view @return Timepoint - the rounded value
[ "Snap", "the", "input", "to", "a", "selectable", "value" ]
train
https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java#L438-L447
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/randomizers/range/IntegerRangeRandomizer.java
IntegerRangeRandomizer.aNewIntegerRangeRandomizer
public static IntegerRangeRandomizer aNewIntegerRangeRandomizer(final Integer min, final Integer max, final long seed) { """ Create a new {@link IntegerRangeRandomizer}. @param min min value @param max max value @param seed initial seed @return a new {@link IntegerRangeRandomizer}. """ return new IntegerRangeRandomizer(min, max, seed); }
java
public static IntegerRangeRandomizer aNewIntegerRangeRandomizer(final Integer min, final Integer max, final long seed) { return new IntegerRangeRandomizer(min, max, seed); }
[ "public", "static", "IntegerRangeRandomizer", "aNewIntegerRangeRandomizer", "(", "final", "Integer", "min", ",", "final", "Integer", "max", ",", "final", "long", "seed", ")", "{", "return", "new", "IntegerRangeRandomizer", "(", "min", ",", "max", ",", "seed", ")...
Create a new {@link IntegerRangeRandomizer}. @param min min value @param max max value @param seed initial seed @return a new {@link IntegerRangeRandomizer}.
[ "Create", "a", "new", "{", "@link", "IntegerRangeRandomizer", "}", "." ]
train
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/range/IntegerRangeRandomizer.java#L73-L75
JavaMoney/jsr354-api
src/main/java/javax/money/format/MonetaryFormats.java
MonetaryFormats.isAvailable
public static boolean isAvailable(Locale locale, String... providers) { """ Checks if a {@link MonetaryAmountFormat} is available for the given {@link Locale} and providers. @param locale the target {@link Locale}, not {@code null}. @param providers The providers to be queried, if not set the providers as defined by #getDefaultCurrencyProviderChain() are queried. @return true, if a corresponding {@link MonetaryAmountFormat} is accessible. """ return Optional.ofNullable(getMonetaryFormatsSpi()).orElseThrow(() -> new MonetaryException( "No MonetaryFormatsSingletonSpi " + "loaded, query functionality is not available.")) .isAvailable(locale, providers); }
java
public static boolean isAvailable(Locale locale, String... providers) { return Optional.ofNullable(getMonetaryFormatsSpi()).orElseThrow(() -> new MonetaryException( "No MonetaryFormatsSingletonSpi " + "loaded, query functionality is not available.")) .isAvailable(locale, providers); }
[ "public", "static", "boolean", "isAvailable", "(", "Locale", "locale", ",", "String", "...", "providers", ")", "{", "return", "Optional", ".", "ofNullable", "(", "getMonetaryFormatsSpi", "(", ")", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "Monetar...
Checks if a {@link MonetaryAmountFormat} is available for the given {@link Locale} and providers. @param locale the target {@link Locale}, not {@code null}. @param providers The providers to be queried, if not set the providers as defined by #getDefaultCurrencyProviderChain() are queried. @return true, if a corresponding {@link MonetaryAmountFormat} is accessible.
[ "Checks", "if", "a", "{", "@link", "MonetaryAmountFormat", "}", "is", "available", "for", "the", "given", "{", "@link", "Locale", "}", "and", "providers", "." ]
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/format/MonetaryFormats.java#L73-L77
deephacks/confit
provider-hbase/src/main/java/org/deephacks/confit/internal/hbase/HBeanReferences.java
HBeanReferences.getIids2
private static byte[] getIids2(final List<BeanId> ids, final UniqueIds uids) { """ Second version of getIids that takes a set of bean ids instead. """ if (ids == null) { return new byte[0]; } final AbstractList<String> list = new AbstractList<String>() { @Override public String get(int index) { return ids.get(index).getInstanceId(); } @Override public int size() { return ids.size(); } }; return getIids(list, uids); }
java
private static byte[] getIids2(final List<BeanId> ids, final UniqueIds uids) { if (ids == null) { return new byte[0]; } final AbstractList<String> list = new AbstractList<String>() { @Override public String get(int index) { return ids.get(index).getInstanceId(); } @Override public int size() { return ids.size(); } }; return getIids(list, uids); }
[ "private", "static", "byte", "[", "]", "getIids2", "(", "final", "List", "<", "BeanId", ">", "ids", ",", "final", "UniqueIds", "uids", ")", "{", "if", "(", "ids", "==", "null", ")", "{", "return", "new", "byte", "[", "0", "]", ";", "}", "final", ...
Second version of getIids that takes a set of bean ids instead.
[ "Second", "version", "of", "getIids", "that", "takes", "a", "set", "of", "bean", "ids", "instead", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/provider-hbase/src/main/java/org/deephacks/confit/internal/hbase/HBeanReferences.java#L284-L301
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java
ByteBufferOutputStream.writeTo
public void writeTo (@Nonnull final ByteBuffer aDestBuffer, final boolean bCompactBuffer) { """ Write everything currently contained to the specified buffer. If the passed buffer is too small, a {@link java.nio.BufferOverflowException} is thrown. The copied elements are removed from this streams buffer. @param aDestBuffer The destination buffer to write to. May not be <code>null</code>. @param bCompactBuffer <code>true</code> to compact the buffer afterwards, <code>false</code> otherwise. """ ValueEnforcer.notNull (aDestBuffer, "DestBuffer"); m_aBuffer.flip (); aDestBuffer.put (m_aBuffer); if (bCompactBuffer) m_aBuffer.compact (); }
java
public void writeTo (@Nonnull final ByteBuffer aDestBuffer, final boolean bCompactBuffer) { ValueEnforcer.notNull (aDestBuffer, "DestBuffer"); m_aBuffer.flip (); aDestBuffer.put (m_aBuffer); if (bCompactBuffer) m_aBuffer.compact (); }
[ "public", "void", "writeTo", "(", "@", "Nonnull", "final", "ByteBuffer", "aDestBuffer", ",", "final", "boolean", "bCompactBuffer", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aDestBuffer", ",", "\"DestBuffer\"", ")", ";", "m_aBuffer", ".", "flip", "(", ")...
Write everything currently contained to the specified buffer. If the passed buffer is too small, a {@link java.nio.BufferOverflowException} is thrown. The copied elements are removed from this streams buffer. @param aDestBuffer The destination buffer to write to. May not be <code>null</code>. @param bCompactBuffer <code>true</code> to compact the buffer afterwards, <code>false</code> otherwise.
[ "Write", "everything", "currently", "contained", "to", "the", "specified", "buffer", ".", "If", "the", "passed", "buffer", "is", "too", "small", "a", "{", "@link", "java", ".", "nio", ".", "BufferOverflowException", "}", "is", "thrown", ".", "The", "copied",...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java#L229-L237
mpetazzoni/ttorrent
ttorrent-client/src/main/java/com/turn/ttorrent/client/Piece.java
Piece._read
private ByteBuffer _read(long offset, long length, ByteBuffer buffer) throws IOException { """ Internal piece data read function. <p> This function will read the piece data without checking if the piece has been validated. It is simply meant at factoring-in the common read code from the validate and read functions. </p> @param offset Offset inside this piece where to start reading. @param length Number of bytes to read from the piece. @return A byte buffer containing the piece data. @throws IllegalArgumentException If <em>offset + length</em> goes over the piece boundary. @throws IOException If the read can't be completed (I/O error, or EOF reached, which can happen if the piece is not complete). """ if (offset + length > this.length) { throw new IllegalArgumentException("Piece#" + this.index + " overrun (" + offset + " + " + length + " > " + this.length + ") !"); } // TODO: remove cast to int when large ByteBuffer support is // implemented in Java. int position = buffer.position(); byte[] bytes = this.pieceStorage.readPiecePart(this.index, (int)offset, (int)length); buffer.put(bytes); buffer.rewind(); buffer.limit(bytes.length + position); return buffer; }
java
private ByteBuffer _read(long offset, long length, ByteBuffer buffer) throws IOException { if (offset + length > this.length) { throw new IllegalArgumentException("Piece#" + this.index + " overrun (" + offset + " + " + length + " > " + this.length + ") !"); } // TODO: remove cast to int when large ByteBuffer support is // implemented in Java. int position = buffer.position(); byte[] bytes = this.pieceStorage.readPiecePart(this.index, (int)offset, (int)length); buffer.put(bytes); buffer.rewind(); buffer.limit(bytes.length + position); return buffer; }
[ "private", "ByteBuffer", "_read", "(", "long", "offset", ",", "long", "length", ",", "ByteBuffer", "buffer", ")", "throws", "IOException", "{", "if", "(", "offset", "+", "length", ">", "this", ".", "length", ")", "{", "throw", "new", "IllegalArgumentExceptio...
Internal piece data read function. <p> This function will read the piece data without checking if the piece has been validated. It is simply meant at factoring-in the common read code from the validate and read functions. </p> @param offset Offset inside this piece where to start reading. @param length Number of bytes to read from the piece. @return A byte buffer containing the piece data. @throws IllegalArgumentException If <em>offset + length</em> goes over the piece boundary. @throws IOException If the read can't be completed (I/O error, or EOF reached, which can happen if the piece is not complete).
[ "Internal", "piece", "data", "read", "function", "." ]
train
https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/ttorrent-client/src/main/java/com/turn/ttorrent/client/Piece.java#L181-L196
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
DTMDefaultBase.getTypedAttribute
protected int getTypedAttribute(int nodeHandle, int attType) { """ Given a node handle and an expanded type ID, get the index of the node's attribute of that type, if any. @param nodeHandle int Handle of the node. @param attType int expanded type ID of the required attribute. @return Handle of attribute of the required type, or DTM.NULL to indicate none exists. """ int type = getNodeType(nodeHandle); if (DTM.ELEMENT_NODE == type) { int identity = makeNodeIdentity(nodeHandle); while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { type = _type(identity); if (type == DTM.ATTRIBUTE_NODE) { if (_exptype(identity) == attType) return makeNodeHandle(identity); } else if (DTM.NAMESPACE_NODE != type) { break; } } } return DTM.NULL; }
java
protected int getTypedAttribute(int nodeHandle, int attType) { int type = getNodeType(nodeHandle); if (DTM.ELEMENT_NODE == type) { int identity = makeNodeIdentity(nodeHandle); while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { type = _type(identity); if (type == DTM.ATTRIBUTE_NODE) { if (_exptype(identity) == attType) return makeNodeHandle(identity); } else if (DTM.NAMESPACE_NODE != type) { break; } } } return DTM.NULL; }
[ "protected", "int", "getTypedAttribute", "(", "int", "nodeHandle", ",", "int", "attType", ")", "{", "int", "type", "=", "getNodeType", "(", "nodeHandle", ")", ";", "if", "(", "DTM", ".", "ELEMENT_NODE", "==", "type", ")", "{", "int", "identity", "=", "ma...
Given a node handle and an expanded type ID, get the index of the node's attribute of that type, if any. @param nodeHandle int Handle of the node. @param attType int expanded type ID of the required attribute. @return Handle of attribute of the required type, or DTM.NULL to indicate none exists.
[ "Given", "a", "node", "handle", "and", "an", "expanded", "type", "ID", "get", "the", "index", "of", "the", "node", "s", "attribute", "of", "that", "type", "if", "any", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L1107-L1128
LearnLib/learnlib
oracles/equivalence-oracles/src/main/java/de/learnlib/oracle/equivalence/SampleSetEQOracle.java
SampleSetEQOracle.checkInputs
private static <I> boolean checkInputs(Query<I, ?> query, Collection<? extends I> inputs) { """ Tests if the input word of the given {@link Query} consists entirely of symbols in {@code inputs}. @param query the query to test @param inputs the set of allowed inputs @return {@code true} if the input word of {@code query} consists entirely of symbols in {@code inputs}, {@code false} otherwise """ for (I sym : query.getPrefix()) { if (!inputs.contains(sym)) { return false; } } for (I sym : query.getSuffix()) { if (!inputs.contains(sym)) { return false; } } return true; }
java
private static <I> boolean checkInputs(Query<I, ?> query, Collection<? extends I> inputs) { for (I sym : query.getPrefix()) { if (!inputs.contains(sym)) { return false; } } for (I sym : query.getSuffix()) { if (!inputs.contains(sym)) { return false; } } return true; }
[ "private", "static", "<", "I", ">", "boolean", "checkInputs", "(", "Query", "<", "I", ",", "?", ">", "query", ",", "Collection", "<", "?", "extends", "I", ">", "inputs", ")", "{", "for", "(", "I", "sym", ":", "query", ".", "getPrefix", "(", ")", ...
Tests if the input word of the given {@link Query} consists entirely of symbols in {@code inputs}. @param query the query to test @param inputs the set of allowed inputs @return {@code true} if the input word of {@code query} consists entirely of symbols in {@code inputs}, {@code false} otherwise
[ "Tests", "if", "the", "input", "word", "of", "the", "given", "{", "@link", "Query", "}", "consists", "entirely", "of", "symbols", "in", "{", "@code", "inputs", "}", "." ]
train
https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/oracles/equivalence-oracles/src/main/java/de/learnlib/oracle/equivalence/SampleSetEQOracle.java#L186-L198
playn/playn
core/src/playn/core/json/JsonParser.java
JsonParser.createHelpfulException
private JsonParserException createHelpfulException(char first, char[] expected, int failurePosition) throws JsonParserException { """ Throws a helpful exception based on the current alphanumeric token. """ // Build the first part of the token StringBuilder errorToken = new StringBuilder(first + (expected == null ? "" : new String(expected, 0, failurePosition))); // Consume the whole pseudo-token to make a better error message while (isAsciiLetter(peekChar()) && errorToken.length() < 15) errorToken.append((char)advanceChar()); return createParseException(null, "Unexpected token '" + errorToken + "'" + (expected == null ? "" : ". Did you mean '" + first + new String(expected) + "'?"), true); }
java
private JsonParserException createHelpfulException(char first, char[] expected, int failurePosition) throws JsonParserException { // Build the first part of the token StringBuilder errorToken = new StringBuilder(first + (expected == null ? "" : new String(expected, 0, failurePosition))); // Consume the whole pseudo-token to make a better error message while (isAsciiLetter(peekChar()) && errorToken.length() < 15) errorToken.append((char)advanceChar()); return createParseException(null, "Unexpected token '" + errorToken + "'" + (expected == null ? "" : ". Did you mean '" + first + new String(expected) + "'?"), true); }
[ "private", "JsonParserException", "createHelpfulException", "(", "char", "first", ",", "char", "[", "]", "expected", ",", "int", "failurePosition", ")", "throws", "JsonParserException", "{", "// Build the first part of the token", "StringBuilder", "errorToken", "=", "new"...
Throws a helpful exception based on the current alphanumeric token.
[ "Throws", "a", "helpful", "exception", "based", "on", "the", "current", "alphanumeric", "token", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonParser.java#L445-L457
landawn/AbacusUtil
src/com/landawn/abacus/eventBus/EventBus.java
EventBus.removeStickyEvents
public boolean removeStickyEvents(final Class<?> eventType, final String eventId) { """ Remove the sticky events which can be assigned to specified <code>eventType</code> and posted with the specified <code>eventId</code>. @param eventType @param eventId @return true if one or one more than sticky events are removed, otherwise, <code>false</code>. """ final List<Object> keyToRemove = new ArrayList<>(); synchronized (stickyEventMap) { for (Map.Entry<Object, String> entry : stickyEventMap.entrySet()) { if (N.equals(entry.getValue(), eventId) && eventType.isAssignableFrom(entry.getKey().getClass())) { keyToRemove.add(entry); } } if (N.notNullOrEmpty(keyToRemove)) { synchronized (stickyEventMap) { for (Object event : keyToRemove) { stickyEventMap.remove(event); } this.mapOfStickyEvent = null; } return true; } } return false; }
java
public boolean removeStickyEvents(final Class<?> eventType, final String eventId) { final List<Object> keyToRemove = new ArrayList<>(); synchronized (stickyEventMap) { for (Map.Entry<Object, String> entry : stickyEventMap.entrySet()) { if (N.equals(entry.getValue(), eventId) && eventType.isAssignableFrom(entry.getKey().getClass())) { keyToRemove.add(entry); } } if (N.notNullOrEmpty(keyToRemove)) { synchronized (stickyEventMap) { for (Object event : keyToRemove) { stickyEventMap.remove(event); } this.mapOfStickyEvent = null; } return true; } } return false; }
[ "public", "boolean", "removeStickyEvents", "(", "final", "Class", "<", "?", ">", "eventType", ",", "final", "String", "eventId", ")", "{", "final", "List", "<", "Object", ">", "keyToRemove", "=", "new", "ArrayList", "<>", "(", ")", ";", "synchronized", "("...
Remove the sticky events which can be assigned to specified <code>eventType</code> and posted with the specified <code>eventId</code>. @param eventType @param eventId @return true if one or one more than sticky events are removed, otherwise, <code>false</code>.
[ "Remove", "the", "sticky", "events", "which", "can", "be", "assigned", "to", "specified", "<code", ">", "eventType<", "/", "code", ">", "and", "posted", "with", "the", "specified", "<code", ">", "eventId<", "/", "code", ">", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/eventBus/EventBus.java#L561-L585
crowmagnumb/s6-util
src/main/java/net/crowmagnumb/util/net/AbstractMultipartUtility.java
AbstractMultipartUtility.addFilePart
public void addFilePart(final String fieldName, final InputStream stream, final String contentType) throws IOException { """ Adds a upload file section to the request by stream @param fieldName name attribute in &lt;input type="file" name="..." /&gt; @param stream input stream of data to upload @param contentType content type of data @throws IOException if problems """ addFilePart(fieldName, stream, null, contentType); }
java
public void addFilePart(final String fieldName, final InputStream stream, final String contentType) throws IOException { addFilePart(fieldName, stream, null, contentType); }
[ "public", "void", "addFilePart", "(", "final", "String", "fieldName", ",", "final", "InputStream", "stream", ",", "final", "String", "contentType", ")", "throws", "IOException", "{", "addFilePart", "(", "fieldName", ",", "stream", ",", "null", ",", "contentType"...
Adds a upload file section to the request by stream @param fieldName name attribute in &lt;input type="file" name="..." /&gt; @param stream input stream of data to upload @param contentType content type of data @throws IOException if problems
[ "Adds", "a", "upload", "file", "section", "to", "the", "request", "by", "stream" ]
train
https://github.com/crowmagnumb/s6-util/blob/0f9969bc0809e8a617501fa57c135e9b3984fae0/src/main/java/net/crowmagnumb/util/net/AbstractMultipartUtility.java#L71-L75
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/GV/SepaUtil.java
SepaUtil.maxIndex
public static Integer maxIndex(HashMap<String, String> properties) { """ Ermittelt den maximalen Index aller indizierten Properties. Nicht indizierte Properties werden ignoriert. @param properties die Properties, mit denen gearbeitet werden soll @return Maximaler Index, oder {@code null}, wenn keine indizierten Properties gefunden wurden """ Integer max = null; for (String key : properties.keySet()) { Matcher m = INDEX_PATTERN.matcher(key); if (m.matches()) { int index = Integer.parseInt(m.group(1)); if (max == null || index > max) { max = index; } } } return max; }
java
public static Integer maxIndex(HashMap<String, String> properties) { Integer max = null; for (String key : properties.keySet()) { Matcher m = INDEX_PATTERN.matcher(key); if (m.matches()) { int index = Integer.parseInt(m.group(1)); if (max == null || index > max) { max = index; } } } return max; }
[ "public", "static", "Integer", "maxIndex", "(", "HashMap", "<", "String", ",", "String", ">", "properties", ")", "{", "Integer", "max", "=", "null", ";", "for", "(", "String", "key", ":", "properties", ".", "keySet", "(", ")", ")", "{", "Matcher", "m",...
Ermittelt den maximalen Index aller indizierten Properties. Nicht indizierte Properties werden ignoriert. @param properties die Properties, mit denen gearbeitet werden soll @return Maximaler Index, oder {@code null}, wenn keine indizierten Properties gefunden wurden
[ "Ermittelt", "den", "maximalen", "Index", "aller", "indizierten", "Properties", ".", "Nicht", "indizierte", "Properties", "werden", "ignoriert", "." ]
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/SepaUtil.java#L99-L111
apruve/apruve-java
src/main/java/com/apruve/models/PaymentRequest.java
PaymentRequest.get
public static ApruveResponse<PaymentRequest> get(String paymentRequestId) { """ Fetches the PaymentRequest with the given ID from Apruve. @see <a href="https://www.apruve.com/doc/developers/rest-api/">https://www.apruve.com/doc/developers/rest-api/</a> @param paymentRequestId @return PaymentRequest, or null if not found """ return ApruveClient.getInstance().get( PAYMENT_REQUESTS_PATH + paymentRequestId, PaymentRequest.class); }
java
public static ApruveResponse<PaymentRequest> get(String paymentRequestId) { return ApruveClient.getInstance().get( PAYMENT_REQUESTS_PATH + paymentRequestId, PaymentRequest.class); }
[ "public", "static", "ApruveResponse", "<", "PaymentRequest", ">", "get", "(", "String", "paymentRequestId", ")", "{", "return", "ApruveClient", ".", "getInstance", "(", ")", ".", "get", "(", "PAYMENT_REQUESTS_PATH", "+", "paymentRequestId", ",", "PaymentRequest", ...
Fetches the PaymentRequest with the given ID from Apruve. @see <a href="https://www.apruve.com/doc/developers/rest-api/">https://www.apruve.com/doc/developers/rest-api/</a> @param paymentRequestId @return PaymentRequest, or null if not found
[ "Fetches", "the", "PaymentRequest", "with", "the", "given", "ID", "from", "Apruve", "." ]
train
https://github.com/apruve/apruve-java/blob/b188d6b17f777823c2e46427847318849978685e/src/main/java/com/apruve/models/PaymentRequest.java#L110-L113
haifengl/smile
math/src/main/java/smile/math/matrix/JMatrix.java
JMatrix.balbak
private static void balbak(DenseMatrix V, double[] scale) { """ Form the eigenvectors of a real nonsymmetric matrix by back transforming those of the corresponding balanced matrix determined by balance. """ int n = V.nrows(); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { V.mul(i, j, scale[i]); } } }
java
private static void balbak(DenseMatrix V, double[] scale) { int n = V.nrows(); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { V.mul(i, j, scale[i]); } } }
[ "private", "static", "void", "balbak", "(", "DenseMatrix", "V", ",", "double", "[", "]", "scale", ")", "{", "int", "n", "=", "V", ".", "nrows", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "...
Form the eigenvectors of a real nonsymmetric matrix by back transforming those of the corresponding balanced matrix determined by balance.
[ "Form", "the", "eigenvectors", "of", "a", "real", "nonsymmetric", "matrix", "by", "back", "transforming", "those", "of", "the", "corresponding", "balanced", "matrix", "determined", "by", "balance", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/JMatrix.java#L1871-L1878
icoloma/simpleds
src/main/java/org/simpleds/CursorList.java
CursorList.loadRelatedEntities
public Map<Key, Object> loadRelatedEntities(String... propertyName) { """ Load the list of related entities. @param propertyName the name of the properties to be used as Key @return the list of retrieved entities """ EntityManager entityManager = EntityManagerFactory.getEntityManager(); Class<J> persistentClass = (Class<J>) query.getClassMetadata().getPersistentClass(); Set<Key> keys = Sets.newHashSet(); for (String p : propertyName) { keys.addAll(Collections2.transform(data, new EntityToPropertyFunction(persistentClass, p))); } return entityManager.get(keys); }
java
public Map<Key, Object> loadRelatedEntities(String... propertyName) { EntityManager entityManager = EntityManagerFactory.getEntityManager(); Class<J> persistentClass = (Class<J>) query.getClassMetadata().getPersistentClass(); Set<Key> keys = Sets.newHashSet(); for (String p : propertyName) { keys.addAll(Collections2.transform(data, new EntityToPropertyFunction(persistentClass, p))); } return entityManager.get(keys); }
[ "public", "Map", "<", "Key", ",", "Object", ">", "loadRelatedEntities", "(", "String", "...", "propertyName", ")", "{", "EntityManager", "entityManager", "=", "EntityManagerFactory", ".", "getEntityManager", "(", ")", ";", "Class", "<", "J", ">", "persistentClas...
Load the list of related entities. @param propertyName the name of the properties to be used as Key @return the list of retrieved entities
[ "Load", "the", "list", "of", "related", "entities", "." ]
train
https://github.com/icoloma/simpleds/blob/b07763df98b9375b764e625f617a6c78df4b068d/src/main/java/org/simpleds/CursorList.java#L51-L59
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.beginValidateMoveResourcesAsync
public Observable<Void> beginValidateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { """ Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. @param parameters Parameters for moving resources. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return beginValidateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginValidateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { return beginValidateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginValidateMoveResourcesAsync", "(", "String", "sourceResourceGroupName", ",", "ResourcesMoveInfo", "parameters", ")", "{", "return", "beginValidateMoveResourcesWithServiceResponseAsync", "(", "sourceResourceGroupName", ",", "paramet...
Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. @param parameters Parameters for moving resources. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Validates", "whether", "resources", "can", "be", "moved", "from", "one", "resource", "group", "to", "another", "resource", "group", ".", "This", "operation", "checks", "whether", "the", "specified", "resources", "can", "be", "moved", "to", "the", "target", "....
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L682-L689
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagEdit.java
CmsJspTagEdit.getResourceType
private static I_CmsResourceType getResourceType(CmsResource resource, String createType) { """ Returns the resource type to create, or <code>null</code> if not available.<p> @param resource the edit resource @param createType the create type parameter @return the resource type """ I_CmsResourceType resType = null; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(createType)) { try { resType = OpenCms.getResourceManager().getResourceType(createType); } catch (CmsLoaderException e) { LOG.error("Could not read resource type '" + createType + "' for resource creation.", e); } } else if (resource != null) { resType = OpenCms.getResourceManager().getResourceType(resource); } return resType; }
java
private static I_CmsResourceType getResourceType(CmsResource resource, String createType) { I_CmsResourceType resType = null; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(createType)) { try { resType = OpenCms.getResourceManager().getResourceType(createType); } catch (CmsLoaderException e) { LOG.error("Could not read resource type '" + createType + "' for resource creation.", e); } } else if (resource != null) { resType = OpenCms.getResourceManager().getResourceType(resource); } return resType; }
[ "private", "static", "I_CmsResourceType", "getResourceType", "(", "CmsResource", "resource", ",", "String", "createType", ")", "{", "I_CmsResourceType", "resType", "=", "null", ";", "if", "(", "CmsStringUtil", ".", "isNotEmptyOrWhitespaceOnly", "(", "createType", ")",...
Returns the resource type to create, or <code>null</code> if not available.<p> @param resource the edit resource @param createType the create type parameter @return the resource type
[ "Returns", "the", "resource", "type", "to", "create", "or", "<code", ">", "null<", "/", "code", ">", "if", "not", "available", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagEdit.java#L324-L337
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/dbf/internal/DBFDriver.java
DBFDriver.initDriverFromFile
public void initDriverFromFile(File dbfFile, String forceEncoding) throws IOException { """ Init file header for DBF File @param dbfFile DBF File path @param forceEncoding File encoding to use, null will use the file encoding provided in the file header @throws IOException """ // Read columns from files metadata this.dbfFile = dbfFile; FileInputStream fis = new FileInputStream(dbfFile); dbaseFileReader = new DbaseFileReader(fis.getChannel(), forceEncoding); }
java
public void initDriverFromFile(File dbfFile, String forceEncoding) throws IOException { // Read columns from files metadata this.dbfFile = dbfFile; FileInputStream fis = new FileInputStream(dbfFile); dbaseFileReader = new DbaseFileReader(fis.getChannel(), forceEncoding); }
[ "public", "void", "initDriverFromFile", "(", "File", "dbfFile", ",", "String", "forceEncoding", ")", "throws", "IOException", "{", "// Read columns from files metadata", "this", ".", "dbfFile", "=", "dbfFile", ";", "FileInputStream", "fis", "=", "new", "FileInputStrea...
Init file header for DBF File @param dbfFile DBF File path @param forceEncoding File encoding to use, null will use the file encoding provided in the file header @throws IOException
[ "Init", "file", "header", "for", "DBF", "File" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/dbf/internal/DBFDriver.java#L54-L59
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/template/TemplateWriter.java
TemplateWriter.doReplace
@Override protected void doReplace(final String search, final Writer backing) { """ Replaces the search string by rendering the corresponding component. @param search the search String that was matched. @param backing the underlying writer to write the replacement to. """ WComponent component = componentsByKey.get(search); UIContextHolder.pushContext(uic); try { component.paint(new WebXmlRenderContext((PrintWriter) backing)); } finally { UIContextHolder.popContext(); } }
java
@Override protected void doReplace(final String search, final Writer backing) { WComponent component = componentsByKey.get(search); UIContextHolder.pushContext(uic); try { component.paint(new WebXmlRenderContext((PrintWriter) backing)); } finally { UIContextHolder.popContext(); } }
[ "@", "Override", "protected", "void", "doReplace", "(", "final", "String", "search", ",", "final", "Writer", "backing", ")", "{", "WComponent", "component", "=", "componentsByKey", ".", "get", "(", "search", ")", ";", "UIContextHolder", ".", "pushContext", "("...
Replaces the search string by rendering the corresponding component. @param search the search String that was matched. @param backing the underlying writer to write the replacement to.
[ "Replaces", "the", "search", "string", "by", "rendering", "the", "corresponding", "component", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/template/TemplateWriter.java#L53-L63
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addSuccessJobStopped
public FessMessages addSuccessJobStopped(String property, String arg0) { """ Add the created action message for the key 'success.job_stopped' with parameters. <pre> message: Stopped job {0}. </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull) """ assertPropertyNotNull(property); add(property, new UserMessage(SUCCESS_job_stopped, arg0)); return this; }
java
public FessMessages addSuccessJobStopped(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(SUCCESS_job_stopped, arg0)); return this; }
[ "public", "FessMessages", "addSuccessJobStopped", "(", "String", "property", ",", "String", "arg0", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "SUCCESS_job_stopped", ",", "arg0", ")", ")"...
Add the created action message for the key 'success.job_stopped' with parameters. <pre> message: Stopped job {0}. </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "success", ".", "job_stopped", "with", "parameters", ".", "<pre", ">", "message", ":", "Stopped", "job", "{", "0", "}", ".", "<", "/", "pre", ">" ]
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2420-L2424
LearnLib/automatalib
visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java
DOT.runDOT
public static InputStream runDOT(String dotText, String format, String... additionalOpts) throws IOException { """ Invokes the DOT utility on a string. Convenience method, see {@link #runDOT(Reader, String, String...)} """ StringReader sr = new StringReader(dotText); return runDOT(sr, format, additionalOpts); }
java
public static InputStream runDOT(String dotText, String format, String... additionalOpts) throws IOException { StringReader sr = new StringReader(dotText); return runDOT(sr, format, additionalOpts); }
[ "public", "static", "InputStream", "runDOT", "(", "String", "dotText", ",", "String", "format", ",", "String", "...", "additionalOpts", ")", "throws", "IOException", "{", "StringReader", "sr", "=", "new", "StringReader", "(", "dotText", ")", ";", "return", "ru...
Invokes the DOT utility on a string. Convenience method, see {@link #runDOT(Reader, String, String...)}
[ "Invokes", "the", "DOT", "utility", "on", "a", "string", ".", "Convenience", "method", "see", "{" ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java#L120-L123
OpenLiberty/open-liberty
dev/com.ibm.ws.security.authorization.jacc/src/com/ibm/ws/security/authorization/jacc/internal/JaccServiceImpl.java
JaccServiceImpl.checkDataConstraints
protected boolean checkDataConstraints(String applicationName, String moduleName, String uriName, String methodName, Object req, String transportType) { """ /* check DataConstraints true if permission is is implied. false otherwise. """ boolean result = false; WebSecurityValidator wsv = getWsv(servletServiceRef.getService()); if (wsv != null) { result = checkDataConstraints(wsv, applicationName, moduleName, uriName, methodName, req, transportType); } else { Tr.error(tc, "JACC_NO_WEB_PLUGIN"); } return result; }
java
protected boolean checkDataConstraints(String applicationName, String moduleName, String uriName, String methodName, Object req, String transportType) { boolean result = false; WebSecurityValidator wsv = getWsv(servletServiceRef.getService()); if (wsv != null) { result = checkDataConstraints(wsv, applicationName, moduleName, uriName, methodName, req, transportType); } else { Tr.error(tc, "JACC_NO_WEB_PLUGIN"); } return result; }
[ "protected", "boolean", "checkDataConstraints", "(", "String", "applicationName", ",", "String", "moduleName", ",", "String", "uriName", ",", "String", "methodName", ",", "Object", "req", ",", "String", "transportType", ")", "{", "boolean", "result", "=", "false",...
/* check DataConstraints true if permission is is implied. false otherwise.
[ "/", "*", "check", "DataConstraints", "true", "if", "permission", "is", "is", "implied", ".", "false", "otherwise", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authorization.jacc/src/com/ibm/ws/security/authorization/jacc/internal/JaccServiceImpl.java#L303-L312
radkovo/CSSBox
src/main/java/org/fit/cssbox/layout/ElementBox.java
ElementBox.loadBorders
protected void loadBorders(CSSDecoder dec, int contw) { """ Loads the border sizes from the style. @param dec CSS decoder used for decoding the style @param contw containing block width for decoding percentages """ border = new LengthSet(); if (borderVisible("top")) border.top = getBorderWidth(dec, "border-top-width"); else border.top = 0; if (borderVisible("right")) border.right = getBorderWidth(dec, "border-right-width"); else border.right = 0; if (borderVisible("bottom")) border.bottom = getBorderWidth(dec, "border-bottom-width"); else border.bottom = 0; if (borderVisible("left")) border.left = getBorderWidth(dec, "border-left-width"); else border.left = 0; }
java
protected void loadBorders(CSSDecoder dec, int contw) { border = new LengthSet(); if (borderVisible("top")) border.top = getBorderWidth(dec, "border-top-width"); else border.top = 0; if (borderVisible("right")) border.right = getBorderWidth(dec, "border-right-width"); else border.right = 0; if (borderVisible("bottom")) border.bottom = getBorderWidth(dec, "border-bottom-width"); else border.bottom = 0; if (borderVisible("left")) border.left = getBorderWidth(dec, "border-left-width"); else border.left = 0; }
[ "protected", "void", "loadBorders", "(", "CSSDecoder", "dec", ",", "int", "contw", ")", "{", "border", "=", "new", "LengthSet", "(", ")", ";", "if", "(", "borderVisible", "(", "\"top\"", ")", ")", "border", ".", "top", "=", "getBorderWidth", "(", "dec", ...
Loads the border sizes from the style. @param dec CSS decoder used for decoding the style @param contw containing block width for decoding percentages
[ "Loads", "the", "border", "sizes", "from", "the", "style", "." ]
train
https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/ElementBox.java#L1331-L1350
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_responder_POST
public OvhTaskSpecialAccount domain_responder_POST(String domain, String account, String content, Boolean copy, String copyTo, Date from, Date to) throws IOException { """ Create new responder in server REST: POST /email/domain/{domain}/responder @param copyTo [required] Account where copy emails @param account [required] Account of domain @param from [required] Date of start responder @param content [required] Content of responder @param copy [required] If false, emails will be dropped. If true and copyTo field is empty, emails will be delivered to your mailbox. If true and copyTo is set with an address, emails will be delivered to this address @param to [required] Date of end responder @param domain [required] Name of your domain name """ String qPath = "/email/domain/{domain}/responder"; StringBuilder sb = path(qPath, domain); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "account", account); addBody(o, "content", content); addBody(o, "copy", copy); addBody(o, "copyTo", copyTo); addBody(o, "from", from); addBody(o, "to", to); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskSpecialAccount.class); }
java
public OvhTaskSpecialAccount domain_responder_POST(String domain, String account, String content, Boolean copy, String copyTo, Date from, Date to) throws IOException { String qPath = "/email/domain/{domain}/responder"; StringBuilder sb = path(qPath, domain); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "account", account); addBody(o, "content", content); addBody(o, "copy", copy); addBody(o, "copyTo", copyTo); addBody(o, "from", from); addBody(o, "to", to); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskSpecialAccount.class); }
[ "public", "OvhTaskSpecialAccount", "domain_responder_POST", "(", "String", "domain", ",", "String", "account", ",", "String", "content", ",", "Boolean", "copy", ",", "String", "copyTo", ",", "Date", "from", ",", "Date", "to", ")", "throws", "IOException", "{", ...
Create new responder in server REST: POST /email/domain/{domain}/responder @param copyTo [required] Account where copy emails @param account [required] Account of domain @param from [required] Date of start responder @param content [required] Content of responder @param copy [required] If false, emails will be dropped. If true and copyTo field is empty, emails will be delivered to your mailbox. If true and copyTo is set with an address, emails will be delivered to this address @param to [required] Date of end responder @param domain [required] Name of your domain name
[ "Create", "new", "responder", "in", "server" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L929-L941
wso2/transport-http
components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/listener/http2/Http2SourceHandler.java
Http2SourceHandler.userEventTriggered
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { """ Handles the cleartext HTTP upgrade event. <p> If an upgrade occurred, message needs to be dispatched to the correct service/resource and response should be delivered over stream 1 (the stream specifically reserved for cleartext HTTP upgrade). """ if (evt instanceof HttpServerUpgradeHandler.UpgradeEvent) { FullHttpRequest upgradedRequest = ((HttpServerUpgradeHandler.UpgradeEvent) evt).upgradeRequest(); // Construct new HTTP Request HttpRequest httpRequest = new DefaultHttpRequest( new HttpVersion(Constants.HTTP_VERSION_2_0, true), upgradedRequest.method(), upgradedRequest.uri(), upgradedRequest.headers()); HttpCarbonRequest requestCarbonMessage = setupCarbonRequest(httpRequest, this); requestCarbonMessage.addHttpContent(new DefaultLastHttpContent(upgradedRequest.content())); notifyRequestListener(this, requestCarbonMessage, 1); } }
java
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { if (evt instanceof HttpServerUpgradeHandler.UpgradeEvent) { FullHttpRequest upgradedRequest = ((HttpServerUpgradeHandler.UpgradeEvent) evt).upgradeRequest(); // Construct new HTTP Request HttpRequest httpRequest = new DefaultHttpRequest( new HttpVersion(Constants.HTTP_VERSION_2_0, true), upgradedRequest.method(), upgradedRequest.uri(), upgradedRequest.headers()); HttpCarbonRequest requestCarbonMessage = setupCarbonRequest(httpRequest, this); requestCarbonMessage.addHttpContent(new DefaultLastHttpContent(upgradedRequest.content())); notifyRequestListener(this, requestCarbonMessage, 1); } }
[ "@", "Override", "public", "void", "userEventTriggered", "(", "ChannelHandlerContext", "ctx", ",", "Object", "evt", ")", "{", "if", "(", "evt", "instanceof", "HttpServerUpgradeHandler", ".", "UpgradeEvent", ")", "{", "FullHttpRequest", "upgradedRequest", "=", "(", ...
Handles the cleartext HTTP upgrade event. <p> If an upgrade occurred, message needs to be dispatched to the correct service/resource and response should be delivered over stream 1 (the stream specifically reserved for cleartext HTTP upgrade).
[ "Handles", "the", "cleartext", "HTTP", "upgrade", "event", ".", "<p", ">", "If", "an", "upgrade", "occurred", "message", "needs", "to", "be", "dispatched", "to", "the", "correct", "service", "/", "resource", "and", "response", "should", "be", "delivered", "o...
train
https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/listener/http2/Http2SourceHandler.java#L107-L121
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/ifx/Rectangle2ifx.java
Rectangle2ifx.widthProperty
@Pure public IntegerProperty widthProperty() { """ Replies the property that is the width of the box. @return the width property. """ if (this.width == null) { this.width = new ReadOnlyIntegerWrapper(this, MathFXAttributeNames.WIDTH); this.width.bind(Bindings.subtract(maxXProperty(), minXProperty())); } return this.width; }
java
@Pure public IntegerProperty widthProperty() { if (this.width == null) { this.width = new ReadOnlyIntegerWrapper(this, MathFXAttributeNames.WIDTH); this.width.bind(Bindings.subtract(maxXProperty(), minXProperty())); } return this.width; }
[ "@", "Pure", "public", "IntegerProperty", "widthProperty", "(", ")", "{", "if", "(", "this", ".", "width", "==", "null", ")", "{", "this", ".", "width", "=", "new", "ReadOnlyIntegerWrapper", "(", "this", ",", "MathFXAttributeNames", ".", "WIDTH", ")", ";",...
Replies the property that is the width of the box. @return the width property.
[ "Replies", "the", "property", "that", "is", "the", "width", "of", "the", "box", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/ifx/Rectangle2ifx.java#L286-L293
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CodecUtils.java
CodecUtils.setBooleanToByte
public static byte setBooleanToByte(byte modifiers, int i, boolean bool) { """ 一个byte可以存8个boolean,可以按位设置 @param modifiers 描述符 @param i 索引 0-7 @param bool 要设置的值 @return 新的描述符 """ boolean old = getBooleanFromByte(modifiers, i); if (old && !bool) { // true-->false return (byte) (modifiers - (1 << i)); } else if (!old && bool) { // false-->true return (byte) (modifiers + (1 << i)); } return modifiers; }
java
public static byte setBooleanToByte(byte modifiers, int i, boolean bool) { boolean old = getBooleanFromByte(modifiers, i); if (old && !bool) { // true-->false return (byte) (modifiers - (1 << i)); } else if (!old && bool) { // false-->true return (byte) (modifiers + (1 << i)); } return modifiers; }
[ "public", "static", "byte", "setBooleanToByte", "(", "byte", "modifiers", ",", "int", "i", ",", "boolean", "bool", ")", "{", "boolean", "old", "=", "getBooleanFromByte", "(", "modifiers", ",", "i", ")", ";", "if", "(", "old", "&&", "!", "bool", ")", "{...
一个byte可以存8个boolean,可以按位设置 @param modifiers 描述符 @param i 索引 0-7 @param bool 要设置的值 @return 新的描述符
[ "一个byte可以存8个boolean,可以按位设置" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CodecUtils.java#L284-L292
zxing/zxing
core/src/main/java/com/google/zxing/common/detector/WhiteRectangleDetector.java
WhiteRectangleDetector.containsBlackPoint
private boolean containsBlackPoint(int a, int b, int fixed, boolean horizontal) { """ Determines whether a segment contains a black point @param a min value of the scanned coordinate @param b max value of the scanned coordinate @param fixed value of fixed coordinate @param horizontal set to true if scan must be horizontal, false if vertical @return true if a black point has been found, else false. """ if (horizontal) { for (int x = a; x <= b; x++) { if (image.get(x, fixed)) { return true; } } } else { for (int y = a; y <= b; y++) { if (image.get(fixed, y)) { return true; } } } return false; }
java
private boolean containsBlackPoint(int a, int b, int fixed, boolean horizontal) { if (horizontal) { for (int x = a; x <= b; x++) { if (image.get(x, fixed)) { return true; } } } else { for (int y = a; y <= b; y++) { if (image.get(fixed, y)) { return true; } } } return false; }
[ "private", "boolean", "containsBlackPoint", "(", "int", "a", ",", "int", "b", ",", "int", "fixed", ",", "boolean", "horizontal", ")", "{", "if", "(", "horizontal", ")", "{", "for", "(", "int", "x", "=", "a", ";", "x", "<=", "b", ";", "x", "++", "...
Determines whether a segment contains a black point @param a min value of the scanned coordinate @param b max value of the scanned coordinate @param fixed value of fixed coordinate @param horizontal set to true if scan must be horizontal, false if vertical @return true if a black point has been found, else false.
[ "Determines", "whether", "a", "segment", "contains", "a", "black", "point" ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/detector/WhiteRectangleDetector.java#L306-L323
spring-projects/spring-boot
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java
TemplateAvailabilityProviders.getProvider
public TemplateAvailabilityProvider getProvider(String view, ApplicationContext applicationContext) { """ Get the provider that can be used to render the given view. @param view the view to render @param applicationContext the application context @return a {@link TemplateAvailabilityProvider} or null """ Assert.notNull(applicationContext, "ApplicationContext must not be null"); return getProvider(view, applicationContext.getEnvironment(), applicationContext.getClassLoader(), applicationContext); }
java
public TemplateAvailabilityProvider getProvider(String view, ApplicationContext applicationContext) { Assert.notNull(applicationContext, "ApplicationContext must not be null"); return getProvider(view, applicationContext.getEnvironment(), applicationContext.getClassLoader(), applicationContext); }
[ "public", "TemplateAvailabilityProvider", "getProvider", "(", "String", "view", ",", "ApplicationContext", "applicationContext", ")", "{", "Assert", ".", "notNull", "(", "applicationContext", ",", "\"ApplicationContext must not be null\"", ")", ";", "return", "getProvider",...
Get the provider that can be used to render the given view. @param view the view to render @param applicationContext the application context @return a {@link TemplateAvailabilityProvider} or null
[ "Get", "the", "provider", "that", "can", "be", "used", "to", "render", "the", "given", "view", "." ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java#L116-L121
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/views/Projection.java
Projection.toProjectedPixels
public PointL toProjectedPixels(final double latitude, final double longitude, final PointL reuse) { """ Performs only the first computationally heavy part of the projection. Call {@link #getLongPixelsFromProjected(PointL, double, boolean, PointL)} to get the final position. @param latitude the latitute of the point @param longitude the longitude of the point @param reuse just pass null if you do not have a PointL to be 'recycled'. @return intermediate value to be stored and passed to toMapPixelsTranslated. """ return toProjectedPixels(latitude, longitude, true, reuse); }
java
public PointL toProjectedPixels(final double latitude, final double longitude, final PointL reuse) { return toProjectedPixels(latitude, longitude, true, reuse); }
[ "public", "PointL", "toProjectedPixels", "(", "final", "double", "latitude", ",", "final", "double", "longitude", ",", "final", "PointL", "reuse", ")", "{", "return", "toProjectedPixels", "(", "latitude", ",", "longitude", ",", "true", ",", "reuse", ")", ";", ...
Performs only the first computationally heavy part of the projection. Call {@link #getLongPixelsFromProjected(PointL, double, boolean, PointL)} to get the final position. @param latitude the latitute of the point @param longitude the longitude of the point @param reuse just pass null if you do not have a PointL to be 'recycled'. @return intermediate value to be stored and passed to toMapPixelsTranslated.
[ "Performs", "only", "the", "first", "computationally", "heavy", "part", "of", "the", "projection", ".", "Call", "{", "@link", "#getLongPixelsFromProjected", "(", "PointL", "double", "boolean", "PointL", ")", "}", "to", "get", "the", "final", "position", "." ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/Projection.java#L269-L271
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java
TraceNLS.getStringFromBundle
public static String getStringFromBundle(Class<?> caller, String bundleName, String key, String defaultString) { """ Retrieve the localized text corresponding to the specified key in the specified ResourceBundle. If the text cannot be found for any reason, the defaultString is returned. If an error is encountered, an appropriate error message is returned instead. <p> @param caller Class object calling this method @param bundleName the fully qualified name of the ResourceBundle. Must not be null. @param key the key to use in the ResourceBundle lookup. Must not be null. @param defaultString text to return if text cannot be found. Must not be null. @return the value corresponding to the specified key in the specified ResourceBundle, or the appropriate non-null error message. """ if (resolver == null) resolver = TraceNLSResolver.getInstance(); return resolver.getMessage(caller, null, bundleName, key, null, defaultString, false, null, false); }
java
public static String getStringFromBundle(Class<?> caller, String bundleName, String key, String defaultString) { if (resolver == null) resolver = TraceNLSResolver.getInstance(); return resolver.getMessage(caller, null, bundleName, key, null, defaultString, false, null, false); }
[ "public", "static", "String", "getStringFromBundle", "(", "Class", "<", "?", ">", "caller", ",", "String", "bundleName", ",", "String", "key", ",", "String", "defaultString", ")", "{", "if", "(", "resolver", "==", "null", ")", "resolver", "=", "TraceNLSResol...
Retrieve the localized text corresponding to the specified key in the specified ResourceBundle. If the text cannot be found for any reason, the defaultString is returned. If an error is encountered, an appropriate error message is returned instead. <p> @param caller Class object calling this method @param bundleName the fully qualified name of the ResourceBundle. Must not be null. @param key the key to use in the ResourceBundle lookup. Must not be null. @param defaultString text to return if text cannot be found. Must not be null. @return the value corresponding to the specified key in the specified ResourceBundle, or the appropriate non-null error message.
[ "Retrieve", "the", "localized", "text", "corresponding", "to", "the", "specified", "key", "in", "the", "specified", "ResourceBundle", ".", "If", "the", "text", "cannot", "be", "found", "for", "any", "reason", "the", "defaultString", "is", "returned", ".", "If"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java#L288-L293
guardtime/ksi-java-sdk
ksi-api/src/main/java/com/guardtime/ksi/KSIBuilder.java
KSIBuilder.setPublicationsFilePkiTrustStore
public KSIBuilder setPublicationsFilePkiTrustStore(File file, String password) throws KSIException { """ Loads the {@link KeyStore} from the file system and sets the {@link KeyStore} to be used as a truststore to verify the certificate that was used to sign the publications file. @param file keystore file on disk, not null. @param password password of the keystore, null if keystore isn't protected by password. @return Instance of {@link KSIBuilder}. @throws KSIException when any error occurs. """ if (file == null) { throw new KSIException("Invalid input parameter. Trust store file is null"); } FileInputStream input = null; try { this.trustStore = KeyStore.getInstance("JKS"); char[] passwordCharArray = password == null ? null : password.toCharArray(); input = new FileInputStream(file); trustStore.load(input, passwordCharArray); } catch (GeneralSecurityException | IOException e) { throw new KSIException("Loading java key store with path " + file + " failed", e); } finally { Util.closeQuietly(input); } return this; }
java
public KSIBuilder setPublicationsFilePkiTrustStore(File file, String password) throws KSIException { if (file == null) { throw new KSIException("Invalid input parameter. Trust store file is null"); } FileInputStream input = null; try { this.trustStore = KeyStore.getInstance("JKS"); char[] passwordCharArray = password == null ? null : password.toCharArray(); input = new FileInputStream(file); trustStore.load(input, passwordCharArray); } catch (GeneralSecurityException | IOException e) { throw new KSIException("Loading java key store with path " + file + " failed", e); } finally { Util.closeQuietly(input); } return this; }
[ "public", "KSIBuilder", "setPublicationsFilePkiTrustStore", "(", "File", "file", ",", "String", "password", ")", "throws", "KSIException", "{", "if", "(", "file", "==", "null", ")", "{", "throw", "new", "KSIException", "(", "\"Invalid input parameter. Trust store file...
Loads the {@link KeyStore} from the file system and sets the {@link KeyStore} to be used as a truststore to verify the certificate that was used to sign the publications file. @param file keystore file on disk, not null. @param password password of the keystore, null if keystore isn't protected by password. @return Instance of {@link KSIBuilder}. @throws KSIException when any error occurs.
[ "Loads", "the", "{", "@link", "KeyStore", "}", "from", "the", "file", "system", "and", "sets", "the", "{", "@link", "KeyStore", "}", "to", "be", "used", "as", "a", "truststore", "to", "verify", "the", "certificate", "that", "was", "used", "to", "sign", ...
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/KSIBuilder.java#L191-L207
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java
StringUtil.quoteString
static String quoteString(String source, char quote) { """ Quote a string so that it can be used as an identifier or a string literal in SQL statements. Identifiers are surrounded by double quotes and string literals are surrounded by single quotes. If the string contains quote characters, they are escaped. @param source the string to quote @param quote the character to quote the string with (' or &quot;) @return a string quoted with the specified quote character @see #quoteStringLiteral(String) @see IdUtil#normalToDelimited(String) """ // Normally, the quoted string is two characters longer than the source // string (because of start quote and end quote). StringBuffer quoted = new StringBuffer(source.length() + 2); quoted.append(quote); for (int i = 0; i < source.length(); i++) { char c = source.charAt(i); // if the character is a quote, escape it with an extra quote if (c == quote) quoted.append(quote); quoted.append(c); } quoted.append(quote); return quoted.toString(); }
java
static String quoteString(String source, char quote) { // Normally, the quoted string is two characters longer than the source // string (because of start quote and end quote). StringBuffer quoted = new StringBuffer(source.length() + 2); quoted.append(quote); for (int i = 0; i < source.length(); i++) { char c = source.charAt(i); // if the character is a quote, escape it with an extra quote if (c == quote) quoted.append(quote); quoted.append(c); } quoted.append(quote); return quoted.toString(); }
[ "static", "String", "quoteString", "(", "String", "source", ",", "char", "quote", ")", "{", "// Normally, the quoted string is two characters longer than the source", "// string (because of start quote and end quote).", "StringBuffer", "quoted", "=", "new", "StringBuffer", "(", ...
Quote a string so that it can be used as an identifier or a string literal in SQL statements. Identifiers are surrounded by double quotes and string literals are surrounded by single quotes. If the string contains quote characters, they are escaped. @param source the string to quote @param quote the character to quote the string with (' or &quot;) @return a string quoted with the specified quote character @see #quoteStringLiteral(String) @see IdUtil#normalToDelimited(String)
[ "Quote", "a", "string", "so", "that", "it", "can", "be", "used", "as", "an", "identifier", "or", "a", "string", "literal", "in", "SQL", "statements", ".", "Identifiers", "are", "surrounded", "by", "double", "quotes", "and", "string", "literals", "are", "su...
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L765-L778
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/StyleSet.java
StyleSet.setAlign
public StyleSet setAlign(HorizontalAlignment halign, VerticalAlignment valign) { """ 设置cell文本对齐样式 @param halign 横向位置 @param valign 纵向位置 @return this @since 4.0.0 """ StyleUtil.setAlign(this.headCellStyle, halign, valign); StyleUtil.setAlign(this.cellStyle, halign, valign); StyleUtil.setAlign(this.cellStyleForNumber, halign, valign); StyleUtil.setAlign(this.cellStyleForDate, halign, valign); return this; }
java
public StyleSet setAlign(HorizontalAlignment halign, VerticalAlignment valign) { StyleUtil.setAlign(this.headCellStyle, halign, valign); StyleUtil.setAlign(this.cellStyle, halign, valign); StyleUtil.setAlign(this.cellStyleForNumber, halign, valign); StyleUtil.setAlign(this.cellStyleForDate, halign, valign); return this; }
[ "public", "StyleSet", "setAlign", "(", "HorizontalAlignment", "halign", ",", "VerticalAlignment", "valign", ")", "{", "StyleUtil", ".", "setAlign", "(", "this", ".", "headCellStyle", ",", "halign", ",", "valign", ")", ";", "StyleUtil", ".", "setAlign", "(", "t...
设置cell文本对齐样式 @param halign 横向位置 @param valign 纵向位置 @return this @since 4.0.0
[ "设置cell文本对齐样式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/StyleSet.java#L114-L120
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ns_savedconfig.java
ns_ns_savedconfig.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ ns_ns_savedconfig_responses result = (ns_ns_savedconfig_responses) service.get_payload_formatter().string_to_resource(ns_ns_savedconfig_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_ns_savedconfig_response_array); } ns_ns_savedconfig[] result_ns_ns_savedconfig = new ns_ns_savedconfig[result.ns_ns_savedconfig_response_array.length]; for(int i = 0; i < result.ns_ns_savedconfig_response_array.length; i++) { result_ns_ns_savedconfig[i] = result.ns_ns_savedconfig_response_array[i].ns_ns_savedconfig[0]; } return result_ns_ns_savedconfig; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_ns_savedconfig_responses result = (ns_ns_savedconfig_responses) service.get_payload_formatter().string_to_resource(ns_ns_savedconfig_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_ns_savedconfig_response_array); } ns_ns_savedconfig[] result_ns_ns_savedconfig = new ns_ns_savedconfig[result.ns_ns_savedconfig_response_array.length]; for(int i = 0; i < result.ns_ns_savedconfig_response_array.length; i++) { result_ns_ns_savedconfig[i] = result.ns_ns_savedconfig_response_array[i].ns_ns_savedconfig[0]; } return result_ns_ns_savedconfig; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "ns_ns_savedconfig_responses", "result", "=", "(", "ns_ns_savedconfig_responses", ")", "service", ".", "get_pa...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ns_savedconfig.java#L203-L220
tango-controls/JTango
client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java
InsertExtractUtils.extractRead
public static <T> T extractRead(final DeviceAttribute da, final AttrDataFormat format, final Class<T> type) throws DevFailed { """ Extract read part values to an object for SCALAR, SPECTRUM and IMAGE to the requested type @param <T> @param da @param type the output type (e.g. double.class for SCALAR, double[].class for SPECTRUM, double[][].class for IMAGE) @return single value for SCALAR, array of primitives for SPECTRUM, 2D array of primitives for IMAGE @throws DevFailed """ if (da == null) { throw DevFailedUtils.newDevFailed(ERROR_MSG_DA); } return TypeConversionUtil.castToType(type, extractRead(da, format)); }
java
public static <T> T extractRead(final DeviceAttribute da, final AttrDataFormat format, final Class<T> type) throws DevFailed { if (da == null) { throw DevFailedUtils.newDevFailed(ERROR_MSG_DA); } return TypeConversionUtil.castToType(type, extractRead(da, format)); }
[ "public", "static", "<", "T", ">", "T", "extractRead", "(", "final", "DeviceAttribute", "da", ",", "final", "AttrDataFormat", "format", ",", "final", "Class", "<", "T", ">", "type", ")", "throws", "DevFailed", "{", "if", "(", "da", "==", "null", ")", "...
Extract read part values to an object for SCALAR, SPECTRUM and IMAGE to the requested type @param <T> @param da @param type the output type (e.g. double.class for SCALAR, double[].class for SPECTRUM, double[][].class for IMAGE) @return single value for SCALAR, array of primitives for SPECTRUM, 2D array of primitives for IMAGE @throws DevFailed
[ "Extract", "read", "part", "values", "to", "an", "object", "for", "SCALAR", "SPECTRUM", "and", "IMAGE", "to", "the", "requested", "type" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java#L124-L130
Whiley/WhileyCompiler
src/main/java/wyil/interpreter/Interpreter.java
Interpreter.executeBlock
private Status executeBlock(Stmt.Block block, CallStack frame, EnclosingScope scope) { """ Execute a given block of statements starting from the beginning. Control may terminate prematurely in a number of situations. For example, when a return or break statement is encountered. @param block --- Statement block to execute @param frame --- The current stack frame @return """ for (int i = 0; i != block.size(); ++i) { Stmt stmt = block.get(i); Status r = executeStatement(stmt, frame, scope); // Now, see whether we are continuing or not if (r != Status.NEXT) { return r; } } return Status.NEXT; }
java
private Status executeBlock(Stmt.Block block, CallStack frame, EnclosingScope scope) { for (int i = 0; i != block.size(); ++i) { Stmt stmt = block.get(i); Status r = executeStatement(stmt, frame, scope); // Now, see whether we are continuing or not if (r != Status.NEXT) { return r; } } return Status.NEXT; }
[ "private", "Status", "executeBlock", "(", "Stmt", ".", "Block", "block", ",", "CallStack", "frame", ",", "EnclosingScope", "scope", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "!=", "block", ".", "size", "(", ")", ";", "++", "i", ")", "{"...
Execute a given block of statements starting from the beginning. Control may terminate prematurely in a number of situations. For example, when a return or break statement is encountered. @param block --- Statement block to execute @param frame --- The current stack frame @return
[ "Execute", "a", "given", "block", "of", "statements", "starting", "from", "the", "beginning", ".", "Control", "may", "terminate", "prematurely", "in", "a", "number", "of", "situations", ".", "For", "example", "when", "a", "return", "or", "break", "statement", ...
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L162-L172
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/MiniMax.java
MiniMax.initializeMatrices
protected static <O> void initializeMatrices(MatrixParadigm mat, ArrayModifiableDBIDs prots, DistanceQuery<O> dq) { """ Initializes the inter-cluster distance matrix of possible merges @param mat Matrix @param dq The distance query """ final DBIDArrayIter ix = mat.ix, iy = mat.iy; final double[] distances = mat.matrix; int pos = 0; for(ix.seek(0); ix.valid(); ix.advance()) { for(iy.seek(0); iy.getOffset() < ix.getOffset(); iy.advance()) { distances[pos] = dq.distance(ix, iy); prots.add(iy); pos++; } } assert (prots.size() == pos); }
java
protected static <O> void initializeMatrices(MatrixParadigm mat, ArrayModifiableDBIDs prots, DistanceQuery<O> dq) { final DBIDArrayIter ix = mat.ix, iy = mat.iy; final double[] distances = mat.matrix; int pos = 0; for(ix.seek(0); ix.valid(); ix.advance()) { for(iy.seek(0); iy.getOffset() < ix.getOffset(); iy.advance()) { distances[pos] = dq.distance(ix, iy); prots.add(iy); pos++; } } assert (prots.size() == pos); }
[ "protected", "static", "<", "O", ">", "void", "initializeMatrices", "(", "MatrixParadigm", "mat", ",", "ArrayModifiableDBIDs", "prots", ",", "DistanceQuery", "<", "O", ">", "dq", ")", "{", "final", "DBIDArrayIter", "ix", "=", "mat", ".", "ix", ",", "iy", "...
Initializes the inter-cluster distance matrix of possible merges @param mat Matrix @param dq The distance query
[ "Initializes", "the", "inter", "-", "cluster", "distance", "matrix", "of", "possible", "merges" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/MiniMax.java#L123-L135
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/message/ParameterFormatter.java
ParameterFormatter.recursiveDeepToString
private static void recursiveDeepToString(final Object o, final StringBuilder str, final Set<String> dejaVu) { """ This method performs a deep toString of the given Object. Primitive arrays are converted using their respective Arrays.toString methods while special handling is implemented for "container types", i.e. Object[], Map and Collection because those could contain themselves. <p> dejaVu is used in case of those container types to prevent an endless recursion. </p> <p> It should be noted that neither AbstractMap.toString() nor AbstractCollection.toString() implement such a behavior. They only check if the container is directly contained in itself, but not if a contained container contains the original one. Because of that, Arrays.toString(Object[]) isn't safe either. Confusing? Just read the last paragraph again and check the respective toString() implementation. </p> <p> This means, in effect, that logging would produce a usable output even if an ordinary System.out.println(o) would produce a relatively hard-to-debug StackOverflowError. </p> @param o the Object to convert into a String @param str the StringBuilder that o will be appended to @param dejaVu a list of container identities that were already used. """ if (appendSpecialTypes(o, str)) { return; } if (isMaybeRecursive(o)) { appendPotentiallyRecursiveValue(o, str, dejaVu); } else { tryObjectToString(o, str); } }
java
private static void recursiveDeepToString(final Object o, final StringBuilder str, final Set<String> dejaVu) { if (appendSpecialTypes(o, str)) { return; } if (isMaybeRecursive(o)) { appendPotentiallyRecursiveValue(o, str, dejaVu); } else { tryObjectToString(o, str); } }
[ "private", "static", "void", "recursiveDeepToString", "(", "final", "Object", "o", ",", "final", "StringBuilder", "str", ",", "final", "Set", "<", "String", ">", "dejaVu", ")", "{", "if", "(", "appendSpecialTypes", "(", "o", ",", "str", ")", ")", "{", "r...
This method performs a deep toString of the given Object. Primitive arrays are converted using their respective Arrays.toString methods while special handling is implemented for "container types", i.e. Object[], Map and Collection because those could contain themselves. <p> dejaVu is used in case of those container types to prevent an endless recursion. </p> <p> It should be noted that neither AbstractMap.toString() nor AbstractCollection.toString() implement such a behavior. They only check if the container is directly contained in itself, but not if a contained container contains the original one. Because of that, Arrays.toString(Object[]) isn't safe either. Confusing? Just read the last paragraph again and check the respective toString() implementation. </p> <p> This means, in effect, that logging would produce a usable output even if an ordinary System.out.println(o) would produce a relatively hard-to-debug StackOverflowError. </p> @param o the Object to convert into a String @param str the StringBuilder that o will be appended to @param dejaVu a list of container identities that were already used.
[ "This", "method", "performs", "a", "deep", "toString", "of", "the", "given", "Object", ".", "Primitive", "arrays", "are", "converted", "using", "their", "respective", "Arrays", ".", "toString", "methods", "while", "special", "handling", "is", "implemented", "for...
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/ParameterFormatter.java#L427-L436
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.createMock
public static synchronized <T> T createMock(Class<T> type, Method... methods) { """ Creates a mock object that supports mocking of final and native methods. @param <T> the type of the mock object @param type the type of the mock object @param methods optionally what methods to mock @return the mock object. """ return doMock(type, false, new DefaultMockStrategy(), null, methods); }
java
public static synchronized <T> T createMock(Class<T> type, Method... methods) { return doMock(type, false, new DefaultMockStrategy(), null, methods); }
[ "public", "static", "synchronized", "<", "T", ">", "T", "createMock", "(", "Class", "<", "T", ">", "type", ",", "Method", "...", "methods", ")", "{", "return", "doMock", "(", "type", ",", "false", ",", "new", "DefaultMockStrategy", "(", ")", ",", "null...
Creates a mock object that supports mocking of final and native methods. @param <T> the type of the mock object @param type the type of the mock object @param methods optionally what methods to mock @return the mock object.
[ "Creates", "a", "mock", "object", "that", "supports", "mocking", "of", "final", "and", "native", "methods", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L83-L85
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java
BaseConvertToMessage.unmarshalRootElement
public Object unmarshalRootElement(Node node, BaseXmlTrxMessageIn soapTrxMessage) throws Exception { """ Create the root element for this message. You SHOULD override this if the unmarshaller has a native method to unmarshall a dom node. @return The root element. """ // Override this! (If you can!) TransformerFactory tFact = TransformerFactory.newInstance(); Source source = new DOMSource(node); Writer writer = new StringWriter(); Result result = new StreamResult(writer); Transformer transformer = tFact.newTransformer(); transformer.transform(source, result); writer.flush(); writer.close(); String strXMLBody = writer.toString(); Reader inStream = new StringReader(strXMLBody); Object msg = this.unmarshalRootElement(inStream, soapTrxMessage); inStream.close(); return msg; }
java
public Object unmarshalRootElement(Node node, BaseXmlTrxMessageIn soapTrxMessage) throws Exception { // Override this! (If you can!) TransformerFactory tFact = TransformerFactory.newInstance(); Source source = new DOMSource(node); Writer writer = new StringWriter(); Result result = new StreamResult(writer); Transformer transformer = tFact.newTransformer(); transformer.transform(source, result); writer.flush(); writer.close(); String strXMLBody = writer.toString(); Reader inStream = new StringReader(strXMLBody); Object msg = this.unmarshalRootElement(inStream, soapTrxMessage); inStream.close(); return msg; }
[ "public", "Object", "unmarshalRootElement", "(", "Node", "node", ",", "BaseXmlTrxMessageIn", "soapTrxMessage", ")", "throws", "Exception", "{", "// Override this! (If you can!)", "TransformerFactory", "tFact", "=", "TransformerFactory", ".", "newInstance", "(", ")", ";", ...
Create the root element for this message. You SHOULD override this if the unmarshaller has a native method to unmarshall a dom node. @return The root element.
[ "Create", "the", "root", "element", "for", "this", "message", ".", "You", "SHOULD", "override", "this", "if", "the", "unmarshaller", "has", "a", "native", "method", "to", "unmarshall", "a", "dom", "node", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java#L105-L128
apache/groovy
src/main/java/org/apache/groovy/util/SystemUtil.java
SystemUtil.getIntegerSafe
public static Integer getIntegerSafe(String name, Integer def) { """ Retrieves an Integer System property @param name the name of the system property. @param def the default value @return value of the Integer system property or false """ try { return Integer.getInteger(name, def); } catch (SecurityException ignore) { // suppress exception } return def; }
java
public static Integer getIntegerSafe(String name, Integer def) { try { return Integer.getInteger(name, def); } catch (SecurityException ignore) { // suppress exception } return def; }
[ "public", "static", "Integer", "getIntegerSafe", "(", "String", "name", ",", "Integer", "def", ")", "{", "try", "{", "return", "Integer", ".", "getInteger", "(", "name", ",", "def", ")", ";", "}", "catch", "(", "SecurityException", "ignore", ")", "{", "/...
Retrieves an Integer System property @param name the name of the system property. @param def the default value @return value of the Integer system property or false
[ "Retrieves", "an", "Integer", "System", "property" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/util/SystemUtil.java#L130-L138
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/LinearClassifier.java
LinearClassifier.getFeatureCountLabelIndices
protected int getFeatureCountLabelIndices(Set<Integer> iLabels, double threshold, boolean useMagnitude) { """ Returns number of features with weight above a certain threshold @param iLabels Set of label indices we care about when counting features Use null to get counts across all labels @param threshold Threshold above which we will count the feature @param useMagnitude Whether the notion of "large" should ignore the sign of the feature weight. @return number of features satisfying the specified conditions """ int n = 0; for (int feat = 0; feat < weights.length; feat++) { for (int labIndex:iLabels) { double thisWeight = (useMagnitude)? Math.abs(weights[feat][labIndex]):weights[feat][labIndex]; if (thisWeight > threshold) { n++; } } } return n; }
java
protected int getFeatureCountLabelIndices(Set<Integer> iLabels, double threshold, boolean useMagnitude) { int n = 0; for (int feat = 0; feat < weights.length; feat++) { for (int labIndex:iLabels) { double thisWeight = (useMagnitude)? Math.abs(weights[feat][labIndex]):weights[feat][labIndex]; if (thisWeight > threshold) { n++; } } } return n; }
[ "protected", "int", "getFeatureCountLabelIndices", "(", "Set", "<", "Integer", ">", "iLabels", ",", "double", "threshold", ",", "boolean", "useMagnitude", ")", "{", "int", "n", "=", "0", ";", "for", "(", "int", "feat", "=", "0", ";", "feat", "<", "weight...
Returns number of features with weight above a certain threshold @param iLabels Set of label indices we care about when counting features Use null to get counts across all labels @param threshold Threshold above which we will count the feature @param useMagnitude Whether the notion of "large" should ignore the sign of the feature weight. @return number of features satisfying the specified conditions
[ "Returns", "number", "of", "features", "with", "weight", "above", "a", "certain", "threshold" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifier.java#L412-L424
alkacon/opencms-core
src/org/opencms/ade/galleries/CmsGalleryService.java
CmsGalleryService.getResourceTypeBeans
private List<CmsResourceTypeBean> getResourceTypeBeans( GalleryMode galleryMode, String referenceSitePath, List<String> resourceTypesList, final List<String> typesForTypeTab) { """ Returns the resource types configured to be used within the given gallery mode.<p> @param galleryMode the gallery mode @param referenceSitePath the reference site-path to check permissions for @param resourceTypesList the resource types parameter @param typesForTypeTab the types which should be shown in the types tab according to the gallery configuration @return the resource types """ List<I_CmsResourceType> resourceTypes = null; Set<String> creatableTypes = null; switch (galleryMode) { case editor: case view: case adeView: case widget: resourceTypes = convertTypeNamesToTypes(resourceTypesList); if (resourceTypes.size() == 0) { resourceTypes = Lists.newArrayList(getDefaultTypesForGallery()); } creatableTypes = Collections.<String> emptySet(); break; case ade: throw new IllegalStateException("This code should never be called"); // ADE case is handled by container page service default: resourceTypes = Collections.<I_CmsResourceType> emptyList(); creatableTypes = Collections.<String> emptySet(); } return buildTypesList(resourceTypes, creatableTypes, Collections.<String> emptySet(), typesForTypeTab); }
java
private List<CmsResourceTypeBean> getResourceTypeBeans( GalleryMode galleryMode, String referenceSitePath, List<String> resourceTypesList, final List<String> typesForTypeTab) { List<I_CmsResourceType> resourceTypes = null; Set<String> creatableTypes = null; switch (galleryMode) { case editor: case view: case adeView: case widget: resourceTypes = convertTypeNamesToTypes(resourceTypesList); if (resourceTypes.size() == 0) { resourceTypes = Lists.newArrayList(getDefaultTypesForGallery()); } creatableTypes = Collections.<String> emptySet(); break; case ade: throw new IllegalStateException("This code should never be called"); // ADE case is handled by container page service default: resourceTypes = Collections.<I_CmsResourceType> emptyList(); creatableTypes = Collections.<String> emptySet(); } return buildTypesList(resourceTypes, creatableTypes, Collections.<String> emptySet(), typesForTypeTab); }
[ "private", "List", "<", "CmsResourceTypeBean", ">", "getResourceTypeBeans", "(", "GalleryMode", "galleryMode", ",", "String", "referenceSitePath", ",", "List", "<", "String", ">", "resourceTypesList", ",", "final", "List", "<", "String", ">", "typesForTypeTab", ")",...
Returns the resource types configured to be used within the given gallery mode.<p> @param galleryMode the gallery mode @param referenceSitePath the reference site-path to check permissions for @param resourceTypesList the resource types parameter @param typesForTypeTab the types which should be shown in the types tab according to the gallery configuration @return the resource types
[ "Returns", "the", "resource", "types", "configured", "to", "be", "used", "within", "the", "given", "gallery", "mode", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsGalleryService.java#L2559-L2586
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java
AppServiceCertificateOrdersInner.createOrUpdateCertificate
public AppServiceCertificateResourceInner createOrUpdateCertificate(String resourceGroupName, String certificateOrderName, String name, AppServiceCertificateResourceInner keyVaultCertificate) { """ Creates or updates a certificate and associates with key vault secret. Creates or updates a certificate and associates with key vault secret. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param name Name of the certificate. @param keyVaultCertificate Key vault certificate resource Id. @throws IllegalArgumentException thrown if parameters fail the validation @throws DefaultErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AppServiceCertificateResourceInner object if successful. """ return createOrUpdateCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name, keyVaultCertificate).toBlocking().last().body(); }
java
public AppServiceCertificateResourceInner createOrUpdateCertificate(String resourceGroupName, String certificateOrderName, String name, AppServiceCertificateResourceInner keyVaultCertificate) { return createOrUpdateCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name, keyVaultCertificate).toBlocking().last().body(); }
[ "public", "AppServiceCertificateResourceInner", "createOrUpdateCertificate", "(", "String", "resourceGroupName", ",", "String", "certificateOrderName", ",", "String", "name", ",", "AppServiceCertificateResourceInner", "keyVaultCertificate", ")", "{", "return", "createOrUpdateCert...
Creates or updates a certificate and associates with key vault secret. Creates or updates a certificate and associates with key vault secret. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param name Name of the certificate. @param keyVaultCertificate Key vault certificate resource Id. @throws IllegalArgumentException thrown if parameters fail the validation @throws DefaultErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AppServiceCertificateResourceInner object if successful.
[ "Creates", "or", "updates", "a", "certificate", "and", "associates", "with", "key", "vault", "secret", ".", "Creates", "or", "updates", "a", "certificate", "and", "associates", "with", "key", "vault", "secret", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L1189-L1191
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/ReloadableType.java
ReloadableType.setField
public void setField(Object instance, String fieldname, boolean isStatic, Object newValue) throws IllegalAccessException { """ Attempt to set the value of a field on an instance to the specified value. @param instance the object upon which to set the field (maybe null for static fields) @param fieldname the name of the field @param isStatic whether the field is static @param newValue the new value to put into the field @throws IllegalAccessException if there is a problem setting the field value """ FieldReaderWriter fieldReaderWriter = locateField(fieldname); if (isStatic && !fieldReaderWriter.isStatic()) { throw new IncompatibleClassChangeError("Expected static field " + fieldReaderWriter.theField.getDeclaringTypeName() + "." + fieldReaderWriter.theField.getName()); } else if (!isStatic && fieldReaderWriter.isStatic()) { throw new IncompatibleClassChangeError("Expected non-static field " + fieldReaderWriter.theField.getDeclaringTypeName() + "." + fieldReaderWriter.theField.getName()); } if (fieldReaderWriter.isStatic()) { fieldReaderWriter.setStaticFieldValue(getClazz(), newValue, null); } else { fieldReaderWriter.setValue(instance, newValue, null); } }
java
public void setField(Object instance, String fieldname, boolean isStatic, Object newValue) throws IllegalAccessException { FieldReaderWriter fieldReaderWriter = locateField(fieldname); if (isStatic && !fieldReaderWriter.isStatic()) { throw new IncompatibleClassChangeError("Expected static field " + fieldReaderWriter.theField.getDeclaringTypeName() + "." + fieldReaderWriter.theField.getName()); } else if (!isStatic && fieldReaderWriter.isStatic()) { throw new IncompatibleClassChangeError("Expected non-static field " + fieldReaderWriter.theField.getDeclaringTypeName() + "." + fieldReaderWriter.theField.getName()); } if (fieldReaderWriter.isStatic()) { fieldReaderWriter.setStaticFieldValue(getClazz(), newValue, null); } else { fieldReaderWriter.setValue(instance, newValue, null); } }
[ "public", "void", "setField", "(", "Object", "instance", ",", "String", "fieldname", ",", "boolean", "isStatic", ",", "Object", "newValue", ")", "throws", "IllegalAccessException", "{", "FieldReaderWriter", "fieldReaderWriter", "=", "locateField", "(", "fieldname", ...
Attempt to set the value of a field on an instance to the specified value. @param instance the object upon which to set the field (maybe null for static fields) @param fieldname the name of the field @param isStatic whether the field is static @param newValue the new value to put into the field @throws IllegalAccessException if there is a problem setting the field value
[ "Attempt", "to", "set", "the", "value", "of", "a", "field", "on", "an", "instance", "to", "the", "specified", "value", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/ReloadableType.java#L1347-L1367
nemerosa/ontrack
ontrack-ui/src/main/java/net/nemerosa/ontrack/boot/ui/BuildController.java
BuildController.createBuildLinkFromForm
@RequestMapping(value = "builds/ { """ Create a link between a build and another, using a form. @param buildId From this build... @return List of builds """buildId}/links", method = RequestMethod.PUT) public Build createBuildLinkFromForm(@PathVariable ID buildId, @RequestBody BuildLinkForm form) { Build build = structureService.getBuild(buildId); structureService.editBuildLinks(build, form); return build; }
java
@RequestMapping(value = "builds/{buildId}/links", method = RequestMethod.PUT) public Build createBuildLinkFromForm(@PathVariable ID buildId, @RequestBody BuildLinkForm form) { Build build = structureService.getBuild(buildId); structureService.editBuildLinks(build, form); return build; }
[ "@", "RequestMapping", "(", "value", "=", "\"builds/{buildId}/links\"", ",", "method", "=", "RequestMethod", ".", "PUT", ")", "public", "Build", "createBuildLinkFromForm", "(", "@", "PathVariable", "ID", "buildId", ",", "@", "RequestBody", "BuildLinkForm", "form", ...
Create a link between a build and another, using a form. @param buildId From this build... @return List of builds
[ "Create", "a", "link", "between", "a", "build", "and", "another", "using", "a", "form", "." ]
train
https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-ui/src/main/java/net/nemerosa/ontrack/boot/ui/BuildController.java#L301-L306
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java
KickflipApiClient.getUserInfo
public void getUserInfo(String username, final KickflipCallback cb) { """ Get public user info @param username The Kickflip user's username @param cb This callback will receive a User in {@link io.kickflip.sdk.api.KickflipCallback#onSuccess(io.kickflip.sdk.api.json.Response)} or an Exception {@link io.kickflip.sdk.api.KickflipCallback#onError(io.kickflip.sdk.exception.KickflipException)}. """ if (!assertActiveUserAvailable(cb)) return; GenericData data = new GenericData(); data.put("username", username); post(GET_USER_PUBLIC, new UrlEncodedContent(data), User.class, new KickflipCallback() { @Override public void onSuccess(final Response response) { if (VERBOSE) Log.i(TAG, "getUserInfo response: " + response); postResponseToCallback(cb, response); } @Override public void onError(final KickflipException error) { Log.w(TAG, "getUserInfo Error: " + error); postExceptionToCallback(cb, error); } }); }
java
public void getUserInfo(String username, final KickflipCallback cb) { if (!assertActiveUserAvailable(cb)) return; GenericData data = new GenericData(); data.put("username", username); post(GET_USER_PUBLIC, new UrlEncodedContent(data), User.class, new KickflipCallback() { @Override public void onSuccess(final Response response) { if (VERBOSE) Log.i(TAG, "getUserInfo response: " + response); postResponseToCallback(cb, response); } @Override public void onError(final KickflipException error) { Log.w(TAG, "getUserInfo Error: " + error); postExceptionToCallback(cb, error); } }); }
[ "public", "void", "getUserInfo", "(", "String", "username", ",", "final", "KickflipCallback", "cb", ")", "{", "if", "(", "!", "assertActiveUserAvailable", "(", "cb", ")", ")", "return", ";", "GenericData", "data", "=", "new", "GenericData", "(", ")", ";", ...
Get public user info @param username The Kickflip user's username @param cb This callback will receive a User in {@link io.kickflip.sdk.api.KickflipCallback#onSuccess(io.kickflip.sdk.api.json.Response)} or an Exception {@link io.kickflip.sdk.api.KickflipCallback#onError(io.kickflip.sdk.exception.KickflipException)}.
[ "Get", "public", "user", "info" ]
train
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L284-L303
google/closure-compiler
src/com/google/javascript/jscomp/TypeValidator.java
TypeValidator.expectSuperType
void expectSuperType(Node n, ObjectType superObject, ObjectType subObject) { """ Expect that the first type is the direct superclass of the second type. @param t The node traversal. @param n The node where warnings should point to. @param superObject The expected super instance type. @param subObject The sub instance type. """ FunctionType subCtor = subObject.getConstructor(); ObjectType implicitProto = subObject.getImplicitPrototype(); ObjectType declaredSuper = implicitProto == null ? null : implicitProto.getImplicitPrototype(); if (declaredSuper != null && declaredSuper.isTemplatizedType()) { declaredSuper = declaredSuper.toMaybeTemplatizedType().getReferencedType(); } if (declaredSuper != null && !(superObject instanceof UnknownType) && !declaredSuper.isEquivalentTo(superObject)) { if (declaredSuper.isEquivalentTo(getNativeType(OBJECT_TYPE))) { registerMismatch( superObject, declaredSuper, report(JSError.make(n, MISSING_EXTENDS_TAG_WARNING, subObject.toString()))); } else { mismatch(n, "mismatch in declaration of superclass type", superObject, declaredSuper); } // Correct the super type. if (!subCtor.hasCachedValues()) { subCtor.setPrototypeBasedOn(superObject); } } }
java
void expectSuperType(Node n, ObjectType superObject, ObjectType subObject) { FunctionType subCtor = subObject.getConstructor(); ObjectType implicitProto = subObject.getImplicitPrototype(); ObjectType declaredSuper = implicitProto == null ? null : implicitProto.getImplicitPrototype(); if (declaredSuper != null && declaredSuper.isTemplatizedType()) { declaredSuper = declaredSuper.toMaybeTemplatizedType().getReferencedType(); } if (declaredSuper != null && !(superObject instanceof UnknownType) && !declaredSuper.isEquivalentTo(superObject)) { if (declaredSuper.isEquivalentTo(getNativeType(OBJECT_TYPE))) { registerMismatch( superObject, declaredSuper, report(JSError.make(n, MISSING_EXTENDS_TAG_WARNING, subObject.toString()))); } else { mismatch(n, "mismatch in declaration of superclass type", superObject, declaredSuper); } // Correct the super type. if (!subCtor.hasCachedValues()) { subCtor.setPrototypeBasedOn(superObject); } } }
[ "void", "expectSuperType", "(", "Node", "n", ",", "ObjectType", "superObject", ",", "ObjectType", "subObject", ")", "{", "FunctionType", "subCtor", "=", "subObject", ".", "getConstructor", "(", ")", ";", "ObjectType", "implicitProto", "=", "subObject", ".", "get...
Expect that the first type is the direct superclass of the second type. @param t The node traversal. @param n The node where warnings should point to. @param superObject The expected super instance type. @param subObject The sub instance type.
[ "Expect", "that", "the", "first", "type", "is", "the", "direct", "superclass", "of", "the", "second", "type", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L679-L705
KyoriPowered/text
api/src/main/java/net/kyori/text/TextComponent.java
TextComponent.of
public static TextComponent of(final @NonNull String content, final @Nullable TextColor color, final @NonNull Set<TextDecoration> decorations) { """ Creates a text component with content, and optional color and decorations. @param content the plain text content @param color the color @param decorations the decorations @return the text component """ return builder(content).color(color).decorations(decorations, true).build(); }
java
public static TextComponent of(final @NonNull String content, final @Nullable TextColor color, final @NonNull Set<TextDecoration> decorations) { return builder(content).color(color).decorations(decorations, true).build(); }
[ "public", "static", "TextComponent", "of", "(", "final", "@", "NonNull", "String", "content", ",", "final", "@", "Nullable", "TextColor", "color", ",", "final", "@", "NonNull", "Set", "<", "TextDecoration", ">", "decorations", ")", "{", "return", "builder", ...
Creates a text component with content, and optional color and decorations. @param content the plain text content @param color the color @param decorations the decorations @return the text component
[ "Creates", "a", "text", "component", "with", "content", "and", "optional", "color", "and", "decorations", "." ]
train
https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/TextComponent.java#L177-L179
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/SymbolRegistry.java
SymbolRegistry.resolveSymbolicString
String resolveSymbolicString(String symbolicPath) { """ Resolves the given string, evaluating all symbols, and path-normalizes the value. @param symbolicPath @return The resolved value, path-normalized. """ if (symbolicPath == null) throw new NullPointerException("Path must be non-null"); return resolveStringSymbols(symbolicPath, symbolicPath, true, 0, true); }
java
String resolveSymbolicString(String symbolicPath) { if (symbolicPath == null) throw new NullPointerException("Path must be non-null"); return resolveStringSymbols(symbolicPath, symbolicPath, true, 0, true); }
[ "String", "resolveSymbolicString", "(", "String", "symbolicPath", ")", "{", "if", "(", "symbolicPath", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"Path must be non-null\"", ")", ";", "return", "resolveStringSymbols", "(", "symbolicPath", ",", ...
Resolves the given string, evaluating all symbols, and path-normalizes the value. @param symbolicPath @return The resolved value, path-normalized.
[ "Resolves", "the", "given", "string", "evaluating", "all", "symbols", "and", "path", "-", "normalizes", "the", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/SymbolRegistry.java#L200-L205
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java
base_resource.unset_resource
protected base_response unset_resource(nitro_service service, String args[]) throws Exception { """ Use this method to perform an Unset operation on netscaler resource. @param service nitro_service object. @param args Array of args that are to be unset. @return status of the operation performed. @throws Exception Nitro exception is thrown. """ if (!service.isLogin() && !get_object_type().equals("login")) service.login(); options option = new options(); option.set_action("unset"); base_response response = unset_request(service, option, args); return response; }
java
protected base_response unset_resource(nitro_service service, String args[]) throws Exception { if (!service.isLogin() && !get_object_type().equals("login")) service.login(); options option = new options(); option.set_action("unset"); base_response response = unset_request(service, option, args); return response; }
[ "protected", "base_response", "unset_resource", "(", "nitro_service", "service", ",", "String", "args", "[", "]", ")", "throws", "Exception", "{", "if", "(", "!", "service", ".", "isLogin", "(", ")", "&&", "!", "get_object_type", "(", ")", ".", "equals", "...
Use this method to perform an Unset operation on netscaler resource. @param service nitro_service object. @param args Array of args that are to be unset. @return status of the operation performed. @throws Exception Nitro exception is thrown.
[ "Use", "this", "method", "to", "perform", "an", "Unset", "operation", "on", "netscaler", "resource", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java#L477-L486
gallandarakhneorg/afc
advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java
DBaseFileAttributePool.getCollection
@Pure public static DBaseFileAttributeCollection getCollection(File dbaseFile, int recordNumber) { """ Get an attribute container that corresponds to the specified file. @param dbaseFile is the file to read @param recordNumber is the index of the record inside the file ({@code 0..size-1}). @return a container or <code>null</code> on error """ final DBaseFileAttributePool pool = getPool(dbaseFile); if (pool != null) { final DBaseFileAttributeAccessor accessor = pool.getAccessor(recordNumber); if (accessor != null) { return new DBaseFileAttributeCollection(accessor); } } return null; }
java
@Pure public static DBaseFileAttributeCollection getCollection(File dbaseFile, int recordNumber) { final DBaseFileAttributePool pool = getPool(dbaseFile); if (pool != null) { final DBaseFileAttributeAccessor accessor = pool.getAccessor(recordNumber); if (accessor != null) { return new DBaseFileAttributeCollection(accessor); } } return null; }
[ "@", "Pure", "public", "static", "DBaseFileAttributeCollection", "getCollection", "(", "File", "dbaseFile", ",", "int", "recordNumber", ")", "{", "final", "DBaseFileAttributePool", "pool", "=", "getPool", "(", "dbaseFile", ")", ";", "if", "(", "pool", "!=", "nul...
Get an attribute container that corresponds to the specified file. @param dbaseFile is the file to read @param recordNumber is the index of the record inside the file ({@code 0..size-1}). @return a container or <code>null</code> on error
[ "Get", "an", "attribute", "container", "that", "corresponds", "to", "the", "specified", "file", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java#L276-L286
javabeanz/owasp-security-logging
owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/SecurityUtil.java
SecurityUtil.bindSystemStreamsToSLF4J
public static void bindSystemStreamsToSLF4J() { """ Redirect <code>System.out</code> and <code>System.err</code> streams to SLF4J logger. This is a benefit if you have a legacy console logger application. Does not provide benefit of a full implementation. For example, no hierarchical or logger inheritence support but there are some ancilarity benefits like, 1) capturing messages that would otherwise be lost, 2) redirecting console messages to centralized log services, 3) formatting console messages in other types of output (e.g., HTML). """ // Enable autoflush System.setOut(new PrintStream(new OutputStreamRedirector(sysOutLogger, false), true)); System.setErr(new PrintStream(new OutputStreamRedirector(sysErrLogger, true), true)); }
java
public static void bindSystemStreamsToSLF4J() { // Enable autoflush System.setOut(new PrintStream(new OutputStreamRedirector(sysOutLogger, false), true)); System.setErr(new PrintStream(new OutputStreamRedirector(sysErrLogger, true), true)); }
[ "public", "static", "void", "bindSystemStreamsToSLF4J", "(", ")", "{", "// Enable autoflush", "System", ".", "setOut", "(", "new", "PrintStream", "(", "new", "OutputStreamRedirector", "(", "sysOutLogger", ",", "false", ")", ",", "true", ")", ")", ";", "System", ...
Redirect <code>System.out</code> and <code>System.err</code> streams to SLF4J logger. This is a benefit if you have a legacy console logger application. Does not provide benefit of a full implementation. For example, no hierarchical or logger inheritence support but there are some ancilarity benefits like, 1) capturing messages that would otherwise be lost, 2) redirecting console messages to centralized log services, 3) formatting console messages in other types of output (e.g., HTML).
[ "Redirect", "<code", ">", "System", ".", "out<", "/", "code", ">", "and", "<code", ">", "System", ".", "err<", "/", "code", ">", "streams", "to", "SLF4J", "logger", ".", "This", "is", "a", "benefit", "if", "you", "have", "a", "legacy", "console", "lo...
train
https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/SecurityUtil.java#L36-L40
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/resource/Import.java
Import.addDataPointSet
public void addDataPointSet(String series, Set<DataPoint> dataPoints) { """ Adds a set of `DataPoint`s to a series. @param series The series the DataPoints should be added to. If the series doesn't exist, it will be created. @param dataPoints Data to be added. """ DataSet set = store.get(series); if (set == null) { set = new DataSet(dataPoints); store.put(series, set); } else { set.addAll(dataPoints); } }
java
public void addDataPointSet(String series, Set<DataPoint> dataPoints) { DataSet set = store.get(series); if (set == null) { set = new DataSet(dataPoints); store.put(series, set); } else { set.addAll(dataPoints); } }
[ "public", "void", "addDataPointSet", "(", "String", "series", ",", "Set", "<", "DataPoint", ">", "dataPoints", ")", "{", "DataSet", "set", "=", "store", ".", "get", "(", "series", ")", ";", "if", "(", "set", "==", "null", ")", "{", "set", "=", "new",...
Adds a set of `DataPoint`s to a series. @param series The series the DataPoints should be added to. If the series doesn't exist, it will be created. @param dataPoints Data to be added.
[ "Adds", "a", "set", "of", "DataPoint", "s", "to", "a", "series", "." ]
train
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/resource/Import.java#L135-L143
jenkinsci/jenkins
core/src/main/java/jenkins/util/ProgressiveRendering.java
ProgressiveRendering.createMockRequest
@java.lang.SuppressWarnings( { """ Copies important fields from the current HTTP request and makes them available during {@link #compute}. This is necessary because some model methods such as {@link AbstractItem#getUrl} behave differently when called from a request. """"rawtypes", "unchecked"}) // public RequestImpl ctor requires List<AncestorImpl> yet AncestorImpl is not public! API design flaw private static RequestImpl createMockRequest() { RequestImpl currentRequest = (RequestImpl) Stapler.getCurrentRequest(); HttpServletRequest original = (HttpServletRequest) currentRequest.getRequest(); final Map<String,Object> getters = new HashMap<>(); for (Method method : HttpServletRequest.class.getMethods()) { String m = method.getName(); if ((m.startsWith("get") || m.startsWith("is")) && method.getParameterTypes().length == 0) { Class<?> type = method.getReturnType(); // TODO could add other types which are known to be safe to copy: Cookie[], Principal, HttpSession, etc. if (type.isPrimitive() || type == String.class || type == Locale.class) { try { getters.put(m, method.invoke(original)); } catch (Exception x) { LOG.log(Level.WARNING, "cannot mock Stapler request " + method, x); } } } } List/*<AncestorImpl>*/ ancestors = currentRequest.ancestors; LOG.log(Level.FINER, "mocking ancestors {0} using {1}", new Object[] {ancestors, getters}); TokenList tokens = currentRequest.tokens; return new RequestImpl(Stapler.getCurrent(), (HttpServletRequest) Proxy.newProxyInstance(ProgressiveRendering.class.getClassLoader(), new Class<?>[] {HttpServletRequest.class}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String m = method.getName(); if (getters.containsKey(m)) { return getters.get(m); } else { // TODO implement other methods as needed throw new UnsupportedOperationException(m); } } }), ancestors, tokens); }
java
@java.lang.SuppressWarnings({"rawtypes", "unchecked"}) // public RequestImpl ctor requires List<AncestorImpl> yet AncestorImpl is not public! API design flaw private static RequestImpl createMockRequest() { RequestImpl currentRequest = (RequestImpl) Stapler.getCurrentRequest(); HttpServletRequest original = (HttpServletRequest) currentRequest.getRequest(); final Map<String,Object> getters = new HashMap<>(); for (Method method : HttpServletRequest.class.getMethods()) { String m = method.getName(); if ((m.startsWith("get") || m.startsWith("is")) && method.getParameterTypes().length == 0) { Class<?> type = method.getReturnType(); // TODO could add other types which are known to be safe to copy: Cookie[], Principal, HttpSession, etc. if (type.isPrimitive() || type == String.class || type == Locale.class) { try { getters.put(m, method.invoke(original)); } catch (Exception x) { LOG.log(Level.WARNING, "cannot mock Stapler request " + method, x); } } } } List/*<AncestorImpl>*/ ancestors = currentRequest.ancestors; LOG.log(Level.FINER, "mocking ancestors {0} using {1}", new Object[] {ancestors, getters}); TokenList tokens = currentRequest.tokens; return new RequestImpl(Stapler.getCurrent(), (HttpServletRequest) Proxy.newProxyInstance(ProgressiveRendering.class.getClassLoader(), new Class<?>[] {HttpServletRequest.class}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String m = method.getName(); if (getters.containsKey(m)) { return getters.get(m); } else { // TODO implement other methods as needed throw new UnsupportedOperationException(m); } } }), ancestors, tokens); }
[ "@", "java", ".", "lang", ".", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "// public RequestImpl ctor requires List<AncestorImpl> yet AncestorImpl is not public! API design flaw", "private", "static", "RequestImpl", "createMockRequest", "(", "...
Copies important fields from the current HTTP request and makes them available during {@link #compute}. This is necessary because some model methods such as {@link AbstractItem#getUrl} behave differently when called from a request.
[ "Copies", "important", "fields", "from", "the", "current", "HTTP", "request", "and", "makes", "them", "available", "during", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/util/ProgressiveRendering.java#L160-L192
dmerkushov/log-helper
src/main/java/ru/dmerkushov/loghelper/LogHelperDebug.java
LogHelperDebug.printError
public static void printError (String message, boolean force) { """ Print a message to <code>System.err</code>, with an every-line prefix: "log-helper ERROR: " @param message @param force <code>true</code> if we need to override the debug enabled flag (i.e. the message is REALLY important), <code>false</code> otherwise """ if (isDebugEnabled () || force) { String toOutput = "log-helper ERROR: " + message.replaceAll ("\n", "\nlog-helper ERROR: "); System.err.println (toOutput); } }
java
public static void printError (String message, boolean force) { if (isDebugEnabled () || force) { String toOutput = "log-helper ERROR: " + message.replaceAll ("\n", "\nlog-helper ERROR: "); System.err.println (toOutput); } }
[ "public", "static", "void", "printError", "(", "String", "message", ",", "boolean", "force", ")", "{", "if", "(", "isDebugEnabled", "(", ")", "||", "force", ")", "{", "String", "toOutput", "=", "\"log-helper ERROR: \"", "+", "message", ".", "replaceAll", "("...
Print a message to <code>System.err</code>, with an every-line prefix: "log-helper ERROR: " @param message @param force <code>true</code> if we need to override the debug enabled flag (i.e. the message is REALLY important), <code>false</code> otherwise
[ "Print", "a", "message", "to", "<code", ">", "System", ".", "err<", "/", "code", ">", "with", "an", "every", "-", "line", "prefix", ":", "log", "-", "helper", "ERROR", ":" ]
train
https://github.com/dmerkushov/log-helper/blob/3b7d3d30faa7f1437b27cd07c10fa579a995de23/src/main/java/ru/dmerkushov/loghelper/LogHelperDebug.java#L64-L69
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
DTMDefaultBase.getTypedFirstChild
public int getTypedFirstChild(int nodeHandle, int nodeType) { """ Given a node handle, get the handle of the node's first child. If not yet resolved, waits for more nodes to be added to the document and tries again. @param nodeHandle int Handle of the node. @return int DTM node-number of first child, or DTM.NULL to indicate none exists. """ int firstChild, eType; if (nodeType < DTM.NTYPES) { for (firstChild = _firstch(makeNodeIdentity(nodeHandle)); firstChild != DTM.NULL; firstChild = _nextsib(firstChild)) { eType = _exptype(firstChild); if (eType == nodeType || (eType >= DTM.NTYPES && m_expandedNameTable.getType(eType) == nodeType)) { return makeNodeHandle(firstChild); } } } else { for (firstChild = _firstch(makeNodeIdentity(nodeHandle)); firstChild != DTM.NULL; firstChild = _nextsib(firstChild)) { if (_exptype(firstChild) == nodeType) { return makeNodeHandle(firstChild); } } } return DTM.NULL; }
java
public int getTypedFirstChild(int nodeHandle, int nodeType) { int firstChild, eType; if (nodeType < DTM.NTYPES) { for (firstChild = _firstch(makeNodeIdentity(nodeHandle)); firstChild != DTM.NULL; firstChild = _nextsib(firstChild)) { eType = _exptype(firstChild); if (eType == nodeType || (eType >= DTM.NTYPES && m_expandedNameTable.getType(eType) == nodeType)) { return makeNodeHandle(firstChild); } } } else { for (firstChild = _firstch(makeNodeIdentity(nodeHandle)); firstChild != DTM.NULL; firstChild = _nextsib(firstChild)) { if (_exptype(firstChild) == nodeType) { return makeNodeHandle(firstChild); } } } return DTM.NULL; }
[ "public", "int", "getTypedFirstChild", "(", "int", "nodeHandle", ",", "int", "nodeType", ")", "{", "int", "firstChild", ",", "eType", ";", "if", "(", "nodeType", "<", "DTM", ".", "NTYPES", ")", "{", "for", "(", "firstChild", "=", "_firstch", "(", "makeNo...
Given a node handle, get the handle of the node's first child. If not yet resolved, waits for more nodes to be added to the document and tries again. @param nodeHandle int Handle of the node. @return int DTM node-number of first child, or DTM.NULL to indicate none exists.
[ "Given", "a", "node", "handle", "get", "the", "handle", "of", "the", "node", "s", "first", "child", ".", "If", "not", "yet", "resolved", "waits", "for", "more", "nodes", "to", "be", "added", "to", "the", "document", "and", "tries", "again", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L986-L1011
actorapp/droidkit-actors
actors/src/main/java/com/droidkit/actors/mailbox/Mailbox.java
Mailbox.isEqualEnvelope
protected boolean isEqualEnvelope(Envelope a, Envelope b) { """ Override this if you need to change filtering for scheduleOnce behaviour. By default it check equality only of class names. @param a @param b @return is equal """ return a.getMessage().getClass() == b.getMessage().getClass(); }
java
protected boolean isEqualEnvelope(Envelope a, Envelope b) { return a.getMessage().getClass() == b.getMessage().getClass(); }
[ "protected", "boolean", "isEqualEnvelope", "(", "Envelope", "a", ",", "Envelope", "b", ")", "{", "return", "a", ".", "getMessage", "(", ")", ".", "getClass", "(", ")", "==", "b", ".", "getMessage", "(", ")", ".", "getClass", "(", ")", ";", "}" ]
Override this if you need to change filtering for scheduleOnce behaviour. By default it check equality only of class names. @param a @param b @return is equal
[ "Override", "this", "if", "you", "need", "to", "change", "filtering", "for", "scheduleOnce", "behaviour", ".", "By", "default", "it", "check", "equality", "only", "of", "class", "names", "." ]
train
https://github.com/actorapp/droidkit-actors/blob/fdb72fcfdd1c5e54a970f203a33a71fa54344217/actors/src/main/java/com/droidkit/actors/mailbox/Mailbox.java#L91-L93
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/storage/StorageUtil.java
StorageUtil.withStream
public static ResourceMeta withStream(final HasInputStream stream, final Map<String, String> meta) { """ @return Construct a resource @param stream stream @param meta metadata """ return new BaseStreamResource(meta,stream); }
java
public static ResourceMeta withStream(final HasInputStream stream, final Map<String, String> meta) { return new BaseStreamResource(meta,stream); }
[ "public", "static", "ResourceMeta", "withStream", "(", "final", "HasInputStream", "stream", ",", "final", "Map", "<", "String", ",", "String", ">", "meta", ")", "{", "return", "new", "BaseStreamResource", "(", "meta", ",", "stream", ")", ";", "}" ]
@return Construct a resource @param stream stream @param meta metadata
[ "@return", "Construct", "a", "resource" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/storage/StorageUtil.java#L100-L102
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/StopWatchFactory.java
StopWatchFactory.create
public static IStopWatch create() { """ Returns an uninitialized stopwatch instance. @return An uninitialized stopwatch instance. Will be null if the factory has not been initialized. """ if (factory == null) { throw new IllegalStateException("No stopwatch factory registered."); } try { return factory.clazz.newInstance(); } catch (Exception e) { throw new RuntimeException("Could not create stopwatch instance.", e); } }
java
public static IStopWatch create() { if (factory == null) { throw new IllegalStateException("No stopwatch factory registered."); } try { return factory.clazz.newInstance(); } catch (Exception e) { throw new RuntimeException("Could not create stopwatch instance.", e); } }
[ "public", "static", "IStopWatch", "create", "(", ")", "{", "if", "(", "factory", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"No stopwatch factory registered.\"", ")", ";", "}", "try", "{", "return", "factory", ".", "clazz", ".", ...
Returns an uninitialized stopwatch instance. @return An uninitialized stopwatch instance. Will be null if the factory has not been initialized.
[ "Returns", "an", "uninitialized", "stopwatch", "instance", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/StopWatchFactory.java#L91-L101
revelc/formatter-maven-plugin
src/main/java/net/revelc/code/formatter/FormatterMojo.java
FormatterMojo.getOptionsFromPropertiesFile
private Map<String, String> getOptionsFromPropertiesFile(String newPropertiesFile) throws MojoExecutionException { """ Read properties file and return the properties as {@link Map}. @return the options from properties file or null if not properties file found @throws MojoExecutionException the mojo execution exception """ this.getLog().debug("Using search path at: " + this.basedir.getAbsolutePath()); this.resourceManager.addSearchPath(FileResourceLoader.ID, this.basedir.getAbsolutePath()); Properties properties = new Properties(); try { properties.load(this.resourceManager.getResourceAsInputStream(newPropertiesFile)); } catch (ResourceNotFoundException e) { getLog().debug("Property file [" + newPropertiesFile + "] cannot be found", e); return new HashMap<>(); } catch (IOException e) { throw new MojoExecutionException("Cannot read config file [" + newPropertiesFile + "]", e); } final Map<String, String> map = new HashMap<>(); for (final String name : properties.stringPropertyNames()) { map.put(name, properties.getProperty(name)); } return map; }
java
private Map<String, String> getOptionsFromPropertiesFile(String newPropertiesFile) throws MojoExecutionException { this.getLog().debug("Using search path at: " + this.basedir.getAbsolutePath()); this.resourceManager.addSearchPath(FileResourceLoader.ID, this.basedir.getAbsolutePath()); Properties properties = new Properties(); try { properties.load(this.resourceManager.getResourceAsInputStream(newPropertiesFile)); } catch (ResourceNotFoundException e) { getLog().debug("Property file [" + newPropertiesFile + "] cannot be found", e); return new HashMap<>(); } catch (IOException e) { throw new MojoExecutionException("Cannot read config file [" + newPropertiesFile + "]", e); } final Map<String, String> map = new HashMap<>(); for (final String name : properties.stringPropertyNames()) { map.put(name, properties.getProperty(name)); } return map; }
[ "private", "Map", "<", "String", ",", "String", ">", "getOptionsFromPropertiesFile", "(", "String", "newPropertiesFile", ")", "throws", "MojoExecutionException", "{", "this", ".", "getLog", "(", ")", ".", "debug", "(", "\"Using search path at: \"", "+", "this", "....
Read properties file and return the properties as {@link Map}. @return the options from properties file or null if not properties file found @throws MojoExecutionException the mojo execution exception
[ "Read", "properties", "file", "and", "return", "the", "properties", "as", "{", "@link", "Map", "}", "." ]
train
https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/FormatterMojo.java#L723-L743
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/common/FrameworkProjectMgr.java
FrameworkProjectMgr.createFrameworkProjectStrict
@Override public IRundeckProject createFrameworkProjectStrict(final String projectName, final Properties properties) { """ Create a new project if it doesn't, otherwise throw exception @param projectName name of project @param properties config properties @return new project @throws IllegalArgumentException if the project already exists """ return createFrameworkProjectInt(projectName,properties,true); }
java
@Override public IRundeckProject createFrameworkProjectStrict(final String projectName, final Properties properties) { return createFrameworkProjectInt(projectName,properties,true); }
[ "@", "Override", "public", "IRundeckProject", "createFrameworkProjectStrict", "(", "final", "String", "projectName", ",", "final", "Properties", "properties", ")", "{", "return", "createFrameworkProjectInt", "(", "projectName", ",", "properties", ",", "true", ")", ";"...
Create a new project if it doesn't, otherwise throw exception @param projectName name of project @param properties config properties @return new project @throws IllegalArgumentException if the project already exists
[ "Create", "a", "new", "project", "if", "it", "doesn", "t", "otherwise", "throw", "exception" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/FrameworkProjectMgr.java#L107-L111
ehcache/ehcache3
impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java
CacheConfigurationBuilder.withResilienceStrategy
@SuppressWarnings("rawtypes") public CacheConfigurationBuilder<K, V> withResilienceStrategy(Class<? extends ResilienceStrategy> resilienceStrategyClass, Object... arguments) { """ Adds a {@link ResilienceStrategy} configured through a class and optional constructor arguments to the configured builder. @param resilienceStrategyClass the resilience strategy class @param arguments optional constructor arguments @return a new builder with the added resilience strategy configuration """ return addOrReplaceConfiguration(new DefaultResilienceStrategyConfiguration(requireNonNull(resilienceStrategyClass, "Null resilienceStrategyClass"), arguments)); }
java
@SuppressWarnings("rawtypes") public CacheConfigurationBuilder<K, V> withResilienceStrategy(Class<? extends ResilienceStrategy> resilienceStrategyClass, Object... arguments) { return addOrReplaceConfiguration(new DefaultResilienceStrategyConfiguration(requireNonNull(resilienceStrategyClass, "Null resilienceStrategyClass"), arguments)); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "CacheConfigurationBuilder", "<", "K", ",", "V", ">", "withResilienceStrategy", "(", "Class", "<", "?", "extends", "ResilienceStrategy", ">", "resilienceStrategyClass", ",", "Object", "...", "arguments", "...
Adds a {@link ResilienceStrategy} configured through a class and optional constructor arguments to the configured builder. @param resilienceStrategyClass the resilience strategy class @param arguments optional constructor arguments @return a new builder with the added resilience strategy configuration
[ "Adds", "a", "{", "@link", "ResilienceStrategy", "}", "configured", "through", "a", "class", "and", "optional", "constructor", "arguments", "to", "the", "configured", "builder", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java#L373-L376
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WCheckBoxSelectRenderer.java
WCheckBoxSelectRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given WCheckBoxSelect. @param component the WCheckBoxSelect to paint. @param renderContext the RenderContext to paint to. """ WCheckBoxSelect select = (WCheckBoxSelect) component; XmlStringBuilder xml = renderContext.getWriter(); int cols = select.getButtonColumns(); boolean readOnly = select.isReadOnly(); xml.appendTagOpen("ui:checkboxselect"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", select.isHidden(), "true"); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { int min = select.getMinSelect(); int max = select.getMaxSelect(); xml.appendOptionalAttribute("disabled", select.isDisabled(), "true"); xml.appendOptionalAttribute("required", select.isMandatory(), "true"); xml.appendOptionalAttribute("submitOnChange", select.isSubmitOnChange(), "true"); xml.appendOptionalAttribute("toolTip", component.getToolTip()); xml.appendOptionalAttribute("accessibleText", component.getAccessibleText()); xml.appendOptionalAttribute("min", min > 0, min); xml.appendOptionalAttribute("max", max > 0, max); } xml.appendOptionalAttribute("frameless", select.isFrameless(), "true"); switch (select.getButtonLayout()) { case COLUMNS: xml.appendAttribute("layout", "column"); xml.appendOptionalAttribute("layoutColumnCount", cols > 0, cols); break; case FLAT: xml.appendAttribute("layout", "flat"); break; case STACKED: xml.appendAttribute("layout", "stacked"); break; default: throw new SystemException("Unknown layout type: " + select.getButtonLayout()); } xml.appendClose(); // Options List<?> options = select.getOptions(); boolean renderSelectionsOnly = readOnly; if (options != null) { int optionIndex = 0; List<?> selections = select.getSelected(); for (Object option : options) { if (option instanceof OptionGroup) { throw new SystemException("Option groups not supported in WCheckBoxSelect."); } else { renderOption(select, option, optionIndex++, xml, selections, renderSelectionsOnly); } } } if (!readOnly) { DiagnosticRenderUtil.renderDiagnostics(select, renderContext); } xml.appendEndTag("ui:checkboxselect"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WCheckBoxSelect select = (WCheckBoxSelect) component; XmlStringBuilder xml = renderContext.getWriter(); int cols = select.getButtonColumns(); boolean readOnly = select.isReadOnly(); xml.appendTagOpen("ui:checkboxselect"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", select.isHidden(), "true"); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { int min = select.getMinSelect(); int max = select.getMaxSelect(); xml.appendOptionalAttribute("disabled", select.isDisabled(), "true"); xml.appendOptionalAttribute("required", select.isMandatory(), "true"); xml.appendOptionalAttribute("submitOnChange", select.isSubmitOnChange(), "true"); xml.appendOptionalAttribute("toolTip", component.getToolTip()); xml.appendOptionalAttribute("accessibleText", component.getAccessibleText()); xml.appendOptionalAttribute("min", min > 0, min); xml.appendOptionalAttribute("max", max > 0, max); } xml.appendOptionalAttribute("frameless", select.isFrameless(), "true"); switch (select.getButtonLayout()) { case COLUMNS: xml.appendAttribute("layout", "column"); xml.appendOptionalAttribute("layoutColumnCount", cols > 0, cols); break; case FLAT: xml.appendAttribute("layout", "flat"); break; case STACKED: xml.appendAttribute("layout", "stacked"); break; default: throw new SystemException("Unknown layout type: " + select.getButtonLayout()); } xml.appendClose(); // Options List<?> options = select.getOptions(); boolean renderSelectionsOnly = readOnly; if (options != null) { int optionIndex = 0; List<?> selections = select.getSelected(); for (Object option : options) { if (option instanceof OptionGroup) { throw new SystemException("Option groups not supported in WCheckBoxSelect."); } else { renderOption(select, option, optionIndex++, xml, selections, renderSelectionsOnly); } } } if (!readOnly) { DiagnosticRenderUtil.renderDiagnostics(select, renderContext); } xml.appendEndTag("ui:checkboxselect"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WCheckBoxSelect", "select", "=", "(", "WCheckBoxSelect", ")", "component", ";", "XmlStringBuilder", "xml", "=", ...
Paints the given WCheckBoxSelect. @param component the WCheckBoxSelect to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WCheckBoxSelect", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WCheckBoxSelectRenderer.java#L26-L92
Azure/azure-sdk-for-java
keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java
VaultsInner.updateAsync
public Observable<VaultInner> updateAsync(String resourceGroupName, String vaultName, VaultPatchParameters parameters) { """ Update a key vault in the specified subscription. @param resourceGroupName The name of the Resource Group to which the server belongs. @param vaultName Name of the vault @param parameters Parameters to patch the vault @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VaultInner object """ return updateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).map(new Func1<ServiceResponse<VaultInner>, VaultInner>() { @Override public VaultInner call(ServiceResponse<VaultInner> response) { return response.body(); } }); }
java
public Observable<VaultInner> updateAsync(String resourceGroupName, String vaultName, VaultPatchParameters parameters) { return updateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).map(new Func1<ServiceResponse<VaultInner>, VaultInner>() { @Override public VaultInner call(ServiceResponse<VaultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VaultInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "vaultName", ",", "VaultPatchParameters", "parameters", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "vaultName", ",...
Update a key vault in the specified subscription. @param resourceGroupName The name of the Resource Group to which the server belongs. @param vaultName Name of the vault @param parameters Parameters to patch the vault @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VaultInner object
[ "Update", "a", "key", "vault", "in", "the", "specified", "subscription", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java#L277-L284
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.getPropertiesFromTaskAsync
public Observable<Void> getPropertiesFromTaskAsync(String jobId, String taskId, String filePath) { """ Gets the properties of the specified task file. @param jobId The ID of the job that contains the task. @param taskId The ID of the task whose file you want to get the properties of. @param filePath The path to the task file that you want to get the properties of. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful. """ return getPropertiesFromTaskWithServiceResponseAsync(jobId, taskId, filePath).map(new Func1<ServiceResponseWithHeaders<Void, FileGetPropertiesFromTaskHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, FileGetPropertiesFromTaskHeaders> response) { return response.body(); } }); }
java
public Observable<Void> getPropertiesFromTaskAsync(String jobId, String taskId, String filePath) { return getPropertiesFromTaskWithServiceResponseAsync(jobId, taskId, filePath).map(new Func1<ServiceResponseWithHeaders<Void, FileGetPropertiesFromTaskHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, FileGetPropertiesFromTaskHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "getPropertiesFromTaskAsync", "(", "String", "jobId", ",", "String", "taskId", ",", "String", "filePath", ")", "{", "return", "getPropertiesFromTaskWithServiceResponseAsync", "(", "jobId", ",", "taskId", ",", "filePath", ")"...
Gets the properties of the specified task file. @param jobId The ID of the job that contains the task. @param taskId The ID of the task whose file you want to get the properties of. @param filePath The path to the task file that you want to get the properties of. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Gets", "the", "properties", "of", "the", "specified", "task", "file", "." ]
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#L663-L670
azkaban/azkaban
az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopProxy.java
HadoopProxy.killAllSpawnedHadoopJobs
public void killAllSpawnedHadoopJobs(Props jobProps, final Logger logger) { """ Kill all Spawned Hadoop Jobs @param jobProps job properties @param logger logger handler """ if (tokenFile == null) { return; // do null check for tokenFile } final String logFilePath = jobProps.getString(CommonJobProperties.JOB_LOG_FILE); logger.info("Log file path is: " + logFilePath); HadoopJobUtils.proxyUserKillAllSpawnedHadoopJobs(logFilePath, jobProps, tokenFile, logger); }
java
public void killAllSpawnedHadoopJobs(Props jobProps, final Logger logger) { if (tokenFile == null) { return; // do null check for tokenFile } final String logFilePath = jobProps.getString(CommonJobProperties.JOB_LOG_FILE); logger.info("Log file path is: " + logFilePath); HadoopJobUtils.proxyUserKillAllSpawnedHadoopJobs(logFilePath, jobProps, tokenFile, logger); }
[ "public", "void", "killAllSpawnedHadoopJobs", "(", "Props", "jobProps", ",", "final", "Logger", "logger", ")", "{", "if", "(", "tokenFile", "==", "null", ")", "{", "return", ";", "// do null check for tokenFile", "}", "final", "String", "logFilePath", "=", "jobP...
Kill all Spawned Hadoop Jobs @param jobProps job properties @param logger logger handler
[ "Kill", "all", "Spawned", "Hadoop", "Jobs" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopProxy.java#L142-L151
haraldk/TwelveMonkeys
servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java
ContentNegotiationFilter.adjustQualityFromAccept
private void adjustQualityFromAccept(Map<String, Float> pFormatQuality, HttpServletRequest pRequest) { """ Adjust quality from HTTP Accept header @param pFormatQuality the format to quality mapping @param pRequest the request """ // Multiply all q factors with qs factors // No q=.. should be interpreted as q=1.0 // Apache does some extras; if both explicit types and wildcards // (without qaulity factor) are present, */* is interpreted as // */*;q=0.01 and image/* is interpreted as image/*;q=0.02 // See: http://httpd.apache.org/docs-2.0/content-negotiation.html String accept = getAcceptedFormats(pRequest); //System.out.println("Accept: " + accept); float anyImageFactor = getQualityFactor(accept, MIME_TYPE_IMAGE_ANY); anyImageFactor = (anyImageFactor == 1) ? 0.02f : anyImageFactor; float anyFactor = getQualityFactor(accept, MIME_TYPE_ANY); anyFactor = (anyFactor == 1) ? 0.01f : anyFactor; for (String format : pFormatQuality.keySet()) { //System.out.println("Trying format: " + format); String formatMIME = MIME_TYPE_IMAGE_PREFIX + format; float qFactor = getQualityFactor(accept, formatMIME); qFactor = (qFactor == 0f) ? Math.max(anyFactor, anyImageFactor) : qFactor; adjustQuality(pFormatQuality, format, qFactor); } }
java
private void adjustQualityFromAccept(Map<String, Float> pFormatQuality, HttpServletRequest pRequest) { // Multiply all q factors with qs factors // No q=.. should be interpreted as q=1.0 // Apache does some extras; if both explicit types and wildcards // (without qaulity factor) are present, */* is interpreted as // */*;q=0.01 and image/* is interpreted as image/*;q=0.02 // See: http://httpd.apache.org/docs-2.0/content-negotiation.html String accept = getAcceptedFormats(pRequest); //System.out.println("Accept: " + accept); float anyImageFactor = getQualityFactor(accept, MIME_TYPE_IMAGE_ANY); anyImageFactor = (anyImageFactor == 1) ? 0.02f : anyImageFactor; float anyFactor = getQualityFactor(accept, MIME_TYPE_ANY); anyFactor = (anyFactor == 1) ? 0.01f : anyFactor; for (String format : pFormatQuality.keySet()) { //System.out.println("Trying format: " + format); String formatMIME = MIME_TYPE_IMAGE_PREFIX + format; float qFactor = getQualityFactor(accept, formatMIME); qFactor = (qFactor == 0f) ? Math.max(anyFactor, anyImageFactor) : qFactor; adjustQuality(pFormatQuality, format, qFactor); } }
[ "private", "void", "adjustQualityFromAccept", "(", "Map", "<", "String", ",", "Float", ">", "pFormatQuality", ",", "HttpServletRequest", "pRequest", ")", "{", "// Multiply all q factors with qs factors\r", "// No q=.. should be interpreted as q=1.0\r", "// Apache does some extras...
Adjust quality from HTTP Accept header @param pFormatQuality the format to quality mapping @param pRequest the request
[ "Adjust", "quality", "from", "HTTP", "Accept", "header" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java#L297-L323
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/KernelPoints.java
KernelPoints.standardMove
private void standardMove(KernelPoint destination, KernelPoint source) { """ Updates the gram matrix storage of the destination to point at the exact same objects as the ones from the source. @param destination the destination object @param source the source object """ destination.InvK = source.InvK; destination.InvKExpanded = source.InvKExpanded; destination.K = source.K; destination.KExpanded = source.KExpanded; }
java
private void standardMove(KernelPoint destination, KernelPoint source) { destination.InvK = source.InvK; destination.InvKExpanded = source.InvKExpanded; destination.K = source.K; destination.KExpanded = source.KExpanded; }
[ "private", "void", "standardMove", "(", "KernelPoint", "destination", ",", "KernelPoint", "source", ")", "{", "destination", ".", "InvK", "=", "source", ".", "InvK", ";", "destination", ".", "InvKExpanded", "=", "source", ".", "InvKExpanded", ";", "destination",...
Updates the gram matrix storage of the destination to point at the exact same objects as the ones from the source. @param destination the destination object @param source the source object
[ "Updates", "the", "gram", "matrix", "storage", "of", "the", "destination", "to", "point", "at", "the", "exact", "same", "objects", "as", "the", "ones", "from", "the", "source", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/KernelPoints.java#L601-L607
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/io/StreamUtil.java
StreamUtil.streamCopy
public static void streamCopy(InputStream input, Writer output) throws IOException { """ Copies the contents of an InputStream, using the default encoding, into a Writer @param input @param output @throws IOException """ if (input == null) throw new IllegalArgumentException("Must provide something to read from"); if (output == null) throw new IllegalArgumentException("Must provide something to write to"); streamCopy(new InputStreamReader(input), output); }
java
public static void streamCopy(InputStream input, Writer output) throws IOException { if (input == null) throw new IllegalArgumentException("Must provide something to read from"); if (output == null) throw new IllegalArgumentException("Must provide something to write to"); streamCopy(new InputStreamReader(input), output); }
[ "public", "static", "void", "streamCopy", "(", "InputStream", "input", ",", "Writer", "output", ")", "throws", "IOException", "{", "if", "(", "input", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Must provide something to read from\"", ")",...
Copies the contents of an InputStream, using the default encoding, into a Writer @param input @param output @throws IOException
[ "Copies", "the", "contents", "of", "an", "InputStream", "using", "the", "default", "encoding", "into", "a", "Writer" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/io/StreamUtil.java#L343-L351
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.getAsync
public <T> CompletableFuture<T> getAsync(final Class<T> type, final Consumer<HttpConfig> configuration) { """ Executes asynchronous GET request on the configured URI (alias for the `get(Class, Consumer)` method), with additional configuration provided by the configuration function. The result will be cast to the specified `type`. This method is generally meant for use with standard Java. [source,groovy] ---- HttpBuilder http = HttpBuilder.configure(config -> { config.getRequest().setUri("http://localhost:10101"); }); String result = http.get(String.class, config -> { config.getRequest().getUri().setPath("/foo"); }); ---- @param type the type of the response content @param configuration the additional configuration function (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} for the resulting content cast to the specified type """ return CompletableFuture.supplyAsync(() -> get(type, configuration), getExecutor()); }
java
public <T> CompletableFuture<T> getAsync(final Class<T> type, final Consumer<HttpConfig> configuration) { return CompletableFuture.supplyAsync(() -> get(type, configuration), getExecutor()); }
[ "public", "<", "T", ">", "CompletableFuture", "<", "T", ">", "getAsync", "(", "final", "Class", "<", "T", ">", "type", ",", "final", "Consumer", "<", "HttpConfig", ">", "configuration", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(",...
Executes asynchronous GET request on the configured URI (alias for the `get(Class, Consumer)` method), with additional configuration provided by the configuration function. The result will be cast to the specified `type`. This method is generally meant for use with standard Java. [source,groovy] ---- HttpBuilder http = HttpBuilder.configure(config -> { config.getRequest().setUri("http://localhost:10101"); }); String result = http.get(String.class, config -> { config.getRequest().getUri().setPath("/foo"); }); ---- @param type the type of the response content @param configuration the additional configuration function (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} for the resulting content cast to the specified type
[ "Executes", "asynchronous", "GET", "request", "on", "the", "configured", "URI", "(", "alias", "for", "the", "get", "(", "Class", "Consumer", ")", "method", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", "function", ".", "...
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L489-L491
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/RandomCompat.java
RandomCompat.longs
@NotNull public LongStream longs(long streamSize, final long randomNumberOrigin, final long randomNumberBound) { """ Returns a stream producing the given {@code streamSize} number of pseudorandom {@code long} values, each conforming to the given origin (inclusive) and bound (exclusive). @param streamSize the number of values to generate @param randomNumberOrigin the origin (inclusive) of each random value @param randomNumberBound the bound (exclusive) if each random value @return a stream of pseudorandom {@code long} values, each with the given origin (inclusive) and bound (exclusive) @throws IllegalArgumentException if {@code streamSize} is less than zero, or {@code randomNumberOrigin} is greater than or equal to {@code randomNumberBound} """ if (streamSize < 0L) throw new IllegalArgumentException(); if (streamSize == 0L) { return LongStream.empty(); } return longs(randomNumberOrigin, randomNumberBound).limit(streamSize); }
java
@NotNull public LongStream longs(long streamSize, final long randomNumberOrigin, final long randomNumberBound) { if (streamSize < 0L) throw new IllegalArgumentException(); if (streamSize == 0L) { return LongStream.empty(); } return longs(randomNumberOrigin, randomNumberBound).limit(streamSize); }
[ "@", "NotNull", "public", "LongStream", "longs", "(", "long", "streamSize", ",", "final", "long", "randomNumberOrigin", ",", "final", "long", "randomNumberBound", ")", "{", "if", "(", "streamSize", "<", "0L", ")", "throw", "new", "IllegalArgumentException", "(",...
Returns a stream producing the given {@code streamSize} number of pseudorandom {@code long} values, each conforming to the given origin (inclusive) and bound (exclusive). @param streamSize the number of values to generate @param randomNumberOrigin the origin (inclusive) of each random value @param randomNumberBound the bound (exclusive) if each random value @return a stream of pseudorandom {@code long} values, each with the given origin (inclusive) and bound (exclusive) @throws IllegalArgumentException if {@code streamSize} is less than zero, or {@code randomNumberOrigin} is greater than or equal to {@code randomNumberBound}
[ "Returns", "a", "stream", "producing", "the", "given", "{", "@code", "streamSize", "}", "number", "of", "pseudorandom", "{", "@code", "long", "}", "values", "each", "conforming", "to", "the", "given", "origin", "(", "inclusive", ")", "and", "bound", "(", "...
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/RandomCompat.java#L213-L221
JodaOrg/joda-money
src/main/java/org/joda/money/Money.java
Money.minus
public Money minus(BigDecimal amountToSubtract, RoundingMode roundingMode) { """ Returns a copy of this monetary value with the amount subtracted. <p> This subtracts the specified amount from this monetary amount, returning a new object. If the amount to subtract exceeds the scale of the currency, then the rounding mode will be used to adjust the result. <p> This instance is immutable and unaffected by this method. @param amountToSubtract the monetary value to subtract, not null @param roundingMode the rounding mode to use, not null @return the new instance with the input amount subtracted, never null """ return with(money.minusRetainScale(amountToSubtract, roundingMode)); }
java
public Money minus(BigDecimal amountToSubtract, RoundingMode roundingMode) { return with(money.minusRetainScale(amountToSubtract, roundingMode)); }
[ "public", "Money", "minus", "(", "BigDecimal", "amountToSubtract", ",", "RoundingMode", "roundingMode", ")", "{", "return", "with", "(", "money", ".", "minusRetainScale", "(", "amountToSubtract", ",", "roundingMode", ")", ")", ";", "}" ]
Returns a copy of this monetary value with the amount subtracted. <p> This subtracts the specified amount from this monetary amount, returning a new object. If the amount to subtract exceeds the scale of the currency, then the rounding mode will be used to adjust the result. <p> This instance is immutable and unaffected by this method. @param amountToSubtract the monetary value to subtract, not null @param roundingMode the rounding mode to use, not null @return the new instance with the input amount subtracted, never null
[ "Returns", "a", "copy", "of", "this", "monetary", "value", "with", "the", "amount", "subtracted", ".", "<p", ">", "This", "subtracts", "the", "specified", "amount", "from", "this", "monetary", "amount", "returning", "a", "new", "object", ".", "If", "the", ...
train
https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/Money.java#L924-L926
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfReaderInstance.java
PdfReaderInstance.getFormXObject
PdfStream getFormXObject(int pageNumber, int compressionLevel) throws IOException { """ Gets the content stream of a page as a PdfStream object. @param pageNumber the page of which you want the stream @param compressionLevel the compression level you want to apply to the stream @return a PdfStream object @since 2.1.3 (the method already existed without param compressionLevel) """ PdfDictionary page = reader.getPageNRelease(pageNumber); PdfObject contents = PdfReader.getPdfObjectRelease(page.get(PdfName.CONTENTS)); PdfDictionary dic = new PdfDictionary(); byte bout[] = null; if (contents != null) { if (contents.isStream()) dic.putAll((PRStream)contents); else bout = reader.getPageContent(pageNumber, file); } else bout = new byte[0]; dic.put(PdfName.RESOURCES, PdfReader.getPdfObjectRelease(page.get(PdfName.RESOURCES))); dic.put(PdfName.TYPE, PdfName.XOBJECT); dic.put(PdfName.SUBTYPE, PdfName.FORM); PdfImportedPage impPage = (PdfImportedPage)importedPages.get(Integer.valueOf(pageNumber)); dic.put(PdfName.BBOX, new PdfRectangle(impPage.getBoundingBox())); PdfArray matrix = impPage.getMatrix(); if (matrix == null) dic.put(PdfName.MATRIX, IDENTITYMATRIX); else dic.put(PdfName.MATRIX, matrix); dic.put(PdfName.FORMTYPE, ONE); PRStream stream; if (bout == null) { stream = new PRStream((PRStream)contents, dic); } else { stream = new PRStream(reader, bout, compressionLevel); stream.putAll(dic); } return stream; }
java
PdfStream getFormXObject(int pageNumber, int compressionLevel) throws IOException { PdfDictionary page = reader.getPageNRelease(pageNumber); PdfObject contents = PdfReader.getPdfObjectRelease(page.get(PdfName.CONTENTS)); PdfDictionary dic = new PdfDictionary(); byte bout[] = null; if (contents != null) { if (contents.isStream()) dic.putAll((PRStream)contents); else bout = reader.getPageContent(pageNumber, file); } else bout = new byte[0]; dic.put(PdfName.RESOURCES, PdfReader.getPdfObjectRelease(page.get(PdfName.RESOURCES))); dic.put(PdfName.TYPE, PdfName.XOBJECT); dic.put(PdfName.SUBTYPE, PdfName.FORM); PdfImportedPage impPage = (PdfImportedPage)importedPages.get(Integer.valueOf(pageNumber)); dic.put(PdfName.BBOX, new PdfRectangle(impPage.getBoundingBox())); PdfArray matrix = impPage.getMatrix(); if (matrix == null) dic.put(PdfName.MATRIX, IDENTITYMATRIX); else dic.put(PdfName.MATRIX, matrix); dic.put(PdfName.FORMTYPE, ONE); PRStream stream; if (bout == null) { stream = new PRStream((PRStream)contents, dic); } else { stream = new PRStream(reader, bout, compressionLevel); stream.putAll(dic); } return stream; }
[ "PdfStream", "getFormXObject", "(", "int", "pageNumber", ",", "int", "compressionLevel", ")", "throws", "IOException", "{", "PdfDictionary", "page", "=", "reader", ".", "getPageNRelease", "(", "pageNumber", ")", ";", "PdfObject", "contents", "=", "PdfReader", ".",...
Gets the content stream of a page as a PdfStream object. @param pageNumber the page of which you want the stream @param compressionLevel the compression level you want to apply to the stream @return a PdfStream object @since 2.1.3 (the method already existed without param compressionLevel)
[ "Gets", "the", "content", "stream", "of", "a", "page", "as", "a", "PdfStream", "object", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfReaderInstance.java#L120-L153
wisdom-framework/wisdom
core/router/src/main/java/org/wisdom/router/parameter/Bindings.java
Bindings.bind
public static void bind(Source source, RouteParameterHandler handler) { """ Associates the given source to the given handler. @param source the source, must not be {@code null} @param handler the handler, must not be {@code null} """ if (BINDINGS.containsKey(source)) { LoggerFactory.getLogger(Bindings.class).warn("Replacing a route parameter binding for {} by {}", source.name(), handler); } BINDINGS.put(source, handler); }
java
public static void bind(Source source, RouteParameterHandler handler) { if (BINDINGS.containsKey(source)) { LoggerFactory.getLogger(Bindings.class).warn("Replacing a route parameter binding for {} by {}", source.name(), handler); } BINDINGS.put(source, handler); }
[ "public", "static", "void", "bind", "(", "Source", "source", ",", "RouteParameterHandler", "handler", ")", "{", "if", "(", "BINDINGS", ".", "containsKey", "(", "source", ")", ")", "{", "LoggerFactory", ".", "getLogger", "(", "Bindings", ".", "class", ")", ...
Associates the given source to the given handler. @param source the source, must not be {@code null} @param handler the handler, must not be {@code null}
[ "Associates", "the", "given", "source", "to", "the", "given", "handler", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/router/src/main/java/org/wisdom/router/parameter/Bindings.java#L56-L62
aragozin/jvm-tools
hprof-heap/src/main/java/org/netbeans/lib/profiler/heap/LongHashMap.java
LongHashMap.put
long put(long key, long value) { """ Associates the specified value with the specified key in this identity hash map. If the map previously contained a mapping for the key, the old value is replaced. @param key the key with which the specified value is to be associated @param value the value to be associated with the specified key @return the previous value associated with <tt>key</tt>, or <tt>null</tt> if there was no mapping for <tt>key</tt>. (A <tt>null</tt> return can also indicate that the map previously associated <tt>null</tt> with <tt>key</tt>.) @see Object#equals(Object) @see #get(Object) @see #containsKey(Object) """ assert key != 0; long k = key; long[] tab = table; int len = tab.length; int i = hash(k, len); long item; while ( (item = tab[i]) != 0) { if (item == k) { long oldValue = tab[i + 1]; tab[i + 1] = value; return oldValue; } i = nextKeyIndex(i, len); } modCount++; tab[i] = k; tab[i + 1] = value; if (++size >= threshold) resize(len); // len == 2 * current capacity. return 0; }
java
long put(long key, long value) { assert key != 0; long k = key; long[] tab = table; int len = tab.length; int i = hash(k, len); long item; while ( (item = tab[i]) != 0) { if (item == k) { long oldValue = tab[i + 1]; tab[i + 1] = value; return oldValue; } i = nextKeyIndex(i, len); } modCount++; tab[i] = k; tab[i + 1] = value; if (++size >= threshold) resize(len); // len == 2 * current capacity. return 0; }
[ "long", "put", "(", "long", "key", ",", "long", "value", ")", "{", "assert", "key", "!=", "0", ";", "long", "k", "=", "key", ";", "long", "[", "]", "tab", "=", "table", ";", "int", "len", "=", "tab", ".", "length", ";", "int", "i", "=", "hash...
Associates the specified value with the specified key in this identity hash map. If the map previously contained a mapping for the key, the old value is replaced. @param key the key with which the specified value is to be associated @param value the value to be associated with the specified key @return the previous value associated with <tt>key</tt>, or <tt>null</tt> if there was no mapping for <tt>key</tt>. (A <tt>null</tt> return can also indicate that the map previously associated <tt>null</tt> with <tt>key</tt>.) @see Object#equals(Object) @see #get(Object) @see #containsKey(Object)
[ "Associates", "the", "specified", "value", "with", "the", "specified", "key", "in", "this", "identity", "hash", "map", ".", "If", "the", "map", "previously", "contained", "a", "mapping", "for", "the", "key", "the", "old", "value", "is", "replaced", "." ]
train
https://github.com/aragozin/jvm-tools/blob/d3a4d0c6a47fb9317f274988569655f30dcd2f76/hprof-heap/src/main/java/org/netbeans/lib/profiler/heap/LongHashMap.java#L311-L334
Commonjava/webdav-handler
common/src/main/java/net/sf/webdav/methods/DoGet.java
DoGet.getHeader
protected String getHeader( final ITransaction transaction, final String path, final WebdavResponse resp, final WebdavRequest req ) { """ Return the header to be displayed in front of the folder content @param transaction @param path @param resp @param req @return String representing the header to be display in front of the folder content """ return "<h1>Content of folder " + path + "</h1>"; }
java
protected String getHeader( final ITransaction transaction, final String path, final WebdavResponse resp, final WebdavRequest req ) { return "<h1>Content of folder " + path + "</h1>"; }
[ "protected", "String", "getHeader", "(", "final", "ITransaction", "transaction", ",", "final", "String", "path", ",", "final", "WebdavResponse", "resp", ",", "final", "WebdavRequest", "req", ")", "{", "return", "\"<h1>Content of folder \"", "+", "path", "+", "\"</...
Return the header to be displayed in front of the folder content @param transaction @param path @param resp @param req @return String representing the header to be display in front of the folder content
[ "Return", "the", "header", "to", "be", "displayed", "in", "front", "of", "the", "folder", "content" ]
train
https://github.com/Commonjava/webdav-handler/blob/39bb7032fc75c1b67d3f2440dd1c234ead96cb9d/common/src/main/java/net/sf/webdav/methods/DoGet.java#L269-L272
revelytix/spark
sherpa-java/src/main/java/sherpa/client/QueryExecution.java
QueryExecution.asyncMoreRequest
private void asyncMoreRequest(int startRow) { """ Send request for more data for this query. NOTE: This method is always run in a background thread!! @param startRow Start row needed in return batch """ try { DataRequest moreRequest = new DataRequest(); moreRequest.queryId = queryId; moreRequest.startRow = startRow; moreRequest.maxSize = maxBatchSize; logger.debug("Client requesting {} .. {}", startRow, (startRow + maxBatchSize - 1)); DataResponse response = server.data(moreRequest); logger.debug("Client got response {} .. {}, more={}", new Object[] { response.startRow, (response.startRow + response.data.size() - 1), response.more }); nextData.add(new Window(response.data, response.more)); } catch (AvroRemoteException e) { this.nextData.addError(toSparqlException(e)); } catch (Throwable t) { this.nextData.addError(t); } }
java
private void asyncMoreRequest(int startRow) { try { DataRequest moreRequest = new DataRequest(); moreRequest.queryId = queryId; moreRequest.startRow = startRow; moreRequest.maxSize = maxBatchSize; logger.debug("Client requesting {} .. {}", startRow, (startRow + maxBatchSize - 1)); DataResponse response = server.data(moreRequest); logger.debug("Client got response {} .. {}, more={}", new Object[] { response.startRow, (response.startRow + response.data.size() - 1), response.more }); nextData.add(new Window(response.data, response.more)); } catch (AvroRemoteException e) { this.nextData.addError(toSparqlException(e)); } catch (Throwable t) { this.nextData.addError(t); } }
[ "private", "void", "asyncMoreRequest", "(", "int", "startRow", ")", "{", "try", "{", "DataRequest", "moreRequest", "=", "new", "DataRequest", "(", ")", ";", "moreRequest", ".", "queryId", "=", "queryId", ";", "moreRequest", ".", "startRow", "=", "startRow", ...
Send request for more data for this query. NOTE: This method is always run in a background thread!! @param startRow Start row needed in return batch
[ "Send", "request", "for", "more", "data", "for", "this", "query", "." ]
train
https://github.com/revelytix/spark/blob/d777d40c962bc66fdc04b7c3a66d20b777ff6fb4/sherpa-java/src/main/java/sherpa/client/QueryExecution.java#L166-L183
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzleResultSet.java
DrizzleResultSet.updateRowId
public void updateRowId(final String columnLabel, final java.sql.RowId x) throws SQLException { """ Updates the designated column with a <code>RowId</code> value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code> methods are called to update the database. @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column @param x the column value @throws java.sql.SQLException if the columnLabel is not valid; if a database access error occurs; the result set concurrency is <code>CONCUR_READ_ONLY</code> or this method is called on a closed result set @throws java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support this method @since 1.6 """ throw SQLExceptionMapper.getFeatureNotSupportedException("Updates are not supported"); }
java
public void updateRowId(final String columnLabel, final java.sql.RowId x) throws SQLException { throw SQLExceptionMapper.getFeatureNotSupportedException("Updates are not supported"); }
[ "public", "void", "updateRowId", "(", "final", "String", "columnLabel", ",", "final", "java", ".", "sql", ".", "RowId", "x", ")", "throws", "SQLException", "{", "throw", "SQLExceptionMapper", ".", "getFeatureNotSupportedException", "(", "\"Updates are not supported\""...
Updates the designated column with a <code>RowId</code> value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code> methods are called to update the database. @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column @param x the column value @throws java.sql.SQLException if the columnLabel is not valid; if a database access error occurs; the result set concurrency is <code>CONCUR_READ_ONLY</code> or this method is called on a closed result set @throws java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support this method @since 1.6
[ "Updates", "the", "designated", "column", "with", "a", "<code", ">", "RowId<", "/", "code", ">", "value", ".", "The", "updater", "methods", "are", "used", "to", "update", "column", "values", "in", "the", "current", "row", "or", "the", "insert", "row", "....
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzleResultSet.java#L2457-L2460
atomix/atomix
protocols/primary-backup/src/main/java/io/atomix/protocols/backup/PrimaryBackupClient.java
PrimaryBackupClient.sessionBuilder
public PrimaryBackupSessionClient.Builder sessionBuilder(String primitiveName, PrimitiveType primitiveType, ServiceConfig serviceConfig) { """ Creates a new primary backup proxy session builder. @param primitiveName the primitive name @param primitiveType the primitive type @param serviceConfig the service configuration @return a new primary-backup proxy session builder """ byte[] configBytes = Serializer.using(primitiveType.namespace()).encode(serviceConfig); return new PrimaryBackupSessionClient.Builder() { @Override public SessionClient build() { Supplier<CompletableFuture<SessionClient>> proxyBuilder = () -> sessionIdService.nextSessionId() .thenApply(sessionId -> new PrimaryBackupSessionClient( clientName, partitionId, sessionId, primitiveType, new PrimitiveDescriptor( primitiveName, primitiveType.name(), configBytes, numBackups, replication), clusterMembershipService, PrimaryBackupClient.this.protocol, primaryElection, threadContextFactory.createContext())); SessionClient proxy; ThreadContext context = threadContextFactory.createContext(); if (recovery == Recovery.RECOVER) { proxy = new RecoveringSessionClient( clientName, partitionId, primitiveName, primitiveType, proxyBuilder, context); } else { proxy = Futures.get(proxyBuilder.get()); } // If max retries is set, wrap the client in a retrying proxy client. if (maxRetries > 0) { proxy = new RetryingSessionClient( proxy, context, maxRetries, retryDelay); } return new BlockingAwareSessionClient(proxy, context); } }; }
java
public PrimaryBackupSessionClient.Builder sessionBuilder(String primitiveName, PrimitiveType primitiveType, ServiceConfig serviceConfig) { byte[] configBytes = Serializer.using(primitiveType.namespace()).encode(serviceConfig); return new PrimaryBackupSessionClient.Builder() { @Override public SessionClient build() { Supplier<CompletableFuture<SessionClient>> proxyBuilder = () -> sessionIdService.nextSessionId() .thenApply(sessionId -> new PrimaryBackupSessionClient( clientName, partitionId, sessionId, primitiveType, new PrimitiveDescriptor( primitiveName, primitiveType.name(), configBytes, numBackups, replication), clusterMembershipService, PrimaryBackupClient.this.protocol, primaryElection, threadContextFactory.createContext())); SessionClient proxy; ThreadContext context = threadContextFactory.createContext(); if (recovery == Recovery.RECOVER) { proxy = new RecoveringSessionClient( clientName, partitionId, primitiveName, primitiveType, proxyBuilder, context); } else { proxy = Futures.get(proxyBuilder.get()); } // If max retries is set, wrap the client in a retrying proxy client. if (maxRetries > 0) { proxy = new RetryingSessionClient( proxy, context, maxRetries, retryDelay); } return new BlockingAwareSessionClient(proxy, context); } }; }
[ "public", "PrimaryBackupSessionClient", ".", "Builder", "sessionBuilder", "(", "String", "primitiveName", ",", "PrimitiveType", "primitiveType", ",", "ServiceConfig", "serviceConfig", ")", "{", "byte", "[", "]", "configBytes", "=", "Serializer", ".", "using", "(", "...
Creates a new primary backup proxy session builder. @param primitiveName the primitive name @param primitiveType the primitive type @param serviceConfig the service configuration @return a new primary-backup proxy session builder
[ "Creates", "a", "new", "primary", "backup", "proxy", "session", "builder", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/primary-backup/src/main/java/io/atomix/protocols/backup/PrimaryBackupClient.java#L99-L146
windup/windup
rules-java-ee/addon/src/main/java/org/jboss/windup/rules/apps/javaee/service/JmsDestinationService.java
JmsDestinationService.getTypeFromClass
public static JmsDestinationType getTypeFromClass(String aClass) { """ Gets JmsDestinationType from java class name Returns null for unrecognized class """ if (StringUtils.equals(aClass, "javax.jms.Queue") || StringUtils.equals(aClass, "javax.jms.QueueConnectionFactory")) { return JmsDestinationType.QUEUE; } else if (StringUtils.equals(aClass, "javax.jms.Topic") || StringUtils.equals(aClass, "javax.jms.TopicConnectionFactory")) { return JmsDestinationType.TOPIC; } else { return null; } }
java
public static JmsDestinationType getTypeFromClass(String aClass) { if (StringUtils.equals(aClass, "javax.jms.Queue") || StringUtils.equals(aClass, "javax.jms.QueueConnectionFactory")) { return JmsDestinationType.QUEUE; } else if (StringUtils.equals(aClass, "javax.jms.Topic") || StringUtils.equals(aClass, "javax.jms.TopicConnectionFactory")) { return JmsDestinationType.TOPIC; } else { return null; } }
[ "public", "static", "JmsDestinationType", "getTypeFromClass", "(", "String", "aClass", ")", "{", "if", "(", "StringUtils", ".", "equals", "(", "aClass", ",", "\"javax.jms.Queue\"", ")", "||", "StringUtils", ".", "equals", "(", "aClass", ",", "\"javax.jms.QueueConn...
Gets JmsDestinationType from java class name Returns null for unrecognized class
[ "Gets", "JmsDestinationType", "from", "java", "class", "name" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java-ee/addon/src/main/java/org/jboss/windup/rules/apps/javaee/service/JmsDestinationService.java#L75-L89
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/search/aggregate/Aggregate.java
Aggregate.updateMetric
private synchronized void updateMetric(String value, Group group, Set<String>[] groupKeys, int index) { """ add value to the aggregation group and all subgroups in accordance with the groupKeys paths. """ group.update(value); if (index < groupKeys.length){ for (String key : groupKeys[index]){ Group subgroup = group.subgroup(key); updateMetric(value, subgroup, groupKeys, index + 1); } } }
java
private synchronized void updateMetric(String value, Group group, Set<String>[] groupKeys, int index){ group.update(value); if (index < groupKeys.length){ for (String key : groupKeys[index]){ Group subgroup = group.subgroup(key); updateMetric(value, subgroup, groupKeys, index + 1); } } }
[ "private", "synchronized", "void", "updateMetric", "(", "String", "value", ",", "Group", "group", ",", "Set", "<", "String", ">", "[", "]", "groupKeys", ",", "int", "index", ")", "{", "group", ".", "update", "(", "value", ")", ";", "if", "(", "index", ...
add value to the aggregation group and all subgroups in accordance with the groupKeys paths.
[ "add", "value", "to", "the", "aggregation", "group", "and", "all", "subgroups", "in", "accordance", "with", "the", "groupKeys", "paths", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/search/aggregate/Aggregate.java#L401-L409
osglworks/java-tool
src/main/java/org/osgl/Lang.java
F5.andThen
public <T> F5<P1, P2, P3, P4, P5, T> andThen(final Function<? super R, ? extends T> f) { """ Returns a composed function from this function and the specified function that takes the result of this function. When applying the composed function, this function is applied first to given parameter and then the specified function is applied to the result of this function. @param f the function takes the <code>R</code> type parameter and return <code>T</code> type result @param <T> the return type of function {@code f} @return the composed function @throws NullPointerException if <code>f</code> is null """ E.NPE(f); final F5<P1, P2, P3, P4, P5, R> me = this; return new F5<P1, P2, P3, P4, P5, T>() { @Override public T apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { R r = me.apply(p1, p2, p3, p4, p5); return f.apply(r); } }; }
java
public <T> F5<P1, P2, P3, P4, P5, T> andThen(final Function<? super R, ? extends T> f) { E.NPE(f); final F5<P1, P2, P3, P4, P5, R> me = this; return new F5<P1, P2, P3, P4, P5, T>() { @Override public T apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { R r = me.apply(p1, p2, p3, p4, p5); return f.apply(r); } }; }
[ "public", "<", "T", ">", "F5", "<", "P1", ",", "P2", ",", "P3", ",", "P4", ",", "P5", ",", "T", ">", "andThen", "(", "final", "Function", "<", "?", "super", "R", ",", "?", "extends", "T", ">", "f", ")", "{", "E", ".", "NPE", "(", "f", ")"...
Returns a composed function from this function and the specified function that takes the result of this function. When applying the composed function, this function is applied first to given parameter and then the specified function is applied to the result of this function. @param f the function takes the <code>R</code> type parameter and return <code>T</code> type result @param <T> the return type of function {@code f} @return the composed function @throws NullPointerException if <code>f</code> is null
[ "Returns", "a", "composed", "function", "from", "this", "function", "and", "the", "specified", "function", "that", "takes", "the", "result", "of", "this", "function", ".", "When", "applying", "the", "composed", "function", "this", "function", "is", "applied", ...
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L1866-L1876
alkacon/opencms-core
src/org/opencms/util/CmsXsltUtil.java
CmsXsltUtil.transformXmlContent
public static String transformXmlContent(CmsObject cms, String xsltFile, String xmlContent) throws CmsException, CmsXmlException { """ Applies a XSLT Transformation to the content.<p> The method does not use DOM4J, because iso-8859-1 code ist not transformed correctly. @param cms the cms object @param xsltFile the XSLT transformation file @param xmlContent the XML content to transform @return the transformed xml @throws CmsXmlException if something goes wrong @throws CmsException if something goes wrong """ // JAXP reads data Source xmlSource = new StreamSource(new StringReader(xmlContent)); String xsltString = new String(cms.readFile(xsltFile).getContents()); Source xsltSource = new StreamSource(new StringReader(xsltString)); String result = null; try { TransformerFactory transFact = TransformerFactory.newInstance(); Transformer trans = transFact.newTransformer(xsltSource); StringWriter writer = new StringWriter(); trans.transform(xmlSource, new StreamResult(writer)); result = writer.toString(); } catch (Exception exc) { throw new CmsXmlException(Messages.get().container(Messages.ERR_CSV_XML_TRANSFORMATION_FAILED_0)); } // cut of the prefacing declaration '<?xml version="1.0" encoding="UTF-8"?>' if (result.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")) { return result.substring(38); } else { return result; } }
java
public static String transformXmlContent(CmsObject cms, String xsltFile, String xmlContent) throws CmsException, CmsXmlException { // JAXP reads data Source xmlSource = new StreamSource(new StringReader(xmlContent)); String xsltString = new String(cms.readFile(xsltFile).getContents()); Source xsltSource = new StreamSource(new StringReader(xsltString)); String result = null; try { TransformerFactory transFact = TransformerFactory.newInstance(); Transformer trans = transFact.newTransformer(xsltSource); StringWriter writer = new StringWriter(); trans.transform(xmlSource, new StreamResult(writer)); result = writer.toString(); } catch (Exception exc) { throw new CmsXmlException(Messages.get().container(Messages.ERR_CSV_XML_TRANSFORMATION_FAILED_0)); } // cut of the prefacing declaration '<?xml version="1.0" encoding="UTF-8"?>' if (result.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")) { return result.substring(38); } else { return result; } }
[ "public", "static", "String", "transformXmlContent", "(", "CmsObject", "cms", ",", "String", "xsltFile", ",", "String", "xmlContent", ")", "throws", "CmsException", ",", "CmsXmlException", "{", "// JAXP reads data", "Source", "xmlSource", "=", "new", "StreamSource", ...
Applies a XSLT Transformation to the content.<p> The method does not use DOM4J, because iso-8859-1 code ist not transformed correctly. @param cms the cms object @param xsltFile the XSLT transformation file @param xmlContent the XML content to transform @return the transformed xml @throws CmsXmlException if something goes wrong @throws CmsException if something goes wrong
[ "Applies", "a", "XSLT", "Transformation", "to", "the", "content", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsXsltUtil.java#L145-L171
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelServerStates.java
StoredPaymentChannelServerStates.getBroadcaster
private TransactionBroadcaster getBroadcaster() { """ If the broadcaster has not been set for MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET seconds, then the programmer probably forgot to set it and we should throw exception. """ try { return broadcasterFuture.get(MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } catch (TimeoutException e) { String err = "Transaction broadcaster not set"; log.error(err); throw new RuntimeException(err,e); } }
java
private TransactionBroadcaster getBroadcaster() { try { return broadcasterFuture.get(MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } catch (TimeoutException e) { String err = "Transaction broadcaster not set"; log.error(err); throw new RuntimeException(err,e); } }
[ "private", "TransactionBroadcaster", "getBroadcaster", "(", ")", "{", "try", "{", "return", "broadcasterFuture", ".", "get", "(", "MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET", ",", "TimeUnit", ".", "SECONDS", ")", ";", "}", "catch", "(", "InterruptedException", "e"...
If the broadcaster has not been set for MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET seconds, then the programmer probably forgot to set it and we should throw exception.
[ "If", "the", "broadcaster", "has", "not", "been", "set", "for", "MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET", "seconds", "then", "the", "programmer", "probably", "forgot", "to", "set", "it", "and", "we", "should", "throw", "exception", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelServerStates.java#L136-L148
apache/groovy
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
SwingGroovyMethods.leftShift
public static JMenu leftShift(JMenu self, Component component) { """ Overloads the left shift operator to provide an easy way to add components to a menu.<p> @param self a JMenu @param component a component to be added to the menu. @return same menu, after the value was added to it. @since 1.6.4 """ self.add(component); return self; }
java
public static JMenu leftShift(JMenu self, Component component) { self.add(component); return self; }
[ "public", "static", "JMenu", "leftShift", "(", "JMenu", "self", ",", "Component", "component", ")", "{", "self", ".", "add", "(", "component", ")", ";", "return", "self", ";", "}" ]
Overloads the left shift operator to provide an easy way to add components to a menu.<p> @param self a JMenu @param component a component to be added to the menu. @return same menu, after the value was added to it. @since 1.6.4
[ "Overloads", "the", "left", "shift", "operator", "to", "provide", "an", "easy", "way", "to", "add", "components", "to", "a", "menu", ".", "<p", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L781-L784
Whiley/WhileyCompiler
src/main/java/wyc/io/WhileyFileParser.java
WhileyFileParser.parseMultiplicativeExpression
private Expr parseMultiplicativeExpression(EnclosingScope scope, boolean terminated) { """ Parse a multiplicative expression. @param scope The enclosing scope for this statement, which determines the set of visible (i.e. declared) variables and also the current indentation level. @param terminated This indicates that the expression is known to be terminated (or not). An expression that's known to be terminated is one which is guaranteed to be followed by something. This is important because it means that we can ignore any newline characters encountered in parsing this expression, and that we'll never overrun the end of the expression (i.e. because there's guaranteed to be something which terminates this expression). A classic situation where terminated is true is when parsing an expression surrounded in braces. In such case, we know the right-brace will always terminate this expression. @return """ int start = index; Expr lhs = parseAccessExpression(scope, terminated); Token lookahead = tryAndMatch(terminated, Star, RightSlash, Percent); if (lookahead != null) { Expr rhs = parseAccessExpression(scope, terminated); switch (lookahead.kind) { case Star: lhs = new Expr.IntegerMultiplication(Type.Void, lhs, rhs); break; case RightSlash: lhs = new Expr.IntegerDivision(Type.Void, lhs, rhs); break; case Percent: lhs = new Expr.IntegerRemainder(Type.Void, lhs, rhs); break; default: throw new RuntimeException("deadcode"); // dead-code } lhs = annotateSourceLocation(lhs, start); } return lhs; }
java
private Expr parseMultiplicativeExpression(EnclosingScope scope, boolean terminated) { int start = index; Expr lhs = parseAccessExpression(scope, terminated); Token lookahead = tryAndMatch(terminated, Star, RightSlash, Percent); if (lookahead != null) { Expr rhs = parseAccessExpression(scope, terminated); switch (lookahead.kind) { case Star: lhs = new Expr.IntegerMultiplication(Type.Void, lhs, rhs); break; case RightSlash: lhs = new Expr.IntegerDivision(Type.Void, lhs, rhs); break; case Percent: lhs = new Expr.IntegerRemainder(Type.Void, lhs, rhs); break; default: throw new RuntimeException("deadcode"); // dead-code } lhs = annotateSourceLocation(lhs, start); } return lhs; }
[ "private", "Expr", "parseMultiplicativeExpression", "(", "EnclosingScope", "scope", ",", "boolean", "terminated", ")", "{", "int", "start", "=", "index", ";", "Expr", "lhs", "=", "parseAccessExpression", "(", "scope", ",", "terminated", ")", ";", "Token", "looka...
Parse a multiplicative expression. @param scope The enclosing scope for this statement, which determines the set of visible (i.e. declared) variables and also the current indentation level. @param terminated This indicates that the expression is known to be terminated (or not). An expression that's known to be terminated is one which is guaranteed to be followed by something. This is important because it means that we can ignore any newline characters encountered in parsing this expression, and that we'll never overrun the end of the expression (i.e. because there's guaranteed to be something which terminates this expression). A classic situation where terminated is true is when parsing an expression surrounded in braces. In such case, we know the right-brace will always terminate this expression. @return
[ "Parse", "a", "multiplicative", "expression", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L2119-L2143