repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
sirensolutions/siren-join
src/main/java/solutions/siren/join/action/coordinate/execution/FilterJoinVisitor.java
FilterJoinVisitor.executeAsyncOperation
protected void executeAsyncOperation(final FilterJoinNode node) { logger.debug("Executing async actions"); node.setState(FilterJoinNode.State.RUNNING); // set state before execution to avoid race conditions with listener NodePipelineManager pipeline = new NodePipelineManager(); pipeline.addListener(new NodePipelineListener() { @Override public void onSuccess() { node.setState(FilterJoinNode.State.COMPLETED); // set state before unblocking the queue to avoid race conditions FilterJoinVisitor.this.unblock(); } @Override public void onFailure(Throwable e) { node.setFailure(e); node.setState(FilterJoinNode.State.COMPLETED); // set state before unblocking the queue to avoid race conditions FilterJoinVisitor.this.unblock(); } }); // Adds the list of tasks to be executed pipeline.addTask(new IndicesVersionTask()); pipeline.addTask(new CacheLookupTask()); pipeline.addTask(new CardinalityEstimationTask()); pipeline.addTask(new TermsByQueryTask()); // Starts the execution of the pipeline pipeline.execute(new NodeTaskContext(client, node, this)); }
java
protected void executeAsyncOperation(final FilterJoinNode node) { logger.debug("Executing async actions"); node.setState(FilterJoinNode.State.RUNNING); // set state before execution to avoid race conditions with listener NodePipelineManager pipeline = new NodePipelineManager(); pipeline.addListener(new NodePipelineListener() { @Override public void onSuccess() { node.setState(FilterJoinNode.State.COMPLETED); // set state before unblocking the queue to avoid race conditions FilterJoinVisitor.this.unblock(); } @Override public void onFailure(Throwable e) { node.setFailure(e); node.setState(FilterJoinNode.State.COMPLETED); // set state before unblocking the queue to avoid race conditions FilterJoinVisitor.this.unblock(); } }); // Adds the list of tasks to be executed pipeline.addTask(new IndicesVersionTask()); pipeline.addTask(new CacheLookupTask()); pipeline.addTask(new CardinalityEstimationTask()); pipeline.addTask(new TermsByQueryTask()); // Starts the execution of the pipeline pipeline.execute(new NodeTaskContext(client, node, this)); }
[ "protected", "void", "executeAsyncOperation", "(", "final", "FilterJoinNode", "node", ")", "{", "logger", ".", "debug", "(", "\"Executing async actions\"", ")", ";", "node", ".", "setState", "(", "FilterJoinNode", ".", "State", ".", "RUNNING", ")", ";", "// set state before execution to avoid race conditions with listener", "NodePipelineManager", "pipeline", "=", "new", "NodePipelineManager", "(", ")", ";", "pipeline", ".", "addListener", "(", "new", "NodePipelineListener", "(", ")", "{", "@", "Override", "public", "void", "onSuccess", "(", ")", "{", "node", ".", "setState", "(", "FilterJoinNode", ".", "State", ".", "COMPLETED", ")", ";", "// set state before unblocking the queue to avoid race conditions", "FilterJoinVisitor", ".", "this", ".", "unblock", "(", ")", ";", "}", "@", "Override", "public", "void", "onFailure", "(", "Throwable", "e", ")", "{", "node", ".", "setFailure", "(", "e", ")", ";", "node", ".", "setState", "(", "FilterJoinNode", ".", "State", ".", "COMPLETED", ")", ";", "// set state before unblocking the queue to avoid race conditions", "FilterJoinVisitor", ".", "this", ".", "unblock", "(", ")", ";", "}", "}", ")", ";", "// Adds the list of tasks to be executed", "pipeline", ".", "addTask", "(", "new", "IndicesVersionTask", "(", ")", ")", ";", "pipeline", ".", "addTask", "(", "new", "CacheLookupTask", "(", ")", ")", ";", "pipeline", ".", "addTask", "(", "new", "CardinalityEstimationTask", "(", ")", ")", ";", "pipeline", ".", "addTask", "(", "new", "TermsByQueryTask", "(", ")", ")", ";", "// Starts the execution of the pipeline", "pipeline", ".", "execute", "(", "new", "NodeTaskContext", "(", "client", ",", "node", ",", "this", ")", ")", ";", "}" ]
Executes the pipeline of async actions to compute the terms for this node.
[ "Executes", "the", "pipeline", "of", "async", "actions", "to", "compute", "the", "terms", "for", "this", "node", "." ]
train
https://github.com/sirensolutions/siren-join/blob/cba1111b209ce6f72ab7750d5488a573a6c77fe5/src/main/java/solutions/siren/join/action/coordinate/execution/FilterJoinVisitor.java#L193-L223
leancloud/java-sdk-all
android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/pay/PaySignUtil.java
PaySignUtil.doCheck
public static boolean doCheck(String noSignStr, String sign, String publicKey) { if (sign == null || noSignStr == null || publicKey == null) { return false; } try { KeyFactory keyFactory = KeyFactory.getInstance("RSA"); byte[] encodedKey = Base64.decode(publicKey, Base64.DEFAULT); PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS); signature.initVerify(pubKey); signature.update(noSignStr.getBytes(CHARSET)); return signature.verify(Base64.decode(sign, Base64.DEFAULT)); } catch (Exception e) { // 这里是安全算法,为避免出现异常时泄露加密信息,这里不打印具体日志 HMSAgentLog.e("doCheck error"); } return false; }
java
public static boolean doCheck(String noSignStr, String sign, String publicKey) { if (sign == null || noSignStr == null || publicKey == null) { return false; } try { KeyFactory keyFactory = KeyFactory.getInstance("RSA"); byte[] encodedKey = Base64.decode(publicKey, Base64.DEFAULT); PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS); signature.initVerify(pubKey); signature.update(noSignStr.getBytes(CHARSET)); return signature.verify(Base64.decode(sign, Base64.DEFAULT)); } catch (Exception e) { // 这里是安全算法,为避免出现异常时泄露加密信息,这里不打印具体日志 HMSAgentLog.e("doCheck error"); } return false; }
[ "public", "static", "boolean", "doCheck", "(", "String", "noSignStr", ",", "String", "sign", ",", "String", "publicKey", ")", "{", "if", "(", "sign", "==", "null", "||", "noSignStr", "==", "null", "||", "publicKey", "==", "null", ")", "{", "return", "false", ";", "}", "try", "{", "KeyFactory", "keyFactory", "=", "KeyFactory", ".", "getInstance", "(", "\"RSA\"", ")", ";", "byte", "[", "]", "encodedKey", "=", "Base64", ".", "decode", "(", "publicKey", ",", "Base64", ".", "DEFAULT", ")", ";", "PublicKey", "pubKey", "=", "keyFactory", ".", "generatePublic", "(", "new", "X509EncodedKeySpec", "(", "encodedKey", ")", ")", ";", "java", ".", "security", ".", "Signature", "signature", "=", "java", ".", "security", ".", "Signature", ".", "getInstance", "(", "SIGN_ALGORITHMS", ")", ";", "signature", ".", "initVerify", "(", "pubKey", ")", ";", "signature", ".", "update", "(", "noSignStr", ".", "getBytes", "(", "CHARSET", ")", ")", ";", "return", "signature", ".", "verify", "(", "Base64", ".", "decode", "(", "sign", ",", "Base64", ".", "DEFAULT", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// 这里是安全算法,为避免出现异常时泄露加密信息,这里不打印具体日志\r", "HMSAgentLog", ".", "e", "(", "\"doCheck error\"", ")", ";", "}", "return", "false", ";", "}" ]
校验签名信息 @param noSignStr 待校验未字符串 @param sign 签名字符串 @param publicKey 公钥 @return 是否校验通过
[ "校验签名信息" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/pay/PaySignUtil.java#L403-L425
craftercms/commons
utilities/src/main/java/org/craftercms/commons/lang/RegexUtils.java
RegexUtils.matchesAny
public static boolean matchesAny(String str, String... regexes) { if (ArrayUtils.isNotEmpty(regexes)) { return matchesAny(str, Arrays.asList(regexes)); } else { return false; } }
java
public static boolean matchesAny(String str, String... regexes) { if (ArrayUtils.isNotEmpty(regexes)) { return matchesAny(str, Arrays.asList(regexes)); } else { return false; } }
[ "public", "static", "boolean", "matchesAny", "(", "String", "str", ",", "String", "...", "regexes", ")", "{", "if", "(", "ArrayUtils", ".", "isNotEmpty", "(", "regexes", ")", ")", "{", "return", "matchesAny", "(", "str", ",", "Arrays", ".", "asList", "(", "regexes", ")", ")", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Returns true if the string matches any of the specified regexes. @param str the string to match @param regexes the regexes used for matching @return true if the string matches one or more of the regexes
[ "Returns", "true", "if", "the", "string", "matches", "any", "of", "the", "specified", "regexes", "." ]
train
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/lang/RegexUtils.java#L45-L51
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.ip_delegation_POST
public OvhReverseDelegation ip_delegation_POST(String ip, String target) throws IOException { String qPath = "/ip/{ip}/delegation"; StringBuilder sb = path(qPath, ip); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "target", target); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhReverseDelegation.class); }
java
public OvhReverseDelegation ip_delegation_POST(String ip, String target) throws IOException { String qPath = "/ip/{ip}/delegation"; StringBuilder sb = path(qPath, ip); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "target", target); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhReverseDelegation.class); }
[ "public", "OvhReverseDelegation", "ip_delegation_POST", "(", "String", "ip", ",", "String", "target", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/{ip}/delegation\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "ip", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"target\"", ",", "target", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhReverseDelegation", ".", "class", ")", ";", "}" ]
Add target for reverse delegation on IPv6 subnet REST: POST /ip/{ip}/delegation @param target [required] Target for reverse delegation on IPv6 @param ip [required]
[ "Add", "target", "for", "reverse", "delegation", "on", "IPv6", "subnet" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L153-L160
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/replay/PreservingHttpHeaderProcessor.java
PreservingHttpHeaderProcessor.preserve
protected void preserve(Map<String, String> output, String name, String value) { if (prefix != null) { output.put(prefix + name, value); } }
java
protected void preserve(Map<String, String> output, String name, String value) { if (prefix != null) { output.put(prefix + name, value); } }
[ "protected", "void", "preserve", "(", "Map", "<", "String", ",", "String", ">", "output", ",", "String", "name", ",", "String", "value", ")", "{", "if", "(", "prefix", "!=", "null", ")", "{", "output", ".", "put", "(", "prefix", "+", "name", ",", "value", ")", ";", "}", "}" ]
add a header {@code prefix + name} with value {@code value} to {@code output}. if {@code prefix} is either null or empty, this method is no-op. @param output headers Map @param name header name @param value header value
[ "add", "a", "header", "{" ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/replay/PreservingHttpHeaderProcessor.java#L45-L49
offbynull/coroutines
instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java
GenericGenerators.cloneInsnList
public static InsnList cloneInsnList(InsnList insnList, Set<LabelNode> globalLabels) { Validate.notNull(insnList); // remap all labelnodes Map<LabelNode, LabelNode> labelNodeMapping = new HashMap<>(); ListIterator<AbstractInsnNode> it = insnList.iterator(); while (it.hasNext()) { AbstractInsnNode abstractInsnNode = it.next(); if (abstractInsnNode instanceof LabelNode) { LabelNode existingLabelNode = (LabelNode) abstractInsnNode; labelNodeMapping.put(existingLabelNode, new LabelNode()); } } // override remapping such that global labels stay the same for (LabelNode globalLabel : globalLabels) { labelNodeMapping.put(globalLabel, globalLabel); } // clone InsnList ret = new InsnList(); it = insnList.iterator(); while (it.hasNext()) { AbstractInsnNode abstractInsnNode = it.next(); ret.add(abstractInsnNode.clone(labelNodeMapping)); } return ret; }
java
public static InsnList cloneInsnList(InsnList insnList, Set<LabelNode> globalLabels) { Validate.notNull(insnList); // remap all labelnodes Map<LabelNode, LabelNode> labelNodeMapping = new HashMap<>(); ListIterator<AbstractInsnNode> it = insnList.iterator(); while (it.hasNext()) { AbstractInsnNode abstractInsnNode = it.next(); if (abstractInsnNode instanceof LabelNode) { LabelNode existingLabelNode = (LabelNode) abstractInsnNode; labelNodeMapping.put(existingLabelNode, new LabelNode()); } } // override remapping such that global labels stay the same for (LabelNode globalLabel : globalLabels) { labelNodeMapping.put(globalLabel, globalLabel); } // clone InsnList ret = new InsnList(); it = insnList.iterator(); while (it.hasNext()) { AbstractInsnNode abstractInsnNode = it.next(); ret.add(abstractInsnNode.clone(labelNodeMapping)); } return ret; }
[ "public", "static", "InsnList", "cloneInsnList", "(", "InsnList", "insnList", ",", "Set", "<", "LabelNode", ">", "globalLabels", ")", "{", "Validate", ".", "notNull", "(", "insnList", ")", ";", "// remap all labelnodes", "Map", "<", "LabelNode", ",", "LabelNode", ">", "labelNodeMapping", "=", "new", "HashMap", "<>", "(", ")", ";", "ListIterator", "<", "AbstractInsnNode", ">", "it", "=", "insnList", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "AbstractInsnNode", "abstractInsnNode", "=", "it", ".", "next", "(", ")", ";", "if", "(", "abstractInsnNode", "instanceof", "LabelNode", ")", "{", "LabelNode", "existingLabelNode", "=", "(", "LabelNode", ")", "abstractInsnNode", ";", "labelNodeMapping", ".", "put", "(", "existingLabelNode", ",", "new", "LabelNode", "(", ")", ")", ";", "}", "}", "// override remapping such that global labels stay the same", "for", "(", "LabelNode", "globalLabel", ":", "globalLabels", ")", "{", "labelNodeMapping", ".", "put", "(", "globalLabel", ",", "globalLabel", ")", ";", "}", "// clone", "InsnList", "ret", "=", "new", "InsnList", "(", ")", ";", "it", "=", "insnList", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "AbstractInsnNode", "abstractInsnNode", "=", "it", ".", "next", "(", ")", ";", "ret", ".", "add", "(", "abstractInsnNode", ".", "clone", "(", "labelNodeMapping", ")", ")", ";", "}", "return", "ret", ";", "}" ]
Clones an instruction list. All labels are remapped unless otherwise specified in {@code globalLabels}. @param insnList instruction list to clone @param globalLabels set of labels that should not be remapped @throws NullPointerException if any argument is {@code null} @return instruction list with cloned instructions
[ "Clones", "an", "instruction", "list", ".", "All", "labels", "are", "remapped", "unless", "otherwise", "specified", "in", "{" ]
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L127-L155
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java
RecoveryDirectorImpl.addTerminationRecord
private void addTerminationRecord(RecoveryAgent recoveryAgent, FailureScope failureScope) { if (tc.isEntryEnabled()) Tr.entry(tc, "addTerminationRecord", new Object[] { recoveryAgent, failureScope, this }); synchronized (_outstandingTerminationRecords) { // Extract the set of failure scopes that the corrisponding client service is currently // processing HashSet<FailureScope> failureScopeSet = _outstandingTerminationRecords.get(recoveryAgent); // If its not handled yet any then create an empty set to hold both this and future // failure scopes. if (failureScopeSet == null) { failureScopeSet = new HashSet<FailureScope>(); _outstandingTerminationRecords.put(recoveryAgent, failureScopeSet); } // Add this new failure scope to the set of those currently being processed by the // client service. failureScopeSet.add(failureScope); } if (tc.isEntryEnabled()) Tr.exit(tc, "addTerminationRecord"); }
java
private void addTerminationRecord(RecoveryAgent recoveryAgent, FailureScope failureScope) { if (tc.isEntryEnabled()) Tr.entry(tc, "addTerminationRecord", new Object[] { recoveryAgent, failureScope, this }); synchronized (_outstandingTerminationRecords) { // Extract the set of failure scopes that the corrisponding client service is currently // processing HashSet<FailureScope> failureScopeSet = _outstandingTerminationRecords.get(recoveryAgent); // If its not handled yet any then create an empty set to hold both this and future // failure scopes. if (failureScopeSet == null) { failureScopeSet = new HashSet<FailureScope>(); _outstandingTerminationRecords.put(recoveryAgent, failureScopeSet); } // Add this new failure scope to the set of those currently being processed by the // client service. failureScopeSet.add(failureScope); } if (tc.isEntryEnabled()) Tr.exit(tc, "addTerminationRecord"); }
[ "private", "void", "addTerminationRecord", "(", "RecoveryAgent", "recoveryAgent", ",", "FailureScope", "failureScope", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"addTerminationRecord\"", ",", "new", "Object", "[", "]", "{", "recoveryAgent", ",", "failureScope", ",", "this", "}", ")", ";", "synchronized", "(", "_outstandingTerminationRecords", ")", "{", "// Extract the set of failure scopes that the corrisponding client service is currently", "// processing", "HashSet", "<", "FailureScope", ">", "failureScopeSet", "=", "_outstandingTerminationRecords", ".", "get", "(", "recoveryAgent", ")", ";", "// If its not handled yet any then create an empty set to hold both this and future", "// failure scopes.", "if", "(", "failureScopeSet", "==", "null", ")", "{", "failureScopeSet", "=", "new", "HashSet", "<", "FailureScope", ">", "(", ")", ";", "_outstandingTerminationRecords", ".", "put", "(", "recoveryAgent", ",", "failureScopeSet", ")", ";", "}", "// Add this new failure scope to the set of those currently being processed by the", "// client service.", "failureScopeSet", ".", "add", "(", "failureScope", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"addTerminationRecord\"", ")", ";", "}" ]
<p> Internal method to record a termination request for the supplied RecoveryAgent and FailureScope combination. </p> <p> Just prior to requesting a RecoveryAgent to "terminateRecovery" of a FailureScope, this method is driven to record the request. When the client service is ready and invokes RecoveryDirector.terminateComplete, the removeTerminationRecord method is called to remove this record. </p> @param recoveryAgent The RecoveryAgent that is about to be directed to terminate recovery of a FailureScope. @param failureScope The FailureScope.
[ "<p", ">", "Internal", "method", "to", "record", "a", "termination", "request", "for", "the", "supplied", "RecoveryAgent", "and", "FailureScope", "combination", ".", "<", "/", "p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java#L881-L904
samskivert/samskivert
src/main/java/com/samskivert/util/Calendars.java
Calendars.in
public static Builder in (TimeZone zone, Locale locale) { return with(Calendar.getInstance(zone, locale)); }
java
public static Builder in (TimeZone zone, Locale locale) { return with(Calendar.getInstance(zone, locale)); }
[ "public", "static", "Builder", "in", "(", "TimeZone", "zone", ",", "Locale", "locale", ")", "{", "return", "with", "(", "Calendar", ".", "getInstance", "(", "zone", ",", "locale", ")", ")", ";", "}" ]
Returns a fluent wrapper around a calendar for the specifed time zone and locale.
[ "Returns", "a", "fluent", "wrapper", "around", "a", "calendar", "for", "the", "specifed", "time", "zone", "and", "locale", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Calendars.java#L233-L236
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/WebSockets.java
WebSockets.sendPong
public static void sendPong(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) { sendInternal(pooledData, WebSocketFrameType.PONG, wsChannel, callback, null, -1); }
java
public static void sendPong(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) { sendInternal(pooledData, WebSocketFrameType.PONG, wsChannel, callback, null, -1); }
[ "public", "static", "void", "sendPong", "(", "final", "PooledByteBuffer", "pooledData", ",", "final", "WebSocketChannel", "wsChannel", ",", "final", "WebSocketCallback", "<", "Void", ">", "callback", ")", "{", "sendInternal", "(", "pooledData", ",", "WebSocketFrameType", ".", "PONG", ",", "wsChannel", ",", "callback", ",", "null", ",", "-", "1", ")", ";", "}" ]
Sends a complete pong message, invoking the callback when complete Automatically frees the pooled byte buffer when done. @param pooledData The data to send, it will be freed when done @param wsChannel The web socket channel @param callback The callback to invoke on completion
[ "Sends", "a", "complete", "pong", "message", "invoking", "the", "callback", "when", "complete", "Automatically", "frees", "the", "pooled", "byte", "buffer", "when", "done", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L507-L509
taimos/dvalin
interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/InterconnectMapper.java
InterconnectMapper.fromJson
public static <T extends InterconnectObject> T fromJson(String data, Class<T> clazz) throws IOException { return InterconnectMapper.mapper.readValue(data, clazz); }
java
public static <T extends InterconnectObject> T fromJson(String data, Class<T> clazz) throws IOException { return InterconnectMapper.mapper.readValue(data, clazz); }
[ "public", "static", "<", "T", "extends", "InterconnectObject", ">", "T", "fromJson", "(", "String", "data", ",", "Class", "<", "T", ">", "clazz", ")", "throws", "IOException", "{", "return", "InterconnectMapper", ".", "mapper", ".", "readValue", "(", "data", ",", "clazz", ")", ";", "}" ]
Creates an object from the given JSON data. @param data the JSON data @param clazz the class object for the content of the JSON data @param <T> the type of the class object extending {@link InterconnectObject} @return the object contained in the given JSON data @throws JsonParseException if a the JSON data could not be parsed @throws JsonMappingException if the mapping of the JSON data to the IVO failed @throws IOException if an I/O related problem occurred
[ "Creates", "an", "object", "from", "the", "given", "JSON", "data", "." ]
train
https://github.com/taimos/dvalin/blob/ff8f1bf594e43d7e8ca8de0b4da9f923b66a1a47/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/InterconnectMapper.java#L77-L79
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 { 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", "(", ")", ";", "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", ")", ";", "}" ]
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
groovy/groovy-core
src/main/groovy/lang/MetaProperty.java
MetaProperty.getGetterName
public static String getGetterName(String propertyName, Class type) { 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\"", ";", "return", "prefix", "+", "MetaClassHelper", ".", "capitalize", "(", "propertyName", ")", ";", "}" ]
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
playn/playn
core/src/playn/core/json/JsonParser.java
JsonParser.createHelpfulException
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); }
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", "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", ")", ";", "}" ]
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
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) { 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", "(", "uic", ")", ";", "try", "{", "component", ".", "paint", "(", "new", "WebXmlRenderContext", "(", "(", "PrintWriter", ")", "backing", ")", ")", ";", "}", "finally", "{", "UIContextHolder", ".", "popContext", "(", ")", ";", "}", "}" ]
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
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) { 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", "(", "view", ",", "applicationContext", ".", "getEnvironment", "(", ")", ",", "applicationContext", ".", "getClassLoader", "(", ")", ",", "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
[ "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
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) { 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", ")", ")", "{", "return", ";", "}", "if", "(", "isMaybeRecursive", "(", "o", ")", ")", "{", "appendPotentiallyRecursiveValue", "(", "o", ",", "str", ",", "dejaVu", ")", ";", "}", "else", "{", "tryObjectToString", "(", "o", ",", "str", ")", ";", "}", "}" ]
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", "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", ">" ]
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
google/closure-compiler
src/com/google/javascript/jscomp/TypeValidator.java
TypeValidator.expectSuperType
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); } } }
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", ".", "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", ")", ";", "}", "}", "}" ]
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
actorapp/droidkit-actors
actors/src/main/java/com/droidkit/actors/mailbox/Mailbox.java
Mailbox.isEqualEnvelope
protected boolean isEqualEnvelope(Envelope a, Envelope b) { 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
haraldk/TwelveMonkeys
servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java
ContentNegotiationFilter.adjustQualityFromAccept
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); } }
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; if both explicit types and wildcards\r", "// (without qaulity factor) are present, */* is interpreted as\r", "// */*;q=0.01 and image/* is interpreted as image/*;q=0.02\r", "// See: http://httpd.apache.org/docs-2.0/content-negotiation.html\r", "String", "accept", "=", "getAcceptedFormats", "(", "pRequest", ")", ";", "//System.out.println(\"Accept: \" + accept);\r", "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);\r", "String", "formatMIME", "=", "MIME_TYPE_IMAGE_PREFIX", "+", "format", ";", "float", "qFactor", "=", "getQualityFactor", "(", "accept", ",", "formatMIME", ")", ";", "qFactor", "=", "(", "qFactor", "==", "0f", ")", "?", "Math", ".", "max", "(", "anyFactor", ",", "anyImageFactor", ")", ":", "qFactor", ";", "adjustQuality", "(", "pFormatQuality", ",", "format", ",", "qFactor", ")", ";", "}", "}" ]
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
revelytix/spark
sherpa-java/src/main/java/sherpa/client/QueryExecution.java
QueryExecution.asyncMoreRequest
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); } }
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", ";", "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", ")", ";", "}", "}" ]
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
fuinorg/utils4j
src/main/java/org/fuin/utils4j/Utils4J.java
Utils4J.toDigit
private static int toDigit(final char ch, final int index) { final int digit = Character.digit(ch, 16); if (digit == -1) { throw new RuntimeException("Illegal hexadecimal charcter " + ch + " at index " + index); } return digit; }
java
private static int toDigit(final char ch, final int index) { final int digit = Character.digit(ch, 16); if (digit == -1) { throw new RuntimeException("Illegal hexadecimal charcter " + ch + " at index " + index); } return digit; }
[ "private", "static", "int", "toDigit", "(", "final", "char", "ch", ",", "final", "int", "index", ")", "{", "final", "int", "digit", "=", "Character", ".", "digit", "(", "ch", ",", "16", ")", ";", "if", "(", "digit", "==", "-", "1", ")", "{", "throw", "new", "RuntimeException", "(", "\"Illegal hexadecimal charcter \"", "+", "ch", "+", "\" at index \"", "+", "index", ")", ";", "}", "return", "digit", ";", "}" ]
Converts a hexadecimal character to an integer. @param ch A character to convert to an integer digit @param index The index of the character in the source @return An integer @author Apache Software Foundation @see org.apache.commons.codec.binary.Hex
[ "Converts", "a", "hexadecimal", "character", "to", "an", "integer", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L1227-L1233
morimekta/providence
providence-core/src/main/java/net/morimekta/providence/serializer/pretty/Tokenizer.java
Tokenizer.peek
@Nonnull public Token peek(String message) throws IOException { if (!hasNext()) { throw failure(lineNo, linePos + 1, 0, "Expected %s: Got end of file", message); } return unreadToken; }
java
@Nonnull public Token peek(String message) throws IOException { if (!hasNext()) { throw failure(lineNo, linePos + 1, 0, "Expected %s: Got end of file", message); } return unreadToken; }
[ "@", "Nonnull", "public", "Token", "peek", "(", "String", "message", ")", "throws", "IOException", "{", "if", "(", "!", "hasNext", "(", ")", ")", "{", "throw", "failure", "(", "lineNo", ",", "linePos", "+", "1", ",", "0", ",", "\"Expected %s: Got end of file\"", ",", "message", ")", ";", "}", "return", "unreadToken", ";", "}" ]
Return the next token or throw an exception. Though it does not consume that token. @param message Message to add to exception if there are no more JSON tokens on the stream. @return The next token. @throws IOException If unable to read from stream.
[ "Return", "the", "next", "token", "or", "throw", "an", "exception", ".", "Though", "it", "does", "not", "consume", "that", "token", "." ]
train
https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/serializer/pretty/Tokenizer.java#L254-L260
structurizr/java
structurizr-core/src/com/structurizr/model/ModelItem.java
ModelItem.addPerspective
public Perspective addPerspective(String name, String description) { if (StringUtils.isNullOrEmpty(name)) { throw new IllegalArgumentException("A name must be specified."); } if (StringUtils.isNullOrEmpty(description)) { throw new IllegalArgumentException("A description must be specified."); } if (perspectives.stream().filter(p -> p.getName().equals(name)).count() > 0) { throw new IllegalArgumentException("A perspective named \"" + name + "\" already exists."); } Perspective perspective = new Perspective(name, description); perspectives.add(perspective); return perspective; }
java
public Perspective addPerspective(String name, String description) { if (StringUtils.isNullOrEmpty(name)) { throw new IllegalArgumentException("A name must be specified."); } if (StringUtils.isNullOrEmpty(description)) { throw new IllegalArgumentException("A description must be specified."); } if (perspectives.stream().filter(p -> p.getName().equals(name)).count() > 0) { throw new IllegalArgumentException("A perspective named \"" + name + "\" already exists."); } Perspective perspective = new Perspective(name, description); perspectives.add(perspective); return perspective; }
[ "public", "Perspective", "addPerspective", "(", "String", "name", ",", "String", "description", ")", "{", "if", "(", "StringUtils", ".", "isNullOrEmpty", "(", "name", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A name must be specified.\"", ")", ";", "}", "if", "(", "StringUtils", ".", "isNullOrEmpty", "(", "description", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A description must be specified.\"", ")", ";", "}", "if", "(", "perspectives", ".", "stream", "(", ")", ".", "filter", "(", "p", "->", "p", ".", "getName", "(", ")", ".", "equals", "(", "name", ")", ")", ".", "count", "(", ")", ">", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A perspective named \\\"\"", "+", "name", "+", "\"\\\" already exists.\"", ")", ";", "}", "Perspective", "perspective", "=", "new", "Perspective", "(", "name", ",", "description", ")", ";", "perspectives", ".", "add", "(", "perspective", ")", ";", "return", "perspective", ";", "}" ]
Adds a perspective to this model item. @param name the name of the perspective (e.g. "Security", must be unique) @param description a description of the perspective @return a Perspective object @throws IllegalArgumentException if perspective details are not specified, or the named perspective exists already
[ "Adds", "a", "perspective", "to", "this", "model", "item", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/ModelItem.java#L156-L173
ThreeTen/threetenbp
src/main/java/org/threeten/bp/zone/ZoneRulesBuilder.java
ZoneRulesBuilder.addWindowForever
public ZoneRulesBuilder addWindowForever(ZoneOffset standardOffset) { return addWindow(standardOffset, LocalDateTime.MAX, TimeDefinition.WALL); }
java
public ZoneRulesBuilder addWindowForever(ZoneOffset standardOffset) { return addWindow(standardOffset, LocalDateTime.MAX, TimeDefinition.WALL); }
[ "public", "ZoneRulesBuilder", "addWindowForever", "(", "ZoneOffset", "standardOffset", ")", "{", "return", "addWindow", "(", "standardOffset", ",", "LocalDateTime", ".", "MAX", ",", "TimeDefinition", ".", "WALL", ")", ";", "}" ]
Adds a window that applies until the end of time to the builder that can be used to filter a set of rules. <p> This method defines and adds a window to the zone where the standard offset is specified. The window limits the effect of subsequent additions of transition rules or fixed savings. If neither rules or fixed savings are added to the window then the window will default to no savings. <p> This must be added after all other windows. No more windows can be added after this one. @param standardOffset the standard offset, not null @return this, for chaining @throws IllegalStateException if a forever window has already been added
[ "Adds", "a", "window", "that", "applies", "until", "the", "end", "of", "time", "to", "the", "builder", "that", "can", "be", "used", "to", "filter", "a", "set", "of", "rules", ".", "<p", ">", "This", "method", "defines", "and", "adds", "a", "window", "to", "the", "zone", "where", "the", "standard", "offset", "is", "specified", ".", "The", "window", "limits", "the", "effect", "of", "subsequent", "additions", "of", "transition", "rules", "or", "fixed", "savings", ".", "If", "neither", "rules", "or", "fixed", "savings", "are", "added", "to", "the", "window", "then", "the", "window", "will", "default", "to", "no", "savings", ".", "<p", ">", "This", "must", "be", "added", "after", "all", "other", "windows", ".", "No", "more", "windows", "can", "be", "added", "after", "this", "one", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/zone/ZoneRulesBuilder.java#L148-L150
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java
CommonOps_ZDRM.multTransB
public static void multTransB(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { MatrixMatrixMult_ZDRM.multTransB(a, b, c); }
java
public static void multTransB(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { MatrixMatrixMult_ZDRM.multTransB(a, b, c); }
[ "public", "static", "void", "multTransB", "(", "ZMatrixRMaj", "a", ",", "ZMatrixRMaj", "b", ",", "ZMatrixRMaj", "c", ")", "{", "MatrixMatrixMult_ZDRM", ".", "multTransB", "(", "a", ",", "b", ",", "c", ")", ";", "}" ]
<p> Performs the following operation:<br> <br> c = a * b<sup>H</sup> <br> c<sub>ij</sub> = &sum;<sub>k=1:n</sub> { a<sub>ik</sub> * b<sub>jk</sub>} </p> @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "a", "*", "b<sup", ">", "H<", "/", "sup", ">", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "&sum", ";", "<sub", ">", "k", "=", "1", ":", "n<", "/", "sub", ">", "{", "a<sub", ">", "ik<", "/", "sub", ">", "*", "b<sub", ">", "jk<", "/", "sub", ">", "}", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L501-L504
sebastiangraf/jSCSI
bundles/commons/src/main/java/org/jscsi/parser/ProtocolDataUnit.java
ProtocolDataUnit.deserializeAdditionalHeaderSegments
private final int deserializeAdditionalHeaderSegments (final ByteBuffer pdu, final int offset) throws InternetSCSIException { // parsing Additional Header Segment int off = offset; int ahsLength = basicHeaderSegment.getTotalAHSLength(); while (ahsLength != 0) { final AdditionalHeaderSegment tmpAHS = new AdditionalHeaderSegment(); tmpAHS.deserialize(pdu, off); additionalHeaderSegments.add(tmpAHS); ahsLength -= tmpAHS.getLength(); off += tmpAHS.getSpecificField().position(); } return off - offset; }
java
private final int deserializeAdditionalHeaderSegments (final ByteBuffer pdu, final int offset) throws InternetSCSIException { // parsing Additional Header Segment int off = offset; int ahsLength = basicHeaderSegment.getTotalAHSLength(); while (ahsLength != 0) { final AdditionalHeaderSegment tmpAHS = new AdditionalHeaderSegment(); tmpAHS.deserialize(pdu, off); additionalHeaderSegments.add(tmpAHS); ahsLength -= tmpAHS.getLength(); off += tmpAHS.getSpecificField().position(); } return off - offset; }
[ "private", "final", "int", "deserializeAdditionalHeaderSegments", "(", "final", "ByteBuffer", "pdu", ",", "final", "int", "offset", ")", "throws", "InternetSCSIException", "{", "// parsing Additional Header Segment", "int", "off", "=", "offset", ";", "int", "ahsLength", "=", "basicHeaderSegment", ".", "getTotalAHSLength", "(", ")", ";", "while", "(", "ahsLength", "!=", "0", ")", "{", "final", "AdditionalHeaderSegment", "tmpAHS", "=", "new", "AdditionalHeaderSegment", "(", ")", ";", "tmpAHS", ".", "deserialize", "(", "pdu", ",", "off", ")", ";", "additionalHeaderSegments", ".", "add", "(", "tmpAHS", ")", ";", "ahsLength", "-=", "tmpAHS", ".", "getLength", "(", ")", ";", "off", "+=", "tmpAHS", ".", "getSpecificField", "(", ")", ".", "position", "(", ")", ";", "}", "return", "off", "-", "offset", ";", "}" ]
Deserializes a array (starting from the given offset) and store the informations to the <code>AdditionalHeaderSegment</code> object. @param pdu The <code>ByteBuffer</code> to read from. @param offset The offset to start from. @return The length of the written bytes. @throws InternetSCSIException If any violation of the iSCSI-Standard emerge.
[ "Deserializes", "a", "array", "(", "starting", "from", "the", "given", "offset", ")", "and", "store", "the", "informations", "to", "the", "<code", ">", "AdditionalHeaderSegment<", "/", "code", ">", "object", "." ]
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/commons/src/main/java/org/jscsi/parser/ProtocolDataUnit.java#L224-L240
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/EntityTypeDependencyResolver.java
EntityTypeDependencyResolver.expandEntityTypeDependencies
private static Set<EntityTypeNode> expandEntityTypeDependencies(EntityTypeNode entityTypeNode) { if (LOG.isTraceEnabled()) { LOG.trace( "expandEntityTypeDependencies(EntityTypeNode entityTypeNode) --- entity: [{}], skip: [{}]", entityTypeNode.getEntityType().getId(), entityTypeNode.isSkip()); } if (!entityTypeNode.isSkip()) { // get referenced entities excluding entities of mappedBy attributes EntityType entityType = entityTypeNode.getEntityType(); Set<EntityTypeNode> refEntityMetaSet = stream(entityType.getOwnAllAttributes()) .filter(attribute -> isProcessableAttribute(attribute, entityType)) .flatMap( attr -> { EntityTypeNode nodeRef = new EntityTypeNode(attr.getRefEntity(), entityTypeNode.getStack()); Set<EntityTypeNode> dependenciesRef = expandEntityTypeDependencies(nodeRef); dependenciesRef.add(nodeRef); return dependenciesRef.stream(); }) .collect(toCollection(HashSet::new)); EntityType extendsEntityMeta = entityType.getExtends(); if (extendsEntityMeta != null) { EntityTypeNode nodeRef = new EntityTypeNode(extendsEntityMeta, entityTypeNode.getStack()); // Add extended entity to set refEntityMetaSet.add(nodeRef); // Add dependencies of extended entity to set Set<EntityTypeNode> dependenciesRef = expandEntityTypeDependencies(nodeRef); refEntityMetaSet.addAll(dependenciesRef); } return refEntityMetaSet; } else { return Sets.newHashSet(); } }
java
private static Set<EntityTypeNode> expandEntityTypeDependencies(EntityTypeNode entityTypeNode) { if (LOG.isTraceEnabled()) { LOG.trace( "expandEntityTypeDependencies(EntityTypeNode entityTypeNode) --- entity: [{}], skip: [{}]", entityTypeNode.getEntityType().getId(), entityTypeNode.isSkip()); } if (!entityTypeNode.isSkip()) { // get referenced entities excluding entities of mappedBy attributes EntityType entityType = entityTypeNode.getEntityType(); Set<EntityTypeNode> refEntityMetaSet = stream(entityType.getOwnAllAttributes()) .filter(attribute -> isProcessableAttribute(attribute, entityType)) .flatMap( attr -> { EntityTypeNode nodeRef = new EntityTypeNode(attr.getRefEntity(), entityTypeNode.getStack()); Set<EntityTypeNode> dependenciesRef = expandEntityTypeDependencies(nodeRef); dependenciesRef.add(nodeRef); return dependenciesRef.stream(); }) .collect(toCollection(HashSet::new)); EntityType extendsEntityMeta = entityType.getExtends(); if (extendsEntityMeta != null) { EntityTypeNode nodeRef = new EntityTypeNode(extendsEntityMeta, entityTypeNode.getStack()); // Add extended entity to set refEntityMetaSet.add(nodeRef); // Add dependencies of extended entity to set Set<EntityTypeNode> dependenciesRef = expandEntityTypeDependencies(nodeRef); refEntityMetaSet.addAll(dependenciesRef); } return refEntityMetaSet; } else { return Sets.newHashSet(); } }
[ "private", "static", "Set", "<", "EntityTypeNode", ">", "expandEntityTypeDependencies", "(", "EntityTypeNode", "entityTypeNode", ")", "{", "if", "(", "LOG", ".", "isTraceEnabled", "(", ")", ")", "{", "LOG", ".", "trace", "(", "\"expandEntityTypeDependencies(EntityTypeNode entityTypeNode) --- entity: [{}], skip: [{}]\"", ",", "entityTypeNode", ".", "getEntityType", "(", ")", ".", "getId", "(", ")", ",", "entityTypeNode", ".", "isSkip", "(", ")", ")", ";", "}", "if", "(", "!", "entityTypeNode", ".", "isSkip", "(", ")", ")", "{", "// get referenced entities excluding entities of mappedBy attributes", "EntityType", "entityType", "=", "entityTypeNode", ".", "getEntityType", "(", ")", ";", "Set", "<", "EntityTypeNode", ">", "refEntityMetaSet", "=", "stream", "(", "entityType", ".", "getOwnAllAttributes", "(", ")", ")", ".", "filter", "(", "attribute", "->", "isProcessableAttribute", "(", "attribute", ",", "entityType", ")", ")", ".", "flatMap", "(", "attr", "->", "{", "EntityTypeNode", "nodeRef", "=", "new", "EntityTypeNode", "(", "attr", ".", "getRefEntity", "(", ")", ",", "entityTypeNode", ".", "getStack", "(", ")", ")", ";", "Set", "<", "EntityTypeNode", ">", "dependenciesRef", "=", "expandEntityTypeDependencies", "(", "nodeRef", ")", ";", "dependenciesRef", ".", "add", "(", "nodeRef", ")", ";", "return", "dependenciesRef", ".", "stream", "(", ")", ";", "}", ")", ".", "collect", "(", "toCollection", "(", "HashSet", "::", "new", ")", ")", ";", "EntityType", "extendsEntityMeta", "=", "entityType", ".", "getExtends", "(", ")", ";", "if", "(", "extendsEntityMeta", "!=", "null", ")", "{", "EntityTypeNode", "nodeRef", "=", "new", "EntityTypeNode", "(", "extendsEntityMeta", ",", "entityTypeNode", ".", "getStack", "(", ")", ")", ";", "// Add extended entity to set", "refEntityMetaSet", ".", "add", "(", "nodeRef", ")", ";", "// Add dependencies of extended entity to set", "Set", "<", "EntityTypeNode", ">", "dependenciesRef", "=", "expandEntityTypeDependencies", "(", "nodeRef", ")", ";", "refEntityMetaSet", ".", "addAll", "(", "dependenciesRef", ")", ";", "}", "return", "refEntityMetaSet", ";", "}", "else", "{", "return", "Sets", ".", "newHashSet", "(", ")", ";", "}", "}" ]
Returns whole tree dependencies of the given entity meta data. @param entityTypeNode entity meta data node @return dependencies of the entity meta data node
[ "Returns", "whole", "tree", "dependencies", "of", "the", "given", "entity", "meta", "data", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/EntityTypeDependencyResolver.java#L110-L149
elki-project/elki
elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/datasource/bundle/MultipleObjectsBundle.java
MultipleObjectsBundle.makeSimple
public static <V1, V2, V3> MultipleObjectsBundle makeSimple(SimpleTypeInformation<? super V1> type1, List<? extends V1> data1, SimpleTypeInformation<? super V2> type2, List<? extends V2> data2, SimpleTypeInformation<? super V3> type3, List<? extends V3> data3) { MultipleObjectsBundle bundle = new MultipleObjectsBundle(); bundle.appendColumn(type1, data1); bundle.appendColumn(type2, data2); bundle.appendColumn(type3, data3); return bundle; }
java
public static <V1, V2, V3> MultipleObjectsBundle makeSimple(SimpleTypeInformation<? super V1> type1, List<? extends V1> data1, SimpleTypeInformation<? super V2> type2, List<? extends V2> data2, SimpleTypeInformation<? super V3> type3, List<? extends V3> data3) { MultipleObjectsBundle bundle = new MultipleObjectsBundle(); bundle.appendColumn(type1, data1); bundle.appendColumn(type2, data2); bundle.appendColumn(type3, data3); return bundle; }
[ "public", "static", "<", "V1", ",", "V2", ",", "V3", ">", "MultipleObjectsBundle", "makeSimple", "(", "SimpleTypeInformation", "<", "?", "super", "V1", ">", "type1", ",", "List", "<", "?", "extends", "V1", ">", "data1", ",", "SimpleTypeInformation", "<", "?", "super", "V2", ">", "type2", ",", "List", "<", "?", "extends", "V2", ">", "data2", ",", "SimpleTypeInformation", "<", "?", "super", "V3", ">", "type3", ",", "List", "<", "?", "extends", "V3", ">", "data3", ")", "{", "MultipleObjectsBundle", "bundle", "=", "new", "MultipleObjectsBundle", "(", ")", ";", "bundle", ".", "appendColumn", "(", "type1", ",", "data1", ")", ";", "bundle", ".", "appendColumn", "(", "type2", ",", "data2", ")", ";", "bundle", ".", "appendColumn", "(", "type3", ",", "data3", ")", ";", "return", "bundle", ";", "}" ]
Helper to add a single column to the bundle. @param <V1> First Object type @param <V2> Second Object type @param <V3> Third Object type @param type1 First type information @param data1 First data column to add @param type2 Second type information @param data2 Second data column to add @param type3 Third type information @param data3 Third data column to add
[ "Helper", "to", "add", "a", "single", "column", "to", "the", "bundle", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/datasource/bundle/MultipleObjectsBundle.java#L210-L216
knowm/XChange
xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseAccountServiceRaw.java
CoinbaseAccountServiceRaw.getCoinbaseAccounts
public List<CoinbaseAccount> getCoinbaseAccounts() throws IOException { String apiKey = exchange.getExchangeSpecification().getApiKey(); BigDecimal timestamp = coinbase.getTime(Coinbase.CB_VERSION_VALUE).getData().getEpoch(); return coinbase .getAccounts(Coinbase.CB_VERSION_VALUE, apiKey, signatureCreator2, timestamp) .getData(); }
java
public List<CoinbaseAccount> getCoinbaseAccounts() throws IOException { String apiKey = exchange.getExchangeSpecification().getApiKey(); BigDecimal timestamp = coinbase.getTime(Coinbase.CB_VERSION_VALUE).getData().getEpoch(); return coinbase .getAccounts(Coinbase.CB_VERSION_VALUE, apiKey, signatureCreator2, timestamp) .getData(); }
[ "public", "List", "<", "CoinbaseAccount", ">", "getCoinbaseAccounts", "(", ")", "throws", "IOException", "{", "String", "apiKey", "=", "exchange", ".", "getExchangeSpecification", "(", ")", ".", "getApiKey", "(", ")", ";", "BigDecimal", "timestamp", "=", "coinbase", ".", "getTime", "(", "Coinbase", ".", "CB_VERSION_VALUE", ")", ".", "getData", "(", ")", ".", "getEpoch", "(", ")", ";", "return", "coinbase", ".", "getAccounts", "(", "Coinbase", ".", "CB_VERSION_VALUE", ",", "apiKey", ",", "signatureCreator2", ",", "timestamp", ")", ".", "getData", "(", ")", ";", "}" ]
Authenticated resource that shows the current user accounts. @see <a href="https://developers.coinbase.com/api/v2#list-accounts">developers.coinbase.com/api/v2#list-accounts</a>
[ "Authenticated", "resource", "that", "shows", "the", "current", "user", "accounts", "." ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseAccountServiceRaw.java#L52-L59
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/util/ThreadUtil.java
ThreadUtil.getThreadFactory
public static ThreadFactory getThreadFactory(String nameFormat, boolean daemon) { if (PlatformInformation.isOnGAEStandard7() || PlatformInformation.isOnGAEStandard8()) { return MoreExecutors.platformThreadFactory(); } else { return new ThreadFactoryBuilder() .setDaemon(daemon) .setNameFormat(nameFormat) .build(); } }
java
public static ThreadFactory getThreadFactory(String nameFormat, boolean daemon) { if (PlatformInformation.isOnGAEStandard7() || PlatformInformation.isOnGAEStandard8()) { return MoreExecutors.platformThreadFactory(); } else { return new ThreadFactoryBuilder() .setDaemon(daemon) .setNameFormat(nameFormat) .build(); } }
[ "public", "static", "ThreadFactory", "getThreadFactory", "(", "String", "nameFormat", ",", "boolean", "daemon", ")", "{", "if", "(", "PlatformInformation", ".", "isOnGAEStandard7", "(", ")", "||", "PlatformInformation", ".", "isOnGAEStandard8", "(", ")", ")", "{", "return", "MoreExecutors", ".", "platformThreadFactory", "(", ")", ";", "}", "else", "{", "return", "new", "ThreadFactoryBuilder", "(", ")", ".", "setDaemon", "(", "daemon", ")", ".", "setNameFormat", "(", "nameFormat", ")", ".", "build", "(", ")", ";", "}", "}" ]
Get a {@link ThreadFactory} suitable for use in the current environment. @param nameFormat to apply to threads created by the factory. @param daemon {@code true} if the threads the factory creates are daemon threads, {@code false} otherwise. @return a {@link ThreadFactory}.
[ "Get", "a", "{" ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/util/ThreadUtil.java#L38-L47
mattprecious/telescope
telescope/src/main/java/com/mattprecious/telescope/TelescopeFileProvider.java
TelescopeFileProvider.getUriForFile
public static Uri getUriForFile(Context context, File file) { return getUriForFile(context, context.getPackageName() + ".telescope.fileprovider", file); }
java
public static Uri getUriForFile(Context context, File file) { return getUriForFile(context, context.getPackageName() + ".telescope.fileprovider", file); }
[ "public", "static", "Uri", "getUriForFile", "(", "Context", "context", ",", "File", "file", ")", "{", "return", "getUriForFile", "(", "context", ",", "context", ".", "getPackageName", "(", ")", "+", "\".telescope.fileprovider\"", ",", "file", ")", ";", "}" ]
Calls {@link #getUriForFile(Context, String, File)} using the correct authority for Telescope screenshots.
[ "Calls", "{" ]
train
https://github.com/mattprecious/telescope/blob/ce5e2710fb16ee214026fc25b091eb946fdbbb3c/telescope/src/main/java/com/mattprecious/telescope/TelescopeFileProvider.java#L12-L14
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java
ContentSpecParser.calculateLineIndentationLevel
protected int calculateLineIndentationLevel(final ParserData parserData, final String line, int lineNumber) throws IndentationException { char[] lineCharArray = line.toCharArray(); int indentationCount = 0; // Count the amount of whitespace characters before any text to determine the level if (Character.isWhitespace(lineCharArray[0])) { for (char c : lineCharArray) { if (Character.isWhitespace(c)) { indentationCount++; } else { break; } } if (indentationCount % parserData.getIndentationSize() != 0) { throw new IndentationException(format(ProcessorConstants.ERROR_INCORRECT_INDENTATION_MSG, lineNumber, line.trim())); } } return indentationCount / parserData.getIndentationSize(); }
java
protected int calculateLineIndentationLevel(final ParserData parserData, final String line, int lineNumber) throws IndentationException { char[] lineCharArray = line.toCharArray(); int indentationCount = 0; // Count the amount of whitespace characters before any text to determine the level if (Character.isWhitespace(lineCharArray[0])) { for (char c : lineCharArray) { if (Character.isWhitespace(c)) { indentationCount++; } else { break; } } if (indentationCount % parserData.getIndentationSize() != 0) { throw new IndentationException(format(ProcessorConstants.ERROR_INCORRECT_INDENTATION_MSG, lineNumber, line.trim())); } } return indentationCount / parserData.getIndentationSize(); }
[ "protected", "int", "calculateLineIndentationLevel", "(", "final", "ParserData", "parserData", ",", "final", "String", "line", ",", "int", "lineNumber", ")", "throws", "IndentationException", "{", "char", "[", "]", "lineCharArray", "=", "line", ".", "toCharArray", "(", ")", ";", "int", "indentationCount", "=", "0", ";", "// Count the amount of whitespace characters before any text to determine the level", "if", "(", "Character", ".", "isWhitespace", "(", "lineCharArray", "[", "0", "]", ")", ")", "{", "for", "(", "char", "c", ":", "lineCharArray", ")", "{", "if", "(", "Character", ".", "isWhitespace", "(", "c", ")", ")", "{", "indentationCount", "++", ";", "}", "else", "{", "break", ";", "}", "}", "if", "(", "indentationCount", "%", "parserData", ".", "getIndentationSize", "(", ")", "!=", "0", ")", "{", "throw", "new", "IndentationException", "(", "format", "(", "ProcessorConstants", ".", "ERROR_INCORRECT_INDENTATION_MSG", ",", "lineNumber", ",", "line", ".", "trim", "(", ")", ")", ")", ";", "}", "}", "return", "indentationCount", "/", "parserData", ".", "getIndentationSize", "(", ")", ";", "}" ]
Calculates the indentation level of a line using the amount of whitespace and the parsers indentation size setting. @param parserData @param line The line to calculate the indentation for. @return The lines indentation level. @throws IndentationException Thrown if the indentation for the line isn't valid.
[ "Calculates", "the", "indentation", "level", "of", "a", "line", "using", "the", "amount", "of", "whitespace", "and", "the", "parsers", "indentation", "size", "setting", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L490-L509
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/utils/JPAUtils.java
JPAUtils.copyJoins
public static void copyJoins(From<?, ?> from, From<?, ?> to) { for (Join<?, ?> j : from.getJoins()) { Join<?, ?> toJoin = to.join(j.getAttribute().getName(), j.getJoinType()); toJoin.alias(getOrCreateAlias(j)); copyJoins(j, toJoin); } for (Fetch<?, ?> f : from.getFetches()) { Fetch<?, ?> toFetch = to.fetch(f.getAttribute().getName()); copyFetches(f, toFetch); } }
java
public static void copyJoins(From<?, ?> from, From<?, ?> to) { for (Join<?, ?> j : from.getJoins()) { Join<?, ?> toJoin = to.join(j.getAttribute().getName(), j.getJoinType()); toJoin.alias(getOrCreateAlias(j)); copyJoins(j, toJoin); } for (Fetch<?, ?> f : from.getFetches()) { Fetch<?, ?> toFetch = to.fetch(f.getAttribute().getName()); copyFetches(f, toFetch); } }
[ "public", "static", "void", "copyJoins", "(", "From", "<", "?", ",", "?", ">", "from", ",", "From", "<", "?", ",", "?", ">", "to", ")", "{", "for", "(", "Join", "<", "?", ",", "?", ">", "j", ":", "from", ".", "getJoins", "(", ")", ")", "{", "Join", "<", "?", ",", "?", ">", "toJoin", "=", "to", ".", "join", "(", "j", ".", "getAttribute", "(", ")", ".", "getName", "(", ")", ",", "j", ".", "getJoinType", "(", ")", ")", ";", "toJoin", ".", "alias", "(", "getOrCreateAlias", "(", "j", ")", ")", ";", "copyJoins", "(", "j", ",", "toJoin", ")", ";", "}", "for", "(", "Fetch", "<", "?", ",", "?", ">", "f", ":", "from", ".", "getFetches", "(", ")", ")", "{", "Fetch", "<", "?", ",", "?", ">", "toFetch", "=", "to", ".", "fetch", "(", "f", ".", "getAttribute", "(", ")", ".", "getName", "(", ")", ")", ";", "copyFetches", "(", "f", ",", "toFetch", ")", ";", "}", "}" ]
Copy Joins @param from source Join @param to destination Join
[ "Copy", "Joins" ]
train
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/utils/JPAUtils.java#L281-L294
nguyenq/tess4j
src/main/java/com/recognition/software/jdeskew/ImageUtil.java
ImageUtil.isBlack
public static boolean isBlack(BufferedImage image, int x, int y) { if (image.getType() == BufferedImage.TYPE_BYTE_BINARY) { WritableRaster raster = image.getRaster(); int pixelRGBValue = raster.getSample(x, y, 0); return pixelRGBValue == 0; } int luminanceValue = 140; return isBlack(image, x, y, luminanceValue); }
java
public static boolean isBlack(BufferedImage image, int x, int y) { if (image.getType() == BufferedImage.TYPE_BYTE_BINARY) { WritableRaster raster = image.getRaster(); int pixelRGBValue = raster.getSample(x, y, 0); return pixelRGBValue == 0; } int luminanceValue = 140; return isBlack(image, x, y, luminanceValue); }
[ "public", "static", "boolean", "isBlack", "(", "BufferedImage", "image", ",", "int", "x", ",", "int", "y", ")", "{", "if", "(", "image", ".", "getType", "(", ")", "==", "BufferedImage", ".", "TYPE_BYTE_BINARY", ")", "{", "WritableRaster", "raster", "=", "image", ".", "getRaster", "(", ")", ";", "int", "pixelRGBValue", "=", "raster", ".", "getSample", "(", "x", ",", "y", ",", "0", ")", ";", "return", "pixelRGBValue", "==", "0", ";", "}", "int", "luminanceValue", "=", "140", ";", "return", "isBlack", "(", "image", ",", "x", ",", "y", ",", "luminanceValue", ")", ";", "}" ]
Whether the pixel is black. @param image source image @param x @param y @return
[ "Whether", "the", "pixel", "is", "black", "." ]
train
https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/com/recognition/software/jdeskew/ImageUtil.java#L29-L38
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/Zips.java
Zips.isEntryInDir
private boolean isEntryInDir(Set<String> dirNames, String entryName) { // this should be done with a trie, put dirNames in a trie and check if entryName leads to // some node or not. for(String dirName : dirNames) { if (entryName.startsWith(dirName)) { return true; } } return false; }
java
private boolean isEntryInDir(Set<String> dirNames, String entryName) { // this should be done with a trie, put dirNames in a trie and check if entryName leads to // some node or not. for(String dirName : dirNames) { if (entryName.startsWith(dirName)) { return true; } } return false; }
[ "private", "boolean", "isEntryInDir", "(", "Set", "<", "String", ">", "dirNames", ",", "String", "entryName", ")", "{", "// this should be done with a trie, put dirNames in a trie and check if entryName leads to", "// some node or not.", "for", "(", "String", "dirName", ":", "dirNames", ")", "{", "if", "(", "entryName", ".", "startsWith", "(", "dirName", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks if entry given by name resides inside of one of the dirs. @param dirNames dirs @param entryName entryPath
[ "Checks", "if", "entry", "given", "by", "name", "resides", "inside", "of", "one", "of", "the", "dirs", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/Zips.java#L607-L616
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java
Utils.copyDirectory
public static void copyDirectory( File source, File target ) throws IOException { Utils.createDirectory( target ); for( File sourceFile : listAllFiles( source, false )) { String path = computeFileRelativeLocation( source, sourceFile ); File targetFile = new File( target, path ); Utils.createDirectory( targetFile.getParentFile()); copyStream( sourceFile, targetFile ); } }
java
public static void copyDirectory( File source, File target ) throws IOException { Utils.createDirectory( target ); for( File sourceFile : listAllFiles( source, false )) { String path = computeFileRelativeLocation( source, sourceFile ); File targetFile = new File( target, path ); Utils.createDirectory( targetFile.getParentFile()); copyStream( sourceFile, targetFile ); } }
[ "public", "static", "void", "copyDirectory", "(", "File", "source", ",", "File", "target", ")", "throws", "IOException", "{", "Utils", ".", "createDirectory", "(", "target", ")", ";", "for", "(", "File", "sourceFile", ":", "listAllFiles", "(", "source", ",", "false", ")", ")", "{", "String", "path", "=", "computeFileRelativeLocation", "(", "source", ",", "sourceFile", ")", ";", "File", "targetFile", "=", "new", "File", "(", "target", ",", "path", ")", ";", "Utils", ".", "createDirectory", "(", "targetFile", ".", "getParentFile", "(", ")", ")", ";", "copyStream", "(", "sourceFile", ",", "targetFile", ")", ";", "}", "}" ]
Copies a directory. <p> This method copies the content of the source directory into the a target directory. This latter is created if necessary. </p> @param source the directory to copy @param target the target directory @throws IOException if a problem occurred during the copy
[ "Copies", "a", "directory", ".", "<p", ">", "This", "method", "copies", "the", "content", "of", "the", "source", "directory", "into", "the", "a", "target", "directory", ".", "This", "latter", "is", "created", "if", "necessary", ".", "<", "/", "p", ">" ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java#L1250-L1260
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java
ConditionalFunctions.ifNaN
public static Expression ifNaN(Expression expression1, Expression expression2, Expression... others) { return build("IFNAN", expression1, expression2, others); }
java
public static Expression ifNaN(Expression expression1, Expression expression2, Expression... others) { return build("IFNAN", expression1, expression2, others); }
[ "public", "static", "Expression", "ifNaN", "(", "Expression", "expression1", ",", "Expression", "expression2", ",", "Expression", "...", "others", ")", "{", "return", "build", "(", "\"IFNAN\"", ",", "expression1", ",", "expression2", ",", "others", ")", ";", "}" ]
Returned expression results in first non-MISSING, non-NaN number. Returns MISSING or NULL if a non-number input is encountered first
[ "Returned", "expression", "results", "in", "first", "non", "-", "MISSING", "non", "-", "NaN", "number", ".", "Returns", "MISSING", "or", "NULL", "if", "a", "non", "-", "number", "input", "is", "encountered", "first" ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L108-L110
shinesolutions/swagger-aem
java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/CrxApi.java
CrxApi.postPackageUpdateAsync
public com.squareup.okhttp.Call postPackageUpdateAsync(String groupName, String packageName, String version, String path, String filter, String charset_, final ApiCallback<String> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postPackageUpdateValidateBeforeCall(groupName, packageName, version, path, filter, charset_, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<String>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call postPackageUpdateAsync(String groupName, String packageName, String version, String path, String filter, String charset_, final ApiCallback<String> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postPackageUpdateValidateBeforeCall(groupName, packageName, version, path, filter, charset_, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<String>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "postPackageUpdateAsync", "(", "String", "groupName", ",", "String", "packageName", ",", "String", "version", ",", "String", "path", ",", "String", "filter", ",", "String", "charset_", ",", "final", "ApiCallback", "<", "String", ">", "callback", ")", "throws", "ApiException", "{", "ProgressResponseBody", ".", "ProgressListener", "progressListener", "=", "null", ";", "ProgressRequestBody", ".", "ProgressRequestListener", "progressRequestListener", "=", "null", ";", "if", "(", "callback", "!=", "null", ")", "{", "progressListener", "=", "new", "ProgressResponseBody", ".", "ProgressListener", "(", ")", "{", "@", "Override", "public", "void", "update", "(", "long", "bytesRead", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onDownloadProgress", "(", "bytesRead", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "progressRequestListener", "=", "new", "ProgressRequestBody", ".", "ProgressRequestListener", "(", ")", "{", "@", "Override", "public", "void", "onRequestProgress", "(", "long", "bytesWritten", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onUploadProgress", "(", "bytesWritten", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "}", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "postPackageUpdateValidateBeforeCall", "(", "groupName", ",", "packageName", ",", "version", ",", "path", ",", "filter", ",", "charset_", ",", "progressListener", ",", "progressRequestListener", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "String", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "apiClient", ".", "executeAsync", "(", "call", ",", "localVarReturnType", ",", "callback", ")", ";", "return", "call", ";", "}" ]
(asynchronously) @param groupName (required) @param packageName (required) @param version (required) @param path (required) @param filter (optional) @param charset_ (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "(", "asynchronously", ")" ]
train
https://github.com/shinesolutions/swagger-aem/blob/ae7da4df93e817dc2bad843779b2069d9c4e7c6b/java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/CrxApi.java#L747-L772
btaz/data-util
src/main/java/com/btaz/util/tf/Template.java
Template.readResource
public static String readResource(String path) { try { File file = ResourceUtil.getResourceFile(path); return ResourceUtil.readFromFileIntoString(file); } catch (Exception e) { throw new DataUtilException("Failed to load resource", e); } }
java
public static String readResource(String path) { try { File file = ResourceUtil.getResourceFile(path); return ResourceUtil.readFromFileIntoString(file); } catch (Exception e) { throw new DataUtilException("Failed to load resource", e); } }
[ "public", "static", "String", "readResource", "(", "String", "path", ")", "{", "try", "{", "File", "file", "=", "ResourceUtil", ".", "getResourceFile", "(", "path", ")", ";", "return", "ResourceUtil", ".", "readFromFileIntoString", "(", "file", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "DataUtilException", "(", "\"Failed to load resource\"", ",", "e", ")", ";", "}", "}" ]
This method looks for a file on the provided path and returns it as a string @param path path @return {@code String} text
[ "This", "method", "looks", "for", "a", "file", "on", "the", "provided", "path", "and", "returns", "it", "as", "a", "string" ]
train
https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/tf/Template.java#L61-L68
LearnLib/automatalib
commons/util/src/main/java/net/automatalib/commons/util/array/AWUtil.java
AWUtil.safeWrite
public static <T, U extends T> int safeWrite(ArrayWritable<U> aw, T[] array) { int num = aw.size(); if (num <= 0) { return 0; } if (num > array.length) { num = array.length; } aw.writeToArray(0, array, 0, num); return num; }
java
public static <T, U extends T> int safeWrite(ArrayWritable<U> aw, T[] array) { int num = aw.size(); if (num <= 0) { return 0; } if (num > array.length) { num = array.length; } aw.writeToArray(0, array, 0, num); return num; }
[ "public", "static", "<", "T", ",", "U", "extends", "T", ">", "int", "safeWrite", "(", "ArrayWritable", "<", "U", ">", "aw", ",", "T", "[", "]", "array", ")", "{", "int", "num", "=", "aw", ".", "size", "(", ")", ";", "if", "(", "num", "<=", "0", ")", "{", "return", "0", ";", "}", "if", "(", "num", ">", "array", ".", "length", ")", "{", "num", "=", "array", ".", "length", ";", "}", "aw", ".", "writeToArray", "(", "0", ",", "array", ",", "0", ",", "num", ")", ";", "return", "num", ";", "}" ]
Writes the complete container data to an array. This method ensures that the array's capacity is not exceeded. @param aw the container. @param array the array @return the number of elements copied
[ "Writes", "the", "complete", "container", "data", "to", "an", "array", ".", "This", "method", "ensures", "that", "the", "array", "s", "capacity", "is", "not", "exceeded", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/array/AWUtil.java#L46-L56
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/StreamSegmentContainerMetadata.java
StreamSegmentContainerMetadata.isEligibleForEviction
private boolean isEligibleForEviction(SegmentMetadata metadata, long sequenceNumberCutoff) { return !metadata.isPinned() && (metadata.getLastUsed() < sequenceNumberCutoff || metadata.isDeleted() && metadata.getLastUsed() <= this.lastTruncatedSequenceNumber.get()); }
java
private boolean isEligibleForEviction(SegmentMetadata metadata, long sequenceNumberCutoff) { return !metadata.isPinned() && (metadata.getLastUsed() < sequenceNumberCutoff || metadata.isDeleted() && metadata.getLastUsed() <= this.lastTruncatedSequenceNumber.get()); }
[ "private", "boolean", "isEligibleForEviction", "(", "SegmentMetadata", "metadata", ",", "long", "sequenceNumberCutoff", ")", "{", "return", "!", "metadata", ".", "isPinned", "(", ")", "&&", "(", "metadata", ".", "getLastUsed", "(", ")", "<", "sequenceNumberCutoff", "||", "metadata", ".", "isDeleted", "(", ")", "&&", "metadata", ".", "getLastUsed", "(", ")", "<=", "this", ".", "lastTruncatedSequenceNumber", ".", "get", "(", ")", ")", ";", "}" ]
Determines whether the Segment with given metadata can be evicted, based on the the given Sequence Number Threshold. A Segment will not be chosen for eviction if {@link SegmentMetadata#isPinned()} is true. @param metadata The Metadata for the Segment that is considered for eviction. @param sequenceNumberCutoff A Sequence Number that indicates the cutoff threshold. A Segment is eligible for eviction if it has a LastUsed value smaller than this threshold. One exception to this rule is deleted segments, which only need to be truncated out of the Log. @return True if the Segment can be evicted, false otherwise.
[ "Determines", "whether", "the", "Segment", "with", "given", "metadata", "can", "be", "evicted", "based", "on", "the", "the", "given", "Sequence", "Number", "Threshold", ".", "A", "Segment", "will", "not", "be", "chosen", "for", "eviction", "if", "{", "@link", "SegmentMetadata#isPinned", "()", "}", "is", "true", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/StreamSegmentContainerMetadata.java#L297-L301
javamelody/javamelody
javamelody-swing/src/main/java/net/bull/javamelody/swing/Utilities.java
Utilities.adjustTableHeight
public static void adjustTableHeight(final JTable table) { table.setPreferredScrollableViewportSize( new Dimension(-1, table.getPreferredSize().height)); // on utilise invokeLater pour configurer le scrollPane car lors de l'exécution ce cette méthode // la table n'est pas encore dans son scrollPane parent SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final JScrollPane scrollPane = MSwingUtilities.getAncestorOfClass(JScrollPane.class, table); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); // Puisqu'il n'y a pas d'ascenceur sur ce scrollPane, // il est inutile que la mollette de souris serve à bouger cet ascenseur, // mais il est très utile en revanche que ce scrollPane ne bloque pas l'utilisation // de la mollette de souris pour le scrollPane global de l'onglet principal. // On commence par enlever le listener au cas où la méthode soit appelée deux fois sur la même table. scrollPane.removeMouseWheelListener(DELEGATE_TO_PARENT_MOUSE_WHEEL_LISTENER); scrollPane.addMouseWheelListener(DELEGATE_TO_PARENT_MOUSE_WHEEL_LISTENER); } }); }
java
public static void adjustTableHeight(final JTable table) { table.setPreferredScrollableViewportSize( new Dimension(-1, table.getPreferredSize().height)); // on utilise invokeLater pour configurer le scrollPane car lors de l'exécution ce cette méthode // la table n'est pas encore dans son scrollPane parent SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final JScrollPane scrollPane = MSwingUtilities.getAncestorOfClass(JScrollPane.class, table); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); // Puisqu'il n'y a pas d'ascenceur sur ce scrollPane, // il est inutile que la mollette de souris serve à bouger cet ascenseur, // mais il est très utile en revanche que ce scrollPane ne bloque pas l'utilisation // de la mollette de souris pour le scrollPane global de l'onglet principal. // On commence par enlever le listener au cas où la méthode soit appelée deux fois sur la même table. scrollPane.removeMouseWheelListener(DELEGATE_TO_PARENT_MOUSE_WHEEL_LISTENER); scrollPane.addMouseWheelListener(DELEGATE_TO_PARENT_MOUSE_WHEEL_LISTENER); } }); }
[ "public", "static", "void", "adjustTableHeight", "(", "final", "JTable", "table", ")", "{", "table", ".", "setPreferredScrollableViewportSize", "(", "new", "Dimension", "(", "-", "1", ",", "table", ".", "getPreferredSize", "(", ")", ".", "height", ")", ")", ";", "// on utilise invokeLater pour configurer le scrollPane car lors de l'exécution ce cette méthode\r", "// la table n'est pas encore dans son scrollPane parent\r", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "final", "JScrollPane", "scrollPane", "=", "MSwingUtilities", ".", "getAncestorOfClass", "(", "JScrollPane", ".", "class", ",", "table", ")", ";", "scrollPane", ".", "setVerticalScrollBarPolicy", "(", "ScrollPaneConstants", ".", "VERTICAL_SCROLLBAR_NEVER", ")", ";", "// Puisqu'il n'y a pas d'ascenceur sur ce scrollPane,\r", "// il est inutile que la mollette de souris serve à bouger cet ascenseur,\r", "// mais il est très utile en revanche que ce scrollPane ne bloque pas l'utilisation\r", "// de la mollette de souris pour le scrollPane global de l'onglet principal.\r", "// On commence par enlever le listener au cas où la méthode soit appelée deux fois sur la même table.\r", "scrollPane", ".", "removeMouseWheelListener", "(", "DELEGATE_TO_PARENT_MOUSE_WHEEL_LISTENER", ")", ";", "scrollPane", ".", "addMouseWheelListener", "(", "DELEGATE_TO_PARENT_MOUSE_WHEEL_LISTENER", ")", ";", "}", "}", ")", ";", "}" ]
Fixe la taille exacte d'une JTable à celle nécessaire pour afficher les données. @param table JTable
[ "Fixe", "la", "taille", "exacte", "d", "une", "JTable", "à", "celle", "nécessaire", "pour", "afficher", "les", "données", "." ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/Utilities.java#L101-L121
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java
Ftp.init
public Ftp init(String host, int port, String user, String password, FtpMode mode) { final FTPClient client = new FTPClient(); client.setControlEncoding(this.charset.toString()); try { // 连接ftp服务器 client.connect(host, port); // 登录ftp服务器 client.login(user, password); } catch (IOException e) { throw new FtpException(e); } final int replyCode = client.getReplyCode(); // 是否成功登录服务器 if (false == FTPReply.isPositiveCompletion(replyCode)) { try { client.disconnect(); } catch (IOException e) { // ignore } throw new FtpException("Login failed for user [{}], reply code is: [{}]", user, replyCode); } this.client = client; if (mode != null ) { setMode(mode); } return this; }
java
public Ftp init(String host, int port, String user, String password, FtpMode mode) { final FTPClient client = new FTPClient(); client.setControlEncoding(this.charset.toString()); try { // 连接ftp服务器 client.connect(host, port); // 登录ftp服务器 client.login(user, password); } catch (IOException e) { throw new FtpException(e); } final int replyCode = client.getReplyCode(); // 是否成功登录服务器 if (false == FTPReply.isPositiveCompletion(replyCode)) { try { client.disconnect(); } catch (IOException e) { // ignore } throw new FtpException("Login failed for user [{}], reply code is: [{}]", user, replyCode); } this.client = client; if (mode != null ) { setMode(mode); } return this; }
[ "public", "Ftp", "init", "(", "String", "host", ",", "int", "port", ",", "String", "user", ",", "String", "password", ",", "FtpMode", "mode", ")", "{", "final", "FTPClient", "client", "=", "new", "FTPClient", "(", ")", ";", "client", ".", "setControlEncoding", "(", "this", ".", "charset", ".", "toString", "(", ")", ")", ";", "try", "{", "// 连接ftp服务器\r", "client", ".", "connect", "(", "host", ",", "port", ")", ";", "// 登录ftp服务器\r", "client", ".", "login", "(", "user", ",", "password", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "FtpException", "(", "e", ")", ";", "}", "final", "int", "replyCode", "=", "client", ".", "getReplyCode", "(", ")", ";", "// 是否成功登录服务器\r", "if", "(", "false", "==", "FTPReply", ".", "isPositiveCompletion", "(", "replyCode", ")", ")", "{", "try", "{", "client", ".", "disconnect", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// ignore\r", "}", "throw", "new", "FtpException", "(", "\"Login failed for user [{}], reply code is: [{}]\"", ",", "user", ",", "replyCode", ")", ";", "}", "this", ".", "client", "=", "client", ";", "if", "(", "mode", "!=", "null", ")", "{", "setMode", "(", "mode", ")", ";", "}", "return", "this", ";", "}" ]
初始化连接 @param host 域名或IP @param port 端口 @param user 用户名 @param password 密码 @param mode 模式 @return this
[ "初始化连接" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java#L132-L157
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getTitleInfo
public void getTitleInfo(int[] ids, Callback<List<Title>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getTitleInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getTitleInfo(int[] ids, Callback<List<Title>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getTitleInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getTitleInfo", "(", "int", "[", "]", "ids", ",", "Callback", "<", "List", "<", "Title", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ids", ")", ")", ";", "gw2API", ".", "getTitleInfo", "(", "processIds", "(", "ids", ")", ",", "GuildWars2", ".", "lang", ".", "getValue", "(", ")", ")", ".", "enqueue", "(", "callback", ")", ";", "}" ]
For more info on titles API go <a href="https://wiki.guildwars2.com/wiki/API:2/titles">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of title id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see Title title info
[ "For", "more", "info", "on", "titles", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "titles", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "user", "the", "access", "to", "{", "@link", "Callback#onResponse", "(", "Call", "Response", ")", "}", "and", "{", "@link", "Callback#onFailure", "(", "Call", "Throwable", ")", "}", "methods", "for", "custom", "interactions" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2495-L2498
apache/groovy
src/main/java/org/codehaus/groovy/syntax/Types.java
Types.makePostfix
public static void makePostfix(CSTNode node, boolean throwIfInvalid) { switch (node.getMeaning()) { case PLUS_PLUS: node.setMeaning(POSTFIX_PLUS_PLUS); break; case MINUS_MINUS: node.setMeaning(POSTFIX_MINUS_MINUS); break; default: if (throwIfInvalid) { throw new GroovyBugError("cannot convert to postfix for type [" + node.getMeaning() + "]"); } } }
java
public static void makePostfix(CSTNode node, boolean throwIfInvalid) { switch (node.getMeaning()) { case PLUS_PLUS: node.setMeaning(POSTFIX_PLUS_PLUS); break; case MINUS_MINUS: node.setMeaning(POSTFIX_MINUS_MINUS); break; default: if (throwIfInvalid) { throw new GroovyBugError("cannot convert to postfix for type [" + node.getMeaning() + "]"); } } }
[ "public", "static", "void", "makePostfix", "(", "CSTNode", "node", ",", "boolean", "throwIfInvalid", ")", "{", "switch", "(", "node", ".", "getMeaning", "(", ")", ")", "{", "case", "PLUS_PLUS", ":", "node", ".", "setMeaning", "(", "POSTFIX_PLUS_PLUS", ")", ";", "break", ";", "case", "MINUS_MINUS", ":", "node", ".", "setMeaning", "(", "POSTFIX_MINUS_MINUS", ")", ";", "break", ";", "default", ":", "if", "(", "throwIfInvalid", ")", "{", "throw", "new", "GroovyBugError", "(", "\"cannot convert to postfix for type [\"", "+", "node", ".", "getMeaning", "(", ")", "+", "\"]\"", ")", ";", "}", "}", "}" ]
Converts a node from a generic type to a specific postfix type. Throws a <code>GroovyBugError</code> if the type can't be converted.
[ "Converts", "a", "node", "from", "a", "generic", "type", "to", "a", "specific", "postfix", "type", ".", "Throws", "a", "<code", ">", "GroovyBugError<", "/", "code", ">", "if", "the", "type", "can", "t", "be", "converted", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/syntax/Types.java#L887-L904
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
Stanza.overrideExtension
public ExtensionElement overrideExtension(ExtensionElement extension) { if (extension == null) return null; synchronized (packetExtensions) { // Note that we need to use removeExtension(String, String) here. If would use // removeExtension(ExtensionElement) then we would remove based on the equality of ExtensionElement, which // is not what we want in this case. ExtensionElement removedExtension = removeExtension(extension.getElementName(), extension.getNamespace()); addExtension(extension); return removedExtension; } }
java
public ExtensionElement overrideExtension(ExtensionElement extension) { if (extension == null) return null; synchronized (packetExtensions) { // Note that we need to use removeExtension(String, String) here. If would use // removeExtension(ExtensionElement) then we would remove based on the equality of ExtensionElement, which // is not what we want in this case. ExtensionElement removedExtension = removeExtension(extension.getElementName(), extension.getNamespace()); addExtension(extension); return removedExtension; } }
[ "public", "ExtensionElement", "overrideExtension", "(", "ExtensionElement", "extension", ")", "{", "if", "(", "extension", "==", "null", ")", "return", "null", ";", "synchronized", "(", "packetExtensions", ")", "{", "// Note that we need to use removeExtension(String, String) here. If would use", "// removeExtension(ExtensionElement) then we would remove based on the equality of ExtensionElement, which", "// is not what we want in this case.", "ExtensionElement", "removedExtension", "=", "removeExtension", "(", "extension", ".", "getElementName", "(", ")", ",", "extension", ".", "getNamespace", "(", ")", ")", ";", "addExtension", "(", "extension", ")", ";", "return", "removedExtension", ";", "}", "}" ]
Add the given extension and override eventually existing extensions with the same name and namespace. @param extension the extension element to add. @return one of the removed extensions or <code>null</code> if there are none. @since 4.1.2
[ "Add", "the", "given", "extension", "and", "override", "eventually", "existing", "extensions", "with", "the", "same", "name", "and", "namespace", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java#L394-L404
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.findAll
public static <T> Set<T> findAll(Set<T> self) { return findAll(self, Closure.IDENTITY); }
java
public static <T> Set<T> findAll(Set<T> self) { return findAll(self, Closure.IDENTITY); }
[ "public", "static", "<", "T", ">", "Set", "<", "T", ">", "findAll", "(", "Set", "<", "T", ">", "self", ")", "{", "return", "findAll", "(", "self", ",", "Closure", ".", "IDENTITY", ")", ";", "}" ]
Finds the items matching the IDENTITY Closure (i.e.&#160;matching Groovy truth). <p> Example: <pre class="groovyTestCase"> def items = [1, 2, 0, false, true, '', 'foo', [], [4, 5], null] as Set assert items.findAll() == [1, 2, true, 'foo', [4, 5]] as Set </pre> @param self a Set @return a Set of the values found @since 2.4.0 @see Closure#IDENTITY
[ "Finds", "the", "items", "matching", "the", "IDENTITY", "Closure", "(", "i", ".", "e", ".", "&#160", ";", "matching", "Groovy", "truth", ")", ".", "<p", ">", "Example", ":", "<pre", "class", "=", "groovyTestCase", ">", "def", "items", "=", "[", "1", "2", "0", "false", "true", "foo", "[]", "[", "4", "5", "]", "null", "]", "as", "Set", "assert", "items", ".", "findAll", "()", "==", "[", "1", "2", "true", "foo", "[", "4", "5", "]]", "as", "Set", "<", "/", "pre", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L4811-L4813
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/utils/MiniTemplator.java
MiniTemplator.addBlock
public void addBlock(String blockName, boolean isOptional) throws BlockNotDefinedException { int blockNo = mtp.lookupBlockName(blockName); if (blockNo == -1) { if (isOptional) { return; } throw new BlockNotDefinedException(blockName); } while (blockNo != -1) { addBlockByNo(blockNo); blockNo = mtp.blockTab[blockNo].nextWithSameName; } }
java
public void addBlock(String blockName, boolean isOptional) throws BlockNotDefinedException { int blockNo = mtp.lookupBlockName(blockName); if (blockNo == -1) { if (isOptional) { return; } throw new BlockNotDefinedException(blockName); } while (blockNo != -1) { addBlockByNo(blockNo); blockNo = mtp.blockTab[blockNo].nextWithSameName; } }
[ "public", "void", "addBlock", "(", "String", "blockName", ",", "boolean", "isOptional", ")", "throws", "BlockNotDefinedException", "{", "int", "blockNo", "=", "mtp", ".", "lookupBlockName", "(", "blockName", ")", ";", "if", "(", "blockNo", "==", "-", "1", ")", "{", "if", "(", "isOptional", ")", "{", "return", ";", "}", "throw", "new", "BlockNotDefinedException", "(", "blockName", ")", ";", "}", "while", "(", "blockNo", "!=", "-", "1", ")", "{", "addBlockByNo", "(", "blockNo", ")", ";", "blockNo", "=", "mtp", ".", "blockTab", "[", "blockNo", "]", ".", "nextWithSameName", ";", "}", "}" ]
Adds an instance of a template block. <p> If the block contains variables, these variables must be set before the block is added. If the block contains subblocks (nested blocks), the subblocks must be added before this block is added. If multiple blocks exist with the specified name, an instance is added for each block occurrence. @param blockName the name of the block to be added. Case-insensitive. @param isOptional specifies whether an exception should be thrown when the block does not exist in the template. If <code>isOptional</code> is <code>false</code> and the block does not exist, an exception is thrown. @throws BlockNotDefinedException when no block with the specified name exists in the template and <code>isOptional</code> is <code>false</code>.
[ "Adds", "an", "instance", "of", "a", "template", "block", ".", "<p", ">", "If", "the", "block", "contains", "variables", "these", "variables", "must", "be", "set", "before", "the", "block", "is", "added", ".", "If", "the", "block", "contains", "subblocks", "(", "nested", "blocks", ")", "the", "subblocks", "must", "be", "added", "before", "this", "block", "is", "added", ".", "If", "multiple", "blocks", "exist", "with", "the", "specified", "name", "an", "instance", "is", "added", "for", "each", "block", "occurrence", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/utils/MiniTemplator.java#L521-L533
Azure/azure-sdk-for-java
mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/LogFilesInner.java
LogFilesInner.listByServerAsync
public Observable<List<LogFileInner>> listByServerAsync(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<LogFileInner>>, List<LogFileInner>>() { @Override public List<LogFileInner> call(ServiceResponse<List<LogFileInner>> response) { return response.body(); } }); }
java
public Observable<List<LogFileInner>> listByServerAsync(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<LogFileInner>>, List<LogFileInner>>() { @Override public List<LogFileInner> call(ServiceResponse<List<LogFileInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "LogFileInner", ">", ">", "listByServerAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "listByServerWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "LogFileInner", ">", ">", ",", "List", "<", "LogFileInner", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "LogFileInner", ">", "call", "(", "ServiceResponse", "<", "List", "<", "LogFileInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
List all the log files in a given server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;LogFileInner&gt; object
[ "List", "all", "the", "log", "files", "in", "a", "given", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/LogFilesInner.java#L96-L103
puniverse/capsule
capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java
Jar.addClass
public Jar addClass(Class<?> clazz) throws IOException { final String resource = clazz.getName().replace('.', '/') + ".class"; return addEntry(resource, clazz.getClassLoader().getResourceAsStream(resource)); }
java
public Jar addClass(Class<?> clazz) throws IOException { final String resource = clazz.getName().replace('.', '/') + ".class"; return addEntry(resource, clazz.getClassLoader().getResourceAsStream(resource)); }
[ "public", "Jar", "addClass", "(", "Class", "<", "?", ">", "clazz", ")", "throws", "IOException", "{", "final", "String", "resource", "=", "clazz", ".", "getName", "(", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "\".class\"", ";", "return", "addEntry", "(", "resource", ",", "clazz", ".", "getClassLoader", "(", ")", ".", "getResourceAsStream", "(", "resource", ")", ")", ";", "}" ]
Adds a class entry to this JAR. @param clazz the class to add to the JAR. @return {@code this}
[ "Adds", "a", "class", "entry", "to", "this", "JAR", "." ]
train
https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L379-L382
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/model/Entry.java
Entry.isShowing
public final boolean isShowing(LocalDate startDate, LocalDate endDate, ZoneId zoneId) { return isShowing(this, startDate, endDate, zoneId); }
java
public final boolean isShowing(LocalDate startDate, LocalDate endDate, ZoneId zoneId) { return isShowing(this, startDate, endDate, zoneId); }
[ "public", "final", "boolean", "isShowing", "(", "LocalDate", "startDate", ",", "LocalDate", "endDate", ",", "ZoneId", "zoneId", ")", "{", "return", "isShowing", "(", "this", ",", "startDate", ",", "endDate", ",", "zoneId", ")", ";", "}" ]
Checks whether the entry will be visible within the given start and end dates. This method takes recurrence into consideration and will return true if any recurrence of this entry will be displayed inside the given time interval. @param startDate the start date of the search interval @param endDate the end date of the search interval @param zoneId the time zone @return true if the entry or any of its recurrences is showing
[ "Checks", "whether", "the", "entry", "will", "be", "visible", "within", "the", "given", "start", "and", "end", "dates", ".", "This", "method", "takes", "recurrence", "into", "consideration", "and", "will", "return", "true", "if", "any", "recurrence", "of", "this", "entry", "will", "be", "displayed", "inside", "the", "given", "time", "interval", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Entry.java#L1487-L1489
UrielCh/ovh-java-sdk
ovh-java-sdk-deskaas/src/main/java/net/minidev/ovh/api/ApiOvhDeskaas.java
ApiOvhDeskaas.serviceName_changeContact_POST
public ArrayList<Long> serviceName_changeContact_POST(String serviceName, String contactAdmin, String contactBilling, String contactTech) throws IOException { String qPath = "/deskaas/{serviceName}/changeContact"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "contactAdmin", contactAdmin); addBody(o, "contactBilling", contactBilling); addBody(o, "contactTech", contactTech); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t1); }
java
public ArrayList<Long> serviceName_changeContact_POST(String serviceName, String contactAdmin, String contactBilling, String contactTech) throws IOException { String qPath = "/deskaas/{serviceName}/changeContact"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "contactAdmin", contactAdmin); addBody(o, "contactBilling", contactBilling); addBody(o, "contactTech", contactTech); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "Long", ">", "serviceName_changeContact_POST", "(", "String", "serviceName", ",", "String", "contactAdmin", ",", "String", "contactBilling", ",", "String", "contactTech", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/deskaas/{serviceName}/changeContact\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"contactAdmin\"", ",", "contactAdmin", ")", ";", "addBody", "(", "o", ",", "\"contactBilling\"", ",", "contactBilling", ")", ";", "addBody", "(", "o", ",", "\"contactTech\"", ",", "contactTech", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "t1", ")", ";", "}" ]
Launch a contact change procedure REST: POST /deskaas/{serviceName}/changeContact @param contactAdmin The contact to set as admin contact @param contactTech The contact to set as tech contact @param contactBilling The contact to set as billing contact @param serviceName [required] Domain of the service
[ "Launch", "a", "contact", "change", "procedure" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-deskaas/src/main/java/net/minidev/ovh/api/ApiOvhDeskaas.java#L301-L310
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/extract/FactoryFeatureExtractor.java
FactoryFeatureExtractor.nonmaxCandidate
public static NonMaxSuppression nonmaxCandidate( @Nullable ConfigExtract config ) { if( config == null ) config = new ConfigExtract(); config.checkValidity(); if( BOverrideFactoryFeatureExtractor.nonmaxCandidate != null ) { return BOverrideFactoryFeatureExtractor.nonmaxCandidate.process(config); } NonMaxCandidate.Search search; // no need to check the detection max/min since these algorithms can handle both if (config.useStrictRule) { search = new NonMaxCandidate.Strict(); } else { search = new NonMaxCandidate.Relaxed(); } // See if the user wants to use threaded code or not NonMaxCandidate extractor = BoofConcurrency.USE_CONCURRENT? new NonMaxCandidate_MT(search):new NonMaxCandidate(search); WrapperNonMaxCandidate ret = new WrapperNonMaxCandidate(extractor,false,true); ret.setSearchRadius(config.radius); ret.setIgnoreBorder(config.ignoreBorder); ret.setThresholdMaximum(config.threshold); return ret; }
java
public static NonMaxSuppression nonmaxCandidate( @Nullable ConfigExtract config ) { if( config == null ) config = new ConfigExtract(); config.checkValidity(); if( BOverrideFactoryFeatureExtractor.nonmaxCandidate != null ) { return BOverrideFactoryFeatureExtractor.nonmaxCandidate.process(config); } NonMaxCandidate.Search search; // no need to check the detection max/min since these algorithms can handle both if (config.useStrictRule) { search = new NonMaxCandidate.Strict(); } else { search = new NonMaxCandidate.Relaxed(); } // See if the user wants to use threaded code or not NonMaxCandidate extractor = BoofConcurrency.USE_CONCURRENT? new NonMaxCandidate_MT(search):new NonMaxCandidate(search); WrapperNonMaxCandidate ret = new WrapperNonMaxCandidate(extractor,false,true); ret.setSearchRadius(config.radius); ret.setIgnoreBorder(config.ignoreBorder); ret.setThresholdMaximum(config.threshold); return ret; }
[ "public", "static", "NonMaxSuppression", "nonmaxCandidate", "(", "@", "Nullable", "ConfigExtract", "config", ")", "{", "if", "(", "config", "==", "null", ")", "config", "=", "new", "ConfigExtract", "(", ")", ";", "config", ".", "checkValidity", "(", ")", ";", "if", "(", "BOverrideFactoryFeatureExtractor", ".", "nonmaxCandidate", "!=", "null", ")", "{", "return", "BOverrideFactoryFeatureExtractor", ".", "nonmaxCandidate", ".", "process", "(", "config", ")", ";", "}", "NonMaxCandidate", ".", "Search", "search", ";", "// no need to check the detection max/min since these algorithms can handle both", "if", "(", "config", ".", "useStrictRule", ")", "{", "search", "=", "new", "NonMaxCandidate", ".", "Strict", "(", ")", ";", "}", "else", "{", "search", "=", "new", "NonMaxCandidate", ".", "Relaxed", "(", ")", ";", "}", "// See if the user wants to use threaded code or not", "NonMaxCandidate", "extractor", "=", "BoofConcurrency", ".", "USE_CONCURRENT", "?", "new", "NonMaxCandidate_MT", "(", "search", ")", ":", "new", "NonMaxCandidate", "(", "search", ")", ";", "WrapperNonMaxCandidate", "ret", "=", "new", "WrapperNonMaxCandidate", "(", "extractor", ",", "false", ",", "true", ")", ";", "ret", ".", "setSearchRadius", "(", "config", ".", "radius", ")", ";", "ret", ".", "setIgnoreBorder", "(", "config", ".", "ignoreBorder", ")", ";", "ret", ".", "setThresholdMaximum", "(", "config", ".", "threshold", ")", ";", "return", "ret", ";", "}" ]
Non-max feature extractor which saves a candidate list of all the found local maximums.. @param config Configuration for extractor @return A feature extractor.
[ "Non", "-", "max", "feature", "extractor", "which", "saves", "a", "candidate", "list", "of", "all", "the", "found", "local", "maximums", ".." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/extract/FactoryFeatureExtractor.java#L110-L140
apache/incubator-heron
heron/api/src/java/org/apache/heron/classification/HeronAnnotationProcessor.java
HeronAnnotationProcessor.process
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (!roundEnv.processingOver()) { for (TypeElement te : annotations) { for (Element elt : roundEnv.getElementsAnnotatedWith(te)) { if (!elt.toString().startsWith("org.apache.heron")) { env.getMessager().printMessage( Kind.WARNING, String.format("%s extends from a class annotated with %s", elt, te), elt); } } } } return true; }
java
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (!roundEnv.processingOver()) { for (TypeElement te : annotations) { for (Element elt : roundEnv.getElementsAnnotatedWith(te)) { if (!elt.toString().startsWith("org.apache.heron")) { env.getMessager().printMessage( Kind.WARNING, String.format("%s extends from a class annotated with %s", elt, te), elt); } } } } return true; }
[ "@", "Override", "public", "boolean", "process", "(", "Set", "<", "?", "extends", "TypeElement", ">", "annotations", ",", "RoundEnvironment", "roundEnv", ")", "{", "if", "(", "!", "roundEnv", ".", "processingOver", "(", ")", ")", "{", "for", "(", "TypeElement", "te", ":", "annotations", ")", "{", "for", "(", "Element", "elt", ":", "roundEnv", ".", "getElementsAnnotatedWith", "(", "te", ")", ")", "{", "if", "(", "!", "elt", ".", "toString", "(", ")", ".", "startsWith", "(", "\"org.apache.heron\"", ")", ")", "{", "env", ".", "getMessager", "(", ")", ".", "printMessage", "(", "Kind", ".", "WARNING", ",", "String", ".", "format", "(", "\"%s extends from a class annotated with %s\"", ",", "elt", ",", "te", ")", ",", "elt", ")", ";", "}", "}", "}", "}", "return", "true", ";", "}" ]
If a non-heron class extends from a class annotated as Unstable, Private or LimitedPrivate, emit a warning.
[ "If", "a", "non", "-", "heron", "class", "extends", "from", "a", "class", "annotated", "as", "Unstable", "Private", "or", "LimitedPrivate", "emit", "a", "warning", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/classification/HeronAnnotationProcessor.java#L55-L70
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalReader.java
JournalReader.getJournalEntryStartTag
private StartElement getJournalEntryStartTag(XMLEventReader reader) throws XMLStreamException, JournalException { XMLEvent event = reader.nextTag(); if (!isStartTagEvent(event, QNAME_TAG_JOURNAL_ENTRY)) { throw getNotStartTagException(QNAME_TAG_JOURNAL_ENTRY, event); } return event.asStartElement(); }
java
private StartElement getJournalEntryStartTag(XMLEventReader reader) throws XMLStreamException, JournalException { XMLEvent event = reader.nextTag(); if (!isStartTagEvent(event, QNAME_TAG_JOURNAL_ENTRY)) { throw getNotStartTagException(QNAME_TAG_JOURNAL_ENTRY, event); } return event.asStartElement(); }
[ "private", "StartElement", "getJournalEntryStartTag", "(", "XMLEventReader", "reader", ")", "throws", "XMLStreamException", ",", "JournalException", "{", "XMLEvent", "event", "=", "reader", ".", "nextTag", "(", ")", ";", "if", "(", "!", "isStartTagEvent", "(", "event", ",", "QNAME_TAG_JOURNAL_ENTRY", ")", ")", "{", "throw", "getNotStartTagException", "(", "QNAME_TAG_JOURNAL_ENTRY", ",", "event", ")", ";", "}", "return", "event", ".", "asStartElement", "(", ")", ";", "}" ]
Get the next event and complain if it isn't a JournalEntry start tag.
[ "Get", "the", "next", "event", "and", "complain", "if", "it", "isn", "t", "a", "JournalEntry", "start", "tag", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalReader.java#L218-L225
albfernandez/itext2
src/main/java/com/lowagie/text/FontFactory.java
FontFactory.registerFamily
public void registerFamily(String familyName, String fullName, String path) { fontImp.registerFamily(familyName, fullName, path); }
java
public void registerFamily(String familyName, String fullName, String path) { fontImp.registerFamily(familyName, fullName, path); }
[ "public", "void", "registerFamily", "(", "String", "familyName", ",", "String", "fullName", ",", "String", "path", ")", "{", "fontImp", ".", "registerFamily", "(", "familyName", ",", "fullName", ",", "path", ")", ";", "}" ]
Register a font by giving explicitly the font family and name. @param familyName the font family @param fullName the font name @param path the font path
[ "Register", "a", "font", "by", "giving", "explicitly", "the", "font", "family", "and", "name", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/FontFactory.java#L338-L340
apache/flink
flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java
MetricConfig.getFloat
public float getFloat(String key, float defaultValue) { String argument = getProperty(key, null); return argument == null ? defaultValue : Float.parseFloat(argument); }
java
public float getFloat(String key, float defaultValue) { String argument = getProperty(key, null); return argument == null ? defaultValue : Float.parseFloat(argument); }
[ "public", "float", "getFloat", "(", "String", "key", ",", "float", "defaultValue", ")", "{", "String", "argument", "=", "getProperty", "(", "key", ",", "null", ")", ";", "return", "argument", "==", "null", "?", "defaultValue", ":", "Float", ".", "parseFloat", "(", "argument", ")", ";", "}" ]
Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found. @param key the hashtable key. @param defaultValue a default value. @return the value in this property list with the specified key value parsed as a float.
[ "Searches", "for", "the", "property", "with", "the", "specified", "key", "in", "this", "property", "list", ".", "If", "the", "key", "is", "not", "found", "in", "this", "property", "list", "the", "default", "property", "list", "and", "its", "defaults", "recursively", "are", "then", "checked", ".", "The", "method", "returns", "the", "default", "value", "argument", "if", "the", "property", "is", "not", "found", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java#L76-L81
ModeShape/modeshape
modeshape-schematic/src/main/java/org/modeshape/schematic/Schematic.java
Schematic.getDb
public static <T extends SchematicDb> T getDb(Document document) throws RuntimeException { return getDb(document, Schematic.class.getClassLoader()); }
java
public static <T extends SchematicDb> T getDb(Document document) throws RuntimeException { return getDb(document, Schematic.class.getClassLoader()); }
[ "public", "static", "<", "T", "extends", "SchematicDb", ">", "T", "getDb", "(", "Document", "document", ")", "throws", "RuntimeException", "{", "return", "getDb", "(", "document", ",", "Schematic", ".", "class", ".", "getClassLoader", "(", ")", ")", ";", "}" ]
Returns a DB with the given configuration document {@code Document}. This document is expected to contain a {@link Schematic#TYPE_FIELD type field} to indicate the type of DB. @see #getDb(Document, ClassLoader)
[ "Returns", "a", "DB", "with", "the", "given", "configuration", "document", "{", "@code", "Document", "}", ".", "This", "document", "is", "expected", "to", "contain", "a", "{", "@link", "Schematic#TYPE_FIELD", "type", "field", "}", "to", "indicate", "the", "type", "of", "DB", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-schematic/src/main/java/org/modeshape/schematic/Schematic.java#L52-L54
strator-dev/greenpepper
greenpepper/core/src/main/java/com/greenpepper/util/DuckType.java
DuckType.instanceOf
public static boolean instanceOf(Class type, Object object) { if (type.isInstance(object)) return true; Class<?> candidate = object.getClass(); for (Method method : type.getMethods()) { try { candidate.getMethod(method.getName(), (Class[])method.getParameterTypes()); } catch (NoSuchMethodException e) { return false; } } return true; }
java
public static boolean instanceOf(Class type, Object object) { if (type.isInstance(object)) return true; Class<?> candidate = object.getClass(); for (Method method : type.getMethods()) { try { candidate.getMethod(method.getName(), (Class[])method.getParameterTypes()); } catch (NoSuchMethodException e) { return false; } } return true; }
[ "public", "static", "boolean", "instanceOf", "(", "Class", "type", ",", "Object", "object", ")", "{", "if", "(", "type", ".", "isInstance", "(", "object", ")", ")", "return", "true", ";", "Class", "<", "?", ">", "candidate", "=", "object", ".", "getClass", "(", ")", ";", "for", "(", "Method", "method", ":", "type", ".", "getMethods", "(", ")", ")", "{", "try", "{", "candidate", ".", "getMethod", "(", "method", ".", "getName", "(", ")", ",", "(", "Class", "[", "]", ")", "method", ".", "getParameterTypes", "(", ")", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Indicates if object is a (DuckType) instance of a type (interface). That is, is every method in type is present on object. @param type The interface to implement @param object The object to test @return true if every method in type is present on object, false otherwise
[ "Indicates", "if", "object", "is", "a", "(", "DuckType", ")", "instance", "of", "a", "type", "(", "interface", ")", ".", "That", "is", "is", "every", "method", "in", "type", "is", "present", "on", "object", "." ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/util/DuckType.java#L51-L68
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.rotateLocalZ
public Matrix4d rotateLocalZ(double ang, Matrix4d dest) { double sin = Math.sin(ang); double cos = Math.cosFromSin(sin, ang); double nm00 = cos * m00 - sin * m01; double nm01 = sin * m00 + cos * m01; double nm10 = cos * m10 - sin * m11; double nm11 = sin * m10 + cos * m11; double nm20 = cos * m20 - sin * m21; double nm21 = sin * m20 + cos * m21; double nm30 = cos * m30 - sin * m31; double nm31 = sin * m30 + cos * m31; dest.m00 = nm00; dest.m01 = nm01; dest.m02 = m02; dest.m03 = m03; dest.m10 = nm10; dest.m11 = nm11; dest.m12 = m12; dest.m13 = m13; dest.m20 = nm20; dest.m21 = nm21; dest.m22 = m22; dest.m23 = m23; dest.m30 = nm30; dest.m31 = nm31; dest.m32 = m32; dest.m33 = m33; dest.properties = properties & ~(PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION); return dest; }
java
public Matrix4d rotateLocalZ(double ang, Matrix4d dest) { double sin = Math.sin(ang); double cos = Math.cosFromSin(sin, ang); double nm00 = cos * m00 - sin * m01; double nm01 = sin * m00 + cos * m01; double nm10 = cos * m10 - sin * m11; double nm11 = sin * m10 + cos * m11; double nm20 = cos * m20 - sin * m21; double nm21 = sin * m20 + cos * m21; double nm30 = cos * m30 - sin * m31; double nm31 = sin * m30 + cos * m31; dest.m00 = nm00; dest.m01 = nm01; dest.m02 = m02; dest.m03 = m03; dest.m10 = nm10; dest.m11 = nm11; dest.m12 = m12; dest.m13 = m13; dest.m20 = nm20; dest.m21 = nm21; dest.m22 = m22; dest.m23 = m23; dest.m30 = nm30; dest.m31 = nm31; dest.m32 = m32; dest.m33 = m33; dest.properties = properties & ~(PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION); return dest; }
[ "public", "Matrix4d", "rotateLocalZ", "(", "double", "ang", ",", "Matrix4d", "dest", ")", "{", "double", "sin", "=", "Math", ".", "sin", "(", "ang", ")", ";", "double", "cos", "=", "Math", ".", "cosFromSin", "(", "sin", ",", "ang", ")", ";", "double", "nm00", "=", "cos", "*", "m00", "-", "sin", "*", "m01", ";", "double", "nm01", "=", "sin", "*", "m00", "+", "cos", "*", "m01", ";", "double", "nm10", "=", "cos", "*", "m10", "-", "sin", "*", "m11", ";", "double", "nm11", "=", "sin", "*", "m10", "+", "cos", "*", "m11", ";", "double", "nm20", "=", "cos", "*", "m20", "-", "sin", "*", "m21", ";", "double", "nm21", "=", "sin", "*", "m20", "+", "cos", "*", "m21", ";", "double", "nm30", "=", "cos", "*", "m30", "-", "sin", "*", "m31", ";", "double", "nm31", "=", "sin", "*", "m30", "+", "cos", "*", "m31", ";", "dest", ".", "m00", "=", "nm00", ";", "dest", ".", "m01", "=", "nm01", ";", "dest", ".", "m02", "=", "m02", ";", "dest", ".", "m03", "=", "m03", ";", "dest", ".", "m10", "=", "nm10", ";", "dest", ".", "m11", "=", "nm11", ";", "dest", ".", "m12", "=", "m12", ";", "dest", ".", "m13", "=", "m13", ";", "dest", ".", "m20", "=", "nm20", ";", "dest", ".", "m21", "=", "nm21", ";", "dest", ".", "m22", "=", "m22", ";", "dest", ".", "m23", "=", "m23", ";", "dest", ".", "m30", "=", "nm30", ";", "dest", ".", "m31", "=", "nm31", ";", "dest", ".", "m32", "=", "m32", ";", "dest", ".", "m33", "=", "m33", ";", "dest", ".", "properties", "=", "properties", "&", "~", "(", "PROPERTY_PERSPECTIVE", "|", "PROPERTY_IDENTITY", "|", "PROPERTY_TRANSLATION", ")", ";", "return", "dest", ";", "}" ]
Pre-multiply a rotation around the Z axis to this matrix by rotating the given amount of radians about the Z axis and store the result in <code>dest</code>. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationZ(double) rotationZ()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotationZ(double) @param ang the angle in radians to rotate about the Z axis @param dest will hold the result @return dest
[ "Pre", "-", "multiply", "a", "rotation", "around", "the", "Z", "axis", "to", "this", "matrix", "by", "rotating", "the", "given", "amount", "of", "radians", "about", "the", "Z", "axis", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", "code", ">", ".", "<p", ">", "When", "used", "with", "a", "right", "-", "handed", "coordinate", "system", "the", "produced", "rotation", "will", "rotate", "a", "vector", "counter", "-", "clockwise", "around", "the", "rotation", "axis", "when", "viewing", "along", "the", "negative", "axis", "direction", "towards", "the", "origin", ".", "When", "used", "with", "a", "left", "-", "handed", "coordinate", "system", "the", "rotation", "is", "clockwise", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "R<", "/", "code", ">", "the", "rotation", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "R", "*", "M<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "R", "*", "M", "*", "v<", "/", "code", ">", "the", "rotation", "will", "be", "applied", "last!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "a", "rotation", "matrix", "without", "pre", "-", "multiplying", "the", "rotation", "transformation", "use", "{", "@link", "#rotationZ", "(", "double", ")", "rotationZ", "()", "}", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Rotation_matrix#Rotation_matrix_from_axis_and_angle", ">", "http", ":", "//", "en", ".", "wikipedia", ".", "org<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L5926-L5955
joniles/mpxj
src/main/java/net/sf/mpxj/planner/PlannerReader.java
PlannerReader.getTime
private Date getTime(String value) throws MPXJException { try { Number hours = m_twoDigitFormat.parse(value.substring(0, 2)); Number minutes = m_twoDigitFormat.parse(value.substring(2, 4)); Calendar cal = DateHelper.popCalendar(); cal.set(Calendar.HOUR_OF_DAY, hours.intValue()); cal.set(Calendar.MINUTE, minutes.intValue()); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); Date result = cal.getTime(); DateHelper.pushCalendar(cal); return result; } catch (ParseException ex) { throw new MPXJException("Failed to parse time " + value, ex); } }
java
private Date getTime(String value) throws MPXJException { try { Number hours = m_twoDigitFormat.parse(value.substring(0, 2)); Number minutes = m_twoDigitFormat.parse(value.substring(2, 4)); Calendar cal = DateHelper.popCalendar(); cal.set(Calendar.HOUR_OF_DAY, hours.intValue()); cal.set(Calendar.MINUTE, minutes.intValue()); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); Date result = cal.getTime(); DateHelper.pushCalendar(cal); return result; } catch (ParseException ex) { throw new MPXJException("Failed to parse time " + value, ex); } }
[ "private", "Date", "getTime", "(", "String", "value", ")", "throws", "MPXJException", "{", "try", "{", "Number", "hours", "=", "m_twoDigitFormat", ".", "parse", "(", "value", ".", "substring", "(", "0", ",", "2", ")", ")", ";", "Number", "minutes", "=", "m_twoDigitFormat", ".", "parse", "(", "value", ".", "substring", "(", "2", ",", "4", ")", ")", ";", "Calendar", "cal", "=", "DateHelper", ".", "popCalendar", "(", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "hours", ".", "intValue", "(", ")", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "minutes", ".", "intValue", "(", ")", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "SECOND", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MILLISECOND", ",", "0", ")", ";", "Date", "result", "=", "cal", ".", "getTime", "(", ")", ";", "DateHelper", ".", "pushCalendar", "(", "cal", ")", ";", "return", "result", ";", "}", "catch", "(", "ParseException", "ex", ")", "{", "throw", "new", "MPXJException", "(", "\"Failed to parse time \"", "+", "value", ",", "ex", ")", ";", "}", "}" ]
Convert a Planner time into a Java date. 0800 @param value Planner time @return Java Date instance
[ "Convert", "a", "Planner", "time", "into", "a", "Java", "date", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/planner/PlannerReader.java#L869-L891
tango-controls/JTango
dao/src/main/java/fr/esrf/TangoDs/TemplCommand.java
TemplCommand.find_method
protected Method find_method(Method[] meth_list,String meth_name) throws DevFailed { int i; Method meth_found = null; for (i = 0;i < meth_list.length;i++) { if (meth_name.equals(meth_list[i].getName())) { for (int j = i + 1;j < meth_list.length;j++) { if (meth_name.equals(meth_list[j].getName())) { StringBuffer mess = new StringBuffer("Method overloading is not supported for command (Method name = "); mess.append(meth_name); mess.append(")"); Except.throw_exception("API_OverloadingNotSupported", mess.toString(), "TemplCommand.find_method()"); } } meth_found = meth_list[i]; break; } } if (i == meth_list.length) { StringBuffer mess = new StringBuffer("Command "); mess.append(name); mess.append(": Can't find method "); mess.append(meth_name); Except.throw_exception("API_MethodNotFound", mess.toString(), "TemplCommand.find_method()"); } return meth_found; }
java
protected Method find_method(Method[] meth_list,String meth_name) throws DevFailed { int i; Method meth_found = null; for (i = 0;i < meth_list.length;i++) { if (meth_name.equals(meth_list[i].getName())) { for (int j = i + 1;j < meth_list.length;j++) { if (meth_name.equals(meth_list[j].getName())) { StringBuffer mess = new StringBuffer("Method overloading is not supported for command (Method name = "); mess.append(meth_name); mess.append(")"); Except.throw_exception("API_OverloadingNotSupported", mess.toString(), "TemplCommand.find_method()"); } } meth_found = meth_list[i]; break; } } if (i == meth_list.length) { StringBuffer mess = new StringBuffer("Command "); mess.append(name); mess.append(": Can't find method "); mess.append(meth_name); Except.throw_exception("API_MethodNotFound", mess.toString(), "TemplCommand.find_method()"); } return meth_found; }
[ "protected", "Method", "find_method", "(", "Method", "[", "]", "meth_list", ",", "String", "meth_name", ")", "throws", "DevFailed", "{", "int", "i", ";", "Method", "meth_found", "=", "null", ";", "for", "(", "i", "=", "0", ";", "i", "<", "meth_list", ".", "length", ";", "i", "++", ")", "{", "if", "(", "meth_name", ".", "equals", "(", "meth_list", "[", "i", "]", ".", "getName", "(", ")", ")", ")", "{", "for", "(", "int", "j", "=", "i", "+", "1", ";", "j", "<", "meth_list", ".", "length", ";", "j", "++", ")", "{", "if", "(", "meth_name", ".", "equals", "(", "meth_list", "[", "j", "]", ".", "getName", "(", ")", ")", ")", "{", "StringBuffer", "mess", "=", "new", "StringBuffer", "(", "\"Method overloading is not supported for command (Method name = \"", ")", ";", "mess", ".", "append", "(", "meth_name", ")", ";", "mess", ".", "append", "(", "\")\"", ")", ";", "Except", ".", "throw_exception", "(", "\"API_OverloadingNotSupported\"", ",", "mess", ".", "toString", "(", ")", ",", "\"TemplCommand.find_method()\"", ")", ";", "}", "}", "meth_found", "=", "meth_list", "[", "i", "]", ";", "break", ";", "}", "}", "if", "(", "i", "==", "meth_list", ".", "length", ")", "{", "StringBuffer", "mess", "=", "new", "StringBuffer", "(", "\"Command \"", ")", ";", "mess", ".", "append", "(", "name", ")", ";", "mess", ".", "append", "(", "\": Can't find method \"", ")", ";", "mess", ".", "append", "(", "meth_name", ")", ";", "Except", ".", "throw_exception", "(", "\"API_MethodNotFound\"", ",", "mess", ".", "toString", "(", ")", ",", "\"TemplCommand.find_method()\"", ")", ";", "}", "return", "meth_found", ";", "}" ]
Retrieve a Method object from a Method list from its name. @param meth_list The Method object list @return The wanted method @exception DevFailed If the method is not known or if two methods are found with the same name Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read <b>DevFailed</b> exception specification
[ "Retrieve", "a", "Method", "object", "from", "a", "Method", "list", "from", "its", "name", "." ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/TemplCommand.java#L708-L747
Impetus/Kundera
src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClient.java
OracleNoSQLClient.onRelationalAttributes
private void onRelationalAttributes(List<RelationHolder> rlHolders, Row row, Table schemaTable) { // Iterate over relations if (rlHolders != null && !rlHolders.isEmpty()) { for (RelationHolder rh : rlHolders) { String relationName = rh.getRelationName(); Object valueObj = rh.getRelationValue(); if (!StringUtils.isEmpty(relationName) && valueObj != null) { if (valueObj != null) { NoSqlDBUtils.add(schemaTable.getField(relationName), row, valueObj, relationName); KunderaCoreUtils.printQuery( "Add relation: relation name:" + relationName + "relation value:" + valueObj, showQuery); } } } } }
java
private void onRelationalAttributes(List<RelationHolder> rlHolders, Row row, Table schemaTable) { // Iterate over relations if (rlHolders != null && !rlHolders.isEmpty()) { for (RelationHolder rh : rlHolders) { String relationName = rh.getRelationName(); Object valueObj = rh.getRelationValue(); if (!StringUtils.isEmpty(relationName) && valueObj != null) { if (valueObj != null) { NoSqlDBUtils.add(schemaTable.getField(relationName), row, valueObj, relationName); KunderaCoreUtils.printQuery( "Add relation: relation name:" + relationName + "relation value:" + valueObj, showQuery); } } } } }
[ "private", "void", "onRelationalAttributes", "(", "List", "<", "RelationHolder", ">", "rlHolders", ",", "Row", "row", ",", "Table", "schemaTable", ")", "{", "// Iterate over relations", "if", "(", "rlHolders", "!=", "null", "&&", "!", "rlHolders", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "RelationHolder", "rh", ":", "rlHolders", ")", "{", "String", "relationName", "=", "rh", ".", "getRelationName", "(", ")", ";", "Object", "valueObj", "=", "rh", ".", "getRelationValue", "(", ")", ";", "if", "(", "!", "StringUtils", ".", "isEmpty", "(", "relationName", ")", "&&", "valueObj", "!=", "null", ")", "{", "if", "(", "valueObj", "!=", "null", ")", "{", "NoSqlDBUtils", ".", "add", "(", "schemaTable", ".", "getField", "(", "relationName", ")", ",", "row", ",", "valueObj", ",", "relationName", ")", ";", "KunderaCoreUtils", ".", "printQuery", "(", "\"Add relation: relation name:\"", "+", "relationName", "+", "\"relation value:\"", "+", "valueObj", ",", "showQuery", ")", ";", "}", "}", "}", "}", "}" ]
Process relational attributes. @param rlHolders relation holders @param row kv row object @param schemaTable the schema table
[ "Process", "relational", "attributes", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClient.java#L1109-L1131
atteo/classindex
classindex/src/main/java/org/atteo/classindex/ClassIndex.java
ClassIndex.getAnnotatedNames
public static Iterable<String> getAnnotatedNames(Class<? extends Annotation> annotation, ClassLoader classLoader) { return readIndexFile(classLoader, ANNOTATED_INDEX_PREFIX + annotation.getCanonicalName()); }
java
public static Iterable<String> getAnnotatedNames(Class<? extends Annotation> annotation, ClassLoader classLoader) { return readIndexFile(classLoader, ANNOTATED_INDEX_PREFIX + annotation.getCanonicalName()); }
[ "public", "static", "Iterable", "<", "String", ">", "getAnnotatedNames", "(", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ",", "ClassLoader", "classLoader", ")", "{", "return", "readIndexFile", "(", "classLoader", ",", "ANNOTATED_INDEX_PREFIX", "+", "annotation", ".", "getCanonicalName", "(", ")", ")", ";", "}" ]
Retrieves names of classes annotated by given annotation. <p/> <p> The annotation must be annotated with {@link IndexAnnotated} for annotated classes to be indexed at compile-time by {@link org.atteo.classindex.processor.ClassIndexProcessor}. </p> <p> Please note there is no verification if the class really exists. It can be missing when incremental compilation is used. Use {@link #getAnnotated(Class, ClassLoader) } if you need the verification. </p> @param annotation annotation to search class for @param classLoader classloader for loading the index file @return names of annotated classes
[ "Retrieves", "names", "of", "classes", "annotated", "by", "given", "annotation", ".", "<p", "/", ">", "<p", ">", "The", "annotation", "must", "be", "annotated", "with", "{" ]
train
https://github.com/atteo/classindex/blob/ad76c6bd8b4e84c594d94e48f466a095ffe2306a/classindex/src/main/java/org/atteo/classindex/ClassIndex.java#L304-L306
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getImplodedMapped
@Nonnull public static <ELEMENTTYPE> String getImplodedMapped (@Nonnull final String sSep, @Nullable final ELEMENTTYPE [] aElements, @Nonnull final Function <? super ELEMENTTYPE, String> aMapper) { ValueEnforcer.notNull (sSep, "Separator"); ValueEnforcer.notNull (aMapper, "Mapper"); if (ArrayHelper.isEmpty (aElements)) return ""; return getImplodedMapped (sSep, aElements, 0, aElements.length, aMapper); }
java
@Nonnull public static <ELEMENTTYPE> String getImplodedMapped (@Nonnull final String sSep, @Nullable final ELEMENTTYPE [] aElements, @Nonnull final Function <? super ELEMENTTYPE, String> aMapper) { ValueEnforcer.notNull (sSep, "Separator"); ValueEnforcer.notNull (aMapper, "Mapper"); if (ArrayHelper.isEmpty (aElements)) return ""; return getImplodedMapped (sSep, aElements, 0, aElements.length, aMapper); }
[ "@", "Nonnull", "public", "static", "<", "ELEMENTTYPE", ">", "String", "getImplodedMapped", "(", "@", "Nonnull", "final", "String", "sSep", ",", "@", "Nullable", "final", "ELEMENTTYPE", "[", "]", "aElements", ",", "@", "Nonnull", "final", "Function", "<", "?", "super", "ELEMENTTYPE", ",", "String", ">", "aMapper", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sSep", ",", "\"Separator\"", ")", ";", "ValueEnforcer", ".", "notNull", "(", "aMapper", ",", "\"Mapper\"", ")", ";", "if", "(", "ArrayHelper", ".", "isEmpty", "(", "aElements", ")", ")", "return", "\"\"", ";", "return", "getImplodedMapped", "(", "sSep", ",", "aElements", ",", "0", ",", "aElements", ".", "length", ",", "aMapper", ")", ";", "}" ]
Get a concatenated String from all elements of the passed array, separated by the specified separator string. @param sSep The separator to use. May not be <code>null</code>. @param aElements The container to convert. May be <code>null</code> or empty. @param aMapper The mapping function to convert from ELEMENTTYPE to String. May not be <code>null</code>. @return The concatenated string. @param <ELEMENTTYPE> The type of elements to be imploded. @since 8.5.6
[ "Get", "a", "concatenated", "String", "from", "all", "elements", "of", "the", "passed", "array", "separated", "by", "the", "specified", "separator", "string", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L1335-L1346
alkacon/opencms-core
src-gwt/org/opencms/ade/editprovider/client/CmsDirectEditButtons.java
CmsDirectEditButtons.setPosition
public void setPosition(CmsPositionBean position, CmsPositionBean buttonsPosition, Element containerElement) { m_position = position; Element parent = CmsDomUtil.getPositioningParent(getElement()); Style style = getElement().getStyle(); style.setRight( parent.getOffsetWidth() - ((buttonsPosition.getLeft() + buttonsPosition.getWidth()) - parent.getAbsoluteLeft()), Unit.PX); int top = buttonsPosition.getTop() - parent.getAbsoluteTop(); if (top < 0) { top = 0; } style.setTop(top, Unit.PX); }
java
public void setPosition(CmsPositionBean position, CmsPositionBean buttonsPosition, Element containerElement) { m_position = position; Element parent = CmsDomUtil.getPositioningParent(getElement()); Style style = getElement().getStyle(); style.setRight( parent.getOffsetWidth() - ((buttonsPosition.getLeft() + buttonsPosition.getWidth()) - parent.getAbsoluteLeft()), Unit.PX); int top = buttonsPosition.getTop() - parent.getAbsoluteTop(); if (top < 0) { top = 0; } style.setTop(top, Unit.PX); }
[ "public", "void", "setPosition", "(", "CmsPositionBean", "position", ",", "CmsPositionBean", "buttonsPosition", ",", "Element", "containerElement", ")", "{", "m_position", "=", "position", ";", "Element", "parent", "=", "CmsDomUtil", ".", "getPositioningParent", "(", "getElement", "(", ")", ")", ";", "Style", "style", "=", "getElement", "(", ")", ".", "getStyle", "(", ")", ";", "style", ".", "setRight", "(", "parent", ".", "getOffsetWidth", "(", ")", "-", "(", "(", "buttonsPosition", ".", "getLeft", "(", ")", "+", "buttonsPosition", ".", "getWidth", "(", ")", ")", "-", "parent", ".", "getAbsoluteLeft", "(", ")", ")", ",", "Unit", ".", "PX", ")", ";", "int", "top", "=", "buttonsPosition", ".", "getTop", "(", ")", "-", "parent", ".", "getAbsoluteTop", "(", ")", ";", "if", "(", "top", "<", "0", ")", "{", "top", "=", "0", ";", "}", "style", ".", "setTop", "(", "top", ",", "Unit", ".", "PX", ")", ";", "}" ]
Sets the position. Make sure the widget is attached to the DOM.<p> @param position the absolute position @param buttonsPosition the corrected position for the buttons @param containerElement the parent container element
[ "Sets", "the", "position", ".", "Make", "sure", "the", "widget", "is", "attached", "to", "the", "DOM", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/editprovider/client/CmsDirectEditButtons.java#L89-L103
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java
ElementMatchers.takesArgument
public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArgument(int index, TypeDescription type) { return takesArgument(index, is(type)); }
java
public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArgument(int index, TypeDescription type) { return takesArgument(index, is(type)); }
[ "public", "static", "<", "T", "extends", "MethodDescription", ">", "ElementMatcher", ".", "Junction", "<", "T", ">", "takesArgument", "(", "int", "index", ",", "TypeDescription", "type", ")", "{", "return", "takesArgument", "(", "index", ",", "is", "(", "type", ")", ")", ";", "}" ]
Matches {@link MethodDescription}s that define a given type erasure as a parameter at the given index. @param index The index of the parameter. @param type The erasure of the type the matched method is expected to define as a parameter type. @param <T> The type of the matched object. @return An element matcher that matches a given argument type for a method description.
[ "Matches", "{", "@link", "MethodDescription", "}", "s", "that", "define", "a", "given", "type", "erasure", "as", "a", "parameter", "at", "the", "given", "index", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L1254-L1256
xerial/snappy-java
src/main/java/org/xerial/snappy/Snappy.java
Snappy.uncompressString
public static String uncompressString(byte[] input, int offset, int length) throws IOException { try { return uncompressString(input, offset, length, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("UTF-8 decoder is not found"); } }
java
public static String uncompressString(byte[] input, int offset, int length) throws IOException { try { return uncompressString(input, offset, length, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("UTF-8 decoder is not found"); } }
[ "public", "static", "String", "uncompressString", "(", "byte", "[", "]", "input", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "try", "{", "return", "uncompressString", "(", "input", ",", "offset", ",", "length", ",", "\"UTF-8\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"UTF-8 decoder is not found\"", ")", ";", "}", "}" ]
Uncompress the input[offset, offset+length) as a String @param input @param offset @param length @return the uncompressed data @throws IOException
[ "Uncompress", "the", "input", "[", "offset", "offset", "+", "length", ")", "as", "a", "String" ]
train
https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L823-L832
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/publisher/BaseDataPublisher.java
BaseDataPublisher.getIntermediateMetadataFromState
private String getIntermediateMetadataFromState(WorkUnitState state, int branchId) { return state.getProp( ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_METADATA_KEY, this.numBranches, branchId)); }
java
private String getIntermediateMetadataFromState(WorkUnitState state, int branchId) { return state.getProp( ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_METADATA_KEY, this.numBranches, branchId)); }
[ "private", "String", "getIntermediateMetadataFromState", "(", "WorkUnitState", "state", ",", "int", "branchId", ")", "{", "return", "state", ".", "getProp", "(", "ForkOperatorUtils", ".", "getPropertyNameForBranch", "(", "ConfigurationKeys", ".", "WRITER_METADATA_KEY", ",", "this", ".", "numBranches", ",", "branchId", ")", ")", ";", "}" ]
/* Retrieve intermediate metadata (eg the metadata stored by each writer) for a given state and branch id.
[ "/", "*", "Retrieve", "intermediate", "metadata", "(", "eg", "the", "metadata", "stored", "by", "each", "writer", ")", "for", "a", "given", "state", "and", "branch", "id", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/publisher/BaseDataPublisher.java#L743-L746
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassNameRewriterUtil.java
ClassNameRewriterUtil.rewriteSignature
public static String rewriteSignature(ClassNameRewriter classNameRewriter, String signature) { if (classNameRewriter != IdentityClassNameRewriter.instance() && signature.startsWith("L")) { String className = signature.substring(1, signature.length() - 1).replace('/', '.'); className = classNameRewriter.rewriteClassName(className); signature = "L" + className.replace('.', '/') + ";"; } return signature; }
java
public static String rewriteSignature(ClassNameRewriter classNameRewriter, String signature) { if (classNameRewriter != IdentityClassNameRewriter.instance() && signature.startsWith("L")) { String className = signature.substring(1, signature.length() - 1).replace('/', '.'); className = classNameRewriter.rewriteClassName(className); signature = "L" + className.replace('.', '/') + ";"; } return signature; }
[ "public", "static", "String", "rewriteSignature", "(", "ClassNameRewriter", "classNameRewriter", ",", "String", "signature", ")", "{", "if", "(", "classNameRewriter", "!=", "IdentityClassNameRewriter", ".", "instance", "(", ")", "&&", "signature", ".", "startsWith", "(", "\"L\"", ")", ")", "{", "String", "className", "=", "signature", ".", "substring", "(", "1", ",", "signature", ".", "length", "(", ")", "-", "1", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ";", "className", "=", "classNameRewriter", ".", "rewriteClassName", "(", "className", ")", ";", "signature", "=", "\"L\"", "+", "className", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "\";\"", ";", "}", "return", "signature", ";", "}" ]
Rewrite a signature. @param classNameRewriter a ClassNameRewriter @param signature a signature (parameter, return type, or field) @return rewritten signature with class name updated if required
[ "Rewrite", "a", "signature", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassNameRewriterUtil.java#L73-L83
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java
FeatureInfoBuilder.buildResultsInfoMessage
public String buildResultsInfoMessage(FeatureIndexResults results, double tolerance, Projection projection) { return buildResultsInfoMessage(results, tolerance, null, projection); }
java
public String buildResultsInfoMessage(FeatureIndexResults results, double tolerance, Projection projection) { return buildResultsInfoMessage(results, tolerance, null, projection); }
[ "public", "String", "buildResultsInfoMessage", "(", "FeatureIndexResults", "results", ",", "double", "tolerance", ",", "Projection", "projection", ")", "{", "return", "buildResultsInfoMessage", "(", "results", ",", "tolerance", ",", "null", ",", "projection", ")", ";", "}" ]
Build a feature results information message @param results feature index results @param tolerance distance tolerance @param projection desired geometry projection @return results message or null if no results
[ "Build", "a", "feature", "results", "information", "message" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java#L307-L309
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Bidi.java
Bidi.setLine
public Bidi setLine(int start, int limit) { verifyValidPara(); verifyRange(start, 0, limit); verifyRange(limit, 0, length+1); if (getParagraphIndex(start) != getParagraphIndex(limit - 1)) { /* the line crosses a paragraph boundary */ throw new IllegalArgumentException(); } return BidiLine.setLine(this, start, limit); }
java
public Bidi setLine(int start, int limit) { verifyValidPara(); verifyRange(start, 0, limit); verifyRange(limit, 0, length+1); if (getParagraphIndex(start) != getParagraphIndex(limit - 1)) { /* the line crosses a paragraph boundary */ throw new IllegalArgumentException(); } return BidiLine.setLine(this, start, limit); }
[ "public", "Bidi", "setLine", "(", "int", "start", ",", "int", "limit", ")", "{", "verifyValidPara", "(", ")", ";", "verifyRange", "(", "start", ",", "0", ",", "limit", ")", ";", "verifyRange", "(", "limit", ",", "0", ",", "length", "+", "1", ")", ";", "if", "(", "getParagraphIndex", "(", "start", ")", "!=", "getParagraphIndex", "(", "limit", "-", "1", ")", ")", "{", "/* the line crosses a paragraph boundary */", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "return", "BidiLine", ".", "setLine", "(", "this", ",", "start", ",", "limit", ")", ";", "}" ]
<code>setLine()</code> returns a <code>Bidi</code> object to contain the reordering information, especially the resolved levels, for all the characters in a line of text. This line of text is specified by referring to a <code>Bidi</code> object representing this information for a piece of text containing one or more paragraphs, and by specifying a range of indexes in this text.<p> In the new line object, the indexes will range from 0 to <code>limit-start-1</code>.<p> This is used after calling <code>setPara()</code> for a piece of text, and after line-breaking on that text. It is not necessary if each paragraph is treated as a single line.<p> After line-breaking, rules (L1) and (L2) for the treatment of trailing WS and for reordering are performed on a <code>Bidi</code> object that represents a line.<p> <strong>Important: </strong>the line <code>Bidi</code> object may reference data within the global text <code>Bidi</code> object. You should not alter the content of the global text object until you are finished using the line object. @param start is the line's first index into the text. @param limit is just behind the line's last index into the text (its last index +1). @return a <code>Bidi</code> object that will now represent a line of the text. @throws IllegalStateException if this call is not preceded by a successful call to <code>setPara</code> @throws IllegalArgumentException if start and limit are not in the range <code>0&lt;=start&lt;limit&lt;=getProcessedLength()</code>, or if the specified line crosses a paragraph boundary @see #setPara @see #getProcessedLength
[ "<code", ">", "setLine", "()", "<", "/", "code", ">", "returns", "a", "<code", ">", "Bidi<", "/", "code", ">", "object", "to", "contain", "the", "reordering", "information", "especially", "the", "resolved", "levels", "for", "all", "the", "characters", "in", "a", "line", "of", "text", ".", "This", "line", "of", "text", "is", "specified", "by", "referring", "to", "a", "<code", ">", "Bidi<", "/", "code", ">", "object", "representing", "this", "information", "for", "a", "piece", "of", "text", "containing", "one", "or", "more", "paragraphs", "and", "by", "specifying", "a", "range", "of", "indexes", "in", "this", "text", ".", "<p", ">", "In", "the", "new", "line", "object", "the", "indexes", "will", "range", "from", "0", "to", "<code", ">", "limit", "-", "start", "-", "1<", "/", "code", ">", ".", "<p", ">" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Bidi.java#L4682-L4692
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java
CmsSitemapController.createSitemapSubEntry
public void createSitemapSubEntry(final CmsClientSitemapEntry newEntry, CmsUUID parentId, String sitemapType) { CmsUUID structureId = m_data.getDefaultNewElementInfo().getCopyResourceId(); newEntry.setResourceTypeName(sitemapType); create(newEntry, parentId, m_data.getDefaultNewElementInfo().getId(), structureId, null, true); }
java
public void createSitemapSubEntry(final CmsClientSitemapEntry newEntry, CmsUUID parentId, String sitemapType) { CmsUUID structureId = m_data.getDefaultNewElementInfo().getCopyResourceId(); newEntry.setResourceTypeName(sitemapType); create(newEntry, parentId, m_data.getDefaultNewElementInfo().getId(), structureId, null, true); }
[ "public", "void", "createSitemapSubEntry", "(", "final", "CmsClientSitemapEntry", "newEntry", ",", "CmsUUID", "parentId", ",", "String", "sitemapType", ")", "{", "CmsUUID", "structureId", "=", "m_data", ".", "getDefaultNewElementInfo", "(", ")", ".", "getCopyResourceId", "(", ")", ";", "newEntry", ".", "setResourceTypeName", "(", "sitemapType", ")", ";", "create", "(", "newEntry", ",", "parentId", ",", "m_data", ".", "getDefaultNewElementInfo", "(", ")", ".", "getId", "(", ")", ",", "structureId", ",", "null", ",", "true", ")", ";", "}" ]
Creates a sitemap folder.<p> @param newEntry the new entry @param parentId the entry parent id @param sitemapType the resource type for the subsitemap folder
[ "Creates", "a", "sitemap", "folder", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L595-L600
calimero-project/calimero-core
src/tuwien/auto/calimero/dptxlator/DPTXlatorDateTime.java
DPTXlatorDateTime.setValidField
public final void setValidField(final int field, final boolean valid) { if (field < 0 || field >= FIELD_MASKS.length) throw new KNXIllegalArgumentException("illegal field"); setBit(0, FIELD_MASKS[field], !valid); }
java
public final void setValidField(final int field, final boolean valid) { if (field < 0 || field >= FIELD_MASKS.length) throw new KNXIllegalArgumentException("illegal field"); setBit(0, FIELD_MASKS[field], !valid); }
[ "public", "final", "void", "setValidField", "(", "final", "int", "field", ",", "final", "boolean", "valid", ")", "{", "if", "(", "field", "<", "0", "||", "field", ">=", "FIELD_MASKS", ".", "length", ")", "throw", "new", "KNXIllegalArgumentException", "(", "\"illegal field\"", ")", ";", "setBit", "(", "0", ",", "FIELD_MASKS", "[", "field", "]", ",", "!", "valid", ")", ";", "}" ]
Sets a date/time field of the first translation item to valid or not valid. <p> A field which is valid, i.e., contains valid data, has to be set <code>true</code>, otherwise the field should be set not valid with <code>false</code>.<br> Possible fields allowed to be set valid or not valid are {@link #YEAR}, {@link #DATE}, {@link #TIME}, {@link #DAY_OF_WEEK} and {@link #WORKDAY}. @param field field number @param valid <code>true</code> if field is supported and contains valid data, <code>false</code> otherwise
[ "Sets", "a", "date", "/", "time", "field", "of", "the", "first", "translation", "item", "to", "valid", "or", "not", "valid", ".", "<p", ">", "A", "field", "which", "is", "valid", "i", ".", "e", ".", "contains", "valid", "data", "has", "to", "be", "set", "<code", ">", "true<", "/", "code", ">", "otherwise", "the", "field", "should", "be", "set", "not", "valid", "with", "<code", ">", "false<", "/", "code", ">", ".", "<br", ">", "Possible", "fields", "allowed", "to", "be", "set", "valid", "or", "not", "valid", "are", "{", "@link", "#YEAR", "}", "{", "@link", "#DATE", "}", "{", "@link", "#TIME", "}", "{", "@link", "#DAY_OF_WEEK", "}", "and", "{", "@link", "#WORKDAY", "}", "." ]
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/dptxlator/DPTXlatorDateTime.java#L525-L530
lessthanoptimal/BoofCV
main/boofcv-types/src/main/java/boofcv/alg/InputSanityCheck.java
InputSanityCheck.checkDeclare
public static <T extends ImageBase<T>> T checkDeclare(T input, T output) { if (output == null) { output = (T) input.createNew(input.width, input.height); } else { output.reshape(input.width, input.height); } return output; }
java
public static <T extends ImageBase<T>> T checkDeclare(T input, T output) { if (output == null) { output = (T) input.createNew(input.width, input.height); } else { output.reshape(input.width, input.height); } return output; }
[ "public", "static", "<", "T", "extends", "ImageBase", "<", "T", ">", ">", "T", "checkDeclare", "(", "T", "input", ",", "T", "output", ")", "{", "if", "(", "output", "==", "null", ")", "{", "output", "=", "(", "T", ")", "input", ".", "createNew", "(", "input", ".", "width", ",", "input", ".", "height", ")", ";", "}", "else", "{", "output", ".", "reshape", "(", "input", ".", "width", ",", "input", ".", "height", ")", ";", "}", "return", "output", ";", "}" ]
If the output has not been declared a new instance is declared. If an instance of the output is provided its bounds are checked.
[ "If", "the", "output", "has", "not", "been", "declared", "a", "new", "instance", "is", "declared", ".", "If", "an", "instance", "of", "the", "output", "is", "provided", "its", "bounds", "are", "checked", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/alg/InputSanityCheck.java#L58-L65
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/WSKeyStore.java
WSKeyStore.printWarning
public void printWarning(int daysBeforeExpireWarning, String keyStoreName, String alias, X509Certificate cert) { try { long millisDelta = ((((daysBeforeExpireWarning * 24L) * 60L) * 60L) * 1000L); long millisBeforeExpiration = cert.getNotAfter().getTime() - System.currentTimeMillis(); long daysLeft = ((((millisBeforeExpiration / 1000L) / 60L) / 60L) / 24L); // cert is already expired if (millisBeforeExpiration < 0) { Tr.error(tc, "ssl.expiration.expired.CWPKI0017E", new Object[] { alias, keyStoreName }); } else if (millisBeforeExpiration < millisDelta) { Tr.warning(tc, "ssl.expiration.warning.CWPKI0016W", new Object[] { alias, keyStoreName, Long.valueOf(daysLeft) }); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "The certificate with alias " + alias + " from keyStore " + keyStoreName + " has " + daysLeft + " days left before expiring."); } } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Exception reading KeyStore certificates during expiration check; " + e); FFDCFilter.processException(e, getClass().getName(), "printWarning", this); } }
java
public void printWarning(int daysBeforeExpireWarning, String keyStoreName, String alias, X509Certificate cert) { try { long millisDelta = ((((daysBeforeExpireWarning * 24L) * 60L) * 60L) * 1000L); long millisBeforeExpiration = cert.getNotAfter().getTime() - System.currentTimeMillis(); long daysLeft = ((((millisBeforeExpiration / 1000L) / 60L) / 60L) / 24L); // cert is already expired if (millisBeforeExpiration < 0) { Tr.error(tc, "ssl.expiration.expired.CWPKI0017E", new Object[] { alias, keyStoreName }); } else if (millisBeforeExpiration < millisDelta) { Tr.warning(tc, "ssl.expiration.warning.CWPKI0016W", new Object[] { alias, keyStoreName, Long.valueOf(daysLeft) }); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "The certificate with alias " + alias + " from keyStore " + keyStoreName + " has " + daysLeft + " days left before expiring."); } } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Exception reading KeyStore certificates during expiration check; " + e); FFDCFilter.processException(e, getClass().getName(), "printWarning", this); } }
[ "public", "void", "printWarning", "(", "int", "daysBeforeExpireWarning", ",", "String", "keyStoreName", ",", "String", "alias", ",", "X509Certificate", "cert", ")", "{", "try", "{", "long", "millisDelta", "=", "(", "(", "(", "(", "daysBeforeExpireWarning", "*", "24L", ")", "*", "60L", ")", "*", "60L", ")", "*", "1000L", ")", ";", "long", "millisBeforeExpiration", "=", "cert", ".", "getNotAfter", "(", ")", ".", "getTime", "(", ")", "-", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "daysLeft", "=", "(", "(", "(", "(", "millisBeforeExpiration", "/", "1000L", ")", "/", "60L", ")", "/", "60L", ")", "/", "24L", ")", ";", "// cert is already expired", "if", "(", "millisBeforeExpiration", "<", "0", ")", "{", "Tr", ".", "error", "(", "tc", ",", "\"ssl.expiration.expired.CWPKI0017E\"", ",", "new", "Object", "[", "]", "{", "alias", ",", "keyStoreName", "}", ")", ";", "}", "else", "if", "(", "millisBeforeExpiration", "<", "millisDelta", ")", "{", "Tr", ".", "warning", "(", "tc", ",", "\"ssl.expiration.warning.CWPKI0016W\"", ",", "new", "Object", "[", "]", "{", "alias", ",", "keyStoreName", ",", "Long", ".", "valueOf", "(", "daysLeft", ")", "}", ")", ";", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"The certificate with alias \"", "+", "alias", "+", "\" from keyStore \"", "+", "keyStoreName", "+", "\" has \"", "+", "daysLeft", "+", "\" days left before expiring.\"", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Exception reading KeyStore certificates during expiration check; \"", "+", "e", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "getClass", "(", ")", ".", "getName", "(", ")", ",", "\"printWarning\"", ",", "this", ")", ";", "}", "}" ]
Print a warning about a certificate being expired or soon to be expired in the keystore. @param daysBeforeExpireWarning @param keyStoreName @param alias @param cert
[ "Print", "a", "warning", "about", "a", "certificate", "being", "expired", "or", "soon", "to", "be", "expired", "in", "the", "keystore", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/WSKeyStore.java#L1062-L1082
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/gen/SignatureGenerator.java
SignatureGenerator.genMethodTypeSignature
private void genMethodTypeSignature(ExecutableElement method, StringBuilder sb) { genOptFormalTypeParameters(method.getTypeParameters(), sb); sb.append('('); for (VariableElement param : method.getParameters()) { genTypeSignature(param.asType(), sb); } sb.append(')'); genTypeSignature(method.getReturnType(), sb); List<? extends TypeMirror> thrownTypes = method.getThrownTypes(); if (hasGenericSignature(thrownTypes)) { for (TypeMirror thrownType : thrownTypes) { sb.append('^'); genTypeSignature(thrownType, sb); } } }
java
private void genMethodTypeSignature(ExecutableElement method, StringBuilder sb) { genOptFormalTypeParameters(method.getTypeParameters(), sb); sb.append('('); for (VariableElement param : method.getParameters()) { genTypeSignature(param.asType(), sb); } sb.append(')'); genTypeSignature(method.getReturnType(), sb); List<? extends TypeMirror> thrownTypes = method.getThrownTypes(); if (hasGenericSignature(thrownTypes)) { for (TypeMirror thrownType : thrownTypes) { sb.append('^'); genTypeSignature(thrownType, sb); } } }
[ "private", "void", "genMethodTypeSignature", "(", "ExecutableElement", "method", ",", "StringBuilder", "sb", ")", "{", "genOptFormalTypeParameters", "(", "method", ".", "getTypeParameters", "(", ")", ",", "sb", ")", ";", "sb", ".", "append", "(", "'", "'", ")", ";", "for", "(", "VariableElement", "param", ":", "method", ".", "getParameters", "(", ")", ")", "{", "genTypeSignature", "(", "param", ".", "asType", "(", ")", ",", "sb", ")", ";", "}", "sb", ".", "append", "(", "'", "'", ")", ";", "genTypeSignature", "(", "method", ".", "getReturnType", "(", ")", ",", "sb", ")", ";", "List", "<", "?", "extends", "TypeMirror", ">", "thrownTypes", "=", "method", ".", "getThrownTypes", "(", ")", ";", "if", "(", "hasGenericSignature", "(", "thrownTypes", ")", ")", "{", "for", "(", "TypeMirror", "thrownType", ":", "thrownTypes", ")", "{", "sb", ".", "append", "(", "'", "'", ")", ";", "genTypeSignature", "(", "thrownType", ",", "sb", ")", ";", "}", "}", "}" ]
MethodTypeSignature ::= [FormalTypeParameters] "(" {TypeSignature} ")" ReturnType {ThrowsSignature}.
[ "MethodTypeSignature", "::", "=", "[", "FormalTypeParameters", "]", "(", "{", "TypeSignature", "}", ")", "ReturnType", "{", "ThrowsSignature", "}", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/gen/SignatureGenerator.java#L347-L362
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.wrapKeyAsync
public ServiceFuture<KeyOperationResult> wrapKeyAsync(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeyEncryptionAlgorithm algorithm, byte[] value, final ServiceCallback<KeyOperationResult> serviceCallback) { return ServiceFuture.fromResponse(wrapKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, algorithm, value), serviceCallback); }
java
public ServiceFuture<KeyOperationResult> wrapKeyAsync(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeyEncryptionAlgorithm algorithm, byte[] value, final ServiceCallback<KeyOperationResult> serviceCallback) { return ServiceFuture.fromResponse(wrapKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, algorithm, value), serviceCallback); }
[ "public", "ServiceFuture", "<", "KeyOperationResult", ">", "wrapKeyAsync", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "String", "keyVersion", ",", "JsonWebKeyEncryptionAlgorithm", "algorithm", ",", "byte", "[", "]", "value", ",", "final", "ServiceCallback", "<", "KeyOperationResult", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", "wrapKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "keyName", ",", "keyVersion", ",", "algorithm", ",", "value", ")", ",", "serviceCallback", ")", ";", "}" ]
Wraps a symmetric key using a specified key. The WRAP operation supports encryption of a symmetric key using a key encryption key that has previously been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for symmetric keys stored in Azure Key Vault since protection with an asymmetric key can be performed using the public portion of the key. This operation is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have access to the public key material. This operation requires the keys/wrapKey permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of the key. @param keyVersion The version of the key. @param algorithm algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value the Base64Url value @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Wraps", "a", "symmetric", "key", "using", "a", "specified", "key", ".", "The", "WRAP", "operation", "supports", "encryption", "of", "a", "symmetric", "key", "using", "a", "key", "encryption", "key", "that", "has", "previously", "been", "stored", "in", "an", "Azure", "Key", "Vault", ".", "The", "WRAP", "operation", "is", "only", "strictly", "necessary", "for", "symmetric", "keys", "stored", "in", "Azure", "Key", "Vault", "since", "protection", "with", "an", "asymmetric", "key", "can", "be", "performed", "using", "the", "public", "portion", "of", "the", "key", ".", "This", "operation", "is", "supported", "for", "asymmetric", "keys", "as", "a", "convenience", "for", "callers", "that", "have", "a", "key", "-", "reference", "but", "do", "not", "have", "access", "to", "the", "public", "key", "material", ".", "This", "operation", "requires", "the", "keys", "/", "wrapKey", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L2619-L2621
vigna/Sux4J
src/it/unimi/dsi/sux4j/mph/HypergraphSorter.java
HypergraphSorter.bitVectorToEdge
public static void bitVectorToEdge(final BitVector bv, final long seed, final int numVertices, final int e[]) { bitVectorToEdge(bv, seed, numVertices, (int)(numVertices * 0xAAAAAAABL >>> 33), e); // Fast division by 3 }
java
public static void bitVectorToEdge(final BitVector bv, final long seed, final int numVertices, final int e[]) { bitVectorToEdge(bv, seed, numVertices, (int)(numVertices * 0xAAAAAAABL >>> 33), e); // Fast division by 3 }
[ "public", "static", "void", "bitVectorToEdge", "(", "final", "BitVector", "bv", ",", "final", "long", "seed", ",", "final", "int", "numVertices", ",", "final", "int", "e", "[", "]", ")", "{", "bitVectorToEdge", "(", "bv", ",", "seed", ",", "numVertices", ",", "(", "int", ")", "(", "numVertices", "*", "0xAAAAAAAB", "L", ">>>", "33", ")", ",", "e", ")", ";", "// Fast division by 3", "}" ]
Turns a bit vector into a 3-hyperedge. @param bv a bit vector. @param seed the seed for the hash function. @param numVertices the number of vertices in the underlying hypergraph. @param e an array to store the resulting edge. @see #bitVectorToEdge(BitVector, long, int, int, int[])
[ "Turns", "a", "bit", "vector", "into", "a", "3", "-", "hyperedge", "." ]
train
https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/HypergraphSorter.java#L219-L221
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/StatementManager.java
StatementManager.setObjectForStatement
private void setObjectForStatement(PreparedStatement stmt, int index, Object value, int sqlType) throws SQLException { if (value == null) { m_platform.setNullForStatement(stmt, index, sqlType); } else { m_platform.setObjectForStatement(stmt, index, value, sqlType); } }
java
private void setObjectForStatement(PreparedStatement stmt, int index, Object value, int sqlType) throws SQLException { if (value == null) { m_platform.setNullForStatement(stmt, index, sqlType); } else { m_platform.setObjectForStatement(stmt, index, value, sqlType); } }
[ "private", "void", "setObjectForStatement", "(", "PreparedStatement", "stmt", ",", "int", "index", ",", "Object", "value", ",", "int", "sqlType", ")", "throws", "SQLException", "{", "if", "(", "value", "==", "null", ")", "{", "m_platform", ".", "setNullForStatement", "(", "stmt", ",", "index", ",", "sqlType", ")", ";", "}", "else", "{", "m_platform", ".", "setObjectForStatement", "(", "stmt", ",", "index", ",", "value", ",", "sqlType", ")", ";", "}", "}" ]
Sets object for statement at specific index, adhering to platform- and null-rules. @param stmt the statement @param index the current parameter index @param value the value to set @param sqlType the JDBC SQL-type of the value @throws SQLException on platform error
[ "Sets", "object", "for", "statement", "at", "specific", "index", "adhering", "to", "platform", "-", "and", "null", "-", "rules", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java#L764-L775
undera/jmeter-plugins
graphs/graphs-basic/src/main/java/kg/apc/jmeter/vizualizers/ThreadsStateOverTimeGui.java
ThreadsStateOverTimeGui.rebuildAggRow
private void rebuildAggRow(GraphRowSimple row, long time, long duration) { long key = row.getHigherKey(lastAggUpdateTime - duration - 1); while (key < time && key != -1) { GraphPanelChartSimpleElement elt = (GraphPanelChartSimpleElement) row.getElement(key); elt.add(getAllThreadCount(key)); Long nextKey = row.getHigherKey(key); if (nextKey != null) { key = nextKey; } else { key = -1; } } }
java
private void rebuildAggRow(GraphRowSimple row, long time, long duration) { long key = row.getHigherKey(lastAggUpdateTime - duration - 1); while (key < time && key != -1) { GraphPanelChartSimpleElement elt = (GraphPanelChartSimpleElement) row.getElement(key); elt.add(getAllThreadCount(key)); Long nextKey = row.getHigherKey(key); if (nextKey != null) { key = nextKey; } else { key = -1; } } }
[ "private", "void", "rebuildAggRow", "(", "GraphRowSimple", "row", ",", "long", "time", ",", "long", "duration", ")", "{", "long", "key", "=", "row", ".", "getHigherKey", "(", "lastAggUpdateTime", "-", "duration", "-", "1", ")", ";", "while", "(", "key", "<", "time", "&&", "key", "!=", "-", "1", ")", "{", "GraphPanelChartSimpleElement", "elt", "=", "(", "GraphPanelChartSimpleElement", ")", "row", ".", "getElement", "(", "key", ")", ";", "elt", ".", "add", "(", "getAllThreadCount", "(", "key", ")", ")", ";", "Long", "nextKey", "=", "row", ".", "getHigherKey", "(", "key", ")", ";", "if", "(", "nextKey", "!=", "null", ")", "{", "key", "=", "nextKey", ";", "}", "else", "{", "key", "=", "-", "1", ";", "}", "}", "}" ]
perf fix: only process elements between time and last processed - sampler duration
[ "perf", "fix", ":", "only", "process", "elements", "between", "time", "and", "last", "processed", "-", "sampler", "duration" ]
train
https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/graphs/graphs-basic/src/main/java/kg/apc/jmeter/vizualizers/ThreadsStateOverTimeGui.java#L54-L67
infinispan/infinispan
counter/src/main/java/org/infinispan/counter/impl/entries/CounterValue.java
CounterValue.newCounterValue
public static CounterValue newCounterValue(long value, long lowerBound, long upperBound) { return new CounterValue(value, calculateState(value, lowerBound, upperBound)); }
java
public static CounterValue newCounterValue(long value, long lowerBound, long upperBound) { return new CounterValue(value, calculateState(value, lowerBound, upperBound)); }
[ "public", "static", "CounterValue", "newCounterValue", "(", "long", "value", ",", "long", "lowerBound", ",", "long", "upperBound", ")", "{", "return", "new", "CounterValue", "(", "value", ",", "calculateState", "(", "value", ",", "lowerBound", ",", "upperBound", ")", ")", ";", "}" ]
Creates a new {@link CounterValue} with the value and state based on the boundaries. @param value the counter's value. @param lowerBound the counter's lower bound. @param upperBound the counter's upper bound. @return the {@link CounterValue}.
[ "Creates", "a", "new", "{", "@link", "CounterValue", "}", "with", "the", "value", "and", "state", "based", "on", "the", "boundaries", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/counter/src/main/java/org/infinispan/counter/impl/entries/CounterValue.java#L62-L64
Bernardo-MG/dice-notation-java
src/main/java/com/bernardomg/tabletop/dice/parser/listener/DefaultDiceExpressionBuilder.java
DefaultDiceExpressionBuilder.getDiceOperand
private final DiceOperand getDiceOperand(final DiceContext ctx) { final Dice dice; // Parsed dice final Integer quantity; // Number of dice final Integer sides; // Number of sides final Iterator<TerminalNode> digits; // Parsed digits // Parses the dice data digits = ctx.DIGIT().iterator(); if (Iterables.size(ctx.DIGIT()) > 1) { if ((ctx.ADDOPERATOR() != null) && (SUBTRACTION_OPERATOR .equals(ctx.ADDOPERATOR().getText()))) { LOGGER.debug("This is part of a subtraction. Reversing sign."); quantity = 0 - Integer.parseInt(digits.next().getText()); } else { quantity = Integer.parseInt(digits.next().getText()); } } else { // No quantity of dice defined // Defaults to 1 quantity = 1; } sides = Integer.parseInt(digits.next().getText()); // Creates the dice dice = new DefaultDice(quantity, sides); return new DefaultDiceOperand(dice); }
java
private final DiceOperand getDiceOperand(final DiceContext ctx) { final Dice dice; // Parsed dice final Integer quantity; // Number of dice final Integer sides; // Number of sides final Iterator<TerminalNode> digits; // Parsed digits // Parses the dice data digits = ctx.DIGIT().iterator(); if (Iterables.size(ctx.DIGIT()) > 1) { if ((ctx.ADDOPERATOR() != null) && (SUBTRACTION_OPERATOR .equals(ctx.ADDOPERATOR().getText()))) { LOGGER.debug("This is part of a subtraction. Reversing sign."); quantity = 0 - Integer.parseInt(digits.next().getText()); } else { quantity = Integer.parseInt(digits.next().getText()); } } else { // No quantity of dice defined // Defaults to 1 quantity = 1; } sides = Integer.parseInt(digits.next().getText()); // Creates the dice dice = new DefaultDice(quantity, sides); return new DefaultDiceOperand(dice); }
[ "private", "final", "DiceOperand", "getDiceOperand", "(", "final", "DiceContext", "ctx", ")", "{", "final", "Dice", "dice", ";", "// Parsed dice", "final", "Integer", "quantity", ";", "// Number of dice", "final", "Integer", "sides", ";", "// Number of sides", "final", "Iterator", "<", "TerminalNode", ">", "digits", ";", "// Parsed digits", "// Parses the dice data", "digits", "=", "ctx", ".", "DIGIT", "(", ")", ".", "iterator", "(", ")", ";", "if", "(", "Iterables", ".", "size", "(", "ctx", ".", "DIGIT", "(", ")", ")", ">", "1", ")", "{", "if", "(", "(", "ctx", ".", "ADDOPERATOR", "(", ")", "!=", "null", ")", "&&", "(", "SUBTRACTION_OPERATOR", ".", "equals", "(", "ctx", ".", "ADDOPERATOR", "(", ")", ".", "getText", "(", ")", ")", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"This is part of a subtraction. Reversing sign.\"", ")", ";", "quantity", "=", "0", "-", "Integer", ".", "parseInt", "(", "digits", ".", "next", "(", ")", ".", "getText", "(", ")", ")", ";", "}", "else", "{", "quantity", "=", "Integer", ".", "parseInt", "(", "digits", ".", "next", "(", ")", ".", "getText", "(", ")", ")", ";", "}", "}", "else", "{", "// No quantity of dice defined", "// Defaults to 1", "quantity", "=", "1", ";", "}", "sides", "=", "Integer", ".", "parseInt", "(", "digits", ".", "next", "(", ")", ".", "getText", "(", ")", ")", ";", "// Creates the dice", "dice", "=", "new", "DefaultDice", "(", "quantity", ",", "sides", ")", ";", "return", "new", "DefaultDiceOperand", "(", "dice", ")", ";", "}" ]
Creates a dice operand from the parsed context data. <p> If the dice is being subtracted then the sign of the dice set is reversed. @param ctx parsed context @return a dice operand
[ "Creates", "a", "dice", "operand", "from", "the", "parsed", "context", "data", ".", "<p", ">", "If", "the", "dice", "is", "being", "subtracted", "then", "the", "sign", "of", "the", "dice", "set", "is", "reversed", "." ]
train
https://github.com/Bernardo-MG/dice-notation-java/blob/fdba6a6eb7ff35740399f2694a58514a383dad88/src/main/java/com/bernardomg/tabletop/dice/parser/listener/DefaultDiceExpressionBuilder.java#L243-L271
apache/flink
flink-core/src/main/java/org/apache/flink/util/NetUtils.java
NetUtils.unresolvedHostToNormalizedString
public static String unresolvedHostToNormalizedString(String host) { // Return loopback interface address if host is null // This represents the behavior of {@code InetAddress.getByName } and RFC 3330 if (host == null) { host = InetAddress.getLoopbackAddress().getHostAddress(); } else { host = host.trim().toLowerCase(); } // normalize and valid address if (IPAddressUtil.isIPv6LiteralAddress(host)) { byte[] ipV6Address = IPAddressUtil.textToNumericFormatV6(host); host = getIPv6UrlRepresentation(ipV6Address); } else if (!IPAddressUtil.isIPv4LiteralAddress(host)) { try { // We don't allow these in hostnames Preconditions.checkArgument(!host.startsWith(".")); Preconditions.checkArgument(!host.endsWith(".")); Preconditions.checkArgument(!host.contains(":")); } catch (Exception e) { throw new IllegalConfigurationException("The configured hostname is not valid", e); } } return host; }
java
public static String unresolvedHostToNormalizedString(String host) { // Return loopback interface address if host is null // This represents the behavior of {@code InetAddress.getByName } and RFC 3330 if (host == null) { host = InetAddress.getLoopbackAddress().getHostAddress(); } else { host = host.trim().toLowerCase(); } // normalize and valid address if (IPAddressUtil.isIPv6LiteralAddress(host)) { byte[] ipV6Address = IPAddressUtil.textToNumericFormatV6(host); host = getIPv6UrlRepresentation(ipV6Address); } else if (!IPAddressUtil.isIPv4LiteralAddress(host)) { try { // We don't allow these in hostnames Preconditions.checkArgument(!host.startsWith(".")); Preconditions.checkArgument(!host.endsWith(".")); Preconditions.checkArgument(!host.contains(":")); } catch (Exception e) { throw new IllegalConfigurationException("The configured hostname is not valid", e); } } return host; }
[ "public", "static", "String", "unresolvedHostToNormalizedString", "(", "String", "host", ")", "{", "// Return loopback interface address if host is null", "// This represents the behavior of {@code InetAddress.getByName } and RFC 3330", "if", "(", "host", "==", "null", ")", "{", "host", "=", "InetAddress", ".", "getLoopbackAddress", "(", ")", ".", "getHostAddress", "(", ")", ";", "}", "else", "{", "host", "=", "host", ".", "trim", "(", ")", ".", "toLowerCase", "(", ")", ";", "}", "// normalize and valid address", "if", "(", "IPAddressUtil", ".", "isIPv6LiteralAddress", "(", "host", ")", ")", "{", "byte", "[", "]", "ipV6Address", "=", "IPAddressUtil", ".", "textToNumericFormatV6", "(", "host", ")", ";", "host", "=", "getIPv6UrlRepresentation", "(", "ipV6Address", ")", ";", "}", "else", "if", "(", "!", "IPAddressUtil", ".", "isIPv4LiteralAddress", "(", "host", ")", ")", "{", "try", "{", "// We don't allow these in hostnames", "Preconditions", ".", "checkArgument", "(", "!", "host", ".", "startsWith", "(", "\".\"", ")", ")", ";", "Preconditions", ".", "checkArgument", "(", "!", "host", ".", "endsWith", "(", "\".\"", ")", ")", ";", "Preconditions", ".", "checkArgument", "(", "!", "host", ".", "contains", "(", "\":\"", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalConfigurationException", "(", "\"The configured hostname is not valid\"", ",", "e", ")", ";", "}", "}", "return", "host", ";", "}" ]
Returns an address in a normalized format for Akka. When an IPv6 address is specified, it normalizes the IPv6 address to avoid complications with the exact URL match policy of Akka. @param host The hostname, IPv4 or IPv6 address @return host which will be normalized if it is an IPv6 address
[ "Returns", "an", "address", "in", "a", "normalized", "format", "for", "Akka", ".", "When", "an", "IPv6", "address", "is", "specified", "it", "normalizes", "the", "IPv6", "address", "to", "avoid", "complications", "with", "the", "exact", "URL", "match", "policy", "of", "Akka", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/NetUtils.java#L130-L155
QSFT/Doradus
doradus-dynamodb/src/main/java/com/dell/doradus/db/dynamodb/DynamoDBService.java
DynamoDBService.deleteRow
void deleteRow(String storeName, Map<String, AttributeValue> key) { String tableName = storeToTableName(storeName); m_logger.debug("Deleting row from table {}, key={}", tableName, DynamoDBService.getDDBKey(key)); Timer timer = new Timer(); boolean bSuccess = false; for (int attempts = 1; !bSuccess; attempts++) { try { m_ddbClient.deleteItem(tableName, key); if (attempts > 1) { m_logger.info("deleteRow() succeeded on attempt #{}", attempts); } bSuccess = true; m_logger.debug("Time to delete table {}, key={}: {}", new Object[]{tableName, DynamoDBService.getDDBKey(key), timer.toString()}); } catch (ProvisionedThroughputExceededException e) { if (attempts >= m_max_commit_attempts) { String errMsg = "All retries exceeded; abandoning deleteRow() for table: " + tableName; m_logger.error(errMsg, e); throw new RuntimeException(errMsg, e); } m_logger.warn("deleteRow() attempt #{} failed: {}", attempts, e); try { Thread.sleep(attempts * m_retry_wait_millis); } catch (InterruptedException ex2) { // ignore } } } }
java
void deleteRow(String storeName, Map<String, AttributeValue> key) { String tableName = storeToTableName(storeName); m_logger.debug("Deleting row from table {}, key={}", tableName, DynamoDBService.getDDBKey(key)); Timer timer = new Timer(); boolean bSuccess = false; for (int attempts = 1; !bSuccess; attempts++) { try { m_ddbClient.deleteItem(tableName, key); if (attempts > 1) { m_logger.info("deleteRow() succeeded on attempt #{}", attempts); } bSuccess = true; m_logger.debug("Time to delete table {}, key={}: {}", new Object[]{tableName, DynamoDBService.getDDBKey(key), timer.toString()}); } catch (ProvisionedThroughputExceededException e) { if (attempts >= m_max_commit_attempts) { String errMsg = "All retries exceeded; abandoning deleteRow() for table: " + tableName; m_logger.error(errMsg, e); throw new RuntimeException(errMsg, e); } m_logger.warn("deleteRow() attempt #{} failed: {}", attempts, e); try { Thread.sleep(attempts * m_retry_wait_millis); } catch (InterruptedException ex2) { // ignore } } } }
[ "void", "deleteRow", "(", "String", "storeName", ",", "Map", "<", "String", ",", "AttributeValue", ">", "key", ")", "{", "String", "tableName", "=", "storeToTableName", "(", "storeName", ")", ";", "m_logger", ".", "debug", "(", "\"Deleting row from table {}, key={}\"", ",", "tableName", ",", "DynamoDBService", ".", "getDDBKey", "(", "key", ")", ")", ";", "Timer", "timer", "=", "new", "Timer", "(", ")", ";", "boolean", "bSuccess", "=", "false", ";", "for", "(", "int", "attempts", "=", "1", ";", "!", "bSuccess", ";", "attempts", "++", ")", "{", "try", "{", "m_ddbClient", ".", "deleteItem", "(", "tableName", ",", "key", ")", ";", "if", "(", "attempts", ">", "1", ")", "{", "m_logger", ".", "info", "(", "\"deleteRow() succeeded on attempt #{}\"", ",", "attempts", ")", ";", "}", "bSuccess", "=", "true", ";", "m_logger", ".", "debug", "(", "\"Time to delete table {}, key={}: {}\"", ",", "new", "Object", "[", "]", "{", "tableName", ",", "DynamoDBService", ".", "getDDBKey", "(", "key", ")", ",", "timer", ".", "toString", "(", ")", "}", ")", ";", "}", "catch", "(", "ProvisionedThroughputExceededException", "e", ")", "{", "if", "(", "attempts", ">=", "m_max_commit_attempts", ")", "{", "String", "errMsg", "=", "\"All retries exceeded; abandoning deleteRow() for table: \"", "+", "tableName", ";", "m_logger", ".", "error", "(", "errMsg", ",", "e", ")", ";", "throw", "new", "RuntimeException", "(", "errMsg", ",", "e", ")", ";", "}", "m_logger", ".", "warn", "(", "\"deleteRow() attempt #{} failed: {}\"", ",", "attempts", ",", "e", ")", ";", "try", "{", "Thread", ".", "sleep", "(", "attempts", "*", "m_retry_wait_millis", ")", ";", "}", "catch", "(", "InterruptedException", "ex2", ")", "{", "// ignore", "}", "}", "}", "}" ]
Delete row and back off if ProvisionedThroughputExceededException occurs.
[ "Delete", "row", "and", "back", "off", "if", "ProvisionedThroughputExceededException", "occurs", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-dynamodb/src/main/java/com/dell/doradus/db/dynamodb/DynamoDBService.java#L283-L312
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.generateMapFile
public void generateMapFile(File jarFile, String mapFileName, boolean mapClassMethods) throws XMLStreamException, IOException, ClassNotFoundException, IntrospectionException { m_responseList = new LinkedList<String>(); writeMapFile(mapFileName, jarFile, mapClassMethods); }
java
public void generateMapFile(File jarFile, String mapFileName, boolean mapClassMethods) throws XMLStreamException, IOException, ClassNotFoundException, IntrospectionException { m_responseList = new LinkedList<String>(); writeMapFile(mapFileName, jarFile, mapClassMethods); }
[ "public", "void", "generateMapFile", "(", "File", "jarFile", ",", "String", "mapFileName", ",", "boolean", "mapClassMethods", ")", "throws", "XMLStreamException", ",", "IOException", ",", "ClassNotFoundException", ",", "IntrospectionException", "{", "m_responseList", "=", "new", "LinkedList", "<", "String", ">", "(", ")", ";", "writeMapFile", "(", "mapFileName", ",", "jarFile", ",", "mapClassMethods", ")", ";", "}" ]
Generate a map file from a jar file. @param jarFile jar file @param mapFileName map file name @param mapClassMethods true if we want to produce .Net style class method names @throws XMLStreamException @throws IOException @throws ClassNotFoundException @throws IntrospectionException
[ "Generate", "a", "map", "file", "from", "a", "jar", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L94-L98
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfString.java
PdfString.toPdf
public void toPdf(PdfWriter writer, OutputStream os) throws IOException { byte b[] = getBytes(); PdfEncryption crypto = null; if (writer != null) crypto = writer.getEncryption(); if (crypto != null && !crypto.isEmbeddedFilesOnly()) b = crypto.encryptByteArray(b); if (hexWriting) { ByteBuffer buf = new ByteBuffer(); buf.append('<'); int len = b.length; for (int k = 0; k < len; ++k) buf.appendHex(b[k]); buf.append('>'); os.write(buf.toByteArray()); } else os.write(PdfContentByte.escapeString(b)); }
java
public void toPdf(PdfWriter writer, OutputStream os) throws IOException { byte b[] = getBytes(); PdfEncryption crypto = null; if (writer != null) crypto = writer.getEncryption(); if (crypto != null && !crypto.isEmbeddedFilesOnly()) b = crypto.encryptByteArray(b); if (hexWriting) { ByteBuffer buf = new ByteBuffer(); buf.append('<'); int len = b.length; for (int k = 0; k < len; ++k) buf.appendHex(b[k]); buf.append('>'); os.write(buf.toByteArray()); } else os.write(PdfContentByte.escapeString(b)); }
[ "public", "void", "toPdf", "(", "PdfWriter", "writer", ",", "OutputStream", "os", ")", "throws", "IOException", "{", "byte", "b", "[", "]", "=", "getBytes", "(", ")", ";", "PdfEncryption", "crypto", "=", "null", ";", "if", "(", "writer", "!=", "null", ")", "crypto", "=", "writer", ".", "getEncryption", "(", ")", ";", "if", "(", "crypto", "!=", "null", "&&", "!", "crypto", ".", "isEmbeddedFilesOnly", "(", ")", ")", "b", "=", "crypto", ".", "encryptByteArray", "(", "b", ")", ";", "if", "(", "hexWriting", ")", "{", "ByteBuffer", "buf", "=", "new", "ByteBuffer", "(", ")", ";", "buf", ".", "append", "(", "'", "'", ")", ";", "int", "len", "=", "b", ".", "length", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "len", ";", "++", "k", ")", "buf", ".", "appendHex", "(", "[", "k", "]", ")", ";", "buf", ".", "append", "(", "'", "'", ")", ";", "os", ".", "write", "(", "buf", ".", "toByteArray", "(", ")", ")", ";", "}", "else", "os", ".", "write", "(", "PdfContentByte", ".", "escapeString", "(", "b", ")", ")", ";", "}" ]
Writes the PDF representation of this <CODE>PdfString</CODE> as an array of <CODE>byte</CODE> to the specified <CODE>OutputStream</CODE>. @param writer for backwards compatibility @param os The <CODE>OutputStream</CODE> to write the bytes to.
[ "Writes", "the", "PDF", "representation", "of", "this", "<CODE", ">", "PdfString<", "/", "CODE", ">", "as", "an", "array", "of", "<CODE", ">", "byte<", "/", "CODE", ">", "to", "the", "specified", "<CODE", ">", "OutputStream<", "/", "CODE", ">", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfString.java#L144-L162
meertensinstituut/mtas
src/main/java/mtas/codec/MtasFieldsProducer.java
MtasFieldsProducer.openMtasFile
private IndexInput openMtasFile(SegmentReadState state, String name, String extension) throws IOException { return openMtasFile(state, name, extension, null, null); }
java
private IndexInput openMtasFile(SegmentReadState state, String name, String extension) throws IOException { return openMtasFile(state, name, extension, null, null); }
[ "private", "IndexInput", "openMtasFile", "(", "SegmentReadState", "state", ",", "String", "name", ",", "String", "extension", ")", "throws", "IOException", "{", "return", "openMtasFile", "(", "state", ",", "name", ",", "extension", ",", "null", ",", "null", ")", ";", "}" ]
Open mtas file. @param state the state @param name the name @param extension the extension @return the index input @throws IOException Signals that an I/O exception has occurred.
[ "Open", "mtas", "file", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/MtasFieldsProducer.java#L279-L282
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetsInner.java
AssetsInner.getEncryptionKeyAsync
public Observable<StorageEncryptedAssetDecryptionDataInner> getEncryptionKeyAsync(String resourceGroupName, String accountName, String assetName) { return getEncryptionKeyWithServiceResponseAsync(resourceGroupName, accountName, assetName).map(new Func1<ServiceResponse<StorageEncryptedAssetDecryptionDataInner>, StorageEncryptedAssetDecryptionDataInner>() { @Override public StorageEncryptedAssetDecryptionDataInner call(ServiceResponse<StorageEncryptedAssetDecryptionDataInner> response) { return response.body(); } }); }
java
public Observable<StorageEncryptedAssetDecryptionDataInner> getEncryptionKeyAsync(String resourceGroupName, String accountName, String assetName) { return getEncryptionKeyWithServiceResponseAsync(resourceGroupName, accountName, assetName).map(new Func1<ServiceResponse<StorageEncryptedAssetDecryptionDataInner>, StorageEncryptedAssetDecryptionDataInner>() { @Override public StorageEncryptedAssetDecryptionDataInner call(ServiceResponse<StorageEncryptedAssetDecryptionDataInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "StorageEncryptedAssetDecryptionDataInner", ">", "getEncryptionKeyAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "assetName", ")", "{", "return", "getEncryptionKeyWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "assetName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "StorageEncryptedAssetDecryptionDataInner", ">", ",", "StorageEncryptedAssetDecryptionDataInner", ">", "(", ")", "{", "@", "Override", "public", "StorageEncryptedAssetDecryptionDataInner", "call", "(", "ServiceResponse", "<", "StorageEncryptedAssetDecryptionDataInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the Asset storage key. Gets the Asset storage encryption keys used to decrypt content created by version 2 of the Media Services API. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param assetName The Asset name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StorageEncryptedAssetDecryptionDataInner object
[ "Gets", "the", "Asset", "storage", "key", ".", "Gets", "the", "Asset", "storage", "encryption", "keys", "used", "to", "decrypt", "content", "created", "by", "version", "2", "of", "the", "Media", "Services", "API", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetsInner.java#L924-L931
square/okhttp
okhttp/src/main/java/okhttp3/internal/Util.java
Util.delimiterOffset
public static int delimiterOffset(String input, int pos, int limit, char delimiter) { for (int i = pos; i < limit; i++) { if (input.charAt(i) == delimiter) return i; } return limit; }
java
public static int delimiterOffset(String input, int pos, int limit, char delimiter) { for (int i = pos; i < limit; i++) { if (input.charAt(i) == delimiter) return i; } return limit; }
[ "public", "static", "int", "delimiterOffset", "(", "String", "input", ",", "int", "pos", ",", "int", "limit", ",", "char", "delimiter", ")", "{", "for", "(", "int", "i", "=", "pos", ";", "i", "<", "limit", ";", "i", "++", ")", "{", "if", "(", "input", ".", "charAt", "(", "i", ")", "==", "delimiter", ")", "return", "i", ";", "}", "return", "limit", ";", "}" ]
Returns the index of the first character in {@code input} that is {@code delimiter}. Returns limit if there is no such character.
[ "Returns", "the", "index", "of", "the", "first", "character", "in", "{" ]
train
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/Util.java#L354-L359
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/EnumUtils.java
EnumUtils.generateBitVector
public static <E extends Enum<E>> long generateBitVector(final Class<E> enumClass, final Iterable<? extends E> values) { checkBitVectorable(enumClass); Validate.notNull(values); long total = 0; for (final E constant : values) { Validate.isTrue(constant != null, NULL_ELEMENTS_NOT_PERMITTED); total |= 1L << constant.ordinal(); } return total; }
java
public static <E extends Enum<E>> long generateBitVector(final Class<E> enumClass, final Iterable<? extends E> values) { checkBitVectorable(enumClass); Validate.notNull(values); long total = 0; for (final E constant : values) { Validate.isTrue(constant != null, NULL_ELEMENTS_NOT_PERMITTED); total |= 1L << constant.ordinal(); } return total; }
[ "public", "static", "<", "E", "extends", "Enum", "<", "E", ">", ">", "long", "generateBitVector", "(", "final", "Class", "<", "E", ">", "enumClass", ",", "final", "Iterable", "<", "?", "extends", "E", ">", "values", ")", "{", "checkBitVectorable", "(", "enumClass", ")", ";", "Validate", ".", "notNull", "(", "values", ")", ";", "long", "total", "=", "0", ";", "for", "(", "final", "E", "constant", ":", "values", ")", "{", "Validate", ".", "isTrue", "(", "constant", "!=", "null", ",", "NULL_ELEMENTS_NOT_PERMITTED", ")", ";", "total", "|=", "1L", "<<", "constant", ".", "ordinal", "(", ")", ";", "}", "return", "total", ";", "}" ]
<p>Creates a long bit vector representation of the given subset of an Enum.</p> <p>This generates a value that is usable by {@link EnumUtils#processBitVector}.</p> <p>Do not use this method if you have more than 64 values in your Enum, as this would create a value greater than a long can hold.</p> @param enumClass the class of the enum we are working with, not {@code null} @param values the values we want to convert, not {@code null}, neither containing {@code null} @param <E> the type of the enumeration @return a long whose value provides a binary representation of the given set of enum values. @throws NullPointerException if {@code enumClass} or {@code values} is {@code null} @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values, or if any {@code values} {@code null} @since 3.0.1 @see #generateBitVectors(Class, Iterable)
[ "<p", ">", "Creates", "a", "long", "bit", "vector", "representation", "of", "the", "given", "subset", "of", "an", "Enum", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/EnumUtils.java#L143-L152
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/codemining/SARLCodeMiningProvider.java
SARLCodeMiningProvider.createImplicitFieldType
private void createImplicitFieldType(XtextResource resource, IAcceptor<? super ICodeMining> acceptor) { createImplicitVarValType(resource, acceptor, XtendField.class, it -> it.getType(), it -> { final JvmField inferredField = (JvmField) this.jvmModelAssocitions.getPrimaryJvmElement(it); if (inferredField == null || inferredField.getType() == null || inferredField.getType().eIsProxy()) { return null; } return inferredField.getType().getSimpleName(); }, null, () -> this.grammar.getAOPMemberAccess().getInitialValueAssignment_2_3_3_1()); }
java
private void createImplicitFieldType(XtextResource resource, IAcceptor<? super ICodeMining> acceptor) { createImplicitVarValType(resource, acceptor, XtendField.class, it -> it.getType(), it -> { final JvmField inferredField = (JvmField) this.jvmModelAssocitions.getPrimaryJvmElement(it); if (inferredField == null || inferredField.getType() == null || inferredField.getType().eIsProxy()) { return null; } return inferredField.getType().getSimpleName(); }, null, () -> this.grammar.getAOPMemberAccess().getInitialValueAssignment_2_3_3_1()); }
[ "private", "void", "createImplicitFieldType", "(", "XtextResource", "resource", ",", "IAcceptor", "<", "?", "super", "ICodeMining", ">", "acceptor", ")", "{", "createImplicitVarValType", "(", "resource", ",", "acceptor", ",", "XtendField", ".", "class", ",", "it", "->", "it", ".", "getType", "(", ")", ",", "it", "->", "{", "final", "JvmField", "inferredField", "=", "(", "JvmField", ")", "this", ".", "jvmModelAssocitions", ".", "getPrimaryJvmElement", "(", "it", ")", ";", "if", "(", "inferredField", "==", "null", "||", "inferredField", ".", "getType", "(", ")", "==", "null", "||", "inferredField", ".", "getType", "(", ")", ".", "eIsProxy", "(", ")", ")", "{", "return", "null", ";", "}", "return", "inferredField", ".", "getType", "(", ")", ".", "getSimpleName", "(", ")", ";", "}", ",", "null", ",", "(", ")", "->", "this", ".", "grammar", ".", "getAOPMemberAccess", "(", ")", ".", "getInitialValueAssignment_2_3_3_1", "(", ")", ")", ";", "}" ]
Add an annotation when the field's type is implicit and inferred by the SARL compiler. @param resource the resource to parse. @param acceptor the code mining acceptor.
[ "Add", "an", "annotation", "when", "the", "field", "s", "type", "is", "implicit", "and", "inferred", "by", "the", "SARL", "compiler", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/codemining/SARLCodeMiningProvider.java#L233-L245
apiman/apiman
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/LocalClientFactory.java
LocalClientFactory.createLocalClient
public JestClient createLocalClient(Map<String, String> config, String indexName, String defaultIndexName) { String clientLocClassName = config.get("client.class"); //$NON-NLS-1$ String clientLocFieldName = config.get("client.field"); //$NON-NLS-1$ return createLocalClient(clientLocClassName, clientLocFieldName, indexName, defaultIndexName); }
java
public JestClient createLocalClient(Map<String, String> config, String indexName, String defaultIndexName) { String clientLocClassName = config.get("client.class"); //$NON-NLS-1$ String clientLocFieldName = config.get("client.field"); //$NON-NLS-1$ return createLocalClient(clientLocClassName, clientLocFieldName, indexName, defaultIndexName); }
[ "public", "JestClient", "createLocalClient", "(", "Map", "<", "String", ",", "String", ">", "config", ",", "String", "indexName", ",", "String", "defaultIndexName", ")", "{", "String", "clientLocClassName", "=", "config", ".", "get", "(", "\"client.class\"", ")", ";", "//$NON-NLS-1$", "String", "clientLocFieldName", "=", "config", ".", "get", "(", "\"client.field\"", ")", ";", "//$NON-NLS-1$", "return", "createLocalClient", "(", "clientLocClassName", ",", "clientLocFieldName", ",", "indexName", ",", "defaultIndexName", ")", ";", "}" ]
Creates a local client from a configuration map. @param config the config from apiman.properties @param indexName the name of the ES index @param defaultIndexName the default ES index name @return the ES client
[ "Creates", "a", "local", "client", "from", "a", "configuration", "map", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/LocalClientFactory.java#L59-L63
RestComm/sip-servlets
sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouter.java
DefaultApplicationRouter.init
public void init() { defaultApplicationRouterParser.init(); try { defaultSipApplicationRouterInfos = defaultApplicationRouterParser.parse(); } catch (ParseException e) { log.fatal("Impossible to parse the default application router configuration file", e); throw new IllegalArgumentException("Impossible to parse the default application router configuration file", e); } }
java
public void init() { defaultApplicationRouterParser.init(); try { defaultSipApplicationRouterInfos = defaultApplicationRouterParser.parse(); } catch (ParseException e) { log.fatal("Impossible to parse the default application router configuration file", e); throw new IllegalArgumentException("Impossible to parse the default application router configuration file", e); } }
[ "public", "void", "init", "(", ")", "{", "defaultApplicationRouterParser", ".", "init", "(", ")", ";", "try", "{", "defaultSipApplicationRouterInfos", "=", "defaultApplicationRouterParser", ".", "parse", "(", ")", ";", "}", "catch", "(", "ParseException", "e", ")", "{", "log", ".", "fatal", "(", "\"Impossible to parse the default application router configuration file\"", ",", "e", ")", ";", "throw", "new", "IllegalArgumentException", "(", "\"Impossible to parse the default application router configuration file\"", ",", "e", ")", ";", "}", "}" ]
load the configuration file as defined in appendix C of JSR289
[ "load", "the", "configuration", "file", "as", "defined", "in", "appendix", "C", "of", "JSR289" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouter.java#L442-L450
javafxports/javafxmobile-plugin
src/main/java/org/javafxports/jfxmobile/plugin/android/task/ApkBuilder.java
ApkBuilder.addZipFile
public void addZipFile(File zipFile) throws ApkCreationException, SealedApkException, DuplicateFileException { if (mIsSealed) { throw new SealedApkException("APK is already sealed"); } try { verbosePrintln("%s:", zipFile); // reset the filter with this input. mNullFilter.reset(zipFile); // ask the builder to add the content of the file. FileInputStream fis = new FileInputStream(zipFile); mBuilder.writeZip(fis, mNullFilter); fis.close(); } catch (DuplicateFileException e) { mBuilder.cleanUp(); throw e; } catch (Exception e) { mBuilder.cleanUp(); throw new ApkCreationException(e, "Failed to add %s", zipFile); } }
java
public void addZipFile(File zipFile) throws ApkCreationException, SealedApkException, DuplicateFileException { if (mIsSealed) { throw new SealedApkException("APK is already sealed"); } try { verbosePrintln("%s:", zipFile); // reset the filter with this input. mNullFilter.reset(zipFile); // ask the builder to add the content of the file. FileInputStream fis = new FileInputStream(zipFile); mBuilder.writeZip(fis, mNullFilter); fis.close(); } catch (DuplicateFileException e) { mBuilder.cleanUp(); throw e; } catch (Exception e) { mBuilder.cleanUp(); throw new ApkCreationException(e, "Failed to add %s", zipFile); } }
[ "public", "void", "addZipFile", "(", "File", "zipFile", ")", "throws", "ApkCreationException", ",", "SealedApkException", ",", "DuplicateFileException", "{", "if", "(", "mIsSealed", ")", "{", "throw", "new", "SealedApkException", "(", "\"APK is already sealed\"", ")", ";", "}", "try", "{", "verbosePrintln", "(", "\"%s:\"", ",", "zipFile", ")", ";", "// reset the filter with this input.", "mNullFilter", ".", "reset", "(", "zipFile", ")", ";", "// ask the builder to add the content of the file.", "FileInputStream", "fis", "=", "new", "FileInputStream", "(", "zipFile", ")", ";", "mBuilder", ".", "writeZip", "(", "fis", ",", "mNullFilter", ")", ";", "fis", ".", "close", "(", ")", ";", "}", "catch", "(", "DuplicateFileException", "e", ")", "{", "mBuilder", ".", "cleanUp", "(", ")", ";", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "mBuilder", ".", "cleanUp", "(", ")", ";", "throw", "new", "ApkCreationException", "(", "e", ",", "\"Failed to add %s\"", ",", "zipFile", ")", ";", "}", "}" ]
Adds the content from a zip file. All file keep the same path inside the archive. @param zipFile the zip File. @throws ApkCreationException if an error occurred @throws SealedApkException if the APK is already sealed. @throws DuplicateFileException if a file conflicts with another already added to the APK at the same location inside the APK archive.
[ "Adds", "the", "content", "from", "a", "zip", "file", ".", "All", "file", "keep", "the", "same", "path", "inside", "the", "archive", "." ]
train
https://github.com/javafxports/javafxmobile-plugin/blob/a9bef513b7e1bfa85f9a668226e6943c6d9f847f/src/main/java/org/javafxports/jfxmobile/plugin/android/task/ApkBuilder.java#L579-L602
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PKeyArea.java
PKeyArea.doSeek
public BaseBuffer doSeek(String strSeekSign, FieldTable table, KeyAreaInfo keyArea) throws DBException { return null; }
java
public BaseBuffer doSeek(String strSeekSign, FieldTable table, KeyAreaInfo keyArea) throws DBException { return null; }
[ "public", "BaseBuffer", "doSeek", "(", "String", "strSeekSign", ",", "FieldTable", "table", ",", "KeyAreaInfo", "keyArea", ")", "throws", "DBException", "{", "return", "null", ";", "}" ]
Read the record that matches this record's temp key area.<p> WARNING - This method changes the current record's buffer. @param strSeekSign - Seek sign:<p> <pre> "=" - Look for the first match. "==" - Look for an exact match (On non-unique keys, must match primary key also). ">" - Look for the first record greater than this. ">=" - Look for the first record greater than or equal to this. "<" - Look for the first record less than or equal to this. "<=" - Look for the first record less than or equal to this. </pre> returns: success/failure (true/false). @param table The basetable. @param keyArea The key area. @exception DBException File exception.
[ "Read", "the", "record", "that", "matches", "this", "record", "s", "temp", "key", "area", ".", "<p", ">", "WARNING", "-", "This", "method", "changes", "the", "current", "record", "s", "buffer", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PKeyArea.java#L149-L152
vkostyukov/la4j
src/main/java/org/la4j/matrix/RowMajorSparseMatrix.java
RowMajorSparseMatrix.randomSymmetric
public static RowMajorSparseMatrix randomSymmetric(int size, double density, Random random) { return CRSMatrix.randomSymmetric(size, density, random); }
java
public static RowMajorSparseMatrix randomSymmetric(int size, double density, Random random) { return CRSMatrix.randomSymmetric(size, density, random); }
[ "public", "static", "RowMajorSparseMatrix", "randomSymmetric", "(", "int", "size", ",", "double", "density", ",", "Random", "random", ")", "{", "return", "CRSMatrix", ".", "randomSymmetric", "(", "size", ",", "density", ",", "random", ")", ";", "}" ]
Creates a random symmetric {@link RowMajorSparseMatrix} of the given {@code size}.
[ "Creates", "a", "random", "symmetric", "{" ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/RowMajorSparseMatrix.java#L93-L95
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionTypesInner.java
ConnectionTypesInner.listByAutomationAccountAsync
public Observable<Page<ConnectionTypeInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName) { return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName) .map(new Func1<ServiceResponse<Page<ConnectionTypeInner>>, Page<ConnectionTypeInner>>() { @Override public Page<ConnectionTypeInner> call(ServiceResponse<Page<ConnectionTypeInner>> response) { return response.body(); } }); }
java
public Observable<Page<ConnectionTypeInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName) { return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName) .map(new Func1<ServiceResponse<Page<ConnectionTypeInner>>, Page<ConnectionTypeInner>>() { @Override public Page<ConnectionTypeInner> call(ServiceResponse<Page<ConnectionTypeInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "ConnectionTypeInner", ">", ">", "listByAutomationAccountAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "automationAccountName", ")", "{", "return", "listByAutomationAccountWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "ConnectionTypeInner", ">", ">", ",", "Page", "<", "ConnectionTypeInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "ConnectionTypeInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "ConnectionTypeInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Retrieve a list of connectiontypes. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ConnectionTypeInner&gt; object
[ "Retrieve", "a", "list", "of", "connectiontypes", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionTypesInner.java#L418-L426
wcm-io/wcm-io-sling
commons/src/main/java/io/wcm/sling/commons/request/RequestPath.java
RequestPath.hasSelector
public static boolean hasSelector(@NotNull SlingHttpServletRequest request, @NotNull String expectedSelector) { String[] selectors = request.getRequestPathInfo().getSelectors(); return ArrayUtils.contains(selectors, expectedSelector); }
java
public static boolean hasSelector(@NotNull SlingHttpServletRequest request, @NotNull String expectedSelector) { String[] selectors = request.getRequestPathInfo().getSelectors(); return ArrayUtils.contains(selectors, expectedSelector); }
[ "public", "static", "boolean", "hasSelector", "(", "@", "NotNull", "SlingHttpServletRequest", "request", ",", "@", "NotNull", "String", "expectedSelector", ")", "{", "String", "[", "]", "selectors", "=", "request", ".", "getRequestPathInfo", "(", ")", ".", "getSelectors", "(", ")", ";", "return", "ArrayUtils", ".", "contains", "(", "selectors", ",", "expectedSelector", ")", ";", "}" ]
Checks if the given selector is present in the current URL request (at any position). @param request Sling request @param expectedSelector Selector string to check for. @return true if the selector was found
[ "Checks", "if", "the", "given", "selector", "is", "present", "in", "the", "current", "URL", "request", "(", "at", "any", "position", ")", "." ]
train
https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/RequestPath.java#L43-L46
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.leftShift
public static Path leftShift(Path path, InputStream data) throws IOException { append(path, data); return path; }
java
public static Path leftShift(Path path, InputStream data) throws IOException { append(path, data); return path; }
[ "public", "static", "Path", "leftShift", "(", "Path", "path", ",", "InputStream", "data", ")", "throws", "IOException", "{", "append", "(", "path", ",", "data", ")", ";", "return", "path", ";", "}" ]
Append binary data to the file. See {@link #append(Path, java.io.InputStream)} @param path a Path @param data an InputStream of data to write to the file @return the file @throws java.io.IOException if an IOException occurs. @since 2.3.0
[ "Append", "binary", "data", "to", "the", "file", ".", "See", "{", "@link", "#append", "(", "Path", "java", ".", "io", ".", "InputStream", ")", "}" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L520-L523