repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/ChannelUpgradeHandler.java
ChannelUpgradeHandler.removeProtocol
public synchronized void removeProtocol(String productString, ChannelListener<? super StreamConnection> openListener) { """ Remove a protocol from this handler. @param productString the product string to match @param openListener The open listener """ List<Holder> holders = handlers.get(productString); if (holders == null) { return; } Iterator<Holder> it = holders.iterator(); while (it.hasNext()) { Holder holder = it.next(); if (holder.channelListener == openListener) { holders.remove(holder); break; } } if (holders.isEmpty()) { handlers.remove(productString); } }
java
public synchronized void removeProtocol(String productString, ChannelListener<? super StreamConnection> openListener) { List<Holder> holders = handlers.get(productString); if (holders == null) { return; } Iterator<Holder> it = holders.iterator(); while (it.hasNext()) { Holder holder = it.next(); if (holder.channelListener == openListener) { holders.remove(holder); break; } } if (holders.isEmpty()) { handlers.remove(productString); } }
[ "public", "synchronized", "void", "removeProtocol", "(", "String", "productString", ",", "ChannelListener", "<", "?", "super", "StreamConnection", ">", "openListener", ")", "{", "List", "<", "Holder", ">", "holders", "=", "handlers", ".", "get", "(", "productString", ")", ";", "if", "(", "holders", "==", "null", ")", "{", "return", ";", "}", "Iterator", "<", "Holder", ">", "it", "=", "holders", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Holder", "holder", "=", "it", ".", "next", "(", ")", ";", "if", "(", "holder", ".", "channelListener", "==", "openListener", ")", "{", "holders", ".", "remove", "(", "holder", ")", ";", "break", ";", "}", "}", "if", "(", "holders", ".", "isEmpty", "(", ")", ")", "{", "handlers", ".", "remove", "(", "productString", ")", ";", "}", "}" ]
Remove a protocol from this handler. @param productString the product string to match @param openListener The open listener
[ "Remove", "a", "protocol", "from", "this", "handler", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/ChannelUpgradeHandler.java#L126-L142
rhuss/jolokia
agent/jmx/src/main/java/org/jolokia/jmx/JolokiaMBeanServer.java
JolokiaMBeanServer.toJson
String toJson(Object object, JsonConvertOptions pConvertOptions) { """ Converter used by JsonMBean for converting from Object to JSON representation @param object object to serialize @param pConvertOptions options used for conversion @return serialized object """ try { Object ret = converters.getToJsonConverter().convertToJson(object,null,pConvertOptions); return ret.toString(); } catch (AttributeNotFoundException exp) { // Cannot happen, since we dont use a path return ""; } }
java
String toJson(Object object, JsonConvertOptions pConvertOptions) { try { Object ret = converters.getToJsonConverter().convertToJson(object,null,pConvertOptions); return ret.toString(); } catch (AttributeNotFoundException exp) { // Cannot happen, since we dont use a path return ""; } }
[ "String", "toJson", "(", "Object", "object", ",", "JsonConvertOptions", "pConvertOptions", ")", "{", "try", "{", "Object", "ret", "=", "converters", ".", "getToJsonConverter", "(", ")", ".", "convertToJson", "(", "object", ",", "null", ",", "pConvertOptions", ")", ";", "return", "ret", ".", "toString", "(", ")", ";", "}", "catch", "(", "AttributeNotFoundException", "exp", ")", "{", "// Cannot happen, since we dont use a path", "return", "\"\"", ";", "}", "}" ]
Converter used by JsonMBean for converting from Object to JSON representation @param object object to serialize @param pConvertOptions options used for conversion @return serialized object
[ "Converter", "used", "by", "JsonMBean", "for", "converting", "from", "Object", "to", "JSON", "representation" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jmx/src/main/java/org/jolokia/jmx/JolokiaMBeanServer.java#L149-L157
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/trustregion/UnconMinTrustRegionBFGS_F64.java
UnconMinTrustRegionBFGS_F64.wolfeCondition
protected boolean wolfeCondition( DMatrixRMaj s , DMatrixRMaj y , DMatrixRMaj g_k) { """ Indicates if there's sufficient decrease and curvature. If the Wolfe condition is meet then the Hessian will be positive definite. @param s change in state (new - old) @param y change in gradient (new - old) @param g_k Gradient at step k. @return """ double left = CommonOps_DDRM.dot(y,s); double g_s = CommonOps_DDRM.dot(g_k,s); double right = (c2-1)*g_s; if( left >= right ) { return (fx-f_prev) <= c1*g_s; } return false; }
java
protected boolean wolfeCondition( DMatrixRMaj s , DMatrixRMaj y , DMatrixRMaj g_k) { double left = CommonOps_DDRM.dot(y,s); double g_s = CommonOps_DDRM.dot(g_k,s); double right = (c2-1)*g_s; if( left >= right ) { return (fx-f_prev) <= c1*g_s; } return false; }
[ "protected", "boolean", "wolfeCondition", "(", "DMatrixRMaj", "s", ",", "DMatrixRMaj", "y", ",", "DMatrixRMaj", "g_k", ")", "{", "double", "left", "=", "CommonOps_DDRM", ".", "dot", "(", "y", ",", "s", ")", ";", "double", "g_s", "=", "CommonOps_DDRM", ".", "dot", "(", "g_k", ",", "s", ")", ";", "double", "right", "=", "(", "c2", "-", "1", ")", "*", "g_s", ";", "if", "(", "left", ">=", "right", ")", "{", "return", "(", "fx", "-", "f_prev", ")", "<=", "c1", "*", "g_s", ";", "}", "return", "false", ";", "}" ]
Indicates if there's sufficient decrease and curvature. If the Wolfe condition is meet then the Hessian will be positive definite. @param s change in state (new - old) @param y change in gradient (new - old) @param g_k Gradient at step k. @return
[ "Indicates", "if", "there", "s", "sufficient", "decrease", "and", "curvature", ".", "If", "the", "Wolfe", "condition", "is", "meet", "then", "the", "Hessian", "will", "be", "positive", "definite", "." ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/trustregion/UnconMinTrustRegionBFGS_F64.java#L139-L147
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PeopleApi.java
PeopleApi.getInfo
public Person getInfo(String userId, boolean sign) throws JinxException { """ Get information about a user. <br> This method does not require authentication. @param userId (Required) The user id of the user to fetch information about. @param sign if true, the request will be signed. @return object with information about the user. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.people.getInfo.html">flickr.people.getInfo</a> """ JinxUtils.validateParams(userId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.people.getInfo"); params.put("user_id", userId); return jinx.flickrGet(params, Person.class, sign); }
java
public Person getInfo(String userId, boolean sign) throws JinxException { JinxUtils.validateParams(userId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.people.getInfo"); params.put("user_id", userId); return jinx.flickrGet(params, Person.class, sign); }
[ "public", "Person", "getInfo", "(", "String", "userId", ",", "boolean", "sign", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "userId", ")", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "TreeMap", "<>", "(", ")", ";", "params", ".", "put", "(", "\"method\"", ",", "\"flickr.people.getInfo\"", ")", ";", "params", ".", "put", "(", "\"user_id\"", ",", "userId", ")", ";", "return", "jinx", ".", "flickrGet", "(", "params", ",", "Person", ".", "class", ",", "sign", ")", ";", "}" ]
Get information about a user. <br> This method does not require authentication. @param userId (Required) The user id of the user to fetch information about. @param sign if true, the request will be signed. @return object with information about the user. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.people.getInfo.html">flickr.people.getInfo</a>
[ "Get", "information", "about", "a", "user", ".", "<br", ">", "This", "method", "does", "not", "require", "authentication", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PeopleApi.java#L125-L131
johncarl81/transfuse
transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java
InjectionPointFactory.buildInjectionPoint
public FieldInjectionPoint buildInjectionPoint(ASTType rootContainingType, ASTType containingType, ASTField astField, AnalysisContext context) { """ Build a Field InjectionPoint from the given ASTField @param containingType @param astField required ASTField @param context analysis context @return FieldInjectionPoint """ return new FieldInjectionPoint(rootContainingType, containingType, astField, buildInjectionNode(astField.getAnnotations(), astField, astField.getASTType(), context)); }
java
public FieldInjectionPoint buildInjectionPoint(ASTType rootContainingType, ASTType containingType, ASTField astField, AnalysisContext context) { return new FieldInjectionPoint(rootContainingType, containingType, astField, buildInjectionNode(astField.getAnnotations(), astField, astField.getASTType(), context)); }
[ "public", "FieldInjectionPoint", "buildInjectionPoint", "(", "ASTType", "rootContainingType", ",", "ASTType", "containingType", ",", "ASTField", "astField", ",", "AnalysisContext", "context", ")", "{", "return", "new", "FieldInjectionPoint", "(", "rootContainingType", ",", "containingType", ",", "astField", ",", "buildInjectionNode", "(", "astField", ".", "getAnnotations", "(", ")", ",", "astField", ",", "astField", ".", "getASTType", "(", ")", ",", "context", ")", ")", ";", "}" ]
Build a Field InjectionPoint from the given ASTField @param containingType @param astField required ASTField @param context analysis context @return FieldInjectionPoint
[ "Build", "a", "Field", "InjectionPoint", "from", "the", "given", "ASTField" ]
train
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java#L126-L128
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationProcessor.java
OperationProcessor.processOperation
private void processOperation(CompletableOperation operation) throws Exception { """ Processes a single operation. Steps: <ol> <li> Pre-processes operation (in MetadataUpdater). <li> Assigns Sequence Number. <li> Appends to DataFrameBuilder. <li> Accepts operation in MetadataUpdater. </ol> @param operation The operation to process. @throws Exception If an exception occurred while processing this operation. Depending on the type of the exception, this could be due to the operation itself being invalid, or because we are unable to process any more operations. """ Preconditions.checkState(!operation.isDone(), "The Operation has already been processed."); Operation entry = operation.getOperation(); synchronized (this.stateLock) { // Update Metadata and Operations with any missing data (offsets, lengths, etc) - the Metadata Updater // has all the knowledge for that task. this.metadataUpdater.preProcessOperation(entry); // Entry is ready to be serialized; assign a sequence number. entry.setSequenceNumber(this.metadataUpdater.nextOperationSequenceNumber()); this.dataFrameBuilder.append(entry); this.metadataUpdater.acceptOperation(entry); } log.trace("{}: DataFrameBuilder.Append {}.", this.traceObjectId, entry); }
java
private void processOperation(CompletableOperation operation) throws Exception { Preconditions.checkState(!operation.isDone(), "The Operation has already been processed."); Operation entry = operation.getOperation(); synchronized (this.stateLock) { // Update Metadata and Operations with any missing data (offsets, lengths, etc) - the Metadata Updater // has all the knowledge for that task. this.metadataUpdater.preProcessOperation(entry); // Entry is ready to be serialized; assign a sequence number. entry.setSequenceNumber(this.metadataUpdater.nextOperationSequenceNumber()); this.dataFrameBuilder.append(entry); this.metadataUpdater.acceptOperation(entry); } log.trace("{}: DataFrameBuilder.Append {}.", this.traceObjectId, entry); }
[ "private", "void", "processOperation", "(", "CompletableOperation", "operation", ")", "throws", "Exception", "{", "Preconditions", ".", "checkState", "(", "!", "operation", ".", "isDone", "(", ")", ",", "\"The Operation has already been processed.\"", ")", ";", "Operation", "entry", "=", "operation", ".", "getOperation", "(", ")", ";", "synchronized", "(", "this", ".", "stateLock", ")", "{", "// Update Metadata and Operations with any missing data (offsets, lengths, etc) - the Metadata Updater", "// has all the knowledge for that task.", "this", ".", "metadataUpdater", ".", "preProcessOperation", "(", "entry", ")", ";", "// Entry is ready to be serialized; assign a sequence number.", "entry", ".", "setSequenceNumber", "(", "this", ".", "metadataUpdater", ".", "nextOperationSequenceNumber", "(", ")", ")", ";", "this", ".", "dataFrameBuilder", ".", "append", "(", "entry", ")", ";", "this", ".", "metadataUpdater", ".", "acceptOperation", "(", "entry", ")", ";", "}", "log", ".", "trace", "(", "\"{}: DataFrameBuilder.Append {}.\"", ",", "this", ".", "traceObjectId", ",", "entry", ")", ";", "}" ]
Processes a single operation. Steps: <ol> <li> Pre-processes operation (in MetadataUpdater). <li> Assigns Sequence Number. <li> Appends to DataFrameBuilder. <li> Accepts operation in MetadataUpdater. </ol> @param operation The operation to process. @throws Exception If an exception occurred while processing this operation. Depending on the type of the exception, this could be due to the operation itself being invalid, or because we are unable to process any more operations.
[ "Processes", "a", "single", "operation", ".", "Steps", ":", "<ol", ">", "<li", ">", "Pre", "-", "processes", "operation", "(", "in", "MetadataUpdater", ")", ".", "<li", ">", "Assigns", "Sequence", "Number", ".", "<li", ">", "Appends", "to", "DataFrameBuilder", ".", "<li", ">", "Accepts", "operation", "in", "MetadataUpdater", ".", "<", "/", "ol", ">" ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationProcessor.java#L351-L367
Whiley/WhileyCompiler
src/main/java/wyil/type/binding/RelaxedTypeResolver.java
RelaxedTypeResolver.selectCallableCandidate
private Binding selectCallableCandidate(Name name, List<Binding> candidates, LifetimeRelation lifetimes) { """ Given a list of candidate function or method declarations, determine the most precise match for the supplied argument types. The given argument types must be applicable to this function or macro declaration, and it must be a subtype of all other applicable candidates. @param candidates @param args @return """ Binding best = null; Type.Callable bestType = null; boolean bestValidWinner = false; // for (int i = 0; i != candidates.size(); ++i) { Binding candidate = candidates.get(i); Type.Callable candidateType = candidate.getConcreteType(); if (best == null) { // No other candidates are applicable so far. Hence, this // one is automatically promoted to the best seen so far. best = candidate; bestType = candidateType; bestValidWinner = true; } else { boolean csubb = isSubtype(bestType, candidateType, lifetimes); boolean bsubc = isSubtype(candidateType, bestType, lifetimes); // if (csubb && !bsubc) { // This candidate is a subtype of the best seen so far. Hence, it is now the // best seen so far. best = candidate; bestType = candidate.getConcreteType(); bestValidWinner = true; } else if (bsubc && !csubb) { // This best so far is a subtype of this candidate. Therefore, we can simply // discard this candidate from consideration since it's definitely not the best. } else if (!csubb && !bsubc) { // This is the awkward case. Neither the best so far, nor the candidate, are // subtypes of each other. In this case, we report an error. NOTE: must perform // an explicit equality check above due to the present of type invariants. // Specifically, without this check, the system will treat two declarations with // identical raw types (though non-identical actual types) as the same. return null; } else { // This is a tricky case. We have two types after instantiation which are // considered identical under the raw subtype test. As such, they may not be // actually identical (e.g. if one has a type invariant). Furthermore, we cannot // stop at this stage as, in principle, we could still find an outright winner. bestValidWinner = false; } } } return bestValidWinner ? best : null; }
java
private Binding selectCallableCandidate(Name name, List<Binding> candidates, LifetimeRelation lifetimes) { Binding best = null; Type.Callable bestType = null; boolean bestValidWinner = false; // for (int i = 0; i != candidates.size(); ++i) { Binding candidate = candidates.get(i); Type.Callable candidateType = candidate.getConcreteType(); if (best == null) { // No other candidates are applicable so far. Hence, this // one is automatically promoted to the best seen so far. best = candidate; bestType = candidateType; bestValidWinner = true; } else { boolean csubb = isSubtype(bestType, candidateType, lifetimes); boolean bsubc = isSubtype(candidateType, bestType, lifetimes); // if (csubb && !bsubc) { // This candidate is a subtype of the best seen so far. Hence, it is now the // best seen so far. best = candidate; bestType = candidate.getConcreteType(); bestValidWinner = true; } else if (bsubc && !csubb) { // This best so far is a subtype of this candidate. Therefore, we can simply // discard this candidate from consideration since it's definitely not the best. } else if (!csubb && !bsubc) { // This is the awkward case. Neither the best so far, nor the candidate, are // subtypes of each other. In this case, we report an error. NOTE: must perform // an explicit equality check above due to the present of type invariants. // Specifically, without this check, the system will treat two declarations with // identical raw types (though non-identical actual types) as the same. return null; } else { // This is a tricky case. We have two types after instantiation which are // considered identical under the raw subtype test. As such, they may not be // actually identical (e.g. if one has a type invariant). Furthermore, we cannot // stop at this stage as, in principle, we could still find an outright winner. bestValidWinner = false; } } } return bestValidWinner ? best : null; }
[ "private", "Binding", "selectCallableCandidate", "(", "Name", "name", ",", "List", "<", "Binding", ">", "candidates", ",", "LifetimeRelation", "lifetimes", ")", "{", "Binding", "best", "=", "null", ";", "Type", ".", "Callable", "bestType", "=", "null", ";", "boolean", "bestValidWinner", "=", "false", ";", "//", "for", "(", "int", "i", "=", "0", ";", "i", "!=", "candidates", ".", "size", "(", ")", ";", "++", "i", ")", "{", "Binding", "candidate", "=", "candidates", ".", "get", "(", "i", ")", ";", "Type", ".", "Callable", "candidateType", "=", "candidate", ".", "getConcreteType", "(", ")", ";", "if", "(", "best", "==", "null", ")", "{", "// No other candidates are applicable so far. Hence, this", "// one is automatically promoted to the best seen so far.", "best", "=", "candidate", ";", "bestType", "=", "candidateType", ";", "bestValidWinner", "=", "true", ";", "}", "else", "{", "boolean", "csubb", "=", "isSubtype", "(", "bestType", ",", "candidateType", ",", "lifetimes", ")", ";", "boolean", "bsubc", "=", "isSubtype", "(", "candidateType", ",", "bestType", ",", "lifetimes", ")", ";", "//", "if", "(", "csubb", "&&", "!", "bsubc", ")", "{", "// This candidate is a subtype of the best seen so far. Hence, it is now the", "// best seen so far.", "best", "=", "candidate", ";", "bestType", "=", "candidate", ".", "getConcreteType", "(", ")", ";", "bestValidWinner", "=", "true", ";", "}", "else", "if", "(", "bsubc", "&&", "!", "csubb", ")", "{", "// This best so far is a subtype of this candidate. Therefore, we can simply", "// discard this candidate from consideration since it's definitely not the best.", "}", "else", "if", "(", "!", "csubb", "&&", "!", "bsubc", ")", "{", "// This is the awkward case. Neither the best so far, nor the candidate, are", "// subtypes of each other. In this case, we report an error. NOTE: must perform", "// an explicit equality check above due to the present of type invariants.", "// Specifically, without this check, the system will treat two declarations with", "// identical raw types (though non-identical actual types) as the same.", "return", "null", ";", "}", "else", "{", "// This is a tricky case. We have two types after instantiation which are", "// considered identical under the raw subtype test. As such, they may not be", "// actually identical (e.g. if one has a type invariant). Furthermore, we cannot", "// stop at this stage as, in principle, we could still find an outright winner.", "bestValidWinner", "=", "false", ";", "}", "}", "}", "return", "bestValidWinner", "?", "best", ":", "null", ";", "}" ]
Given a list of candidate function or method declarations, determine the most precise match for the supplied argument types. The given argument types must be applicable to this function or macro declaration, and it must be a subtype of all other applicable candidates. @param candidates @param args @return
[ "Given", "a", "list", "of", "candidate", "function", "or", "method", "declarations", "determine", "the", "most", "precise", "match", "for", "the", "supplied", "argument", "types", ".", "The", "given", "argument", "types", "must", "be", "applicable", "to", "this", "function", "or", "macro", "declaration", "and", "it", "must", "be", "a", "subtype", "of", "all", "other", "applicable", "candidates", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/type/binding/RelaxedTypeResolver.java#L507-L551
flow/nbt
src/main/java/com/flowpowered/nbt/util/NBTMapper.java
NBTMapper.toTagValue
public static <T, U extends T> T toTagValue(Tag<?> t, Class<? extends T> clazz, U defaultValue) { """ Takes in an NBT tag, sanely checks null status, and then returns it value. This method will return null if the value cannot be cast to the default value. @param t Tag to get the value from @param defaultValue the value to return if the tag or its value is null or the value cannot be cast @return the value as an onbject of the same type as the default value, or the default value """ Object o = toTagValue(t); if (o == null) { return defaultValue; } try { T value = clazz.cast(o); return value; } catch (ClassCastException e) { return defaultValue; } }
java
public static <T, U extends T> T toTagValue(Tag<?> t, Class<? extends T> clazz, U defaultValue) { Object o = toTagValue(t); if (o == null) { return defaultValue; } try { T value = clazz.cast(o); return value; } catch (ClassCastException e) { return defaultValue; } }
[ "public", "static", "<", "T", ",", "U", "extends", "T", ">", "T", "toTagValue", "(", "Tag", "<", "?", ">", "t", ",", "Class", "<", "?", "extends", "T", ">", "clazz", ",", "U", "defaultValue", ")", "{", "Object", "o", "=", "toTagValue", "(", "t", ")", ";", "if", "(", "o", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "try", "{", "T", "value", "=", "clazz", ".", "cast", "(", "o", ")", ";", "return", "value", ";", "}", "catch", "(", "ClassCastException", "e", ")", "{", "return", "defaultValue", ";", "}", "}" ]
Takes in an NBT tag, sanely checks null status, and then returns it value. This method will return null if the value cannot be cast to the default value. @param t Tag to get the value from @param defaultValue the value to return if the tag or its value is null or the value cannot be cast @return the value as an onbject of the same type as the default value, or the default value
[ "Takes", "in", "an", "NBT", "tag", "sanely", "checks", "null", "status", "and", "then", "returns", "it", "value", ".", "This", "method", "will", "return", "null", "if", "the", "value", "cannot", "be", "cast", "to", "the", "default", "value", "." ]
train
https://github.com/flow/nbt/blob/7a1b6d986e6fbd01862356d47827b8b357349a22/src/main/java/com/flowpowered/nbt/util/NBTMapper.java#L72-L83
loldevs/riotapi
rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java
ThrottledApiHandler.getChampionListDto
public Future<ChampionList> getChampionListDto(String locale, String version, boolean dataById, ChampData champData) { """ <p> Get champion information for all champions </p> This method does not count towards the rate limit @param locale Locale code for returned data @param version Data dragon version for returned data @param dataById If specified as true, the returned data map will use the champions' IDs as the keys. @param champData Additional information to retrieve @return The information for all champions @see <a href=https://developer.riotgames.com/api/methods#!/649/2171>Official API documentation</a> """ return new DummyFuture<>(handler.getChampionListDto(locale, version, dataById, champData)); }
java
public Future<ChampionList> getChampionListDto(String locale, String version, boolean dataById, ChampData champData) { return new DummyFuture<>(handler.getChampionListDto(locale, version, dataById, champData)); }
[ "public", "Future", "<", "ChampionList", ">", "getChampionListDto", "(", "String", "locale", ",", "String", "version", ",", "boolean", "dataById", ",", "ChampData", "champData", ")", "{", "return", "new", "DummyFuture", "<>", "(", "handler", ".", "getChampionListDto", "(", "locale", ",", "version", ",", "dataById", ",", "champData", ")", ")", ";", "}" ]
<p> Get champion information for all champions </p> This method does not count towards the rate limit @param locale Locale code for returned data @param version Data dragon version for returned data @param dataById If specified as true, the returned data map will use the champions' IDs as the keys. @param champData Additional information to retrieve @return The information for all champions @see <a href=https://developer.riotgames.com/api/methods#!/649/2171>Official API documentation</a>
[ "<p", ">", "Get", "champion", "information", "for", "all", "champions", "<", "/", "p", ">", "This", "method", "does", "not", "count", "towards", "the", "rate", "limit" ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L358-L360
apruve/apruve-java
src/main/java/com/apruve/models/Payment.java
Payment.get
public static ApruveResponse<Payment> get(String paymentRequestId, String paymentId) { """ Fetches the Payment with the given ID from Apruve. @see <a href="https://www.apruve.com/doc/developers/rest-api/">https://www.apruve.com/doc/developers/rest-api/</a> @param paymentRequestId The ID of the PaymentRequest that owns the Payment @param paymentId The ID of the Payment @return Payment, or null if not found """ return ApruveClient.getInstance().get( getPaymentsPath(paymentRequestId) + paymentId, Payment.class); }
java
public static ApruveResponse<Payment> get(String paymentRequestId, String paymentId) { return ApruveClient.getInstance().get( getPaymentsPath(paymentRequestId) + paymentId, Payment.class); }
[ "public", "static", "ApruveResponse", "<", "Payment", ">", "get", "(", "String", "paymentRequestId", ",", "String", "paymentId", ")", "{", "return", "ApruveClient", ".", "getInstance", "(", ")", ".", "get", "(", "getPaymentsPath", "(", "paymentRequestId", ")", "+", "paymentId", ",", "Payment", ".", "class", ")", ";", "}" ]
Fetches the Payment with the given ID from Apruve. @see <a href="https://www.apruve.com/doc/developers/rest-api/">https://www.apruve.com/doc/developers/rest-api/</a> @param paymentRequestId The ID of the PaymentRequest that owns the Payment @param paymentId The ID of the Payment @return Payment, or null if not found
[ "Fetches", "the", "Payment", "with", "the", "given", "ID", "from", "Apruve", "." ]
train
https://github.com/apruve/apruve-java/blob/b188d6b17f777823c2e46427847318849978685e/src/main/java/com/apruve/models/Payment.java#L102-L105
jamesagnew/hapi-fhir
hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/CSVReader.java
CSVReader.parseLine
public String[] parseLine() throws IOException, FHIRException { """ Split one line in a CSV file into its rows. Comma's appearing in double quoted strings will not be seen as a separator. @return @throws IOException @throws FHIRException @ """ List<String> res = new ArrayList<String>(); StringBuilder b = new StringBuilder(); boolean inQuote = false; while (inQuote || (peek() != '\r' && peek() != '\n')) { char c = peek(); next(); if (c == '"') inQuote = !inQuote; else if (!inQuote && c == ',') { res.add(b.toString().trim()); b = new StringBuilder(); } else b.append(c); } res.add(b.toString().trim()); while (ready() && (peek() == '\r' || peek() == '\n')) { next(); } String[] r = new String[] {}; r = res.toArray(r); return r; }
java
public String[] parseLine() throws IOException, FHIRException { List<String> res = new ArrayList<String>(); StringBuilder b = new StringBuilder(); boolean inQuote = false; while (inQuote || (peek() != '\r' && peek() != '\n')) { char c = peek(); next(); if (c == '"') inQuote = !inQuote; else if (!inQuote && c == ',') { res.add(b.toString().trim()); b = new StringBuilder(); } else b.append(c); } res.add(b.toString().trim()); while (ready() && (peek() == '\r' || peek() == '\n')) { next(); } String[] r = new String[] {}; r = res.toArray(r); return r; }
[ "public", "String", "[", "]", "parseLine", "(", ")", "throws", "IOException", ",", "FHIRException", "{", "List", "<", "String", ">", "res", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "StringBuilder", "b", "=", "new", "StringBuilder", "(", ")", ";", "boolean", "inQuote", "=", "false", ";", "while", "(", "inQuote", "||", "(", "peek", "(", ")", "!=", "'", "'", "&&", "peek", "(", ")", "!=", "'", "'", ")", ")", "{", "char", "c", "=", "peek", "(", ")", ";", "next", "(", ")", ";", "if", "(", "c", "==", "'", "'", ")", "inQuote", "=", "!", "inQuote", ";", "else", "if", "(", "!", "inQuote", "&&", "c", "==", "'", "'", ")", "{", "res", ".", "add", "(", "b", ".", "toString", "(", ")", ".", "trim", "(", ")", ")", ";", "b", "=", "new", "StringBuilder", "(", ")", ";", "}", "else", "b", ".", "append", "(", "c", ")", ";", "}", "res", ".", "add", "(", "b", ".", "toString", "(", ")", ".", "trim", "(", ")", ")", ";", "while", "(", "ready", "(", ")", "&&", "(", "peek", "(", ")", "==", "'", "'", "||", "peek", "(", ")", "==", "'", "'", ")", ")", "{", "next", "(", ")", ";", "}", "String", "[", "]", "r", "=", "new", "String", "[", "]", "{", "}", ";", "r", "=", "res", ".", "toArray", "(", "r", ")", ";", "return", "r", ";", "}" ]
Split one line in a CSV file into its rows. Comma's appearing in double quoted strings will not be seen as a separator. @return @throws IOException @throws FHIRException @
[ "Split", "one", "line", "in", "a", "CSV", "file", "into", "its", "rows", ".", "Comma", "s", "appearing", "in", "double", "quoted", "strings", "will", "not", "be", "seen", "as", "a", "separator", "." ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/CSVReader.java#L119-L145
javagl/CommonUI
src/main/java/de/javagl/common/ui/JTrees.java
JTrees.getParent
public static Object getParent(TreeModel treeModel, Object node) { """ Returns the parent of the given node in the given tree model. This parent may be <code>null</code>, if the given node is the root node (or not contained in the tree model at all). @param treeModel The tree model @param node The node @return The parent """ return getParent(treeModel, node, treeModel.getRoot()); }
java
public static Object getParent(TreeModel treeModel, Object node) { return getParent(treeModel, node, treeModel.getRoot()); }
[ "public", "static", "Object", "getParent", "(", "TreeModel", "treeModel", ",", "Object", "node", ")", "{", "return", "getParent", "(", "treeModel", ",", "node", ",", "treeModel", ".", "getRoot", "(", ")", ")", ";", "}" ]
Returns the parent of the given node in the given tree model. This parent may be <code>null</code>, if the given node is the root node (or not contained in the tree model at all). @param treeModel The tree model @param node The node @return The parent
[ "Returns", "the", "parent", "of", "the", "given", "node", "in", "the", "given", "tree", "model", ".", "This", "parent", "may", "be", "<code", ">", "null<", "/", "code", ">", "if", "the", "given", "node", "is", "the", "root", "node", "(", "or", "not", "contained", "in", "the", "tree", "model", "at", "all", ")", "." ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/JTrees.java#L286-L289
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java
SphereUtil.haversineFormulaRad
@Reference(authors = "R. W. Sinnott", // title = "Virtues of the Haversine", // booktitle = "Sky and Telescope 68(2)", // bibkey = "journals/skytelesc/Sinnott84") public static double haversineFormulaRad(double lat1, double lon1, double lat2, double lon2) { """ Compute the approximate great-circle distance of two points using the Haversine formula <p> Complexity: 5 trigonometric functions, 1-2 sqrt. <p> Reference: <p> R. W. Sinnott,<br> Virtues of the Haversine<br> Sky and Telescope 68(2) @param lat1 Latitude of first point in degree @param lon1 Longitude of first point in degree @param lat2 Latitude of second point in degree @param lon2 Longitude of second point in degree @return Distance on unit sphere """ if(lat1 == lat2 && lon1 == lon2) { return 0.; } // Haversine formula, higher precision at < 1 meters but maybe issues at // antipodal points with asin, atan2 is supposedly better (but slower). final double slat = sin((lat1 - lat2) * .5), slon = sin((lon1 - lon2) * .5); double a = slat * slat + slon * slon * cos(lat1) * cos(lat2); return a < .9 ? 2 * asin(sqrt(a)) : a < 1 ? 2 * atan2(sqrt(a), sqrt(1 - a)) : Math.PI; }
java
@Reference(authors = "R. W. Sinnott", // title = "Virtues of the Haversine", // booktitle = "Sky and Telescope 68(2)", // bibkey = "journals/skytelesc/Sinnott84") public static double haversineFormulaRad(double lat1, double lon1, double lat2, double lon2) { if(lat1 == lat2 && lon1 == lon2) { return 0.; } // Haversine formula, higher precision at < 1 meters but maybe issues at // antipodal points with asin, atan2 is supposedly better (but slower). final double slat = sin((lat1 - lat2) * .5), slon = sin((lon1 - lon2) * .5); double a = slat * slat + slon * slon * cos(lat1) * cos(lat2); return a < .9 ? 2 * asin(sqrt(a)) : a < 1 ? 2 * atan2(sqrt(a), sqrt(1 - a)) : Math.PI; }
[ "@", "Reference", "(", "authors", "=", "\"R. W. Sinnott\"", ",", "//", "title", "=", "\"Virtues of the Haversine\"", ",", "//", "booktitle", "=", "\"Sky and Telescope 68(2)\"", ",", "//", "bibkey", "=", "\"journals/skytelesc/Sinnott84\"", ")", "public", "static", "double", "haversineFormulaRad", "(", "double", "lat1", ",", "double", "lon1", ",", "double", "lat2", ",", "double", "lon2", ")", "{", "if", "(", "lat1", "==", "lat2", "&&", "lon1", "==", "lon2", ")", "{", "return", "0.", ";", "}", "// Haversine formula, higher precision at < 1 meters but maybe issues at", "// antipodal points with asin, atan2 is supposedly better (but slower).", "final", "double", "slat", "=", "sin", "(", "(", "lat1", "-", "lat2", ")", "*", ".5", ")", ",", "slon", "=", "sin", "(", "(", "lon1", "-", "lon2", ")", "*", ".5", ")", ";", "double", "a", "=", "slat", "*", "slat", "+", "slon", "*", "slon", "*", "cos", "(", "lat1", ")", "*", "cos", "(", "lat2", ")", ";", "return", "a", "<", ".9", "?", "2", "*", "asin", "(", "sqrt", "(", "a", ")", ")", ":", "a", "<", "1", "?", "2", "*", "atan2", "(", "sqrt", "(", "a", ")", ",", "sqrt", "(", "1", "-", "a", ")", ")", ":", "Math", ".", "PI", ";", "}" ]
Compute the approximate great-circle distance of two points using the Haversine formula <p> Complexity: 5 trigonometric functions, 1-2 sqrt. <p> Reference: <p> R. W. Sinnott,<br> Virtues of the Haversine<br> Sky and Telescope 68(2) @param lat1 Latitude of first point in degree @param lon1 Longitude of first point in degree @param lat2 Latitude of second point in degree @param lon2 Longitude of second point in degree @return Distance on unit sphere
[ "Compute", "the", "approximate", "great", "-", "circle", "distance", "of", "two", "points", "using", "the", "Haversine", "formula", "<p", ">", "Complexity", ":", "5", "trigonometric", "functions", "1", "-", "2", "sqrt", ".", "<p", ">", "Reference", ":", "<p", ">", "R", ".", "W", ".", "Sinnott", "<br", ">", "Virtues", "of", "the", "Haversine<br", ">", "Sky", "and", "Telescope", "68", "(", "2", ")" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java#L174-L187
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java
Agg.percentRankBy
public static <T, U extends Comparable<? super U>> Collector<T, ?, Optional<Double>> percentRankBy(U value, Function<? super T, ? extends U> function) { """ Get a {@link Collector} that calculates the derived <code>PERCENT_RANK()</code> function given natural ordering. """ return percentRankBy(value, function, naturalOrder()); }
java
public static <T, U extends Comparable<? super U>> Collector<T, ?, Optional<Double>> percentRankBy(U value, Function<? super T, ? extends U> function) { return percentRankBy(value, function, naturalOrder()); }
[ "public", "static", "<", "T", ",", "U", "extends", "Comparable", "<", "?", "super", "U", ">", ">", "Collector", "<", "T", ",", "?", ",", "Optional", "<", "Double", ">", ">", "percentRankBy", "(", "U", "value", ",", "Function", "<", "?", "super", "T", ",", "?", "extends", "U", ">", "function", ")", "{", "return", "percentRankBy", "(", "value", ",", "function", ",", "naturalOrder", "(", ")", ")", ";", "}" ]
Get a {@link Collector} that calculates the derived <code>PERCENT_RANK()</code> function given natural ordering.
[ "Get", "a", "{" ]
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java#L761-L763
dadoonet/fscrawler
framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java
FsCrawlerUtil.isIndexable
private static boolean isIndexable(String filename, List<String> includes, List<String> excludes) { """ We check if we can index the file or if we should ignore it @param filename The filename to scan @param includes include rules, may be empty not null @param excludes exclude rules, may be empty not null """ boolean excluded = isExcluded(filename, excludes); if (excluded) return false; return isIncluded(filename, includes); }
java
private static boolean isIndexable(String filename, List<String> includes, List<String> excludes) { boolean excluded = isExcluded(filename, excludes); if (excluded) return false; return isIncluded(filename, includes); }
[ "private", "static", "boolean", "isIndexable", "(", "String", "filename", ",", "List", "<", "String", ">", "includes", ",", "List", "<", "String", ">", "excludes", ")", "{", "boolean", "excluded", "=", "isExcluded", "(", "filename", ",", "excludes", ")", ";", "if", "(", "excluded", ")", "return", "false", ";", "return", "isIncluded", "(", "filename", ",", "includes", ")", ";", "}" ]
We check if we can index the file or if we should ignore it @param filename The filename to scan @param includes include rules, may be empty not null @param excludes exclude rules, may be empty not null
[ "We", "check", "if", "we", "can", "index", "the", "file", "or", "if", "we", "should", "ignore", "it" ]
train
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L165-L170
Alluxio/alluxio
core/common/src/main/java/alluxio/resource/DynamicResourcePool.java
DynamicResourcePool.checkHealthyAndRetry
private T checkHealthyAndRetry(T resource, long endTimeMs) throws TimeoutException, IOException { """ Checks whether the resource is healthy. If not retry. When this called, the resource is not in mAvailableResources. @param resource the resource to check @param endTimeMs the end time to wait till @return the resource @throws TimeoutException if it times out to wait for a resource """ if (isHealthy(resource)) { return resource; } else { LOG.info("Clearing unhealthy resource {}.", resource); remove(resource); closeResource(resource); return acquire(endTimeMs - mClock.millis(), TimeUnit.MILLISECONDS); } }
java
private T checkHealthyAndRetry(T resource, long endTimeMs) throws TimeoutException, IOException { if (isHealthy(resource)) { return resource; } else { LOG.info("Clearing unhealthy resource {}.", resource); remove(resource); closeResource(resource); return acquire(endTimeMs - mClock.millis(), TimeUnit.MILLISECONDS); } }
[ "private", "T", "checkHealthyAndRetry", "(", "T", "resource", ",", "long", "endTimeMs", ")", "throws", "TimeoutException", ",", "IOException", "{", "if", "(", "isHealthy", "(", "resource", ")", ")", "{", "return", "resource", ";", "}", "else", "{", "LOG", ".", "info", "(", "\"Clearing unhealthy resource {}.\"", ",", "resource", ")", ";", "remove", "(", "resource", ")", ";", "closeResource", "(", "resource", ")", ";", "return", "acquire", "(", "endTimeMs", "-", "mClock", ".", "millis", "(", ")", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}", "}" ]
Checks whether the resource is healthy. If not retry. When this called, the resource is not in mAvailableResources. @param resource the resource to check @param endTimeMs the end time to wait till @return the resource @throws TimeoutException if it times out to wait for a resource
[ "Checks", "whether", "the", "resource", "is", "healthy", ".", "If", "not", "retry", ".", "When", "this", "called", "the", "resource", "is", "not", "in", "mAvailableResources", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/resource/DynamicResourcePool.java#L474-L483
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedPriorityQueue.java
DistributedPriorityQueue.putMulti
public void putMulti(MultiItem<T> items, int priority) throws Exception { """ Add a set of items with the same priority into the queue. Adding is done in the background - thus, this method will return quickly.<br><br> NOTE: if an upper bound was set via {@link QueueBuilder#maxItems}, this method will block until there is available space in the queue. @param items items to add @param priority item priority - lower numbers come out of the queue first @throws Exception connection issues """ putMulti(items, priority, 0, null); }
java
public void putMulti(MultiItem<T> items, int priority) throws Exception { putMulti(items, priority, 0, null); }
[ "public", "void", "putMulti", "(", "MultiItem", "<", "T", ">", "items", ",", "int", "priority", ")", "throws", "Exception", "{", "putMulti", "(", "items", ",", "priority", ",", "0", ",", "null", ")", ";", "}" ]
Add a set of items with the same priority into the queue. Adding is done in the background - thus, this method will return quickly.<br><br> NOTE: if an upper bound was set via {@link QueueBuilder#maxItems}, this method will block until there is available space in the queue. @param items items to add @param priority item priority - lower numbers come out of the queue first @throws Exception connection issues
[ "Add", "a", "set", "of", "items", "with", "the", "same", "priority", "into", "the", "queue", ".", "Adding", "is", "done", "in", "the", "background", "-", "thus", "this", "method", "will", "return", "quickly", ".", "<br", ">", "<br", ">", "NOTE", ":", "if", "an", "upper", "bound", "was", "set", "via", "{", "@link", "QueueBuilder#maxItems", "}", "this", "method", "will", "block", "until", "there", "is", "available", "space", "in", "the", "queue", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedPriorityQueue.java#L137-L140
looly/hutool
hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java
SoapClient.setMethod
public SoapClient setMethod(Name name, Map<String, Object> params, boolean useMethodPrefix) { """ 设置请求方法 @param name 方法名及其命名空间 @param params 参数 @param useMethodPrefix 是否使用方法的命名空间前缀 @return this """ return setMethod(new QName(name.getURI(), name.getLocalName(), name.getPrefix()), params, useMethodPrefix); }
java
public SoapClient setMethod(Name name, Map<String, Object> params, boolean useMethodPrefix) { return setMethod(new QName(name.getURI(), name.getLocalName(), name.getPrefix()), params, useMethodPrefix); }
[ "public", "SoapClient", "setMethod", "(", "Name", "name", ",", "Map", "<", "String", ",", "Object", ">", "params", ",", "boolean", "useMethodPrefix", ")", "{", "return", "setMethod", "(", "new", "QName", "(", "name", ".", "getURI", "(", ")", ",", "name", ".", "getLocalName", "(", ")", ",", "name", ".", "getPrefix", "(", ")", ")", ",", "params", ",", "useMethodPrefix", ")", ";", "}" ]
设置请求方法 @param name 方法名及其命名空间 @param params 参数 @param useMethodPrefix 是否使用方法的命名空间前缀 @return this
[ "设置请求方法" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java#L224-L226
Netflix/dyno
dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/lb/HttpEndpointBasedTokenMapSupplier.java
HttpEndpointBasedTokenMapSupplier.getTopologyFromRandomNodeWithRetry
private String getTopologyFromRandomNodeWithRetry(Set<Host> activeHosts) { """ Tries multiple nodes, and it only bubbles up the last node's exception. We want to bubble up the exception in order for the last node to be removed from the connection pool. @param activeHosts @return the topology from cluster_describe """ int count = NUM_RETRIES_PER_NODE; String nodeResponse; Exception lastEx; final Host randomHost = getRandomHost(activeHosts); do { try { lastEx = null; nodeResponse = getResponseViaHttp(randomHost.getHostName()); if (nodeResponse != null) { Logger.info("Received topology from " + randomHost); return nodeResponse; } } catch (Exception e) { Logger.info("cannot get topology from : " + randomHost); lastEx = e; } finally { count--; } } while ((count > 0)); if (lastEx != null) { if (lastEx instanceof ConnectTimeoutException) { throw new TimeoutException("Unable to obtain topology", lastEx).setHost(randomHost); } throw new DynoException(String.format("Unable to obtain topology from %s", randomHost), lastEx); } else { throw new DynoException(String.format("Could not contact dynomite manager for token map on %s", randomHost)); } }
java
private String getTopologyFromRandomNodeWithRetry(Set<Host> activeHosts) { int count = NUM_RETRIES_PER_NODE; String nodeResponse; Exception lastEx; final Host randomHost = getRandomHost(activeHosts); do { try { lastEx = null; nodeResponse = getResponseViaHttp(randomHost.getHostName()); if (nodeResponse != null) { Logger.info("Received topology from " + randomHost); return nodeResponse; } } catch (Exception e) { Logger.info("cannot get topology from : " + randomHost); lastEx = e; } finally { count--; } } while ((count > 0)); if (lastEx != null) { if (lastEx instanceof ConnectTimeoutException) { throw new TimeoutException("Unable to obtain topology", lastEx).setHost(randomHost); } throw new DynoException(String.format("Unable to obtain topology from %s", randomHost), lastEx); } else { throw new DynoException(String.format("Could not contact dynomite manager for token map on %s", randomHost)); } }
[ "private", "String", "getTopologyFromRandomNodeWithRetry", "(", "Set", "<", "Host", ">", "activeHosts", ")", "{", "int", "count", "=", "NUM_RETRIES_PER_NODE", ";", "String", "nodeResponse", ";", "Exception", "lastEx", ";", "final", "Host", "randomHost", "=", "getRandomHost", "(", "activeHosts", ")", ";", "do", "{", "try", "{", "lastEx", "=", "null", ";", "nodeResponse", "=", "getResponseViaHttp", "(", "randomHost", ".", "getHostName", "(", ")", ")", ";", "if", "(", "nodeResponse", "!=", "null", ")", "{", "Logger", ".", "info", "(", "\"Received topology from \"", "+", "randomHost", ")", ";", "return", "nodeResponse", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "Logger", ".", "info", "(", "\"cannot get topology from : \"", "+", "randomHost", ")", ";", "lastEx", "=", "e", ";", "}", "finally", "{", "count", "--", ";", "}", "}", "while", "(", "(", "count", ">", "0", ")", ")", ";", "if", "(", "lastEx", "!=", "null", ")", "{", "if", "(", "lastEx", "instanceof", "ConnectTimeoutException", ")", "{", "throw", "new", "TimeoutException", "(", "\"Unable to obtain topology\"", ",", "lastEx", ")", ".", "setHost", "(", "randomHost", ")", ";", "}", "throw", "new", "DynoException", "(", "String", ".", "format", "(", "\"Unable to obtain topology from %s\"", ",", "randomHost", ")", ",", "lastEx", ")", ";", "}", "else", "{", "throw", "new", "DynoException", "(", "String", ".", "format", "(", "\"Could not contact dynomite manager for token map on %s\"", ",", "randomHost", ")", ")", ";", "}", "}" ]
Tries multiple nodes, and it only bubbles up the last node's exception. We want to bubble up the exception in order for the last node to be removed from the connection pool. @param activeHosts @return the topology from cluster_describe
[ "Tries", "multiple", "nodes", "and", "it", "only", "bubbles", "up", "the", "last", "node", "s", "exception", ".", "We", "want", "to", "bubble", "up", "the", "exception", "in", "order", "for", "the", "last", "node", "to", "be", "removed", "from", "the", "connection", "pool", "." ]
train
https://github.com/Netflix/dyno/blob/158f807083ea8e9b09c8089cb07f98e954ad5b23/dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/lb/HttpEndpointBasedTokenMapSupplier.java#L178-L209
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/SldUtilities.java
SldUtilities.colorWithAlpha
public static Color colorWithAlpha( Color color, int alpha ) { """ Creates a color with the given alpha. @param color the color to use. @param alpha an alpha value between 0 and 255. @return the color with alpha. """ return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); }
java
public static Color colorWithAlpha( Color color, int alpha ) { return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); }
[ "public", "static", "Color", "colorWithAlpha", "(", "Color", "color", ",", "int", "alpha", ")", "{", "return", "new", "Color", "(", "color", ".", "getRed", "(", ")", ",", "color", ".", "getGreen", "(", ")", ",", "color", ".", "getBlue", "(", ")", ",", "alpha", ")", ";", "}" ]
Creates a color with the given alpha. @param color the color to use. @param alpha an alpha value between 0 and 255. @return the color with alpha.
[ "Creates", "a", "color", "with", "the", "given", "alpha", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/SldUtilities.java#L290-L292
apache/groovy
subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java
DateUtilExtensions.putAt
public static void putAt(Date self, int field, int value) { """ Support the subscript operator for mutating a Date. @param self A Date @param field A Calendar field, e.g. MONTH @param value The value for the given field, e.g. FEBRUARY @see #putAt(java.util.Calendar, int, int) @see java.util.Calendar#set(int, int) @since 1.7.3 """ Calendar cal = Calendar.getInstance(); cal.setTime(self); putAt(cal, field, value); self.setTime(cal.getTimeInMillis()); }
java
public static void putAt(Date self, int field, int value) { Calendar cal = Calendar.getInstance(); cal.setTime(self); putAt(cal, field, value); self.setTime(cal.getTimeInMillis()); }
[ "public", "static", "void", "putAt", "(", "Date", "self", ",", "int", "field", ",", "int", "value", ")", "{", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setTime", "(", "self", ")", ";", "putAt", "(", "cal", ",", "field", ",", "value", ")", ";", "self", ".", "setTime", "(", "cal", ".", "getTimeInMillis", "(", ")", ")", ";", "}" ]
Support the subscript operator for mutating a Date. @param self A Date @param field A Calendar field, e.g. MONTH @param value The value for the given field, e.g. FEBRUARY @see #putAt(java.util.Calendar, int, int) @see java.util.Calendar#set(int, int) @since 1.7.3
[ "Support", "the", "subscript", "operator", "for", "mutating", "a", "Date", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java#L111-L116
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/util/pool/Pools.java
Pools.retrievePool
public static Pool retrievePool(UrlParser urlParser) { """ Get existing pool for a configuration. Create it if doesn't exists. @param urlParser configuration parser @return pool """ if (!poolMap.containsKey(urlParser)) { synchronized (poolMap) { if (!poolMap.containsKey(urlParser)) { if (poolExecutor == null) { poolExecutor = new ScheduledThreadPoolExecutor(1, new MariaDbThreadFactory("MariaDbPool-maxTimeoutIdle-checker")); } Pool pool = new Pool(urlParser, poolIndex.incrementAndGet(), poolExecutor); poolMap.put(urlParser, pool); return pool; } } } return poolMap.get(urlParser); }
java
public static Pool retrievePool(UrlParser urlParser) { if (!poolMap.containsKey(urlParser)) { synchronized (poolMap) { if (!poolMap.containsKey(urlParser)) { if (poolExecutor == null) { poolExecutor = new ScheduledThreadPoolExecutor(1, new MariaDbThreadFactory("MariaDbPool-maxTimeoutIdle-checker")); } Pool pool = new Pool(urlParser, poolIndex.incrementAndGet(), poolExecutor); poolMap.put(urlParser, pool); return pool; } } } return poolMap.get(urlParser); }
[ "public", "static", "Pool", "retrievePool", "(", "UrlParser", "urlParser", ")", "{", "if", "(", "!", "poolMap", ".", "containsKey", "(", "urlParser", ")", ")", "{", "synchronized", "(", "poolMap", ")", "{", "if", "(", "!", "poolMap", ".", "containsKey", "(", "urlParser", ")", ")", "{", "if", "(", "poolExecutor", "==", "null", ")", "{", "poolExecutor", "=", "new", "ScheduledThreadPoolExecutor", "(", "1", ",", "new", "MariaDbThreadFactory", "(", "\"MariaDbPool-maxTimeoutIdle-checker\"", ")", ")", ";", "}", "Pool", "pool", "=", "new", "Pool", "(", "urlParser", ",", "poolIndex", ".", "incrementAndGet", "(", ")", ",", "poolExecutor", ")", ";", "poolMap", ".", "put", "(", "urlParser", ",", "pool", ")", ";", "return", "pool", ";", "}", "}", "}", "return", "poolMap", ".", "get", "(", "urlParser", ")", ";", "}" ]
Get existing pool for a configuration. Create it if doesn't exists. @param urlParser configuration parser @return pool
[ "Get", "existing", "pool", "for", "a", "configuration", ".", "Create", "it", "if", "doesn", "t", "exists", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/pool/Pools.java#L45-L60
gallandarakhneorg/afc
advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java
BusItinerary.insertBusHaltAfter
public BusItineraryHalt insertBusHaltAfter(BusItineraryHalt afterHalt, UUID id, BusItineraryHaltType type) { """ Insert newHalt after afterHalt in the ordered list of {@link BusItineraryHalt}. @param afterHalt the halt where insert the new halt @param id id of the new halt @param type the type of bus halt @return the added bus halt, otherwise <code>null</code> """ return insertBusHaltAfter(afterHalt, id, null, type); }
java
public BusItineraryHalt insertBusHaltAfter(BusItineraryHalt afterHalt, UUID id, BusItineraryHaltType type) { return insertBusHaltAfter(afterHalt, id, null, type); }
[ "public", "BusItineraryHalt", "insertBusHaltAfter", "(", "BusItineraryHalt", "afterHalt", ",", "UUID", "id", ",", "BusItineraryHaltType", "type", ")", "{", "return", "insertBusHaltAfter", "(", "afterHalt", ",", "id", ",", "null", ",", "type", ")", ";", "}" ]
Insert newHalt after afterHalt in the ordered list of {@link BusItineraryHalt}. @param afterHalt the halt where insert the new halt @param id id of the new halt @param type the type of bus halt @return the added bus halt, otherwise <code>null</code>
[ "Insert", "newHalt", "after", "afterHalt", "in", "the", "ordered", "list", "of", "{", "@link", "BusItineraryHalt", "}", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java#L1162-L1164
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/DataLakeStoreAccountsInner.java
DataLakeStoreAccountsInner.getAsync
public Observable<DataLakeStoreAccountInformationInner> getAsync(String resourceGroupName, String accountName, String dataLakeStoreAccountName) { """ Gets the specified Data Lake Store account details in the specified Data Lake Analytics account. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Analytics account. @param dataLakeStoreAccountName The name of the Data Lake Store account to retrieve @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataLakeStoreAccountInformationInner object """ return getWithServiceResponseAsync(resourceGroupName, accountName, dataLakeStoreAccountName).map(new Func1<ServiceResponse<DataLakeStoreAccountInformationInner>, DataLakeStoreAccountInformationInner>() { @Override public DataLakeStoreAccountInformationInner call(ServiceResponse<DataLakeStoreAccountInformationInner> response) { return response.body(); } }); }
java
public Observable<DataLakeStoreAccountInformationInner> getAsync(String resourceGroupName, String accountName, String dataLakeStoreAccountName) { return getWithServiceResponseAsync(resourceGroupName, accountName, dataLakeStoreAccountName).map(new Func1<ServiceResponse<DataLakeStoreAccountInformationInner>, DataLakeStoreAccountInformationInner>() { @Override public DataLakeStoreAccountInformationInner call(ServiceResponse<DataLakeStoreAccountInformationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DataLakeStoreAccountInformationInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "dataLakeStoreAccountName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "dataLakeStoreAccountName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DataLakeStoreAccountInformationInner", ">", ",", "DataLakeStoreAccountInformationInner", ">", "(", ")", "{", "@", "Override", "public", "DataLakeStoreAccountInformationInner", "call", "(", "ServiceResponse", "<", "DataLakeStoreAccountInformationInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the specified Data Lake Store account details in the specified Data Lake Analytics account. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Analytics account. @param dataLakeStoreAccountName The name of the Data Lake Store account to retrieve @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataLakeStoreAccountInformationInner object
[ "Gets", "the", "specified", "Data", "Lake", "Store", "account", "details", "in", "the", "specified", "Data", "Lake", "Analytics", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/DataLakeStoreAccountsInner.java#L583-L590
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/service/PipelineHistoryService.java
PipelineHistoryService.loadMinimalData
public PipelineInstanceModels loadMinimalData(String pipelineName, Pagination pagination, Username username, OperationResult result) { """ /* Load just enough data for Pipeline History API. The API is complete enough to build Pipeline History Page. Does following: Exists check, Authorized check, Loads paginated pipeline data, Populates build-cause, Populates future stages as empty, Populates can run for pipeline & each stage, Populate stage run permission """ if (!goConfigService.currentCruiseConfig().hasPipelineNamed(new CaseInsensitiveString(pipelineName))) { result.notFound("Not Found", "Pipeline " + pipelineName + " not found", HealthStateType.general(HealthStateScope.GLOBAL)); return null; } if (!securityService.hasViewPermissionForPipeline(username, pipelineName)) { result.forbidden("Forbidden", NOT_AUTHORIZED_TO_VIEW_PIPELINE, HealthStateType.general(HealthStateScope.forPipeline(pipelineName))); return null; } PipelineInstanceModels history = pipelineDao.loadHistory(pipelineName, pagination.getPageSize(), pagination.getOffset()); for (PipelineInstanceModel pipelineInstanceModel : history) { populateMaterialRevisionsOnBuildCause(pipelineInstanceModel); populatePlaceHolderStages(pipelineInstanceModel); populateCanRunStatus(username, pipelineInstanceModel); populateStageOperatePermission(pipelineInstanceModel, username); } return history; }
java
public PipelineInstanceModels loadMinimalData(String pipelineName, Pagination pagination, Username username, OperationResult result) { if (!goConfigService.currentCruiseConfig().hasPipelineNamed(new CaseInsensitiveString(pipelineName))) { result.notFound("Not Found", "Pipeline " + pipelineName + " not found", HealthStateType.general(HealthStateScope.GLOBAL)); return null; } if (!securityService.hasViewPermissionForPipeline(username, pipelineName)) { result.forbidden("Forbidden", NOT_AUTHORIZED_TO_VIEW_PIPELINE, HealthStateType.general(HealthStateScope.forPipeline(pipelineName))); return null; } PipelineInstanceModels history = pipelineDao.loadHistory(pipelineName, pagination.getPageSize(), pagination.getOffset()); for (PipelineInstanceModel pipelineInstanceModel : history) { populateMaterialRevisionsOnBuildCause(pipelineInstanceModel); populatePlaceHolderStages(pipelineInstanceModel); populateCanRunStatus(username, pipelineInstanceModel); populateStageOperatePermission(pipelineInstanceModel, username); } return history; }
[ "public", "PipelineInstanceModels", "loadMinimalData", "(", "String", "pipelineName", ",", "Pagination", "pagination", ",", "Username", "username", ",", "OperationResult", "result", ")", "{", "if", "(", "!", "goConfigService", ".", "currentCruiseConfig", "(", ")", ".", "hasPipelineNamed", "(", "new", "CaseInsensitiveString", "(", "pipelineName", ")", ")", ")", "{", "result", ".", "notFound", "(", "\"Not Found\"", ",", "\"Pipeline \"", "+", "pipelineName", "+", "\" not found\"", ",", "HealthStateType", ".", "general", "(", "HealthStateScope", ".", "GLOBAL", ")", ")", ";", "return", "null", ";", "}", "if", "(", "!", "securityService", ".", "hasViewPermissionForPipeline", "(", "username", ",", "pipelineName", ")", ")", "{", "result", ".", "forbidden", "(", "\"Forbidden\"", ",", "NOT_AUTHORIZED_TO_VIEW_PIPELINE", ",", "HealthStateType", ".", "general", "(", "HealthStateScope", ".", "forPipeline", "(", "pipelineName", ")", ")", ")", ";", "return", "null", ";", "}", "PipelineInstanceModels", "history", "=", "pipelineDao", ".", "loadHistory", "(", "pipelineName", ",", "pagination", ".", "getPageSize", "(", ")", ",", "pagination", ".", "getOffset", "(", ")", ")", ";", "for", "(", "PipelineInstanceModel", "pipelineInstanceModel", ":", "history", ")", "{", "populateMaterialRevisionsOnBuildCause", "(", "pipelineInstanceModel", ")", ";", "populatePlaceHolderStages", "(", "pipelineInstanceModel", ")", ";", "populateCanRunStatus", "(", "username", ",", "pipelineInstanceModel", ")", ";", "populateStageOperatePermission", "(", "pipelineInstanceModel", ",", "username", ")", ";", "}", "return", "history", ";", "}" ]
/* Load just enough data for Pipeline History API. The API is complete enough to build Pipeline History Page. Does following: Exists check, Authorized check, Loads paginated pipeline data, Populates build-cause, Populates future stages as empty, Populates can run for pipeline & each stage, Populate stage run permission
[ "/", "*", "Load", "just", "enough", "data", "for", "Pipeline", "History", "API", ".", "The", "API", "is", "complete", "enough", "to", "build", "Pipeline", "History", "Page", ".", "Does", "following", ":", "Exists", "check", "Authorized", "check", "Loads", "paginated", "pipeline", "data", "Populates", "build", "-", "cause", "Populates", "future", "stages", "as", "empty", "Populates", "can", "run", "for", "pipeline", "&", "each", "stage", "Populate", "stage", "run", "permission" ]
train
https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/server/src/main/java/com/thoughtworks/go/server/service/PipelineHistoryService.java#L128-L149
Coveros/selenified
src/main/java/com/coveros/selenified/utilities/Property.java
Property.getProxy
public static String getProxy() throws InvalidProxyException { """ Retrieves the proxy property if it is set. This could be to something local, or in the cloud. Provide the protocol, address, and port @return String: the set proxy address, null if none are set """ String proxy = getProgramProperty(PROXY); if (proxy == null) { throw new InvalidProxyException(PROXY_ISNT_SET); } String[] proxyParts = proxy.split(":"); if (proxyParts.length != 2) { throw new InvalidProxyException("Proxy '" + proxy + "' isn't valid. Must contain address and port, without protocol"); } try { Integer.parseInt(proxyParts[1]); } catch (NumberFormatException e) { throw new InvalidProxyException("Proxy '" + proxy + "' isn't valid. Must contain address and port, without protocol. Invalid port provided. " + e); } return proxy; }
java
public static String getProxy() throws InvalidProxyException { String proxy = getProgramProperty(PROXY); if (proxy == null) { throw new InvalidProxyException(PROXY_ISNT_SET); } String[] proxyParts = proxy.split(":"); if (proxyParts.length != 2) { throw new InvalidProxyException("Proxy '" + proxy + "' isn't valid. Must contain address and port, without protocol"); } try { Integer.parseInt(proxyParts[1]); } catch (NumberFormatException e) { throw new InvalidProxyException("Proxy '" + proxy + "' isn't valid. Must contain address and port, without protocol. Invalid port provided. " + e); } return proxy; }
[ "public", "static", "String", "getProxy", "(", ")", "throws", "InvalidProxyException", "{", "String", "proxy", "=", "getProgramProperty", "(", "PROXY", ")", ";", "if", "(", "proxy", "==", "null", ")", "{", "throw", "new", "InvalidProxyException", "(", "PROXY_ISNT_SET", ")", ";", "}", "String", "[", "]", "proxyParts", "=", "proxy", ".", "split", "(", "\":\"", ")", ";", "if", "(", "proxyParts", ".", "length", "!=", "2", ")", "{", "throw", "new", "InvalidProxyException", "(", "\"Proxy '\"", "+", "proxy", "+", "\"' isn't valid. Must contain address and port, without protocol\"", ")", ";", "}", "try", "{", "Integer", ".", "parseInt", "(", "proxyParts", "[", "1", "]", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "new", "InvalidProxyException", "(", "\"Proxy '\"", "+", "proxy", "+", "\"' isn't valid. Must contain address and port, without protocol. Invalid port provided. \"", "+", "e", ")", ";", "}", "return", "proxy", ";", "}" ]
Retrieves the proxy property if it is set. This could be to something local, or in the cloud. Provide the protocol, address, and port @return String: the set proxy address, null if none are set
[ "Retrieves", "the", "proxy", "property", "if", "it", "is", "set", ".", "This", "could", "be", "to", "something", "local", "or", "in", "the", "cloud", ".", "Provide", "the", "protocol", "address", "and", "port" ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/utilities/Property.java#L168-L183
groovy/groovy-core
subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java
JsonOutput.writeCharSequence
private static void writeCharSequence(CharSequence seq, CharBuf buffer) { """ Serializes any char sequence and writes it into specified buffer. """ if (seq.length() > 0) { buffer.addJsonEscapedString(seq.toString()); } else { buffer.addChars(EMPTY_STRING_CHARS); } }
java
private static void writeCharSequence(CharSequence seq, CharBuf buffer) { if (seq.length() > 0) { buffer.addJsonEscapedString(seq.toString()); } else { buffer.addChars(EMPTY_STRING_CHARS); } }
[ "private", "static", "void", "writeCharSequence", "(", "CharSequence", "seq", ",", "CharBuf", "buffer", ")", "{", "if", "(", "seq", ".", "length", "(", ")", ">", "0", ")", "{", "buffer", ".", "addJsonEscapedString", "(", "seq", ".", "toString", "(", ")", ")", ";", "}", "else", "{", "buffer", ".", "addChars", "(", "EMPTY_STRING_CHARS", ")", ";", "}", "}" ]
Serializes any char sequence and writes it into specified buffer.
[ "Serializes", "any", "char", "sequence", "and", "writes", "it", "into", "specified", "buffer", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java#L304-L310
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.createFundamental
public static DMatrixRMaj createFundamental(DMatrixRMaj E, DMatrixRMaj K1, DMatrixRMaj K2) { """ Computes a Fundamental matrix given an Essential matrix and the camera calibration matrix. F = (K2<sup>-1</sup>)<sup>T</sup>*E*K1<sup>-1</sup> @param E Essential matrix @param K1 Intrinsic camera calibration matrix for camera 1 @param K2 Intrinsic camera calibration matrix for camera 2 @return Fundamental matrix """ DMatrixRMaj K1_inv = new DMatrixRMaj(3,3); CommonOps_DDRM.invert(K1,K1_inv); DMatrixRMaj K2_inv = new DMatrixRMaj(3,3); CommonOps_DDRM.invert(K2,K2_inv); DMatrixRMaj F = new DMatrixRMaj(3,3); DMatrixRMaj temp = new DMatrixRMaj(3,3); CommonOps_DDRM.multTransA(K2_inv,E,temp); CommonOps_DDRM.mult(temp,K1_inv,F); return F; }
java
public static DMatrixRMaj createFundamental(DMatrixRMaj E, DMatrixRMaj K1, DMatrixRMaj K2) { DMatrixRMaj K1_inv = new DMatrixRMaj(3,3); CommonOps_DDRM.invert(K1,K1_inv); DMatrixRMaj K2_inv = new DMatrixRMaj(3,3); CommonOps_DDRM.invert(K2,K2_inv); DMatrixRMaj F = new DMatrixRMaj(3,3); DMatrixRMaj temp = new DMatrixRMaj(3,3); CommonOps_DDRM.multTransA(K2_inv,E,temp); CommonOps_DDRM.mult(temp,K1_inv,F); return F; }
[ "public", "static", "DMatrixRMaj", "createFundamental", "(", "DMatrixRMaj", "E", ",", "DMatrixRMaj", "K1", ",", "DMatrixRMaj", "K2", ")", "{", "DMatrixRMaj", "K1_inv", "=", "new", "DMatrixRMaj", "(", "3", ",", "3", ")", ";", "CommonOps_DDRM", ".", "invert", "(", "K1", ",", "K1_inv", ")", ";", "DMatrixRMaj", "K2_inv", "=", "new", "DMatrixRMaj", "(", "3", ",", "3", ")", ";", "CommonOps_DDRM", ".", "invert", "(", "K2", ",", "K2_inv", ")", ";", "DMatrixRMaj", "F", "=", "new", "DMatrixRMaj", "(", "3", ",", "3", ")", ";", "DMatrixRMaj", "temp", "=", "new", "DMatrixRMaj", "(", "3", ",", "3", ")", ";", "CommonOps_DDRM", ".", "multTransA", "(", "K2_inv", ",", "E", ",", "temp", ")", ";", "CommonOps_DDRM", ".", "mult", "(", "temp", ",", "K1_inv", ",", "F", ")", ";", "return", "F", ";", "}" ]
Computes a Fundamental matrix given an Essential matrix and the camera calibration matrix. F = (K2<sup>-1</sup>)<sup>T</sup>*E*K1<sup>-1</sup> @param E Essential matrix @param K1 Intrinsic camera calibration matrix for camera 1 @param K2 Intrinsic camera calibration matrix for camera 2 @return Fundamental matrix
[ "Computes", "a", "Fundamental", "matrix", "given", "an", "Essential", "matrix", "and", "the", "camera", "calibration", "matrix", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L722-L736
k3po/k3po
driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/Channels.java
Channels.shutdownOutput
public static ChannelFuture shutdownOutput(Channel channel) { """ Sends a {@code "shutdownOutput"} request to the last {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} of the specified {@link Channel}. @param channel the channel to bind @return the {@link ChannelFuture} which will be notified when the shutdownOutput operation is done """ ChannelFuture future = future(channel); channel.getPipeline().sendDownstream( new DownstreamShutdownOutputEvent(channel, future)); return future; }
java
public static ChannelFuture shutdownOutput(Channel channel) { ChannelFuture future = future(channel); channel.getPipeline().sendDownstream( new DownstreamShutdownOutputEvent(channel, future)); return future; }
[ "public", "static", "ChannelFuture", "shutdownOutput", "(", "Channel", "channel", ")", "{", "ChannelFuture", "future", "=", "future", "(", "channel", ")", ";", "channel", ".", "getPipeline", "(", ")", ".", "sendDownstream", "(", "new", "DownstreamShutdownOutputEvent", "(", "channel", ",", "future", ")", ")", ";", "return", "future", ";", "}" ]
Sends a {@code "shutdownOutput"} request to the last {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} of the specified {@link Channel}. @param channel the channel to bind @return the {@link ChannelFuture} which will be notified when the shutdownOutput operation is done
[ "Sends", "a", "{", "@code", "shutdownOutput", "}", "request", "to", "the", "last", "{", "@link", "ChannelDownstreamHandler", "}", "in", "the", "{", "@link", "ChannelPipeline", "}", "of", "the", "specified", "{", "@link", "Channel", "}", "." ]
train
https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/Channels.java#L125-L130
VoltDB/voltdb
src/frontend/org/voltdb/planner/ParsedSelectStmt.java
ParsedSelectStmt.fixColumns
static void fixColumns(List<ParsedColInfo> src, Map<Integer, Pair<String, Integer>> m) { """ stmt's display column (name, index) ==> view table column (name, index) """ // change to display column index-keyed map src.forEach(ci -> { if (m.containsKey(ci.m_index)) { Pair<String, Integer> viewInfo = m.get(ci.m_index); ci.updateColName(viewInfo.getFirst(), ci.m_alias); } }); }
java
static void fixColumns(List<ParsedColInfo> src, Map<Integer, Pair<String, Integer>> m) { // change to display column index-keyed map src.forEach(ci -> { if (m.containsKey(ci.m_index)) { Pair<String, Integer> viewInfo = m.get(ci.m_index); ci.updateColName(viewInfo.getFirst(), ci.m_alias); } }); }
[ "static", "void", "fixColumns", "(", "List", "<", "ParsedColInfo", ">", "src", ",", "Map", "<", "Integer", ",", "Pair", "<", "String", ",", "Integer", ">", ">", "m", ")", "{", "// change to display column index-keyed map", "src", ".", "forEach", "(", "ci", "->", "{", "if", "(", "m", ".", "containsKey", "(", "ci", ".", "m_index", ")", ")", "{", "Pair", "<", "String", ",", "Integer", ">", "viewInfo", "=", "m", ".", "get", "(", "ci", ".", "m_index", ")", ";", "ci", ".", "updateColName", "(", "viewInfo", ".", "getFirst", "(", ")", ",", "ci", ".", "m_alias", ")", ";", "}", "}", ")", ";", "}" ]
stmt's display column (name, index) ==> view table column (name, index)
[ "stmt", "s", "display", "column", "(", "name", "index", ")", "==", ">", "view", "table", "column", "(", "name", "index", ")" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/ParsedSelectStmt.java#L175-L183
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/validation/DOValidatorImpl.java
DOValidatorImpl.validateXMLSchema
private void validateXMLSchema(InputStream objectAsStream, DOValidatorXMLSchema xsv) throws ObjectValidityException, GeneralException { """ Do XML Schema validation on the Fedora object. @param objectAsFile The digital object provided as a file. @throws ObjectValidityException If validation fails for any reason. @throws GeneralException If validation fails for any reason. """ try { xsv.validate(objectAsStream); } catch (ObjectValidityException e) { logger.error("VALIDATE: ERROR - failed XML Schema validation.", e); throw e; } catch (Exception e) { logger.error("VALIDATE: ERROR - failed XML Schema validation.", e); throw new ObjectValidityException("[DOValidatorImpl]: validateXMLSchema. " + e.getMessage()); } logger.debug("VALIDATE: SUCCESS - passed XML Schema validation."); }
java
private void validateXMLSchema(InputStream objectAsStream, DOValidatorXMLSchema xsv) throws ObjectValidityException, GeneralException { try { xsv.validate(objectAsStream); } catch (ObjectValidityException e) { logger.error("VALIDATE: ERROR - failed XML Schema validation.", e); throw e; } catch (Exception e) { logger.error("VALIDATE: ERROR - failed XML Schema validation.", e); throw new ObjectValidityException("[DOValidatorImpl]: validateXMLSchema. " + e.getMessage()); } logger.debug("VALIDATE: SUCCESS - passed XML Schema validation."); }
[ "private", "void", "validateXMLSchema", "(", "InputStream", "objectAsStream", ",", "DOValidatorXMLSchema", "xsv", ")", "throws", "ObjectValidityException", ",", "GeneralException", "{", "try", "{", "xsv", ".", "validate", "(", "objectAsStream", ")", ";", "}", "catch", "(", "ObjectValidityException", "e", ")", "{", "logger", ".", "error", "(", "\"VALIDATE: ERROR - failed XML Schema validation.\"", ",", "e", ")", ";", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"VALIDATE: ERROR - failed XML Schema validation.\"", ",", "e", ")", ";", "throw", "new", "ObjectValidityException", "(", "\"[DOValidatorImpl]: validateXMLSchema. \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "logger", ".", "debug", "(", "\"VALIDATE: SUCCESS - passed XML Schema validation.\"", ")", ";", "}" ]
Do XML Schema validation on the Fedora object. @param objectAsFile The digital object provided as a file. @throws ObjectValidityException If validation fails for any reason. @throws GeneralException If validation fails for any reason.
[ "Do", "XML", "Schema", "validation", "on", "the", "Fedora", "object", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/validation/DOValidatorImpl.java#L357-L371
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getPvPHeroInfo
public void getPvPHeroInfo(String[] ids, Callback<List<PvPHero>> callback) throws GuildWars2Exception, NullPointerException { """ For more info on pvp heroes API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/heroes">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 pvp hero 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 PvPHero pvp hero info """ isParamValid(new ParamChecker(ids)); gw2API.getPvPHeroInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getPvPHeroInfo(String[] ids, Callback<List<PvPHero>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getPvPHeroInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getPvPHeroInfo", "(", "String", "[", "]", "ids", ",", "Callback", "<", "List", "<", "PvPHero", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ids", ")", ")", ";", "gw2API", ".", "getPvPHeroInfo", "(", "processIds", "(", "ids", ")", ",", "GuildWars2", ".", "lang", ".", "getValue", "(", ")", ")", ".", "enqueue", "(", "callback", ")", ";", "}" ]
For more info on pvp heroes API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/heroes">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 pvp hero 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 PvPHero pvp hero info
[ "For", "more", "info", "on", "pvp", "heroes", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "pvp", "/", "heroes", ">", "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#L2083-L2086
pac4j/pac4j
pac4j-saml/src/main/java/org/pac4j/saml/sso/impl/SAML2AuthnResponseValidator.java
SAML2AuthnResponseValidator.decryptEncryptedAssertions
protected final void decryptEncryptedAssertions(final Response response, final Decrypter decrypter) { """ Decrypt encrypted assertions and add them to the assertions list of the response. @param response the response @param decrypter the decrypter """ for (final EncryptedAssertion encryptedAssertion : response.getEncryptedAssertions()) { try { final Assertion decryptedAssertion = decrypter.decrypt(encryptedAssertion); response.getAssertions().add(decryptedAssertion); } catch (final DecryptionException e) { logger.error("Decryption of assertion failed, continue with the next one", e); } } }
java
protected final void decryptEncryptedAssertions(final Response response, final Decrypter decrypter) { for (final EncryptedAssertion encryptedAssertion : response.getEncryptedAssertions()) { try { final Assertion decryptedAssertion = decrypter.decrypt(encryptedAssertion); response.getAssertions().add(decryptedAssertion); } catch (final DecryptionException e) { logger.error("Decryption of assertion failed, continue with the next one", e); } } }
[ "protected", "final", "void", "decryptEncryptedAssertions", "(", "final", "Response", "response", ",", "final", "Decrypter", "decrypter", ")", "{", "for", "(", "final", "EncryptedAssertion", "encryptedAssertion", ":", "response", ".", "getEncryptedAssertions", "(", ")", ")", "{", "try", "{", "final", "Assertion", "decryptedAssertion", "=", "decrypter", ".", "decrypt", "(", "encryptedAssertion", ")", ";", "response", ".", "getAssertions", "(", ")", ".", "add", "(", "decryptedAssertion", ")", ";", "}", "catch", "(", "final", "DecryptionException", "e", ")", "{", "logger", ".", "error", "(", "\"Decryption of assertion failed, continue with the next one\"", ",", "e", ")", ";", "}", "}", "}" ]
Decrypt encrypted assertions and add them to the assertions list of the response. @param response the response @param decrypter the decrypter
[ "Decrypt", "encrypted", "assertions", "and", "add", "them", "to", "the", "assertions", "list", "of", "the", "response", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-saml/src/main/java/org/pac4j/saml/sso/impl/SAML2AuthnResponseValidator.java#L294-L305
rythmengine/rythmengine
src/main/java/org/rythmengine/utils/S.java
S.formatCurrency
@Transformer(requireTemplate = true) public static String formatCurrency(Object data) { """ Transformer method. Format given data into currency @param data @return the currency See {@link #formatCurrency(org.rythmengine.template.ITemplate,Object,String,java.util.Locale)} """ return formatCurrency(null, data, null, null); }
java
@Transformer(requireTemplate = true) public static String formatCurrency(Object data) { return formatCurrency(null, data, null, null); }
[ "@", "Transformer", "(", "requireTemplate", "=", "true", ")", "public", "static", "String", "formatCurrency", "(", "Object", "data", ")", "{", "return", "formatCurrency", "(", "null", ",", "data", ",", "null", ",", "null", ")", ";", "}" ]
Transformer method. Format given data into currency @param data @return the currency See {@link #formatCurrency(org.rythmengine.template.ITemplate,Object,String,java.util.Locale)}
[ "Transformer", "method", ".", "Format", "given", "data", "into", "currency" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/utils/S.java#L1445-L1448
Netflix/spectator
spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcLogEntry.java
IpcLogEntry.addTag
public IpcLogEntry addTag(String k, String v) { """ Add custom tags to the request metrics. Note, IPC metrics already have many tags and it is not recommended for users to tack on additional context. In particular, any additional tags should have a <b>guaranteed</b> low cardinality. If additional tagging causes these metrics to exceed limits, then you may lose all visibility into requests. """ this.additionalTags.put(k, v); return this; }
java
public IpcLogEntry addTag(String k, String v) { this.additionalTags.put(k, v); return this; }
[ "public", "IpcLogEntry", "addTag", "(", "String", "k", ",", "String", "v", ")", "{", "this", ".", "additionalTags", ".", "put", "(", "k", ",", "v", ")", ";", "return", "this", ";", "}" ]
Add custom tags to the request metrics. Note, IPC metrics already have many tags and it is not recommended for users to tack on additional context. In particular, any additional tags should have a <b>guaranteed</b> low cardinality. If additional tagging causes these metrics to exceed limits, then you may lose all visibility into requests.
[ "Add", "custom", "tags", "to", "the", "request", "metrics", ".", "Note", "IPC", "metrics", "already", "have", "many", "tags", "and", "it", "is", "not", "recommended", "for", "users", "to", "tack", "on", "additional", "context", ".", "In", "particular", "any", "additional", "tags", "should", "have", "a", "<b", ">", "guaranteed<", "/", "b", ">", "low", "cardinality", ".", "If", "additional", "tagging", "causes", "these", "metrics", "to", "exceed", "limits", "then", "you", "may", "lose", "all", "visibility", "into", "requests", "." ]
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcLogEntry.java#L570-L573
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_line_serviceName_phone_phonebook_bookKey_phonebookContact_id_GET
public OvhPhonebookContact billingAccount_line_serviceName_phone_phonebook_bookKey_phonebookContact_id_GET(String billingAccount, String serviceName, String bookKey, Long id) throws IOException { """ Get this object properties REST: GET /telephony/{billingAccount}/line/{serviceName}/phone/phonebook/{bookKey}/phonebookContact/{id} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param bookKey [required] Identifier of the phonebook @param id [required] Contact identifier """ String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/phonebook/{bookKey}/phonebookContact/{id}"; StringBuilder sb = path(qPath, billingAccount, serviceName, bookKey, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPhonebookContact.class); }
java
public OvhPhonebookContact billingAccount_line_serviceName_phone_phonebook_bookKey_phonebookContact_id_GET(String billingAccount, String serviceName, String bookKey, Long id) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/phonebook/{bookKey}/phonebookContact/{id}"; StringBuilder sb = path(qPath, billingAccount, serviceName, bookKey, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPhonebookContact.class); }
[ "public", "OvhPhonebookContact", "billingAccount_line_serviceName_phone_phonebook_bookKey_phonebookContact_id_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "String", "bookKey", ",", "Long", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/line/{serviceName}/phone/phonebook/{bookKey}/phonebookContact/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ",", "bookKey", ",", "id", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhPhonebookContact", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /telephony/{billingAccount}/line/{serviceName}/phone/phonebook/{bookKey}/phonebookContact/{id} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param bookKey [required] Identifier of the phonebook @param id [required] Contact identifier
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1305-L1310
stripe/stripe-android
stripe/src/main/java/com/stripe/android/view/CardMultilineWidget.java
CardMultilineWidget.getCard
@Nullable public Card getCard() { """ Gets a {@link Card} object from the user input, if all fields are valid. If not, returns {@code null}. @return a valid {@link Card} object based on user input, or {@code null} if any field is invalid """ if (validateAllFields()) { String cardNumber = mCardNumberEditText.getCardNumber(); int[] cardDate = mExpiryDateEditText.getValidDateFields(); String cvcValue = mCvcEditText.getText().toString(); Card card = new Card(cardNumber, cardDate[0], cardDate[1], cvcValue); if (mShouldShowPostalCode) { card.setAddressZip(mPostalCodeEditText.getText().toString()); } return card.addLoggingToken(CARD_MULTILINE_TOKEN); } return null; }
java
@Nullable public Card getCard() { if (validateAllFields()) { String cardNumber = mCardNumberEditText.getCardNumber(); int[] cardDate = mExpiryDateEditText.getValidDateFields(); String cvcValue = mCvcEditText.getText().toString(); Card card = new Card(cardNumber, cardDate[0], cardDate[1], cvcValue); if (mShouldShowPostalCode) { card.setAddressZip(mPostalCodeEditText.getText().toString()); } return card.addLoggingToken(CARD_MULTILINE_TOKEN); } return null; }
[ "@", "Nullable", "public", "Card", "getCard", "(", ")", "{", "if", "(", "validateAllFields", "(", ")", ")", "{", "String", "cardNumber", "=", "mCardNumberEditText", ".", "getCardNumber", "(", ")", ";", "int", "[", "]", "cardDate", "=", "mExpiryDateEditText", ".", "getValidDateFields", "(", ")", ";", "String", "cvcValue", "=", "mCvcEditText", ".", "getText", "(", ")", ".", "toString", "(", ")", ";", "Card", "card", "=", "new", "Card", "(", "cardNumber", ",", "cardDate", "[", "0", "]", ",", "cardDate", "[", "1", "]", ",", "cvcValue", ")", ";", "if", "(", "mShouldShowPostalCode", ")", "{", "card", ".", "setAddressZip", "(", "mPostalCodeEditText", ".", "getText", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "return", "card", ".", "addLoggingToken", "(", "CARD_MULTILINE_TOKEN", ")", ";", "}", "return", "null", ";", "}" ]
Gets a {@link Card} object from the user input, if all fields are valid. If not, returns {@code null}. @return a valid {@link Card} object based on user input, or {@code null} if any field is invalid
[ "Gets", "a", "{", "@link", "Card", "}", "object", "from", "the", "user", "input", "if", "all", "fields", "are", "valid", ".", "If", "not", "returns", "{", "@code", "null", "}", "." ]
train
https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/view/CardMultilineWidget.java#L121-L136
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java
ClientFactory.createMessageReceiverFromEntityPath
public static IMessageReceiver createMessageReceiverFromEntityPath(MessagingFactory messagingFactory, String entityPath) throws InterruptedException, ServiceBusException { """ Creates a message receiver to the entity. @param messagingFactory messaging factory (which represents a connection) on which receiver needs to be created @param entityPath path of the entity @return IMessageReceiver instance @throws InterruptedException if the current thread was interrupted while waiting @throws ServiceBusException if the receiver cannot be created """ return createMessageReceiverFromEntityPath(messagingFactory, entityPath, DEFAULTRECEIVEMODE); }
java
public static IMessageReceiver createMessageReceiverFromEntityPath(MessagingFactory messagingFactory, String entityPath) throws InterruptedException, ServiceBusException { return createMessageReceiverFromEntityPath(messagingFactory, entityPath, DEFAULTRECEIVEMODE); }
[ "public", "static", "IMessageReceiver", "createMessageReceiverFromEntityPath", "(", "MessagingFactory", "messagingFactory", ",", "String", "entityPath", ")", "throws", "InterruptedException", ",", "ServiceBusException", "{", "return", "createMessageReceiverFromEntityPath", "(", "messagingFactory", ",", "entityPath", ",", "DEFAULTRECEIVEMODE", ")", ";", "}" ]
Creates a message receiver to the entity. @param messagingFactory messaging factory (which represents a connection) on which receiver needs to be created @param entityPath path of the entity @return IMessageReceiver instance @throws InterruptedException if the current thread was interrupted while waiting @throws ServiceBusException if the receiver cannot be created
[ "Creates", "a", "message", "receiver", "to", "the", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L334-L336
google/j2objc
jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java
BigDecimal.longMultiplyPowerTen
private static long longMultiplyPowerTen(long val, int n) { """ Compute val * 10 ^ n; return this product if it is representable as a long, INFLATED otherwise. """ if (val == 0 || n <= 0) return val; long[] tab = LONG_TEN_POWERS_TABLE; long[] bounds = THRESHOLDS_TABLE; if (n < tab.length && n < bounds.length) { long tenpower = tab[n]; if (val == 1) return tenpower; if (Math.abs(val) <= bounds[n]) return val * tenpower; } return INFLATED; }
java
private static long longMultiplyPowerTen(long val, int n) { if (val == 0 || n <= 0) return val; long[] tab = LONG_TEN_POWERS_TABLE; long[] bounds = THRESHOLDS_TABLE; if (n < tab.length && n < bounds.length) { long tenpower = tab[n]; if (val == 1) return tenpower; if (Math.abs(val) <= bounds[n]) return val * tenpower; } return INFLATED; }
[ "private", "static", "long", "longMultiplyPowerTen", "(", "long", "val", ",", "int", "n", ")", "{", "if", "(", "val", "==", "0", "||", "n", "<=", "0", ")", "return", "val", ";", "long", "[", "]", "tab", "=", "LONG_TEN_POWERS_TABLE", ";", "long", "[", "]", "bounds", "=", "THRESHOLDS_TABLE", ";", "if", "(", "n", "<", "tab", ".", "length", "&&", "n", "<", "bounds", ".", "length", ")", "{", "long", "tenpower", "=", "tab", "[", "n", "]", ";", "if", "(", "val", "==", "1", ")", "return", "tenpower", ";", "if", "(", "Math", ".", "abs", "(", "val", ")", "<=", "bounds", "[", "n", "]", ")", "return", "val", "*", "tenpower", ";", "}", "return", "INFLATED", ";", "}" ]
Compute val * 10 ^ n; return this product if it is representable as a long, INFLATED otherwise.
[ "Compute", "val", "*", "10", "^", "n", ";", "return", "this", "product", "if", "it", "is", "representable", "as", "a", "long", "INFLATED", "otherwise", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L3654-L3667
percolate/caffeine
caffeine/src/main/java/com/percolate/caffeine/IntentUtils.java
IntentUtils.grantUriPermissionsForIntent
private static void grantUriPermissionsForIntent(final Activity context, final Uri outputDestination, final Intent intent) { """ Grant permissions to read/write the given URI. Take from: http://stackoverflow.com/a/33754937/1234900 """ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { final List<ResolveInfo> resInfoList = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); for (ResolveInfo resolveInfo : resInfoList) { final String packageName = resolveInfo.activityInfo.packageName; context.grantUriPermission(packageName, outputDestination, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); } } }
java
private static void grantUriPermissionsForIntent(final Activity context, final Uri outputDestination, final Intent intent) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { final List<ResolveInfo> resInfoList = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); for (ResolveInfo resolveInfo : resInfoList) { final String packageName = resolveInfo.activityInfo.packageName; context.grantUriPermission(packageName, outputDestination, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); } } }
[ "private", "static", "void", "grantUriPermissionsForIntent", "(", "final", "Activity", "context", ",", "final", "Uri", "outputDestination", ",", "final", "Intent", "intent", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", "<", "Build", ".", "VERSION_CODES", ".", "LOLLIPOP", ")", "{", "final", "List", "<", "ResolveInfo", ">", "resInfoList", "=", "context", ".", "getPackageManager", "(", ")", ".", "queryIntentActivities", "(", "intent", ",", "PackageManager", ".", "MATCH_DEFAULT_ONLY", ")", ";", "for", "(", "ResolveInfo", "resolveInfo", ":", "resInfoList", ")", "{", "final", "String", "packageName", "=", "resolveInfo", ".", "activityInfo", ".", "packageName", ";", "context", ".", "grantUriPermission", "(", "packageName", ",", "outputDestination", ",", "Intent", ".", "FLAG_GRANT_WRITE_URI_PERMISSION", "|", "Intent", ".", "FLAG_GRANT_READ_URI_PERMISSION", ")", ";", "}", "}", "}" ]
Grant permissions to read/write the given URI. Take from: http://stackoverflow.com/a/33754937/1234900
[ "Grant", "permissions", "to", "read", "/", "write", "the", "given", "URI", ".", "Take", "from", ":", "http", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "33754937", "/", "1234900" ]
train
https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/IntentUtils.java#L80-L88
pugwoo/nimble-orm
src/main/java/com/pugwoo/dbhelper/sql/SQLUtils.java
SQLUtils.getSelectSQL
public static String getSelectSQL(Class<?> clazz, boolean selectOnlyKey, boolean withSQL_CALC_FOUND_ROWS) { """ select 字段 from t_table, 不包含where子句及以后的语句 @param clazz @param selectOnlyKey 是否只查询key @param withSQL_CALC_FOUND_ROWS 查询是否带上SQL_CALC_FOUND_ROWS,当配合select FOUND_ROWS();时需要为true @return """ StringBuilder sql = new StringBuilder(); sql.append("SELECT "); if(withSQL_CALC_FOUND_ROWS) { sql.append("SQL_CALC_FOUND_ROWS "); } // 处理join方式clazz JoinTable joinTable = DOInfoReader.getJoinTable(clazz); if(joinTable != null) { Field leftTableField = DOInfoReader.getJoinLeftTable(clazz); Field rightTableField = DOInfoReader.getJoinRightTable(clazz); JoinLeftTable joinLeftTable = leftTableField.getAnnotation(JoinLeftTable.class); JoinRightTable joinRightTable = rightTableField.getAnnotation(JoinRightTable.class); Table table1 = DOInfoReader.getTable(leftTableField.getType()); List<Field> fields1 = DOInfoReader.getColumnsForSelect(leftTableField.getType(), selectOnlyKey); Table table2 = DOInfoReader.getTable(rightTableField.getType()); List<Field> fields2 = DOInfoReader.getColumnsForSelect(rightTableField.getType(), selectOnlyKey); sql.append(join(fields1, ",", joinLeftTable.alias() + ".")); sql.append(","); sql.append(join(fields2, ",", joinRightTable.alias() + ".")); sql.append(" FROM ").append(getTableName(table1)) .append(" ").append(joinLeftTable.alias()).append(" "); sql.append(joinTable.joinType().getCode()).append(" "); sql.append(getTableName(table2)).append(" ").append(joinRightTable.alias()); if(joinTable.on() == null || joinTable.on().trim().isEmpty()) { throw new OnConditionIsNeedException("join table :" + clazz.getName()); } sql.append(" on ").append(joinTable.on().trim()); } else { Table table = DOInfoReader.getTable(clazz); List<Field> fields = DOInfoReader.getColumnsForSelect(clazz, selectOnlyKey); sql.append(join(fields, ",")); sql.append(" FROM ").append(getTableName(table)).append(" ").append(table.alias()); } return sql.toString(); }
java
public static String getSelectSQL(Class<?> clazz, boolean selectOnlyKey, boolean withSQL_CALC_FOUND_ROWS) { StringBuilder sql = new StringBuilder(); sql.append("SELECT "); if(withSQL_CALC_FOUND_ROWS) { sql.append("SQL_CALC_FOUND_ROWS "); } // 处理join方式clazz JoinTable joinTable = DOInfoReader.getJoinTable(clazz); if(joinTable != null) { Field leftTableField = DOInfoReader.getJoinLeftTable(clazz); Field rightTableField = DOInfoReader.getJoinRightTable(clazz); JoinLeftTable joinLeftTable = leftTableField.getAnnotation(JoinLeftTable.class); JoinRightTable joinRightTable = rightTableField.getAnnotation(JoinRightTable.class); Table table1 = DOInfoReader.getTable(leftTableField.getType()); List<Field> fields1 = DOInfoReader.getColumnsForSelect(leftTableField.getType(), selectOnlyKey); Table table2 = DOInfoReader.getTable(rightTableField.getType()); List<Field> fields2 = DOInfoReader.getColumnsForSelect(rightTableField.getType(), selectOnlyKey); sql.append(join(fields1, ",", joinLeftTable.alias() + ".")); sql.append(","); sql.append(join(fields2, ",", joinRightTable.alias() + ".")); sql.append(" FROM ").append(getTableName(table1)) .append(" ").append(joinLeftTable.alias()).append(" "); sql.append(joinTable.joinType().getCode()).append(" "); sql.append(getTableName(table2)).append(" ").append(joinRightTable.alias()); if(joinTable.on() == null || joinTable.on().trim().isEmpty()) { throw new OnConditionIsNeedException("join table :" + clazz.getName()); } sql.append(" on ").append(joinTable.on().trim()); } else { Table table = DOInfoReader.getTable(clazz); List<Field> fields = DOInfoReader.getColumnsForSelect(clazz, selectOnlyKey); sql.append(join(fields, ",")); sql.append(" FROM ").append(getTableName(table)).append(" ").append(table.alias()); } return sql.toString(); }
[ "public", "static", "String", "getSelectSQL", "(", "Class", "<", "?", ">", "clazz", ",", "boolean", "selectOnlyKey", ",", "boolean", "withSQL_CALC_FOUND_ROWS", ")", "{", "StringBuilder", "sql", "=", "new", "StringBuilder", "(", ")", ";", "sql", ".", "append", "(", "\"SELECT \"", ")", ";", "if", "(", "withSQL_CALC_FOUND_ROWS", ")", "{", "sql", ".", "append", "(", "\"SQL_CALC_FOUND_ROWS \"", ")", ";", "}", "// 处理join方式clazz", "JoinTable", "joinTable", "=", "DOInfoReader", ".", "getJoinTable", "(", "clazz", ")", ";", "if", "(", "joinTable", "!=", "null", ")", "{", "Field", "leftTableField", "=", "DOInfoReader", ".", "getJoinLeftTable", "(", "clazz", ")", ";", "Field", "rightTableField", "=", "DOInfoReader", ".", "getJoinRightTable", "(", "clazz", ")", ";", "JoinLeftTable", "joinLeftTable", "=", "leftTableField", ".", "getAnnotation", "(", "JoinLeftTable", ".", "class", ")", ";", "JoinRightTable", "joinRightTable", "=", "rightTableField", ".", "getAnnotation", "(", "JoinRightTable", ".", "class", ")", ";", "Table", "table1", "=", "DOInfoReader", ".", "getTable", "(", "leftTableField", ".", "getType", "(", ")", ")", ";", "List", "<", "Field", ">", "fields1", "=", "DOInfoReader", ".", "getColumnsForSelect", "(", "leftTableField", ".", "getType", "(", ")", ",", "selectOnlyKey", ")", ";", "Table", "table2", "=", "DOInfoReader", ".", "getTable", "(", "rightTableField", ".", "getType", "(", ")", ")", ";", "List", "<", "Field", ">", "fields2", "=", "DOInfoReader", ".", "getColumnsForSelect", "(", "rightTableField", ".", "getType", "(", ")", ",", "selectOnlyKey", ")", ";", "sql", ".", "append", "(", "join", "(", "fields1", ",", "\",\"", ",", "joinLeftTable", ".", "alias", "(", ")", "+", "\".\"", ")", ")", ";", "sql", ".", "append", "(", "\",\"", ")", ";", "sql", ".", "append", "(", "join", "(", "fields2", ",", "\",\"", ",", "joinRightTable", ".", "alias", "(", ")", "+", "\".\"", ")", ")", ";", "sql", ".", "append", "(", "\" FROM \"", ")", ".", "append", "(", "getTableName", "(", "table1", ")", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "joinLeftTable", ".", "alias", "(", ")", ")", ".", "append", "(", "\" \"", ")", ";", "sql", ".", "append", "(", "joinTable", ".", "joinType", "(", ")", ".", "getCode", "(", ")", ")", ".", "append", "(", "\" \"", ")", ";", "sql", ".", "append", "(", "getTableName", "(", "table2", ")", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "joinRightTable", ".", "alias", "(", ")", ")", ";", "if", "(", "joinTable", ".", "on", "(", ")", "==", "null", "||", "joinTable", ".", "on", "(", ")", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "OnConditionIsNeedException", "(", "\"join table :\"", "+", "clazz", ".", "getName", "(", ")", ")", ";", "}", "sql", ".", "append", "(", "\" on \"", ")", ".", "append", "(", "joinTable", ".", "on", "(", ")", ".", "trim", "(", ")", ")", ";", "}", "else", "{", "Table", "table", "=", "DOInfoReader", ".", "getTable", "(", "clazz", ")", ";", "List", "<", "Field", ">", "fields", "=", "DOInfoReader", ".", "getColumnsForSelect", "(", "clazz", ",", "selectOnlyKey", ")", ";", "sql", ".", "append", "(", "join", "(", "fields", ",", "\",\"", ")", ")", ";", "sql", ".", "append", "(", "\" FROM \"", ")", ".", "append", "(", "getTableName", "(", "table", ")", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "table", ".", "alias", "(", ")", ")", ";", "}", "return", "sql", ".", "toString", "(", ")", ";", "}" ]
select 字段 from t_table, 不包含where子句及以后的语句 @param clazz @param selectOnlyKey 是否只查询key @param withSQL_CALC_FOUND_ROWS 查询是否带上SQL_CALC_FOUND_ROWS,当配合select FOUND_ROWS();时需要为true @return
[ "select", "字段", "from", "t_table", "不包含where子句及以后的语句" ]
train
https://github.com/pugwoo/nimble-orm/blob/dd496f3e57029e4f22f9a2f00d18a6513ef94d08/src/main/java/com/pugwoo/dbhelper/sql/SQLUtils.java#L62-L105
JodaOrg/joda-time
src/main/java/org/joda/time/chrono/BasicChronology.java
BasicChronology.getYearInfo
private YearInfo getYearInfo(int year) { """ Although accessed by multiple threads, this method doesn't need to be synchronized. """ YearInfo info = iYearInfoCache[year & CACHE_MASK]; if (info == null || info.iYear != year) { info = new YearInfo(year, calculateFirstDayOfYearMillis(year)); iYearInfoCache[year & CACHE_MASK] = info; } return info; }
java
private YearInfo getYearInfo(int year) { YearInfo info = iYearInfoCache[year & CACHE_MASK]; if (info == null || info.iYear != year) { info = new YearInfo(year, calculateFirstDayOfYearMillis(year)); iYearInfoCache[year & CACHE_MASK] = info; } return info; }
[ "private", "YearInfo", "getYearInfo", "(", "int", "year", ")", "{", "YearInfo", "info", "=", "iYearInfoCache", "[", "year", "&", "CACHE_MASK", "]", ";", "if", "(", "info", "==", "null", "||", "info", ".", "iYear", "!=", "year", ")", "{", "info", "=", "new", "YearInfo", "(", "year", ",", "calculateFirstDayOfYearMillis", "(", "year", ")", ")", ";", "iYearInfoCache", "[", "year", "&", "CACHE_MASK", "]", "=", "info", ";", "}", "return", "info", ";", "}" ]
Although accessed by multiple threads, this method doesn't need to be synchronized.
[ "Although", "accessed", "by", "multiple", "threads", "this", "method", "doesn", "t", "need", "to", "be", "synchronized", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/chrono/BasicChronology.java#L781-L788
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.buildUri
protected URI buildUri(final String path, final List<NameValuePair> queryStringParams) { """ Helper method to return URI query parameters @param path the path. @param queryStringParams the query string parameters. @return the URI object. """ final StringBuilder sb = new StringBuilder(); sb.append(path); if (queryStringParams != null && queryStringParams.size() > 0) { sb.append("?").append(URLEncodedUtils.format(queryStringParams, "UTF-8")); } try { return new URI(sb.toString()); } catch (final URISyntaxException e) { throw new IllegalStateException("Invalid uri", e); } }
java
protected URI buildUri(final String path, final List<NameValuePair> queryStringParams) { final StringBuilder sb = new StringBuilder(); sb.append(path); if (queryStringParams != null && queryStringParams.size() > 0) { sb.append("?").append(URLEncodedUtils.format(queryStringParams, "UTF-8")); } try { return new URI(sb.toString()); } catch (final URISyntaxException e) { throw new IllegalStateException("Invalid uri", e); } }
[ "protected", "URI", "buildUri", "(", "final", "String", "path", ",", "final", "List", "<", "NameValuePair", ">", "queryStringParams", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "path", ")", ";", "if", "(", "queryStringParams", "!=", "null", "&&", "queryStringParams", ".", "size", "(", ")", ">", "0", ")", "{", "sb", ".", "append", "(", "\"?\"", ")", ".", "append", "(", "URLEncodedUtils", ".", "format", "(", "queryStringParams", ",", "\"UTF-8\"", ")", ")", ";", "}", "try", "{", "return", "new", "URI", "(", "sb", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "final", "URISyntaxException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Invalid uri\"", ",", "e", ")", ";", "}", "}" ]
Helper method to return URI query parameters @param path the path. @param queryStringParams the query string parameters. @return the URI object.
[ "Helper", "method", "to", "return", "URI", "query", "parameters" ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L687-L700
jMetal/jMetal
jmetal-core/src/main/java/org/uma/jmetal/solution/util/RepairDoubleSolutionAtRandom.java
RepairDoubleSolutionAtRandom.repairSolutionVariableValue
public double repairSolutionVariableValue(double value, double lowerBound, double upperBound) { """ Checks if the value is between its bounds; if not, a random value between the limits is returned @param value The value to be checked @param lowerBound @param upperBound @return The same value if it is between the limits or a repaired value otherwise """ if (lowerBound > upperBound) { throw new JMetalException("The lower bound (" + lowerBound + ") is greater than the " + "upper bound (" + upperBound+")") ; } double result = value ; if (value < lowerBound) { result = randomGenerator.getRandomValue(lowerBound, upperBound) ; } if (value > upperBound) { result = randomGenerator.getRandomValue(lowerBound, upperBound) ; } return result ; }
java
public double repairSolutionVariableValue(double value, double lowerBound, double upperBound) { if (lowerBound > upperBound) { throw new JMetalException("The lower bound (" + lowerBound + ") is greater than the " + "upper bound (" + upperBound+")") ; } double result = value ; if (value < lowerBound) { result = randomGenerator.getRandomValue(lowerBound, upperBound) ; } if (value > upperBound) { result = randomGenerator.getRandomValue(lowerBound, upperBound) ; } return result ; }
[ "public", "double", "repairSolutionVariableValue", "(", "double", "value", ",", "double", "lowerBound", ",", "double", "upperBound", ")", "{", "if", "(", "lowerBound", ">", "upperBound", ")", "{", "throw", "new", "JMetalException", "(", "\"The lower bound (\"", "+", "lowerBound", "+", "\") is greater than the \"", "+", "\"upper bound (\"", "+", "upperBound", "+", "\")\"", ")", ";", "}", "double", "result", "=", "value", ";", "if", "(", "value", "<", "lowerBound", ")", "{", "result", "=", "randomGenerator", ".", "getRandomValue", "(", "lowerBound", ",", "upperBound", ")", ";", "}", "if", "(", "value", ">", "upperBound", ")", "{", "result", "=", "randomGenerator", ".", "getRandomValue", "(", "lowerBound", ",", "upperBound", ")", ";", "}", "return", "result", ";", "}" ]
Checks if the value is between its bounds; if not, a random value between the limits is returned @param value The value to be checked @param lowerBound @param upperBound @return The same value if it is between the limits or a repaired value otherwise
[ "Checks", "if", "the", "value", "is", "between", "its", "bounds", ";", "if", "not", "a", "random", "value", "between", "the", "limits", "is", "returned" ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/solution/util/RepairDoubleSolutionAtRandom.java#L35-L49
igniterealtime/Smack
smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java
RosterEntry.toRosterItem
static RosterPacket.Item toRosterItem(RosterEntry entry) { """ Convert the RosterEntry to a Roster stanza &lt;item/&gt; element. @param entry the roster entry. @return the roster item. """ return toRosterItem(entry, entry.getName(), false); }
java
static RosterPacket.Item toRosterItem(RosterEntry entry) { return toRosterItem(entry, entry.getName(), false); }
[ "static", "RosterPacket", ".", "Item", "toRosterItem", "(", "RosterEntry", "entry", ")", "{", "return", "toRosterItem", "(", "entry", ",", "entry", ".", "getName", "(", ")", ",", "false", ")", ";", "}" ]
Convert the RosterEntry to a Roster stanza &lt;item/&gt; element. @param entry the roster entry. @return the roster item.
[ "Convert", "the", "RosterEntry", "to", "a", "Roster", "stanza", "&lt", ";", "item", "/", "&gt", ";", "element", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java#L291-L293
liferay/com-liferay-commerce
commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountUsageEntryPersistenceImpl.java
CommerceDiscountUsageEntryPersistenceImpl.findByGroupId
@Override public List<CommerceDiscountUsageEntry> findByGroupId(long groupId) { """ Returns all the commerce discount usage entries where groupId = &#63;. @param groupId the group ID @return the matching commerce discount usage entries """ return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceDiscountUsageEntry> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceDiscountUsageEntry", ">", "findByGroupId", "(", "long", "groupId", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce discount usage entries where groupId = &#63;. @param groupId the group ID @return the matching commerce discount usage entries
[ "Returns", "all", "the", "commerce", "discount", "usage", "entries", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountUsageEntryPersistenceImpl.java#L124-L127
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.getAt
public static CharSequence getAt(CharSequence text, IntRange range) { """ Support the range subscript operator for CharSequence with IntRange @param text a CharSequence @param range an IntRange @return the subsequence CharSequence @since 1.0 """ return getAt(text, (Range) range); }
java
public static CharSequence getAt(CharSequence text, IntRange range) { return getAt(text, (Range) range); }
[ "public", "static", "CharSequence", "getAt", "(", "CharSequence", "text", ",", "IntRange", "range", ")", "{", "return", "getAt", "(", "text", ",", "(", "Range", ")", "range", ")", ";", "}" ]
Support the range subscript operator for CharSequence with IntRange @param text a CharSequence @param range an IntRange @return the subsequence CharSequence @since 1.0
[ "Support", "the", "range", "subscript", "operator", "for", "CharSequence", "with", "IntRange" ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1265-L1267
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/SubGraphPredicate.java
SubGraphPredicate.withInputSubgraph
public SubGraphPredicate withInputSubgraph(int inputNum, @NonNull OpPredicate opPredicate) { """ Require the subgraph to match the specified predicate for the specified input.<br> Note that this DOES add the specified input to part of the subgraph<br> i.e., the subgraph matches if the input matches the predicate, and when returning the SubGraph itself, the function for this input IS added to the SubGraph @param inputNum Input number @param opPredicate Predicate that the input must match @return This predicate with the additional requirement added """ opInputSubgraphPredicates.put(inputNum, opPredicate); return this; }
java
public SubGraphPredicate withInputSubgraph(int inputNum, @NonNull OpPredicate opPredicate){ opInputSubgraphPredicates.put(inputNum, opPredicate); return this; }
[ "public", "SubGraphPredicate", "withInputSubgraph", "(", "int", "inputNum", ",", "@", "NonNull", "OpPredicate", "opPredicate", ")", "{", "opInputSubgraphPredicates", ".", "put", "(", "inputNum", ",", "opPredicate", ")", ";", "return", "this", ";", "}" ]
Require the subgraph to match the specified predicate for the specified input.<br> Note that this DOES add the specified input to part of the subgraph<br> i.e., the subgraph matches if the input matches the predicate, and when returning the SubGraph itself, the function for this input IS added to the SubGraph @param inputNum Input number @param opPredicate Predicate that the input must match @return This predicate with the additional requirement added
[ "Require", "the", "subgraph", "to", "match", "the", "specified", "predicate", "for", "the", "specified", "input", ".", "<br", ">", "Note", "that", "this", "DOES", "add", "the", "specified", "input", "to", "part", "of", "the", "subgraph<br", ">", "i", ".", "e", ".", "the", "subgraph", "matches", "if", "the", "input", "matches", "the", "predicate", "and", "when", "returning", "the", "SubGraph", "itself", "the", "function", "for", "this", "input", "IS", "added", "to", "the", "SubGraph" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/SubGraphPredicate.java#L177-L180
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.notIn
public Where<T, ID> notIn(String columnName, Object... objects) throws SQLException { """ Same as {@link #in(String, Object...)} except with a NOT IN clause. """ return in(false, columnName, objects); }
java
public Where<T, ID> notIn(String columnName, Object... objects) throws SQLException { return in(false, columnName, objects); }
[ "public", "Where", "<", "T", ",", "ID", ">", "notIn", "(", "String", "columnName", ",", "Object", "...", "objects", ")", "throws", "SQLException", "{", "return", "in", "(", "false", ",", "columnName", ",", "objects", ")", ";", "}" ]
Same as {@link #in(String, Object...)} except with a NOT IN clause.
[ "Same", "as", "{" ]
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L241-L243
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValue.java
AnyValue.equalsAs
public <T> boolean equalsAs(Class<T> type, Object obj) { """ Compares this object value to specified specified value. When direct comparison gives negative results it converts values to type specified by type code and compare them again. @param type the Class type that defined the type of the result @param obj the value to be compared with. @return true when objects are equal and false otherwise. @see TypeConverter#toType(Class, Object) """ if (obj == null && _value == null) return true; if (obj == null || _value == null) return false; if (obj instanceof AnyValue) obj = ((AnyValue) obj)._value; T typedThisValue = TypeConverter.toType(type, _value); T typedValue = TypeConverter.toType(type, obj); if (typedThisValue == null && typedValue == null) return true; if (typedThisValue == null || typedValue == null) return false; return typedThisValue.equals(typedValue); }
java
public <T> boolean equalsAs(Class<T> type, Object obj) { if (obj == null && _value == null) return true; if (obj == null || _value == null) return false; if (obj instanceof AnyValue) obj = ((AnyValue) obj)._value; T typedThisValue = TypeConverter.toType(type, _value); T typedValue = TypeConverter.toType(type, obj); if (typedThisValue == null && typedValue == null) return true; if (typedThisValue == null || typedValue == null) return false; return typedThisValue.equals(typedValue); }
[ "public", "<", "T", ">", "boolean", "equalsAs", "(", "Class", "<", "T", ">", "type", ",", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", "&&", "_value", "==", "null", ")", "return", "true", ";", "if", "(", "obj", "==", "null", "||", "_value", "==", "null", ")", "return", "false", ";", "if", "(", "obj", "instanceof", "AnyValue", ")", "obj", "=", "(", "(", "AnyValue", ")", "obj", ")", ".", "_value", ";", "T", "typedThisValue", "=", "TypeConverter", ".", "toType", "(", "type", ",", "_value", ")", ";", "T", "typedValue", "=", "TypeConverter", ".", "toType", "(", "type", ",", "obj", ")", ";", "if", "(", "typedThisValue", "==", "null", "&&", "typedValue", "==", "null", ")", "return", "true", ";", "if", "(", "typedThisValue", "==", "null", "||", "typedValue", "==", "null", ")", "return", "false", ";", "return", "typedThisValue", ".", "equals", "(", "typedValue", ")", ";", "}" ]
Compares this object value to specified specified value. When direct comparison gives negative results it converts values to type specified by type code and compare them again. @param type the Class type that defined the type of the result @param obj the value to be compared with. @return true when objects are equal and false otherwise. @see TypeConverter#toType(Class, Object)
[ "Compares", "this", "object", "value", "to", "specified", "specified", "value", ".", "When", "direct", "comparison", "gives", "negative", "results", "it", "converts", "values", "to", "type", "specified", "by", "type", "code", "and", "compare", "them", "again", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValue.java#L507-L524
square/protoparser
src/main/java/com/squareup/protoparser/ProtoParser.java
ProtoParser.readList
private List<Object> readList() { """ Returns a list of values. This is similar to JSON with '[' and ']' surrounding the list and ',' separating values. """ if (readChar() != '[') throw new AssertionError(); List<Object> result = new ArrayList<>(); while (true) { if (peekChar() == ']') { // If we see the close brace, finish immediately. This handles [] and ,] cases. pos++; return result; } result.add(readKindAndValue().value()); char c = peekChar(); if (c == ',') { pos++; } else if (c != ']') { throw unexpected("expected ',' or ']'"); } } }
java
private List<Object> readList() { if (readChar() != '[') throw new AssertionError(); List<Object> result = new ArrayList<>(); while (true) { if (peekChar() == ']') { // If we see the close brace, finish immediately. This handles [] and ,] cases. pos++; return result; } result.add(readKindAndValue().value()); char c = peekChar(); if (c == ',') { pos++; } else if (c != ']') { throw unexpected("expected ',' or ']'"); } } }
[ "private", "List", "<", "Object", ">", "readList", "(", ")", "{", "if", "(", "readChar", "(", ")", "!=", "'", "'", ")", "throw", "new", "AssertionError", "(", ")", ";", "List", "<", "Object", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "while", "(", "true", ")", "{", "if", "(", "peekChar", "(", ")", "==", "'", "'", ")", "{", "// If we see the close brace, finish immediately. This handles [] and ,] cases.", "pos", "++", ";", "return", "result", ";", "}", "result", ".", "add", "(", "readKindAndValue", "(", ")", ".", "value", "(", ")", ")", ";", "char", "c", "=", "peekChar", "(", ")", ";", "if", "(", "c", "==", "'", "'", ")", "{", "pos", "++", ";", "}", "else", "if", "(", "c", "!=", "'", "'", ")", "{", "throw", "unexpected", "(", "\"expected ',' or ']'\"", ")", ";", "}", "}", "}" ]
Returns a list of values. This is similar to JSON with '[' and ']' surrounding the list and ',' separating values.
[ "Returns", "a", "list", "of", "values", ".", "This", "is", "similar", "to", "JSON", "with", "[", "and", "]", "surrounding", "the", "list", "and", "separating", "values", "." ]
train
https://github.com/square/protoparser/blob/8be66bb8fe6658b04741df0358daabca501f2524/src/main/java/com/squareup/protoparser/ProtoParser.java#L516-L535
baratine/baratine
kraken/src/main/java/com/caucho/v5/kraken/table/WatchServiceImpl.java
WatchServiceImpl.addWatch
public void addWatch(DatabaseWatch watch, TableKraken table, byte[] key, Result<Cancel> result) { """ /* XXX: private void onPodUpdate(PodBartender pod) { for (Map.Entry<TableKraken,Set<HashKey>> remoteKeys : _remoteKeys.entrySet()) { TableKraken table = remoteKeys.getKey(); if (! table.getTablePod().getPodName().equals(pod.name())) { continue; } for (HashKey hashKey : remoteKeys.getValue()) { table.addRemoteWatch(hashKey.getHash()); } } } """ WatchTable watchTable = getWatchTable(table); watchTable.addWatchLocal(watch, key); // bfs/112b // XXX: table.isKeyLocalCopy vs table.isKeyLocalPrimary // XXX: using copy because a copy server reads its own data directly // XXX: and the timing between a remote watch and the put can result in // XXX: the wrong version // XXX: (old) notify requires isKeyLocalOwner, otherwise the notify isn't propagated if (! table.isKeyLocalCopy(key)) { HashKey hashKey = HashKey.create(key); Set<HashKey> keys = _remoteKeys.get(table); if (keys == null) { keys = new HashSet<>(); _remoteKeys.put(table, keys); } if (! keys.contains(hashKey)) { table.addRemoteWatch(key); keys.add(hashKey); } // getWatchTable(table).addWatch(watch, key); } WatchHandle handle = new WatchHandle(table, key, watch); result.ok(_serviceRef.pin(handle).as(Cancel.class)); }
java
public void addWatch(DatabaseWatch watch, TableKraken table, byte[] key, Result<Cancel> result) { WatchTable watchTable = getWatchTable(table); watchTable.addWatchLocal(watch, key); // bfs/112b // XXX: table.isKeyLocalCopy vs table.isKeyLocalPrimary // XXX: using copy because a copy server reads its own data directly // XXX: and the timing between a remote watch and the put can result in // XXX: the wrong version // XXX: (old) notify requires isKeyLocalOwner, otherwise the notify isn't propagated if (! table.isKeyLocalCopy(key)) { HashKey hashKey = HashKey.create(key); Set<HashKey> keys = _remoteKeys.get(table); if (keys == null) { keys = new HashSet<>(); _remoteKeys.put(table, keys); } if (! keys.contains(hashKey)) { table.addRemoteWatch(key); keys.add(hashKey); } // getWatchTable(table).addWatch(watch, key); } WatchHandle handle = new WatchHandle(table, key, watch); result.ok(_serviceRef.pin(handle).as(Cancel.class)); }
[ "public", "void", "addWatch", "(", "DatabaseWatch", "watch", ",", "TableKraken", "table", ",", "byte", "[", "]", "key", ",", "Result", "<", "Cancel", ">", "result", ")", "{", "WatchTable", "watchTable", "=", "getWatchTable", "(", "table", ")", ";", "watchTable", ".", "addWatchLocal", "(", "watch", ",", "key", ")", ";", "// bfs/112b", "// XXX: table.isKeyLocalCopy vs table.isKeyLocalPrimary", "// XXX: using copy because a copy server reads its own data directly", "// XXX: and the timing between a remote watch and the put can result in", "// XXX: the wrong version", "// XXX: (old) notify requires isKeyLocalOwner, otherwise the notify isn't propagated", "if", "(", "!", "table", ".", "isKeyLocalCopy", "(", "key", ")", ")", "{", "HashKey", "hashKey", "=", "HashKey", ".", "create", "(", "key", ")", ";", "Set", "<", "HashKey", ">", "keys", "=", "_remoteKeys", ".", "get", "(", "table", ")", ";", "if", "(", "keys", "==", "null", ")", "{", "keys", "=", "new", "HashSet", "<>", "(", ")", ";", "_remoteKeys", ".", "put", "(", "table", ",", "keys", ")", ";", "}", "if", "(", "!", "keys", ".", "contains", "(", "hashKey", ")", ")", "{", "table", ".", "addRemoteWatch", "(", "key", ")", ";", "keys", ".", "add", "(", "hashKey", ")", ";", "}", "// getWatchTable(table).addWatch(watch, key);", "}", "WatchHandle", "handle", "=", "new", "WatchHandle", "(", "table", ",", "key", ",", "watch", ")", ";", "result", ".", "ok", "(", "_serviceRef", ".", "pin", "(", "handle", ")", ".", "as", "(", "Cancel", ".", "class", ")", ")", ";", "}" ]
/* XXX: private void onPodUpdate(PodBartender pod) { for (Map.Entry<TableKraken,Set<HashKey>> remoteKeys : _remoteKeys.entrySet()) { TableKraken table = remoteKeys.getKey(); if (! table.getTablePod().getPodName().equals(pod.name())) { continue; } for (HashKey hashKey : remoteKeys.getValue()) { table.addRemoteWatch(hashKey.getHash()); } } }
[ "/", "*", "XXX", ":", "private", "void", "onPodUpdate", "(", "PodBartender", "pod", ")", "{", "for", "(", "Map", ".", "Entry<TableKraken", "Set<HashKey", ">>", "remoteKeys", ":", "_remoteKeys", ".", "entrySet", "()", ")", "{", "TableKraken", "table", "=", "remoteKeys", ".", "getKey", "()", ";" ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kraken/table/WatchServiceImpl.java#L117-L155
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getItemData
public ItemData getItemData(QPath path) throws RepositoryException { """ Return item data by internal <b>qpath</b> in this transient storage then in workspace container. @param path - absolute path @return existed item data or null if not found @throws RepositoryException @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getItemData(String) """ NodeData parent = (NodeData)getItemData(Constants.ROOT_UUID); if (path.equals(Constants.ROOT_PATH)) { return parent; } QPathEntry[] relPathEntries = path.getRelPath(path.getDepth()); return getItemData(parent, relPathEntries, ItemType.UNKNOWN); }
java
public ItemData getItemData(QPath path) throws RepositoryException { NodeData parent = (NodeData)getItemData(Constants.ROOT_UUID); if (path.equals(Constants.ROOT_PATH)) { return parent; } QPathEntry[] relPathEntries = path.getRelPath(path.getDepth()); return getItemData(parent, relPathEntries, ItemType.UNKNOWN); }
[ "public", "ItemData", "getItemData", "(", "QPath", "path", ")", "throws", "RepositoryException", "{", "NodeData", "parent", "=", "(", "NodeData", ")", "getItemData", "(", "Constants", ".", "ROOT_UUID", ")", ";", "if", "(", "path", ".", "equals", "(", "Constants", ".", "ROOT_PATH", ")", ")", "{", "return", "parent", ";", "}", "QPathEntry", "[", "]", "relPathEntries", "=", "path", ".", "getRelPath", "(", "path", ".", "getDepth", "(", ")", ")", ";", "return", "getItemData", "(", "parent", ",", "relPathEntries", ",", "ItemType", ".", "UNKNOWN", ")", ";", "}" ]
Return item data by internal <b>qpath</b> in this transient storage then in workspace container. @param path - absolute path @return existed item data or null if not found @throws RepositoryException @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getItemData(String)
[ "Return", "item", "data", "by", "internal", "<b", ">", "qpath<", "/", "b", ">", "in", "this", "transient", "storage", "then", "in", "workspace", "container", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L152-L165
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.optionalDoubleAttribute
public static double optionalDoubleAttribute( final XMLStreamReader reader, final String localName, final double defaultValue) { """ Returns the value of an attribute as a double. If the attribute is empty, this method returns the default value provided. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @param defaultValue default value @return value of attribute, or the default value if the attribute is empty. """ return optionalDoubleAttribute(reader, null, localName, defaultValue); }
java
public static double optionalDoubleAttribute( final XMLStreamReader reader, final String localName, final double defaultValue) { return optionalDoubleAttribute(reader, null, localName, defaultValue); }
[ "public", "static", "double", "optionalDoubleAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "localName", ",", "final", "double", "defaultValue", ")", "{", "return", "optionalDoubleAttribute", "(", "reader", ",", "null", ",", "localName", ",", "defaultValue", ")", ";", "}" ]
Returns the value of an attribute as a double. If the attribute is empty, this method returns the default value provided. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @param defaultValue default value @return value of attribute, or the default value if the attribute is empty.
[ "Returns", "the", "value", "of", "an", "attribute", "as", "a", "double", ".", "If", "the", "attribute", "is", "empty", "this", "method", "returns", "the", "default", "value", "provided", "." ]
train
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L707-L712
alibaba/jstorm
jstorm-core/src/main/java/com/alibaba/jstorm/message/netty/NettyServer.java
NettyServer.recv
public Object recv(Integer taskId, int flags) { """ fetch a message from message queue synchronously (flags != 1) or asynchronously (flags==1) """ try { DisruptorQueue recvQueue = deserializeQueues.get(taskId); if ((flags & 0x01) == 0x01) { return recvQueue.poll(); // non-blocking } else { return recvQueue.take(); } } catch (Exception e) { LOG.warn("Unknown exception ", e); return null; } }
java
public Object recv(Integer taskId, int flags) { try { DisruptorQueue recvQueue = deserializeQueues.get(taskId); if ((flags & 0x01) == 0x01) { return recvQueue.poll(); // non-blocking } else { return recvQueue.take(); } } catch (Exception e) { LOG.warn("Unknown exception ", e); return null; } }
[ "public", "Object", "recv", "(", "Integer", "taskId", ",", "int", "flags", ")", "{", "try", "{", "DisruptorQueue", "recvQueue", "=", "deserializeQueues", ".", "get", "(", "taskId", ")", ";", "if", "(", "(", "flags", "&", "0x01", ")", "==", "0x01", ")", "{", "return", "recvQueue", ".", "poll", "(", ")", ";", "// non-blocking", "}", "else", "{", "return", "recvQueue", ".", "take", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "warn", "(", "\"Unknown exception \"", ",", "e", ")", ";", "return", "null", ";", "}", "}" ]
fetch a message from message queue synchronously (flags != 1) or asynchronously (flags==1)
[ "fetch", "a", "message", "from", "message", "queue", "synchronously", "(", "flags", "!", "=", "1", ")", "or", "asynchronously", "(", "flags", "==", "1", ")" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/message/netty/NettyServer.java#L164-L177
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/TaskContext.java
TaskContext.getWriterOutputFormat
public WriterOutputFormat getWriterOutputFormat(int branches, int index) { """ Get the output format of the writer of type {@link WriterOutputFormat}. @param branches number of forked branches @param index branch index @return output format of the writer """ String writerOutputFormatValue = this.taskState.getProp( ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_OUTPUT_FORMAT_KEY, branches, index), WriterOutputFormat.OTHER.name()); log.debug("Found writer output format value = {}", writerOutputFormatValue); WriterOutputFormat wof = Enums.getIfPresent(WriterOutputFormat.class, writerOutputFormatValue.toUpperCase()) .or(WriterOutputFormat.OTHER); log.debug("Returning writer output format = {}", wof); return wof; }
java
public WriterOutputFormat getWriterOutputFormat(int branches, int index) { String writerOutputFormatValue = this.taskState.getProp( ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_OUTPUT_FORMAT_KEY, branches, index), WriterOutputFormat.OTHER.name()); log.debug("Found writer output format value = {}", writerOutputFormatValue); WriterOutputFormat wof = Enums.getIfPresent(WriterOutputFormat.class, writerOutputFormatValue.toUpperCase()) .or(WriterOutputFormat.OTHER); log.debug("Returning writer output format = {}", wof); return wof; }
[ "public", "WriterOutputFormat", "getWriterOutputFormat", "(", "int", "branches", ",", "int", "index", ")", "{", "String", "writerOutputFormatValue", "=", "this", ".", "taskState", ".", "getProp", "(", "ForkOperatorUtils", ".", "getPropertyNameForBranch", "(", "ConfigurationKeys", ".", "WRITER_OUTPUT_FORMAT_KEY", ",", "branches", ",", "index", ")", ",", "WriterOutputFormat", ".", "OTHER", ".", "name", "(", ")", ")", ";", "log", ".", "debug", "(", "\"Found writer output format value = {}\"", ",", "writerOutputFormatValue", ")", ";", "WriterOutputFormat", "wof", "=", "Enums", ".", "getIfPresent", "(", "WriterOutputFormat", ".", "class", ",", "writerOutputFormatValue", ".", "toUpperCase", "(", ")", ")", ".", "or", "(", "WriterOutputFormat", ".", "OTHER", ")", ";", "log", ".", "debug", "(", "\"Returning writer output format = {}\"", ",", "wof", ")", ";", "return", "wof", ";", "}" ]
Get the output format of the writer of type {@link WriterOutputFormat}. @param branches number of forked branches @param index branch index @return output format of the writer
[ "Get", "the", "output", "format", "of", "the", "writer", "of", "type", "{", "@link", "WriterOutputFormat", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/TaskContext.java#L174-L184
redfish4ktc/maven-soapui-extension-plugin
src/main/java/org/ktc/soapui/maven/extension/impl/runner/SoapUIExtensionMockAsWarGenerator.java
SoapUIExtensionMockAsWarGenerator.runRunner
@Override protected boolean runRunner() throws Exception { """ we should provide a PR to let us inject implementation of the MockAsWar """ WsdlProject project = (WsdlProject) ProjectFactoryRegistry.getProjectFactory("wsdl").createNew( getProjectFile(), getProjectPassword()); String pFile = getProjectFile(); project.getSettings().setString(ProjectSettings.SHADOW_PASSWORD, null); File tmpProjectFile = new File(System.getProperty("java.io.tmpdir")); tmpProjectFile = new File(tmpProjectFile, project.getName() + "-project.xml"); project.beforeSave(); project.saveIn(tmpProjectFile); pFile = tmpProjectFile.getAbsolutePath(); String endpoint = (StringUtils.hasContent(this.getLocalEndpoint())) ? this.getLocalEndpoint() : project .getName(); this.log.info("Creating WAR file with endpoint [" + endpoint + "]"); // TODO the temporary file should be removed at the end of the process MockAsWarExtension mockAsWar = new MockAsWarExtension(pFile, getSettingsFile(), getOutputFolder(), this.getWarFile(), this.isIncludeLibraries(), this.isIncludeActions(), this.isIncludeListeners(), endpoint, this.isEnableWebUI()); mockAsWar.createMockAsWarArchive(); this.log.info("WAR Generation complete"); return true; }
java
@Override protected boolean runRunner() throws Exception { WsdlProject project = (WsdlProject) ProjectFactoryRegistry.getProjectFactory("wsdl").createNew( getProjectFile(), getProjectPassword()); String pFile = getProjectFile(); project.getSettings().setString(ProjectSettings.SHADOW_PASSWORD, null); File tmpProjectFile = new File(System.getProperty("java.io.tmpdir")); tmpProjectFile = new File(tmpProjectFile, project.getName() + "-project.xml"); project.beforeSave(); project.saveIn(tmpProjectFile); pFile = tmpProjectFile.getAbsolutePath(); String endpoint = (StringUtils.hasContent(this.getLocalEndpoint())) ? this.getLocalEndpoint() : project .getName(); this.log.info("Creating WAR file with endpoint [" + endpoint + "]"); // TODO the temporary file should be removed at the end of the process MockAsWarExtension mockAsWar = new MockAsWarExtension(pFile, getSettingsFile(), getOutputFolder(), this.getWarFile(), this.isIncludeLibraries(), this.isIncludeActions(), this.isIncludeListeners(), endpoint, this.isEnableWebUI()); mockAsWar.createMockAsWarArchive(); this.log.info("WAR Generation complete"); return true; }
[ "@", "Override", "protected", "boolean", "runRunner", "(", ")", "throws", "Exception", "{", "WsdlProject", "project", "=", "(", "WsdlProject", ")", "ProjectFactoryRegistry", ".", "getProjectFactory", "(", "\"wsdl\"", ")", ".", "createNew", "(", "getProjectFile", "(", ")", ",", "getProjectPassword", "(", ")", ")", ";", "String", "pFile", "=", "getProjectFile", "(", ")", ";", "project", ".", "getSettings", "(", ")", ".", "setString", "(", "ProjectSettings", ".", "SHADOW_PASSWORD", ",", "null", ")", ";", "File", "tmpProjectFile", "=", "new", "File", "(", "System", ".", "getProperty", "(", "\"java.io.tmpdir\"", ")", ")", ";", "tmpProjectFile", "=", "new", "File", "(", "tmpProjectFile", ",", "project", ".", "getName", "(", ")", "+", "\"-project.xml\"", ")", ";", "project", ".", "beforeSave", "(", ")", ";", "project", ".", "saveIn", "(", "tmpProjectFile", ")", ";", "pFile", "=", "tmpProjectFile", ".", "getAbsolutePath", "(", ")", ";", "String", "endpoint", "=", "(", "StringUtils", ".", "hasContent", "(", "this", ".", "getLocalEndpoint", "(", ")", ")", ")", "?", "this", ".", "getLocalEndpoint", "(", ")", ":", "project", ".", "getName", "(", ")", ";", "this", ".", "log", ".", "info", "(", "\"Creating WAR file with endpoint [\"", "+", "endpoint", "+", "\"]\"", ")", ";", "// TODO the temporary file should be removed at the end of the process", "MockAsWarExtension", "mockAsWar", "=", "new", "MockAsWarExtension", "(", "pFile", ",", "getSettingsFile", "(", ")", ",", "getOutputFolder", "(", ")", ",", "this", ".", "getWarFile", "(", ")", ",", "this", ".", "isIncludeLibraries", "(", ")", ",", "this", ".", "isIncludeActions", "(", ")", ",", "this", ".", "isIncludeListeners", "(", ")", ",", "endpoint", ",", "this", ".", "isEnableWebUI", "(", ")", ")", ";", "mockAsWar", ".", "createMockAsWarArchive", "(", ")", ";", "this", ".", "log", ".", "info", "(", "\"WAR Generation complete\"", ")", ";", "return", "true", ";", "}" ]
we should provide a PR to let us inject implementation of the MockAsWar
[ "we", "should", "provide", "a", "PR", "to", "let", "us", "inject", "implementation", "of", "the", "MockAsWar" ]
train
https://github.com/redfish4ktc/maven-soapui-extension-plugin/blob/556f0e6b2bd1db82feae0e3523a1eb0873fafebd/src/main/java/org/ktc/soapui/maven/extension/impl/runner/SoapUIExtensionMockAsWarGenerator.java#L40-L70
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/ChangeFocusOnChangeHandler.java
ChangeFocusOnChangeHandler.syncClonedListener
public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { """ Set this cloned listener to the same state at this listener. @param field The field this new listener will be added to. @param The new listener to sync to this. @param Has the init method been called? @return True if I called init. """ if (!bInitCalled) ((ChangeFocusOnChangeHandler)listener).init(null, m_screenField, m_fldTarget); bInitCalled = super.syncClonedListener(field, listener, true); ((ChangeFocusOnChangeHandler)listener).setChangeFocusIfNull(m_bChangeIfNull); return bInitCalled; }
java
public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { if (!bInitCalled) ((ChangeFocusOnChangeHandler)listener).init(null, m_screenField, m_fldTarget); bInitCalled = super.syncClonedListener(field, listener, true); ((ChangeFocusOnChangeHandler)listener).setChangeFocusIfNull(m_bChangeIfNull); return bInitCalled; }
[ "public", "boolean", "syncClonedListener", "(", "BaseField", "field", ",", "FieldListener", "listener", ",", "boolean", "bInitCalled", ")", "{", "if", "(", "!", "bInitCalled", ")", "(", "(", "ChangeFocusOnChangeHandler", ")", "listener", ")", ".", "init", "(", "null", ",", "m_screenField", ",", "m_fldTarget", ")", ";", "bInitCalled", "=", "super", ".", "syncClonedListener", "(", "field", ",", "listener", ",", "true", ")", ";", "(", "(", "ChangeFocusOnChangeHandler", ")", "listener", ")", ".", "setChangeFocusIfNull", "(", "m_bChangeIfNull", ")", ";", "return", "bInitCalled", ";", "}" ]
Set this cloned listener to the same state at this listener. @param field The field this new listener will be added to. @param The new listener to sync to this. @param Has the init method been called? @return True if I called init.
[ "Set", "this", "cloned", "listener", "to", "the", "same", "state", "at", "this", "listener", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ChangeFocusOnChangeHandler.java#L87-L94
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImagesInner.java
ImagesInner.getByResourceGroup
public ImageInner getByResourceGroup(String resourceGroupName, String imageName, String expand) { """ Gets an image. @param resourceGroupName The name of the resource group. @param imageName The name of the image. @param expand The expand expression to apply on the operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ImageInner object if successful. """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, imageName, expand).toBlocking().single().body(); }
java
public ImageInner getByResourceGroup(String resourceGroupName, String imageName, String expand) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, imageName, expand).toBlocking().single().body(); }
[ "public", "ImageInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "imageName", ",", "String", "expand", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "imageName", ",", "expand", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets an image. @param resourceGroupName The name of the resource group. @param imageName The name of the image. @param expand The expand expression to apply on the operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ImageInner object if successful.
[ "Gets", "an", "image", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImagesInner.java#L525-L527
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java
SqlFunctionUtils.parseUrl
public static String parseUrl(String urlStr, String partToExtract, String key) { """ Parse url and return various parameter of the URL. If accept any null arguments, return null. @param urlStr URL string. @param partToExtract must be QUERY, or return null. @param key parameter name. @return target value. """ if (!"QUERY".equals(partToExtract)) { return null; } String query = parseUrl(urlStr, partToExtract); if (query == null) { return null; } Pattern p = Pattern.compile("(&|^)" + Pattern.quote(key) + "=([^&]*)"); Matcher m = p.matcher(query); if (m.find()) { return m.group(2); } return null; }
java
public static String parseUrl(String urlStr, String partToExtract, String key) { if (!"QUERY".equals(partToExtract)) { return null; } String query = parseUrl(urlStr, partToExtract); if (query == null) { return null; } Pattern p = Pattern.compile("(&|^)" + Pattern.quote(key) + "=([^&]*)"); Matcher m = p.matcher(query); if (m.find()) { return m.group(2); } return null; }
[ "public", "static", "String", "parseUrl", "(", "String", "urlStr", ",", "String", "partToExtract", ",", "String", "key", ")", "{", "if", "(", "!", "\"QUERY\"", ".", "equals", "(", "partToExtract", ")", ")", "{", "return", "null", ";", "}", "String", "query", "=", "parseUrl", "(", "urlStr", ",", "partToExtract", ")", ";", "if", "(", "query", "==", "null", ")", "{", "return", "null", ";", "}", "Pattern", "p", "=", "Pattern", ".", "compile", "(", "\"(&|^)\"", "+", "Pattern", ".", "quote", "(", "key", ")", "+", "\"=([^&]*)\"", ")", ";", "Matcher", "m", "=", "p", ".", "matcher", "(", "query", ")", ";", "if", "(", "m", ".", "find", "(", ")", ")", "{", "return", "m", ".", "group", "(", "2", ")", ";", "}", "return", "null", ";", "}" ]
Parse url and return various parameter of the URL. If accept any null arguments, return null. @param urlStr URL string. @param partToExtract must be QUERY, or return null. @param key parameter name. @return target value.
[ "Parse", "url", "and", "return", "various", "parameter", "of", "the", "URL", ".", "If", "accept", "any", "null", "arguments", "return", "null", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java#L556-L572
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToTextStream.java
ToTextStream.charactersRaw
public void charactersRaw(char ch[], int start, int length) throws org.xml.sax.SAXException { """ If available, when the disable-output-escaping attribute is used, output raw text without escaping. @param ch The characters from the XML document. @param start The start position in the array. @param length The number of characters to read from the array. @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception. """ try { writeNormalizedChars(ch, start, length, m_lineSepUse); } catch(IOException ioe) { throw new SAXException(ioe); } }
java
public void charactersRaw(char ch[], int start, int length) throws org.xml.sax.SAXException { try { writeNormalizedChars(ch, start, length, m_lineSepUse); } catch(IOException ioe) { throw new SAXException(ioe); } }
[ "public", "void", "charactersRaw", "(", "char", "ch", "[", "]", ",", "int", "start", ",", "int", "length", ")", "throws", "org", ".", "xml", ".", "sax", ".", "SAXException", "{", "try", "{", "writeNormalizedChars", "(", "ch", ",", "start", ",", "length", ",", "m_lineSepUse", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "new", "SAXException", "(", "ioe", ")", ";", "}", "}" ]
If available, when the disable-output-escaping attribute is used, output raw text without escaping. @param ch The characters from the XML document. @param start The start position in the array. @param length The number of characters to read from the array. @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
[ "If", "available", "when", "the", "disable", "-", "output", "-", "escaping", "attribute", "is", "used", "output", "raw", "text", "without", "escaping", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToTextStream.java#L242-L254
di2e/Argo
Responder/ResponderDaemon/src/main/java/ws/argo/responder/transport/sns/SNSListener.java
SNSListener.startServer
public static HttpServer startServer(URI uri, AmazonSNSTransport t) throws IOException { """ Start the ResponseListener client. This largely includes starting at Grizzly 2 server. @param uri the uri of the service @param t the link to the transport associated with this listener @return a new HttpServer @throws IOException if something goes wrong creating the http server """ ResourceConfig resourceConfig = new ResourceConfig(); resourceConfig.registerInstances(new SNSListenerResource(t)); resourceConfig.setApplicationName("Argo AmazonSNSTransport"); // ResourceConfig resourceConfig = new ResourceConfig().packages("ws.argo.responder.transport.sns"); LOGGER.debug("Starting Jersey-Grizzly2 JAX-RS listener..."); HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer(uri, resourceConfig, false); httpServer.getServerConfiguration().setName("SNS Listener"); httpServer.start(); LOGGER.info("Started Jersey-Grizzly2 JAX-RS listener."); return httpServer; }
java
public static HttpServer startServer(URI uri, AmazonSNSTransport t) throws IOException { ResourceConfig resourceConfig = new ResourceConfig(); resourceConfig.registerInstances(new SNSListenerResource(t)); resourceConfig.setApplicationName("Argo AmazonSNSTransport"); // ResourceConfig resourceConfig = new ResourceConfig().packages("ws.argo.responder.transport.sns"); LOGGER.debug("Starting Jersey-Grizzly2 JAX-RS listener..."); HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer(uri, resourceConfig, false); httpServer.getServerConfiguration().setName("SNS Listener"); httpServer.start(); LOGGER.info("Started Jersey-Grizzly2 JAX-RS listener."); return httpServer; }
[ "public", "static", "HttpServer", "startServer", "(", "URI", "uri", ",", "AmazonSNSTransport", "t", ")", "throws", "IOException", "{", "ResourceConfig", "resourceConfig", "=", "new", "ResourceConfig", "(", ")", ";", "resourceConfig", ".", "registerInstances", "(", "new", "SNSListenerResource", "(", "t", ")", ")", ";", "resourceConfig", ".", "setApplicationName", "(", "\"Argo AmazonSNSTransport\"", ")", ";", "// ResourceConfig resourceConfig = new ResourceConfig().packages(\"ws.argo.responder.transport.sns\");", "LOGGER", ".", "debug", "(", "\"Starting Jersey-Grizzly2 JAX-RS listener...\"", ")", ";", "HttpServer", "httpServer", "=", "GrizzlyHttpServerFactory", ".", "createHttpServer", "(", "uri", ",", "resourceConfig", ",", "false", ")", ";", "httpServer", ".", "getServerConfiguration", "(", ")", ".", "setName", "(", "\"SNS Listener\"", ")", ";", "httpServer", ".", "start", "(", ")", ";", "LOGGER", ".", "info", "(", "\"Started Jersey-Grizzly2 JAX-RS listener.\"", ")", ";", "return", "httpServer", ";", "}" ]
Start the ResponseListener client. This largely includes starting at Grizzly 2 server. @param uri the uri of the service @param t the link to the transport associated with this listener @return a new HttpServer @throws IOException if something goes wrong creating the http server
[ "Start", "the", "ResponseListener", "client", ".", "This", "largely", "includes", "starting", "at", "Grizzly", "2", "server", "." ]
train
https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/transport/sns/SNSListener.java#L74-L91
wnameless/rubycollect4j
src/main/java/net/sf/rubycollect4j/util/ByteUtils.java
ByteUtils.toExtendedASCIIs
public static String toExtendedASCIIs(byte[] bytes, int n, ByteOrder bo) { """ Converts a byte array into an ASCII String. @param bytes used to be converted @param n length of ASCII String @param bo a ByteOrder @return ASCII String """ RubyArray<String> ra = Ruby.Array.create(); if (bo == LITTLE_ENDIAN) { for (int i = 0; i < n; i++) { if (i >= bytes.length) { ra.push("\0"); continue; } byte b = bytes[i]; ra.push(toASCII8Bit(b)); } return ra.join(); } else { for (int i = bytes.length - 1; n > 0; i--) { if (i < 0) { ra.unshift("\0"); n--; continue; } byte b = bytes[i]; ra.unshift(toASCII8Bit(b)); n--; } return ra.join(); } }
java
public static String toExtendedASCIIs(byte[] bytes, int n, ByteOrder bo) { RubyArray<String> ra = Ruby.Array.create(); if (bo == LITTLE_ENDIAN) { for (int i = 0; i < n; i++) { if (i >= bytes.length) { ra.push("\0"); continue; } byte b = bytes[i]; ra.push(toASCII8Bit(b)); } return ra.join(); } else { for (int i = bytes.length - 1; n > 0; i--) { if (i < 0) { ra.unshift("\0"); n--; continue; } byte b = bytes[i]; ra.unshift(toASCII8Bit(b)); n--; } return ra.join(); } }
[ "public", "static", "String", "toExtendedASCIIs", "(", "byte", "[", "]", "bytes", ",", "int", "n", ",", "ByteOrder", "bo", ")", "{", "RubyArray", "<", "String", ">", "ra", "=", "Ruby", ".", "Array", ".", "create", "(", ")", ";", "if", "(", "bo", "==", "LITTLE_ENDIAN", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "if", "(", "i", ">=", "bytes", ".", "length", ")", "{", "ra", ".", "push", "(", "\"\\0\"", ")", ";", "continue", ";", "}", "byte", "b", "=", "bytes", "[", "i", "]", ";", "ra", ".", "push", "(", "toASCII8Bit", "(", "b", ")", ")", ";", "}", "return", "ra", ".", "join", "(", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "bytes", ".", "length", "-", "1", ";", "n", ">", "0", ";", "i", "--", ")", "{", "if", "(", "i", "<", "0", ")", "{", "ra", ".", "unshift", "(", "\"\\0\"", ")", ";", "n", "--", ";", "continue", ";", "}", "byte", "b", "=", "bytes", "[", "i", "]", ";", "ra", ".", "unshift", "(", "toASCII8Bit", "(", "b", ")", ")", ";", "n", "--", ";", "}", "return", "ra", ".", "join", "(", ")", ";", "}", "}" ]
Converts a byte array into an ASCII String. @param bytes used to be converted @param n length of ASCII String @param bo a ByteOrder @return ASCII String
[ "Converts", "a", "byte", "array", "into", "an", "ASCII", "String", "." ]
train
https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/util/ByteUtils.java#L398-L423
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/render/R.java
R.renderChildren
public static void renderChildren(FacesContext fc, UIComponent component) throws IOException { """ Renders the Childrens of a Component @param fc @param component @throws IOException """ for (Iterator<UIComponent> iterator = component.getChildren().iterator(); iterator.hasNext();) { UIComponent child = (UIComponent) iterator.next(); renderChild(fc, child); } }
java
public static void renderChildren(FacesContext fc, UIComponent component) throws IOException { for (Iterator<UIComponent> iterator = component.getChildren().iterator(); iterator.hasNext();) { UIComponent child = (UIComponent) iterator.next(); renderChild(fc, child); } }
[ "public", "static", "void", "renderChildren", "(", "FacesContext", "fc", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "for", "(", "Iterator", "<", "UIComponent", ">", "iterator", "=", "component", ".", "getChildren", "(", ")", ".", "iterator", "(", ")", ";", "iterator", ".", "hasNext", "(", ")", ";", ")", "{", "UIComponent", "child", "=", "(", "UIComponent", ")", "iterator", ".", "next", "(", ")", ";", "renderChild", "(", "fc", ",", "child", ")", ";", "}", "}" ]
Renders the Childrens of a Component @param fc @param component @throws IOException
[ "Renders", "the", "Childrens", "of", "a", "Component" ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L332-L337
hdbeukel/james-core
src/main/java/org/jamesframework/core/util/SetUtilities.java
SetUtilities.getRandomSubset
public static <T> Set<T> getRandomSubset(Set<? extends T> set, int size, Random rg) { """ <p> Selects a random subset of a specific size from a given set (uniformly distributed). Applies a full scan algorithm that iterates once through the given set and selects each item with probability (#remaining to select)/(#remaining to scan). It can be proven that this algorithm creates uniformly distributed random subsets (for example, a proof is given <a href="http://eyalsch.wordpress.com/2010/04/01/random-sample">here</a>). In the worst case, this algorithm has linear time complexity with respect to the size of the given set. </p> <p> The generated subset is stored in a newly allocated {@link LinkedHashSet}. </p> @see <a href="http://eyalsch.wordpress.com/2010/04/01/random-sample">http://eyalsch.wordpress.com/2010/04/01/random-sample</a> @param <T> type of elements in randomly selected subset @param set set from which a random subset is to be selected @param size desired subset size, should be a number in [0,|set|] @param rg random generator @throws IllegalArgumentException if an invalid subset size outside [0,|set|] is specified @return random subset stored in a newly allocated {@link LinkedHashSet}. """ Set<T> subset = new LinkedHashSet<>(); getRandomSubset(set, size, rg, subset); return subset; }
java
public static <T> Set<T> getRandomSubset(Set<? extends T> set, int size, Random rg) { Set<T> subset = new LinkedHashSet<>(); getRandomSubset(set, size, rg, subset); return subset; }
[ "public", "static", "<", "T", ">", "Set", "<", "T", ">", "getRandomSubset", "(", "Set", "<", "?", "extends", "T", ">", "set", ",", "int", "size", ",", "Random", "rg", ")", "{", "Set", "<", "T", ">", "subset", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "getRandomSubset", "(", "set", ",", "size", ",", "rg", ",", "subset", ")", ";", "return", "subset", ";", "}" ]
<p> Selects a random subset of a specific size from a given set (uniformly distributed). Applies a full scan algorithm that iterates once through the given set and selects each item with probability (#remaining to select)/(#remaining to scan). It can be proven that this algorithm creates uniformly distributed random subsets (for example, a proof is given <a href="http://eyalsch.wordpress.com/2010/04/01/random-sample">here</a>). In the worst case, this algorithm has linear time complexity with respect to the size of the given set. </p> <p> The generated subset is stored in a newly allocated {@link LinkedHashSet}. </p> @see <a href="http://eyalsch.wordpress.com/2010/04/01/random-sample">http://eyalsch.wordpress.com/2010/04/01/random-sample</a> @param <T> type of elements in randomly selected subset @param set set from which a random subset is to be selected @param size desired subset size, should be a number in [0,|set|] @param rg random generator @throws IllegalArgumentException if an invalid subset size outside [0,|set|] is specified @return random subset stored in a newly allocated {@link LinkedHashSet}.
[ "<p", ">", "Selects", "a", "random", "subset", "of", "a", "specific", "size", "from", "a", "given", "set", "(", "uniformly", "distributed", ")", ".", "Applies", "a", "full", "scan", "algorithm", "that", "iterates", "once", "through", "the", "given", "set", "and", "selects", "each", "item", "with", "probability", "(", "#remaining", "to", "select", ")", "/", "(", "#remaining", "to", "scan", ")", ".", "It", "can", "be", "proven", "that", "this", "algorithm", "creates", "uniformly", "distributed", "random", "subsets", "(", "for", "example", "a", "proof", "is", "given", "<a", "href", "=", "http", ":", "//", "eyalsch", ".", "wordpress", ".", "com", "/", "2010", "/", "04", "/", "01", "/", "random", "-", "sample", ">", "here<", "/", "a", ">", ")", ".", "In", "the", "worst", "case", "this", "algorithm", "has", "linear", "time", "complexity", "with", "respect", "to", "the", "size", "of", "the", "given", "set", ".", "<", "/", "p", ">", "<p", ">", "The", "generated", "subset", "is", "stored", "in", "a", "newly", "allocated", "{", "@link", "LinkedHashSet", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/util/SetUtilities.java#L126-L130
autermann/yaml
src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java
YamlMappingNode.put
public T put(YamlNode key, DateTime value) { """ Adds the specified {@code key}/{@code value} pair to this mapping. @param key the key @param value the value @return {@code this} """ return put(key, getNodeFactory().dateTimeNode(value)); }
java
public T put(YamlNode key, DateTime value) { return put(key, getNodeFactory().dateTimeNode(value)); }
[ "public", "T", "put", "(", "YamlNode", "key", ",", "DateTime", "value", ")", "{", "return", "put", "(", "key", ",", "getNodeFactory", "(", ")", ".", "dateTimeNode", "(", "value", ")", ")", ";", "}" ]
Adds the specified {@code key}/{@code value} pair to this mapping. @param key the key @param value the value @return {@code this}
[ "Adds", "the", "specified", "{", "@code", "key", "}", "/", "{", "@code", "value", "}", "pair", "to", "this", "mapping", "." ]
train
https://github.com/autermann/yaml/blob/5f8ab03e4fec3a2abe72c03561cdaa3a3936634d/src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java#L756-L758
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/unbbayes/ShanksAgentBayesianReasoningCapability.java
ShanksAgentBayesianReasoningCapability.clearEvidence
public static void clearEvidence(ProbabilisticNetwork bn, String nodeName) throws ShanksException { """ Clear a hard evidence fixed in a given node /** @param bn @param nodeName @throws ShanksException """ ProbabilisticNode node = (ProbabilisticNode) bn.getNode(nodeName); ShanksAgentBayesianReasoningCapability.clearEvidence(bn, node); }
java
public static void clearEvidence(ProbabilisticNetwork bn, String nodeName) throws ShanksException { ProbabilisticNode node = (ProbabilisticNode) bn.getNode(nodeName); ShanksAgentBayesianReasoningCapability.clearEvidence(bn, node); }
[ "public", "static", "void", "clearEvidence", "(", "ProbabilisticNetwork", "bn", ",", "String", "nodeName", ")", "throws", "ShanksException", "{", "ProbabilisticNode", "node", "=", "(", "ProbabilisticNode", ")", "bn", ".", "getNode", "(", "nodeName", ")", ";", "ShanksAgentBayesianReasoningCapability", ".", "clearEvidence", "(", "bn", ",", "node", ")", ";", "}" ]
Clear a hard evidence fixed in a given node /** @param bn @param nodeName @throws ShanksException
[ "Clear", "a", "hard", "evidence", "fixed", "in", "a", "given", "node" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/unbbayes/ShanksAgentBayesianReasoningCapability.java#L327-L331
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/HomeResourcesImpl.java
HomeResourcesImpl.getHome
public Home getHome(EnumSet<SourceInclusion> includes, EnumSet<SourceExclusion> excludes) throws SmartsheetException { """ Get a nested list of all Home objects, including sheets, workspaces and folders, and optionally reports and/or templates, as shown on the Home tab.. It mirrors to the following Smartsheet REST API method: GET /home Exceptions: InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation @param includes used to specify the optional objects to include, currently TEMPLATES is supported. @return the resource (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception """ HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); parameters.put("exclude", QueryUtil.generateCommaSeparatedList(excludes)); String path = QueryUtil.generateUrl("home", parameters); return this.getResource(path, Home.class); }
java
public Home getHome(EnumSet<SourceInclusion> includes, EnumSet<SourceExclusion> excludes) throws SmartsheetException { HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); parameters.put("exclude", QueryUtil.generateCommaSeparatedList(excludes)); String path = QueryUtil.generateUrl("home", parameters); return this.getResource(path, Home.class); }
[ "public", "Home", "getHome", "(", "EnumSet", "<", "SourceInclusion", ">", "includes", ",", "EnumSet", "<", "SourceExclusion", ">", "excludes", ")", "throws", "SmartsheetException", "{", "HashMap", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"include\"", ",", "QueryUtil", ".", "generateCommaSeparatedList", "(", "includes", ")", ")", ";", "parameters", ".", "put", "(", "\"exclude\"", ",", "QueryUtil", ".", "generateCommaSeparatedList", "(", "excludes", ")", ")", ";", "String", "path", "=", "QueryUtil", ".", "generateUrl", "(", "\"home\"", ",", "parameters", ")", ";", "return", "this", ".", "getResource", "(", "path", ",", "Home", ".", "class", ")", ";", "}" ]
Get a nested list of all Home objects, including sheets, workspaces and folders, and optionally reports and/or templates, as shown on the Home tab.. It mirrors to the following Smartsheet REST API method: GET /home Exceptions: InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation @param includes used to specify the optional objects to include, currently TEMPLATES is supported. @return the resource (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception
[ "Get", "a", "nested", "list", "of", "all", "Home", "objects", "including", "sheets", "workspaces", "and", "folders", "and", "optionally", "reports", "and", "/", "or", "templates", "as", "shown", "on", "the", "Home", "tab", ".." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/HomeResourcesImpl.java#L102-L111
craterdog/java-security-framework
java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java
CertificateManager.retrieveKeyStore
public final KeyStore retrieveKeyStore(InputStream input, char[] password) throws IOException { """ This method retrieves a PKCS12 format key store from an input stream. @param input The input stream from which to read the key store. @param password The password that was used to encrypt the file. @return The PKCS12 format key store. @throws java.io.IOException Unable to retrieve the key store from the specified input stream. """ logger.entry(); try { KeyStore keyStore = KeyStore.getInstance(KEY_STORE_FORMAT); keyStore.load(input, password); logger.exit(); return keyStore; } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to retrieve a keystore.", e); logger.error(exception.toString()); throw exception; } }
java
public final KeyStore retrieveKeyStore(InputStream input, char[] password) throws IOException { logger.entry(); try { KeyStore keyStore = KeyStore.getInstance(KEY_STORE_FORMAT); keyStore.load(input, password); logger.exit(); return keyStore; } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to retrieve a keystore.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "final", "KeyStore", "retrieveKeyStore", "(", "InputStream", "input", ",", "char", "[", "]", "password", ")", "throws", "IOException", "{", "logger", ".", "entry", "(", ")", ";", "try", "{", "KeyStore", "keyStore", "=", "KeyStore", ".", "getInstance", "(", "KEY_STORE_FORMAT", ")", ";", "keyStore", ".", "load", "(", "input", ",", "password", ")", ";", "logger", ".", "exit", "(", ")", ";", "return", "keyStore", ";", "}", "catch", "(", "KeyStoreException", "|", "NoSuchAlgorithmException", "|", "CertificateException", "e", ")", "{", "RuntimeException", "exception", "=", "new", "RuntimeException", "(", "\"An unexpected exception occurred while attempting to retrieve a keystore.\"", ",", "e", ")", ";", "logger", ".", "error", "(", "exception", ".", "toString", "(", ")", ")", ";", "throw", "exception", ";", "}", "}" ]
This method retrieves a PKCS12 format key store from an input stream. @param input The input stream from which to read the key store. @param password The password that was used to encrypt the file. @return The PKCS12 format key store. @throws java.io.IOException Unable to retrieve the key store from the specified input stream.
[ "This", "method", "retrieves", "a", "PKCS12", "format", "key", "store", "from", "an", "input", "stream", "." ]
train
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java#L65-L77
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.moveChild
public void moveChild(int from, int to) { """ Moves a child from one position to another under the same parent. @param from Current position of child. @param to New position of child. """ if (from != to) { ElementBase child = children.get(from); ElementBase ref = children.get(to); children.remove(from); to = children.indexOf(ref); children.add(to, child); afterMoveChild(child, ref); } }
java
public void moveChild(int from, int to) { if (from != to) { ElementBase child = children.get(from); ElementBase ref = children.get(to); children.remove(from); to = children.indexOf(ref); children.add(to, child); afterMoveChild(child, ref); } }
[ "public", "void", "moveChild", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "from", "!=", "to", ")", "{", "ElementBase", "child", "=", "children", ".", "get", "(", "from", ")", ";", "ElementBase", "ref", "=", "children", ".", "get", "(", "to", ")", ";", "children", ".", "remove", "(", "from", ")", ";", "to", "=", "children", ".", "indexOf", "(", "ref", ")", ";", "children", ".", "add", "(", "to", ",", "child", ")", ";", "afterMoveChild", "(", "child", ",", "ref", ")", ";", "}", "}" ]
Moves a child from one position to another under the same parent. @param from Current position of child. @param to New position of child.
[ "Moves", "a", "child", "from", "one", "position", "to", "another", "under", "the", "same", "parent", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L611-L620
mgormley/pacaya
src/main/java/edu/jhu/pacaya/parse/dep/EdgeScores.java
EdgeScores.tensorToEdgeScores
public static EdgeScores tensorToEdgeScores(Tensor t) { """ Convert a Tensor object to an EdgeScores, where the wall node is indexed as position n+1 in the Tensor. """ if (t.getDims().length != 2) { throw new IllegalArgumentException("Tensor must be an nxn matrix."); } int n = t.getDims()[1]; EdgeScores es = new EdgeScores(n, 0); for (int p = -1; p < n; p++) { for (int c = 0; c < n; c++) { if (p == c) { continue; } int pp = getTensorParent(p, c); es.setScore(p, c, t.get(pp, c)); } } return es; }
java
public static EdgeScores tensorToEdgeScores(Tensor t) { if (t.getDims().length != 2) { throw new IllegalArgumentException("Tensor must be an nxn matrix."); } int n = t.getDims()[1]; EdgeScores es = new EdgeScores(n, 0); for (int p = -1; p < n; p++) { for (int c = 0; c < n; c++) { if (p == c) { continue; } int pp = getTensorParent(p, c); es.setScore(p, c, t.get(pp, c)); } } return es; }
[ "public", "static", "EdgeScores", "tensorToEdgeScores", "(", "Tensor", "t", ")", "{", "if", "(", "t", ".", "getDims", "(", ")", ".", "length", "!=", "2", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Tensor must be an nxn matrix.\"", ")", ";", "}", "int", "n", "=", "t", ".", "getDims", "(", ")", "[", "1", "]", ";", "EdgeScores", "es", "=", "new", "EdgeScores", "(", "n", ",", "0", ")", ";", "for", "(", "int", "p", "=", "-", "1", ";", "p", "<", "n", ";", "p", "++", ")", "{", "for", "(", "int", "c", "=", "0", ";", "c", "<", "n", ";", "c", "++", ")", "{", "if", "(", "p", "==", "c", ")", "{", "continue", ";", "}", "int", "pp", "=", "getTensorParent", "(", "p", ",", "c", ")", ";", "es", ".", "setScore", "(", "p", ",", "c", ",", "t", ".", "get", "(", "pp", ",", "c", ")", ")", ";", "}", "}", "return", "es", ";", "}" ]
Convert a Tensor object to an EdgeScores, where the wall node is indexed as position n+1 in the Tensor.
[ "Convert", "a", "Tensor", "object", "to", "an", "EdgeScores", "where", "the", "wall", "node", "is", "indexed", "as", "position", "n", "+", "1", "in", "the", "Tensor", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/parse/dep/EdgeScores.java#L99-L113
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslservicegroup_sslciphersuite_binding.java
sslservicegroup_sslciphersuite_binding.count_filtered
public static long count_filtered(nitro_service service, String servicegroupname, String filter) throws Exception { """ Use this API to count the filtered set of sslservicegroup_sslciphersuite_binding resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP". """ sslservicegroup_sslciphersuite_binding obj = new sslservicegroup_sslciphersuite_binding(); obj.set_servicegroupname(servicegroupname); options option = new options(); option.set_count(true); option.set_filter(filter); sslservicegroup_sslciphersuite_binding[] response = (sslservicegroup_sslciphersuite_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
java
public static long count_filtered(nitro_service service, String servicegroupname, String filter) throws Exception{ sslservicegroup_sslciphersuite_binding obj = new sslservicegroup_sslciphersuite_binding(); obj.set_servicegroupname(servicegroupname); options option = new options(); option.set_count(true); option.set_filter(filter); sslservicegroup_sslciphersuite_binding[] response = (sslservicegroup_sslciphersuite_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
[ "public", "static", "long", "count_filtered", "(", "nitro_service", "service", ",", "String", "servicegroupname", ",", "String", "filter", ")", "throws", "Exception", "{", "sslservicegroup_sslciphersuite_binding", "obj", "=", "new", "sslservicegroup_sslciphersuite_binding", "(", ")", ";", "obj", ".", "set_servicegroupname", "(", "servicegroupname", ")", ";", "options", "option", "=", "new", "options", "(", ")", ";", "option", ".", "set_count", "(", "true", ")", ";", "option", ".", "set_filter", "(", "filter", ")", ";", "sslservicegroup_sslciphersuite_binding", "[", "]", "response", "=", "(", "sslservicegroup_sslciphersuite_binding", "[", "]", ")", "obj", ".", "getfiltered", "(", "service", ",", "option", ")", ";", "if", "(", "response", "!=", "null", ")", "{", "return", "response", "[", "0", "]", ".", "__count", ";", "}", "return", "0", ";", "}" ]
Use this API to count the filtered set of sslservicegroup_sslciphersuite_binding resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
[ "Use", "this", "API", "to", "count", "the", "filtered", "set", "of", "sslservicegroup_sslciphersuite_binding", "resources", ".", "filter", "string", "should", "be", "in", "JSON", "format", ".", "eg", ":", "port", ":", "80", "servicetype", ":", "HTTP", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslservicegroup_sslciphersuite_binding.java#L225-L236
jbundle/jbundle
main/screen/src/main/java/org/jbundle/main/screen/BaseFolderGridScreen.java
BaseFolderGridScreen.doCommand
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { """ Process the command. <br />Step 1 - Process the command if possible and return true if processed. <br />Step 2 - If I can't process, pass to all children (with me as the source). <br />Step 3 - If children didn't process, pass to parent (with me as the source). <br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop). @param strCommand The command to process. @param sourceSField The source screen field (to avoid echos). @param iCommandOptions If this command creates a new screen, create in a new window? @return true if success. """ if (strCommand.equalsIgnoreCase(MenuConstants.FORMDETAIL)) { // Make sure if the use wants to select a record to re-connect the selection Record targetRecord = null; int iMode = ScreenConstants.DETAIL_MODE; OnSelectHandler listener = (OnSelectHandler)this.getMainRecord().getListener(OnSelectHandler.class); if (listener != null) { targetRecord = listener.getRecordToSync(); this.getMainRecord().removeListener(listener, false); iMode = iMode | ScreenConstants.SELECT_MODE; } BasePanel screen = this.onForm(null, iMode, true, iCommandOptions, null); if (targetRecord != null) screen.setSelectQuery(targetRecord, false); return true; } else return super.doCommand(strCommand, sourceSField, iCommandOptions); }
java
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if (strCommand.equalsIgnoreCase(MenuConstants.FORMDETAIL)) { // Make sure if the use wants to select a record to re-connect the selection Record targetRecord = null; int iMode = ScreenConstants.DETAIL_MODE; OnSelectHandler listener = (OnSelectHandler)this.getMainRecord().getListener(OnSelectHandler.class); if (listener != null) { targetRecord = listener.getRecordToSync(); this.getMainRecord().removeListener(listener, false); iMode = iMode | ScreenConstants.SELECT_MODE; } BasePanel screen = this.onForm(null, iMode, true, iCommandOptions, null); if (targetRecord != null) screen.setSelectQuery(targetRecord, false); return true; } else return super.doCommand(strCommand, sourceSField, iCommandOptions); }
[ "public", "boolean", "doCommand", "(", "String", "strCommand", ",", "ScreenField", "sourceSField", ",", "int", "iCommandOptions", ")", "{", "if", "(", "strCommand", ".", "equalsIgnoreCase", "(", "MenuConstants", ".", "FORMDETAIL", ")", ")", "{", "// Make sure if the use wants to select a record to re-connect the selection", "Record", "targetRecord", "=", "null", ";", "int", "iMode", "=", "ScreenConstants", ".", "DETAIL_MODE", ";", "OnSelectHandler", "listener", "=", "(", "OnSelectHandler", ")", "this", ".", "getMainRecord", "(", ")", ".", "getListener", "(", "OnSelectHandler", ".", "class", ")", ";", "if", "(", "listener", "!=", "null", ")", "{", "targetRecord", "=", "listener", ".", "getRecordToSync", "(", ")", ";", "this", ".", "getMainRecord", "(", ")", ".", "removeListener", "(", "listener", ",", "false", ")", ";", "iMode", "=", "iMode", "|", "ScreenConstants", ".", "SELECT_MODE", ";", "}", "BasePanel", "screen", "=", "this", ".", "onForm", "(", "null", ",", "iMode", ",", "true", ",", "iCommandOptions", ",", "null", ")", ";", "if", "(", "targetRecord", "!=", "null", ")", "screen", ".", "setSelectQuery", "(", "targetRecord", ",", "false", ")", ";", "return", "true", ";", "}", "else", "return", "super", ".", "doCommand", "(", "strCommand", ",", "sourceSField", ",", "iCommandOptions", ")", ";", "}" ]
Process the command. <br />Step 1 - Process the command if possible and return true if processed. <br />Step 2 - If I can't process, pass to all children (with me as the source). <br />Step 3 - If children didn't process, pass to parent (with me as the source). <br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop). @param strCommand The command to process. @param sourceSField The source screen field (to avoid echos). @param iCommandOptions If this command creates a new screen, create in a new window? @return true if success.
[ "Process", "the", "command", ".", "<br", "/", ">", "Step", "1", "-", "Process", "the", "command", "if", "possible", "and", "return", "true", "if", "processed", ".", "<br", "/", ">", "Step", "2", "-", "If", "I", "can", "t", "process", "pass", "to", "all", "children", "(", "with", "me", "as", "the", "source", ")", ".", "<br", "/", ">", "Step", "3", "-", "If", "children", "didn", "t", "process", "pass", "to", "parent", "(", "with", "me", "as", "the", "source", ")", ".", "<br", "/", ">", "Note", ":", "Never", "pass", "to", "a", "parent", "or", "child", "that", "matches", "the", "source", "(", "to", "avoid", "an", "endless", "loop", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/screen/src/main/java/org/jbundle/main/screen/BaseFolderGridScreen.java#L123-L143
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cart_cartId_GET
public OvhCart cart_cartId_GET(String cartId) throws IOException { """ Retrieve information about a specific cart REST: GET /order/cart/{cartId} @param cartId [required] Cart identifier """ String qPath = "/order/cart/{cartId}"; StringBuilder sb = path(qPath, cartId); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhCart.class); }
java
public OvhCart cart_cartId_GET(String cartId) throws IOException { String qPath = "/order/cart/{cartId}"; StringBuilder sb = path(qPath, cartId); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhCart.class); }
[ "public", "OvhCart", "cart_cartId_GET", "(", "String", "cartId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cart/{cartId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "cartId", ")", ";", "String", "resp", "=", "execN", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhCart", ".", "class", ")", ";", "}" ]
Retrieve information about a specific cart REST: GET /order/cart/{cartId} @param cartId [required] Cart identifier
[ "Retrieve", "information", "about", "a", "specific", "cart" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L8841-L8846
mcxiaoke/Android-Next
core/src/main/java/com/mcxiaoke/next/utils/AssertUtils.java
AssertUtils.notEmpty
public static void notEmpty(Collection<?> collection, String message) { """ Assert that a collection has elements; that is, it must not be <code>null</code> and must have at least one element. <p/> <pre class="code"> Assert.notEmpty(collection, &quot;Collection must have elements&quot;); </pre> @param collection the collection to check @param message the exception message to use if the assertion fails @throws IllegalArgumentException if the collection is <code>null</code> or has no elements """ if (collection == null || collection.isEmpty()) { throw new IllegalArgumentException(message); } }
java
public static void notEmpty(Collection<?> collection, String message) { if (collection == null || collection.isEmpty()) { throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "notEmpty", "(", "Collection", "<", "?", ">", "collection", ",", "String", "message", ")", "{", "if", "(", "collection", "==", "null", "||", "collection", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}" ]
Assert that a collection has elements; that is, it must not be <code>null</code> and must have at least one element. <p/> <pre class="code"> Assert.notEmpty(collection, &quot;Collection must have elements&quot;); </pre> @param collection the collection to check @param message the exception message to use if the assertion fails @throws IllegalArgumentException if the collection is <code>null</code> or has no elements
[ "Assert", "that", "a", "collection", "has", "elements", ";", "that", "is", "it", "must", "not", "be", "<code", ">", "null<", "/", "code", ">", "and", "must", "have", "at", "least", "one", "element", ".", "<p", "/", ">", "<pre", "class", "=", "code", ">", "Assert", ".", "notEmpty", "(", "collection", "&quot", ";", "Collection", "must", "have", "elements&quot", ";", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/AssertUtils.java#L372-L376
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/AcroFields.java
AcroFields.setListSelection
public boolean setListSelection(String name, String[] value) throws IOException, DocumentException { """ Sets different values in a list selection. No appearance is generated yet; nor does the code check if multiple select is allowed. @param name the name of the field @param value an array with values that need to be selected @return true only if the field value was changed @since 2.1.4 """ Item item = getFieldItem(name); if (item == null) return false; PdfName type = item.getMerged(0).getAsName(PdfName.FT); if (!PdfName.CH.equals(type)) { return false; } String[] options = getListOptionExport(name); PdfArray array = new PdfArray(); for (int i = 0; i < value.length; i++) { for (int j = 0; j < options.length; j++) { if (options[j].equals(value[i])) { array.add(new PdfNumber(j)); } } } item.writeToAll(PdfName.I, array, Item.WRITE_MERGED | Item.WRITE_VALUE); item.writeToAll(PdfName.V, null, Item.WRITE_MERGED | Item.WRITE_VALUE); item.writeToAll(PdfName.AP, null, Item.WRITE_MERGED | Item.WRITE_WIDGET); item.markUsed( this, Item.WRITE_VALUE | Item.WRITE_WIDGET ); return true; }
java
public boolean setListSelection(String name, String[] value) throws IOException, DocumentException { Item item = getFieldItem(name); if (item == null) return false; PdfName type = item.getMerged(0).getAsName(PdfName.FT); if (!PdfName.CH.equals(type)) { return false; } String[] options = getListOptionExport(name); PdfArray array = new PdfArray(); for (int i = 0; i < value.length; i++) { for (int j = 0; j < options.length; j++) { if (options[j].equals(value[i])) { array.add(new PdfNumber(j)); } } } item.writeToAll(PdfName.I, array, Item.WRITE_MERGED | Item.WRITE_VALUE); item.writeToAll(PdfName.V, null, Item.WRITE_MERGED | Item.WRITE_VALUE); item.writeToAll(PdfName.AP, null, Item.WRITE_MERGED | Item.WRITE_WIDGET); item.markUsed( this, Item.WRITE_VALUE | Item.WRITE_WIDGET ); return true; }
[ "public", "boolean", "setListSelection", "(", "String", "name", ",", "String", "[", "]", "value", ")", "throws", "IOException", ",", "DocumentException", "{", "Item", "item", "=", "getFieldItem", "(", "name", ")", ";", "if", "(", "item", "==", "null", ")", "return", "false", ";", "PdfName", "type", "=", "item", ".", "getMerged", "(", "0", ")", ".", "getAsName", "(", "PdfName", ".", "FT", ")", ";", "if", "(", "!", "PdfName", ".", "CH", ".", "equals", "(", "type", ")", ")", "{", "return", "false", ";", "}", "String", "[", "]", "options", "=", "getListOptionExport", "(", "name", ")", ";", "PdfArray", "array", "=", "new", "PdfArray", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "value", ".", "length", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "options", ".", "length", ";", "j", "++", ")", "{", "if", "(", "options", "[", "j", "]", ".", "equals", "(", "value", "[", "i", "]", ")", ")", "{", "array", ".", "add", "(", "new", "PdfNumber", "(", "j", ")", ")", ";", "}", "}", "}", "item", ".", "writeToAll", "(", "PdfName", ".", "I", ",", "array", ",", "Item", ".", "WRITE_MERGED", "|", "Item", ".", "WRITE_VALUE", ")", ";", "item", ".", "writeToAll", "(", "PdfName", ".", "V", ",", "null", ",", "Item", ".", "WRITE_MERGED", "|", "Item", ".", "WRITE_VALUE", ")", ";", "item", ".", "writeToAll", "(", "PdfName", ".", "AP", ",", "null", ",", "Item", ".", "WRITE_MERGED", "|", "Item", ".", "WRITE_WIDGET", ")", ";", "item", ".", "markUsed", "(", "this", ",", "Item", ".", "WRITE_VALUE", "|", "Item", ".", "WRITE_WIDGET", ")", ";", "return", "true", ";", "}" ]
Sets different values in a list selection. No appearance is generated yet; nor does the code check if multiple select is allowed. @param name the name of the field @param value an array with values that need to be selected @return true only if the field value was changed @since 2.1.4
[ "Sets", "different", "values", "in", "a", "list", "selection", ".", "No", "appearance", "is", "generated", "yet", ";", "nor", "does", "the", "code", "check", "if", "multiple", "select", "is", "allowed", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/AcroFields.java#L1431-L1453
phax/ph-css
ph-css/src/main/java/com/helger/css/utils/CSSDataURL.java
CSSDataURL.getContentAsString
@Nonnull public String getContentAsString (@Nonnull final Charset aCharset) { """ Get the data content of this Data URL as String in the specified charset. No Base64 encoding is performed in this method. @param aCharset The charset to be used. May not be <code>null</code>. @return The content in a String representation using the provided charset. Never <code>null</code>. """ if (m_aCharset.equals (aCharset)) { // Potentially return cached version return getContentAsString (); } return new String (m_aContent, aCharset); }
java
@Nonnull public String getContentAsString (@Nonnull final Charset aCharset) { if (m_aCharset.equals (aCharset)) { // Potentially return cached version return getContentAsString (); } return new String (m_aContent, aCharset); }
[ "@", "Nonnull", "public", "String", "getContentAsString", "(", "@", "Nonnull", "final", "Charset", "aCharset", ")", "{", "if", "(", "m_aCharset", ".", "equals", "(", "aCharset", ")", ")", "{", "// Potentially return cached version", "return", "getContentAsString", "(", ")", ";", "}", "return", "new", "String", "(", "m_aContent", ",", "aCharset", ")", ";", "}" ]
Get the data content of this Data URL as String in the specified charset. No Base64 encoding is performed in this method. @param aCharset The charset to be used. May not be <code>null</code>. @return The content in a String representation using the provided charset. Never <code>null</code>.
[ "Get", "the", "data", "content", "of", "this", "Data", "URL", "as", "String", "in", "the", "specified", "charset", ".", "No", "Base64", "encoding", "is", "performed", "in", "this", "method", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/utils/CSSDataURL.java#L304-L313
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestMultipart.java
BoxRequestMultipart.putField
public void putField(String key, Date value) { """ Adds or updates a multipart field in this request. @param key the field's key. @param value the field's value. """ this.fields.put(key, BoxDateFormat.format(value)); }
java
public void putField(String key, Date value) { this.fields.put(key, BoxDateFormat.format(value)); }
[ "public", "void", "putField", "(", "String", "key", ",", "Date", "value", ")", "{", "this", ".", "fields", ".", "put", "(", "key", ",", "BoxDateFormat", ".", "format", "(", "value", ")", ")", ";", "}" ]
Adds or updates a multipart field in this request. @param key the field's key. @param value the field's value.
[ "Adds", "or", "updates", "a", "multipart", "field", "in", "this", "request", "." ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequestMultipart.java#L75-L77
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfDictionary.java
PdfDictionary.putEx
public void putEx(PdfName key, PdfObject value) { """ Associates the specified <CODE>PdfObject</CODE> as value to the specified <CODE>PdfName</CODE> as key in this map. If the <VAR>value</VAR> is a <CODE>PdfNull</CODE>, it is treated just as any other <CODE>PdfObject</CODE>. If the <VAR>value</VAR> is <CODE>null</CODE> however nothing is done. @param key a <CODE>PdfName</CODE> @param value the <CODE>PdfObject</CODE> to be associated to the <VAR>key</VAR> """ if (value == null) { return; } put(key, value); }
java
public void putEx(PdfName key, PdfObject value) { if (value == null) { return; } put(key, value); }
[ "public", "void", "putEx", "(", "PdfName", "key", ",", "PdfObject", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", ";", "}", "put", "(", "key", ",", "value", ")", ";", "}" ]
Associates the specified <CODE>PdfObject</CODE> as value to the specified <CODE>PdfName</CODE> as key in this map. If the <VAR>value</VAR> is a <CODE>PdfNull</CODE>, it is treated just as any other <CODE>PdfObject</CODE>. If the <VAR>value</VAR> is <CODE>null</CODE> however nothing is done. @param key a <CODE>PdfName</CODE> @param value the <CODE>PdfObject</CODE> to be associated to the <VAR>key</VAR>
[ "Associates", "the", "specified", "<CODE", ">", "PdfObject<", "/", "CODE", ">", "as", "value", "to", "the", "specified", "<CODE", ">", "PdfName<", "/", "CODE", ">", "as", "key", "in", "this", "map", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfDictionary.java#L210-L215
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/markup/AnnotatedTextBuilder.java
AnnotatedTextBuilder.addText
public AnnotatedTextBuilder addText(String text) { """ Add a plain text snippet, to be checked by LanguageTool when using {@link org.languagetool.JLanguageTool#check(AnnotatedText)}. """ parts.add(new TextPart(text, TextPart.Type.TEXT)); return this; }
java
public AnnotatedTextBuilder addText(String text) { parts.add(new TextPart(text, TextPart.Type.TEXT)); return this; }
[ "public", "AnnotatedTextBuilder", "addText", "(", "String", "text", ")", "{", "parts", ".", "add", "(", "new", "TextPart", "(", "text", ",", "TextPart", ".", "Type", ".", "TEXT", ")", ")", ";", "return", "this", ";", "}" ]
Add a plain text snippet, to be checked by LanguageTool when using {@link org.languagetool.JLanguageTool#check(AnnotatedText)}.
[ "Add", "a", "plain", "text", "snippet", "to", "be", "checked", "by", "LanguageTool", "when", "using", "{" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/markup/AnnotatedTextBuilder.java#L84-L87
zaproxy/zaproxy
src/org/parosproxy/paros/common/AbstractParam.java
AbstractParam.getInt
protected int getInt(String key, int defaultValue) { """ Gets the {@code int} with the given configuration key. <p> The default value is returned if the key doesn't exist or it's not a {@code int}. @param key the configuration key. @param defaultValue the default value, if the key doesn't exist or it's not an {@code int}. @return the value of the configuration, or default value. @since 2.7.0 """ try { return getConfig().getInt(key, defaultValue); } catch (ConversionException e) { logConversionException(key, e); } return defaultValue; }
java
protected int getInt(String key, int defaultValue) { try { return getConfig().getInt(key, defaultValue); } catch (ConversionException e) { logConversionException(key, e); } return defaultValue; }
[ "protected", "int", "getInt", "(", "String", "key", ",", "int", "defaultValue", ")", "{", "try", "{", "return", "getConfig", "(", ")", ".", "getInt", "(", "key", ",", "defaultValue", ")", ";", "}", "catch", "(", "ConversionException", "e", ")", "{", "logConversionException", "(", "key", ",", "e", ")", ";", "}", "return", "defaultValue", ";", "}" ]
Gets the {@code int} with the given configuration key. <p> The default value is returned if the key doesn't exist or it's not a {@code int}. @param key the configuration key. @param defaultValue the default value, if the key doesn't exist or it's not an {@code int}. @return the value of the configuration, or default value. @since 2.7.0
[ "Gets", "the", "{", "@code", "int", "}", "with", "the", "given", "configuration", "key", ".", "<p", ">", "The", "default", "value", "is", "returned", "if", "the", "key", "doesn", "t", "exist", "or", "it", "s", "not", "a", "{", "@code", "int", "}", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/common/AbstractParam.java#L193-L200
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/MediaUtils.java
MediaUtils.createTempFile
private static File createTempFile(Context ctx, String fileName) throws IOException { """ Create a temporary file to use to handle selected images from the picker @return the created temporary file @throws IOException """ File storageDir = new File(ctx.getFilesDir(), "temp"); storageDir.mkdir(); return nonDuplicateFile(storageDir, fileName); }
java
private static File createTempFile(Context ctx, String fileName) throws IOException { File storageDir = new File(ctx.getFilesDir(), "temp"); storageDir.mkdir(); return nonDuplicateFile(storageDir, fileName); }
[ "private", "static", "File", "createTempFile", "(", "Context", "ctx", ",", "String", "fileName", ")", "throws", "IOException", "{", "File", "storageDir", "=", "new", "File", "(", "ctx", ".", "getFilesDir", "(", ")", ",", "\"temp\"", ")", ";", "storageDir", ".", "mkdir", "(", ")", ";", "return", "nonDuplicateFile", "(", "storageDir", ",", "fileName", ")", ";", "}" ]
Create a temporary file to use to handle selected images from the picker @return the created temporary file @throws IOException
[ "Create", "a", "temporary", "file", "to", "use", "to", "handle", "selected", "images", "from", "the", "picker" ]
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/MediaUtils.java#L224-L228
geomajas/geomajas-project-client-gwt
plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/action/toolbar/MultiLayerFeatureInfoModalAction.java
MultiLayerFeatureInfoModalAction.setFeaturesListLabels
public void setFeaturesListLabels(Map<String, String> featuresListLabels) { """ Set labels for feature lists. @param featuresListLabels the featuresListLabels to set """ this.featuresListLabels = featuresListLabels; controller.setFeaturesListLabels(featuresListLabels); }
java
public void setFeaturesListLabels(Map<String, String> featuresListLabels) { this.featuresListLabels = featuresListLabels; controller.setFeaturesListLabels(featuresListLabels); }
[ "public", "void", "setFeaturesListLabels", "(", "Map", "<", "String", ",", "String", ">", "featuresListLabels", ")", "{", "this", ".", "featuresListLabels", "=", "featuresListLabels", ";", "controller", ".", "setFeaturesListLabels", "(", "featuresListLabels", ")", ";", "}" ]
Set labels for feature lists. @param featuresListLabels the featuresListLabels to set
[ "Set", "labels", "for", "feature", "lists", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/action/toolbar/MultiLayerFeatureInfoModalAction.java#L131-L134
cdk/cdk
legacy/src/main/java/org/openscience/cdk/math/qm/OneElectronJob.java
OneElectronJob.calculateT
private Matrix calculateT(IBasis basis) { """ Calculates the matrix for the kinetic energy T_i,j = (1/2) * -<d^2/dx^2 chi_i | chi_j> """ int size = basis.getSize(); Matrix J = new Matrix(size, size); int i, j; for (i = 0; i < size; i++) for (j = 0; j < size; j++) // (1/2) * -<d^2/dx^2 chi_i | chi_j> J.matrix[i][j] = basis.calcJ(j, i) / 2; // Attention indicies are exchanged return J; }
java
private Matrix calculateT(IBasis basis) { int size = basis.getSize(); Matrix J = new Matrix(size, size); int i, j; for (i = 0; i < size; i++) for (j = 0; j < size; j++) // (1/2) * -<d^2/dx^2 chi_i | chi_j> J.matrix[i][j] = basis.calcJ(j, i) / 2; // Attention indicies are exchanged return J; }
[ "private", "Matrix", "calculateT", "(", "IBasis", "basis", ")", "{", "int", "size", "=", "basis", ".", "getSize", "(", ")", ";", "Matrix", "J", "=", "new", "Matrix", "(", "size", ",", "size", ")", ";", "int", "i", ",", "j", ";", "for", "(", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "for", "(", "j", "=", "0", ";", "j", "<", "size", ";", "j", "++", ")", "// (1/2) * -<d^2/dx^2 chi_i | chi_j>", "J", ".", "matrix", "[", "i", "]", "[", "j", "]", "=", "basis", ".", "calcJ", "(", "j", ",", "i", ")", "/", "2", ";", "// Attention indicies are exchanged", "return", "J", ";", "}" ]
Calculates the matrix for the kinetic energy T_i,j = (1/2) * -<d^2/dx^2 chi_i | chi_j>
[ "Calculates", "the", "matrix", "for", "the", "kinetic", "energy" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/math/qm/OneElectronJob.java#L102-L112
lessthanoptimal/ejml
main/ejml-core/src/org/ejml/UtilEjml.java
UtilEjml.fancyStringF
public static String fancyStringF(double value, DecimalFormat format, int length, int significant) { """ Fixed length fancy formatting for doubles. If possible decimal notation is used. If all the significant digits can't be shown then it will switch to exponential notation. If not all the space is needed then it will be filled in to ensure it has the specified length. @param value value being formatted @param format default format before exponential @param length Maximum number of characters it can take. @param significant Number of significant decimal digits to show at a minimum. @return formatted string """ String formatted = fancyString(value, format, length, significant); int n = length-formatted.length(); if( n > 0 ) { StringBuilder builder = new StringBuilder(n); for (int i = 0; i < n; i++) { builder.append(' '); } return formatted + builder.toString(); } else { return formatted; } }
java
public static String fancyStringF(double value, DecimalFormat format, int length, int significant) { String formatted = fancyString(value, format, length, significant); int n = length-formatted.length(); if( n > 0 ) { StringBuilder builder = new StringBuilder(n); for (int i = 0; i < n; i++) { builder.append(' '); } return formatted + builder.toString(); } else { return formatted; } }
[ "public", "static", "String", "fancyStringF", "(", "double", "value", ",", "DecimalFormat", "format", ",", "int", "length", ",", "int", "significant", ")", "{", "String", "formatted", "=", "fancyString", "(", "value", ",", "format", ",", "length", ",", "significant", ")", ";", "int", "n", "=", "length", "-", "formatted", ".", "length", "(", ")", ";", "if", "(", "n", ">", "0", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "n", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "builder", ".", "append", "(", "'", "'", ")", ";", "}", "return", "formatted", "+", "builder", ".", "toString", "(", ")", ";", "}", "else", "{", "return", "formatted", ";", "}", "}" ]
Fixed length fancy formatting for doubles. If possible decimal notation is used. If all the significant digits can't be shown then it will switch to exponential notation. If not all the space is needed then it will be filled in to ensure it has the specified length. @param value value being formatted @param format default format before exponential @param length Maximum number of characters it can take. @param significant Number of significant decimal digits to show at a minimum. @return formatted string
[ "Fixed", "length", "fancy", "formatting", "for", "doubles", ".", "If", "possible", "decimal", "notation", "is", "used", ".", "If", "all", "the", "significant", "digits", "can", "t", "be", "shown", "then", "it", "will", "switch", "to", "exponential", "notation", ".", "If", "not", "all", "the", "space", "is", "needed", "then", "it", "will", "be", "filled", "in", "to", "ensure", "it", "has", "the", "specified", "length", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/UtilEjml.java#L336-L350
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/VirtualHost.java
VirtualHost.addMapping
protected synchronized void addMapping(String contextRoot, WebGroup group) throws Exception { """ end 280649 SERVICE: clean up separation of core and shell WASCC.web.webcontainer """ if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, "addMapping", " contextRoot -->" + contextRoot + " group -->" + group.getName() + " : " + this.hashCode()); } requestMapper.addMapping(contextRoot, group); }
java
protected synchronized void addMapping(String contextRoot, WebGroup group) throws Exception { if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, "addMapping", " contextRoot -->" + contextRoot + " group -->" + group.getName() + " : " + this.hashCode()); } requestMapper.addMapping(contextRoot, group); }
[ "protected", "synchronized", "void", "addMapping", "(", "String", "contextRoot", ",", "WebGroup", "group", ")", "throws", "Exception", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "logger", ".", "logp", "(", "Level", ".", "FINE", ",", "CLASS_NAME", ",", "\"addMapping\"", ",", "\" contextRoot -->\"", "+", "contextRoot", "+", "\" group -->\"", "+", "group", ".", "getName", "(", ")", "+", "\" : \"", "+", "this", ".", "hashCode", "(", ")", ")", ";", "}", "requestMapper", ".", "addMapping", "(", "contextRoot", ",", "group", ")", ";", "}" ]
end 280649 SERVICE: clean up separation of core and shell WASCC.web.webcontainer
[ "end", "280649", "SERVICE", ":", "clean", "up", "separation", "of", "core", "and", "shell", "WASCC", ".", "web", ".", "webcontainer" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/VirtualHost.java#L280-L285
springfox/springfox
springfox-spring-webmvc/src/main/java/springfox/documentation/spring/web/WebMvcPropertySourcedRequestMappingHandlerMapping.java
WebMvcPropertySourcedRequestMappingHandlerMapping.lookupHandlerMethod
@Override protected HandlerMethod lookupHandlerMethod(String urlPath, HttpServletRequest request) { """ The lookup handler method, maps the SEOMapper method to the request URL. <p>If no mapping is found, or if the URL is disabled, it will simply drop through to the standard 404 handling.</p> @param urlPath the path to match. @param request the http servlet request. @return The HandlerMethod if one was found. """ logger.debug("looking up handler for path: " + urlPath); HandlerMethod handlerMethod = handlerMethods.get(urlPath); if (handlerMethod != null) { return handlerMethod; } for (String path : handlerMethods.keySet()) { UriTemplate template = new UriTemplate(path); if (template.matches(urlPath)) { request.setAttribute( HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, template.match(urlPath)); return handlerMethods.get(path); } } return null; }
java
@Override protected HandlerMethod lookupHandlerMethod(String urlPath, HttpServletRequest request) { logger.debug("looking up handler for path: " + urlPath); HandlerMethod handlerMethod = handlerMethods.get(urlPath); if (handlerMethod != null) { return handlerMethod; } for (String path : handlerMethods.keySet()) { UriTemplate template = new UriTemplate(path); if (template.matches(urlPath)) { request.setAttribute( HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, template.match(urlPath)); return handlerMethods.get(path); } } return null; }
[ "@", "Override", "protected", "HandlerMethod", "lookupHandlerMethod", "(", "String", "urlPath", ",", "HttpServletRequest", "request", ")", "{", "logger", ".", "debug", "(", "\"looking up handler for path: \"", "+", "urlPath", ")", ";", "HandlerMethod", "handlerMethod", "=", "handlerMethods", ".", "get", "(", "urlPath", ")", ";", "if", "(", "handlerMethod", "!=", "null", ")", "{", "return", "handlerMethod", ";", "}", "for", "(", "String", "path", ":", "handlerMethods", ".", "keySet", "(", ")", ")", "{", "UriTemplate", "template", "=", "new", "UriTemplate", "(", "path", ")", ";", "if", "(", "template", ".", "matches", "(", "urlPath", ")", ")", "{", "request", ".", "setAttribute", "(", "HandlerMapping", ".", "URI_TEMPLATE_VARIABLES_ATTRIBUTE", ",", "template", ".", "match", "(", "urlPath", ")", ")", ";", "return", "handlerMethods", ".", "get", "(", "path", ")", ";", "}", "}", "return", "null", ";", "}" ]
The lookup handler method, maps the SEOMapper method to the request URL. <p>If no mapping is found, or if the URL is disabled, it will simply drop through to the standard 404 handling.</p> @param urlPath the path to match. @param request the http servlet request. @return The HandlerMethod if one was found.
[ "The", "lookup", "handler", "method", "maps", "the", "SEOMapper", "method", "to", "the", "request", "URL", ".", "<p", ">", "If", "no", "mapping", "is", "found", "or", "if", "the", "URL", "is", "disabled", "it", "will", "simply", "drop", "through", "to", "the", "standard", "404", "handling", ".", "<", "/", "p", ">" ]
train
https://github.com/springfox/springfox/blob/e40e2d6f4b345ffa35cd5c0ca7a12589036acaf7/springfox-spring-webmvc/src/main/java/springfox/documentation/spring/web/WebMvcPropertySourcedRequestMappingHandlerMapping.java#L101-L118
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/embedded/EmbeddedLogContext.java
EmbeddedLogContext.configureLogContext
static synchronized LogContext configureLogContext(final File logDir, final File configDir, final String defaultLogFileName, final CommandContext ctx) { """ Configures the log context for the server and returns the configured log context. @param logDir the logging directory, from jboss.server|domain.log.dir standalone default {@code $JBOSS_HOME/standalone/log} @param configDir the configuration directory from jboss.server|domain.config.dir, standalone default {@code $JBOSS_HOME/standalone/configuration} @param defaultLogFileName the name of the log file to pass to {@code org.jboss.boot.log.file} @param ctx the command context used to report errors to @return the configured log context """ final LogContext embeddedLogContext = Holder.LOG_CONTEXT; final Path bootLog = logDir.toPath().resolve(Paths.get(defaultLogFileName)); final Path loggingProperties = configDir.toPath().resolve(Paths.get("logging.properties")); if (Files.exists(loggingProperties)) { WildFlySecurityManager.setPropertyPrivileged("org.jboss.boot.log.file", bootLog.toAbsolutePath().toString()); try (final InputStream in = Files.newInputStream(loggingProperties)) { // Attempt to get the configurator from the root logger Configurator configurator = embeddedLogContext.getAttachment("", Configurator.ATTACHMENT_KEY); if (configurator == null) { configurator = new PropertyConfigurator(embeddedLogContext); final Configurator existing = embeddedLogContext.getLogger("").attachIfAbsent(Configurator.ATTACHMENT_KEY, configurator); if (existing != null) { configurator = existing; } } configurator.configure(in); } catch (IOException e) { ctx.printLine(String.format("Unable to configure logging from configuration file %s. Reason: %s", loggingProperties, e.getLocalizedMessage())); } } return embeddedLogContext; }
java
static synchronized LogContext configureLogContext(final File logDir, final File configDir, final String defaultLogFileName, final CommandContext ctx) { final LogContext embeddedLogContext = Holder.LOG_CONTEXT; final Path bootLog = logDir.toPath().resolve(Paths.get(defaultLogFileName)); final Path loggingProperties = configDir.toPath().resolve(Paths.get("logging.properties")); if (Files.exists(loggingProperties)) { WildFlySecurityManager.setPropertyPrivileged("org.jboss.boot.log.file", bootLog.toAbsolutePath().toString()); try (final InputStream in = Files.newInputStream(loggingProperties)) { // Attempt to get the configurator from the root logger Configurator configurator = embeddedLogContext.getAttachment("", Configurator.ATTACHMENT_KEY); if (configurator == null) { configurator = new PropertyConfigurator(embeddedLogContext); final Configurator existing = embeddedLogContext.getLogger("").attachIfAbsent(Configurator.ATTACHMENT_KEY, configurator); if (existing != null) { configurator = existing; } } configurator.configure(in); } catch (IOException e) { ctx.printLine(String.format("Unable to configure logging from configuration file %s. Reason: %s", loggingProperties, e.getLocalizedMessage())); } } return embeddedLogContext; }
[ "static", "synchronized", "LogContext", "configureLogContext", "(", "final", "File", "logDir", ",", "final", "File", "configDir", ",", "final", "String", "defaultLogFileName", ",", "final", "CommandContext", "ctx", ")", "{", "final", "LogContext", "embeddedLogContext", "=", "Holder", ".", "LOG_CONTEXT", ";", "final", "Path", "bootLog", "=", "logDir", ".", "toPath", "(", ")", ".", "resolve", "(", "Paths", ".", "get", "(", "defaultLogFileName", ")", ")", ";", "final", "Path", "loggingProperties", "=", "configDir", ".", "toPath", "(", ")", ".", "resolve", "(", "Paths", ".", "get", "(", "\"logging.properties\"", ")", ")", ";", "if", "(", "Files", ".", "exists", "(", "loggingProperties", ")", ")", "{", "WildFlySecurityManager", ".", "setPropertyPrivileged", "(", "\"org.jboss.boot.log.file\"", ",", "bootLog", ".", "toAbsolutePath", "(", ")", ".", "toString", "(", ")", ")", ";", "try", "(", "final", "InputStream", "in", "=", "Files", ".", "newInputStream", "(", "loggingProperties", ")", ")", "{", "// Attempt to get the configurator from the root logger", "Configurator", "configurator", "=", "embeddedLogContext", ".", "getAttachment", "(", "\"\"", ",", "Configurator", ".", "ATTACHMENT_KEY", ")", ";", "if", "(", "configurator", "==", "null", ")", "{", "configurator", "=", "new", "PropertyConfigurator", "(", "embeddedLogContext", ")", ";", "final", "Configurator", "existing", "=", "embeddedLogContext", ".", "getLogger", "(", "\"\"", ")", ".", "attachIfAbsent", "(", "Configurator", ".", "ATTACHMENT_KEY", ",", "configurator", ")", ";", "if", "(", "existing", "!=", "null", ")", "{", "configurator", "=", "existing", ";", "}", "}", "configurator", ".", "configure", "(", "in", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "ctx", ".", "printLine", "(", "String", ".", "format", "(", "\"Unable to configure logging from configuration file %s. Reason: %s\"", ",", "loggingProperties", ",", "e", ".", "getLocalizedMessage", "(", ")", ")", ")", ";", "}", "}", "return", "embeddedLogContext", ";", "}" ]
Configures the log context for the server and returns the configured log context. @param logDir the logging directory, from jboss.server|domain.log.dir standalone default {@code $JBOSS_HOME/standalone/log} @param configDir the configuration directory from jboss.server|domain.config.dir, standalone default {@code $JBOSS_HOME/standalone/configuration} @param defaultLogFileName the name of the log file to pass to {@code org.jboss.boot.log.file} @param ctx the command context used to report errors to @return the configured log context
[ "Configures", "the", "log", "context", "for", "the", "server", "and", "returns", "the", "configured", "log", "context", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/embedded/EmbeddedLogContext.java#L65-L88
infinispan/infinispan
core/src/main/java/org/infinispan/stream/impl/IteratorHandler.java
IteratorHandler.closeIterator
public void closeIterator(Address origin, Object requestId) { """ Invoked to have handler forget about given iterator they requested. This should be invoked when an {@link Iterator} has been found to have completed {@link Iterator#hasNext()} is false or if the caller wishes to stop a given iteration early. If an iterator is fully iterated upon (ie. {@link Iterator#hasNext()} returns false, that invocation will also close resources related to the iterator. @param requestId the id of the iterator """ Set<Object> ids = ownerRequests.get(origin); if (ids != null) { ids.remove(requestId); } closeIterator(requestId); }
java
public void closeIterator(Address origin, Object requestId) { Set<Object> ids = ownerRequests.get(origin); if (ids != null) { ids.remove(requestId); } closeIterator(requestId); }
[ "public", "void", "closeIterator", "(", "Address", "origin", ",", "Object", "requestId", ")", "{", "Set", "<", "Object", ">", "ids", "=", "ownerRequests", ".", "get", "(", "origin", ")", ";", "if", "(", "ids", "!=", "null", ")", "{", "ids", ".", "remove", "(", "requestId", ")", ";", "}", "closeIterator", "(", "requestId", ")", ";", "}" ]
Invoked to have handler forget about given iterator they requested. This should be invoked when an {@link Iterator} has been found to have completed {@link Iterator#hasNext()} is false or if the caller wishes to stop a given iteration early. If an iterator is fully iterated upon (ie. {@link Iterator#hasNext()} returns false, that invocation will also close resources related to the iterator. @param requestId the id of the iterator
[ "Invoked", "to", "have", "handler", "forget", "about", "given", "iterator", "they", "requested", ".", "This", "should", "be", "invoked", "when", "an", "{" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/stream/impl/IteratorHandler.java#L148-L154
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/ngmf/util/cosu/Efficiencies.java
Efficiencies.runoffCoefficientError
public static double runoffCoefficientError(double[] obs, double[] sim, double[] precip) { """ Runoff coefficient error ROCE @param obs @param sim @param precip @return """ sameArrayLen(sim, obs, precip); double mean_pred = Stats.mean(sim); double mean_val = Stats.mean(obs); double mean_ppt = Stats.mean(precip); double error = Math.abs((mean_pred / mean_ppt) - (mean_val / mean_ppt)); return Math.sqrt(error); }
java
public static double runoffCoefficientError(double[] obs, double[] sim, double[] precip) { sameArrayLen(sim, obs, precip); double mean_pred = Stats.mean(sim); double mean_val = Stats.mean(obs); double mean_ppt = Stats.mean(precip); double error = Math.abs((mean_pred / mean_ppt) - (mean_val / mean_ppt)); return Math.sqrt(error); }
[ "public", "static", "double", "runoffCoefficientError", "(", "double", "[", "]", "obs", ",", "double", "[", "]", "sim", ",", "double", "[", "]", "precip", ")", "{", "sameArrayLen", "(", "sim", ",", "obs", ",", "precip", ")", ";", "double", "mean_pred", "=", "Stats", ".", "mean", "(", "sim", ")", ";", "double", "mean_val", "=", "Stats", ".", "mean", "(", "obs", ")", ";", "double", "mean_ppt", "=", "Stats", ".", "mean", "(", "precip", ")", ";", "double", "error", "=", "Math", ".", "abs", "(", "(", "mean_pred", "/", "mean_ppt", ")", "-", "(", "mean_val", "/", "mean_ppt", ")", ")", ";", "return", "Math", ".", "sqrt", "(", "error", ")", ";", "}" ]
Runoff coefficient error ROCE @param obs @param sim @param precip @return
[ "Runoff", "coefficient", "error", "ROCE" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/ngmf/util/cosu/Efficiencies.java#L409-L417
zaproxy/zaproxy
src/org/parosproxy/paros/common/AbstractParam.java
AbstractParam.getString
protected String getString(String key, String defaultValue) { """ Gets the {@code String} with the given configuration key. <p> The default value is returned if the key doesn't exist or it's not a {@code String}. @param key the configuration key. @param defaultValue the default value, if the key doesn't exist or it's not a {@code String}. @return the value of the configuration, or default value. @since 2.7.0 """ try { return getConfig().getString(key, defaultValue); } catch (ConversionException e) { logConversionException(key, e); } return defaultValue; }
java
protected String getString(String key, String defaultValue) { try { return getConfig().getString(key, defaultValue); } catch (ConversionException e) { logConversionException(key, e); } return defaultValue; }
[ "protected", "String", "getString", "(", "String", "key", ",", "String", "defaultValue", ")", "{", "try", "{", "return", "getConfig", "(", ")", ".", "getString", "(", "key", ",", "defaultValue", ")", ";", "}", "catch", "(", "ConversionException", "e", ")", "{", "logConversionException", "(", "key", ",", "e", ")", ";", "}", "return", "defaultValue", ";", "}" ]
Gets the {@code String} with the given configuration key. <p> The default value is returned if the key doesn't exist or it's not a {@code String}. @param key the configuration key. @param defaultValue the default value, if the key doesn't exist or it's not a {@code String}. @return the value of the configuration, or default value. @since 2.7.0
[ "Gets", "the", "{", "@code", "String", "}", "with", "the", "given", "configuration", "key", ".", "<p", ">", "The", "default", "value", "is", "returned", "if", "the", "key", "doesn", "t", "exist", "or", "it", "s", "not", "a", "{", "@code", "String", "}", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/common/AbstractParam.java#L144-L151
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteRequest.java
CreateRouteRequest.withRequestModels
public CreateRouteRequest withRequestModels(java.util.Map<String, String> requestModels) { """ <p> The request models for the route. </p> @param requestModels The request models for the route. @return Returns a reference to this object so that method calls can be chained together. """ setRequestModels(requestModels); return this; }
java
public CreateRouteRequest withRequestModels(java.util.Map<String, String> requestModels) { setRequestModels(requestModels); return this; }
[ "public", "CreateRouteRequest", "withRequestModels", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "requestModels", ")", "{", "setRequestModels", "(", "requestModels", ")", ";", "return", "this", ";", "}" ]
<p> The request models for the route. </p> @param requestModels The request models for the route. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "request", "models", "for", "the", "route", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteRequest.java#L488-L491
line/centraldogma
server/src/main/java/com/linecorp/centraldogma/server/PluginGroup.java
PluginGroup.loadPlugins
@Nullable static PluginGroup loadPlugins(PluginTarget target, CentralDogmaConfig config) { """ Returns a new {@link PluginGroup} which holds the {@link Plugin}s loaded from the classpath. {@code null} is returned if there is no {@link Plugin} whose target equals to the specified {@code target}. @param target the {@link PluginTarget} which would be loaded """ return loadPlugins(PluginGroup.class.getClassLoader(), target, config); }
java
@Nullable static PluginGroup loadPlugins(PluginTarget target, CentralDogmaConfig config) { return loadPlugins(PluginGroup.class.getClassLoader(), target, config); }
[ "@", "Nullable", "static", "PluginGroup", "loadPlugins", "(", "PluginTarget", "target", ",", "CentralDogmaConfig", "config", ")", "{", "return", "loadPlugins", "(", "PluginGroup", ".", "class", ".", "getClassLoader", "(", ")", ",", "target", ",", "config", ")", ";", "}" ]
Returns a new {@link PluginGroup} which holds the {@link Plugin}s loaded from the classpath. {@code null} is returned if there is no {@link Plugin} whose target equals to the specified {@code target}. @param target the {@link PluginTarget} which would be loaded
[ "Returns", "a", "new", "{", "@link", "PluginGroup", "}", "which", "holds", "the", "{", "@link", "Plugin", "}", "s", "loaded", "from", "the", "classpath", ".", "{", "@code", "null", "}", "is", "returned", "if", "there", "is", "no", "{", "@link", "Plugin", "}", "whose", "target", "equals", "to", "the", "specified", "{", "@code", "target", "}", "." ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/PluginGroup.java#L62-L65
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java
SqlBuilderHelper.generateLogForContentValuesContentProvider
public static void generateLogForContentValuesContentProvider(SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { """ Generate log for content values content provider. @param method the method @param methodBuilder the method builder """ methodBuilder.addCode("\n// log for content values -- BEGIN\n"); methodBuilder.addStatement("Object _contentValue"); methodBuilder.beginControlFlow("for (String _contentKey:_contentValues.values().keySet())"); methodBuilder.addStatement("_contentValue=_contentValues.values().get(_contentKey)"); methodBuilder.beginControlFlow("if (_contentValue==null)"); methodBuilder.addStatement("$T.info(\"==> :%s = <null>\", _contentKey)", Logger.class); methodBuilder.nextControlFlow("else"); methodBuilder.addStatement("$T.info(\"==> :%s = '%s' (%s)\", _contentKey, $T.checkSize(_contentValue), _contentValue.getClass().getCanonicalName())", Logger.class, StringUtils.class); methodBuilder.endControlFlow(); methodBuilder.endControlFlow(); methodBuilder.addCode("// log for content values -- END\n"); }
java
public static void generateLogForContentValuesContentProvider(SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { methodBuilder.addCode("\n// log for content values -- BEGIN\n"); methodBuilder.addStatement("Object _contentValue"); methodBuilder.beginControlFlow("for (String _contentKey:_contentValues.values().keySet())"); methodBuilder.addStatement("_contentValue=_contentValues.values().get(_contentKey)"); methodBuilder.beginControlFlow("if (_contentValue==null)"); methodBuilder.addStatement("$T.info(\"==> :%s = <null>\", _contentKey)", Logger.class); methodBuilder.nextControlFlow("else"); methodBuilder.addStatement("$T.info(\"==> :%s = '%s' (%s)\", _contentKey, $T.checkSize(_contentValue), _contentValue.getClass().getCanonicalName())", Logger.class, StringUtils.class); methodBuilder.endControlFlow(); methodBuilder.endControlFlow(); methodBuilder.addCode("// log for content values -- END\n"); }
[ "public", "static", "void", "generateLogForContentValuesContentProvider", "(", "SQLiteModelMethod", "method", ",", "MethodSpec", ".", "Builder", "methodBuilder", ")", "{", "methodBuilder", ".", "addCode", "(", "\"\\n// log for content values -- BEGIN\\n\"", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"Object _contentValue\"", ")", ";", "methodBuilder", ".", "beginControlFlow", "(", "\"for (String _contentKey:_contentValues.values().keySet())\"", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"_contentValue=_contentValues.values().get(_contentKey)\"", ")", ";", "methodBuilder", ".", "beginControlFlow", "(", "\"if (_contentValue==null)\"", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"$T.info(\\\"==> :%s = <null>\\\", _contentKey)\"", ",", "Logger", ".", "class", ")", ";", "methodBuilder", ".", "nextControlFlow", "(", "\"else\"", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"$T.info(\\\"==> :%s = '%s' (%s)\\\", _contentKey, $T.checkSize(_contentValue), _contentValue.getClass().getCanonicalName())\"", ",", "Logger", ".", "class", ",", "StringUtils", ".", "class", ")", ";", "methodBuilder", ".", "endControlFlow", "(", ")", ";", "methodBuilder", ".", "endControlFlow", "(", ")", ";", "methodBuilder", ".", "addCode", "(", "\"// log for content values -- END\\n\"", ")", ";", "}" ]
Generate log for content values content provider. @param method the method @param methodBuilder the method builder
[ "Generate", "log", "for", "content", "values", "content", "provider", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java#L753-L766
vincentk/joptimizer
src/main/java/com/joptimizer/util/ColtUtils.java
ColtUtils.add
public static final DoubleMatrix1D add(DoubleMatrix1D v1, DoubleMatrix1D v2, double c) { """ Returns v = v1 + c*v2. Useful in avoiding the need of the copy() in the colt api. """ if(v1.size()!=v2.size()){ throw new IllegalArgumentException("wrong vectors dimensions"); } DoubleMatrix1D ret = DoubleFactory1D.dense.make(v1.size()); for(int i=0; i<ret.size(); i++){ ret.setQuick(i, v1.getQuick(i) + c*v2.getQuick(i)); } return ret; }
java
public static final DoubleMatrix1D add(DoubleMatrix1D v1, DoubleMatrix1D v2, double c){ if(v1.size()!=v2.size()){ throw new IllegalArgumentException("wrong vectors dimensions"); } DoubleMatrix1D ret = DoubleFactory1D.dense.make(v1.size()); for(int i=0; i<ret.size(); i++){ ret.setQuick(i, v1.getQuick(i) + c*v2.getQuick(i)); } return ret; }
[ "public", "static", "final", "DoubleMatrix1D", "add", "(", "DoubleMatrix1D", "v1", ",", "DoubleMatrix1D", "v2", ",", "double", "c", ")", "{", "if", "(", "v1", ".", "size", "(", ")", "!=", "v2", ".", "size", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"wrong vectors dimensions\"", ")", ";", "}", "DoubleMatrix1D", "ret", "=", "DoubleFactory1D", ".", "dense", ".", "make", "(", "v1", ".", "size", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ret", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ret", ".", "setQuick", "(", "i", ",", "v1", ".", "getQuick", "(", "i", ")", "+", "c", "*", "v2", ".", "getQuick", "(", "i", ")", ")", ";", "}", "return", "ret", ";", "}" ]
Returns v = v1 + c*v2. Useful in avoiding the need of the copy() in the colt api.
[ "Returns", "v", "=", "v1", "+", "c", "*", "v2", ".", "Useful", "in", "avoiding", "the", "need", "of", "the", "copy", "()", "in", "the", "colt", "api", "." ]
train
https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/util/ColtUtils.java#L368-L378
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
MemberSummaryBuilder.buildConstructorsSummary
public void buildConstructorsSummary(XMLNode node, Content memberSummaryTree) { """ Build the constructor summary. @param node the XML element that specifies which components to document @param memberSummaryTree the content tree to which the documentation will be added """ MemberSummaryWriter writer = memberSummaryWriters.get(VisibleMemberMap.Kind.CONSTRUCTORS); VisibleMemberMap visibleMemberMap = getVisibleMemberMap(VisibleMemberMap.Kind.CONSTRUCTORS); addSummary(writer, visibleMemberMap, false, memberSummaryTree); }
java
public void buildConstructorsSummary(XMLNode node, Content memberSummaryTree) { MemberSummaryWriter writer = memberSummaryWriters.get(VisibleMemberMap.Kind.CONSTRUCTORS); VisibleMemberMap visibleMemberMap = getVisibleMemberMap(VisibleMemberMap.Kind.CONSTRUCTORS); addSummary(writer, visibleMemberMap, false, memberSummaryTree); }
[ "public", "void", "buildConstructorsSummary", "(", "XMLNode", "node", ",", "Content", "memberSummaryTree", ")", "{", "MemberSummaryWriter", "writer", "=", "memberSummaryWriters", ".", "get", "(", "VisibleMemberMap", ".", "Kind", ".", "CONSTRUCTORS", ")", ";", "VisibleMemberMap", "visibleMemberMap", "=", "getVisibleMemberMap", "(", "VisibleMemberMap", ".", "Kind", ".", "CONSTRUCTORS", ")", ";", "addSummary", "(", "writer", ",", "visibleMemberMap", ",", "false", ",", "memberSummaryTree", ")", ";", "}" ]
Build the constructor summary. @param node the XML element that specifies which components to document @param memberSummaryTree the content tree to which the documentation will be added
[ "Build", "the", "constructor", "summary", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java#L318-L324
HadoopGenomics/Hadoop-BAM
src/main/java/org/seqdoop/hadoop_bam/util/NIOFileUtil.java
NIOFileUtil.mergeInto
static void mergeInto(List<Path> parts, OutputStream out) throws IOException { """ Merge the given part files in order into an output stream. This deletes the parts. @param parts the part files to merge @param out the stream to write each file into, in order @throws IOException """ for (final Path part : parts) { Files.copy(part, out); Files.delete(part); } }
java
static void mergeInto(List<Path> parts, OutputStream out) throws IOException { for (final Path part : parts) { Files.copy(part, out); Files.delete(part); } }
[ "static", "void", "mergeInto", "(", "List", "<", "Path", ">", "parts", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "for", "(", "final", "Path", "part", ":", "parts", ")", "{", "Files", ".", "copy", "(", "part", ",", "out", ")", ";", "Files", ".", "delete", "(", "part", ")", ";", "}", "}" ]
Merge the given part files in order into an output stream. This deletes the parts. @param parts the part files to merge @param out the stream to write each file into, in order @throws IOException
[ "Merge", "the", "given", "part", "files", "in", "order", "into", "an", "output", "stream", ".", "This", "deletes", "the", "parts", "." ]
train
https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/NIOFileUtil.java#L106-L112
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addTagsInfo
protected void addTagsInfo(Doc doc, Content htmltree) { """ Adds the tags information. @param doc the doc for which the tags will be generated @param htmltree the documentation tree to which the tags will be added """ if (configuration.nocomment) { return; } Content dl = new HtmlTree(HtmlTag.DL); if (doc instanceof MethodDoc) { addMethodInfo((MethodDoc) doc, dl); } Content output = new ContentBuilder(); TagletWriter.genTagOuput(configuration.tagletManager, doc, configuration.tagletManager.getCustomTaglets(doc), getTagletWriterInstance(false), output); dl.addContent(output); htmltree.addContent(dl); }
java
protected void addTagsInfo(Doc doc, Content htmltree) { if (configuration.nocomment) { return; } Content dl = new HtmlTree(HtmlTag.DL); if (doc instanceof MethodDoc) { addMethodInfo((MethodDoc) doc, dl); } Content output = new ContentBuilder(); TagletWriter.genTagOuput(configuration.tagletManager, doc, configuration.tagletManager.getCustomTaglets(doc), getTagletWriterInstance(false), output); dl.addContent(output); htmltree.addContent(dl); }
[ "protected", "void", "addTagsInfo", "(", "Doc", "doc", ",", "Content", "htmltree", ")", "{", "if", "(", "configuration", ".", "nocomment", ")", "{", "return", ";", "}", "Content", "dl", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "DL", ")", ";", "if", "(", "doc", "instanceof", "MethodDoc", ")", "{", "addMethodInfo", "(", "(", "MethodDoc", ")", "doc", ",", "dl", ")", ";", "}", "Content", "output", "=", "new", "ContentBuilder", "(", ")", ";", "TagletWriter", ".", "genTagOuput", "(", "configuration", ".", "tagletManager", ",", "doc", ",", "configuration", ".", "tagletManager", ".", "getCustomTaglets", "(", "doc", ")", ",", "getTagletWriterInstance", "(", "false", ")", ",", "output", ")", ";", "dl", ".", "addContent", "(", "output", ")", ";", "htmltree", ".", "addContent", "(", "dl", ")", ";", "}" ]
Adds the tags information. @param doc the doc for which the tags will be generated @param htmltree the documentation tree to which the tags will be added
[ "Adds", "the", "tags", "information", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L237-L251
loldevs/riotapi
spectator/src/main/java/net/boreeas/riotapi/spectator/GameEncryptionData.java
GameEncryptionData.getEncryptionCipher
public Cipher getEncryptionCipher() throws GeneralSecurityException { """ Creates a cipher for encrypting data with the specified key. @return A Blowfish/ECB/PKCS5Padding cipher in encryption mode. @throws GeneralSecurityException """ Cipher cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "Blowfish")); return cipher; }
java
public Cipher getEncryptionCipher() throws GeneralSecurityException { Cipher cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "Blowfish")); return cipher; }
[ "public", "Cipher", "getEncryptionCipher", "(", ")", "throws", "GeneralSecurityException", "{", "Cipher", "cipher", "=", "Cipher", ".", "getInstance", "(", "\"Blowfish/ECB/PKCS5Padding\"", ")", ";", "cipher", ".", "init", "(", "Cipher", ".", "ENCRYPT_MODE", ",", "new", "SecretKeySpec", "(", "key", ",", "\"Blowfish\"", ")", ")", ";", "return", "cipher", ";", "}" ]
Creates a cipher for encrypting data with the specified key. @return A Blowfish/ECB/PKCS5Padding cipher in encryption mode. @throws GeneralSecurityException
[ "Creates", "a", "cipher", "for", "encrypting", "data", "with", "the", "specified", "key", "." ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/spectator/src/main/java/net/boreeas/riotapi/spectator/GameEncryptionData.java#L53-L58
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/TextFile.java
TextFile.readTextFile
public static String readTextFile(Context context, int resourceId) { """ Read a text file resource into a single string @param context A non-null Android Context @param resourceId An Android resource id @return The contents, or null on error. """ InputStream inputStream = context.getResources().openRawResource( resourceId); return readTextFile(inputStream); }
java
public static String readTextFile(Context context, int resourceId) { InputStream inputStream = context.getResources().openRawResource( resourceId); return readTextFile(inputStream); }
[ "public", "static", "String", "readTextFile", "(", "Context", "context", ",", "int", "resourceId", ")", "{", "InputStream", "inputStream", "=", "context", ".", "getResources", "(", ")", ".", "openRawResource", "(", "resourceId", ")", ";", "return", "readTextFile", "(", "inputStream", ")", ";", "}" ]
Read a text file resource into a single string @param context A non-null Android Context @param resourceId An Android resource id @return The contents, or null on error.
[ "Read", "a", "text", "file", "resource", "into", "a", "single", "string" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/TextFile.java#L79-L83