repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getRaidInfo
public void getRaidInfo(String[] ids, Callback<List<Raid>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getRaidInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getRaidInfo(String[] ids, Callback<List<Raid>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getRaidInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getRaidInfo", "(", "String", "[", "]", "ids", ",", "Callback", "<", "List", "<", "Raid", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ids", ...
For more info on raids API go <a href="https://wiki.guildwars2.com/wiki/API:2/raids">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 raid id(s) @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 Raid raid info
[ "For", "more", "info", "on", "raids", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "raids", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "user", "the...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2277-L2280
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/AttList.java
AttList.getValue
public String getValue(String uri, String localName) { Node a=m_attrs.getNamedItemNS(uri,localName); return (a==null) ? null : a.getNodeValue(); }
java
public String getValue(String uri, String localName) { Node a=m_attrs.getNamedItemNS(uri,localName); return (a==null) ? null : a.getNodeValue(); }
[ "public", "String", "getValue", "(", "String", "uri", ",", "String", "localName", ")", "{", "Node", "a", "=", "m_attrs", ".", "getNamedItemNS", "(", "uri", ",", "localName", ")", ";", "return", "(", "a", "==", "null", ")", "?", "null", ":", "a", ".",...
Look up an attribute's value by Namespace name. @param uri The Namespace URI, or the empty String if the name has no Namespace URI. @param localName The local name of the attribute. @return The attribute value as a string, or null if the attribute is not in the list.
[ "Look", "up", "an", "attribute", "s", "value", "by", "Namespace", "name", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/AttList.java#L217-L221
gosu-lang/gosu-lang
gosu-core/src/main/java/gw/internal/gosu/parser/GosuParser.java
GosuParser.maybeParseImpliedThisMethod
private boolean maybeParseImpliedThisMethod( int iOffset, int iLineNum, int iColumn, LazyLightweightParserState state, String strFunction, int markBeforeTypeArgs, int iLocBeforeTypeArgs ) { if( getTokenizerInstructor() != null || getScriptPart() != null && TemplateGenerator.GS_TEMPLATE_PARSED.equals( getScriptPart().getId() ) ) { // templates can only access static members from its optional super class return false; } ISymbol thisSym = getSymbolTable().getThisSymbolFromStackOrMap(); if( thisSym == null || getPropertyNameFromMethodNameIncludingSetter( strFunction ) == null ) { return false; } backtrack( markBeforeTypeArgs, iLocBeforeTypeArgs ); // Make a synthetic 'this' qualifier Identifier root = new Identifier(); root.setSymbol( thisSym, getSymbolTable() ); root.setSynthetic( true ); root.setType( thisSym.getType() ); pushExpression( root ); setLocation( getTokenizer().getTokenStart(), iLineNum, iColumn, true, true ); popExpression(); // Try to parse 'Xxx()' as implicitly qualified 'this.Xxx()' parseMemberAccess( root, MemberAccessKind.NORMAL, iOffset, strFunction, state, false ); return true; }
java
private boolean maybeParseImpliedThisMethod( int iOffset, int iLineNum, int iColumn, LazyLightweightParserState state, String strFunction, int markBeforeTypeArgs, int iLocBeforeTypeArgs ) { if( getTokenizerInstructor() != null || getScriptPart() != null && TemplateGenerator.GS_TEMPLATE_PARSED.equals( getScriptPart().getId() ) ) { // templates can only access static members from its optional super class return false; } ISymbol thisSym = getSymbolTable().getThisSymbolFromStackOrMap(); if( thisSym == null || getPropertyNameFromMethodNameIncludingSetter( strFunction ) == null ) { return false; } backtrack( markBeforeTypeArgs, iLocBeforeTypeArgs ); // Make a synthetic 'this' qualifier Identifier root = new Identifier(); root.setSymbol( thisSym, getSymbolTable() ); root.setSynthetic( true ); root.setType( thisSym.getType() ); pushExpression( root ); setLocation( getTokenizer().getTokenStart(), iLineNum, iColumn, true, true ); popExpression(); // Try to parse 'Xxx()' as implicitly qualified 'this.Xxx()' parseMemberAccess( root, MemberAccessKind.NORMAL, iOffset, strFunction, state, false ); return true; }
[ "private", "boolean", "maybeParseImpliedThisMethod", "(", "int", "iOffset", ",", "int", "iLineNum", ",", "int", "iColumn", ",", "LazyLightweightParserState", "state", ",", "String", "strFunction", ",", "int", "markBeforeTypeArgs", ",", "int", "iLocBeforeTypeArgs", ")"...
e.g., void setFoo( String value ) {} and void setFoo( Integer value ) {} are defined in the super class.
[ "e", ".", "g", ".", "void", "setFoo", "(", "String", "value", ")", "{}", "and", "void", "setFoo", "(", "Integer", "value", ")", "{}", "are", "defined", "in", "the", "super", "class", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/GosuParser.java#L5951-L5979
azkaban/azkaban
azkaban-common/src/main/java/azkaban/executor/selector/ExecutorComparator.java
ExecutorComparator.getMemoryComparator
private static FactorComparator<Executor> getMemoryComparator(final int weight) { return FactorComparator.create(MEMORY_COMPARATOR_NAME, weight, new Comparator<Executor>() { @Override public int compare(final Executor o1, final Executor o2) { final ExecutorInfo stat1 = o1.getExecutorInfo(); final ExecutorInfo stat2 = o2.getExecutorInfo(); final int result = 0; if (statisticsObjectCheck(stat1, stat2, MEMORY_COMPARATOR_NAME)) { return result; } if (stat1.getRemainingMemoryInMB() != stat2.getRemainingMemoryInMB()) { return stat1.getRemainingMemoryInMB() > stat2.getRemainingMemoryInMB() ? 1 : -1; } return Double.compare(stat1.getRemainingMemoryPercent(), stat2.getRemainingMemoryPercent()); } }); }
java
private static FactorComparator<Executor> getMemoryComparator(final int weight) { return FactorComparator.create(MEMORY_COMPARATOR_NAME, weight, new Comparator<Executor>() { @Override public int compare(final Executor o1, final Executor o2) { final ExecutorInfo stat1 = o1.getExecutorInfo(); final ExecutorInfo stat2 = o2.getExecutorInfo(); final int result = 0; if (statisticsObjectCheck(stat1, stat2, MEMORY_COMPARATOR_NAME)) { return result; } if (stat1.getRemainingMemoryInMB() != stat2.getRemainingMemoryInMB()) { return stat1.getRemainingMemoryInMB() > stat2.getRemainingMemoryInMB() ? 1 : -1; } return Double.compare(stat1.getRemainingMemoryPercent(), stat2.getRemainingMemoryPercent()); } }); }
[ "private", "static", "FactorComparator", "<", "Executor", ">", "getMemoryComparator", "(", "final", "int", "weight", ")", "{", "return", "FactorComparator", ".", "create", "(", "MEMORY_COMPARATOR_NAME", ",", "weight", ",", "new", "Comparator", "<", "Executor", ">"...
<pre> function defines the Memory comparator. Note: comparator firstly take the absolute value of the remaining memory, if both sides have the same value, it go further to check the percent of the remaining memory. </pre> @param weight weight of the comparator.
[ "<pre", ">", "function", "defines", "the", "Memory", "comparator", ".", "Note", ":", "comparator", "firstly", "take", "the", "absolute", "value", "of", "the", "remaining", "memory", "if", "both", "sides", "have", "the", "same", "value", "it", "go", "further"...
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/executor/selector/ExecutorComparator.java#L226-L246
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java
ThreadPoolExecutor.processWorkerExit
private void processWorkerExit(Worker w, boolean completedAbruptly) { if (completedAbruptly) // If abrupt, then workerCount wasn't adjusted decrementWorkerCount(); final ReentrantLock mainLock = this.mainLock; mainLock.lock(); try { completedTaskCount += w.completedTasks; workers.remove(w); } finally { mainLock.unlock(); } tryTerminate(); int c = ctl.get(); if (runStateLessThan(c, STOP)) { if (!completedAbruptly) { int min = allowCoreThreadTimeOut ? 0 : corePoolSize; if (min == 0 && ! workQueue.isEmpty()) min = 1; if (workerCountOf(c) >= min) return; // replacement not needed } addWorker(null, false); } }
java
private void processWorkerExit(Worker w, boolean completedAbruptly) { if (completedAbruptly) // If abrupt, then workerCount wasn't adjusted decrementWorkerCount(); final ReentrantLock mainLock = this.mainLock; mainLock.lock(); try { completedTaskCount += w.completedTasks; workers.remove(w); } finally { mainLock.unlock(); } tryTerminate(); int c = ctl.get(); if (runStateLessThan(c, STOP)) { if (!completedAbruptly) { int min = allowCoreThreadTimeOut ? 0 : corePoolSize; if (min == 0 && ! workQueue.isEmpty()) min = 1; if (workerCountOf(c) >= min) return; // replacement not needed } addWorker(null, false); } }
[ "private", "void", "processWorkerExit", "(", "Worker", "w", ",", "boolean", "completedAbruptly", ")", "{", "if", "(", "completedAbruptly", ")", "// If abrupt, then workerCount wasn't adjusted", "decrementWorkerCount", "(", ")", ";", "final", "ReentrantLock", "mainLock", ...
Performs cleanup and bookkeeping for a dying worker. Called only from worker threads. Unless completedAbruptly is set, assumes that workerCount has already been adjusted to account for exit. This method removes thread from worker set, and possibly terminates the pool or replaces the worker if either it exited due to user task exception or if fewer than corePoolSize workers are running or queue is non-empty but there are no workers. @param w the worker @param completedAbruptly if the worker died due to user exception
[ "Performs", "cleanup", "and", "bookkeeping", "for", "a", "dying", "worker", ".", "Called", "only", "from", "worker", "threads", ".", "Unless", "completedAbruptly", "is", "set", "assumes", "that", "workerCount", "has", "already", "been", "adjusted", "to", "accoun...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java#L729-L755
craftercms/profile
security-provider/src/main/java/org/craftercms/security/utils/social/ConnectionUtils.java
ConnectionUtils.removeConnectionData
public static void removeConnectionData(Profile profile, String providerId) { Map<String, List<Map<String, Object>>> allConnections = profile.getAttribute(CONNECTIONS_ATTRIBUTE_NAME); if (MapUtils.isNotEmpty(allConnections)) { allConnections.remove(providerId); } }
java
public static void removeConnectionData(Profile profile, String providerId) { Map<String, List<Map<String, Object>>> allConnections = profile.getAttribute(CONNECTIONS_ATTRIBUTE_NAME); if (MapUtils.isNotEmpty(allConnections)) { allConnections.remove(providerId); } }
[ "public", "static", "void", "removeConnectionData", "(", "Profile", "profile", ",", "String", "providerId", ")", "{", "Map", "<", "String", ",", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", ">", "allConnections", "=", "profile", ".", "getAtt...
Remove all {@link ConnectionData} associated to the specified provider ID. @param profile the profile where to remove the data from @param providerId the provider ID of the connection
[ "Remove", "all", "{", "@link", "ConnectionData", "}", "associated", "to", "the", "specified", "provider", "ID", "." ]
train
https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/utils/social/ConnectionUtils.java#L179-L184
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/libcore/io/IoUtils.java
IoUtils.setBlocking
public static void setBlocking(FileDescriptor fd, boolean blocking) throws IOException { try { int flags = Libcore.os.fcntlVoid(fd, F_GETFL); if (!blocking) { flags |= O_NONBLOCK; } else { flags &= ~O_NONBLOCK; } Libcore.os.fcntlLong(fd, F_SETFL, flags); } catch (ErrnoException errnoException) { throw errnoException.rethrowAsIOException(); } }
java
public static void setBlocking(FileDescriptor fd, boolean blocking) throws IOException { try { int flags = Libcore.os.fcntlVoid(fd, F_GETFL); if (!blocking) { flags |= O_NONBLOCK; } else { flags &= ~O_NONBLOCK; } Libcore.os.fcntlLong(fd, F_SETFL, flags); } catch (ErrnoException errnoException) { throw errnoException.rethrowAsIOException(); } }
[ "public", "static", "void", "setBlocking", "(", "FileDescriptor", "fd", ",", "boolean", "blocking", ")", "throws", "IOException", "{", "try", "{", "int", "flags", "=", "Libcore", ".", "os", ".", "fcntlVoid", "(", "fd", ",", "F_GETFL", ")", ";", "if", "("...
Sets 'fd' to be blocking or non-blocking, according to the state of 'blocking'.
[ "Sets", "fd", "to", "be", "blocking", "or", "non", "-", "blocking", "according", "to", "the", "state", "of", "blocking", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/io/IoUtils.java#L87-L99
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java
PlanNode.findAtOrBelow
public PlanNode findAtOrBelow( Traversal order, Type typeToFind ) { return findAtOrBelow(order, EnumSet.of(typeToFind)); }
java
public PlanNode findAtOrBelow( Traversal order, Type typeToFind ) { return findAtOrBelow(order, EnumSet.of(typeToFind)); }
[ "public", "PlanNode", "findAtOrBelow", "(", "Traversal", "order", ",", "Type", "typeToFind", ")", "{", "return", "findAtOrBelow", "(", "order", ",", "EnumSet", ".", "of", "(", "typeToFind", ")", ")", ";", "}" ]
Find the first node with the specified type that are at or below this node. @param order the order to traverse; may not be null @param typeToFind the type of node to find; may not be null @return the first node that is at or below this node that has the supplied type; or null if there is no such node
[ "Find", "the", "first", "node", "with", "the", "specified", "type", "that", "are", "at", "or", "below", "this", "node", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L1484-L1487
mabe02/lanterna
src/main/java/com/googlecode/lanterna/gui2/dialogs/TextInputDialogBuilder.java
TextInputDialogBuilder.setValidationPattern
public TextInputDialogBuilder setValidationPattern(final Pattern pattern, final String errorMessage) { return setValidator(new TextInputDialogResultValidator() { @Override public String validate(String content) { Matcher matcher = pattern.matcher(content); if(!matcher.matches()) { if(errorMessage == null) { return "Invalid input"; } return errorMessage; } return null; } }); }
java
public TextInputDialogBuilder setValidationPattern(final Pattern pattern, final String errorMessage) { return setValidator(new TextInputDialogResultValidator() { @Override public String validate(String content) { Matcher matcher = pattern.matcher(content); if(!matcher.matches()) { if(errorMessage == null) { return "Invalid input"; } return errorMessage; } return null; } }); }
[ "public", "TextInputDialogBuilder", "setValidationPattern", "(", "final", "Pattern", "pattern", ",", "final", "String", "errorMessage", ")", "{", "return", "setValidator", "(", "new", "TextInputDialogResultValidator", "(", ")", "{", "@", "Override", "public", "String"...
Helper method that assigned a validator to the text box the dialog will have which matches the pattern supplied @param pattern Pattern to validate the text box @param errorMessage Error message to show when the pattern doesn't match @return Itself
[ "Helper", "method", "that", "assigned", "a", "validator", "to", "the", "text", "box", "the", "dialog", "will", "have", "which", "matches", "the", "pattern", "supplied" ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/dialogs/TextInputDialogBuilder.java#L127-L141
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzleStatement.java
DrizzleStatement.executeQuery
public ResultSet executeQuery(final String query) throws SQLException { startTimer(); try { if (queryResult != null) { queryResult.close(); } final Query queryToSend = queryFactory.createQuery(query); queryResult = protocol.executeQuery(queryToSend); warningsCleared = false; return new DrizzleResultSet(queryResult, this, getProtocol()); } catch (QueryException e) { throw SQLExceptionMapper.get(e); } finally { stopTimer(); } }
java
public ResultSet executeQuery(final String query) throws SQLException { startTimer(); try { if (queryResult != null) { queryResult.close(); } final Query queryToSend = queryFactory.createQuery(query); queryResult = protocol.executeQuery(queryToSend); warningsCleared = false; return new DrizzleResultSet(queryResult, this, getProtocol()); } catch (QueryException e) { throw SQLExceptionMapper.get(e); } finally { stopTimer(); } }
[ "public", "ResultSet", "executeQuery", "(", "final", "String", "query", ")", "throws", "SQLException", "{", "startTimer", "(", ")", ";", "try", "{", "if", "(", "queryResult", "!=", "null", ")", "{", "queryResult", ".", "close", "(", ")", ";", "}", "final...
executes a select query. @param query the query to send to the server @return a result set @throws SQLException if something went wrong
[ "executes", "a", "select", "query", "." ]
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzleStatement.java#L122-L137
agmip/agmip-common-functions
src/main/java/org/agmip/functions/PTSaxton2006.java
PTSaxton2006.calcAdjustedMoisture33Kpa
public static String calcAdjustedMoisture33Kpa(String slsnd, String slcly, String omPct, String df) { String mt33 = calcMoisture33Kpa(slsnd, slcly, omPct); String satMt = calcSaturatedMoisture(slsnd, slcly, omPct); String adjSatMt = calcAdjustedSaturatedMoisture(slsnd, slcly, omPct, df); String ret = substract(mt33, product(substract(satMt, adjSatMt), "0.2")); LOG.debug("Calculate result for 33 kPa moisture, adjusted density, ([0,100]%) is {}", ret); return ret; }
java
public static String calcAdjustedMoisture33Kpa(String slsnd, String slcly, String omPct, String df) { String mt33 = calcMoisture33Kpa(slsnd, slcly, omPct); String satMt = calcSaturatedMoisture(slsnd, slcly, omPct); String adjSatMt = calcAdjustedSaturatedMoisture(slsnd, slcly, omPct, df); String ret = substract(mt33, product(substract(satMt, adjSatMt), "0.2")); LOG.debug("Calculate result for 33 kPa moisture, adjusted density, ([0,100]%) is {}", ret); return ret; }
[ "public", "static", "String", "calcAdjustedMoisture33Kpa", "(", "String", "slsnd", ",", "String", "slcly", ",", "String", "omPct", ",", "String", "df", ")", "{", "String", "mt33", "=", "calcMoisture33Kpa", "(", "slsnd", ",", "slcly", ",", "omPct", ")", ";", ...
Equation 9 for calculating 33 kPa moisture, adjusted density,([0,100]%) @param slsnd Sand weight percentage by layer ([0,100]%) @param slcly Clay weight percentage by layer ([0,100]%) @param omPct Organic matter weight percentage by layer ([0,100]%), (= SLOC * 1.72) @param df Density adjustment Factor (0.9–1.3)
[ "Equation", "9", "for", "calculating", "33", "kPa", "moisture", "adjusted", "density", "(", "[", "0", "100", "]", "%", ")" ]
train
https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/PTSaxton2006.java#L283-L291
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deleteEntity
public OperationStatus deleteEntity(UUID appId, String versionId, UUID entityId) { return deleteEntityWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body(); }
java
public OperationStatus deleteEntity(UUID appId, String versionId, UUID entityId) { return deleteEntityWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body(); }
[ "public", "OperationStatus", "deleteEntity", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ")", "{", "return", "deleteEntityWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ")", ".", "toBlocking", "(", ")", ...
Deletes an entity extractor from the application. @param appId The application ID. @param versionId The version ID. @param entityId The entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Deletes", "an", "entity", "extractor", "from", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L3565-L3567
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java
StylesheetHandler.notationDecl
public void notationDecl(String name, String publicId, String systemId) { getCurrentProcessor().notationDecl(this, name, publicId, systemId); }
java
public void notationDecl(String name, String publicId, String systemId) { getCurrentProcessor().notationDecl(this, name, publicId, systemId); }
[ "public", "void", "notationDecl", "(", "String", "name", ",", "String", "publicId", ",", "String", "systemId", ")", "{", "getCurrentProcessor", "(", ")", ".", "notationDecl", "(", "this", ",", "name", ",", "publicId", ",", "systemId", ")", ";", "}" ]
Receive notification of a notation declaration. <p>By default, do nothing. Application writers may override this method in a subclass if they wish to keep track of the notations declared in a document.</p> @param name The notation name. @param publicId The notation public identifier, or null if not available. @param systemId The notation system identifier. @see org.xml.sax.DTDHandler#notationDecl
[ "Receive", "notification", "of", "a", "notation", "declaration", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java#L330-L333
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/graph/EdmondsMaximumMatching.java
EdmondsMaximumMatching.parent
private int parent(BitSet ancestors, int curr) { curr = dsf.getRoot(curr); ancestors.set(curr); int parent = dsf.getRoot(even[curr]); if (parent == curr) return curr; // root of tree ancestors.set(parent); return dsf.getRoot(odd[parent]); }
java
private int parent(BitSet ancestors, int curr) { curr = dsf.getRoot(curr); ancestors.set(curr); int parent = dsf.getRoot(even[curr]); if (parent == curr) return curr; // root of tree ancestors.set(parent); return dsf.getRoot(odd[parent]); }
[ "private", "int", "parent", "(", "BitSet", "ancestors", ",", "int", "curr", ")", "{", "curr", "=", "dsf", ".", "getRoot", "(", "curr", ")", ";", "ancestors", ".", "set", "(", "curr", ")", ";", "int", "parent", "=", "dsf", ".", "getRoot", "(", "even...
Access the next ancestor in a tree of the forest. Note we go back two places at once as we only need check 'even' vertices. @param ancestors temporary set which fills up the path we traversed @param curr the current even vertex in the tree @return the next 'even' vertex
[ "Access", "the", "next", "ancestor", "in", "a", "tree", "of", "the", "forest", ".", "Note", "we", "go", "back", "two", "places", "at", "once", "as", "we", "only", "need", "check", "even", "vertices", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/graph/EdmondsMaximumMatching.java#L252-L259
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java
Configuration.getChar
public char getChar(String name, char defaultValue) { return getProps().getProperty(name, String.valueOf(defaultValue)).charAt(0); }
java
public char getChar(String name, char defaultValue) { return getProps().getProperty(name, String.valueOf(defaultValue)).charAt(0); }
[ "public", "char", "getChar", "(", "String", "name", ",", "char", "defaultValue", ")", "{", "return", "getProps", "(", ")", ".", "getProperty", "(", "name", ",", "String", ".", "valueOf", "(", "defaultValue", ")", ")", ".", "charAt", "(", "0", ")", ";",...
Get the char value of the <code>name</code> property, <code>null</code> if no such property exists. Values are processed for <a href="#VariableExpansion">variable expansion</a> before being returned. @param name the property name. @return the value of the <code>name</code> property, or null if no such property exists.
[ "Get", "the", "char", "value", "of", "the", "<code", ">", "name<", "/", "code", ">", "property", "<code", ">", "null<", "/", "code", ">", "if", "no", "such", "property", "exists", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java#L417-L419
Waikato/moa
moa/src/main/java/moa/clusterers/streamkm/Point.java
Point.costOfPoint
public double costOfPoint(int k, Point[] centres){ double nearestCost = -1.0; for(int j=0; j<k; j++){ double distance = 0.0; int l = 0; for(l=0;l<this.dimension;l++){ //Centroid coordinate of the point double centroidCoordinatePoint; if(this.weight != 0.0){ centroidCoordinatePoint = this.coordinates[l] / this.weight; } else { centroidCoordinatePoint = this.coordinates[l]; } //Centroid coordinate of the centre double centroidCoordinateCentre; if(centres[j].weight != 0.0){ centroidCoordinateCentre = centres[j].coordinates[l] / centres[j].weight; } else { centroidCoordinateCentre = centres[j].coordinates[l]; } distance += (centroidCoordinatePoint-centroidCoordinateCentre) * (centroidCoordinatePoint-centroidCoordinateCentre) ; } if(nearestCost <0 || distance < nearestCost) { nearestCost = distance; } } return this.weight * nearestCost; }
java
public double costOfPoint(int k, Point[] centres){ double nearestCost = -1.0; for(int j=0; j<k; j++){ double distance = 0.0; int l = 0; for(l=0;l<this.dimension;l++){ //Centroid coordinate of the point double centroidCoordinatePoint; if(this.weight != 0.0){ centroidCoordinatePoint = this.coordinates[l] / this.weight; } else { centroidCoordinatePoint = this.coordinates[l]; } //Centroid coordinate of the centre double centroidCoordinateCentre; if(centres[j].weight != 0.0){ centroidCoordinateCentre = centres[j].coordinates[l] / centres[j].weight; } else { centroidCoordinateCentre = centres[j].coordinates[l]; } distance += (centroidCoordinatePoint-centroidCoordinateCentre) * (centroidCoordinatePoint-centroidCoordinateCentre) ; } if(nearestCost <0 || distance < nearestCost) { nearestCost = distance; } } return this.weight * nearestCost; }
[ "public", "double", "costOfPoint", "(", "int", "k", ",", "Point", "[", "]", "centres", ")", "{", "double", "nearestCost", "=", "-", "1.0", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "k", ";", "j", "++", ")", "{", "double", "distance", ...
Computes the cost of this point with the given array of centres centres[] (of size k)
[ "Computes", "the", "cost", "of", "this", "point", "with", "the", "given", "array", "of", "centres", "centres", "[]", "(", "of", "size", "k", ")" ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/streamkm/Point.java#L90-L119
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java
DateFormatSymbols.setLocale
final void setLocale(ULocale valid, ULocale actual) { // Change the following to an assertion later if ((valid == null) != (actual == null)) { ///CLOVER:OFF throw new IllegalArgumentException(); ///CLOVER:ON } // Another check we could do is that the actual locale is at // the same level or less specific than the valid locale. this.validLocale = valid; this.actualLocale = actual; }
java
final void setLocale(ULocale valid, ULocale actual) { // Change the following to an assertion later if ((valid == null) != (actual == null)) { ///CLOVER:OFF throw new IllegalArgumentException(); ///CLOVER:ON } // Another check we could do is that the actual locale is at // the same level or less specific than the valid locale. this.validLocale = valid; this.actualLocale = actual; }
[ "final", "void", "setLocale", "(", "ULocale", "valid", ",", "ULocale", "actual", ")", "{", "// Change the following to an assertion later", "if", "(", "(", "valid", "==", "null", ")", "!=", "(", "actual", "==", "null", ")", ")", "{", "///CLOVER:OFF", "throw", ...
Sets information about the locales that were used to create this object. If the object was not constructed from locale data, both arguments should be set to null. Otherwise, neither should be null. The actual locale must be at the same level or less specific than the valid locale. This method is intended for use by factories or other entities that create objects of this class. @param valid the most specific locale containing any resource data, or null @param actual the locale containing data used to construct this object, or null @see android.icu.util.ULocale @see android.icu.util.ULocale#VALID_LOCALE @see android.icu.util.ULocale#ACTUAL_LOCALE
[ "Sets", "information", "about", "the", "locales", "that", "were", "used", "to", "create", "this", "object", ".", "If", "the", "object", "was", "not", "constructed", "from", "locale", "data", "both", "arguments", "should", "be", "set", "to", "null", ".", "O...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java#L2437-L2448
xm-online/xm-commons
xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/spring/LepServiceHandler.java
LepServiceHandler.onMethodInvoke
@SuppressWarnings("squid:S00112") //suppress throwable warning public Object onMethodInvoke(Class<?> targetType, Object target, Method method, Object[] args) throws Throwable { LepService typeLepService = targetType.getAnnotation(LepService.class); Objects.requireNonNull(typeLepService, "No " + LepService.class.getSimpleName() + " annotation for type " + targetType.getCanonicalName()); LogicExtensionPoint methodLep = AnnotationUtils.getAnnotation(method, LogicExtensionPoint.class); // TODO methodLep can be null (if used interface method without @LogicExtensionPoint) !!! // create/get key resolver instance LepKeyResolver keyResolver = getKeyResolver(methodLep); // create base LEP key instance LepKey baseLepKey = getBaseLepKey(typeLepService, methodLep, method); // create LEP method descriptor LepMethod lepMethod = buildLepMethod(targetType, target, method, args); // call LepManager to process LEP try { return getLepManager().processLep(baseLepKey, XmLepConstants.UNUSED_RESOURCE_VERSION, keyResolver, lepMethod); } catch (LepInvocationCauseException e) { log.debug("Error process target", e); throw e.getCause(); } catch (Exception e) { throw e; } }
java
@SuppressWarnings("squid:S00112") //suppress throwable warning public Object onMethodInvoke(Class<?> targetType, Object target, Method method, Object[] args) throws Throwable { LepService typeLepService = targetType.getAnnotation(LepService.class); Objects.requireNonNull(typeLepService, "No " + LepService.class.getSimpleName() + " annotation for type " + targetType.getCanonicalName()); LogicExtensionPoint methodLep = AnnotationUtils.getAnnotation(method, LogicExtensionPoint.class); // TODO methodLep can be null (if used interface method without @LogicExtensionPoint) !!! // create/get key resolver instance LepKeyResolver keyResolver = getKeyResolver(methodLep); // create base LEP key instance LepKey baseLepKey = getBaseLepKey(typeLepService, methodLep, method); // create LEP method descriptor LepMethod lepMethod = buildLepMethod(targetType, target, method, args); // call LepManager to process LEP try { return getLepManager().processLep(baseLepKey, XmLepConstants.UNUSED_RESOURCE_VERSION, keyResolver, lepMethod); } catch (LepInvocationCauseException e) { log.debug("Error process target", e); throw e.getCause(); } catch (Exception e) { throw e; } }
[ "@", "SuppressWarnings", "(", "\"squid:S00112\"", ")", "//suppress throwable warning", "public", "Object", "onMethodInvoke", "(", "Class", "<", "?", ">", "targetType", ",", "Object", "target", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throw...
Processes a LEP method invocation on a proxy instance and returns the result. This method will be invoked on an invocation handler when a method is invoked on a proxy instance that it is associated with. @param targetType type of LEP service (interface, concrete class) @param target target LEP service object, can be {@code null} @param method called LEP method @param args called LEP method arguments @return LEP method result object @throws Throwable the exception to throw from the method invocation on the proxy instance. The exception's type must be assignable either to any of the exception types declared in the {@code throws} clause of the interface method or to the unchecked exception types {@code java.lang.RuntimeException} or {@code java.lang.Error}. If a checked exception is thrown by this method that is not assignable to any of the exception types declared in the {@code throws} clause of the interface method, then an {@link UndeclaredThrowableException} containing the exception that was thrown by this method will be thrown by the method invocation on the proxy instance.
[ "Processes", "a", "LEP", "method", "invocation", "on", "a", "proxy", "instance", "and", "returns", "the", "result", ".", "This", "method", "will", "be", "invoked", "on", "an", "invocation", "handler", "when", "a", "method", "is", "invoked", "on", "a", "pro...
train
https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/spring/LepServiceHandler.java#L64-L91
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloTableManager.java
AccumuloTableManager.ensureNamespace
public void ensureNamespace(String schema) { try { // If the table schema is not "default" and the namespace does not exist, create it if (!schema.equals(DEFAULT) && !connector.namespaceOperations().exists(schema)) { connector.namespaceOperations().create(schema); } } catch (AccumuloException | AccumuloSecurityException e) { throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to check for existence or create Accumulo namespace", e); } catch (NamespaceExistsException e) { // Suppress race condition between test for existence and creation LOG.warn("NamespaceExistsException suppressed when creating " + schema); } }
java
public void ensureNamespace(String schema) { try { // If the table schema is not "default" and the namespace does not exist, create it if (!schema.equals(DEFAULT) && !connector.namespaceOperations().exists(schema)) { connector.namespaceOperations().create(schema); } } catch (AccumuloException | AccumuloSecurityException e) { throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to check for existence or create Accumulo namespace", e); } catch (NamespaceExistsException e) { // Suppress race condition between test for existence and creation LOG.warn("NamespaceExistsException suppressed when creating " + schema); } }
[ "public", "void", "ensureNamespace", "(", "String", "schema", ")", "{", "try", "{", "// If the table schema is not \"default\" and the namespace does not exist, create it", "if", "(", "!", "schema", ".", "equals", "(", "DEFAULT", ")", "&&", "!", "connector", ".", "nam...
Ensures the given Accumulo namespace exist, creating it if necessary @param schema Presto schema (Accumulo namespace)
[ "Ensures", "the", "given", "Accumulo", "namespace", "exist", "creating", "it", "if", "necessary" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloTableManager.java#L60-L75
loadimpact/loadimpact-sdk-java
src/main/java/com/loadimpact/util/Parameters.java
Parameters.get
public String get(String key, String defaultValue) { String value = parameters.get(key); return StringUtils.isBlank(value) ? defaultValue : value; }
java
public String get(String key, String defaultValue) { String value = parameters.get(key); return StringUtils.isBlank(value) ? defaultValue : value; }
[ "public", "String", "get", "(", "String", "key", ",", "String", "defaultValue", ")", "{", "String", "value", "=", "parameters", ".", "get", "(", "key", ")", ";", "return", "StringUtils", ".", "isBlank", "(", "value", ")", "?", "defaultValue", ":", "value...
Returns the value associated with the key, or the given default value. @param key key to find @param defaultValue if not found @return value
[ "Returns", "the", "value", "associated", "with", "the", "key", "or", "the", "given", "default", "value", "." ]
train
https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/util/Parameters.java#L84-L87
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java
DTMDocumentImpl.appendComment
void appendComment(int m_char_current_start,int contentLength) { // create a Comment Node // %TBD% may be possible to combine with appendNode()to replace the next chunk of code int w0 = COMMENT_NODE; // W1: Parent int w1 = currentParent; // W2: Start position within m_char int w2 = m_char_current_start; // W3: Length of the full string int w3 = contentLength; int ourslot = appendNode(w0, w1, w2, w3); previousSibling = ourslot; }
java
void appendComment(int m_char_current_start,int contentLength) { // create a Comment Node // %TBD% may be possible to combine with appendNode()to replace the next chunk of code int w0 = COMMENT_NODE; // W1: Parent int w1 = currentParent; // W2: Start position within m_char int w2 = m_char_current_start; // W3: Length of the full string int w3 = contentLength; int ourslot = appendNode(w0, w1, w2, w3); previousSibling = ourslot; }
[ "void", "appendComment", "(", "int", "m_char_current_start", ",", "int", "contentLength", ")", "{", "// create a Comment Node", "// %TBD% may be possible to combine with appendNode()to replace the next chunk of code", "int", "w0", "=", "COMMENT_NODE", ";", "// W1: Parent", "int",...
Append a comment child at the current insertion point. Assumes that the actual content of the comment has previously been appended to the m_char buffer (shared with the builder). @param m_char_current_start int Starting offset of node's content in m_char. @param contentLength int Length of node's content in m_char.
[ "Append", "a", "comment", "child", "at", "the", "current", "insertion", "point", ".", "Assumes", "that", "the", "actual", "content", "of", "the", "comment", "has", "previously", "been", "appended", "to", "the", "m_char", "buffer", "(", "shared", "with", "the...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L2114-L2128
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java
PersonGroupPersonsImpl.get
public Person get(String personGroupId, UUID personId) { return getWithServiceResponseAsync(personGroupId, personId).toBlocking().single().body(); }
java
public Person get(String personGroupId, UUID personId) { return getWithServiceResponseAsync(personGroupId, personId).toBlocking().single().body(); }
[ "public", "Person", "get", "(", "String", "personGroupId", ",", "UUID", "personId", ")", "{", "return", "getWithServiceResponseAsync", "(", "personGroupId", ",", "personId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ...
Retrieve a person's information, including registered persisted faces, name and userData. @param personGroupId Id referencing a particular person group. @param personId Id referencing a particular person. @throws IllegalArgumentException thrown if parameters fail the validation @throws APIErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the Person object if successful.
[ "Retrieve", "a", "person", "s", "information", "including", "registered", "persisted", "faces", "name", "and", "userData", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java#L535-L537
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/auth/policy/internal/JsonPolicyReader.java
JsonPolicyReader.createPrincipal
private Principal createPrincipal(String schema, JsonNode principalNode) { if (schema.equalsIgnoreCase(PRINCIPAL_SCHEMA_USER)) { return new Principal(PRINCIPAL_SCHEMA_USER, principalNode.asText(), options.isStripAwsPrincipalIdHyphensEnabled()); } else if (schema.equalsIgnoreCase(PRINCIPAL_SCHEMA_SERVICE)) { return new Principal(schema, principalNode.asText()); } else if (schema.equalsIgnoreCase(PRINCIPAL_SCHEMA_FEDERATED)) { if (WebIdentityProviders.fromString(principalNode.asText()) != null) { return new Principal(WebIdentityProviders.fromString(principalNode.asText())); } else { return new Principal(PRINCIPAL_SCHEMA_FEDERATED, principalNode.asText()); } } throw new SdkClientException("Schema " + schema + " is not a valid value for the principal."); }
java
private Principal createPrincipal(String schema, JsonNode principalNode) { if (schema.equalsIgnoreCase(PRINCIPAL_SCHEMA_USER)) { return new Principal(PRINCIPAL_SCHEMA_USER, principalNode.asText(), options.isStripAwsPrincipalIdHyphensEnabled()); } else if (schema.equalsIgnoreCase(PRINCIPAL_SCHEMA_SERVICE)) { return new Principal(schema, principalNode.asText()); } else if (schema.equalsIgnoreCase(PRINCIPAL_SCHEMA_FEDERATED)) { if (WebIdentityProviders.fromString(principalNode.asText()) != null) { return new Principal(WebIdentityProviders.fromString(principalNode.asText())); } else { return new Principal(PRINCIPAL_SCHEMA_FEDERATED, principalNode.asText()); } } throw new SdkClientException("Schema " + schema + " is not a valid value for the principal."); }
[ "private", "Principal", "createPrincipal", "(", "String", "schema", ",", "JsonNode", "principalNode", ")", "{", "if", "(", "schema", ".", "equalsIgnoreCase", "(", "PRINCIPAL_SCHEMA_USER", ")", ")", "{", "return", "new", "Principal", "(", "PRINCIPAL_SCHEMA_USER", "...
Creates a new principal instance for the given schema and the Json node. @param schema the schema for the principal instance being created. @param principalNode the node indicating the AWS account that is making the request. @return a principal instance.
[ "Creates", "a", "new", "principal", "instance", "for", "the", "given", "schema", "and", "the", "Json", "node", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/auth/policy/internal/JsonPolicyReader.java#L254-L267
BlueBrain/bluima
modules/bluima_abbreviations/src/main/java/com/wcohen/ss/TagLink.java
TagLink.score
public double score(StringWrapper s, StringWrapper t) { checkTrainingHasHappened(s,t); UnitVector sBag = asUnitVector(s); UnitVector tBag = asUnitVector(t); if (s.unwrap().equals(t.unwrap())) { return 1.0; } else { String[] sTokens = getTokenArray(sBag), tTokens = getTokenArray(tBag); double[] sIdfArray = getIDFArray(sBag), tIdfArray = getIDFArray(tBag); return algorithm1(sTokens, tTokens, sIdfArray, tIdfArray); } }
java
public double score(StringWrapper s, StringWrapper t) { checkTrainingHasHappened(s,t); UnitVector sBag = asUnitVector(s); UnitVector tBag = asUnitVector(t); if (s.unwrap().equals(t.unwrap())) { return 1.0; } else { String[] sTokens = getTokenArray(sBag), tTokens = getTokenArray(tBag); double[] sIdfArray = getIDFArray(sBag), tIdfArray = getIDFArray(tBag); return algorithm1(sTokens, tTokens, sIdfArray, tIdfArray); } }
[ "public", "double", "score", "(", "StringWrapper", "s", ",", "StringWrapper", "t", ")", "{", "checkTrainingHasHappened", "(", "s", ",", "t", ")", ";", "UnitVector", "sBag", "=", "asUnitVector", "(", "s", ")", ";", "UnitVector", "tBag", "=", "asUnitVector", ...
getStringMetric computes the similarity between a pair of strings T and U. @param T String @param U String @return double
[ "getStringMetric", "computes", "the", "similarity", "between", "a", "pair", "of", "strings", "T", "and", "U", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/TagLink.java#L120-L134
orhanobut/wasp
wasp/src/main/java/com/orhanobut/wasp/utils/SSLUtils.java
SSLUtils.getTrustAllCertSslSocketFactory
public static SSLSocketFactory getTrustAllCertSslSocketFactory() { try { TrustManager[] trustAllCerts = new TrustManager[]{ new X509TrustManager() { @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { } @Override public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { } @Override public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[]{}; } } }; SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, trustAllCerts, new java.security.SecureRandom()); return sslContext.getSocketFactory(); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static SSLSocketFactory getTrustAllCertSslSocketFactory() { try { TrustManager[] trustAllCerts = new TrustManager[]{ new X509TrustManager() { @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { } @Override public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { } @Override public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[]{}; } } }; SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, trustAllCerts, new java.security.SecureRandom()); return sslContext.getSocketFactory(); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "SSLSocketFactory", "getTrustAllCertSslSocketFactory", "(", ")", "{", "try", "{", "TrustManager", "[", "]", "trustAllCerts", "=", "new", "TrustManager", "[", "]", "{", "new", "X509TrustManager", "(", ")", "{", "@", "Override", "public", "void...
Helper method to create an empty {@link SSLSocketFactory} which trusts all certificates It is intended to be used only for testing purposes @return created empty factory
[ "Helper", "method", "to", "create", "an", "empty", "{", "@link", "SSLSocketFactory", "}", "which", "trusts", "all", "certificates", "It", "is", "intended", "to", "be", "used", "only", "for", "testing", "purposes" ]
train
https://github.com/orhanobut/wasp/blob/295d8747aa7e410b185a620a6b87239816a38c11/wasp/src/main/java/com/orhanobut/wasp/utils/SSLUtils.java#L33-L61
google/closure-compiler
src/com/google/javascript/jscomp/JsMessageVisitor.java
JsMessageVisitor.checkNode
protected void checkNode(@Nullable Node node, Token type) throws MalformedException { if (node == null) { throw new MalformedException( "Expected node type " + type + "; found: null", node); } if (node.getToken() != type) { throw new MalformedException( "Expected node type " + type + "; found: " + node.getToken(), node); } }
java
protected void checkNode(@Nullable Node node, Token type) throws MalformedException { if (node == null) { throw new MalformedException( "Expected node type " + type + "; found: null", node); } if (node.getToken() != type) { throw new MalformedException( "Expected node type " + type + "; found: " + node.getToken(), node); } }
[ "protected", "void", "checkNode", "(", "@", "Nullable", "Node", "node", ",", "Token", "type", ")", "throws", "MalformedException", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "MalformedException", "(", "\"Expected node type \"", "+", "type"...
Checks a node's type. @throws MalformedException if the node is null or the wrong type
[ "Checks", "a", "node", "s", "type", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JsMessageVisitor.java#L982-L991
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.toType
public static <S extends T, T extends Tree> Matcher<T> toType( final Class<S> type, final Matcher<? super S> matcher) { return new Matcher<T>() { @Override public boolean matches(T tree, VisitorState state) { return type.isInstance(tree) && matcher.matches(type.cast(tree), state); } }; }
java
public static <S extends T, T extends Tree> Matcher<T> toType( final Class<S> type, final Matcher<? super S> matcher) { return new Matcher<T>() { @Override public boolean matches(T tree, VisitorState state) { return type.isInstance(tree) && matcher.matches(type.cast(tree), state); } }; }
[ "public", "static", "<", "S", "extends", "T", ",", "T", "extends", "Tree", ">", "Matcher", "<", "T", ">", "toType", "(", "final", "Class", "<", "S", ">", "type", ",", "final", "Matcher", "<", "?", "super", "S", ">", "matcher", ")", "{", "return", ...
Converts the given matcher to one that can be applied to any tree but is only executed when run on a tree of {@code type} and returns {@code false} for all other tree types.
[ "Converts", "the", "given", "matcher", "to", "one", "that", "can", "be", "applied", "to", "any", "tree", "but", "is", "only", "executed", "when", "run", "on", "a", "tree", "of", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L1244-L1252
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/model/Tile.java
Tile.getOrigin
public Point getOrigin() { if (this.origin == null) { double x = MercatorProjection.tileToPixel(this.tileX, this.tileSize); double y = MercatorProjection.tileToPixel(this.tileY, this.tileSize); this.origin = new Point(x, y); } return this.origin; }
java
public Point getOrigin() { if (this.origin == null) { double x = MercatorProjection.tileToPixel(this.tileX, this.tileSize); double y = MercatorProjection.tileToPixel(this.tileY, this.tileSize); this.origin = new Point(x, y); } return this.origin; }
[ "public", "Point", "getOrigin", "(", ")", "{", "if", "(", "this", ".", "origin", "==", "null", ")", "{", "double", "x", "=", "MercatorProjection", ".", "tileToPixel", "(", "this", ".", "tileX", ",", "this", ".", "tileSize", ")", ";", "double", "y", "...
Returns the top-left point of this tile in absolute coordinates. @return the top-left point
[ "Returns", "the", "top", "-", "left", "point", "of", "this", "tile", "in", "absolute", "coordinates", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/model/Tile.java#L227-L234
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSHome.java
EJSHome.postCreate
public EJBObject postCreate(BeanO beanO, Object primaryKey) throws CreateException, RemoteException { homeEnabled(); return postCreate(beanO, primaryKey, false); //142250 }
java
public EJBObject postCreate(BeanO beanO, Object primaryKey) throws CreateException, RemoteException { homeEnabled(); return postCreate(beanO, primaryKey, false); //142250 }
[ "public", "EJBObject", "postCreate", "(", "BeanO", "beanO", ",", "Object", "primaryKey", ")", "throws", "CreateException", ",", "RemoteException", "{", "homeEnabled", "(", ")", ";", "return", "postCreate", "(", "beanO", ",", "primaryKey", ",", "false", ")", ";...
Complete the bean creation process. <p> @param beanO the <code>BeanO</code> being created <p> @exception CreateException thrown if create-specific error occurs <p> @exception RemoteException thrown if a container error occurs <p>
[ "Complete", "the", "bean", "creation", "process", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSHome.java#L2549-L2555
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java
OjbTagsHandler.forAllIndexColumns
public void forAllIndexColumns(String template, Properties attributes) throws XDocletException { for (Iterator it = _curIndexDef.getColumns(); it.hasNext(); ) { _curColumnDef = _curTableDef.getColumn((String)it.next()); generate(template); } _curColumnDef = null; }
java
public void forAllIndexColumns(String template, Properties attributes) throws XDocletException { for (Iterator it = _curIndexDef.getColumns(); it.hasNext(); ) { _curColumnDef = _curTableDef.getColumn((String)it.next()); generate(template); } _curColumnDef = null; }
[ "public", "void", "forAllIndexColumns", "(", "String", "template", ",", "Properties", "attributes", ")", "throws", "XDocletException", "{", "for", "(", "Iterator", "it", "=", "_curIndexDef", ".", "getColumns", "(", ")", ";", "it", ".", "hasNext", "(", ")", "...
Processes the template for all columns of the current table index. @param template The template @param attributes The attributes of the tag @exception XDocletException if an error occurs @doc.tag type="block"
[ "Processes", "the", "template", "for", "all", "columns", "of", "the", "current", "table", "index", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L1431-L1439
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateMoney
public static <T extends CharSequence> T validateMoney(T value, String errorMsg) throws ValidateException { if (false == isMoney(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T extends CharSequence> T validateMoney(T value, String errorMsg) throws ValidateException { if (false == isMoney(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validateMoney", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isMoney", "(", "value", ")", ")", "{", "throw", "new", "...
验证是否为货币 @param <T> 字符串类型 @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常
[ "验证是否为货币" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L598-L604
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java
CommerceOrderPersistenceImpl.findByGroupId
@Override public List<CommerceOrder> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceOrder> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceOrder", ">", "findByGroupId", "(", "long", "groupId", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce orders where groupId = &#63;. @param groupId the group ID @return the matching commerce orders
[ "Returns", "all", "the", "commerce", "orders", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java#L1510-L1513
google/closure-compiler
src/com/google/javascript/rhino/TypeDeclarationsIR.java
TypeDeclarationsIR.namedType
public static TypeDeclarationNode namedType(Iterable<String> segments) { Iterator<String> segmentsIt = segments.iterator(); Node node = IR.name(segmentsIt.next()); while (segmentsIt.hasNext()) { node = IR.getprop(node, IR.string(segmentsIt.next())); } return new TypeDeclarationNode(Token.NAMED_TYPE, node); }
java
public static TypeDeclarationNode namedType(Iterable<String> segments) { Iterator<String> segmentsIt = segments.iterator(); Node node = IR.name(segmentsIt.next()); while (segmentsIt.hasNext()) { node = IR.getprop(node, IR.string(segmentsIt.next())); } return new TypeDeclarationNode(Token.NAMED_TYPE, node); }
[ "public", "static", "TypeDeclarationNode", "namedType", "(", "Iterable", "<", "String", ">", "segments", ")", "{", "Iterator", "<", "String", ">", "segmentsIt", "=", "segments", ".", "iterator", "(", ")", ";", "Node", "node", "=", "IR", ".", "name", "(", ...
Produces a tree structure similar to the Rhino AST of a qualified name expression, under a top-level NAMED_TYPE node. <p>Example: <pre> NAMED_TYPE NAME goog STRING ui STRING Window </pre>
[ "Produces", "a", "tree", "structure", "similar", "to", "the", "Rhino", "AST", "of", "a", "qualified", "name", "expression", "under", "a", "top", "-", "level", "NAMED_TYPE", "node", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/TypeDeclarationsIR.java#L125-L132
jenkinsci/blueocean-display-url-plugin
src/main/java/org/jenkinsci/plugins/blueoceandisplayurl/BlueOceanDisplayURLImpl.java
BlueOceanDisplayURLImpl.getFullNameForItemGroup
private static String getFullNameForItemGroup(@Nullable BlueOrganization org, @Nonnull ItemGroup itemGroup) { if (itemGroup instanceof Item) { return getFullNameForItem(org, (Item)itemGroup); } else { return itemGroup.getFullName(); } }
java
private static String getFullNameForItemGroup(@Nullable BlueOrganization org, @Nonnull ItemGroup itemGroup) { if (itemGroup instanceof Item) { return getFullNameForItem(org, (Item)itemGroup); } else { return itemGroup.getFullName(); } }
[ "private", "static", "String", "getFullNameForItemGroup", "(", "@", "Nullable", "BlueOrganization", "org", ",", "@", "Nonnull", "ItemGroup", "itemGroup", ")", "{", "if", "(", "itemGroup", "instanceof", "Item", ")", "{", "return", "getFullNameForItem", "(", "org", ...
Returns full name relative to the <code>BlueOrganization</code> base. Each name is separated by '/' @param org the organization the item belongs to @param itemGroup to return the full name of @return
[ "Returns", "full", "name", "relative", "to", "the", "<code", ">", "BlueOrganization<", "/", "code", ">", "base", ".", "Each", "name", "is", "separated", "by", "/" ]
train
https://github.com/jenkinsci/blueocean-display-url-plugin/blob/d6515117712c9b30a32f32bb6e1a977711b9b037/src/main/java/org/jenkinsci/plugins/blueoceandisplayurl/BlueOceanDisplayURLImpl.java#L148-L154
casmi/casmi
src/main/java/casmi/graphics/color/HSBColor.java
HSBColor.lerpColor
public static Color lerpColor(HSBColor color1, HSBColor color2, double amt) { double hue, saturation, brightness, alpha; hue = color2.hue * amt + color1.hue * (1 - amt); saturation = color2.saturation * amt + color1.saturation * (1 - amt); brightness = color2.brightness * amt + color1.brightness * (1 - amt); alpha = color2.alpha * amt + color1.alpha * (1 - amt); return new HSBColor(hue, saturation, brightness, alpha); }
java
public static Color lerpColor(HSBColor color1, HSBColor color2, double amt) { double hue, saturation, brightness, alpha; hue = color2.hue * amt + color1.hue * (1 - amt); saturation = color2.saturation * amt + color1.saturation * (1 - amt); brightness = color2.brightness * amt + color1.brightness * (1 - amt); alpha = color2.alpha * amt + color1.alpha * (1 - amt); return new HSBColor(hue, saturation, brightness, alpha); }
[ "public", "static", "Color", "lerpColor", "(", "HSBColor", "color1", ",", "HSBColor", "color2", ",", "double", "amt", ")", "{", "double", "hue", ",", "saturation", ",", "brightness", ",", "alpha", ";", "hue", "=", "color2", ".", "hue", "*", "amt", "+", ...
Calculates a color or colors between two color at a specific increment. @param color1 interpolate from this color @param color2 interpolate to this color @param amt between 0.0 and 1.0 @return The calculated color values.
[ "Calculates", "a", "color", "or", "colors", "between", "two", "color", "at", "a", "specific", "increment", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/color/HSBColor.java#L273-L280
rundeck/rundeck
core/src/main/java/com/dtolabs/shared/resources/ResourceXMLGenerator.java
ResourceXMLGenerator.genEntityCommon
private Element genEntityCommon(final Element root, final ResourceXMLParser.Entity entity) { final Element tag = root.addElement(entity.getResourceType()); tag.addAttribute(COMMON_NAME, entity.getName()); tag.addAttribute(COMMON_DESCRIPTION, notNull(entity.getProperty(COMMON_DESCRIPTION))); tag.addAttribute(COMMON_TAGS, notNull(entity.getProperty(COMMON_TAGS))); return tag; }
java
private Element genEntityCommon(final Element root, final ResourceXMLParser.Entity entity) { final Element tag = root.addElement(entity.getResourceType()); tag.addAttribute(COMMON_NAME, entity.getName()); tag.addAttribute(COMMON_DESCRIPTION, notNull(entity.getProperty(COMMON_DESCRIPTION))); tag.addAttribute(COMMON_TAGS, notNull(entity.getProperty(COMMON_TAGS))); return tag; }
[ "private", "Element", "genEntityCommon", "(", "final", "Element", "root", ",", "final", "ResourceXMLParser", ".", "Entity", "entity", ")", "{", "final", "Element", "tag", "=", "root", ".", "addElement", "(", "entity", ".", "getResourceType", "(", ")", ")", "...
Create entity tag based on resourceType of entity, and add common attributes @param root element @param entity entity @return element
[ "Create", "entity", "tag", "based", "on", "resourceType", "of", "entity", "and", "add", "common", "attributes" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/shared/resources/ResourceXMLGenerator.java#L271-L277
OpenBEL/openbel-framework
org.openbel.framework.core/src/main/java/org/openbel/framework/core/protonetwork/ProtoNetworkBuilder.java
ProtoNetworkBuilder.buildProtoNetwork
public int buildProtoNetwork(final ProtoNetwork pn, final Term term) { int ti = pn.getTermTable().addTerm(term); List<Integer> pvals = new ArrayList<Integer>(); List<Parameter> ps = term.getAllParametersLeftToRight(); for (Parameter p : ps) { pvals.add(handleParameter(pn, p)); } TermParameterMapTable tpmt = pn.getTermParameterMapTable(); if (!tpmt.getTermParameterIndex().containsKey(ti)) { tpmt.addTermParameterMapping(ti, pvals); } return ti; }
java
public int buildProtoNetwork(final ProtoNetwork pn, final Term term) { int ti = pn.getTermTable().addTerm(term); List<Integer> pvals = new ArrayList<Integer>(); List<Parameter> ps = term.getAllParametersLeftToRight(); for (Parameter p : ps) { pvals.add(handleParameter(pn, p)); } TermParameterMapTable tpmt = pn.getTermParameterMapTable(); if (!tpmt.getTermParameterIndex().containsKey(ti)) { tpmt.addTermParameterMapping(ti, pvals); } return ti; }
[ "public", "int", "buildProtoNetwork", "(", "final", "ProtoNetwork", "pn", ",", "final", "Term", "term", ")", "{", "int", "ti", "=", "pn", ".", "getTermTable", "(", ")", ".", "addTerm", "(", "term", ")", ";", "List", "<", "Integer", ">", "pvals", "=", ...
Builds the {@link ProtoNetwork} at the {@link Term} level. The found parameters are handled via {@link #handleParameter(ProtoNetwork, Parameter)} and indexed against the term. @param pn {@link ProtoNetwork}, the proto network @param term {@link Term}, the term to evaluate @return {@code int}, the term index in the {@link TermTable}
[ "Builds", "the", "{", "@link", "ProtoNetwork", "}", "at", "the", "{", "@link", "Term", "}", "level", ".", "The", "found", "parameters", "are", "handled", "via", "{", "@link", "#handleParameter", "(", "ProtoNetwork", "Parameter", ")", "}", "and", "indexed", ...
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/protonetwork/ProtoNetworkBuilder.java#L308-L324
pressgang-ccms/PressGangCCMSCommonUtilities
src/main/java/org/jboss/pressgang/ccms/utils/common/DateUtils.java
DateUtils.parseDateStrictly
public static Date parseDateStrictly(String str, String... parsePatterns) throws ParseException { return parseDateWithLeniency(str, null, parsePatterns, false); }
java
public static Date parseDateStrictly(String str, String... parsePatterns) throws ParseException { return parseDateWithLeniency(str, null, parsePatterns, false); }
[ "public", "static", "Date", "parseDateStrictly", "(", "String", "str", ",", "String", "...", "parsePatterns", ")", "throws", "ParseException", "{", "return", "parseDateWithLeniency", "(", "str", ",", "null", ",", "parsePatterns", ",", "false", ")", ";", "}" ]
<p>Parses a string representing a date by trying a variety of different parsers.</p> <p/> <p>The parse will try each parse pattern in turn. A parse is only deemed successful if it parses the whole of the input string. If no parse patterns match, a ParseException is thrown.</p> The parser parses strictly - it does not allow for dates such as "February 942, 1996". @param str the date to parse, not null @param parsePatterns the date format patterns to use, see SimpleDateFormat, not null @return the parsed date @throws IllegalArgumentException if the date string or pattern array is null @throws ParseException if none of the date patterns were suitable @since 2.5
[ "<p", ">", "Parses", "a", "string", "representing", "a", "date", "by", "trying", "a", "variety", "of", "different", "parsers", ".", "<", "/", "p", ">", "<p", "/", ">", "<p", ">", "The", "parse", "will", "try", "each", "parse", "pattern", "in", "turn"...
train
https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DateUtils.java#L94-L96
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/jboss/logging/Logger.java
Logger.warnf
public void warnf(String format, Object... params) { doLogf(Level.WARN, FQCN, format, params, null); }
java
public void warnf(String format, Object... params) { doLogf(Level.WARN, FQCN, format, params, null); }
[ "public", "void", "warnf", "(", "String", "format", ",", "Object", "...", "params", ")", "{", "doLogf", "(", "Level", ".", "WARN", ",", "FQCN", ",", "format", ",", "params", ",", "null", ")", ";", "}" ]
Issue a formatted log message with a level of WARN. @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor @param params the parameters
[ "Issue", "a", "formatted", "log", "message", "with", "a", "level", "of", "WARN", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1395-L1397
mozilla/rhino
src/org/mozilla/javascript/ScriptableObject.java
ScriptableObject.has
@Override public boolean has(int index, Scriptable start) { if (externalData != null) { return (index < externalData.getArrayLength()); } return null != slotMap.query(null, index); }
java
@Override public boolean has(int index, Scriptable start) { if (externalData != null) { return (index < externalData.getArrayLength()); } return null != slotMap.query(null, index); }
[ "@", "Override", "public", "boolean", "has", "(", "int", "index", ",", "Scriptable", "start", ")", "{", "if", "(", "externalData", "!=", "null", ")", "{", "return", "(", "index", "<", "externalData", ".", "getArrayLength", "(", ")", ")", ";", "}", "ret...
Returns true if the property index is defined. @param index the numeric index for the property @param start the object in which the lookup began @return true if and only if the property was found in the object
[ "Returns", "true", "if", "the", "property", "index", "is", "defined", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L428-L435
google/closure-compiler
src/com/google/javascript/refactoring/Matchers.java
Matchers.propertyAccess
public static Matcher propertyAccess(final String name) { return new Matcher() { @Override public boolean matches(Node node, NodeMetadata metadata) { if (node.isGetProp()) { if (name == null) { return true; } if (node.matchesQualifiedName(name)) { return true; } else if (name.contains(".prototype.")) { return matchesPrototypeInstanceVar(node, metadata, name); } } return false; } }; }
java
public static Matcher propertyAccess(final String name) { return new Matcher() { @Override public boolean matches(Node node, NodeMetadata metadata) { if (node.isGetProp()) { if (name == null) { return true; } if (node.matchesQualifiedName(name)) { return true; } else if (name.contains(".prototype.")) { return matchesPrototypeInstanceVar(node, metadata, name); } } return false; } }; }
[ "public", "static", "Matcher", "propertyAccess", "(", "final", "String", "name", ")", "{", "return", "new", "Matcher", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "Node", "node", ",", "NodeMetadata", "metadata", ")", "{", "if", "("...
Returns a Matcher that matches nodes representing a GETPROP access of an object property. @param name The name of the property to match. For non-static properties, this must be the fully qualified name that includes the type of the object. For instance: {@code ns.AppContext.prototype.root} will match {@code appContext.root} and {@code this.root} when accessed from the AppContext.
[ "Returns", "a", "Matcher", "that", "matches", "nodes", "representing", "a", "GETPROP", "access", "of", "an", "object", "property", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L252-L269
radkovo/CSSBox
src/main/java/org/fit/cssbox/layout/BrowserConfig.java
BrowserConfig.createDocumentSource
public DocumentSource createDocumentSource(URL base, String urlstring) { try { Constructor<? extends DocumentSource> constr = getDocumentSourceClass().getConstructor(URL.class, String.class); return constr.newInstance(base, urlstring); } catch (Exception e) { log.warn("Could not create the DocumentSource instance: " + e.getMessage()); return null; } }
java
public DocumentSource createDocumentSource(URL base, String urlstring) { try { Constructor<? extends DocumentSource> constr = getDocumentSourceClass().getConstructor(URL.class, String.class); return constr.newInstance(base, urlstring); } catch (Exception e) { log.warn("Could not create the DocumentSource instance: " + e.getMessage()); return null; } }
[ "public", "DocumentSource", "createDocumentSource", "(", "URL", "base", ",", "String", "urlstring", ")", "{", "try", "{", "Constructor", "<", "?", "extends", "DocumentSource", ">", "constr", "=", "getDocumentSourceClass", "(", ")", ".", "getConstructor", "(", "U...
Creates a new instance of the {@link org.fit.cssbox.io.DocumentSource} class registered in the browser configuration. @param base the base URL @param urlstring the URL suffix @return the document source.
[ "Creates", "a", "new", "instance", "of", "the", "{" ]
train
https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/BrowserConfig.java#L298-L308
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/contextmenu/CmsHistory.java
CmsHistory.loadDialog
public static void loadDialog(final CmsUUID structureId, final I_CmsHistoryActionHandler handler) { CmsRpcAction<CmsHistoryResourceCollection> action = new CmsRpcAction<CmsHistoryResourceCollection>() { @Override public void execute() { start(200, true); CmsCoreProvider.getVfsService().getResourceHistory(structureId, this); } @Override protected void onResponse(CmsHistoryResourceCollection result) { stop(false); final CmsPopup popup = new CmsPopup(CmsHistoryMessages.dialogTitle(), 1150); popup.addDialogClose(null); CmsResourceHistoryView view = new CmsResourceHistoryView(result, handler); handler.setPostRevertAction(new Runnable() { public void run() { popup.hide(); } }); popup.setMainContent(view); popup.setModal(true); popup.setGlassEnabled(true); popup.centerHorizontally(80); } }; action.execute(); }
java
public static void loadDialog(final CmsUUID structureId, final I_CmsHistoryActionHandler handler) { CmsRpcAction<CmsHistoryResourceCollection> action = new CmsRpcAction<CmsHistoryResourceCollection>() { @Override public void execute() { start(200, true); CmsCoreProvider.getVfsService().getResourceHistory(structureId, this); } @Override protected void onResponse(CmsHistoryResourceCollection result) { stop(false); final CmsPopup popup = new CmsPopup(CmsHistoryMessages.dialogTitle(), 1150); popup.addDialogClose(null); CmsResourceHistoryView view = new CmsResourceHistoryView(result, handler); handler.setPostRevertAction(new Runnable() { public void run() { popup.hide(); } }); popup.setMainContent(view); popup.setModal(true); popup.setGlassEnabled(true); popup.centerHorizontally(80); } }; action.execute(); }
[ "public", "static", "void", "loadDialog", "(", "final", "CmsUUID", "structureId", ",", "final", "I_CmsHistoryActionHandler", "handler", ")", "{", "CmsRpcAction", "<", "CmsHistoryResourceCollection", ">", "action", "=", "new", "CmsRpcAction", "<", "CmsHistoryResourceColl...
Loads the data necessary for the history dialog and then displays that dialog.<p> @param structureId the structure id for which the history should be loaded.<p> @param handler the history action handler to use
[ "Loads", "the", "data", "necessary", "for", "the", "history", "dialog", "and", "then", "displays", "that", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/contextmenu/CmsHistory.java#L71-L105
op4j/op4j
src/main/java/org/op4j/Op.java
Op.onArrayFor
public static <T> Level0ArrayOperator<BigInteger[],BigInteger> onArrayFor(final BigInteger... elements) { return onArrayOf(Types.BIG_INTEGER, VarArgsUtil.asRequiredObjectArray(elements)); }
java
public static <T> Level0ArrayOperator<BigInteger[],BigInteger> onArrayFor(final BigInteger... elements) { return onArrayOf(Types.BIG_INTEGER, VarArgsUtil.asRequiredObjectArray(elements)); }
[ "public", "static", "<", "T", ">", "Level0ArrayOperator", "<", "BigInteger", "[", "]", ",", "BigInteger", ">", "onArrayFor", "(", "final", "BigInteger", "...", "elements", ")", "{", "return", "onArrayOf", "(", "Types", ".", "BIG_INTEGER", ",", "VarArgsUtil", ...
<p> Creates an array with the specified elements and an <i>operation expression</i> on it. </p> @param elements the elements of the array being created @return an operator, ready for chaining
[ "<p", ">", "Creates", "an", "array", "with", "the", "specified", "elements", "and", "an", "<i", ">", "operation", "expression<", "/", "i", ">", "on", "it", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L997-L999
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/ChannelUpgradeHandler.java
ChannelUpgradeHandler.addProtocol
public synchronized void addProtocol(String productString, ChannelListener<? super StreamConnection> openListener, final HttpUpgradeHandshake handshake) { addProtocol(productString, null, openListener, handshake); }
java
public synchronized void addProtocol(String productString, ChannelListener<? super StreamConnection> openListener, final HttpUpgradeHandshake handshake) { addProtocol(productString, null, openListener, handshake); }
[ "public", "synchronized", "void", "addProtocol", "(", "String", "productString", ",", "ChannelListener", "<", "?", "super", "StreamConnection", ">", "openListener", ",", "final", "HttpUpgradeHandshake", "handshake", ")", "{", "addProtocol", "(", "productString", ",", ...
Add a protocol to this handler. @param productString the product string to match @param openListener the open listener to call @param handshake a handshake implementation that can be used to verify the client request and modify the response
[ "Add", "a", "protocol", "to", "this", "handler", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/ChannelUpgradeHandler.java#L53-L55
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfContentParser.java
PdfContentParser.readPRObject
public PdfObject readPRObject() throws IOException { if (!nextValidToken()) return null; int type = tokeniser.getTokenType(); switch (type) { case PRTokeniser.TK_START_DIC: { PdfDictionary dic = readDictionary(); return dic; } case PRTokeniser.TK_START_ARRAY: return readArray(); case PRTokeniser.TK_STRING: PdfString str = new PdfString(tokeniser.getStringValue(), null).setHexWriting(tokeniser.isHexString()); return str; case PRTokeniser.TK_NAME: return new PdfName(tokeniser.getStringValue(), false); case PRTokeniser.TK_NUMBER: return new PdfNumber(tokeniser.getStringValue()); case PRTokeniser.TK_OTHER: return new PdfLiteral(COMMAND_TYPE, tokeniser.getStringValue()); default: return new PdfLiteral(-type, tokeniser.getStringValue()); } }
java
public PdfObject readPRObject() throws IOException { if (!nextValidToken()) return null; int type = tokeniser.getTokenType(); switch (type) { case PRTokeniser.TK_START_DIC: { PdfDictionary dic = readDictionary(); return dic; } case PRTokeniser.TK_START_ARRAY: return readArray(); case PRTokeniser.TK_STRING: PdfString str = new PdfString(tokeniser.getStringValue(), null).setHexWriting(tokeniser.isHexString()); return str; case PRTokeniser.TK_NAME: return new PdfName(tokeniser.getStringValue(), false); case PRTokeniser.TK_NUMBER: return new PdfNumber(tokeniser.getStringValue()); case PRTokeniser.TK_OTHER: return new PdfLiteral(COMMAND_TYPE, tokeniser.getStringValue()); default: return new PdfLiteral(-type, tokeniser.getStringValue()); } }
[ "public", "PdfObject", "readPRObject", "(", ")", "throws", "IOException", "{", "if", "(", "!", "nextValidToken", "(", ")", ")", "return", "null", ";", "int", "type", "=", "tokeniser", ".", "getTokenType", "(", ")", ";", "switch", "(", "type", ")", "{", ...
Reads a pdf object. @return the pdf object @throws IOException on error
[ "Reads", "a", "pdf", "object", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentParser.java#L166-L189
visenze/visearch-sdk-java
src/main/java/com/visenze/visearch/ViSearch.java
ViSearch.sendSolutionActions
private void sendSolutionActions(String action, String reqId){ if(reqId!=null && !reqId.equals("")) { Map<String, String> map = Maps.newHashMap(); map.put("action", action); map.put("reqid", reqId); this.sendEvent(map); } }
java
private void sendSolutionActions(String action, String reqId){ if(reqId!=null && !reqId.equals("")) { Map<String, String> map = Maps.newHashMap(); map.put("action", action); map.put("reqid", reqId); this.sendEvent(map); } }
[ "private", "void", "sendSolutionActions", "(", "String", "action", ",", "String", "reqId", ")", "{", "if", "(", "reqId", "!=", "null", "&&", "!", "reqId", ".", "equals", "(", "\"\"", ")", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "="...
send search actions after finishing search @param action @param reqId
[ "send", "search", "actions", "after", "finishing", "search" ]
train
https://github.com/visenze/visearch-sdk-java/blob/133611b84a7489f08bf40b55912ccd2acc7f002c/src/main/java/com/visenze/visearch/ViSearch.java#L330-L337
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/CommonExpectations.java
CommonExpectations.jwtCookieExists
public static Expectations jwtCookieExists(String testAction, WebClient webClient, String jwtCookieName, boolean isSecure, boolean isHttpOnly) { Expectations expectations = new Expectations(); expectations.addExpectation(new CookieExpectation(testAction, webClient, jwtCookieName, JwtFatConstants.JWT_REGEX, isSecure, isHttpOnly)); return expectations; }
java
public static Expectations jwtCookieExists(String testAction, WebClient webClient, String jwtCookieName, boolean isSecure, boolean isHttpOnly) { Expectations expectations = new Expectations(); expectations.addExpectation(new CookieExpectation(testAction, webClient, jwtCookieName, JwtFatConstants.JWT_REGEX, isSecure, isHttpOnly)); return expectations; }
[ "public", "static", "Expectations", "jwtCookieExists", "(", "String", "testAction", ",", "WebClient", "webClient", ",", "String", "jwtCookieName", ",", "boolean", "isSecure", ",", "boolean", "isHttpOnly", ")", "{", "Expectations", "expectations", "=", "new", "Expect...
Sets expectations that will check: <ol> <li>The provided WebClient contains a cookie with the default JWT SSO cookie name, its value is a JWT, is NOT marked secure, and is marked HttpOnly </ol>
[ "Sets", "expectations", "that", "will", "check", ":", "<ol", ">", "<li", ">", "The", "provided", "WebClient", "contains", "a", "cookie", "with", "the", "default", "JWT", "SSO", "cookie", "name", "its", "value", "is", "a", "JWT", "is", "NOT", "marked", "s...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/CommonExpectations.java#L82-L86
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/lang/Strings.java
Strings.mergeSeq
public static String mergeSeq(final String first, final String second) { return mergeSeq(first, second, DELIMITER); }
java
public static String mergeSeq(final String first, final String second) { return mergeSeq(first, second, DELIMITER); }
[ "public", "static", "String", "mergeSeq", "(", "final", "String", "first", ",", "final", "String", "second", ")", "{", "return", "mergeSeq", "(", "first", ",", "second", ",", "DELIMITER", ")", ";", "}" ]
<p> mergeSeq. </p> @param first a {@link java.lang.String} object. @param second a {@link java.lang.String} object. @return a {@link java.lang.String} object.
[ "<p", ">", "mergeSeq", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L573-L575
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/impl/VaultConfig.java
VaultConfig.readVaultElement_3_0
static VaultConfig readVaultElement_3_0(XMLExtendedStreamReader reader, Namespace expectedNs) throws XMLStreamException { final VaultConfig config = new VaultConfig(); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); String name = reader.getAttributeLocalName(i); if (name.equals(CODE)){ config.code = value; } else if (name.equals(MODULE)){ config.module = value; } else { unexpectedVaultAttribute(reader.getAttributeLocalName(i), reader); } } if (config.code == null && config.module != null){ throw new XMLStreamException("Attribute 'module' was specified without an attribute" + " 'code' for element '" + VAULT + "' at " + reader.getLocation()); } readVaultOptions(reader, config); return config; }
java
static VaultConfig readVaultElement_3_0(XMLExtendedStreamReader reader, Namespace expectedNs) throws XMLStreamException { final VaultConfig config = new VaultConfig(); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); String name = reader.getAttributeLocalName(i); if (name.equals(CODE)){ config.code = value; } else if (name.equals(MODULE)){ config.module = value; } else { unexpectedVaultAttribute(reader.getAttributeLocalName(i), reader); } } if (config.code == null && config.module != null){ throw new XMLStreamException("Attribute 'module' was specified without an attribute" + " 'code' for element '" + VAULT + "' at " + reader.getLocation()); } readVaultOptions(reader, config); return config; }
[ "static", "VaultConfig", "readVaultElement_3_0", "(", "XMLExtendedStreamReader", "reader", ",", "Namespace", "expectedNs", ")", "throws", "XMLStreamException", "{", "final", "VaultConfig", "config", "=", "new", "VaultConfig", "(", ")", ";", "final", "int", "count", ...
In the 3.0 xsd the vault configuration and its options are part of the vault xsd. @param reader the reader at the vault element @param expectedNs the namespace @return the vault configuration
[ "In", "the", "3", ".", "0", "xsd", "the", "vault", "configuration", "and", "its", "options", "are", "part", "of", "the", "vault", "xsd", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/VaultConfig.java#L104-L125
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java
CertificateOperations.createCertificate
public void createCertificate(InputStream certStream, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException, CertificateException, NoSuchAlgorithmException { CertificateFactory x509CertFact = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate) x509CertFact.generateCertificate(certStream); CertificateAddParameter addParam = new CertificateAddParameter() .withCertificateFormat(CertificateFormat.CER) .withThumbprintAlgorithm(SHA1_CERTIFICATE_ALGORITHM) .withThumbprint(getThumbPrint(cert)) .withData(Base64.encodeBase64String(cert.getEncoded())); createCertificate(addParam, additionalBehaviors); }
java
public void createCertificate(InputStream certStream, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException, CertificateException, NoSuchAlgorithmException { CertificateFactory x509CertFact = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate) x509CertFact.generateCertificate(certStream); CertificateAddParameter addParam = new CertificateAddParameter() .withCertificateFormat(CertificateFormat.CER) .withThumbprintAlgorithm(SHA1_CERTIFICATE_ALGORITHM) .withThumbprint(getThumbPrint(cert)) .withData(Base64.encodeBase64String(cert.getEncoded())); createCertificate(addParam, additionalBehaviors); }
[ "public", "void", "createCertificate", "(", "InputStream", "certStream", ",", "Iterable", "<", "BatchClientBehavior", ">", "additionalBehaviors", ")", "throws", "BatchErrorException", ",", "IOException", ",", "CertificateException", ",", "NoSuchAlgorithmException", "{", "...
Adds a certificate to the Batch account. @param certStream The certificate data in .cer format. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. @throws CertificateException Exception thrown when an error is encountered processing the provided certificate. @throws NoSuchAlgorithmException Exception thrown if the X.509 provider is not registered in the Java security provider list.
[ "Adds", "a", "certificate", "to", "the", "Batch", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java#L115-L126
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesInner.java
ManagedBackupShortTermRetentionPoliciesInner.beginUpdateAsync
public Observable<ManagedBackupShortTermRetentionPolicyInner> beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).map(new Func1<ServiceResponse<ManagedBackupShortTermRetentionPolicyInner>, ManagedBackupShortTermRetentionPolicyInner>() { @Override public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse<ManagedBackupShortTermRetentionPolicyInner> response) { return response.body(); } }); }
java
public Observable<ManagedBackupShortTermRetentionPolicyInner> beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).map(new Func1<ServiceResponse<ManagedBackupShortTermRetentionPolicyInner>, ManagedBackupShortTermRetentionPolicyInner>() { @Override public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse<ManagedBackupShortTermRetentionPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ManagedBackupShortTermRetentionPolicyInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "managedInstanceName", ",", "String", "databaseName", ",", "Integer", "retentionDays", ")", "{", "return", "beginUpdateWith...
Updates a managed database's short term retention policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance. @param databaseName The name of the database. @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ManagedBackupShortTermRetentionPolicyInner object
[ "Updates", "a", "managed", "database", "s", "short", "term", "retention", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesInner.java#L833-L840
thorstenwagner/TraJ
src/main/java/de/biomedical_imaging/traj/math/TrajectorySplineFit.java
TrajectorySplineFit.distancePointLine
public double distancePointLine(Point2D.Double p1,Point2D.Double p2,Point2D.Double p){ double d; double m = (p2.y-p1.y)/(p2.x-p1.x); if(Double.isInfinite(m)) { d = Math.abs(p2.x-p.x); } else{ double k = -1*m*p1.x+p1.y; d = Math.sqrt( Math.pow( (p.x+m*p.y-m*k)/(m*m+1)-p.x , 2) + Math.pow( m*( (p.x+m*p.y-m*k)/(m*m+1))+k-p.y , 2)); } return d; }
java
public double distancePointLine(Point2D.Double p1,Point2D.Double p2,Point2D.Double p){ double d; double m = (p2.y-p1.y)/(p2.x-p1.x); if(Double.isInfinite(m)) { d = Math.abs(p2.x-p.x); } else{ double k = -1*m*p1.x+p1.y; d = Math.sqrt( Math.pow( (p.x+m*p.y-m*k)/(m*m+1)-p.x , 2) + Math.pow( m*( (p.x+m*p.y-m*k)/(m*m+1))+k-p.y , 2)); } return d; }
[ "public", "double", "distancePointLine", "(", "Point2D", ".", "Double", "p1", ",", "Point2D", ".", "Double", "p2", ",", "Point2D", ".", "Double", "p", ")", "{", "double", "d", ";", "double", "m", "=", "(", "p2", ".", "y", "-", "p1", ".", "y", ")", ...
Please see https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line#Another_formula and http://mathworld.wolfram.com/Two-PointForm.html @param p1 First point on line @param p2 Second point on line @param p Point for which the distance should be calculated. @return distance of p to line defined by p1&p2
[ "Please", "see", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Distance_from_a_point_to_a_line#Another_formula", "and", "http", ":", "//", "mathworld", ".", "wolfram", ".", "com", "/", "Two", "-", "PointForm", ".", "html" ]
train
https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traj/math/TrajectorySplineFit.java#L517-L530
Azure/azure-sdk-for-java
recoveryservices/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/v2016_06_01/implementation/ReplicationUsagesInner.java
ReplicationUsagesInner.listAsync
public Observable<List<ReplicationUsageInner>> listAsync(String resourceGroupName, String vaultName) { return listWithServiceResponseAsync(resourceGroupName, vaultName).map(new Func1<ServiceResponse<List<ReplicationUsageInner>>, List<ReplicationUsageInner>>() { @Override public List<ReplicationUsageInner> call(ServiceResponse<List<ReplicationUsageInner>> response) { return response.body(); } }); }
java
public Observable<List<ReplicationUsageInner>> listAsync(String resourceGroupName, String vaultName) { return listWithServiceResponseAsync(resourceGroupName, vaultName).map(new Func1<ServiceResponse<List<ReplicationUsageInner>>, List<ReplicationUsageInner>>() { @Override public List<ReplicationUsageInner> call(ServiceResponse<List<ReplicationUsageInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "ReplicationUsageInner", ">", ">", "listAsync", "(", "String", "resourceGroupName", ",", "String", "vaultName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "vaultName", ")", ".", "map",...
Fetches the replication usages of the vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param vaultName The name of the recovery services vault. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ReplicationUsageInner&gt; object
[ "Fetches", "the", "replication", "usages", "of", "the", "vault", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/v2016_06_01/implementation/ReplicationUsagesInner.java#L96-L103
apache/flink
flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java
AbstractFetcher.emitRecord
protected void emitRecord(T record, KafkaTopicPartitionState<KPH> partitionState, long offset) throws Exception { if (record != null) { if (timestampWatermarkMode == NO_TIMESTAMPS_WATERMARKS) { // fast path logic, in case there are no watermarks // emit the record, using the checkpoint lock to guarantee // atomicity of record emission and offset state update synchronized (checkpointLock) { sourceContext.collect(record); partitionState.setOffset(offset); } } else if (timestampWatermarkMode == PERIODIC_WATERMARKS) { emitRecordWithTimestampAndPeriodicWatermark(record, partitionState, offset, Long.MIN_VALUE); } else { emitRecordWithTimestampAndPunctuatedWatermark(record, partitionState, offset, Long.MIN_VALUE); } } else { // if the record is null, simply just update the offset state for partition synchronized (checkpointLock) { partitionState.setOffset(offset); } } }
java
protected void emitRecord(T record, KafkaTopicPartitionState<KPH> partitionState, long offset) throws Exception { if (record != null) { if (timestampWatermarkMode == NO_TIMESTAMPS_WATERMARKS) { // fast path logic, in case there are no watermarks // emit the record, using the checkpoint lock to guarantee // atomicity of record emission and offset state update synchronized (checkpointLock) { sourceContext.collect(record); partitionState.setOffset(offset); } } else if (timestampWatermarkMode == PERIODIC_WATERMARKS) { emitRecordWithTimestampAndPeriodicWatermark(record, partitionState, offset, Long.MIN_VALUE); } else { emitRecordWithTimestampAndPunctuatedWatermark(record, partitionState, offset, Long.MIN_VALUE); } } else { // if the record is null, simply just update the offset state for partition synchronized (checkpointLock) { partitionState.setOffset(offset); } } }
[ "protected", "void", "emitRecord", "(", "T", "record", ",", "KafkaTopicPartitionState", "<", "KPH", ">", "partitionState", ",", "long", "offset", ")", "throws", "Exception", "{", "if", "(", "record", "!=", "null", ")", "{", "if", "(", "timestampWatermarkMode",...
Emits a record without attaching an existing timestamp to it. <p>Implementation Note: This method is kept brief to be JIT inlining friendly. That makes the fast path efficient, the extended paths are called as separate methods. @param record The record to emit @param partitionState The state of the Kafka partition from which the record was fetched @param offset The offset of the record
[ "Emits", "a", "record", "without", "attaching", "an", "existing", "timestamp", "to", "it", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java#L353-L376
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java
ValueEnforcer.isBetweenExclusive
public static BigDecimal isBetweenExclusive (final BigDecimal aValue, final String sName, @Nonnull final BigDecimal aLowerBoundExclusive, @Nonnull final BigDecimal aUpperBoundExclusive) { if (isEnabled ()) return isBetweenExclusive (aValue, () -> sName, aLowerBoundExclusive, aUpperBoundExclusive); return aValue; }
java
public static BigDecimal isBetweenExclusive (final BigDecimal aValue, final String sName, @Nonnull final BigDecimal aLowerBoundExclusive, @Nonnull final BigDecimal aUpperBoundExclusive) { if (isEnabled ()) return isBetweenExclusive (aValue, () -> sName, aLowerBoundExclusive, aUpperBoundExclusive); return aValue; }
[ "public", "static", "BigDecimal", "isBetweenExclusive", "(", "final", "BigDecimal", "aValue", ",", "final", "String", "sName", ",", "@", "Nonnull", "final", "BigDecimal", "aLowerBoundExclusive", ",", "@", "Nonnull", "final", "BigDecimal", "aUpperBoundExclusive", ")", ...
Check if <code>nValue &gt; nLowerBoundInclusive &amp;&amp; nValue &lt; nUpperBoundInclusive</code> @param aValue Value @param sName Name @param aLowerBoundExclusive Lower bound @param aUpperBoundExclusive Upper bound @return The value
[ "Check", "if", "<code", ">", "nValue", "&gt", ";", "nLowerBoundInclusive", "&amp", ";", "&amp", ";", "nValue", "&lt", ";", "nUpperBoundInclusive<", "/", "code", ">" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L2955-L2963
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/BaseAsset.java
BaseAsset.createLink
public Link createLink(String name, String url, boolean onMenu) { return getInstance().create().link(name, this, url, onMenu); }
java
public Link createLink(String name, String url, boolean onMenu) { return getInstance().create().link(name, this, url, onMenu); }
[ "public", "Link", "createLink", "(", "String", "name", ",", "String", "url", ",", "boolean", "onMenu", ")", "{", "return", "getInstance", "(", ")", ".", "create", "(", ")", ".", "link", "(", "name", ",", "this", ",", "url", ",", "onMenu", ")", ";", ...
Create a link that belongs to this asset. @param name The name of the link. @param url The url of the link. @param onMenu True if the link is visible on this asset's detail page menu. @return created Link.
[ "Create", "a", "link", "that", "belongs", "to", "this", "asset", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/BaseAsset.java#L213-L215
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java
PyExpressionGenerator._generate
protected XExpression _generate(XListLiteral literal, IAppendable it, IExtraLanguageGeneratorContext context) { appendReturnIfExpectedReturnedExpression(it, context); it.append("["); //$NON-NLS-1$ boolean first = true; for (final XExpression value : literal.getElements()) { if (first) { first = false; } else { it.append(", "); //$NON-NLS-1$ } generate(value, it, context); } it.append("]"); //$NON-NLS-1$ return literal; }
java
protected XExpression _generate(XListLiteral literal, IAppendable it, IExtraLanguageGeneratorContext context) { appendReturnIfExpectedReturnedExpression(it, context); it.append("["); //$NON-NLS-1$ boolean first = true; for (final XExpression value : literal.getElements()) { if (first) { first = false; } else { it.append(", "); //$NON-NLS-1$ } generate(value, it, context); } it.append("]"); //$NON-NLS-1$ return literal; }
[ "protected", "XExpression", "_generate", "(", "XListLiteral", "literal", ",", "IAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "appendReturnIfExpectedReturnedExpression", "(", "it", ",", "context", ")", ";", "it", ".", "append", "(", ...
Generate the given object. @param literal the list literal. @param it the target for the generated content. @param context the context. @return the literal.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L699-L713
camunda/camunda-bpm-mockito
src/main/java/org/camunda/bpm/extension/mockito/process/CallActivityMock.java
CallActivityMock.onExecutionDo
public CallActivityMock onExecutionDo(final String serviceId, final Consumer<DelegateExecution> consumer) { flowNodeBuilder = flowNodeBuilder.serviceTask(serviceId) .camundaDelegateExpression("${id}".replace("id", serviceId)); registerInstance(serviceId, (JavaDelegate) consumer::accept); return this; }
java
public CallActivityMock onExecutionDo(final String serviceId, final Consumer<DelegateExecution> consumer) { flowNodeBuilder = flowNodeBuilder.serviceTask(serviceId) .camundaDelegateExpression("${id}".replace("id", serviceId)); registerInstance(serviceId, (JavaDelegate) consumer::accept); return this; }
[ "public", "CallActivityMock", "onExecutionDo", "(", "final", "String", "serviceId", ",", "final", "Consumer", "<", "DelegateExecution", ">", "consumer", ")", "{", "flowNodeBuilder", "=", "flowNodeBuilder", ".", "serviceTask", "(", "serviceId", ")", ".", "camundaDele...
On execution, the MockProcess will execute the given consumer with a DelegateExecution. @param serviceId ... the id of the mock delegate @param consumer delegate for service task @return self
[ "On", "execution", "the", "MockProcess", "will", "execute", "the", "given", "consumer", "with", "a", "DelegateExecution", "." ]
train
https://github.com/camunda/camunda-bpm-mockito/blob/77b86c9710813f0bfa59b92985e126a9dad66eef/src/main/java/org/camunda/bpm/extension/mockito/process/CallActivityMock.java#L89-L95
elki-project/elki
addons/joglvis/src/main/java/de/lmu/ifi/dbs/elki/joglvis/ShaderUtil.java
ShaderUtil.linkShaderProgram
public static int linkShaderProgram(GL2 gl, int[] shaders) throws ShaderCompilationException { int[] error = new int[1]; int shaderprogram = gl.glCreateProgram(); for(int shader : shaders) { gl.glAttachShader(shaderprogram, shader); } gl.glLinkProgram(shaderprogram); gl.glValidateProgram(shaderprogram); // This worked best for me to get error messages: gl.glGetObjectParameterivARB(shaderprogram, GL2.GL_OBJECT_INFO_LOG_LENGTH_ARB, error, 0); if(error[0] > 1) { byte[] info = new byte[error[0]]; gl.glGetInfoLogARB(shaderprogram, info.length, error, 0, info, 0); String out = new String(info); gl.glDeleteProgram(shaderprogram); throw new ShaderCompilationException("Shader compilation error: " + out); } return shaderprogram; }
java
public static int linkShaderProgram(GL2 gl, int[] shaders) throws ShaderCompilationException { int[] error = new int[1]; int shaderprogram = gl.glCreateProgram(); for(int shader : shaders) { gl.glAttachShader(shaderprogram, shader); } gl.glLinkProgram(shaderprogram); gl.glValidateProgram(shaderprogram); // This worked best for me to get error messages: gl.glGetObjectParameterivARB(shaderprogram, GL2.GL_OBJECT_INFO_LOG_LENGTH_ARB, error, 0); if(error[0] > 1) { byte[] info = new byte[error[0]]; gl.glGetInfoLogARB(shaderprogram, info.length, error, 0, info, 0); String out = new String(info); gl.glDeleteProgram(shaderprogram); throw new ShaderCompilationException("Shader compilation error: " + out); } return shaderprogram; }
[ "public", "static", "int", "linkShaderProgram", "(", "GL2", "gl", ",", "int", "[", "]", "shaders", ")", "throws", "ShaderCompilationException", "{", "int", "[", "]", "error", "=", "new", "int", "[", "1", "]", ";", "int", "shaderprogram", "=", "gl", ".", ...
Link multiple (compiled) shaders into one program. @param gl GL context @param shaders Shaders to link @return Program id @throws ShaderCompilationException on errors.
[ "Link", "multiple", "(", "compiled", ")", "shaders", "into", "one", "program", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/joglvis/src/main/java/de/lmu/ifi/dbs/elki/joglvis/ShaderUtil.java#L91-L110
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentPersistenceImpl.java
CommerceShipmentPersistenceImpl.findAll
@Override public List<CommerceShipment> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceShipment> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceShipment", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce shipments. @return the commerce shipments
[ "Returns", "all", "the", "commerce", "shipments", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentPersistenceImpl.java#L1666-L1669
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java
Utils.readUrlContentQuietly
public static String readUrlContentQuietly( String url, Logger logger ) { String result = ""; try { result = readUrlContent( url ); } catch( Exception e ) { logger.severe( "Content of URL " + url + " could not be read." ); logException( logger, e ); } return result; }
java
public static String readUrlContentQuietly( String url, Logger logger ) { String result = ""; try { result = readUrlContent( url ); } catch( Exception e ) { logger.severe( "Content of URL " + url + " could not be read." ); logException( logger, e ); } return result; }
[ "public", "static", "String", "readUrlContentQuietly", "(", "String", "url", ",", "Logger", "logger", ")", "{", "String", "result", "=", "\"\"", ";", "try", "{", "result", "=", "readUrlContent", "(", "url", ")", ";", "}", "catch", "(", "Exception", "e", ...
Reads the content of an URL (assumed to be text content). @param url an URL @return a non-null string @throws IOException @throws URISyntaxException
[ "Reads", "the", "content", "of", "an", "URL", "(", "assumed", "to", "be", "text", "content", ")", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java#L512-L524
aol/cyclops
cyclops/src/main/java/cyclops/control/Future.java
Future.visitAsync
@Deprecated //use foldAsync public <R> Future<R> visitAsync(Function<? super T,? extends R> success, Function<? super Throwable,? extends R> failure){ return foldAsync(success,failure); }
java
@Deprecated //use foldAsync public <R> Future<R> visitAsync(Function<? super T,? extends R> success, Function<? super Throwable,? extends R> failure){ return foldAsync(success,failure); }
[ "@", "Deprecated", "//use foldAsync", "public", "<", "R", ">", "Future", "<", "R", ">", "visitAsync", "(", "Function", "<", "?", "super", "T", ",", "?", "extends", "R", ">", "success", ",", "Function", "<", "?", "super", "Throwable", ",", "?", "extends...
Non-blocking visit on the state of this Future <pre> {@code Future.ofResult(10) .visitAsync(i->i*2, e->-1); Future[20] Future.<Integer>ofError(new RuntimeException()) .visitAsync(i->i*2, e->-1) Future[-1] } </pre> @param success Function to execute if the previous stage completes successfully @param failure Function to execute if this Future fails @return Future with the eventual result of the executed Function
[ "Non", "-", "blocking", "visit", "on", "the", "state", "of", "this", "Future" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L761-L764
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/ds/DsParser.java
DsParser.storeRecovery
@Override protected void storeRecovery(Recovery r, XMLStreamWriter writer) throws Exception { writer.writeStartElement(XML.ELEMENT_RECOVERY); if (r.isNoRecovery() != null) writer.writeAttribute(XML.ATTRIBUTE_NO_RECOVERY, r.getValue(XML.ATTRIBUTE_NO_RECOVERY, r.isNoRecovery().toString())); if (r.getCredential() != null) { writer.writeStartElement(XML.ELEMENT_RECOVERY_CREDENTIAL); Credential c = (Credential)r.getCredential(); if (c.getUserName() != null) { writer.writeStartElement(XML.ELEMENT_USER_NAME); writer.writeCharacters(c.getValue(XML.ELEMENT_USER_NAME, c.getUserName())); writer.writeEndElement(); writer.writeStartElement(XML.ELEMENT_PASSWORD); writer.writeCharacters(c.getValue(XML.ELEMENT_PASSWORD, c.getPassword())); writer.writeEndElement(); } else { writer.writeStartElement(XML.ELEMENT_SECURITY_DOMAIN); writer.writeCharacters(c.getValue(XML.ELEMENT_SECURITY_DOMAIN, c.getSecurityDomain())); writer.writeEndElement(); } writer.writeEndElement(); } if (r.getPlugin() != null) { storeExtension(r.getPlugin(), writer, CommonXML.ELEMENT_RECOVERY_PLUGIN); } writer.writeEndElement(); }
java
@Override protected void storeRecovery(Recovery r, XMLStreamWriter writer) throws Exception { writer.writeStartElement(XML.ELEMENT_RECOVERY); if (r.isNoRecovery() != null) writer.writeAttribute(XML.ATTRIBUTE_NO_RECOVERY, r.getValue(XML.ATTRIBUTE_NO_RECOVERY, r.isNoRecovery().toString())); if (r.getCredential() != null) { writer.writeStartElement(XML.ELEMENT_RECOVERY_CREDENTIAL); Credential c = (Credential)r.getCredential(); if (c.getUserName() != null) { writer.writeStartElement(XML.ELEMENT_USER_NAME); writer.writeCharacters(c.getValue(XML.ELEMENT_USER_NAME, c.getUserName())); writer.writeEndElement(); writer.writeStartElement(XML.ELEMENT_PASSWORD); writer.writeCharacters(c.getValue(XML.ELEMENT_PASSWORD, c.getPassword())); writer.writeEndElement(); } else { writer.writeStartElement(XML.ELEMENT_SECURITY_DOMAIN); writer.writeCharacters(c.getValue(XML.ELEMENT_SECURITY_DOMAIN, c.getSecurityDomain())); writer.writeEndElement(); } writer.writeEndElement(); } if (r.getPlugin() != null) { storeExtension(r.getPlugin(), writer, CommonXML.ELEMENT_RECOVERY_PLUGIN); } writer.writeEndElement(); }
[ "@", "Override", "protected", "void", "storeRecovery", "(", "Recovery", "r", ",", "XMLStreamWriter", "writer", ")", "throws", "Exception", "{", "writer", ".", "writeStartElement", "(", "XML", ".", "ELEMENT_RECOVERY", ")", ";", "if", "(", "r", ".", "isNoRecover...
Store recovery @param r The recovery @param writer The writer @exception Exception Thrown if an error occurs
[ "Store", "recovery" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/ds/DsParser.java#L2129-L2171
OpenLiberty/open-liberty
dev/com.ibm.ws.jpa.container/src/com/ibm/ws/jpa/container/osgi/internal/JPAComponentImpl.java
JPAComponentImpl.processEJBModulePersistenceXml
private void processEJBModulePersistenceXml(JPAApplInfo applInfo, ContainerInfo module, ClassLoader appClassloader) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "processEJBModulePersistenceXml : " + applInfo.getApplName() + "#" + module.getName()); String archiveName = module.getName(); Container ejbContainer = module.getContainer(); ClassLoader ejbClassLoader = appClassloader; // ------------------------------------------------------------------------ // JPA 2.0 Specification - 8.2 Persistence Unit Packaging // // A persistence unit is defined by a persistence.xml file. The jar file or // directory whose META-INF directory contains the persistence.xml file is // termed the root of the persistence unit. In Java EE environments, the // root of a persistence unit may be one of the following: // // -> an EJB-JAR file // ------------------------------------------------------------------------ // Obtain persistence.xml in META-INF Entry pxml = ejbContainer.getEntry("META-INF/persistence.xml"); if (pxml != null) { String appName = applInfo.getApplName(); URL puRoot = getPXmlRootURL(appName, archiveName, pxml); applInfo.addPersistenceUnits(new OSGiJPAPXml(applInfo, archiveName, JPAPuScope.EJB_Scope, puRoot, ejbClassLoader, pxml)); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "processEJBModulePersistenceXml : " + applInfo.getApplName() + "#" + module.getName()); }
java
private void processEJBModulePersistenceXml(JPAApplInfo applInfo, ContainerInfo module, ClassLoader appClassloader) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "processEJBModulePersistenceXml : " + applInfo.getApplName() + "#" + module.getName()); String archiveName = module.getName(); Container ejbContainer = module.getContainer(); ClassLoader ejbClassLoader = appClassloader; // ------------------------------------------------------------------------ // JPA 2.0 Specification - 8.2 Persistence Unit Packaging // // A persistence unit is defined by a persistence.xml file. The jar file or // directory whose META-INF directory contains the persistence.xml file is // termed the root of the persistence unit. In Java EE environments, the // root of a persistence unit may be one of the following: // // -> an EJB-JAR file // ------------------------------------------------------------------------ // Obtain persistence.xml in META-INF Entry pxml = ejbContainer.getEntry("META-INF/persistence.xml"); if (pxml != null) { String appName = applInfo.getApplName(); URL puRoot = getPXmlRootURL(appName, archiveName, pxml); applInfo.addPersistenceUnits(new OSGiJPAPXml(applInfo, archiveName, JPAPuScope.EJB_Scope, puRoot, ejbClassLoader, pxml)); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "processEJBModulePersistenceXml : " + applInfo.getApplName() + "#" + module.getName()); }
[ "private", "void", "processEJBModulePersistenceXml", "(", "JPAApplInfo", "applInfo", ",", "ContainerInfo", "module", ",", "ClassLoader", "appClassloader", ")", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if"...
Locates and processes persistence.xml file in an EJB module. <p> @param applInfo the application archive information @param module the EJB module archive information
[ "Locates", "and", "processes", "persistence", ".", "xml", "file", "in", "an", "EJB", "module", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container/src/com/ibm/ws/jpa/container/osgi/internal/JPAComponentImpl.java#L540-L572
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/ConnectionManagerServiceImpl.java
ConnectionManagerServiceImpl.getCMConfigData
private final CMConfigData getCMConfigData(AbstractConnectionFactoryService cfSvc, ResourceInfo refInfo) { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(this, tc, "getCMConfigData"); // Defaults for direct lookup int auth = J2CConstants.AUTHENTICATION_APPLICATION; int branchCoupling = ResourceRefInfo.BRANCH_COUPLING_UNSET; int commitPriority = 0; int isolation = Connection.TRANSACTION_NONE; int sharingScope; String loginConfigName = null; HashMap<String, String> loginConfigProps = null; String resRefName = null; if (refInfo != null) { if (refInfo.getAuth() == ResourceRef.AUTH_CONTAINER) auth = J2CConstants.AUTHENTICATION_CONTAINER; branchCoupling = refInfo.getBranchCoupling(); commitPriority = refInfo.getCommitPriority(); isolation = refInfo.getIsolationLevel(); loginConfigName = refInfo.getLoginConfigurationName(); loginConfigProps = toHashMap(refInfo.getLoginPropertyList()); resRefName = refInfo.getName(); sharingScope = refInfo.getSharingScope(); } else { if (properties != null) { Object enableSharingForDirectLookups = properties.get("enableSharingForDirectLookups"); sharingScope = enableSharingForDirectLookups == null || (Boolean) enableSharingForDirectLookups ? ResourceRefInfo.SHARING_SCOPE_SHAREABLE : ResourceRefInfo.SHARING_SCOPE_UNSHAREABLE; } else { sharingScope = ResourceRefInfo.SHARING_SCOPE_SHAREABLE; } } CMConfigData cmConfig = new CMConfigDataImpl(cfSvc.getJNDIName(), sharingScope, isolation, auth, cfSvc.getID(), loginConfigName, loginConfigProps, resRefName, commitPriority, branchCoupling, null // no mmProps ); if (trace && tc.isEntryEnabled()) Tr.exit(this, tc, "getCMConfigData", cmConfig); return cmConfig; }
java
private final CMConfigData getCMConfigData(AbstractConnectionFactoryService cfSvc, ResourceInfo refInfo) { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(this, tc, "getCMConfigData"); // Defaults for direct lookup int auth = J2CConstants.AUTHENTICATION_APPLICATION; int branchCoupling = ResourceRefInfo.BRANCH_COUPLING_UNSET; int commitPriority = 0; int isolation = Connection.TRANSACTION_NONE; int sharingScope; String loginConfigName = null; HashMap<String, String> loginConfigProps = null; String resRefName = null; if (refInfo != null) { if (refInfo.getAuth() == ResourceRef.AUTH_CONTAINER) auth = J2CConstants.AUTHENTICATION_CONTAINER; branchCoupling = refInfo.getBranchCoupling(); commitPriority = refInfo.getCommitPriority(); isolation = refInfo.getIsolationLevel(); loginConfigName = refInfo.getLoginConfigurationName(); loginConfigProps = toHashMap(refInfo.getLoginPropertyList()); resRefName = refInfo.getName(); sharingScope = refInfo.getSharingScope(); } else { if (properties != null) { Object enableSharingForDirectLookups = properties.get("enableSharingForDirectLookups"); sharingScope = enableSharingForDirectLookups == null || (Boolean) enableSharingForDirectLookups ? ResourceRefInfo.SHARING_SCOPE_SHAREABLE : ResourceRefInfo.SHARING_SCOPE_UNSHAREABLE; } else { sharingScope = ResourceRefInfo.SHARING_SCOPE_SHAREABLE; } } CMConfigData cmConfig = new CMConfigDataImpl(cfSvc.getJNDIName(), sharingScope, isolation, auth, cfSvc.getID(), loginConfigName, loginConfigProps, resRefName, commitPriority, branchCoupling, null // no mmProps ); if (trace && tc.isEntryEnabled()) Tr.exit(this, tc, "getCMConfigData", cmConfig); return cmConfig; }
[ "private", "final", "CMConfigData", "getCMConfigData", "(", "AbstractConnectionFactoryService", "cfSvc", ",", "ResourceInfo", "refInfo", ")", "{", "final", "boolean", "trace", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "trace", "&&"...
Construct the CMConfigData, including properties from the resource reference, if applicable. @param cfSvc connection factory service @param ref resource reference. @return com.ibm.ejs.j2c.CMConfigData
[ "Construct", "the", "CMConfigData", "including", "properties", "from", "the", "resource", "reference", "if", "applicable", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/ConnectionManagerServiceImpl.java#L288-L330
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/net/HostAndPort.java
HostAndPort.withDefaultPort
public HostAndPort withDefaultPort(int defaultPort) { checkArgument(isValidPort(defaultPort)); if (hasPort() || port == defaultPort) { return this; } return new HostAndPort(host, defaultPort, hasBracketlessColons); }
java
public HostAndPort withDefaultPort(int defaultPort) { checkArgument(isValidPort(defaultPort)); if (hasPort() || port == defaultPort) { return this; } return new HostAndPort(host, defaultPort, hasBracketlessColons); }
[ "public", "HostAndPort", "withDefaultPort", "(", "int", "defaultPort", ")", "{", "checkArgument", "(", "isValidPort", "(", "defaultPort", ")", ")", ";", "if", "(", "hasPort", "(", ")", "||", "port", "==", "defaultPort", ")", "{", "return", "this", ";", "}"...
Provide a default port if the parsed string contained only a host. You can chain this after {@link #fromString(String)} to include a port in case the port was omitted from the input string. If a port was already provided, then this method is a no-op. @param defaultPort a port number, from [0..65535] @return a HostAndPort instance, guaranteed to have a defined port.
[ "Provide", "a", "default", "port", "if", "the", "parsed", "string", "contained", "only", "a", "host", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/net/HostAndPort.java#L263-L269
libgdx/box2dlights
src/box2dLight/ChainLight.java
ChainLight.attachToBody
public void attachToBody(Body body, float degrees) { this.body = body; this.bodyPosition.set(body.getPosition()); bodyAngleOffset = MathUtils.degreesToRadians * degrees; bodyAngle = body.getAngle(); applyAttachment(); if (staticLight) dirty = true; }
java
public void attachToBody(Body body, float degrees) { this.body = body; this.bodyPosition.set(body.getPosition()); bodyAngleOffset = MathUtils.degreesToRadians * degrees; bodyAngle = body.getAngle(); applyAttachment(); if (staticLight) dirty = true; }
[ "public", "void", "attachToBody", "(", "Body", "body", ",", "float", "degrees", ")", "{", "this", ".", "body", "=", "body", ";", "this", ".", "bodyPosition", ".", "set", "(", "body", ".", "getPosition", "(", ")", ")", ";", "bodyAngleOffset", "=", "Math...
Attaches light to specified body with relative direction offset @param body that will be automatically followed, note that the body rotation angle is taken into account for the light offset and direction calculations @param degrees directional relative offset in degrees
[ "Attaches", "light", "to", "specified", "body", "with", "relative", "direction", "offset" ]
train
https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/ChainLight.java#L194-L201
jamesagnew/hapi-fhir
hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/ParameterUtil.java
ParameterUtil.parseQueryParams
public static IQueryParameterAnd<?> parseQueryParams(FhirContext theContext, RuntimeSearchParam theParamDef, String theUnqualifiedParamName, List<QualifiedParamList> theParameters) { RestSearchParameterTypeEnum paramType = theParamDef.getParamType(); return parseQueryParams(theContext, paramType, theUnqualifiedParamName, theParameters); }
java
public static IQueryParameterAnd<?> parseQueryParams(FhirContext theContext, RuntimeSearchParam theParamDef, String theUnqualifiedParamName, List<QualifiedParamList> theParameters) { RestSearchParameterTypeEnum paramType = theParamDef.getParamType(); return parseQueryParams(theContext, paramType, theUnqualifiedParamName, theParameters); }
[ "public", "static", "IQueryParameterAnd", "<", "?", ">", "parseQueryParams", "(", "FhirContext", "theContext", ",", "RuntimeSearchParam", "theParamDef", ",", "String", "theUnqualifiedParamName", ",", "List", "<", "QualifiedParamList", ">", "theParameters", ")", "{", "...
This is a utility method intended provided to help the JPA module.
[ "This", "is", "a", "utility", "method", "intended", "provided", "to", "help", "the", "JPA", "module", "." ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/ParameterUtil.java#L110-L114
bazaarvoice/emodb
web/src/main/java/com/bazaarvoice/emodb/web/scanner/writer/TemporaryFileScanWriter.java
TemporaryFileScanWriter.blockUntilOpenShardsAtMost
private void blockUntilOpenShardsAtMost(int maxOpenShards, @Nullable TransferKey permittedKey) throws IOException, InterruptedException { blockUntilOpenShardsAtMost(maxOpenShards, permittedKey, Instant.MAX); }
java
private void blockUntilOpenShardsAtMost(int maxOpenShards, @Nullable TransferKey permittedKey) throws IOException, InterruptedException { blockUntilOpenShardsAtMost(maxOpenShards, permittedKey, Instant.MAX); }
[ "private", "void", "blockUntilOpenShardsAtMost", "(", "int", "maxOpenShards", ",", "@", "Nullable", "TransferKey", "permittedKey", ")", "throws", "IOException", ",", "InterruptedException", "{", "blockUntilOpenShardsAtMost", "(", "maxOpenShards", ",", "permittedKey", ",",...
Blocks until the number of open shards is equal to or less than the provided threshold.
[ "Blocks", "until", "the", "number", "of", "open", "shards", "is", "equal", "to", "or", "less", "than", "the", "provided", "threshold", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/scanner/writer/TemporaryFileScanWriter.java#L223-L226
h2oai/h2o-3
h2o-core/src/main/java/water/DTask.java
DTask.setException
public synchronized void setException(Throwable ex) { if(_ex == null) { _ex = AutoBuffer.javaSerializeWritePojo(((ex instanceof DistributedException) ? (DistributedException) ex : new DistributedException(ex,false /* don't want this setException(ex) call in the stacktrace */))); } }
java
public synchronized void setException(Throwable ex) { if(_ex == null) { _ex = AutoBuffer.javaSerializeWritePojo(((ex instanceof DistributedException) ? (DistributedException) ex : new DistributedException(ex,false /* don't want this setException(ex) call in the stacktrace */))); } }
[ "public", "synchronized", "void", "setException", "(", "Throwable", "ex", ")", "{", "if", "(", "_ex", "==", "null", ")", "{", "_ex", "=", "AutoBuffer", ".", "javaSerializeWritePojo", "(", "(", "(", "ex", "instanceof", "DistributedException", ")", "?", "(", ...
Capture the first exception in _ex. Later setException attempts are ignored.
[ "Capture", "the", "first", "exception", "in", "_ex", ".", "Later", "setException", "attempts", "are", "ignored", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/DTask.java#L38-L42
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ArrayTypeUtils.java
ArrayTypeUtils.elementType
public static Class elementType(Class clazz, int dim) { checkArrayType(clazz); if (dim < 0) { throw new IllegalArgumentException("The target dimension should not be less than zero: " + dim); } while (clazz.isArray() && dimension(clazz) > dim) { clazz = clazz.getComponentType(); } return clazz; }
java
public static Class elementType(Class clazz, int dim) { checkArrayType(clazz); if (dim < 0) { throw new IllegalArgumentException("The target dimension should not be less than zero: " + dim); } while (clazz.isArray() && dimension(clazz) > dim) { clazz = clazz.getComponentType(); } return clazz; }
[ "public", "static", "Class", "elementType", "(", "Class", "clazz", ",", "int", "dim", ")", "{", "checkArrayType", "(", "clazz", ")", ";", "if", "(", "dim", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The target dimension should not ...
Get the type of array elements by the dimension @param clazz the type of array @param dim the target dimension @return the result array
[ "Get", "the", "type", "of", "array", "elements", "by", "the", "dimension" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ArrayTypeUtils.java#L68-L80
lucee/Lucee
core/src/main/java/lucee/runtime/config/XMLConfigFactory.java
XMLConfigFactory.createFileFromResource
static void createFileFromResource(String resource, Resource file) throws IOException { createFileFromResource(resource, file, null); }
java
static void createFileFromResource(String resource, Resource file) throws IOException { createFileFromResource(resource, file, null); }
[ "static", "void", "createFileFromResource", "(", "String", "resource", ",", "Resource", "file", ")", "throws", "IOException", "{", "createFileFromResource", "(", "resource", ",", "file", ",", "null", ")", ";", "}" ]
creates a File and his content froma a resurce @param resource @param file @throws IOException
[ "creates", "a", "File", "and", "his", "content", "froma", "a", "resurce" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigFactory.java#L287-L289
classgraph/classgraph
src/main/java/io/github/classgraph/AnnotationInfo.java
AnnotationInfo.loadClassAndInstantiate
public Annotation loadClassAndInstantiate() { final Class<? extends Annotation> annotationClass = getClassInfo().loadClass(Annotation.class); return (Annotation) Proxy.newProxyInstance(annotationClass.getClassLoader(), new Class[] { annotationClass }, new AnnotationInvocationHandler(annotationClass, this)); }
java
public Annotation loadClassAndInstantiate() { final Class<? extends Annotation> annotationClass = getClassInfo().loadClass(Annotation.class); return (Annotation) Proxy.newProxyInstance(annotationClass.getClassLoader(), new Class[] { annotationClass }, new AnnotationInvocationHandler(annotationClass, this)); }
[ "public", "Annotation", "loadClassAndInstantiate", "(", ")", "{", "final", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", "=", "getClassInfo", "(", ")", ".", "loadClass", "(", "Annotation", ".", "class", ")", ";", "return", "(", "Annotatio...
Load the {@link Annotation} class corresponding to this {@link AnnotationInfo} object, by calling {@code getClassInfo().loadClass()}, then create a new instance of the annotation, with the annotation parameter values obtained from this {@link AnnotationInfo} object, possibly overriding default annotation parameter values obtained from calling {@link AnnotationInfo#getClassInfo()} then {@link ClassInfo#getAnnotationDefaultParameterValues()}. <p> Note that the returned {@link Annotation} will have some sort of {@link InvocationHandler} proxy type, such as {@code io.github.classgraph.features.$Proxy4} or {@code com.sun.proxy.$Proxy6}. This is an unavoidable side effect of the fact that concrete {@link Annotation} instances cannot be instantiated directly. (ClassGraph uses <a href= "http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/classes/sun/reflect/annotation/AnnotationParser.java#l255">the same approach that the JDK uses to instantiate annotations from a map</a>.) However, proxy instances are <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/reflect/Proxy.html">handled specially</a> when it comes to casting and {@code instanceof}: you are able to cast the returned proxy instance to the annotation type, and {@code instanceof} checks against the annotation class will succeed. <p> Of course another option you have for getting the concrete annotations, rather than instantiating the annotations on a {@link ClassInfo} object via this method, is to call {@link ClassInfo#loadClass()}, and read the annotations directly from the returned {@link Class} object. @return The new {@link Annotation} instance, as a dynamic proxy object that can be cast to the expected annotation type.
[ "Load", "the", "{", "@link", "Annotation", "}", "class", "corresponding", "to", "this", "{", "@link", "AnnotationInfo", "}", "object", "by", "calling", "{", "@code", "getClassInfo", "()", ".", "loadClass", "()", "}", "then", "create", "a", "new", "instance",...
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/AnnotationInfo.java#L275-L279
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java
CoverageUtilities.buildCoverage
public static GridCoverage2D buildCoverage( String name, RenderedImage renderedImage, HashMap<String, Double> envelopeParams, CoordinateReferenceSystem crs ) { double west = envelopeParams.get(WEST); double south = envelopeParams.get(SOUTH); double east = envelopeParams.get(EAST); double north = envelopeParams.get(NORTH); Envelope2D writeEnvelope = new Envelope2D(crs, west, south, east - west, north - south); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); GridCoverage2D coverage2D = factory.create(name, renderedImage, writeEnvelope); return coverage2D; }
java
public static GridCoverage2D buildCoverage( String name, RenderedImage renderedImage, HashMap<String, Double> envelopeParams, CoordinateReferenceSystem crs ) { double west = envelopeParams.get(WEST); double south = envelopeParams.get(SOUTH); double east = envelopeParams.get(EAST); double north = envelopeParams.get(NORTH); Envelope2D writeEnvelope = new Envelope2D(crs, west, south, east - west, north - south); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); GridCoverage2D coverage2D = factory.create(name, renderedImage, writeEnvelope); return coverage2D; }
[ "public", "static", "GridCoverage2D", "buildCoverage", "(", "String", "name", ",", "RenderedImage", "renderedImage", ",", "HashMap", "<", "String", ",", "Double", ">", "envelopeParams", ",", "CoordinateReferenceSystem", "crs", ")", "{", "double", "west", "=", "env...
Creates a {@link GridCoverage2D coverage} from the {@link RenderedImage image} and the necessary geographic Information. @param name the name of the coverage. @param renderedImage the image containing the data. @param envelopeParams the map of boundary parameters. @param crs the {@link CoordinateReferenceSystem}. @return the {@link GridCoverage2D coverage}.
[ "Creates", "a", "{", "@link", "GridCoverage2D", "coverage", "}", "from", "the", "{", "@link", "RenderedImage", "image", "}", "and", "the", "necessary", "geographic", "Information", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L862-L874
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/mock/MockHttpServletRequest.java
MockHttpServletRequest.setParameter
@Nonnull public MockHttpServletRequest setParameter (@Nonnull final String sName, @Nullable final String sValue) { m_aParameters.remove (sName); m_aParameters.add (sName, sValue); return this; }
java
@Nonnull public MockHttpServletRequest setParameter (@Nonnull final String sName, @Nullable final String sValue) { m_aParameters.remove (sName); m_aParameters.add (sName, sValue); return this; }
[ "@", "Nonnull", "public", "MockHttpServletRequest", "setParameter", "(", "@", "Nonnull", "final", "String", "sName", ",", "@", "Nullable", "final", "String", "sValue", ")", "{", "m_aParameters", ".", "remove", "(", "sName", ")", ";", "m_aParameters", ".", "add...
Set a single value for the specified HTTP parameter. <p> If there are already one or more values registered for the given parameter name, they will be replaced. @param sName Parameter name @param sValue Parameter value @return this
[ "Set", "a", "single", "value", "for", "the", "specified", "HTTP", "parameter", ".", "<p", ">", "If", "there", "are", "already", "one", "or", "more", "values", "registered", "for", "the", "given", "parameter", "name", "they", "will", "be", "replaced", "." ]
train
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/mock/MockHttpServletRequest.java#L398-L404
aws/aws-sdk-java
aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/UpdatePatchBaselineRequest.java
UpdatePatchBaselineRequest.getApprovedPatches
public java.util.List<String> getApprovedPatches() { if (approvedPatches == null) { approvedPatches = new com.amazonaws.internal.SdkInternalList<String>(); } return approvedPatches; }
java
public java.util.List<String> getApprovedPatches() { if (approvedPatches == null) { approvedPatches = new com.amazonaws.internal.SdkInternalList<String>(); } return approvedPatches; }
[ "public", "java", ".", "util", ".", "List", "<", "String", ">", "getApprovedPatches", "(", ")", "{", "if", "(", "approvedPatches", "==", "null", ")", "{", "approvedPatches", "=", "new", "com", ".", "amazonaws", ".", "internal", ".", "SdkInternalList", "<",...
<p> A list of explicitly approved patches for the baseline. </p> <p> For information about accepted formats for lists of approved patches and rejected patches, see <a href= "https://docs.aws.amazon.com/systems-manager/latest/userguide/patch-manager-approved-rejected-package-name-formats.html" >Package Name Formats for Approved and Rejected Patch Lists</a> in the <i>AWS Systems Manager User Guide</i>. </p> @return A list of explicitly approved patches for the baseline.</p> <p> For information about accepted formats for lists of approved patches and rejected patches, see <a href= "https://docs.aws.amazon.com/systems-manager/latest/userguide/patch-manager-approved-rejected-package-name-formats.html" >Package Name Formats for Approved and Rejected Patch Lists</a> in the <i>AWS Systems Manager User Guide</i>.
[ "<p", ">", "A", "list", "of", "explicitly", "approved", "patches", "for", "the", "baseline", ".", "<", "/", "p", ">", "<p", ">", "For", "information", "about", "accepted", "formats", "for", "lists", "of", "approved", "patches", "and", "rejected", "patches"...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/UpdatePatchBaselineRequest.java#L308-L313
haifengl/smile
core/src/main/java/smile/association/FPGrowth.java
FPGrowth.learn
private long learn(PrintStream out, List<ItemSet> list, TotalSupportTree ttree) { if (MulticoreExecutor.getThreadPoolSize() > 1) { return grow(out, list, ttree, T0, null, null, null); } else { return grow(out, list, ttree, T0, null); } }
java
private long learn(PrintStream out, List<ItemSet> list, TotalSupportTree ttree) { if (MulticoreExecutor.getThreadPoolSize() > 1) { return grow(out, list, ttree, T0, null, null, null); } else { return grow(out, list, ttree, T0, null); } }
[ "private", "long", "learn", "(", "PrintStream", "out", ",", "List", "<", "ItemSet", ">", "list", ",", "TotalSupportTree", "ttree", ")", "{", "if", "(", "MulticoreExecutor", ".", "getThreadPoolSize", "(", ")", ">", "1", ")", "{", "return", "grow", "(", "o...
Mines the frequent item sets. The discovered frequent item sets will be printed out to the provided stream. @param out a print stream for output of frequent item sets. @return the number of discovered frequent item sets.
[ "Mines", "the", "frequent", "item", "sets", ".", "The", "discovered", "frequent", "item", "sets", "will", "be", "printed", "out", "to", "the", "provided", "stream", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/FPGrowth.java#L176-L182
samskivert/samskivert
src/main/java/com/samskivert/velocity/FormTool.java
FormTool.fixedTextarea
public String fixedTextarea (String name, String extra, Object value) { StringBuilder buf = new StringBuilder(); buf.append("<textarea name=\"").append(name).append("\""); if (!StringUtil.isBlank(extra)) { buf.append(" ").append(extra); } buf.append(">"); if (value != null) { buf.append(value); } buf.append("</textarea>"); return buf.toString(); }
java
public String fixedTextarea (String name, String extra, Object value) { StringBuilder buf = new StringBuilder(); buf.append("<textarea name=\"").append(name).append("\""); if (!StringUtil.isBlank(extra)) { buf.append(" ").append(extra); } buf.append(">"); if (value != null) { buf.append(value); } buf.append("</textarea>"); return buf.toString(); }
[ "public", "String", "fixedTextarea", "(", "String", "name", ",", "String", "extra", ",", "Object", "value", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "buf", ".", "append", "(", "\"<textarea name=\\\"\"", ")", ".", "append"...
Construct a text area with the specified name, optional extra parameters and the specified text.
[ "Construct", "a", "text", "area", "with", "the", "specified", "name", "optional", "extra", "parameters", "and", "the", "specified", "text", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/velocity/FormTool.java#L352-L365
dain/leveldb
leveldb/src/main/java/org/iq80/leveldb/util/Slice.java
Slice.getBytes
public void getBytes(int index, OutputStream out, int length) throws IOException { checkPositionIndexes(index, index + length, this.length); index += offset; out.write(data, index, length); }
java
public void getBytes(int index, OutputStream out, int length) throws IOException { checkPositionIndexes(index, index + length, this.length); index += offset; out.write(data, index, length); }
[ "public", "void", "getBytes", "(", "int", "index", ",", "OutputStream", "out", ",", "int", "length", ")", "throws", "IOException", "{", "checkPositionIndexes", "(", "index", ",", "index", "+", "length", ",", "this", ".", "length", ")", ";", "index", "+=", ...
Transfers this buffer's data to the specified stream starting at the specified absolute {@code index}. @param length the number of bytes to transfer @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or if {@code index + length} is greater than {@code this.capacity} @throws java.io.IOException if the specified stream threw an exception during I/O
[ "Transfers", "this", "buffer", "s", "data", "to", "the", "specified", "stream", "starting", "at", "the", "specified", "absolute", "{", "@code", "index", "}", "." ]
train
https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/Slice.java#L259-L265
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java
SDBaseOps.unsortedSegmentSqrtN
public SDVariable unsortedSegmentSqrtN(String name, SDVariable data, SDVariable segmentIds, int numSegments) { SDVariable ret = f().unsortedSegmentSqrtN(data, segmentIds, numSegments); return updateVariableNameAndReference(ret, name); }
java
public SDVariable unsortedSegmentSqrtN(String name, SDVariable data, SDVariable segmentIds, int numSegments) { SDVariable ret = f().unsortedSegmentSqrtN(data, segmentIds, numSegments); return updateVariableNameAndReference(ret, name); }
[ "public", "SDVariable", "unsortedSegmentSqrtN", "(", "String", "name", ",", "SDVariable", "data", ",", "SDVariable", "segmentIds", ",", "int", "numSegments", ")", "{", "SDVariable", "ret", "=", "f", "(", ")", ".", "unsortedSegmentSqrtN", "(", "data", ",", "seg...
Unsorted segment sqrtN operation. Simply returns the sqrt of the count of the number of values in each segment<br> If data = [1, 3, 2, 6, 4, 9, 8]<br> segmentIds = [1, 0, 2, 0, 1, 1, 2]<br> then output = [1.414, 1.732, 1.414] = [sqrt(2), sqrtN(3), sqrtN(2)]<br> @param name Name of the output variable @param data Data (variable) to perform unsorted segment sqrtN on @param segmentIds Variable for the segment IDs @return Unsorted segment sqrtN output
[ "Unsorted", "segment", "sqrtN", "operation", ".", "Simply", "returns", "the", "sqrt", "of", "the", "count", "of", "the", "number", "of", "values", "in", "each", "segment<br", ">", "If", "data", "=", "[", "1", "3", "2", "6", "4", "9", "8", "]", "<br",...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L2961-L2964
google/allocation-instrumenter
src/main/java/com/google/monitoring/runtime/instrumentation/AllocationMethodAdapter.java
AllocationMethodAdapter.newLocal
private int newLocal(Type type, String typeDesc, Label begin, Label end) { int newVar = lvs.newLocal(type); getLocalScopes().add(new VariableScope(newVar, begin, end, typeDesc)); return newVar; }
java
private int newLocal(Type type, String typeDesc, Label begin, Label end) { int newVar = lvs.newLocal(type); getLocalScopes().add(new VariableScope(newVar, begin, end, typeDesc)); return newVar; }
[ "private", "int", "newLocal", "(", "Type", "type", ",", "String", "typeDesc", ",", "Label", "begin", ",", "Label", "end", ")", "{", "int", "newVar", "=", "lvs", ".", "newLocal", "(", "type", ")", ";", "getLocalScopes", "(", ")", ".", "add", "(", "new...
Helper method to allocate a new local variable and account for its scope.
[ "Helper", "method", "to", "allocate", "a", "new", "local", "variable", "and", "account", "for", "its", "scope", "." ]
train
https://github.com/google/allocation-instrumenter/blob/58d8473e8832e51f39ae7aa38328f61c4b747bff/src/main/java/com/google/monitoring/runtime/instrumentation/AllocationMethodAdapter.java#L478-L482
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/types/Timecode.java
Timecode.getInstance
public static final Timecode getInstance(long frameNumber, boolean dropFrame, Timebase timebase) { return TimecodeBuilder.fromFrames(frameNumber, timebase, dropFrame).build(); }
java
public static final Timecode getInstance(long frameNumber, boolean dropFrame, Timebase timebase) { return TimecodeBuilder.fromFrames(frameNumber, timebase, dropFrame).build(); }
[ "public", "static", "final", "Timecode", "getInstance", "(", "long", "frameNumber", ",", "boolean", "dropFrame", ",", "Timebase", "timebase", ")", "{", "return", "TimecodeBuilder", ".", "fromFrames", "(", "frameNumber", ",", "timebase", ",", "dropFrame", ")", "....
@param frameNumber @param dropFrame set to true to indicate that the frame-rate excludes dropframes @param timebase @return a timecode representation of the given data, null when a timecode can not be generated (i.e. duration exceeds a day)
[ "@param", "frameNumber", "@param", "dropFrame", "set", "to", "true", "to", "indicate", "that", "the", "frame", "-", "rate", "excludes", "dropframes", "@param", "timebase" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/Timecode.java#L734-L737
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java
DevicesInner.getByResourceGroup
public DataBoxEdgeDeviceInner getByResourceGroup(String deviceName, String resourceGroupName) { return getByResourceGroupWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().single().body(); }
java
public DataBoxEdgeDeviceInner getByResourceGroup(String deviceName, String resourceGroupName) { return getByResourceGroupWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().single().body(); }
[ "public", "DataBoxEdgeDeviceInner", "getByResourceGroup", "(", "String", "deviceName", ",", "String", "resourceGroupName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "deviceName", ",", "resourceGroupName", ")", ".", "toBlocking", "(", ")", ".",...
Gets the properties of the data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @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 DataBoxEdgeDeviceInner object if successful.
[ "Gets", "the", "properties", "of", "the", "data", "box", "edge", "/", "gateway", "device", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L616-L618
hawkular/hawkular-inventory
hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/TraversalContext.java
TraversalContext.proceedFromRelationshipsTo
<T extends Entity<?, ?>> Builder<BE, T> proceedFromRelationshipsTo(Relationships.Direction direction, Class<T> entityType) { return new Builder<>(this, hop(), Query.filter(), entityType) .hop(new SwitchElementType(direction, true)).where(type(entityType)); }
java
<T extends Entity<?, ?>> Builder<BE, T> proceedFromRelationshipsTo(Relationships.Direction direction, Class<T> entityType) { return new Builder<>(this, hop(), Query.filter(), entityType) .hop(new SwitchElementType(direction, true)).where(type(entityType)); }
[ "<", "T", "extends", "Entity", "<", "?", ",", "?", ">", ">", "Builder", "<", "BE", ",", "T", ">", "proceedFromRelationshipsTo", "(", "Relationships", ".", "Direction", "direction", ",", "Class", "<", "T", ">", "entityType", ")", "{", "return", "new", "...
An opposite of {@link #proceedToRelationships(Relationships.Direction)}. @param direction the direction in which to "leave" the relationships @param entityType the type of entities to "hop to" @param <T> the type of entities to "hop to" @return a context builder with the modified source path, select candidates and type
[ "An", "opposite", "of", "{", "@link", "#proceedToRelationships", "(", "Relationships", ".", "Direction", ")", "}", "." ]
train
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/TraversalContext.java#L230-L234
Javacord/Javacord
javacord-api/src/main/java/org/javacord/api/entity/message/MessageBuilder.java
MessageBuilder.addFileAsSpoiler
public MessageBuilder addFileAsSpoiler(InputStream stream, String fileName) { delegate.addFile(stream, "SPOILER_" + fileName); return this; }
java
public MessageBuilder addFileAsSpoiler(InputStream stream, String fileName) { delegate.addFile(stream, "SPOILER_" + fileName); return this; }
[ "public", "MessageBuilder", "addFileAsSpoiler", "(", "InputStream", "stream", ",", "String", "fileName", ")", "{", "delegate", ".", "addFile", "(", "stream", ",", "\"SPOILER_\"", "+", "fileName", ")", ";", "return", "this", ";", "}" ]
Adds a file to the message and marks it as spoiler. @param stream The stream of the file. @param fileName The name of the file. @return The current instance in order to chain call methods. @see #addAttachment(InputStream, String)
[ "Adds", "a", "file", "to", "the", "message", "and", "marks", "it", "as", "spoiler", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/message/MessageBuilder.java#L283-L286
alkacon/opencms-core
src/org/opencms/util/CmsRequestUtil.java
CmsRequestUtil.removeSessionValue
public static void removeSessionValue(HttpServletRequest request, String key) { HttpSession session = request.getSession(true); session.removeAttribute(key); }
java
public static void removeSessionValue(HttpServletRequest request, String key) { HttpSession session = request.getSession(true); session.removeAttribute(key); }
[ "public", "static", "void", "removeSessionValue", "(", "HttpServletRequest", "request", ",", "String", "key", ")", "{", "HttpSession", "session", "=", "request", ".", "getSession", "(", "true", ")", ";", "session", ".", "removeAttribute", "(", "key", ")", ";",...
Removes an object from the session of the given http request.<p> A session will be initialized if the request does not currently have a session. As a result, the request will always have a session after this method has been called.<p> @param request the request to get the session from @param key the key of the object to be removed from the session
[ "Removes", "an", "object", "from", "the", "session", "of", "the", "given", "http", "request", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsRequestUtil.java#L884-L888
OpenBEL/openbel-framework
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseApplication.java
PhaseApplication.markTime
protected void markTime(final StringBuilder b, long t1, long t2) { boolean time = getPhaseConfiguration().isTime(); if (time) { String seconds = timeFormat((t2 - t1)); b.append("("); b.append(seconds); b.append(" seconds) "); } }
java
protected void markTime(final StringBuilder b, long t1, long t2) { boolean time = getPhaseConfiguration().isTime(); if (time) { String seconds = timeFormat((t2 - t1)); b.append("("); b.append(seconds); b.append(" seconds) "); } }
[ "protected", "void", "markTime", "(", "final", "StringBuilder", "b", ",", "long", "t1", ",", "long", "t2", ")", "{", "boolean", "time", "=", "getPhaseConfiguration", "(", ")", ".", "isTime", "(", ")", ";", "if", "(", "time", ")", "{", "String", "second...
Appends {@code (#.### seconds)} to the builder, if {@link RuntimeConfiguration#isTime() runtime configuration timing} is set. @param b Non-null builder @param t1 Time at {@code t1} @param t2 Time at {@code t2}
[ "Appends", "{", "@code", "(", "#", ".", "###", "seconds", ")", "}", "to", "the", "builder", "if", "{", "@link", "RuntimeConfiguration#isTime", "()", "runtime", "configuration", "timing", "}", "is", "set", "." ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseApplication.java#L385-L393
linkedin/dexmaker
dexmaker/src/main/java/com/android/dx/Code.java
Code.newInstance
public <T> void newInstance(Local<T> target, MethodId<T, Void> constructor, Local<?>... args) { if (target == null) { throw new IllegalArgumentException(); } addInstruction(new ThrowingCstInsn(Rops.NEW_INSTANCE, sourcePosition, RegisterSpecList.EMPTY, catches, constructor.declaringType.constant)); moveResult(target, true); invokeDirect(constructor, null, target, args); }
java
public <T> void newInstance(Local<T> target, MethodId<T, Void> constructor, Local<?>... args) { if (target == null) { throw new IllegalArgumentException(); } addInstruction(new ThrowingCstInsn(Rops.NEW_INSTANCE, sourcePosition, RegisterSpecList.EMPTY, catches, constructor.declaringType.constant)); moveResult(target, true); invokeDirect(constructor, null, target, args); }
[ "public", "<", "T", ">", "void", "newInstance", "(", "Local", "<", "T", ">", "target", ",", "MethodId", "<", "T", ",", "Void", ">", "constructor", ",", "Local", "<", "?", ">", "...", "args", ")", "{", "if", "(", "target", "==", "null", ")", "{", ...
Calls the constructor {@code constructor} using {@code args} and assigns the new instance to {@code target}.
[ "Calls", "the", "constructor", "{" ]
train
https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker/src/main/java/com/android/dx/Code.java#L628-L636
SeleniumJT/seleniumjt-core
src/main/java/com/jt/selenium/elements/JTEvent.java
JTEvent.dragAndDropWithPause
public void dragAndDropWithPause(String locator, String targetLocator, int pause) { dragAndDropToObject(locator, targetLocator); jtCore.pause(pause); }
java
public void dragAndDropWithPause(String locator, String targetLocator, int pause) { dragAndDropToObject(locator, targetLocator); jtCore.pause(pause); }
[ "public", "void", "dragAndDropWithPause", "(", "String", "locator", ",", "String", "targetLocator", ",", "int", "pause", ")", "{", "dragAndDropToObject", "(", "locator", ",", "targetLocator", ")", ";", "jtCore", ".", "pause", "(", "pause", ")", ";", "}" ]
/* Drags the element locator to the element targetLocator with a set pause after the event
[ "/", "*", "Drags", "the", "element", "locator", "to", "the", "element", "targetLocator", "with", "a", "set", "pause", "after", "the", "event" ]
train
https://github.com/SeleniumJT/seleniumjt-core/blob/8e972f69adc4846a3f1d7b8ca9c3f8d953a2d0f3/src/main/java/com/jt/selenium/elements/JTEvent.java#L59-L63
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.deletePreset
public DeletePresetResponse deletePreset(DeletePresetRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getName(), "The parameter name should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.DELETE, request, LIVE_PRESET, request.getName()); return invokeHttpClient(internalRequest, DeletePresetResponse.class); }
java
public DeletePresetResponse deletePreset(DeletePresetRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getName(), "The parameter name should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.DELETE, request, LIVE_PRESET, request.getName()); return invokeHttpClient(internalRequest, DeletePresetResponse.class); }
[ "public", "DeletePresetResponse", "deletePreset", "(", "DeletePresetRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getName", "(", ")", ",", "\"Th...
Delete your live presets by live preset name. @param request The request object containing all parameters for deleting live preset. @return the response
[ "Delete", "your", "live", "presets", "by", "live", "preset", "name", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L444-L450
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialLoader.java
MaterialLoader.loading
public static void loading(boolean visible, Panel container) { loader.setType(LoaderType.CIRCULAR); loader.setContainer(container); if (visible) { loader.show(); } else { loader.hide(); } }
java
public static void loading(boolean visible, Panel container) { loader.setType(LoaderType.CIRCULAR); loader.setContainer(container); if (visible) { loader.show(); } else { loader.hide(); } }
[ "public", "static", "void", "loading", "(", "boolean", "visible", ",", "Panel", "container", ")", "{", "loader", ".", "setType", "(", "LoaderType", ".", "CIRCULAR", ")", ";", "loader", ".", "setContainer", "(", "container", ")", ";", "if", "(", "visible", ...
Static helper class that shows / hides a circular loader within a container
[ "Static", "helper", "class", "that", "shows", "/", "hides", "a", "circular", "loader", "within", "a", "container" ]
train
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialLoader.java#L146-L154
owetterau/neo4j-websockets
client/src/main/java/de/oliverwetterau/neo4j/websockets/client/server/Database.java
Database.sendWriteMessage
public void sendWriteMessage(final String message, final Server server) throws ConnectionNotAvailableException { DataConnection connection = server.getConnection(); if (connection == null) { throw new ConnectionNotAvailableException(server); } connection.send(message); server.returnConnection(connection); }
java
public void sendWriteMessage(final String message, final Server server) throws ConnectionNotAvailableException { DataConnection connection = server.getConnection(); if (connection == null) { throw new ConnectionNotAvailableException(server); } connection.send(message); server.returnConnection(connection); }
[ "public", "void", "sendWriteMessage", "(", "final", "String", "message", ",", "final", "Server", "server", ")", "throws", "ConnectionNotAvailableException", "{", "DataConnection", "connection", "=", "server", ".", "getConnection", "(", ")", ";", "if", "(", "connec...
Sends a text message (which will probably create a write access) to the Neo4j cluster. @param message binary json message (usually json format) @param server server that shall be used to send the message @throws ConnectionNotAvailableException no connection to server exception
[ "Sends", "a", "text", "message", "(", "which", "will", "probably", "create", "a", "write", "access", ")", "to", "the", "Neo4j", "cluster", "." ]
train
https://github.com/owetterau/neo4j-websockets/blob/ca3481066819d01169873aeb145ab3bf5c736afe/client/src/main/java/de/oliverwetterau/neo4j/websockets/client/server/Database.java#L320-L330
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
StatusLogger.logMessage
@Override public void logMessage(final String fqcn, final Level level, final Marker marker, final Message msg, final Throwable t) { StackTraceElement element = null; if (fqcn != null) { element = getStackTraceElement(fqcn, Thread.currentThread().getStackTrace()); } final StatusData data = new StatusData(element, level, msg, t, null); msgLock.lock(); try { messages.add(data); } finally { msgLock.unlock(); } // LOG4J2-1813 if system property "log4j2.debug" is defined, all status logging is enabled if (isDebugPropertyEnabled()) { logger.logMessage(fqcn, level, marker, msg, t); } else { if (listeners.size() > 0) { for (final StatusListener listener : listeners) { if (data.getLevel().isMoreSpecificThan(listener.getStatusLevel())) { listener.log(data); } } } else { logger.logMessage(fqcn, level, marker, msg, t); } } }
java
@Override public void logMessage(final String fqcn, final Level level, final Marker marker, final Message msg, final Throwable t) { StackTraceElement element = null; if (fqcn != null) { element = getStackTraceElement(fqcn, Thread.currentThread().getStackTrace()); } final StatusData data = new StatusData(element, level, msg, t, null); msgLock.lock(); try { messages.add(data); } finally { msgLock.unlock(); } // LOG4J2-1813 if system property "log4j2.debug" is defined, all status logging is enabled if (isDebugPropertyEnabled()) { logger.logMessage(fqcn, level, marker, msg, t); } else { if (listeners.size() > 0) { for (final StatusListener listener : listeners) { if (data.getLevel().isMoreSpecificThan(listener.getStatusLevel())) { listener.log(data); } } } else { logger.logMessage(fqcn, level, marker, msg, t); } } }
[ "@", "Override", "public", "void", "logMessage", "(", "final", "String", "fqcn", ",", "final", "Level", "level", ",", "final", "Marker", "marker", ",", "final", "Message", "msg", ",", "final", "Throwable", "t", ")", "{", "StackTraceElement", "element", "=", ...
Adds an event. @param marker The Marker @param fqcn The fully qualified class name of the <b>caller</b> @param level The logging level @param msg The message associated with the event. @param t A Throwable or null.
[ "Adds", "an", "event", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java#L248-L276
elki-project/elki
elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/APRIORI.java
APRIORI.debugDumpCandidates
private StringBuilder debugDumpCandidates(StringBuilder msg, List<? extends Itemset> candidates, VectorFieldTypeInformation<BitVector> meta) { msg.append(':'); for(Itemset itemset : candidates) { msg.append(" ["); itemset.appendTo(msg, meta); msg.append(']'); } return msg; }
java
private StringBuilder debugDumpCandidates(StringBuilder msg, List<? extends Itemset> candidates, VectorFieldTypeInformation<BitVector> meta) { msg.append(':'); for(Itemset itemset : candidates) { msg.append(" ["); itemset.appendTo(msg, meta); msg.append(']'); } return msg; }
[ "private", "StringBuilder", "debugDumpCandidates", "(", "StringBuilder", "msg", ",", "List", "<", "?", "extends", "Itemset", ">", "candidates", ",", "VectorFieldTypeInformation", "<", "BitVector", ">", "meta", ")", "{", "msg", ".", "append", "(", "'", "'", ")"...
Debug method: output all itemsets. @param msg Output buffer @param candidates Itemsets to dump @param meta Metadata for item labels @return Output buffer
[ "Debug", "method", ":", "output", "all", "itemsets", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/APRIORI.java#L569-L577
uber/NullAway
nullaway/src/main/java/com/uber/nullaway/NullAway.java
NullAway.updateEnvironmentMapping
private void updateEnvironmentMapping(Tree tree, VisitorState state) { AccessPathNullnessAnalysis analysis = getNullnessAnalysis(state); // two notes: // 1. we are free to take local variable information from the program point before // the lambda / class declaration as only effectively final variables can be accessed // from the nested scope, so the program point doesn't matter // 2. we keep info on all locals rather than just effectively final ones for simplicity EnclosingEnvironmentNullness.instance(state.context) .addEnvironmentMapping( tree, analysis.getNullnessInfoBeforeNewContext(state.getPath(), state, handler)); }
java
private void updateEnvironmentMapping(Tree tree, VisitorState state) { AccessPathNullnessAnalysis analysis = getNullnessAnalysis(state); // two notes: // 1. we are free to take local variable information from the program point before // the lambda / class declaration as only effectively final variables can be accessed // from the nested scope, so the program point doesn't matter // 2. we keep info on all locals rather than just effectively final ones for simplicity EnclosingEnvironmentNullness.instance(state.context) .addEnvironmentMapping( tree, analysis.getNullnessInfoBeforeNewContext(state.getPath(), state, handler)); }
[ "private", "void", "updateEnvironmentMapping", "(", "Tree", "tree", ",", "VisitorState", "state", ")", "{", "AccessPathNullnessAnalysis", "analysis", "=", "getNullnessAnalysis", "(", "state", ")", ";", "// two notes:", "// 1. we are free to take local variable information fro...
Updates the {@link EnclosingEnvironmentNullness} with an entry for lambda or anonymous class, capturing nullability info for locals just before the declaration of the entity @param tree either a lambda or a local / anonymous class @param state visitor state
[ "Updates", "the", "{", "@link", "EnclosingEnvironmentNullness", "}", "with", "an", "entry", "for", "lambda", "or", "anonymous", "class", "capturing", "nullability", "info", "for", "locals", "just", "before", "the", "declaration", "of", "the", "entity" ]
train
https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/NullAway.java#L363-L373
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/core/Parser.java
Parser.parseMoveKeyword
public static boolean parseMoveKeyword(final char[] query, int offset) { if (query.length < (offset + 4)) { return false; } return (query[offset] | 32) == 'm' && (query[offset + 1] | 32) == 'o' && (query[offset + 2] | 32) == 'v' && (query[offset + 3] | 32) == 'e'; }
java
public static boolean parseMoveKeyword(final char[] query, int offset) { if (query.length < (offset + 4)) { return false; } return (query[offset] | 32) == 'm' && (query[offset + 1] | 32) == 'o' && (query[offset + 2] | 32) == 'v' && (query[offset + 3] | 32) == 'e'; }
[ "public", "static", "boolean", "parseMoveKeyword", "(", "final", "char", "[", "]", "query", ",", "int", "offset", ")", "{", "if", "(", "query", ".", "length", "<", "(", "offset", "+", "4", ")", ")", "{", "return", "false", ";", "}", "return", "(", ...
Parse string to check presence of MOVE keyword regardless of case. @param query char[] of the query statement @param offset position of query to start checking @return boolean indicates presence of word
[ "Parse", "string", "to", "check", "presence", "of", "MOVE", "keyword", "regardless", "of", "case", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/Parser.java#L602-L611
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java
ImplicitObjectUtil.loadActionForm
public static void loadActionForm(JspContext jspContext, Object form) { jspContext.setAttribute(ACTION_FORM_IMPLICIT_OBJECT_KEY, unwrapForm(form)); }
java
public static void loadActionForm(JspContext jspContext, Object form) { jspContext.setAttribute(ACTION_FORM_IMPLICIT_OBJECT_KEY, unwrapForm(form)); }
[ "public", "static", "void", "loadActionForm", "(", "JspContext", "jspContext", ",", "Object", "form", ")", "{", "jspContext", ".", "setAttribute", "(", "ACTION_FORM_IMPLICIT_OBJECT_KEY", ",", "unwrapForm", "(", "form", ")", ")", ";", "}" ]
Load the given <code>form</code> into the {@link JspContext} object. Because the framework supports any bean action forms, the type of the form is {@link Object} @param jspContext the jsp context @param form the form object
[ "Load", "the", "given", "<code", ">", "form<", "/", "code", ">", "into", "the", "{" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java#L87-L89
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/refer/References.java
References.getOptional
public <T> List<T> getOptional(Class<T> type, Object locator) { try { return find(type, locator, false); } catch (Exception ex) { return new ArrayList<T>(); } }
java
public <T> List<T> getOptional(Class<T> type, Object locator) { try { return find(type, locator, false); } catch (Exception ex) { return new ArrayList<T>(); } }
[ "public", "<", "T", ">", "List", "<", "T", ">", "getOptional", "(", "Class", "<", "T", ">", "type", ",", "Object", "locator", ")", "{", "try", "{", "return", "find", "(", "type", ",", "locator", ",", "false", ")", ";", "}", "catch", "(", "Excepti...
Gets all component references that match specified locator and matching to the specified type. @param type the Class type that defined the type of the result. @param locator the locator to find references by. @return a list with matching component references or empty list if nothing was found.
[ "Gets", "all", "component", "references", "that", "match", "specified", "locator", "and", "matching", "to", "the", "specified", "type", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/refer/References.java#L243-L249
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterEncoder.java
CharacterEncoder.encodeBuffer
public void encodeBuffer(ByteBuffer aBuffer, OutputStream aStream) throws IOException { byte [] buf = getBytes(aBuffer); encodeBuffer(buf, aStream); }
java
public void encodeBuffer(ByteBuffer aBuffer, OutputStream aStream) throws IOException { byte [] buf = getBytes(aBuffer); encodeBuffer(buf, aStream); }
[ "public", "void", "encodeBuffer", "(", "ByteBuffer", "aBuffer", ",", "OutputStream", "aStream", ")", "throws", "IOException", "{", "byte", "[", "]", "buf", "=", "getBytes", "(", "aBuffer", ")", ";", "encodeBuffer", "(", "buf", ",", "aStream", ")", ";", "}"...
Encode the <i>aBuffer</i> ByteBuffer and write the encoded result to the OutputStream <i>aStream</i>. <P> The ByteBuffer's position will be advanced to ByteBuffer's limit.
[ "Encode", "the", "<i", ">", "aBuffer<", "/", "i", ">", "ByteBuffer", "and", "write", "the", "encoded", "result", "to", "the", "OutputStream", "<i", ">", "aStream<", "/", "i", ">", ".", "<P", ">", "The", "ByteBuffer", "s", "position", "will", "be", "adv...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterEncoder.java#L337-L341