repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/geopaparazzi/geopap4/DaoMetadata.java
DaoMetadata.fillProjectMetadata
public static void fillProjectMetadata(Connection connection, String name, String description, String notes, String creationUser) throws Exception { """ Populate the project metadata table. @param name the project name @param description an optional description. @param notes optional notes. @param creationUser the user creating the project. @throws java.io.IOException if something goes wrong. """ Date creationDate = new Date(); if (name == null) { name = "project-" + ETimeUtilities.INSTANCE.TIME_FORMATTER_LOCAL.format(creationDate); } if (description == null) { description = EMPTY_VALUE; } if (notes == null) { notes = EMPTY_VALUE; } if (creationUser == null) { creationUser = "dummy user"; } insertPair(connection, MetadataTableFields.KEY_NAME.getFieldName(), name); insertPair(connection, MetadataTableFields.KEY_DESCRIPTION.getFieldName(), description); insertPair(connection, MetadataTableFields.KEY_NOTES.getFieldName(), notes); insertPair(connection, MetadataTableFields.KEY_CREATIONTS.getFieldName(), String.valueOf(creationDate.getTime())); insertPair(connection, MetadataTableFields.KEY_LASTTS.getFieldName(), EMPTY_VALUE); insertPair(connection, MetadataTableFields.KEY_CREATIONUSER.getFieldName(), creationUser); insertPair(connection, MetadataTableFields.KEY_LASTUSER.getFieldName(), EMPTY_VALUE); }
java
public static void fillProjectMetadata(Connection connection, String name, String description, String notes, String creationUser) throws Exception { Date creationDate = new Date(); if (name == null) { name = "project-" + ETimeUtilities.INSTANCE.TIME_FORMATTER_LOCAL.format(creationDate); } if (description == null) { description = EMPTY_VALUE; } if (notes == null) { notes = EMPTY_VALUE; } if (creationUser == null) { creationUser = "dummy user"; } insertPair(connection, MetadataTableFields.KEY_NAME.getFieldName(), name); insertPair(connection, MetadataTableFields.KEY_DESCRIPTION.getFieldName(), description); insertPair(connection, MetadataTableFields.KEY_NOTES.getFieldName(), notes); insertPair(connection, MetadataTableFields.KEY_CREATIONTS.getFieldName(), String.valueOf(creationDate.getTime())); insertPair(connection, MetadataTableFields.KEY_LASTTS.getFieldName(), EMPTY_VALUE); insertPair(connection, MetadataTableFields.KEY_CREATIONUSER.getFieldName(), creationUser); insertPair(connection, MetadataTableFields.KEY_LASTUSER.getFieldName(), EMPTY_VALUE); }
[ "public", "static", "void", "fillProjectMetadata", "(", "Connection", "connection", ",", "String", "name", ",", "String", "description", ",", "String", "notes", ",", "String", "creationUser", ")", "throws", "Exception", "{", "Date", "creationDate", "=", "new", "Date", "(", ")", ";", "if", "(", "name", "==", "null", ")", "{", "name", "=", "\"project-\"", "+", "ETimeUtilities", ".", "INSTANCE", ".", "TIME_FORMATTER_LOCAL", ".", "format", "(", "creationDate", ")", ";", "}", "if", "(", "description", "==", "null", ")", "{", "description", "=", "EMPTY_VALUE", ";", "}", "if", "(", "notes", "==", "null", ")", "{", "notes", "=", "EMPTY_VALUE", ";", "}", "if", "(", "creationUser", "==", "null", ")", "{", "creationUser", "=", "\"dummy user\"", ";", "}", "insertPair", "(", "connection", ",", "MetadataTableFields", ".", "KEY_NAME", ".", "getFieldName", "(", ")", ",", "name", ")", ";", "insertPair", "(", "connection", ",", "MetadataTableFields", ".", "KEY_DESCRIPTION", ".", "getFieldName", "(", ")", ",", "description", ")", ";", "insertPair", "(", "connection", ",", "MetadataTableFields", ".", "KEY_NOTES", ".", "getFieldName", "(", ")", ",", "notes", ")", ";", "insertPair", "(", "connection", ",", "MetadataTableFields", ".", "KEY_CREATIONTS", ".", "getFieldName", "(", ")", ",", "String", ".", "valueOf", "(", "creationDate", ".", "getTime", "(", ")", ")", ")", ";", "insertPair", "(", "connection", ",", "MetadataTableFields", ".", "KEY_LASTTS", ".", "getFieldName", "(", ")", ",", "EMPTY_VALUE", ")", ";", "insertPair", "(", "connection", ",", "MetadataTableFields", ".", "KEY_CREATIONUSER", ".", "getFieldName", "(", ")", ",", "creationUser", ")", ";", "insertPair", "(", "connection", ",", "MetadataTableFields", ".", "KEY_LASTUSER", ".", "getFieldName", "(", ")", ",", "EMPTY_VALUE", ")", ";", "}" ]
Populate the project metadata table. @param name the project name @param description an optional description. @param notes optional notes. @param creationUser the user creating the project. @throws java.io.IOException if something goes wrong.
[ "Populate", "the", "project", "metadata", "table", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/geopaparazzi/geopap4/DaoMetadata.java#L74-L97
Samsung/GearVRf
GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java
GVRGenericConstraint.setAngularLowerLimits
public void setAngularLowerLimits(float limitX, float limitY, float limitZ) { """ Sets the lower limits for the "moving" body rotation relative to joint point. @param limitX the X axis lower rotation limit (in radians) @param limitY the Y axis lower rotation limit (in radians) @param limitZ the Z axis lower rotation limit (in radians) """ Native3DGenericConstraint.setAngularLowerLimits(getNative(), limitX, limitY, limitZ); }
java
public void setAngularLowerLimits(float limitX, float limitY, float limitZ) { Native3DGenericConstraint.setAngularLowerLimits(getNative(), limitX, limitY, limitZ); }
[ "public", "void", "setAngularLowerLimits", "(", "float", "limitX", ",", "float", "limitY", ",", "float", "limitZ", ")", "{", "Native3DGenericConstraint", ".", "setAngularLowerLimits", "(", "getNative", "(", ")", ",", "limitX", ",", "limitY", ",", "limitZ", ")", ";", "}" ]
Sets the lower limits for the "moving" body rotation relative to joint point. @param limitX the X axis lower rotation limit (in radians) @param limitY the Y axis lower rotation limit (in radians) @param limitZ the Z axis lower rotation limit (in radians)
[ "Sets", "the", "lower", "limits", "for", "the", "moving", "body", "rotation", "relative", "to", "joint", "point", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java#L105-L107
gwt-maven-plugin/gwt-maven-plugin
src/main/java/org/codehaus/mojo/gwt/shell/RunMojo.java
RunMojo.copyDirectoryStructureIfModified
private void copyDirectoryStructureIfModified(File sourceDir, File destDir) throws IOException { """ Copied a directory structure with deafault exclusions (.svn, CVS, etc) @param sourceDir The source directory to copy, must not be <code>null</code>. @param destDir The target directory to copy to, must not be <code>null</code>. @throws java.io.IOException If the directory structure could not be copied. """ DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir( sourceDir ); scanner.addDefaultExcludes(); scanner.scan(); /* * NOTE: Make sure the destination directory is always there (even if empty) to support POM-less ITs. */ destDir.mkdirs(); String[] includedDirs = scanner.getIncludedDirectories(); for ( int i = 0; i < includedDirs.length; ++i ) { File clonedDir = new File( destDir, includedDirs[i] ); clonedDir.mkdirs(); } String[] includedFiles = scanner.getIncludedFiles(); for ( int i = 0; i < includedFiles.length; ++i ) { File sourceFile = new File(sourceDir, includedFiles[i]); File destFile = new File(destDir, includedFiles[i]); FileUtils.copyFileIfModified(sourceFile, destFile); } }
java
private void copyDirectoryStructureIfModified(File sourceDir, File destDir) throws IOException { DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir( sourceDir ); scanner.addDefaultExcludes(); scanner.scan(); /* * NOTE: Make sure the destination directory is always there (even if empty) to support POM-less ITs. */ destDir.mkdirs(); String[] includedDirs = scanner.getIncludedDirectories(); for ( int i = 0; i < includedDirs.length; ++i ) { File clonedDir = new File( destDir, includedDirs[i] ); clonedDir.mkdirs(); } String[] includedFiles = scanner.getIncludedFiles(); for ( int i = 0; i < includedFiles.length; ++i ) { File sourceFile = new File(sourceDir, includedFiles[i]); File destFile = new File(destDir, includedFiles[i]); FileUtils.copyFileIfModified(sourceFile, destFile); } }
[ "private", "void", "copyDirectoryStructureIfModified", "(", "File", "sourceDir", ",", "File", "destDir", ")", "throws", "IOException", "{", "DirectoryScanner", "scanner", "=", "new", "DirectoryScanner", "(", ")", ";", "scanner", ".", "setBasedir", "(", "sourceDir", ")", ";", "scanner", ".", "addDefaultExcludes", "(", ")", ";", "scanner", ".", "scan", "(", ")", ";", "/*\n * NOTE: Make sure the destination directory is always there (even if empty) to support POM-less ITs.\n */", "destDir", ".", "mkdirs", "(", ")", ";", "String", "[", "]", "includedDirs", "=", "scanner", ".", "getIncludedDirectories", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "includedDirs", ".", "length", ";", "++", "i", ")", "{", "File", "clonedDir", "=", "new", "File", "(", "destDir", ",", "includedDirs", "[", "i", "]", ")", ";", "clonedDir", ".", "mkdirs", "(", ")", ";", "}", "String", "[", "]", "includedFiles", "=", "scanner", ".", "getIncludedFiles", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "includedFiles", ".", "length", ";", "++", "i", ")", "{", "File", "sourceFile", "=", "new", "File", "(", "sourceDir", ",", "includedFiles", "[", "i", "]", ")", ";", "File", "destFile", "=", "new", "File", "(", "destDir", ",", "includedFiles", "[", "i", "]", ")", ";", "FileUtils", ".", "copyFileIfModified", "(", "sourceFile", ",", "destFile", ")", ";", "}", "}" ]
Copied a directory structure with deafault exclusions (.svn, CVS, etc) @param sourceDir The source directory to copy, must not be <code>null</code>. @param destDir The target directory to copy to, must not be <code>null</code>. @throws java.io.IOException If the directory structure could not be copied.
[ "Copied", "a", "directory", "structure", "with", "deafault", "exclusions", "(", ".", "svn", "CVS", "etc", ")" ]
train
https://github.com/gwt-maven-plugin/gwt-maven-plugin/blob/0cdd5054b43f182cc22a8acf61ec79ac42b0dfdc/src/main/java/org/codehaus/mojo/gwt/shell/RunMojo.java#L542-L566
alkacon/opencms-core
src/org/opencms/db/generic/CmsHistoryDriver.java
CmsHistoryDriver.internalCleanup
protected void internalCleanup(CmsDbContext dbc, I_CmsHistoryResource resource) throws CmsDataAccessException { """ Deletes all historical entries of subresources of a folder without any historical netry left.<p> @param dbc the current database context @param resource the resource to check @throws CmsDataAccessException if something goes wrong """ Connection conn = null; PreparedStatement stmt = null; ResultSet res = null; Map<CmsUUID, Integer> tmpSubResources = new HashMap<CmsUUID, Integer>(); // if is folder and if no versions left boolean isFolderAndNoVersionLeft = resource.getRootPath().endsWith("/") && (readLastVersion(dbc, resource.getStructureId()) == 0); // if the resource is a folder if (isFolderAndNoVersionLeft) { try { conn = m_sqlManager.getConnection(dbc); // get all direct subresources stmt = m_sqlManager.getPreparedStatement(conn, "C_STRUCTURE_HISTORY_READ_SUBRESOURCES"); stmt.setString(1, resource.getStructureId().toString()); res = stmt.executeQuery(); while (res.next()) { CmsUUID structureId = new CmsUUID(res.getString(1)); int version = res.getInt(2); tmpSubResources.put(structureId, Integer.valueOf(version)); } } catch (SQLException e) { throw new CmsDbSqlException( Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, res); } } // delete all subresource versions for (Map.Entry<CmsUUID, Integer> entry : tmpSubResources.entrySet()) { I_CmsHistoryResource histResource = readResource(dbc, entry.getKey(), entry.getValue().intValue()); deleteEntries(dbc, histResource, 0, -1); } }
java
protected void internalCleanup(CmsDbContext dbc, I_CmsHistoryResource resource) throws CmsDataAccessException { Connection conn = null; PreparedStatement stmt = null; ResultSet res = null; Map<CmsUUID, Integer> tmpSubResources = new HashMap<CmsUUID, Integer>(); // if is folder and if no versions left boolean isFolderAndNoVersionLeft = resource.getRootPath().endsWith("/") && (readLastVersion(dbc, resource.getStructureId()) == 0); // if the resource is a folder if (isFolderAndNoVersionLeft) { try { conn = m_sqlManager.getConnection(dbc); // get all direct subresources stmt = m_sqlManager.getPreparedStatement(conn, "C_STRUCTURE_HISTORY_READ_SUBRESOURCES"); stmt.setString(1, resource.getStructureId().toString()); res = stmt.executeQuery(); while (res.next()) { CmsUUID structureId = new CmsUUID(res.getString(1)); int version = res.getInt(2); tmpSubResources.put(structureId, Integer.valueOf(version)); } } catch (SQLException e) { throw new CmsDbSqlException( Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, res); } } // delete all subresource versions for (Map.Entry<CmsUUID, Integer> entry : tmpSubResources.entrySet()) { I_CmsHistoryResource histResource = readResource(dbc, entry.getKey(), entry.getValue().intValue()); deleteEntries(dbc, histResource, 0, -1); } }
[ "protected", "void", "internalCleanup", "(", "CmsDbContext", "dbc", ",", "I_CmsHistoryResource", "resource", ")", "throws", "CmsDataAccessException", "{", "Connection", "conn", "=", "null", ";", "PreparedStatement", "stmt", "=", "null", ";", "ResultSet", "res", "=", "null", ";", "Map", "<", "CmsUUID", ",", "Integer", ">", "tmpSubResources", "=", "new", "HashMap", "<", "CmsUUID", ",", "Integer", ">", "(", ")", ";", "// if is folder and if no versions left", "boolean", "isFolderAndNoVersionLeft", "=", "resource", ".", "getRootPath", "(", ")", ".", "endsWith", "(", "\"/\"", ")", "&&", "(", "readLastVersion", "(", "dbc", ",", "resource", ".", "getStructureId", "(", ")", ")", "==", "0", ")", ";", "// if the resource is a folder", "if", "(", "isFolderAndNoVersionLeft", ")", "{", "try", "{", "conn", "=", "m_sqlManager", ".", "getConnection", "(", "dbc", ")", ";", "// get all direct subresources", "stmt", "=", "m_sqlManager", ".", "getPreparedStatement", "(", "conn", ",", "\"C_STRUCTURE_HISTORY_READ_SUBRESOURCES\"", ")", ";", "stmt", ".", "setString", "(", "1", ",", "resource", ".", "getStructureId", "(", ")", ".", "toString", "(", ")", ")", ";", "res", "=", "stmt", ".", "executeQuery", "(", ")", ";", "while", "(", "res", ".", "next", "(", ")", ")", "{", "CmsUUID", "structureId", "=", "new", "CmsUUID", "(", "res", ".", "getString", "(", "1", ")", ")", ";", "int", "version", "=", "res", ".", "getInt", "(", "2", ")", ";", "tmpSubResources", ".", "put", "(", "structureId", ",", "Integer", ".", "valueOf", "(", "version", ")", ")", ";", "}", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "new", "CmsDbSqlException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_GENERIC_SQL_1", ",", "CmsDbSqlException", ".", "getErrorQuery", "(", "stmt", ")", ")", ",", "e", ")", ";", "}", "finally", "{", "m_sqlManager", ".", "closeAll", "(", "dbc", ",", "conn", ",", "stmt", ",", "res", ")", ";", "}", "}", "// delete all subresource versions", "for", "(", "Map", ".", "Entry", "<", "CmsUUID", ",", "Integer", ">", "entry", ":", "tmpSubResources", ".", "entrySet", "(", ")", ")", "{", "I_CmsHistoryResource", "histResource", "=", "readResource", "(", "dbc", ",", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ".", "intValue", "(", ")", ")", ";", "deleteEntries", "(", "dbc", ",", "histResource", ",", "0", ",", "-", "1", ")", ";", "}", "}" ]
Deletes all historical entries of subresources of a folder without any historical netry left.<p> @param dbc the current database context @param resource the resource to check @throws CmsDataAccessException if something goes wrong
[ "Deletes", "all", "historical", "entries", "of", "subresources", "of", "a", "folder", "without", "any", "historical", "netry", "left", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsHistoryDriver.java#L1606-L1643
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java
ReferrerURLCookieHandler.invalidateCookie
public void invalidateCookie(HttpServletRequest req, HttpServletResponse res, String cookieName, boolean enableHttpOnly) { """ Invalidate (clear) the referrer URL cookie in the HttpServletResponse. Setting age to 0 invalidates it. @param res """ Cookie c = new Cookie(cookieName, ""); if (cookieName.equals("WASReqURL")) { c.setPath(getPathName(req)); } else { c.setPath("/"); } c.setMaxAge(0); if (enableHttpOnly && webAppSecConfig.getHttpOnlyCookies()) { c.setHttpOnly(true); } if (webAppSecConfig.getSSORequiresSSL()) { c.setSecure(true); } res.addCookie(c); }
java
public void invalidateCookie(HttpServletRequest req, HttpServletResponse res, String cookieName, boolean enableHttpOnly) { Cookie c = new Cookie(cookieName, ""); if (cookieName.equals("WASReqURL")) { c.setPath(getPathName(req)); } else { c.setPath("/"); } c.setMaxAge(0); if (enableHttpOnly && webAppSecConfig.getHttpOnlyCookies()) { c.setHttpOnly(true); } if (webAppSecConfig.getSSORequiresSSL()) { c.setSecure(true); } res.addCookie(c); }
[ "public", "void", "invalidateCookie", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ",", "String", "cookieName", ",", "boolean", "enableHttpOnly", ")", "{", "Cookie", "c", "=", "new", "Cookie", "(", "cookieName", ",", "\"\"", ")", ";", "if", "(", "cookieName", ".", "equals", "(", "\"WASReqURL\"", ")", ")", "{", "c", ".", "setPath", "(", "getPathName", "(", "req", ")", ")", ";", "}", "else", "{", "c", ".", "setPath", "(", "\"/\"", ")", ";", "}", "c", ".", "setMaxAge", "(", "0", ")", ";", "if", "(", "enableHttpOnly", "&&", "webAppSecConfig", ".", "getHttpOnlyCookies", "(", ")", ")", "{", "c", ".", "setHttpOnly", "(", "true", ")", ";", "}", "if", "(", "webAppSecConfig", ".", "getSSORequiresSSL", "(", ")", ")", "{", "c", ".", "setSecure", "(", "true", ")", ";", "}", "res", ".", "addCookie", "(", "c", ")", ";", "}" ]
Invalidate (clear) the referrer URL cookie in the HttpServletResponse. Setting age to 0 invalidates it. @param res
[ "Invalidate", "(", "clear", ")", "the", "referrer", "URL", "cookie", "in", "the", "HttpServletResponse", ".", "Setting", "age", "to", "0", "invalidates", "it", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java#L130-L145
googleads/googleads-java-lib
examples/adwords_axis/src/main/java/adwords/axis/v201809/optimization/EstimateKeywordTraffic.java
EstimateKeywordTraffic.calculateMean
private static Double calculateMean(Money minMoney, Money maxMoney) { """ Returns the mean of the {@code microAmount} of the two Money values if neither is null, else returns null. """ if (minMoney == null || maxMoney == null) { return null; } return calculateMean(minMoney.getMicroAmount(), maxMoney.getMicroAmount()); }
java
private static Double calculateMean(Money minMoney, Money maxMoney) { if (minMoney == null || maxMoney == null) { return null; } return calculateMean(minMoney.getMicroAmount(), maxMoney.getMicroAmount()); }
[ "private", "static", "Double", "calculateMean", "(", "Money", "minMoney", ",", "Money", "maxMoney", ")", "{", "if", "(", "minMoney", "==", "null", "||", "maxMoney", "==", "null", ")", "{", "return", "null", ";", "}", "return", "calculateMean", "(", "minMoney", ".", "getMicroAmount", "(", ")", ",", "maxMoney", ".", "getMicroAmount", "(", ")", ")", ";", "}" ]
Returns the mean of the {@code microAmount} of the two Money values if neither is null, else returns null.
[ "Returns", "the", "mean", "of", "the", "{" ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/adwords_axis/src/main/java/adwords/axis/v201809/optimization/EstimateKeywordTraffic.java#L283-L288
unbescape/unbescape
src/main/java/org/unbescape/json/JsonEscape.java
JsonEscape.unescapeJson
public static void unescapeJson(final Reader reader, final Writer writer) throws IOException { """ <p> Perform a JSON <strong>unescape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> JSON unescape of SECs and u-based escapes. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2 """ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } JsonEscapeUtil.unescape(reader, writer); }
java
public static void unescapeJson(final Reader reader, final Writer writer) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } JsonEscapeUtil.unescape(reader, writer); }
[ "public", "static", "void", "unescapeJson", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Argument 'writer' cannot be null\"", ")", ";", "}", "JsonEscapeUtil", ".", "unescape", "(", "reader", ",", "writer", ")", ";", "}" ]
<p> Perform a JSON <strong>unescape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> JSON unescape of SECs and u-based escapes. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "a", "JSON", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "No", "additional", "configuration", "arguments", "are", "required", ".", "Unescape", "operations", "will", "always", "perform", "<em", ">", "complete<", "/", "em", ">", "JSON", "unescape", "of", "SECs", "and", "u", "-", "based", "escapes", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/json/JsonEscape.java#L957-L966
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/websphere/channelfw/ChannelUtils.java
ChannelUtils.debugTrace
@Override protected void debugTrace(Object logTool, String msg, Object... parameters) { """ Debug trace using either Tr or Logger @param logTool Caller's LogTool (should be Logger OR TraceComponent) @param msg Debug message @see ChannelUtilsBase#debugTrace(Object, String) """ Tr.debug((TraceComponent) logTool, msg, parameters); }
java
@Override protected void debugTrace(Object logTool, String msg, Object... parameters) { Tr.debug((TraceComponent) logTool, msg, parameters); }
[ "@", "Override", "protected", "void", "debugTrace", "(", "Object", "logTool", ",", "String", "msg", ",", "Object", "...", "parameters", ")", "{", "Tr", ".", "debug", "(", "(", "TraceComponent", ")", "logTool", ",", "msg", ",", "parameters", ")", ";", "}" ]
Debug trace using either Tr or Logger @param logTool Caller's LogTool (should be Logger OR TraceComponent) @param msg Debug message @see ChannelUtilsBase#debugTrace(Object, String)
[ "Debug", "trace", "using", "either", "Tr", "or", "Logger" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/websphere/channelfw/ChannelUtils.java#L196-L199
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/EntityFieldAnnotationRule.java
EntityFieldAnnotationRule.checkForGenerator
private void checkForGenerator(final Class<?> clazz, Field field, GeneratedValue generatedValue, String schemaName) { """ Validate for generator. @param clazz @param field @param generatedValue @param schemaName @throws RuleValidationException """ TableGenerator tableGenerator = field.getAnnotation(TableGenerator.class); SequenceGenerator sequenceGenerator = field.getAnnotation(SequenceGenerator.class); if (tableGenerator == null || !tableGenerator.name().equals(generatedValue.generator())) { tableGenerator = clazz.getAnnotation(TableGenerator.class); } if (sequenceGenerator == null || !sequenceGenerator.name().equals(generatedValue.generator())) { sequenceGenerator = clazz.getAnnotation(SequenceGenerator.class); } if ((tableGenerator == null && sequenceGenerator == null) || (tableGenerator != null && !tableGenerator.name().equals(generatedValue.generator())) || (sequenceGenerator != null && !sequenceGenerator.name().equals(generatedValue.generator()))) { throw new RuleValidationException("Unknown Id.generator: " + generatedValue.generator()); } else if ((tableGenerator != null && !tableGenerator.schema().isEmpty() && !tableGenerator.schema().equals( schemaName)) || (sequenceGenerator != null && !sequenceGenerator.schema().isEmpty() && !sequenceGenerator.schema() .equals(schemaName))) { throw new RuleValidationException("Generator " + generatedValue.generator() + " in entity : " + clazz.getName() + " has different schema name ,it should be same as entity have"); } }
java
private void checkForGenerator(final Class<?> clazz, Field field, GeneratedValue generatedValue, String schemaName) { TableGenerator tableGenerator = field.getAnnotation(TableGenerator.class); SequenceGenerator sequenceGenerator = field.getAnnotation(SequenceGenerator.class); if (tableGenerator == null || !tableGenerator.name().equals(generatedValue.generator())) { tableGenerator = clazz.getAnnotation(TableGenerator.class); } if (sequenceGenerator == null || !sequenceGenerator.name().equals(generatedValue.generator())) { sequenceGenerator = clazz.getAnnotation(SequenceGenerator.class); } if ((tableGenerator == null && sequenceGenerator == null) || (tableGenerator != null && !tableGenerator.name().equals(generatedValue.generator())) || (sequenceGenerator != null && !sequenceGenerator.name().equals(generatedValue.generator()))) { throw new RuleValidationException("Unknown Id.generator: " + generatedValue.generator()); } else if ((tableGenerator != null && !tableGenerator.schema().isEmpty() && !tableGenerator.schema().equals( schemaName)) || (sequenceGenerator != null && !sequenceGenerator.schema().isEmpty() && !sequenceGenerator.schema() .equals(schemaName))) { throw new RuleValidationException("Generator " + generatedValue.generator() + " in entity : " + clazz.getName() + " has different schema name ,it should be same as entity have"); } }
[ "private", "void", "checkForGenerator", "(", "final", "Class", "<", "?", ">", "clazz", ",", "Field", "field", ",", "GeneratedValue", "generatedValue", ",", "String", "schemaName", ")", "{", "TableGenerator", "tableGenerator", "=", "field", ".", "getAnnotation", "(", "TableGenerator", ".", "class", ")", ";", "SequenceGenerator", "sequenceGenerator", "=", "field", ".", "getAnnotation", "(", "SequenceGenerator", ".", "class", ")", ";", "if", "(", "tableGenerator", "==", "null", "||", "!", "tableGenerator", ".", "name", "(", ")", ".", "equals", "(", "generatedValue", ".", "generator", "(", ")", ")", ")", "{", "tableGenerator", "=", "clazz", ".", "getAnnotation", "(", "TableGenerator", ".", "class", ")", ";", "}", "if", "(", "sequenceGenerator", "==", "null", "||", "!", "sequenceGenerator", ".", "name", "(", ")", ".", "equals", "(", "generatedValue", ".", "generator", "(", ")", ")", ")", "{", "sequenceGenerator", "=", "clazz", ".", "getAnnotation", "(", "SequenceGenerator", ".", "class", ")", ";", "}", "if", "(", "(", "tableGenerator", "==", "null", "&&", "sequenceGenerator", "==", "null", ")", "||", "(", "tableGenerator", "!=", "null", "&&", "!", "tableGenerator", ".", "name", "(", ")", ".", "equals", "(", "generatedValue", ".", "generator", "(", ")", ")", ")", "||", "(", "sequenceGenerator", "!=", "null", "&&", "!", "sequenceGenerator", ".", "name", "(", ")", ".", "equals", "(", "generatedValue", ".", "generator", "(", ")", ")", ")", ")", "{", "throw", "new", "RuleValidationException", "(", "\"Unknown Id.generator: \"", "+", "generatedValue", ".", "generator", "(", ")", ")", ";", "}", "else", "if", "(", "(", "tableGenerator", "!=", "null", "&&", "!", "tableGenerator", ".", "schema", "(", ")", ".", "isEmpty", "(", ")", "&&", "!", "tableGenerator", ".", "schema", "(", ")", ".", "equals", "(", "schemaName", ")", ")", "||", "(", "sequenceGenerator", "!=", "null", "&&", "!", "sequenceGenerator", ".", "schema", "(", ")", ".", "isEmpty", "(", ")", "&&", "!", "sequenceGenerator", ".", "schema", "(", ")", ".", "equals", "(", "schemaName", ")", ")", ")", "{", "throw", "new", "RuleValidationException", "(", "\"Generator \"", "+", "generatedValue", ".", "generator", "(", ")", "+", "\" in entity : \"", "+", "clazz", ".", "getName", "(", ")", "+", "\" has different schema name ,it should be same as entity have\"", ")", ";", "}", "}" ]
Validate for generator. @param clazz @param field @param generatedValue @param schemaName @throws RuleValidationException
[ "Validate", "for", "generator", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/EntityFieldAnnotationRule.java#L248-L282
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/MusicOnHoldApi.java
MusicOnHoldApi.sendMOHSettingsAsync
public com.squareup.okhttp.Call sendMOHSettingsAsync(String musicFile, Boolean musicEnabled, final ApiCallback<SendMOHSettingsResponse> callback) throws ApiException { """ Update MOH settings. (asynchronously) Adds or updates MOH setting. @param musicFile The Name of WAV file. (required) @param musicEnabled Define is music enabled/disabled. (required) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object """ ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = sendMOHSettingsValidateBeforeCall(musicFile, musicEnabled, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<SendMOHSettingsResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call sendMOHSettingsAsync(String musicFile, Boolean musicEnabled, final ApiCallback<SendMOHSettingsResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = sendMOHSettingsValidateBeforeCall(musicFile, musicEnabled, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<SendMOHSettingsResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "sendMOHSettingsAsync", "(", "String", "musicFile", ",", "Boolean", "musicEnabled", ",", "final", "ApiCallback", "<", "SendMOHSettingsResponse", ">", "callback", ")", "throws", "ApiException", "{", "ProgressResponseBody", ".", "ProgressListener", "progressListener", "=", "null", ";", "ProgressRequestBody", ".", "ProgressRequestListener", "progressRequestListener", "=", "null", ";", "if", "(", "callback", "!=", "null", ")", "{", "progressListener", "=", "new", "ProgressResponseBody", ".", "ProgressListener", "(", ")", "{", "@", "Override", "public", "void", "update", "(", "long", "bytesRead", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onDownloadProgress", "(", "bytesRead", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "progressRequestListener", "=", "new", "ProgressRequestBody", ".", "ProgressRequestListener", "(", ")", "{", "@", "Override", "public", "void", "onRequestProgress", "(", "long", "bytesWritten", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onUploadProgress", "(", "bytesWritten", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "}", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "sendMOHSettingsValidateBeforeCall", "(", "musicFile", ",", "musicEnabled", ",", "progressListener", ",", "progressRequestListener", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "SendMOHSettingsResponse", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "apiClient", ".", "executeAsync", "(", "call", ",", "localVarReturnType", ",", "callback", ")", ";", "return", "call", ";", "}" ]
Update MOH settings. (asynchronously) Adds or updates MOH setting. @param musicFile The Name of WAV file. (required) @param musicEnabled Define is music enabled/disabled. (required) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "Update", "MOH", "settings", ".", "(", "asynchronously", ")", "Adds", "or", "updates", "MOH", "setting", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/MusicOnHoldApi.java#L645-L670
m-m-m/util
datatype/src/main/java/net/sf/mmm/util/datatype/api/color/GenericColor.java
GenericColor.valueOf
public static GenericColor valueOf(Color color) { """ Converts the given {@link Color} to a {@link GenericColor}. @param color is the discrete RGBA {@link Color}. @return the corresponding {@link GenericColor}. """ Objects.requireNonNull(color, "color"); Red red = new Red(color.getRed()); Green green = new Green(color.getGreen()); Blue blue = new Blue(color.getBlue()); Alpha alpha = new Alpha(color.getAlpha()); return valueOf(red, green, blue, alpha); }
java
public static GenericColor valueOf(Color color) { Objects.requireNonNull(color, "color"); Red red = new Red(color.getRed()); Green green = new Green(color.getGreen()); Blue blue = new Blue(color.getBlue()); Alpha alpha = new Alpha(color.getAlpha()); return valueOf(red, green, blue, alpha); }
[ "public", "static", "GenericColor", "valueOf", "(", "Color", "color", ")", "{", "Objects", ".", "requireNonNull", "(", "color", ",", "\"color\"", ")", ";", "Red", "red", "=", "new", "Red", "(", "color", ".", "getRed", "(", ")", ")", ";", "Green", "green", "=", "new", "Green", "(", "color", ".", "getGreen", "(", ")", ")", ";", "Blue", "blue", "=", "new", "Blue", "(", "color", ".", "getBlue", "(", ")", ")", ";", "Alpha", "alpha", "=", "new", "Alpha", "(", "color", ".", "getAlpha", "(", ")", ")", ";", "return", "valueOf", "(", "red", ",", "green", ",", "blue", ",", "alpha", ")", ";", "}" ]
Converts the given {@link Color} to a {@link GenericColor}. @param color is the discrete RGBA {@link Color}. @return the corresponding {@link GenericColor}.
[ "Converts", "the", "given", "{", "@link", "Color", "}", "to", "a", "{", "@link", "GenericColor", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/datatype/src/main/java/net/sf/mmm/util/datatype/api/color/GenericColor.java#L140-L148
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java
UCharacter.getPropertyValueEnumNoThrow
@Deprecated public static int getPropertyValueEnumNoThrow(int property, CharSequence valueAlias) { """ Same as {@link #getPropertyValueEnum(int, CharSequence)}, except doesn't throw exception. Instead, returns UProperty.UNDEFINED. @param property Same as {@link #getPropertyValueEnum(int, CharSequence)} @param valueAlias Same as {@link #getPropertyValueEnum(int, CharSequence)} @return returns UProperty.UNDEFINED if the value is not valid, otherwise the value. @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android """ return UPropertyAliases.INSTANCE.getPropertyValueEnumNoThrow(property, valueAlias); }
java
@Deprecated public static int getPropertyValueEnumNoThrow(int property, CharSequence valueAlias) { return UPropertyAliases.INSTANCE.getPropertyValueEnumNoThrow(property, valueAlias); }
[ "@", "Deprecated", "public", "static", "int", "getPropertyValueEnumNoThrow", "(", "int", "property", ",", "CharSequence", "valueAlias", ")", "{", "return", "UPropertyAliases", ".", "INSTANCE", ".", "getPropertyValueEnumNoThrow", "(", "property", ",", "valueAlias", ")", ";", "}" ]
Same as {@link #getPropertyValueEnum(int, CharSequence)}, except doesn't throw exception. Instead, returns UProperty.UNDEFINED. @param property Same as {@link #getPropertyValueEnum(int, CharSequence)} @param valueAlias Same as {@link #getPropertyValueEnum(int, CharSequence)} @return returns UProperty.UNDEFINED if the value is not valid, otherwise the value. @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Same", "as", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L4232-L4235
skyscreamer/JSONassert
src/main/java/org/skyscreamer/jsonassert/comparator/JSONCompareUtil.java
JSONCompareUtil.isUsableAsUniqueKey
public static boolean isUsableAsUniqueKey(String candidate, JSONArray array) throws JSONException { """ <p>Looks to see if candidate field is a possible unique key across a array of objects. Returns true IFF:</p> <ol> <li>array is an array of JSONObject <li>candidate is a top-level field in each of of the objects in the array <li>candidate is a simple value (not JSONObject or JSONArray) <li>candidate is unique across all elements in the array </ol> @param candidate is usable as a unique key if every element in the @param array is a JSONObject having that key, and no two values are the same. @return true if the candidate can work as a unique id across array @throws JSONException JSON parsing error """ Set<Object> seenValues = new HashSet<Object>(); for (int i = 0; i < array.length(); i++) { Object item = array.get(i); if (item instanceof JSONObject) { JSONObject o = (JSONObject) item; if (o.has(candidate)) { Object value = o.get(candidate); if (isSimpleValue(value) && !seenValues.contains(value)) { seenValues.add(value); } else { return false; } } else { return false; } } else { return false; } } return true; }
java
public static boolean isUsableAsUniqueKey(String candidate, JSONArray array) throws JSONException { Set<Object> seenValues = new HashSet<Object>(); for (int i = 0; i < array.length(); i++) { Object item = array.get(i); if (item instanceof JSONObject) { JSONObject o = (JSONObject) item; if (o.has(candidate)) { Object value = o.get(candidate); if (isSimpleValue(value) && !seenValues.contains(value)) { seenValues.add(value); } else { return false; } } else { return false; } } else { return false; } } return true; }
[ "public", "static", "boolean", "isUsableAsUniqueKey", "(", "String", "candidate", ",", "JSONArray", "array", ")", "throws", "JSONException", "{", "Set", "<", "Object", ">", "seenValues", "=", "new", "HashSet", "<", "Object", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", "(", ")", ";", "i", "++", ")", "{", "Object", "item", "=", "array", ".", "get", "(", "i", ")", ";", "if", "(", "item", "instanceof", "JSONObject", ")", "{", "JSONObject", "o", "=", "(", "JSONObject", ")", "item", ";", "if", "(", "o", ".", "has", "(", "candidate", ")", ")", "{", "Object", "value", "=", "o", ".", "get", "(", "candidate", ")", ";", "if", "(", "isSimpleValue", "(", "value", ")", "&&", "!", "seenValues", ".", "contains", "(", "value", ")", ")", "{", "seenValues", ".", "add", "(", "value", ")", ";", "}", "else", "{", "return", "false", ";", "}", "}", "else", "{", "return", "false", ";", "}", "}", "else", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
<p>Looks to see if candidate field is a possible unique key across a array of objects. Returns true IFF:</p> <ol> <li>array is an array of JSONObject <li>candidate is a top-level field in each of of the objects in the array <li>candidate is a simple value (not JSONObject or JSONArray) <li>candidate is unique across all elements in the array </ol> @param candidate is usable as a unique key if every element in the @param array is a JSONObject having that key, and no two values are the same. @return true if the candidate can work as a unique id across array @throws JSONException JSON parsing error
[ "<p", ">", "Looks", "to", "see", "if", "candidate", "field", "is", "a", "possible", "unique", "key", "across", "a", "array", "of", "objects", ".", "Returns", "true", "IFF", ":", "<", "/", "p", ">", "<ol", ">", "<li", ">", "array", "is", "an", "array", "of", "JSONObject", "<li", ">", "candidate", "is", "a", "top", "-", "level", "field", "in", "each", "of", "of", "the", "objects", "in", "the", "array", "<li", ">", "candidate", "is", "a", "simple", "value", "(", "not", "JSONObject", "or", "JSONArray", ")", "<li", ">", "candidate", "is", "unique", "across", "all", "elements", "in", "the", "array", "<", "/", "ol", ">" ]
train
https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/comparator/JSONCompareUtil.java#L91-L112
Twitter4J/Twitter4J
twitter4j-core/src/internal-json/java/twitter4j/JSONImplFactory.java
JSONImplFactory.createUserMentionEntity
public static UserMentionEntity createUserMentionEntity(int start, int end, String name, String screenName, long id) { """ static factory method for twitter-text-java @return user mention entity @since Twitter4J 2.2.6 """ return new UserMentionEntityJSONImpl(start, end, name, screenName, id); }
java
public static UserMentionEntity createUserMentionEntity(int start, int end, String name, String screenName, long id) { return new UserMentionEntityJSONImpl(start, end, name, screenName, id); }
[ "public", "static", "UserMentionEntity", "createUserMentionEntity", "(", "int", "start", ",", "int", "end", ",", "String", "name", ",", "String", "screenName", ",", "long", "id", ")", "{", "return", "new", "UserMentionEntityJSONImpl", "(", "start", ",", "end", ",", "name", ",", "screenName", ",", "id", ")", ";", "}" ]
static factory method for twitter-text-java @return user mention entity @since Twitter4J 2.2.6
[ "static", "factory", "method", "for", "twitter", "-", "text", "-", "java" ]
train
https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/internal-json/java/twitter4j/JSONImplFactory.java#L284-L287
lessthanoptimal/ejml
main/ejml-ddense/generate/org/ejml/dense/row/misc/GenerateInverseFromMinor.java
GenerateInverseFromMinor.printMinors
public void printMinors(int matrix[], int N, PrintStream stream) { """ Put the core auto-code algorithm here so an external class can call it """ this.N = N; this.stream = stream; // compute all the minors int index = 0; for( int i = 1; i <= N; i++ ) { for( int j = 1; j <= N; j++ , index++) { stream.print(" double m"+i+""+j+" = "); if( (i+j) % 2 == 1 ) stream.print("-( "); printTopMinor(matrix,i-1,j-1,N); if( (i+j) % 2 == 1 ) stream.print(")"); stream.print(";\n"); } } stream.println(); // compute the determinant stream.print(" double det = (a11*m11"); for( int i = 2; i <= N; i++ ) { stream.print(" + "+a(i-1)+"*m"+1+""+i); } stream.println(")/scale;"); }
java
public void printMinors(int matrix[], int N, PrintStream stream) { this.N = N; this.stream = stream; // compute all the minors int index = 0; for( int i = 1; i <= N; i++ ) { for( int j = 1; j <= N; j++ , index++) { stream.print(" double m"+i+""+j+" = "); if( (i+j) % 2 == 1 ) stream.print("-( "); printTopMinor(matrix,i-1,j-1,N); if( (i+j) % 2 == 1 ) stream.print(")"); stream.print(";\n"); } } stream.println(); // compute the determinant stream.print(" double det = (a11*m11"); for( int i = 2; i <= N; i++ ) { stream.print(" + "+a(i-1)+"*m"+1+""+i); } stream.println(")/scale;"); }
[ "public", "void", "printMinors", "(", "int", "matrix", "[", "]", ",", "int", "N", ",", "PrintStream", "stream", ")", "{", "this", ".", "N", "=", "N", ";", "this", ".", "stream", "=", "stream", ";", "// compute all the minors", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "N", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "1", ";", "j", "<=", "N", ";", "j", "++", ",", "index", "++", ")", "{", "stream", ".", "print", "(", "\" double m\"", "+", "i", "+", "\"\"", "+", "j", "+", "\" = \"", ")", ";", "if", "(", "(", "i", "+", "j", ")", "%", "2", "==", "1", ")", "stream", ".", "print", "(", "\"-( \"", ")", ";", "printTopMinor", "(", "matrix", ",", "i", "-", "1", ",", "j", "-", "1", ",", "N", ")", ";", "if", "(", "(", "i", "+", "j", ")", "%", "2", "==", "1", ")", "stream", ".", "print", "(", "\")\"", ")", ";", "stream", ".", "print", "(", "\";\\n\"", ")", ";", "}", "}", "stream", ".", "println", "(", ")", ";", "// compute the determinant", "stream", ".", "print", "(", "\" double det = (a11*m11\"", ")", ";", "for", "(", "int", "i", "=", "2", ";", "i", "<=", "N", ";", "i", "++", ")", "{", "stream", ".", "print", "(", "\" + \"", "+", "a", "(", "i", "-", "1", ")", "+", "\"*m\"", "+", "1", "+", "\"\"", "+", "i", ")", ";", "}", "stream", ".", "println", "(", "\")/scale;\"", ")", ";", "}" ]
Put the core auto-code algorithm here so an external class can call it
[ "Put", "the", "core", "auto", "-", "code", "algorithm", "here", "so", "an", "external", "class", "can", "call", "it" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/generate/org/ejml/dense/row/misc/GenerateInverseFromMinor.java#L147-L173
zaproxy/zaproxy
src/org/apache/commons/httpclient/HttpMethodBase.java
HttpMethodBase.readResponseHeaders
protected void readResponseHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException { """ Reads the response headers from the given {@link HttpConnection connection}. <p> Subclasses may want to override this method to to customize the processing. </p> <p> "It must be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma." - HTTP/1.0 (4.3) </p> @param state the {@link HttpState state} information associated with this method @param conn the {@link HttpConnection connection} used to execute this HTTP method @throws IOException if an I/O (transport) error occurs. Some transport exceptions can be recovered from. @throws HttpException if a protocol exception occurs. Usually protocol exceptions cannot be recovered from. @see #readResponse @see #processResponseHeaders """ LOG.trace("enter HttpMethodBase.readResponseHeaders(HttpState," + "HttpConnection)"); getResponseHeaderGroup().clear(); Header[] headers = HttpParser.parseHeaders( conn.getResponseInputStream(), getParams().getHttpElementCharset()); // Wire logging moved to HttpParser getResponseHeaderGroup().setHeaders(headers); }
java
protected void readResponseHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException { LOG.trace("enter HttpMethodBase.readResponseHeaders(HttpState," + "HttpConnection)"); getResponseHeaderGroup().clear(); Header[] headers = HttpParser.parseHeaders( conn.getResponseInputStream(), getParams().getHttpElementCharset()); // Wire logging moved to HttpParser getResponseHeaderGroup().setHeaders(headers); }
[ "protected", "void", "readResponseHeaders", "(", "HttpState", "state", ",", "HttpConnection", "conn", ")", "throws", "IOException", ",", "HttpException", "{", "LOG", ".", "trace", "(", "\"enter HttpMethodBase.readResponseHeaders(HttpState,\"", "+", "\"HttpConnection)\"", ")", ";", "getResponseHeaderGroup", "(", ")", ".", "clear", "(", ")", ";", "Header", "[", "]", "headers", "=", "HttpParser", ".", "parseHeaders", "(", "conn", ".", "getResponseInputStream", "(", ")", ",", "getParams", "(", ")", ".", "getHttpElementCharset", "(", ")", ")", ";", "// Wire logging moved to HttpParser", "getResponseHeaderGroup", "(", ")", ".", "setHeaders", "(", "headers", ")", ";", "}" ]
Reads the response headers from the given {@link HttpConnection connection}. <p> Subclasses may want to override this method to to customize the processing. </p> <p> "It must be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma." - HTTP/1.0 (4.3) </p> @param state the {@link HttpState state} information associated with this method @param conn the {@link HttpConnection connection} used to execute this HTTP method @throws IOException if an I/O (transport) error occurs. Some transport exceptions can be recovered from. @throws HttpException if a protocol exception occurs. Usually protocol exceptions cannot be recovered from. @see #readResponse @see #processResponseHeaders
[ "Reads", "the", "response", "headers", "from", "the", "given", "{", "@link", "HttpConnection", "connection", "}", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/apache/commons/httpclient/HttpMethodBase.java#L2063-L2074
HiddenStage/divide
Shared/src/main/java/io/divide/shared/transitory/TransientObject.java
TransientObject.put
public void put(String key, Object object, boolean serialize) { """ Add a specific key value pair to this object. @param key key to identify this element by. @param object object to be added. @param serialize whether to manually serialize this object and store it as a json blob. """ if(serialize) put(key,gson.toJson(object)); else put(key,object); }
java
public void put(String key, Object object, boolean serialize){ if(serialize) put(key,gson.toJson(object)); else put(key,object); }
[ "public", "void", "put", "(", "String", "key", ",", "Object", "object", ",", "boolean", "serialize", ")", "{", "if", "(", "serialize", ")", "put", "(", "key", ",", "gson", ".", "toJson", "(", "object", ")", ")", ";", "else", "put", "(", "key", ",", "object", ")", ";", "}" ]
Add a specific key value pair to this object. @param key key to identify this element by. @param object object to be added. @param serialize whether to manually serialize this object and store it as a json blob.
[ "Add", "a", "specific", "key", "value", "pair", "to", "this", "object", "." ]
train
https://github.com/HiddenStage/divide/blob/14e36598c50d92b4393e6649915e32b86141c598/Shared/src/main/java/io/divide/shared/transitory/TransientObject.java#L167-L172
burberius/eve-esi
src/main/java/net/troja/eve/esi/api/AllianceApi.java
AllianceApi.getAlliancesAllianceId
public AllianceResponse getAlliancesAllianceId(Integer allianceId, String datasource, String ifNoneMatch) throws ApiException { """ Get alliance information Public information about an alliance --- This route is cached for up to 3600 seconds @param allianceId An EVE alliance ID (required) @param datasource The server name you would like data from (optional, default to tranquility) @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional) @return AllianceResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<AllianceResponse> resp = getAlliancesAllianceIdWithHttpInfo(allianceId, datasource, ifNoneMatch); return resp.getData(); }
java
public AllianceResponse getAlliancesAllianceId(Integer allianceId, String datasource, String ifNoneMatch) throws ApiException { ApiResponse<AllianceResponse> resp = getAlliancesAllianceIdWithHttpInfo(allianceId, datasource, ifNoneMatch); return resp.getData(); }
[ "public", "AllianceResponse", "getAlliancesAllianceId", "(", "Integer", "allianceId", ",", "String", "datasource", ",", "String", "ifNoneMatch", ")", "throws", "ApiException", "{", "ApiResponse", "<", "AllianceResponse", ">", "resp", "=", "getAlliancesAllianceIdWithHttpInfo", "(", "allianceId", ",", "datasource", ",", "ifNoneMatch", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Get alliance information Public information about an alliance --- This route is cached for up to 3600 seconds @param allianceId An EVE alliance ID (required) @param datasource The server name you would like data from (optional, default to tranquility) @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional) @return AllianceResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "alliance", "information", "Public", "information", "about", "an", "alliance", "---", "This", "route", "is", "cached", "for", "up", "to", "3600", "seconds" ]
train
https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/AllianceApi.java#L271-L275
yidongnan/grpc-spring-boot-starter
grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/util/GrpcUtils.java
GrpcUtils.extractMethodName
public static String extractMethodName(final MethodDescriptor<?, ?> method) { """ Extracts the method name from the given method. @param method The method to get the method name from. @return The extracted method name. @see #extractServiceName(MethodDescriptor) """ // This method is the equivalent of MethodDescriptor.extractFullServiceName final String fullMethodName = method.getFullMethodName(); final int index = fullMethodName.lastIndexOf('/'); if (index == -1) { return fullMethodName; } return fullMethodName.substring(index + 1); }
java
public static String extractMethodName(final MethodDescriptor<?, ?> method) { // This method is the equivalent of MethodDescriptor.extractFullServiceName final String fullMethodName = method.getFullMethodName(); final int index = fullMethodName.lastIndexOf('/'); if (index == -1) { return fullMethodName; } return fullMethodName.substring(index + 1); }
[ "public", "static", "String", "extractMethodName", "(", "final", "MethodDescriptor", "<", "?", ",", "?", ">", "method", ")", "{", "// This method is the equivalent of MethodDescriptor.extractFullServiceName", "final", "String", "fullMethodName", "=", "method", ".", "getFullMethodName", "(", ")", ";", "final", "int", "index", "=", "fullMethodName", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "return", "fullMethodName", ";", "}", "return", "fullMethodName", ".", "substring", "(", "index", "+", "1", ")", ";", "}" ]
Extracts the method name from the given method. @param method The method to get the method name from. @return The extracted method name. @see #extractServiceName(MethodDescriptor)
[ "Extracts", "the", "method", "name", "from", "the", "given", "method", "." ]
train
https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/util/GrpcUtils.java#L48-L56
bbossgroups/bboss-elasticsearch
bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ConfigRestClientUtil.java
ConfigRestClientUtil.addDocuments
public String addDocuments(String indexName, String indexType,String addTemplate, List<?> beans,String refreshOption) throws ElasticSearchException { """ 批量创建索引 @param indexName @param indexType @param addTemplate @param beans @param refreshOption refresh=wait_for refresh=false refresh=true refresh Empty string or true Refresh the relevant primary and replica shards (not the whole index) immediately after the operation occurs, so that the updated document appears in search results immediately. This should ONLY be done after careful thought and verification that it does not lead to poor performance, both from an indexing and a search standpoint. wait_for Wait for the changes made by the request to be made visible by a refresh before replying. This doesn’t force an immediate refresh, rather, it waits for a refresh to happen. Elasticsearch automatically refreshes shards that have changed every index.refresh_interval which defaults to one second. That setting is dynamic. Calling the Refresh API or setting refresh to true on any of the APIs that support it will also cause a refresh, in turn causing already running requests with refresh=wait_for to return. false (the default) Take no refresh related actions. The changes made by this request will be made visible at some point after the request returns. @return @throws ElasticSearchException """ StringBuilder builder = new StringBuilder(); for(Object bean:beans) { ESTemplateHelper.evalBuilkTemplate(esUtil,builder,indexName,indexType,addTemplate,bean,"index",this.client.isUpper7()); } if(refreshOption == null) return this.client.executeHttp("_bulk",builder.toString(),ClientUtil.HTTP_POST); else return this.client.executeHttp("_bulk?"+refreshOption,builder.toString(),ClientUtil.HTTP_POST); }
java
public String addDocuments(String indexName, String indexType,String addTemplate, List<?> beans,String refreshOption) throws ElasticSearchException{ StringBuilder builder = new StringBuilder(); for(Object bean:beans) { ESTemplateHelper.evalBuilkTemplate(esUtil,builder,indexName,indexType,addTemplate,bean,"index",this.client.isUpper7()); } if(refreshOption == null) return this.client.executeHttp("_bulk",builder.toString(),ClientUtil.HTTP_POST); else return this.client.executeHttp("_bulk?"+refreshOption,builder.toString(),ClientUtil.HTTP_POST); }
[ "public", "String", "addDocuments", "(", "String", "indexName", ",", "String", "indexType", ",", "String", "addTemplate", ",", "List", "<", "?", ">", "beans", ",", "String", "refreshOption", ")", "throws", "ElasticSearchException", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Object", "bean", ":", "beans", ")", "{", "ESTemplateHelper", ".", "evalBuilkTemplate", "(", "esUtil", ",", "builder", ",", "indexName", ",", "indexType", ",", "addTemplate", ",", "bean", ",", "\"index\"", ",", "this", ".", "client", ".", "isUpper7", "(", ")", ")", ";", "}", "if", "(", "refreshOption", "==", "null", ")", "return", "this", ".", "client", ".", "executeHttp", "(", "\"_bulk\"", ",", "builder", ".", "toString", "(", ")", ",", "ClientUtil", ".", "HTTP_POST", ")", ";", "else", "return", "this", ".", "client", ".", "executeHttp", "(", "\"_bulk?\"", "+", "refreshOption", ",", "builder", ".", "toString", "(", ")", ",", "ClientUtil", ".", "HTTP_POST", ")", ";", "}" ]
批量创建索引 @param indexName @param indexType @param addTemplate @param beans @param refreshOption refresh=wait_for refresh=false refresh=true refresh Empty string or true Refresh the relevant primary and replica shards (not the whole index) immediately after the operation occurs, so that the updated document appears in search results immediately. This should ONLY be done after careful thought and verification that it does not lead to poor performance, both from an indexing and a search standpoint. wait_for Wait for the changes made by the request to be made visible by a refresh before replying. This doesn’t force an immediate refresh, rather, it waits for a refresh to happen. Elasticsearch automatically refreshes shards that have changed every index.refresh_interval which defaults to one second. That setting is dynamic. Calling the Refresh API or setting refresh to true on any of the APIs that support it will also cause a refresh, in turn causing already running requests with refresh=wait_for to return. false (the default) Take no refresh related actions. The changes made by this request will be made visible at some point after the request returns. @return @throws ElasticSearchException
[ "批量创建索引" ]
train
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ConfigRestClientUtil.java#L116-L125
codegist/crest
core/src/main/java/org/codegist/crest/CRestBuilder.java
CRestBuilder.bindDeserializer
public CRestBuilder bindDeserializer(Class<? extends Deserializer> deserializer, Class<?>[] classes, Map<String, Object> config) { """ <p>Binds a deserializer to a list of interface method's return types.</p> <p>By default, <b>CRest</b> handle the following types:</p> <ul> <li>all primitives and wrapper types</li> <li>java.io.InputStream</li> <li>java.io.Reader</li> </ul> <p>Meaning that any interface method return type can be by default one of these types.</p> @param deserializer Deserializer class to use for the given interface method's return types @param classes Interface method's return types to bind deserializer to @param config State that will be passed to the deserializer along with the CRestConfig object if the deserializer has declared a single argument constructor with CRestConfig parameter type @return current builder @see org.codegist.crest.CRestConfig """ this.classDeserializerBuilder.register(deserializer, classes, config); return this; }
java
public CRestBuilder bindDeserializer(Class<? extends Deserializer> deserializer, Class<?>[] classes, Map<String, Object> config) { this.classDeserializerBuilder.register(deserializer, classes, config); return this; }
[ "public", "CRestBuilder", "bindDeserializer", "(", "Class", "<", "?", "extends", "Deserializer", ">", "deserializer", ",", "Class", "<", "?", ">", "[", "]", "classes", ",", "Map", "<", "String", ",", "Object", ">", "config", ")", "{", "this", ".", "classDeserializerBuilder", ".", "register", "(", "deserializer", ",", "classes", ",", "config", ")", ";", "return", "this", ";", "}" ]
<p>Binds a deserializer to a list of interface method's return types.</p> <p>By default, <b>CRest</b> handle the following types:</p> <ul> <li>all primitives and wrapper types</li> <li>java.io.InputStream</li> <li>java.io.Reader</li> </ul> <p>Meaning that any interface method return type can be by default one of these types.</p> @param deserializer Deserializer class to use for the given interface method's return types @param classes Interface method's return types to bind deserializer to @param config State that will be passed to the deserializer along with the CRestConfig object if the deserializer has declared a single argument constructor with CRestConfig parameter type @return current builder @see org.codegist.crest.CRestConfig
[ "<p", ">", "Binds", "a", "deserializer", "to", "a", "list", "of", "interface", "method", "s", "return", "types", ".", "<", "/", "p", ">", "<p", ">", "By", "default", "<b", ">", "CRest<", "/", "b", ">", "handle", "the", "following", "types", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "all", "primitives", "and", "wrapper", "types<", "/", "li", ">", "<li", ">", "java", ".", "io", ".", "InputStream<", "/", "li", ">", "<li", ">", "java", ".", "io", ".", "Reader<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "Meaning", "that", "any", "interface", "method", "return", "type", "can", "be", "by", "default", "one", "of", "these", "types", ".", "<", "/", "p", ">" ]
train
https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRestBuilder.java#L565-L568
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/SessionApi.java
SessionApi.initializeWorkspaceAsync
public com.squareup.okhttp.Call initializeWorkspaceAsync(String code, String redirectUri, String state, String authorization, final ApiCallback<ApiSuccessResponse> callback) throws ApiException { """ Get and register an auth token (asynchronously) Retrieve the authorization token using the authorization code. Workspace then registers the token and prepares the user&#39;s environment. @param code The authorization code. You must include this parameter for the [Authorization Code Grant flow](/reference/authentication/). (optional) @param redirectUri The same redirect URI you used in the initial login step. You must include this parameter for the [Authorization Code Grant flow](/reference/authentication/). (optional) @param state The state parameter provide by the auth service on redirect that should be used to validate. This parameter must be provided if the include_state parameter is sent with the /login request. (optional) @param authorization Bearer authorization. For example, \&quot;Authorization&amp;colon; Bearer access_token\&quot;. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object """ ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = initializeWorkspaceValidateBeforeCall(code, redirectUri, state, authorization, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call initializeWorkspaceAsync(String code, String redirectUri, String state, String authorization, final ApiCallback<ApiSuccessResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = initializeWorkspaceValidateBeforeCall(code, redirectUri, state, authorization, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "initializeWorkspaceAsync", "(", "String", "code", ",", "String", "redirectUri", ",", "String", "state", ",", "String", "authorization", ",", "final", "ApiCallback", "<", "ApiSuccessResponse", ">", "callback", ")", "throws", "ApiException", "{", "ProgressResponseBody", ".", "ProgressListener", "progressListener", "=", "null", ";", "ProgressRequestBody", ".", "ProgressRequestListener", "progressRequestListener", "=", "null", ";", "if", "(", "callback", "!=", "null", ")", "{", "progressListener", "=", "new", "ProgressResponseBody", ".", "ProgressListener", "(", ")", "{", "@", "Override", "public", "void", "update", "(", "long", "bytesRead", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onDownloadProgress", "(", "bytesRead", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "progressRequestListener", "=", "new", "ProgressRequestBody", ".", "ProgressRequestListener", "(", ")", "{", "@", "Override", "public", "void", "onRequestProgress", "(", "long", "bytesWritten", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onUploadProgress", "(", "bytesWritten", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "}", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "initializeWorkspaceValidateBeforeCall", "(", "code", ",", "redirectUri", ",", "state", ",", "authorization", ",", "progressListener", ",", "progressRequestListener", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "ApiSuccessResponse", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "apiClient", ".", "executeAsync", "(", "call", ",", "localVarReturnType", ",", "callback", ")", ";", "return", "call", ";", "}" ]
Get and register an auth token (asynchronously) Retrieve the authorization token using the authorization code. Workspace then registers the token and prepares the user&#39;s environment. @param code The authorization code. You must include this parameter for the [Authorization Code Grant flow](/reference/authentication/). (optional) @param redirectUri The same redirect URI you used in the initial login step. You must include this parameter for the [Authorization Code Grant flow](/reference/authentication/). (optional) @param state The state parameter provide by the auth service on redirect that should be used to validate. This parameter must be provided if the include_state parameter is sent with the /login request. (optional) @param authorization Bearer authorization. For example, \&quot;Authorization&amp;colon; Bearer access_token\&quot;. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "Get", "and", "register", "an", "auth", "token", "(", "asynchronously", ")", "Retrieve", "the", "authorization", "token", "using", "the", "authorization", "code", ".", "Workspace", "then", "registers", "the", "token", "and", "prepares", "the", "user&#39", ";", "s", "environment", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/SessionApi.java#L1129-L1154
kiegroup/jbpm
jbpm-flow-builder/src/main/java/org/jbpm/compiler/xml/processes/RuleFlowMigrator.java
RuleFlowMigrator.portToCurrentVersion
private static String portToCurrentVersion(String xml, String xsl) throws Exception { """ *********************************************************************** Utility method that applies a given xsl transform to the given xml to transform a drools 4 ruleflow to version 5. @param xml the ruleflow to be transformed @param xsl the xsl transform to apply to the ruleflow xml @return the ruleflow xml transformed from version 4 to 5 using the given xsl transformation @throws Exception ********************************************************************** """ // convert it. String version5XML = XSLTransformation.transform(xsl, xml, null); // Add the namespace attribute to the process element as it is not added by the XSL transformation. version5XML = version5XML.replaceAll( "<process ", PROCESS_ELEMENT_WITH_NAMESPACE ); return version5XML; }
java
private static String portToCurrentVersion(String xml, String xsl) throws Exception { // convert it. String version5XML = XSLTransformation.transform(xsl, xml, null); // Add the namespace attribute to the process element as it is not added by the XSL transformation. version5XML = version5XML.replaceAll( "<process ", PROCESS_ELEMENT_WITH_NAMESPACE ); return version5XML; }
[ "private", "static", "String", "portToCurrentVersion", "(", "String", "xml", ",", "String", "xsl", ")", "throws", "Exception", "{", "// convert it.", "String", "version5XML", "=", "XSLTransformation", ".", "transform", "(", "xsl", ",", "xml", ",", "null", ")", ";", "// Add the namespace attribute to the process element as it is not added by the XSL transformation.", "version5XML", "=", "version5XML", ".", "replaceAll", "(", "\"<process \"", ",", "PROCESS_ELEMENT_WITH_NAMESPACE", ")", ";", "return", "version5XML", ";", "}" ]
*********************************************************************** Utility method that applies a given xsl transform to the given xml to transform a drools 4 ruleflow to version 5. @param xml the ruleflow to be transformed @param xsl the xsl transform to apply to the ruleflow xml @return the ruleflow xml transformed from version 4 to 5 using the given xsl transformation @throws Exception **********************************************************************
[ "***********************************************************************", "Utility", "method", "that", "applies", "a", "given", "xsl", "transform", "to", "the", "given", "xml", "to", "transform", "a", "drools", "4", "ruleflow", "to", "version", "5", "." ]
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-flow-builder/src/main/java/org/jbpm/compiler/xml/processes/RuleFlowMigrator.java#L142-L149
axibase/atsd-api-java
src/main/java/com/axibase/tsd/client/MetaDataService.java
MetaDataService.retrieveMetricSeries
public List<Series> retrieveMetricSeries(String metricName) { """ Retrieve series list of the specified metric @param metricName metric name @return list of series """ return retrieveMetricSeries(metricName, Collections.<String, String>emptyMap()); }
java
public List<Series> retrieveMetricSeries(String metricName) { return retrieveMetricSeries(metricName, Collections.<String, String>emptyMap()); }
[ "public", "List", "<", "Series", ">", "retrieveMetricSeries", "(", "String", "metricName", ")", "{", "return", "retrieveMetricSeries", "(", "metricName", ",", "Collections", ".", "<", "String", ",", "String", ">", "emptyMap", "(", ")", ")", ";", "}" ]
Retrieve series list of the specified metric @param metricName metric name @return list of series
[ "Retrieve", "series", "list", "of", "the", "specified", "metric" ]
train
https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/MetaDataService.java#L585-L587
FasterXML/woodstox
src/main/java/com/ctc/wstx/sr/StreamScanner.java
StreamScanner.throwParseError
@Override public void throwParseError(String format, Object arg, Object arg2) throws XMLStreamException { """ Throws generic parse error with specified message and current parsing location. <p> Note: public access only because core code in other packages needs to access it. """ String msg = (arg != null || arg2 != null) ? MessageFormat.format(format, new Object[] { arg, arg2 }) : format; throw constructWfcException(msg); }
java
@Override public void throwParseError(String format, Object arg, Object arg2) throws XMLStreamException { String msg = (arg != null || arg2 != null) ? MessageFormat.format(format, new Object[] { arg, arg2 }) : format; throw constructWfcException(msg); }
[ "@", "Override", "public", "void", "throwParseError", "(", "String", "format", ",", "Object", "arg", ",", "Object", "arg2", ")", "throws", "XMLStreamException", "{", "String", "msg", "=", "(", "arg", "!=", "null", "||", "arg2", "!=", "null", ")", "?", "MessageFormat", ".", "format", "(", "format", ",", "new", "Object", "[", "]", "{", "arg", ",", "arg2", "}", ")", ":", "format", ";", "throw", "constructWfcException", "(", "msg", ")", ";", "}" ]
Throws generic parse error with specified message and current parsing location. <p> Note: public access only because core code in other packages needs to access it.
[ "Throws", "generic", "parse", "error", "with", "specified", "message", "and", "current", "parsing", "location", ".", "<p", ">", "Note", ":", "public", "access", "only", "because", "core", "code", "in", "other", "packages", "needs", "to", "access", "it", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/StreamScanner.java#L498-L505
jenkinsci/jenkins
core/src/main/java/hudson/model/Descriptor.java
Descriptor.newInstancesFromHeteroList
public static <T extends Describable<T>> List<T> newInstancesFromHeteroList(StaplerRequest req, JSONObject formData, String key, Collection<? extends Descriptor<T>> descriptors) throws FormException { """ Used to build {@link Describable} instance list from {@code <f:hetero-list>} tag. @param req Request that represents the form submission. @param formData Structured form data that represents the contains data for the list of describables. @param key The JSON property name for 'formData' that represents the data for the list of describables. @param descriptors List of descriptors to create instances from. @return Can be empty but never null. """ return newInstancesFromHeteroList(req,formData.get(key),descriptors); }
java
public static <T extends Describable<T>> List<T> newInstancesFromHeteroList(StaplerRequest req, JSONObject formData, String key, Collection<? extends Descriptor<T>> descriptors) throws FormException { return newInstancesFromHeteroList(req,formData.get(key),descriptors); }
[ "public", "static", "<", "T", "extends", "Describable", "<", "T", ">", ">", "List", "<", "T", ">", "newInstancesFromHeteroList", "(", "StaplerRequest", "req", ",", "JSONObject", "formData", ",", "String", "key", ",", "Collection", "<", "?", "extends", "Descriptor", "<", "T", ">", ">", "descriptors", ")", "throws", "FormException", "{", "return", "newInstancesFromHeteroList", "(", "req", ",", "formData", ".", "get", "(", "key", ")", ",", "descriptors", ")", ";", "}" ]
Used to build {@link Describable} instance list from {@code <f:hetero-list>} tag. @param req Request that represents the form submission. @param formData Structured form data that represents the contains data for the list of describables. @param key The JSON property name for 'formData' that represents the data for the list of describables. @param descriptors List of descriptors to create instances from. @return Can be empty but never null.
[ "Used", "to", "build", "{", "@link", "Describable", "}", "instance", "list", "from", "{", "@code", "<f", ":", "hetero", "-", "list", ">", "}", "tag", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Descriptor.java#L1017-L1022
alkacon/opencms-core
src/org/opencms/xml/types/CmsXmlVfsImageValue.java
CmsXmlVfsImageValue.setFormat
public void setFormat(CmsObject cms, String format) { """ Sets the format information of the image.<p> @param cms the current users contexts @param format the format information of the image """ if (CmsStringUtil.isEmptyOrWhitespaceOnly(format)) { m_format = ""; if (m_element.element(PARAM_FORMAT) != null) { m_element.remove(m_element.element(PARAM_FORMAT)); } } else { m_format = format; } setParameterValue(cms, PARAM_FORMAT, format); }
java
public void setFormat(CmsObject cms, String format) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(format)) { m_format = ""; if (m_element.element(PARAM_FORMAT) != null) { m_element.remove(m_element.element(PARAM_FORMAT)); } } else { m_format = format; } setParameterValue(cms, PARAM_FORMAT, format); }
[ "public", "void", "setFormat", "(", "CmsObject", "cms", ",", "String", "format", ")", "{", "if", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "format", ")", ")", "{", "m_format", "=", "\"\"", ";", "if", "(", "m_element", ".", "element", "(", "PARAM_FORMAT", ")", "!=", "null", ")", "{", "m_element", ".", "remove", "(", "m_element", ".", "element", "(", "PARAM_FORMAT", ")", ")", ";", "}", "}", "else", "{", "m_format", "=", "format", ";", "}", "setParameterValue", "(", "cms", ",", "PARAM_FORMAT", ",", "format", ")", ";", "}" ]
Sets the format information of the image.<p> @param cms the current users contexts @param format the format information of the image
[ "Sets", "the", "format", "information", "of", "the", "image", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/types/CmsXmlVfsImageValue.java#L248-L259
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/ui/CmsDroppedElementModeSelectionDialog.java
CmsDroppedElementModeSelectionDialog.showDialog
public static void showDialog(final CmsUUID referenceId, final AsyncCallback<String> createModeCallback) { """ Shows the dialog.<p> @param referenceId the structure id of the resource for which to load the dialog @param createModeCallback the callback to call with the result """ CmsRpcAction<CmsListInfoBean> action = new CmsRpcAction<CmsListInfoBean>() { @Override public void execute() { start(0, true); CmsCoreProvider.getVfsService().getPageInfo(referenceId, this); } @Override protected void onResponse(CmsListInfoBean result) { stop(false); (new CmsDroppedElementModeSelectionDialog(result, createModeCallback)).center(); } }; action.execute(); }
java
public static void showDialog(final CmsUUID referenceId, final AsyncCallback<String> createModeCallback) { CmsRpcAction<CmsListInfoBean> action = new CmsRpcAction<CmsListInfoBean>() { @Override public void execute() { start(0, true); CmsCoreProvider.getVfsService().getPageInfo(referenceId, this); } @Override protected void onResponse(CmsListInfoBean result) { stop(false); (new CmsDroppedElementModeSelectionDialog(result, createModeCallback)).center(); } }; action.execute(); }
[ "public", "static", "void", "showDialog", "(", "final", "CmsUUID", "referenceId", ",", "final", "AsyncCallback", "<", "String", ">", "createModeCallback", ")", "{", "CmsRpcAction", "<", "CmsListInfoBean", ">", "action", "=", "new", "CmsRpcAction", "<", "CmsListInfoBean", ">", "(", ")", "{", "@", "Override", "public", "void", "execute", "(", ")", "{", "start", "(", "0", ",", "true", ")", ";", "CmsCoreProvider", ".", "getVfsService", "(", ")", ".", "getPageInfo", "(", "referenceId", ",", "this", ")", ";", "}", "@", "Override", "protected", "void", "onResponse", "(", "CmsListInfoBean", "result", ")", "{", "stop", "(", "false", ")", ";", "(", "new", "CmsDroppedElementModeSelectionDialog", "(", "result", ",", "createModeCallback", ")", ")", ".", "center", "(", ")", ";", "}", "}", ";", "action", ".", "execute", "(", ")", ";", "}" ]
Shows the dialog.<p> @param referenceId the structure id of the resource for which to load the dialog @param createModeCallback the callback to call with the result
[ "Shows", "the", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/ui/CmsDroppedElementModeSelectionDialog.java#L64-L85
QSFT/Doradus
doradus-common/src/main/java/com/dell/doradus/common/JSONEmitter.java
JSONEmitter.addObject
public JSONEmitter addObject(String name, String value) { """ Add a one-field object consisting of the given name and string value. This generates the JSON text: <pre> {"name":"value"} </pre> @param name Name of new field. @param value Value of new field as a string. @return The same JSONEmitter object, which allows call chaining. """ checkComma(); write("{\""); write(encodeString(name)); write("\":\""); if (value != null) { write(encodeString(value)); } write("\"}"); return this; }
java
public JSONEmitter addObject(String name, String value) { checkComma(); write("{\""); write(encodeString(name)); write("\":\""); if (value != null) { write(encodeString(value)); } write("\"}"); return this; }
[ "public", "JSONEmitter", "addObject", "(", "String", "name", ",", "String", "value", ")", "{", "checkComma", "(", ")", ";", "write", "(", "\"{\\\"\"", ")", ";", "write", "(", "encodeString", "(", "name", ")", ")", ";", "write", "(", "\"\\\":\\\"\"", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "write", "(", "encodeString", "(", "value", ")", ")", ";", "}", "write", "(", "\"\\\"}\"", ")", ";", "return", "this", ";", "}" ]
Add a one-field object consisting of the given name and string value. This generates the JSON text: <pre> {"name":"value"} </pre> @param name Name of new field. @param value Value of new field as a string. @return The same JSONEmitter object, which allows call chaining.
[ "Add", "a", "one", "-", "field", "object", "consisting", "of", "the", "given", "name", "and", "string", "value", ".", "This", "generates", "the", "JSON", "text", ":", "<pre", ">", "{", "name", ":", "value", "}", "<", "/", "pre", ">" ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/JSONEmitter.java#L211-L221
cuba-platform/yarg
core/modules/core/src/com/haulmont/yarg/util/db/DbUtils.java
DbUtils.printStackTrace
public static void printStackTrace(SQLException e, PrintWriter pw) { """ Print the stack trace for a SQLException to a specified PrintWriter. @param e SQLException to print stack trace of @param pw PrintWriter to print to """ SQLException next = e; while (next != null) { next.printStackTrace(pw); next = next.getNextException(); if (next != null) { pw.println("Next SQLException:"); } } }
java
public static void printStackTrace(SQLException e, PrintWriter pw) { SQLException next = e; while (next != null) { next.printStackTrace(pw); next = next.getNextException(); if (next != null) { pw.println("Next SQLException:"); } } }
[ "public", "static", "void", "printStackTrace", "(", "SQLException", "e", ",", "PrintWriter", "pw", ")", "{", "SQLException", "next", "=", "e", ";", "while", "(", "next", "!=", "null", ")", "{", "next", ".", "printStackTrace", "(", "pw", ")", ";", "next", "=", "next", ".", "getNextException", "(", ")", ";", "if", "(", "next", "!=", "null", ")", "{", "pw", ".", "println", "(", "\"Next SQLException:\"", ")", ";", "}", "}", "}" ]
Print the stack trace for a SQLException to a specified PrintWriter. @param e SQLException to print stack trace of @param pw PrintWriter to print to
[ "Print", "the", "stack", "trace", "for", "a", "SQLException", "to", "a", "specified", "PrintWriter", "." ]
train
https://github.com/cuba-platform/yarg/blob/d157286cbe29448f3e1f445e8c5dd88808351da0/core/modules/core/src/com/haulmont/yarg/util/db/DbUtils.java#L207-L217
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyDecoder.java
KeyDecoder.decodeByteDesc
public static byte decodeByteDesc(byte[] src, int srcOffset) throws CorruptEncodingException { """ Decodes a signed byte from exactly 1 byte, as encoded for descending order. @param src source of encoded bytes @param srcOffset offset into source array @return signed byte value """ try { return (byte)(src[srcOffset] ^ 0x7f); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static byte decodeByteDesc(byte[] src, int srcOffset) throws CorruptEncodingException { try { return (byte)(src[srcOffset] ^ 0x7f); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "byte", "decodeByteDesc", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "return", "(", "byte", ")", "(", "src", "[", "srcOffset", "]", "^", "0x7f", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a signed byte from exactly 1 byte, as encoded for descending order. @param src source of encoded bytes @param srcOffset offset into source array @return signed byte value
[ "Decodes", "a", "signed", "byte", "from", "exactly", "1", "byte", "as", "encoded", "for", "descending", "order", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyDecoder.java#L116-L124
google/closure-compiler
src/com/google/javascript/jscomp/Es6TemplateLiterals.java
Es6TemplateLiterals.visitTaggedTemplateLiteral
static void visitTaggedTemplateLiteral(NodeTraversal t, Node n, boolean addTypes) { """ Converts tag`a\tb${bar}` to: // A global (module) scoped variable var $jscomp$templatelit$0 = ["a\tb"]; // cooked string array $jscomp$templatelit$0.raw = ["a\\tb"]; // raw string array ... // A call to the tagging function tag($jscomp$templatelit$0, bar); See template_literal_test.js for more examples. @param n A TAGGED_TEMPLATELIT node """ AstFactory astFactory = t.getCompiler().createAstFactory(); JSTypeRegistry registry = t.getCompiler().getTypeRegistry(); JSType stringType = createType(addTypes, registry, JSTypeNative.STRING_TYPE); JSType arrayType = createGenericType(addTypes, registry, JSTypeNative.ARRAY_TYPE, stringType); JSType templateArrayType = createType(addTypes, registry, JSTypeNative.I_TEMPLATE_ARRAY_TYPE); JSType voidType = createType(addTypes, registry, JSTypeNative.VOID_TYPE); JSType numberType = createType(addTypes, registry, JSTypeNative.NUMBER_TYPE); Node templateLit = n.getLastChild(); Node cooked = createCookedStringArray(templateLit, templateArrayType, stringType, voidType, numberType); // Specify the type of the first argument to be ITemplateArray. JSTypeExpression nonNullSiteObject = new JSTypeExpression( JsDocInfoParser.parseTypeString("!ITemplateArray"), "<Es6TemplateLiterals.java>"); JSDocInfoBuilder info = new JSDocInfoBuilder(false); info.recordType(nonNullSiteObject); Node siteObject = withType(IR.cast(cooked, info.build()), templateArrayType); // Create a variable representing the template literal. Node callsiteId = withType( IR.name(TEMPLATELIT_VAR + t.getCompiler().getUniqueNameIdSupplier().get()), templateArrayType); Node var = IR.var(callsiteId, siteObject).useSourceInfoIfMissingFromForTree(n); Node script = NodeUtil.getEnclosingScript(n); script.addChildToFront(var); t.reportCodeChange(var); // Define the "raw" property on the introduced variable. Node defineRaw; if (cookedAndRawStringsSame(templateLit)) { // The cooked and raw versions of the array are the same, so just call slice() on the // cooked array at runtime to make the raw array a copy of the cooked array. defineRaw = IR.exprResult( astFactory.createAssign( astFactory.createGetProp(callsiteId.cloneNode(), "raw"), astFactory.createCall( astFactory.createGetProp(callsiteId.cloneNode(), "slice")))) .useSourceInfoIfMissingFromForTree(n); } else { // The raw string array is different, so we need to construct it. Node raw = createRawStringArray(templateLit, arrayType, stringType); defineRaw = IR.exprResult( astFactory.createAssign( astFactory.createGetProp(callsiteId.cloneNode(), "raw"), raw)) .useSourceInfoIfMissingFromForTree(n); } script.addChildAfter(defineRaw, var); // Generate the call expression. Node call = withType(IR.call(n.removeFirstChild(), callsiteId.cloneNode()), n.getJSType()); for (Node child = templateLit.getFirstChild(); child != null; child = child.getNext()) { if (!child.isTemplateLitString()) { call.addChildToBack(child.removeFirstChild()); } } call.useSourceInfoIfMissingFromForTree(templateLit); call.putBooleanProp(Node.FREE_CALL, !call.getFirstChild().isGetProp()); n.replaceWith(call); t.reportCodeChange(); }
java
static void visitTaggedTemplateLiteral(NodeTraversal t, Node n, boolean addTypes) { AstFactory astFactory = t.getCompiler().createAstFactory(); JSTypeRegistry registry = t.getCompiler().getTypeRegistry(); JSType stringType = createType(addTypes, registry, JSTypeNative.STRING_TYPE); JSType arrayType = createGenericType(addTypes, registry, JSTypeNative.ARRAY_TYPE, stringType); JSType templateArrayType = createType(addTypes, registry, JSTypeNative.I_TEMPLATE_ARRAY_TYPE); JSType voidType = createType(addTypes, registry, JSTypeNative.VOID_TYPE); JSType numberType = createType(addTypes, registry, JSTypeNative.NUMBER_TYPE); Node templateLit = n.getLastChild(); Node cooked = createCookedStringArray(templateLit, templateArrayType, stringType, voidType, numberType); // Specify the type of the first argument to be ITemplateArray. JSTypeExpression nonNullSiteObject = new JSTypeExpression( JsDocInfoParser.parseTypeString("!ITemplateArray"), "<Es6TemplateLiterals.java>"); JSDocInfoBuilder info = new JSDocInfoBuilder(false); info.recordType(nonNullSiteObject); Node siteObject = withType(IR.cast(cooked, info.build()), templateArrayType); // Create a variable representing the template literal. Node callsiteId = withType( IR.name(TEMPLATELIT_VAR + t.getCompiler().getUniqueNameIdSupplier().get()), templateArrayType); Node var = IR.var(callsiteId, siteObject).useSourceInfoIfMissingFromForTree(n); Node script = NodeUtil.getEnclosingScript(n); script.addChildToFront(var); t.reportCodeChange(var); // Define the "raw" property on the introduced variable. Node defineRaw; if (cookedAndRawStringsSame(templateLit)) { // The cooked and raw versions of the array are the same, so just call slice() on the // cooked array at runtime to make the raw array a copy of the cooked array. defineRaw = IR.exprResult( astFactory.createAssign( astFactory.createGetProp(callsiteId.cloneNode(), "raw"), astFactory.createCall( astFactory.createGetProp(callsiteId.cloneNode(), "slice")))) .useSourceInfoIfMissingFromForTree(n); } else { // The raw string array is different, so we need to construct it. Node raw = createRawStringArray(templateLit, arrayType, stringType); defineRaw = IR.exprResult( astFactory.createAssign( astFactory.createGetProp(callsiteId.cloneNode(), "raw"), raw)) .useSourceInfoIfMissingFromForTree(n); } script.addChildAfter(defineRaw, var); // Generate the call expression. Node call = withType(IR.call(n.removeFirstChild(), callsiteId.cloneNode()), n.getJSType()); for (Node child = templateLit.getFirstChild(); child != null; child = child.getNext()) { if (!child.isTemplateLitString()) { call.addChildToBack(child.removeFirstChild()); } } call.useSourceInfoIfMissingFromForTree(templateLit); call.putBooleanProp(Node.FREE_CALL, !call.getFirstChild().isGetProp()); n.replaceWith(call); t.reportCodeChange(); }
[ "static", "void", "visitTaggedTemplateLiteral", "(", "NodeTraversal", "t", ",", "Node", "n", ",", "boolean", "addTypes", ")", "{", "AstFactory", "astFactory", "=", "t", ".", "getCompiler", "(", ")", ".", "createAstFactory", "(", ")", ";", "JSTypeRegistry", "registry", "=", "t", ".", "getCompiler", "(", ")", ".", "getTypeRegistry", "(", ")", ";", "JSType", "stringType", "=", "createType", "(", "addTypes", ",", "registry", ",", "JSTypeNative", ".", "STRING_TYPE", ")", ";", "JSType", "arrayType", "=", "createGenericType", "(", "addTypes", ",", "registry", ",", "JSTypeNative", ".", "ARRAY_TYPE", ",", "stringType", ")", ";", "JSType", "templateArrayType", "=", "createType", "(", "addTypes", ",", "registry", ",", "JSTypeNative", ".", "I_TEMPLATE_ARRAY_TYPE", ")", ";", "JSType", "voidType", "=", "createType", "(", "addTypes", ",", "registry", ",", "JSTypeNative", ".", "VOID_TYPE", ")", ";", "JSType", "numberType", "=", "createType", "(", "addTypes", ",", "registry", ",", "JSTypeNative", ".", "NUMBER_TYPE", ")", ";", "Node", "templateLit", "=", "n", ".", "getLastChild", "(", ")", ";", "Node", "cooked", "=", "createCookedStringArray", "(", "templateLit", ",", "templateArrayType", ",", "stringType", ",", "voidType", ",", "numberType", ")", ";", "// Specify the type of the first argument to be ITemplateArray.", "JSTypeExpression", "nonNullSiteObject", "=", "new", "JSTypeExpression", "(", "JsDocInfoParser", ".", "parseTypeString", "(", "\"!ITemplateArray\"", ")", ",", "\"<Es6TemplateLiterals.java>\"", ")", ";", "JSDocInfoBuilder", "info", "=", "new", "JSDocInfoBuilder", "(", "false", ")", ";", "info", ".", "recordType", "(", "nonNullSiteObject", ")", ";", "Node", "siteObject", "=", "withType", "(", "IR", ".", "cast", "(", "cooked", ",", "info", ".", "build", "(", ")", ")", ",", "templateArrayType", ")", ";", "// Create a variable representing the template literal.", "Node", "callsiteId", "=", "withType", "(", "IR", ".", "name", "(", "TEMPLATELIT_VAR", "+", "t", ".", "getCompiler", "(", ")", ".", "getUniqueNameIdSupplier", "(", ")", ".", "get", "(", ")", ")", ",", "templateArrayType", ")", ";", "Node", "var", "=", "IR", ".", "var", "(", "callsiteId", ",", "siteObject", ")", ".", "useSourceInfoIfMissingFromForTree", "(", "n", ")", ";", "Node", "script", "=", "NodeUtil", ".", "getEnclosingScript", "(", "n", ")", ";", "script", ".", "addChildToFront", "(", "var", ")", ";", "t", ".", "reportCodeChange", "(", "var", ")", ";", "// Define the \"raw\" property on the introduced variable.", "Node", "defineRaw", ";", "if", "(", "cookedAndRawStringsSame", "(", "templateLit", ")", ")", "{", "// The cooked and raw versions of the array are the same, so just call slice() on the", "// cooked array at runtime to make the raw array a copy of the cooked array.", "defineRaw", "=", "IR", ".", "exprResult", "(", "astFactory", ".", "createAssign", "(", "astFactory", ".", "createGetProp", "(", "callsiteId", ".", "cloneNode", "(", ")", ",", "\"raw\"", ")", ",", "astFactory", ".", "createCall", "(", "astFactory", ".", "createGetProp", "(", "callsiteId", ".", "cloneNode", "(", ")", ",", "\"slice\"", ")", ")", ")", ")", ".", "useSourceInfoIfMissingFromForTree", "(", "n", ")", ";", "}", "else", "{", "// The raw string array is different, so we need to construct it.", "Node", "raw", "=", "createRawStringArray", "(", "templateLit", ",", "arrayType", ",", "stringType", ")", ";", "defineRaw", "=", "IR", ".", "exprResult", "(", "astFactory", ".", "createAssign", "(", "astFactory", ".", "createGetProp", "(", "callsiteId", ".", "cloneNode", "(", ")", ",", "\"raw\"", ")", ",", "raw", ")", ")", ".", "useSourceInfoIfMissingFromForTree", "(", "n", ")", ";", "}", "script", ".", "addChildAfter", "(", "defineRaw", ",", "var", ")", ";", "// Generate the call expression.", "Node", "call", "=", "withType", "(", "IR", ".", "call", "(", "n", ".", "removeFirstChild", "(", ")", ",", "callsiteId", ".", "cloneNode", "(", ")", ")", ",", "n", ".", "getJSType", "(", ")", ")", ";", "for", "(", "Node", "child", "=", "templateLit", ".", "getFirstChild", "(", ")", ";", "child", "!=", "null", ";", "child", "=", "child", ".", "getNext", "(", ")", ")", "{", "if", "(", "!", "child", ".", "isTemplateLitString", "(", ")", ")", "{", "call", ".", "addChildToBack", "(", "child", ".", "removeFirstChild", "(", ")", ")", ";", "}", "}", "call", ".", "useSourceInfoIfMissingFromForTree", "(", "templateLit", ")", ";", "call", ".", "putBooleanProp", "(", "Node", ".", "FREE_CALL", ",", "!", "call", ".", "getFirstChild", "(", ")", ".", "isGetProp", "(", ")", ")", ";", "n", ".", "replaceWith", "(", "call", ")", ";", "t", ".", "reportCodeChange", "(", ")", ";", "}" ]
Converts tag`a\tb${bar}` to: // A global (module) scoped variable var $jscomp$templatelit$0 = ["a\tb"]; // cooked string array $jscomp$templatelit$0.raw = ["a\\tb"]; // raw string array ... // A call to the tagging function tag($jscomp$templatelit$0, bar); See template_literal_test.js for more examples. @param n A TAGGED_TEMPLATELIT node
[ "Converts", "tag", "a", "\\", "tb$", "{", "bar", "}", "to", ":", "//", "A", "global", "(", "module", ")", "scoped", "variable", "var", "$jscomp$templatelit$0", "=", "[", "a", "\\", "tb", "]", ";", "//", "cooked", "string", "array", "$jscomp$templatelit$0", ".", "raw", "=", "[", "a", "\\\\", "tb", "]", ";", "//", "raw", "string", "array", "...", "//", "A", "call", "to", "the", "tagging", "function", "tag", "(", "$jscomp$templatelit$0", "bar", ")", ";" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6TemplateLiterals.java#L102-L168
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/LinkedPE.java
LinkedPE.enrichWithCM
protected void enrichWithCM(Set<BioPAXElement> seed, Set<BioPAXElement> all) { """ Gets parent complexes or complex members recursively according to the type of the linkage. @param seed elements to link @param all already found links """ Set addition = access(type == Type.TO_GENERAL ? complexAcc : memberAcc, seed, all); if (blacklist != null) addition = blacklist.getNonUbiqueObjects(addition); if (!addition.isEmpty()) { all.addAll(addition); enrichWithGenerics(addition, all); } }
java
protected void enrichWithCM(Set<BioPAXElement> seed, Set<BioPAXElement> all) { Set addition = access(type == Type.TO_GENERAL ? complexAcc : memberAcc, seed, all); if (blacklist != null) addition = blacklist.getNonUbiqueObjects(addition); if (!addition.isEmpty()) { all.addAll(addition); enrichWithGenerics(addition, all); } }
[ "protected", "void", "enrichWithCM", "(", "Set", "<", "BioPAXElement", ">", "seed", ",", "Set", "<", "BioPAXElement", ">", "all", ")", "{", "Set", "addition", "=", "access", "(", "type", "==", "Type", ".", "TO_GENERAL", "?", "complexAcc", ":", "memberAcc", ",", "seed", ",", "all", ")", ";", "if", "(", "blacklist", "!=", "null", ")", "addition", "=", "blacklist", ".", "getNonUbiqueObjects", "(", "addition", ")", ";", "if", "(", "!", "addition", ".", "isEmpty", "(", ")", ")", "{", "all", ".", "addAll", "(", "addition", ")", ";", "enrichWithGenerics", "(", "addition", ",", "all", ")", ";", "}", "}" ]
Gets parent complexes or complex members recursively according to the type of the linkage. @param seed elements to link @param all already found links
[ "Gets", "parent", "complexes", "or", "complex", "members", "recursively", "according", "to", "the", "type", "of", "the", "linkage", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/LinkedPE.java#L134-L145
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toDate
public static java.util.Date toDate(String dateTime) { """ Converts a date and time String into a Date @param dateTime A combined data and time string in the format "MM/DD/YYYY HH:MM:SS", the seconds are optional @return The corresponding Date """ // dateTime must have one space between the date and time... String date = dateTime.substring(0, dateTime.indexOf(" ")); String time = dateTime.substring(dateTime.indexOf(" ") + 1); return toDate(date, time); }
java
public static java.util.Date toDate(String dateTime) { // dateTime must have one space between the date and time... String date = dateTime.substring(0, dateTime.indexOf(" ")); String time = dateTime.substring(dateTime.indexOf(" ") + 1); return toDate(date, time); }
[ "public", "static", "java", ".", "util", ".", "Date", "toDate", "(", "String", "dateTime", ")", "{", "// dateTime must have one space between the date and time...\r", "String", "date", "=", "dateTime", ".", "substring", "(", "0", ",", "dateTime", ".", "indexOf", "(", "\" \"", ")", ")", ";", "String", "time", "=", "dateTime", ".", "substring", "(", "dateTime", ".", "indexOf", "(", "\" \"", ")", "+", "1", ")", ";", "return", "toDate", "(", "date", ",", "time", ")", ";", "}" ]
Converts a date and time String into a Date @param dateTime A combined data and time string in the format "MM/DD/YYYY HH:MM:SS", the seconds are optional @return The corresponding Date
[ "Converts", "a", "date", "and", "time", "String", "into", "a", "Date" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L303-L309
pravega/pravega
bindings/src/main/java/io/pravega/storage/hdfs/HDFSExceptionHelpers.java
HDFSExceptionHelpers.convertException
static <T> StreamSegmentException convertException(String segmentName, Throwable e) { """ Translates HDFS specific Exceptions to Pravega-equivalent Exceptions. @param segmentName Name of the stream segment on which the exception occurs. @param e The exception to be translated. @return The exception to be thrown. """ if (e instanceof RemoteException) { e = ((RemoteException) e).unwrapRemoteException(); } if (e instanceof PathNotFoundException || e instanceof FileNotFoundException) { return new StreamSegmentNotExistsException(segmentName, e); } else if (e instanceof FileAlreadyExistsException || e instanceof AlreadyBeingCreatedException) { return new StreamSegmentExistsException(segmentName, e); } else if (e instanceof AclException) { return new StreamSegmentSealedException(segmentName, e); } else { throw Exceptions.sneakyThrow(e); } }
java
static <T> StreamSegmentException convertException(String segmentName, Throwable e) { if (e instanceof RemoteException) { e = ((RemoteException) e).unwrapRemoteException(); } if (e instanceof PathNotFoundException || e instanceof FileNotFoundException) { return new StreamSegmentNotExistsException(segmentName, e); } else if (e instanceof FileAlreadyExistsException || e instanceof AlreadyBeingCreatedException) { return new StreamSegmentExistsException(segmentName, e); } else if (e instanceof AclException) { return new StreamSegmentSealedException(segmentName, e); } else { throw Exceptions.sneakyThrow(e); } }
[ "static", "<", "T", ">", "StreamSegmentException", "convertException", "(", "String", "segmentName", ",", "Throwable", "e", ")", "{", "if", "(", "e", "instanceof", "RemoteException", ")", "{", "e", "=", "(", "(", "RemoteException", ")", "e", ")", ".", "unwrapRemoteException", "(", ")", ";", "}", "if", "(", "e", "instanceof", "PathNotFoundException", "||", "e", "instanceof", "FileNotFoundException", ")", "{", "return", "new", "StreamSegmentNotExistsException", "(", "segmentName", ",", "e", ")", ";", "}", "else", "if", "(", "e", "instanceof", "FileAlreadyExistsException", "||", "e", "instanceof", "AlreadyBeingCreatedException", ")", "{", "return", "new", "StreamSegmentExistsException", "(", "segmentName", ",", "e", ")", ";", "}", "else", "if", "(", "e", "instanceof", "AclException", ")", "{", "return", "new", "StreamSegmentSealedException", "(", "segmentName", ",", "e", ")", ";", "}", "else", "{", "throw", "Exceptions", ".", "sneakyThrow", "(", "e", ")", ";", "}", "}" ]
Translates HDFS specific Exceptions to Pravega-equivalent Exceptions. @param segmentName Name of the stream segment on which the exception occurs. @param e The exception to be translated. @return The exception to be thrown.
[ "Translates", "HDFS", "specific", "Exceptions", "to", "Pravega", "-", "equivalent", "Exceptions", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/bindings/src/main/java/io/pravega/storage/hdfs/HDFSExceptionHelpers.java#L36-L50
ThreeTen/threetenbp
src/main/java/org/threeten/bp/LocalDate.java
LocalDate.ofYearDay
public static LocalDate ofYearDay(int year, int dayOfYear) { """ Obtains an instance of {@code LocalDate} from a year and day-of-year. <p> The day-of-year must be valid for the year, otherwise an exception will be thrown. @param year the year to represent, from MIN_YEAR to MAX_YEAR @param dayOfYear the day-of-year to represent, from 1 to 366 @return the local date, not null @throws DateTimeException if the value of any field is out of range @throws DateTimeException if the day-of-year is invalid for the month-year """ YEAR.checkValidValue(year); DAY_OF_YEAR.checkValidValue(dayOfYear); boolean leap = IsoChronology.INSTANCE.isLeapYear(year); if (dayOfYear == 366 && leap == false) { throw new DateTimeException("Invalid date 'DayOfYear 366' as '" + year + "' is not a leap year"); } Month moy = Month.of((dayOfYear - 1) / 31 + 1); int monthEnd = moy.firstDayOfYear(leap) + moy.length(leap) - 1; if (dayOfYear > monthEnd) { moy = moy.plus(1); } int dom = dayOfYear - moy.firstDayOfYear(leap) + 1; return create(year, moy, dom); }
java
public static LocalDate ofYearDay(int year, int dayOfYear) { YEAR.checkValidValue(year); DAY_OF_YEAR.checkValidValue(dayOfYear); boolean leap = IsoChronology.INSTANCE.isLeapYear(year); if (dayOfYear == 366 && leap == false) { throw new DateTimeException("Invalid date 'DayOfYear 366' as '" + year + "' is not a leap year"); } Month moy = Month.of((dayOfYear - 1) / 31 + 1); int monthEnd = moy.firstDayOfYear(leap) + moy.length(leap) - 1; if (dayOfYear > monthEnd) { moy = moy.plus(1); } int dom = dayOfYear - moy.firstDayOfYear(leap) + 1; return create(year, moy, dom); }
[ "public", "static", "LocalDate", "ofYearDay", "(", "int", "year", ",", "int", "dayOfYear", ")", "{", "YEAR", ".", "checkValidValue", "(", "year", ")", ";", "DAY_OF_YEAR", ".", "checkValidValue", "(", "dayOfYear", ")", ";", "boolean", "leap", "=", "IsoChronology", ".", "INSTANCE", ".", "isLeapYear", "(", "year", ")", ";", "if", "(", "dayOfYear", "==", "366", "&&", "leap", "==", "false", ")", "{", "throw", "new", "DateTimeException", "(", "\"Invalid date 'DayOfYear 366' as '\"", "+", "year", "+", "\"' is not a leap year\"", ")", ";", "}", "Month", "moy", "=", "Month", ".", "of", "(", "(", "dayOfYear", "-", "1", ")", "/", "31", "+", "1", ")", ";", "int", "monthEnd", "=", "moy", ".", "firstDayOfYear", "(", "leap", ")", "+", "moy", ".", "length", "(", "leap", ")", "-", "1", ";", "if", "(", "dayOfYear", ">", "monthEnd", ")", "{", "moy", "=", "moy", ".", "plus", "(", "1", ")", ";", "}", "int", "dom", "=", "dayOfYear", "-", "moy", ".", "firstDayOfYear", "(", "leap", ")", "+", "1", ";", "return", "create", "(", "year", ",", "moy", ",", "dom", ")", ";", "}" ]
Obtains an instance of {@code LocalDate} from a year and day-of-year. <p> The day-of-year must be valid for the year, otherwise an exception will be thrown. @param year the year to represent, from MIN_YEAR to MAX_YEAR @param dayOfYear the day-of-year to represent, from 1 to 366 @return the local date, not null @throws DateTimeException if the value of any field is out of range @throws DateTimeException if the day-of-year is invalid for the month-year
[ "Obtains", "an", "instance", "of", "{", "@code", "LocalDate", "}", "from", "a", "year", "and", "day", "-", "of", "-", "year", ".", "<p", ">", "The", "day", "-", "of", "-", "year", "must", "be", "valid", "for", "the", "year", "otherwise", "an", "exception", "will", "be", "thrown", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/LocalDate.java#L254-L268
LearnLib/automatalib
serialization/etf/src/main/java/net/automatalib/serialization/etf/writer/DFA2ETFWriter.java
DFA2ETFWriter.writeETF
@Override protected void writeETF(PrintWriter pw, DFA<?, I> dfa, Alphabet<I> inputs) { """ Write DFA specific parts in the ETF. - initial state, - the valuations for the state 'id', - the letters in the alphabet, - the transitions, - the state labels (rejecting/accepting), - the mapping from states to state labels. @param pw the Writer. @param dfa the DFA to write. @param inputs the alphabet. """ writeETFInternal(pw, dfa, inputs); }
java
@Override protected void writeETF(PrintWriter pw, DFA<?, I> dfa, Alphabet<I> inputs) { writeETFInternal(pw, dfa, inputs); }
[ "@", "Override", "protected", "void", "writeETF", "(", "PrintWriter", "pw", ",", "DFA", "<", "?", ",", "I", ">", "dfa", ",", "Alphabet", "<", "I", ">", "inputs", ")", "{", "writeETFInternal", "(", "pw", ",", "dfa", ",", "inputs", ")", ";", "}" ]
Write DFA specific parts in the ETF. - initial state, - the valuations for the state 'id', - the letters in the alphabet, - the transitions, - the state labels (rejecting/accepting), - the mapping from states to state labels. @param pw the Writer. @param dfa the DFA to write. @param inputs the alphabet.
[ "Write", "DFA", "specific", "parts", "in", "the", "ETF", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/serialization/etf/src/main/java/net/automatalib/serialization/etf/writer/DFA2ETFWriter.java#L63-L66
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java
ObjectUtils.unwrapProxy
public static Object unwrapProxy(Object bean, Boolean recursive) { """ This is a utility method for getting raw objects that may have been proxied. It is intended to be used in cases where raw implementations are needed rather than working with interfaces which they implement. @param bean the potential proxy. @param recursive whether to procceeed recursively through nested proxies. @return the unwrapped bean or <code>null</code> if target bean is <code>null</code>. If <code>recursive</code> parameter is <code>true</code> then returns the most inner unwrapped bean, otherwise the nearest target bean is returned. Based on this <a href="http://forum.springsource.org/showthread.php?t=60216">Spring forum topic</a>. @see Advised @since 20101223 thanks to <a href="http://jirabluebell.b2b2000.com/browse/BLUE-34">BLUE-34</a> """ Assert.notNull(recursive, "recursive"); Object unwrapped = bean; // If the given object is a proxy, set the return value as the object being proxied, otherwise return the given // object if ((bean != null) && (bean instanceof Advised) && (AopUtils.isAopProxy(bean))) { final Advised advised = (Advised) bean; try { final Object target = advised.getTargetSource().getTarget(); unwrapped = recursive ? ObjectUtils.unwrapProxy(target, recursive) : target; } catch (Exception e) { unwrapped = bean; ObjectUtils.LOGGER.warn("Failure unwrapping \"" + bean + "\".", e); } } return unwrapped; }
java
public static Object unwrapProxy(Object bean, Boolean recursive) { Assert.notNull(recursive, "recursive"); Object unwrapped = bean; // If the given object is a proxy, set the return value as the object being proxied, otherwise return the given // object if ((bean != null) && (bean instanceof Advised) && (AopUtils.isAopProxy(bean))) { final Advised advised = (Advised) bean; try { final Object target = advised.getTargetSource().getTarget(); unwrapped = recursive ? ObjectUtils.unwrapProxy(target, recursive) : target; } catch (Exception e) { unwrapped = bean; ObjectUtils.LOGGER.warn("Failure unwrapping \"" + bean + "\".", e); } } return unwrapped; }
[ "public", "static", "Object", "unwrapProxy", "(", "Object", "bean", ",", "Boolean", "recursive", ")", "{", "Assert", ".", "notNull", "(", "recursive", ",", "\"recursive\"", ")", ";", "Object", "unwrapped", "=", "bean", ";", "// If the given object is a proxy, set the return value as the object being proxied, otherwise return the given", "// object", "if", "(", "(", "bean", "!=", "null", ")", "&&", "(", "bean", "instanceof", "Advised", ")", "&&", "(", "AopUtils", ".", "isAopProxy", "(", "bean", ")", ")", ")", "{", "final", "Advised", "advised", "=", "(", "Advised", ")", "bean", ";", "try", "{", "final", "Object", "target", "=", "advised", ".", "getTargetSource", "(", ")", ".", "getTarget", "(", ")", ";", "unwrapped", "=", "recursive", "?", "ObjectUtils", ".", "unwrapProxy", "(", "target", ",", "recursive", ")", ":", "target", ";", "}", "catch", "(", "Exception", "e", ")", "{", "unwrapped", "=", "bean", ";", "ObjectUtils", ".", "LOGGER", ".", "warn", "(", "\"Failure unwrapping \\\"\"", "+", "bean", "+", "\"\\\".\"", ",", "e", ")", ";", "}", "}", "return", "unwrapped", ";", "}" ]
This is a utility method for getting raw objects that may have been proxied. It is intended to be used in cases where raw implementations are needed rather than working with interfaces which they implement. @param bean the potential proxy. @param recursive whether to procceeed recursively through nested proxies. @return the unwrapped bean or <code>null</code> if target bean is <code>null</code>. If <code>recursive</code> parameter is <code>true</code> then returns the most inner unwrapped bean, otherwise the nearest target bean is returned. Based on this <a href="http://forum.springsource.org/showthread.php?t=60216">Spring forum topic</a>. @see Advised @since 20101223 thanks to <a href="http://jirabluebell.b2b2000.com/browse/BLUE-34">BLUE-34</a>
[ "This", "is", "a", "utility", "method", "for", "getting", "raw", "objects", "that", "may", "have", "been", "proxied", ".", "It", "is", "intended", "to", "be", "used", "in", "cases", "where", "raw", "implementations", "are", "needed", "rather", "than", "working", "with", "interfaces", "which", "they", "implement", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java#L242-L264
rometools/rome
rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleGenerator.java
MediaModuleGenerator.generateLocations
private void generateLocations(final Metadata m, final Element e) { """ Generation of location tags. @param m source @param e element to attach new element to """ final GMLGenerator geoRssGenerator = new GMLGenerator(); for (final Location location : m.getLocations()) { final Element locationElement = new Element("location", NS); addNotNullAttribute(locationElement, "description", location.getDescription()); addNotNullAttribute(locationElement, "start", location.getStart()); addNotNullAttribute(locationElement, "end", location.getEnd()); if (location.getGeoRss() != null) { geoRssGenerator.generate(location.getGeoRss(), locationElement); } if (locationElement.hasAttributes() || !locationElement.getChildren().isEmpty()) { e.addContent(locationElement); } } }
java
private void generateLocations(final Metadata m, final Element e) { final GMLGenerator geoRssGenerator = new GMLGenerator(); for (final Location location : m.getLocations()) { final Element locationElement = new Element("location", NS); addNotNullAttribute(locationElement, "description", location.getDescription()); addNotNullAttribute(locationElement, "start", location.getStart()); addNotNullAttribute(locationElement, "end", location.getEnd()); if (location.getGeoRss() != null) { geoRssGenerator.generate(location.getGeoRss(), locationElement); } if (locationElement.hasAttributes() || !locationElement.getChildren().isEmpty()) { e.addContent(locationElement); } } }
[ "private", "void", "generateLocations", "(", "final", "Metadata", "m", ",", "final", "Element", "e", ")", "{", "final", "GMLGenerator", "geoRssGenerator", "=", "new", "GMLGenerator", "(", ")", ";", "for", "(", "final", "Location", "location", ":", "m", ".", "getLocations", "(", ")", ")", "{", "final", "Element", "locationElement", "=", "new", "Element", "(", "\"location\"", ",", "NS", ")", ";", "addNotNullAttribute", "(", "locationElement", ",", "\"description\"", ",", "location", ".", "getDescription", "(", ")", ")", ";", "addNotNullAttribute", "(", "locationElement", ",", "\"start\"", ",", "location", ".", "getStart", "(", ")", ")", ";", "addNotNullAttribute", "(", "locationElement", ",", "\"end\"", ",", "location", ".", "getEnd", "(", ")", ")", ";", "if", "(", "location", ".", "getGeoRss", "(", ")", "!=", "null", ")", "{", "geoRssGenerator", ".", "generate", "(", "location", ".", "getGeoRss", "(", ")", ",", "locationElement", ")", ";", "}", "if", "(", "locationElement", ".", "hasAttributes", "(", ")", "||", "!", "locationElement", ".", "getChildren", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "e", ".", "addContent", "(", "locationElement", ")", ";", "}", "}", "}" ]
Generation of location tags. @param m source @param e element to attach new element to
[ "Generation", "of", "location", "tags", "." ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleGenerator.java#L392-L406
jcuda/jcufft
JCufftJava/src/main/java/jcuda/jcufft/JCufft.java
JCufft.cufftPlan1d
public static int cufftPlan1d(cufftHandle plan, int nx, int type, int batch) { """ <pre> Creates a 1D FFT plan configuration for a specified signal size and data type. cufftResult cufftPlan1d( cufftHandle *plan, int nx, cufftType type, int batch ); The batch input parameter tells CUFFT how many 1D transforms to configure. Input ---- plan Pointer to a cufftHandle object nx The transform size (e.g., 256 for a 256-point FFT) type The transform data type (e.g., CUFFT_C2C for complex to complex) batch Number of transforms of size nx Output ---- plan Contains a CUFFT 1D plan handle value Return Values ---- CUFFT_SETUP_FAILED CUFFT library failed to initialize. CUFFT_INVALID_SIZE The nx parameter is not a supported size. CUFFT_INVALID_TYPE The type parameter is not supported. CUFFT_ALLOC_FAILED Allocation of GPU resources for the plan failed. CUFFT_SUCCESS CUFFT successfully created the FFT plan. JCUFFT_INTERNAL_ERROR If an internal JCufft error occurred <pre> NOTE: Batch sizes other than 1 for cufftPlan1d() have been deprecated as of CUDA 6.0RC. Use cufftPlanMany() for multiple batch execution. """ plan.setDimension(1); plan.setType(type); plan.setSize(nx, 0, 0); plan.setBatchSize(batch); return checkResult(cufftPlan1dNative(plan, nx, type, batch)); }
java
public static int cufftPlan1d(cufftHandle plan, int nx, int type, int batch) { plan.setDimension(1); plan.setType(type); plan.setSize(nx, 0, 0); plan.setBatchSize(batch); return checkResult(cufftPlan1dNative(plan, nx, type, batch)); }
[ "public", "static", "int", "cufftPlan1d", "(", "cufftHandle", "plan", ",", "int", "nx", ",", "int", "type", ",", "int", "batch", ")", "{", "plan", ".", "setDimension", "(", "1", ")", ";", "plan", ".", "setType", "(", "type", ")", ";", "plan", ".", "setSize", "(", "nx", ",", "0", ",", "0", ")", ";", "plan", ".", "setBatchSize", "(", "batch", ")", ";", "return", "checkResult", "(", "cufftPlan1dNative", "(", "plan", ",", "nx", ",", "type", ",", "batch", ")", ")", ";", "}" ]
<pre> Creates a 1D FFT plan configuration for a specified signal size and data type. cufftResult cufftPlan1d( cufftHandle *plan, int nx, cufftType type, int batch ); The batch input parameter tells CUFFT how many 1D transforms to configure. Input ---- plan Pointer to a cufftHandle object nx The transform size (e.g., 256 for a 256-point FFT) type The transform data type (e.g., CUFFT_C2C for complex to complex) batch Number of transforms of size nx Output ---- plan Contains a CUFFT 1D plan handle value Return Values ---- CUFFT_SETUP_FAILED CUFFT library failed to initialize. CUFFT_INVALID_SIZE The nx parameter is not a supported size. CUFFT_INVALID_TYPE The type parameter is not supported. CUFFT_ALLOC_FAILED Allocation of GPU resources for the plan failed. CUFFT_SUCCESS CUFFT successfully created the FFT plan. JCUFFT_INTERNAL_ERROR If an internal JCufft error occurred <pre> NOTE: Batch sizes other than 1 for cufftPlan1d() have been deprecated as of CUDA 6.0RC. Use cufftPlanMany() for multiple batch execution.
[ "<pre", ">", "Creates", "a", "1D", "FFT", "plan", "configuration", "for", "a", "specified", "signal", "size", "and", "data", "type", "." ]
train
https://github.com/jcuda/jcufft/blob/833c87ffb0864f7ee7270fddef8af57f48939b3a/JCufftJava/src/main/java/jcuda/jcufft/JCufft.java#L210-L217
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/random/RandomInteger.java
RandomInteger.updateInteger
public static int updateInteger(int value, int range) { """ Updates (drifts) a integer value within specified range defined @param value a integer value to drift. @param range (optional) a range. Default: 10% of the value @return updated random integer value. """ range = range == 0 ? (int) (0.1 * value) : range; int min = value - range; int max = value + range; return nextInteger(min, max); }
java
public static int updateInteger(int value, int range) { range = range == 0 ? (int) (0.1 * value) : range; int min = value - range; int max = value + range; return nextInteger(min, max); }
[ "public", "static", "int", "updateInteger", "(", "int", "value", ",", "int", "range", ")", "{", "range", "=", "range", "==", "0", "?", "(", "int", ")", "(", "0.1", "*", "value", ")", ":", "range", ";", "int", "min", "=", "value", "-", "range", ";", "int", "max", "=", "value", "+", "range", ";", "return", "nextInteger", "(", "min", ",", "max", ")", ";", "}" ]
Updates (drifts) a integer value within specified range defined @param value a integer value to drift. @param range (optional) a range. Default: 10% of the value @return updated random integer value.
[ "Updates", "(", "drifts", ")", "a", "integer", "value", "within", "specified", "range", "defined" ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/random/RandomInteger.java#L65-L70
alkacon/opencms-core
src/org/opencms/ade/sitemap/CmsAliasBulkEditHelper.java
CmsAliasBulkEditHelper.validateSingleAliasRow
private void validateSingleAliasRow(CmsObject cms, CmsAliasTableRow row) { """ Validates a single alias row.<p> @param cms the current CMS context @param row the row to validate """ Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms); if (row.getStructureId() == null) { String path = row.getResourcePath(); try { CmsResource resource = cms.readResource(path, CmsResourceFilter.ALL); row.setStructureId(resource.getStructureId()); if (row.getOriginalStructureId() == null) { row.setOriginalStructureId(resource.getStructureId()); } } catch (CmsException e) { row.setPathError(messageResourceNotFound(locale)); m_hasErrors = true; } } if (!CmsAlias.ALIAS_PATTERN.matcher(row.getAliasPath()).matches()) { row.setAliasError(messageInvalidAliasPath(locale)); m_hasErrors = true; } }
java
private void validateSingleAliasRow(CmsObject cms, CmsAliasTableRow row) { Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms); if (row.getStructureId() == null) { String path = row.getResourcePath(); try { CmsResource resource = cms.readResource(path, CmsResourceFilter.ALL); row.setStructureId(resource.getStructureId()); if (row.getOriginalStructureId() == null) { row.setOriginalStructureId(resource.getStructureId()); } } catch (CmsException e) { row.setPathError(messageResourceNotFound(locale)); m_hasErrors = true; } } if (!CmsAlias.ALIAS_PATTERN.matcher(row.getAliasPath()).matches()) { row.setAliasError(messageInvalidAliasPath(locale)); m_hasErrors = true; } }
[ "private", "void", "validateSingleAliasRow", "(", "CmsObject", "cms", ",", "CmsAliasTableRow", "row", ")", "{", "Locale", "locale", "=", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getWorkplaceLocale", "(", "cms", ")", ";", "if", "(", "row", ".", "getStructureId", "(", ")", "==", "null", ")", "{", "String", "path", "=", "row", ".", "getResourcePath", "(", ")", ";", "try", "{", "CmsResource", "resource", "=", "cms", ".", "readResource", "(", "path", ",", "CmsResourceFilter", ".", "ALL", ")", ";", "row", ".", "setStructureId", "(", "resource", ".", "getStructureId", "(", ")", ")", ";", "if", "(", "row", ".", "getOriginalStructureId", "(", ")", "==", "null", ")", "{", "row", ".", "setOriginalStructureId", "(", "resource", ".", "getStructureId", "(", ")", ")", ";", "}", "}", "catch", "(", "CmsException", "e", ")", "{", "row", ".", "setPathError", "(", "messageResourceNotFound", "(", "locale", ")", ")", ";", "m_hasErrors", "=", "true", ";", "}", "}", "if", "(", "!", "CmsAlias", ".", "ALIAS_PATTERN", ".", "matcher", "(", "row", ".", "getAliasPath", "(", ")", ")", ".", "matches", "(", ")", ")", "{", "row", ".", "setAliasError", "(", "messageInvalidAliasPath", "(", "locale", ")", ")", ";", "m_hasErrors", "=", "true", ";", "}", "}" ]
Validates a single alias row.<p> @param cms the current CMS context @param row the row to validate
[ "Validates", "a", "single", "alias", "row", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsAliasBulkEditHelper.java#L312-L332
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java
ConnectionMonitorsInner.beginCreateOrUpdate
public ConnectionMonitorResultInner beginCreateOrUpdate(String resourceGroupName, String networkWatcherName, String connectionMonitorName, ConnectionMonitorInner parameters) { """ Create or update a connection monitor. @param resourceGroupName The name of the resource group containing Network Watcher. @param networkWatcherName The name of the Network Watcher resource. @param connectionMonitorName The name of the connection monitor. @param parameters Parameters that define the operation to create a connection monitor. @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 ConnectionMonitorResultInner object if successful. """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters).toBlocking().single().body(); }
java
public ConnectionMonitorResultInner beginCreateOrUpdate(String resourceGroupName, String networkWatcherName, String connectionMonitorName, ConnectionMonitorInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters).toBlocking().single().body(); }
[ "public", "ConnectionMonitorResultInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "String", "connectionMonitorName", ",", "ConnectionMonitorInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkWatcherName", ",", "connectionMonitorName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Create or update a connection monitor. @param resourceGroupName The name of the resource group containing Network Watcher. @param networkWatcherName The name of the Network Watcher resource. @param connectionMonitorName The name of the connection monitor. @param parameters Parameters that define the operation to create a connection monitor. @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 ConnectionMonitorResultInner object if successful.
[ "Create", "or", "update", "a", "connection", "monitor", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java#L204-L206
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyNodeImpl.java
PolicyNodeImpl.getPolicyNodesExpected
Set<PolicyNodeImpl> getPolicyNodesExpected(int depth, String expectedOID, boolean matchAny) { """ Finds all nodes at the specified depth whose expected_policy_set contains the specified expected OID (if matchAny is false) or the special OID "any value" (if matchAny is true). @param depth an int representing the desired depth @param expectedOID a String encoding the valid OID to match @param matchAny a boolean indicating whether an expected_policy_set containing ANY_POLICY should be considered a match @return a Set of matched <code>PolicyNode</code>s """ if (expectedOID.equals(ANY_POLICY)) { return getPolicyNodes(depth); } else { return getPolicyNodesExpectedHelper(depth, expectedOID, matchAny); } }
java
Set<PolicyNodeImpl> getPolicyNodesExpected(int depth, String expectedOID, boolean matchAny) { if (expectedOID.equals(ANY_POLICY)) { return getPolicyNodes(depth); } else { return getPolicyNodesExpectedHelper(depth, expectedOID, matchAny); } }
[ "Set", "<", "PolicyNodeImpl", ">", "getPolicyNodesExpected", "(", "int", "depth", ",", "String", "expectedOID", ",", "boolean", "matchAny", ")", "{", "if", "(", "expectedOID", ".", "equals", "(", "ANY_POLICY", ")", ")", "{", "return", "getPolicyNodes", "(", "depth", ")", ";", "}", "else", "{", "return", "getPolicyNodesExpectedHelper", "(", "depth", ",", "expectedOID", ",", "matchAny", ")", ";", "}", "}" ]
Finds all nodes at the specified depth whose expected_policy_set contains the specified expected OID (if matchAny is false) or the special OID "any value" (if matchAny is true). @param depth an int representing the desired depth @param expectedOID a String encoding the valid OID to match @param matchAny a boolean indicating whether an expected_policy_set containing ANY_POLICY should be considered a match @return a Set of matched <code>PolicyNode</code>s
[ "Finds", "all", "nodes", "at", "the", "specified", "depth", "whose", "expected_policy_set", "contains", "the", "specified", "expected", "OID", "(", "if", "matchAny", "is", "false", ")", "or", "the", "special", "OID", "any", "value", "(", "if", "matchAny", "is", "true", ")", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyNodeImpl.java#L334-L342
briandilley/jsonrpc4j
src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java
JsonRpcClient.internalWriteRequest
private void internalWriteRequest(String methodName, Object arguments, OutputStream output, String id) throws IOException { """ Writes a request. @param methodName the method name @param arguments the arguments @param output the stream @param id the optional id @throws IOException on error """ final ObjectNode request = internalCreateRequest(methodName, arguments, id); logger.debug("Request {}", request); writeAndFlushValue(output, request); }
java
private void internalWriteRequest(String methodName, Object arguments, OutputStream output, String id) throws IOException { final ObjectNode request = internalCreateRequest(methodName, arguments, id); logger.debug("Request {}", request); writeAndFlushValue(output, request); }
[ "private", "void", "internalWriteRequest", "(", "String", "methodName", ",", "Object", "arguments", ",", "OutputStream", "output", ",", "String", "id", ")", "throws", "IOException", "{", "final", "ObjectNode", "request", "=", "internalCreateRequest", "(", "methodName", ",", "arguments", ",", "id", ")", ";", "logger", ".", "debug", "(", "\"Request {}\"", ",", "request", ")", ";", "writeAndFlushValue", "(", "output", ",", "request", ")", ";", "}" ]
Writes a request. @param methodName the method name @param arguments the arguments @param output the stream @param id the optional id @throws IOException on error
[ "Writes", "a", "request", "." ]
train
https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java#L304-L308
xwiki/xwiki-rendering
xwiki-rendering-transformations/xwiki-rendering-transformation-icon/src/main/java/org/xwiki/rendering/internal/transformation/icon/IconTransformation.java
IconTransformation.convertToDeepTree
private Block convertToDeepTree(Block sourceTree, String iconName) { """ Converts a standard XDOM tree into a deep tree: sibling are transformed into parent/child relationships and the leaf node is an Image node referencing the passed icon name. @param sourceTree the source tree to modify @param iconName the name of the icon to display when a match is found @return the modified tree """ XDOM targetTree = new XDOM(Collections.<Block>emptyList()); Block pointer = targetTree; for (Block block : sourceTree.getChildren()) { pointer.addChild(block); pointer = block; } // Add an image block as the last block pointer.addChild(new ImageBlock(new ResourceReference(iconName, ResourceType.ICON), true)); return targetTree; }
java
private Block convertToDeepTree(Block sourceTree, String iconName) { XDOM targetTree = new XDOM(Collections.<Block>emptyList()); Block pointer = targetTree; for (Block block : sourceTree.getChildren()) { pointer.addChild(block); pointer = block; } // Add an image block as the last block pointer.addChild(new ImageBlock(new ResourceReference(iconName, ResourceType.ICON), true)); return targetTree; }
[ "private", "Block", "convertToDeepTree", "(", "Block", "sourceTree", ",", "String", "iconName", ")", "{", "XDOM", "targetTree", "=", "new", "XDOM", "(", "Collections", ".", "<", "Block", ">", "emptyList", "(", ")", ")", ";", "Block", "pointer", "=", "targetTree", ";", "for", "(", "Block", "block", ":", "sourceTree", ".", "getChildren", "(", ")", ")", "{", "pointer", ".", "addChild", "(", "block", ")", ";", "pointer", "=", "block", ";", "}", "// Add an image block as the last block", "pointer", ".", "addChild", "(", "new", "ImageBlock", "(", "new", "ResourceReference", "(", "iconName", ",", "ResourceType", ".", "ICON", ")", ",", "true", ")", ")", ";", "return", "targetTree", ";", "}" ]
Converts a standard XDOM tree into a deep tree: sibling are transformed into parent/child relationships and the leaf node is an Image node referencing the passed icon name. @param sourceTree the source tree to modify @param iconName the name of the icon to display when a match is found @return the modified tree
[ "Converts", "a", "standard", "XDOM", "tree", "into", "a", "deep", "tree", ":", "sibling", "are", "transformed", "into", "parent", "/", "child", "relationships", "and", "the", "leaf", "node", "is", "an", "Image", "node", "referencing", "the", "passed", "icon", "name", "." ]
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-transformations/xwiki-rendering-transformation-icon/src/main/java/org/xwiki/rendering/internal/transformation/icon/IconTransformation.java#L136-L147
apache/reef
lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java
VortexAggregateFuture.aggregationCompleted
@Private @Override public void aggregationCompleted(final List<Integer> taskletIds, final TOutput result) { """ Aggregation has completed for a list of Tasklets, with an aggregated result. """ try { completedTasklets(result, taskletIds); } catch (final InterruptedException e) { throw new RuntimeException(e); } }
java
@Private @Override public void aggregationCompleted(final List<Integer> taskletIds, final TOutput result) { try { completedTasklets(result, taskletIds); } catch (final InterruptedException e) { throw new RuntimeException(e); } }
[ "@", "Private", "@", "Override", "public", "void", "aggregationCompleted", "(", "final", "List", "<", "Integer", ">", "taskletIds", ",", "final", "TOutput", "result", ")", "{", "try", "{", "completedTasklets", "(", "result", ",", "taskletIds", ")", ";", "}", "catch", "(", "final", "InterruptedException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Aggregation has completed for a list of Tasklets, with an aggregated result.
[ "Aggregation", "has", "completed", "for", "a", "list", "of", "Tasklets", "with", "an", "aggregated", "result", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java#L125-L133
Netflix/conductor
grpc-client/src/main/java/com/netflix/conductor/client/grpc/TaskClient.java
TaskClient.logMessageForTask
public void logMessageForTask(String taskId, String logMessage) { """ Log execution messages for a task. @param taskId id of the task @param logMessage the message to be logged """ Preconditions.checkArgument(StringUtils.isNotBlank(taskId), "Task id cannot be blank"); stub.addLog( TaskServicePb.AddLogRequest.newBuilder() .setTaskId(taskId) .setLog(logMessage) .build() ); }
java
public void logMessageForTask(String taskId, String logMessage) { Preconditions.checkArgument(StringUtils.isNotBlank(taskId), "Task id cannot be blank"); stub.addLog( TaskServicePb.AddLogRequest.newBuilder() .setTaskId(taskId) .setLog(logMessage) .build() ); }
[ "public", "void", "logMessageForTask", "(", "String", "taskId", ",", "String", "logMessage", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "taskId", ")", ",", "\"Task id cannot be blank\"", ")", ";", "stub", ".", "addLog", "(", "TaskServicePb", ".", "AddLogRequest", ".", "newBuilder", "(", ")", ".", "setTaskId", "(", "taskId", ")", ".", "setLog", "(", "logMessage", ")", ".", "build", "(", ")", ")", ";", "}" ]
Log execution messages for a task. @param taskId id of the task @param logMessage the message to be logged
[ "Log", "execution", "messages", "for", "a", "task", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/grpc-client/src/main/java/com/netflix/conductor/client/grpc/TaskClient.java#L175-L183
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/HttpClientUpgradeHandler.java
HttpClientUpgradeHandler.setUpgradeRequestHeaders
private void setUpgradeRequestHeaders(ChannelHandlerContext ctx, HttpRequest request) { """ Adds all upgrade request headers necessary for an upgrade to the supported protocols. """ // Set the UPGRADE header on the request. request.headers().set(HttpHeaderNames.UPGRADE, upgradeCodec.protocol()); // Add all protocol-specific headers to the request. Set<CharSequence> connectionParts = new LinkedHashSet<CharSequence>(2); connectionParts.addAll(upgradeCodec.setUpgradeHeaders(ctx, request)); // Set the CONNECTION header from the set of all protocol-specific headers that were added. StringBuilder builder = new StringBuilder(); for (CharSequence part : connectionParts) { builder.append(part); builder.append(','); } builder.append(HttpHeaderValues.UPGRADE); request.headers().add(HttpHeaderNames.CONNECTION, builder.toString()); }
java
private void setUpgradeRequestHeaders(ChannelHandlerContext ctx, HttpRequest request) { // Set the UPGRADE header on the request. request.headers().set(HttpHeaderNames.UPGRADE, upgradeCodec.protocol()); // Add all protocol-specific headers to the request. Set<CharSequence> connectionParts = new LinkedHashSet<CharSequence>(2); connectionParts.addAll(upgradeCodec.setUpgradeHeaders(ctx, request)); // Set the CONNECTION header from the set of all protocol-specific headers that were added. StringBuilder builder = new StringBuilder(); for (CharSequence part : connectionParts) { builder.append(part); builder.append(','); } builder.append(HttpHeaderValues.UPGRADE); request.headers().add(HttpHeaderNames.CONNECTION, builder.toString()); }
[ "private", "void", "setUpgradeRequestHeaders", "(", "ChannelHandlerContext", "ctx", ",", "HttpRequest", "request", ")", "{", "// Set the UPGRADE header on the request.", "request", ".", "headers", "(", ")", ".", "set", "(", "HttpHeaderNames", ".", "UPGRADE", ",", "upgradeCodec", ".", "protocol", "(", ")", ")", ";", "// Add all protocol-specific headers to the request.", "Set", "<", "CharSequence", ">", "connectionParts", "=", "new", "LinkedHashSet", "<", "CharSequence", ">", "(", "2", ")", ";", "connectionParts", ".", "addAll", "(", "upgradeCodec", ".", "setUpgradeHeaders", "(", "ctx", ",", "request", ")", ")", ";", "// Set the CONNECTION header from the set of all protocol-specific headers that were added.", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "CharSequence", "part", ":", "connectionParts", ")", "{", "builder", ".", "append", "(", "part", ")", ";", "builder", ".", "append", "(", "'", "'", ")", ";", "}", "builder", ".", "append", "(", "HttpHeaderValues", ".", "UPGRADE", ")", ";", "request", ".", "headers", "(", ")", ".", "add", "(", "HttpHeaderNames", ".", "CONNECTION", ",", "builder", ".", "toString", "(", ")", ")", ";", "}" ]
Adds all upgrade request headers necessary for an upgrade to the supported protocols.
[ "Adds", "all", "upgrade", "request", "headers", "necessary", "for", "an", "upgrade", "to", "the", "supported", "protocols", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpClientUpgradeHandler.java#L265-L281
overturetool/overture
core/typechecker/src/main/java/org/overture/typechecker/visitor/AbstractTypeCheckVisitor.java
AbstractTypeCheckVisitor.typecheckLetBeSt
protected Map.Entry<PType, AMultiBindListDefinition> typecheckLetBeSt( INode node, ILexLocation nodeLocation, PMultipleBind bind, PExp suchThat, INode body, TypeCheckInfo question) throws AnalysisException { """ Type check method for let be such that @param node @param nodeLocation @param bind @param suchThat @param body @param question @return a pair of the type and definition @throws AnalysisException """ final PDefinition def = AstFactory.newAMultiBindListDefinition(nodeLocation, question.assistantFactory.createPMultipleBindAssistant().getMultipleBindList((PMultipleBind) bind)); def.apply(THIS, question.newConstraint(null)); List<PDefinition> qualified = new Vector<PDefinition>(); for (PDefinition d: question.assistantFactory.createPDefinitionAssistant().getDefinitions(def)) { PDefinition copy = d.clone(); copy.setNameScope(NameScope.LOCAL); qualified.add(copy); } Environment local = new FlatCheckedEnvironment(question.assistantFactory, qualified, question.env, question.scope); TypeCheckInfo newInfo = new TypeCheckInfo(question.assistantFactory, local, question.scope, question.qualifiers, question.constraint, null); if (suchThat != null && !question.assistantFactory.createPTypeAssistant().isType(suchThat.apply(THIS, newInfo.newConstraint(null)), ABooleanBasicType.class)) { boolean isExpression = node instanceof PExp; TypeCheckerErrors.report((isExpression ? 3117 : 3225), "Such that clause is not boolean", nodeLocation, node); } newInfo.qualifiers = null; final PType r = body.apply(THIS, newInfo); local.unusedCheck(); return new Map.Entry<PType, AMultiBindListDefinition>() { @Override public AMultiBindListDefinition setValue( AMultiBindListDefinition value) { return null; } @Override public AMultiBindListDefinition getValue() { return (AMultiBindListDefinition) def; } @Override public PType getKey() { return r; } }; }
java
protected Map.Entry<PType, AMultiBindListDefinition> typecheckLetBeSt( INode node, ILexLocation nodeLocation, PMultipleBind bind, PExp suchThat, INode body, TypeCheckInfo question) throws AnalysisException { final PDefinition def = AstFactory.newAMultiBindListDefinition(nodeLocation, question.assistantFactory.createPMultipleBindAssistant().getMultipleBindList((PMultipleBind) bind)); def.apply(THIS, question.newConstraint(null)); List<PDefinition> qualified = new Vector<PDefinition>(); for (PDefinition d: question.assistantFactory.createPDefinitionAssistant().getDefinitions(def)) { PDefinition copy = d.clone(); copy.setNameScope(NameScope.LOCAL); qualified.add(copy); } Environment local = new FlatCheckedEnvironment(question.assistantFactory, qualified, question.env, question.scope); TypeCheckInfo newInfo = new TypeCheckInfo(question.assistantFactory, local, question.scope, question.qualifiers, question.constraint, null); if (suchThat != null && !question.assistantFactory.createPTypeAssistant().isType(suchThat.apply(THIS, newInfo.newConstraint(null)), ABooleanBasicType.class)) { boolean isExpression = node instanceof PExp; TypeCheckerErrors.report((isExpression ? 3117 : 3225), "Such that clause is not boolean", nodeLocation, node); } newInfo.qualifiers = null; final PType r = body.apply(THIS, newInfo); local.unusedCheck(); return new Map.Entry<PType, AMultiBindListDefinition>() { @Override public AMultiBindListDefinition setValue( AMultiBindListDefinition value) { return null; } @Override public AMultiBindListDefinition getValue() { return (AMultiBindListDefinition) def; } @Override public PType getKey() { return r; } }; }
[ "protected", "Map", ".", "Entry", "<", "PType", ",", "AMultiBindListDefinition", ">", "typecheckLetBeSt", "(", "INode", "node", ",", "ILexLocation", "nodeLocation", ",", "PMultipleBind", "bind", ",", "PExp", "suchThat", ",", "INode", "body", ",", "TypeCheckInfo", "question", ")", "throws", "AnalysisException", "{", "final", "PDefinition", "def", "=", "AstFactory", ".", "newAMultiBindListDefinition", "(", "nodeLocation", ",", "question", ".", "assistantFactory", ".", "createPMultipleBindAssistant", "(", ")", ".", "getMultipleBindList", "(", "(", "PMultipleBind", ")", "bind", ")", ")", ";", "def", ".", "apply", "(", "THIS", ",", "question", ".", "newConstraint", "(", "null", ")", ")", ";", "List", "<", "PDefinition", ">", "qualified", "=", "new", "Vector", "<", "PDefinition", ">", "(", ")", ";", "for", "(", "PDefinition", "d", ":", "question", ".", "assistantFactory", ".", "createPDefinitionAssistant", "(", ")", ".", "getDefinitions", "(", "def", ")", ")", "{", "PDefinition", "copy", "=", "d", ".", "clone", "(", ")", ";", "copy", ".", "setNameScope", "(", "NameScope", ".", "LOCAL", ")", ";", "qualified", ".", "add", "(", "copy", ")", ";", "}", "Environment", "local", "=", "new", "FlatCheckedEnvironment", "(", "question", ".", "assistantFactory", ",", "qualified", ",", "question", ".", "env", ",", "question", ".", "scope", ")", ";", "TypeCheckInfo", "newInfo", "=", "new", "TypeCheckInfo", "(", "question", ".", "assistantFactory", ",", "local", ",", "question", ".", "scope", ",", "question", ".", "qualifiers", ",", "question", ".", "constraint", ",", "null", ")", ";", "if", "(", "suchThat", "!=", "null", "&&", "!", "question", ".", "assistantFactory", ".", "createPTypeAssistant", "(", ")", ".", "isType", "(", "suchThat", ".", "apply", "(", "THIS", ",", "newInfo", ".", "newConstraint", "(", "null", ")", ")", ",", "ABooleanBasicType", ".", "class", ")", ")", "{", "boolean", "isExpression", "=", "node", "instanceof", "PExp", ";", "TypeCheckerErrors", ".", "report", "(", "(", "isExpression", "?", "3117", ":", "3225", ")", ",", "\"Such that clause is not boolean\"", ",", "nodeLocation", ",", "node", ")", ";", "}", "newInfo", ".", "qualifiers", "=", "null", ";", "final", "PType", "r", "=", "body", ".", "apply", "(", "THIS", ",", "newInfo", ")", ";", "local", ".", "unusedCheck", "(", ")", ";", "return", "new", "Map", ".", "Entry", "<", "PType", ",", "AMultiBindListDefinition", ">", "(", ")", "{", "@", "Override", "public", "AMultiBindListDefinition", "setValue", "(", "AMultiBindListDefinition", "value", ")", "{", "return", "null", ";", "}", "@", "Override", "public", "AMultiBindListDefinition", "getValue", "(", ")", "{", "return", "(", "AMultiBindListDefinition", ")", "def", ";", "}", "@", "Override", "public", "PType", "getKey", "(", ")", "{", "return", "r", ";", "}", "}", ";", "}" ]
Type check method for let be such that @param node @param nodeLocation @param bind @param suchThat @param body @param question @return a pair of the type and definition @throws AnalysisException
[ "Type", "check", "method", "for", "let", "be", "such", "that" ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/typechecker/src/main/java/org/overture/typechecker/visitor/AbstractTypeCheckVisitor.java#L244-L299
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ClassContext.java
ClassContext.putMethodAnalysis
public void putMethodAnalysis(Class<?> analysisClass, MethodDescriptor methodDescriptor, Object object) { """ Store a method analysis object. Note that the cached analysis object could be a special value (indicating null or an exception). @param analysisClass class the method analysis object belongs to @param methodDescriptor method descriptor identifying the analyzed method @param object the analysis object to cache """ if (object == null) { throw new IllegalArgumentException(); } Map<MethodDescriptor, Object> objectMap = getObjectMap(analysisClass); objectMap.put(methodDescriptor, object); }
java
public void putMethodAnalysis(Class<?> analysisClass, MethodDescriptor methodDescriptor, Object object) { if (object == null) { throw new IllegalArgumentException(); } Map<MethodDescriptor, Object> objectMap = getObjectMap(analysisClass); objectMap.put(methodDescriptor, object); }
[ "public", "void", "putMethodAnalysis", "(", "Class", "<", "?", ">", "analysisClass", ",", "MethodDescriptor", "methodDescriptor", ",", "Object", "object", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "Map", "<", "MethodDescriptor", ",", "Object", ">", "objectMap", "=", "getObjectMap", "(", "analysisClass", ")", ";", "objectMap", ".", "put", "(", "methodDescriptor", ",", "object", ")", ";", "}" ]
Store a method analysis object. Note that the cached analysis object could be a special value (indicating null or an exception). @param analysisClass class the method analysis object belongs to @param methodDescriptor method descriptor identifying the analyzed method @param object the analysis object to cache
[ "Store", "a", "method", "analysis", "object", ".", "Note", "that", "the", "cached", "analysis", "object", "could", "be", "a", "special", "value", "(", "indicating", "null", "or", "an", "exception", ")", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ClassContext.java#L152-L158
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
MemberSummaryBuilder.buildMethodsSummary
public void buildMethodsSummary(XMLNode node, Content memberSummaryTree) { """ Build the method summary. @param node the XML element that specifies which components to document @param memberSummaryTree the content tree to which the documentation will be added """ MemberSummaryWriter writer = memberSummaryWriters.get(VisibleMemberMap.Kind.METHODS); VisibleMemberMap visibleMemberMap = getVisibleMemberMap(VisibleMemberMap.Kind.METHODS); addSummary(writer, visibleMemberMap, true, memberSummaryTree); }
java
public void buildMethodsSummary(XMLNode node, Content memberSummaryTree) { MemberSummaryWriter writer = memberSummaryWriters.get(VisibleMemberMap.Kind.METHODS); VisibleMemberMap visibleMemberMap = getVisibleMemberMap(VisibleMemberMap.Kind.METHODS); addSummary(writer, visibleMemberMap, true, memberSummaryTree); }
[ "public", "void", "buildMethodsSummary", "(", "XMLNode", "node", ",", "Content", "memberSummaryTree", ")", "{", "MemberSummaryWriter", "writer", "=", "memberSummaryWriters", ".", "get", "(", "VisibleMemberMap", ".", "Kind", ".", "METHODS", ")", ";", "VisibleMemberMap", "visibleMemberMap", "=", "getVisibleMemberMap", "(", "VisibleMemberMap", ".", "Kind", ".", "METHODS", ")", ";", "addSummary", "(", "writer", ",", "visibleMemberMap", ",", "true", ",", "memberSummaryTree", ")", ";", "}" ]
Build the method summary. @param node the XML element that specifies which components to document @param memberSummaryTree the content tree to which the documentation will be added
[ "Build", "the", "method", "summary", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java#L304-L310
Azure/azure-sdk-for-java
cognitiveservices/data-plane/search/bingimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/imagesearch/implementation/BingImagesImpl.java
BingImagesImpl.detailsAsync
public Observable<ImageInsights> detailsAsync(String query, DetailsOptionalParameter detailsOptionalParameter) { """ The Image Detail Search API lets you search on Bing and get back insights about an image, such as webpages that include the image. This section provides technical details about the query parameters and headers that you use to request insights of images and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the Web for Images](https://docs.microsoft.com/azure/cognitive-services/bing-image-search/search-the-web). @param query The user's search query term. The term cannot be empty. The term may contain [Bing Advanced Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to limit images to a specific domain, use the [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help improve relevance of an insights query (see [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)), you should always include the user's query term. Use this parameter only with the Image Search API.Do not specify this parameter when calling the Trending Images API. @param detailsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ImageInsights object """ return detailsWithServiceResponseAsync(query, detailsOptionalParameter).map(new Func1<ServiceResponse<ImageInsights>, ImageInsights>() { @Override public ImageInsights call(ServiceResponse<ImageInsights> response) { return response.body(); } }); }
java
public Observable<ImageInsights> detailsAsync(String query, DetailsOptionalParameter detailsOptionalParameter) { return detailsWithServiceResponseAsync(query, detailsOptionalParameter).map(new Func1<ServiceResponse<ImageInsights>, ImageInsights>() { @Override public ImageInsights call(ServiceResponse<ImageInsights> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ImageInsights", ">", "detailsAsync", "(", "String", "query", ",", "DetailsOptionalParameter", "detailsOptionalParameter", ")", "{", "return", "detailsWithServiceResponseAsync", "(", "query", ",", "detailsOptionalParameter", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ImageInsights", ">", ",", "ImageInsights", ">", "(", ")", "{", "@", "Override", "public", "ImageInsights", "call", "(", "ServiceResponse", "<", "ImageInsights", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
The Image Detail Search API lets you search on Bing and get back insights about an image, such as webpages that include the image. This section provides technical details about the query parameters and headers that you use to request insights of images and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the Web for Images](https://docs.microsoft.com/azure/cognitive-services/bing-image-search/search-the-web). @param query The user's search query term. The term cannot be empty. The term may contain [Bing Advanced Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to limit images to a specific domain, use the [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help improve relevance of an insights query (see [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)), you should always include the user's query term. Use this parameter only with the Image Search API.Do not specify this parameter when calling the Trending Images API. @param detailsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ImageInsights object
[ "The", "Image", "Detail", "Search", "API", "lets", "you", "search", "on", "Bing", "and", "get", "back", "insights", "about", "an", "image", "such", "as", "webpages", "that", "include", "the", "image", ".", "This", "section", "provides", "technical", "details", "about", "the", "query", "parameters", "and", "headers", "that", "you", "use", "to", "request", "insights", "of", "images", "and", "the", "JSON", "response", "objects", "that", "contain", "them", ".", "For", "examples", "that", "show", "how", "to", "make", "requests", "see", "[", "Searching", "the", "Web", "for", "Images", "]", "(", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "azure", "/", "cognitive", "-", "services", "/", "bing", "-", "image", "-", "search", "/", "search", "-", "the", "-", "web", ")", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/imagesearch/implementation/BingImagesImpl.java#L502-L509
looly/hutool
hutool-core/src/main/java/cn/hutool/core/text/TextSimilarity.java
TextSimilarity.similar
public static String similar(String strA, String strB, int scale) { """ 计算相似度百分比 @param strA 字符串1 @param strB 字符串2 @param scale 保留小数 @return 百分比 """ return NumberUtil.formatPercent(similar(strA, strB), scale); }
java
public static String similar(String strA, String strB, int scale) { return NumberUtil.formatPercent(similar(strA, strB), scale); }
[ "public", "static", "String", "similar", "(", "String", "strA", ",", "String", "strB", ",", "int", "scale", ")", "{", "return", "NumberUtil", ".", "formatPercent", "(", "similar", "(", "strA", ",", "strB", ")", ",", "scale", ")", ";", "}" ]
计算相似度百分比 @param strA 字符串1 @param strB 字符串2 @param scale 保留小数 @return 百分比
[ "计算相似度百分比" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/TextSimilarity.java#L45-L47
apache/flink
flink-core/src/main/java/org/apache/flink/util/InstantiationUtil.java
InstantiationUtil.resolveClassByName
public static <T> Class<T> resolveClassByName( DataInputView in, ClassLoader cl) throws IOException { """ Loads a class by name from the given input stream and reflectively instantiates it. <p>This method will use {@link DataInputView#readUTF()} to read the class name, and then attempt to load the class from the given ClassLoader. @param in The stream to read the class name from. @param cl The class loader to resolve the class. @throws IOException Thrown, if the class name could not be read, the class could not be found. """ return resolveClassByName(in, cl, Object.class); }
java
public static <T> Class<T> resolveClassByName( DataInputView in, ClassLoader cl) throws IOException { return resolveClassByName(in, cl, Object.class); }
[ "public", "static", "<", "T", ">", "Class", "<", "T", ">", "resolveClassByName", "(", "DataInputView", "in", ",", "ClassLoader", "cl", ")", "throws", "IOException", "{", "return", "resolveClassByName", "(", "in", ",", "cl", ",", "Object", ".", "class", ")", ";", "}" ]
Loads a class by name from the given input stream and reflectively instantiates it. <p>This method will use {@link DataInputView#readUTF()} to read the class name, and then attempt to load the class from the given ClassLoader. @param in The stream to read the class name from. @param cl The class loader to resolve the class. @throws IOException Thrown, if the class name could not be read, the class could not be found.
[ "Loads", "a", "class", "by", "name", "from", "the", "given", "input", "stream", "and", "reflectively", "instantiates", "it", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/InstantiationUtil.java#L678-L682
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/MutableClock.java
MutableClock.withZone
@Override public MutableClock withZone(ZoneId zone) { """ Returns a {@code MutableClock} that uses the specified time-zone and that has shared updates with this clock. <p> Two clocks with shared updates always have the same instant, and all updates applied to either clock affect both clocks. @param zone the time-zone to use for the returned clock, not null @return a view of this clock in the specified time-zone, not null """ Objects.requireNonNull(zone, "zone"); if (zone.equals(this.zone)) { return this; } return new MutableClock(instantHolder, zone); }
java
@Override public MutableClock withZone(ZoneId zone) { Objects.requireNonNull(zone, "zone"); if (zone.equals(this.zone)) { return this; } return new MutableClock(instantHolder, zone); }
[ "@", "Override", "public", "MutableClock", "withZone", "(", "ZoneId", "zone", ")", "{", "Objects", ".", "requireNonNull", "(", "zone", ",", "\"zone\"", ")", ";", "if", "(", "zone", ".", "equals", "(", "this", ".", "zone", ")", ")", "{", "return", "this", ";", "}", "return", "new", "MutableClock", "(", "instantHolder", ",", "zone", ")", ";", "}" ]
Returns a {@code MutableClock} that uses the specified time-zone and that has shared updates with this clock. <p> Two clocks with shared updates always have the same instant, and all updates applied to either clock affect both clocks. @param zone the time-zone to use for the returned clock, not null @return a view of this clock in the specified time-zone, not null
[ "Returns", "a", "{", "@code", "MutableClock", "}", "that", "uses", "the", "specified", "time", "-", "zone", "and", "that", "has", "shared", "updates", "with", "this", "clock", ".", "<p", ">", "Two", "clocks", "with", "shared", "updates", "always", "have", "the", "same", "instant", "and", "all", "updates", "applied", "to", "either", "clock", "affect", "both", "clocks", "." ]
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/MutableClock.java#L291-L298
awltech/org.parallelj
parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/loop/KWhileLoop.java
KWhileLoop.complete
private void complete(KSplit split, KCall call) { """ Called at the end of a KWhileLoop @param split @param call @return void """ reset(call.getProcess()); split.split(call); }
java
private void complete(KSplit split, KCall call) { reset(call.getProcess()); split.split(call); }
[ "private", "void", "complete", "(", "KSplit", "split", ",", "KCall", "call", ")", "{", "reset", "(", "call", ".", "getProcess", "(", ")", ")", ";", "split", ".", "split", "(", "call", ")", ";", "}" ]
Called at the end of a KWhileLoop @param split @param call @return void
[ "Called", "at", "the", "end", "of", "a", "KWhileLoop" ]
train
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/loop/KWhileLoop.java#L145-L148
gwtplus/google-gin
src/main/java/com/google/gwt/inject/rebind/util/GuiceUtil.java
GuiceUtil.isOptional
public boolean isOptional(MemberLiteral<?, ?> member) { """ Returns true if the passed method has an {@literal @}{@code Inject} annotation and the injection is marked as optional ( {@literal @}{@code Inject(optional = true)}). Note that {@link javax.inject.Inject} does not have an optional parameter and therefore cannot be optional. @param member method to be checked @return true if method is injected optionally """ Inject annotation = member.getAnnotation(Inject.class); return annotation != null && annotation.optional(); }
java
public boolean isOptional(MemberLiteral<?, ?> member) { Inject annotation = member.getAnnotation(Inject.class); return annotation != null && annotation.optional(); }
[ "public", "boolean", "isOptional", "(", "MemberLiteral", "<", "?", ",", "?", ">", "member", ")", "{", "Inject", "annotation", "=", "member", ".", "getAnnotation", "(", "Inject", ".", "class", ")", ";", "return", "annotation", "!=", "null", "&&", "annotation", ".", "optional", "(", ")", ";", "}" ]
Returns true if the passed method has an {@literal @}{@code Inject} annotation and the injection is marked as optional ( {@literal @}{@code Inject(optional = true)}). Note that {@link javax.inject.Inject} does not have an optional parameter and therefore cannot be optional. @param member method to be checked @return true if method is injected optionally
[ "Returns", "true", "if", "the", "passed", "method", "has", "an", "{", "@literal", "@", "}", "{", "@code", "Inject", "}", "annotation", "and", "the", "injection", "is", "marked", "as", "optional", "(", "{", "@literal", "@", "}", "{", "@code", "Inject", "(", "optional", "=", "true", ")", "}", ")", "." ]
train
https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/util/GuiceUtil.java#L122-L125
logic-ng/LogicNG
src/main/java/org/logicng/formulas/FormulaFactory.java
FormulaFactory.containsComplement
private static boolean containsComplement(final LinkedHashSet<Formula> formulas, final Formula f) { """ Returns {@code true} if a given list of formulas contains the negation of a given formula, {@code false} otherwise. @param formulas the list of formulas @param f the formula @return {@code true} if a given list of formulas contains a given formula, {@code false} otherwise """ return formulas.contains(f.negate()); }
java
private static boolean containsComplement(final LinkedHashSet<Formula> formulas, final Formula f) { return formulas.contains(f.negate()); }
[ "private", "static", "boolean", "containsComplement", "(", "final", "LinkedHashSet", "<", "Formula", ">", "formulas", ",", "final", "Formula", "f", ")", "{", "return", "formulas", ".", "contains", "(", "f", ".", "negate", "(", ")", ")", ";", "}" ]
Returns {@code true} if a given list of formulas contains the negation of a given formula, {@code false} otherwise. @param formulas the list of formulas @param f the formula @return {@code true} if a given list of formulas contains a given formula, {@code false} otherwise
[ "Returns", "{" ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/FormulaFactory.java#L167-L169
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategy.java
SizeTieredCompactionStrategy.trimToThresholdWithHotness
@VisibleForTesting static Pair<List<SSTableReader>, Double> trimToThresholdWithHotness(List<SSTableReader> bucket, int maxThreshold) { """ Returns a (bucket, hotness) pair or null if there were not enough sstables in the bucket to meet minThreshold. If there are more than maxThreshold sstables, the coldest sstables will be trimmed to meet the threshold. """ // Sort by sstable hotness (descending). We first build a map because the hotness may change during the sort. final Map<SSTableReader, Double> hotnessSnapshot = getHotnessMap(bucket); Collections.sort(bucket, new Comparator<SSTableReader>() { public int compare(SSTableReader o1, SSTableReader o2) { return -1 * Double.compare(hotnessSnapshot.get(o1), hotnessSnapshot.get(o2)); } }); // and then trim the coldest sstables off the end to meet the maxThreshold List<SSTableReader> prunedBucket = bucket.subList(0, Math.min(bucket.size(), maxThreshold)); // bucket hotness is the sum of the hotness of all sstable members double bucketHotness = 0.0; for (SSTableReader sstr : prunedBucket) bucketHotness += hotness(sstr); return Pair.create(prunedBucket, bucketHotness); }
java
@VisibleForTesting static Pair<List<SSTableReader>, Double> trimToThresholdWithHotness(List<SSTableReader> bucket, int maxThreshold) { // Sort by sstable hotness (descending). We first build a map because the hotness may change during the sort. final Map<SSTableReader, Double> hotnessSnapshot = getHotnessMap(bucket); Collections.sort(bucket, new Comparator<SSTableReader>() { public int compare(SSTableReader o1, SSTableReader o2) { return -1 * Double.compare(hotnessSnapshot.get(o1), hotnessSnapshot.get(o2)); } }); // and then trim the coldest sstables off the end to meet the maxThreshold List<SSTableReader> prunedBucket = bucket.subList(0, Math.min(bucket.size(), maxThreshold)); // bucket hotness is the sum of the hotness of all sstable members double bucketHotness = 0.0; for (SSTableReader sstr : prunedBucket) bucketHotness += hotness(sstr); return Pair.create(prunedBucket, bucketHotness); }
[ "@", "VisibleForTesting", "static", "Pair", "<", "List", "<", "SSTableReader", ">", ",", "Double", ">", "trimToThresholdWithHotness", "(", "List", "<", "SSTableReader", ">", "bucket", ",", "int", "maxThreshold", ")", "{", "// Sort by sstable hotness (descending). We first build a map because the hotness may change during the sort.", "final", "Map", "<", "SSTableReader", ",", "Double", ">", "hotnessSnapshot", "=", "getHotnessMap", "(", "bucket", ")", ";", "Collections", ".", "sort", "(", "bucket", ",", "new", "Comparator", "<", "SSTableReader", ">", "(", ")", "{", "public", "int", "compare", "(", "SSTableReader", "o1", ",", "SSTableReader", "o2", ")", "{", "return", "-", "1", "*", "Double", ".", "compare", "(", "hotnessSnapshot", ".", "get", "(", "o1", ")", ",", "hotnessSnapshot", ".", "get", "(", "o2", ")", ")", ";", "}", "}", ")", ";", "// and then trim the coldest sstables off the end to meet the maxThreshold", "List", "<", "SSTableReader", ">", "prunedBucket", "=", "bucket", ".", "subList", "(", "0", ",", "Math", ".", "min", "(", "bucket", ".", "size", "(", ")", ",", "maxThreshold", ")", ")", ";", "// bucket hotness is the sum of the hotness of all sstable members", "double", "bucketHotness", "=", "0.0", ";", "for", "(", "SSTableReader", "sstr", ":", "prunedBucket", ")", "bucketHotness", "+=", "hotness", "(", "sstr", ")", ";", "return", "Pair", ".", "create", "(", "prunedBucket", ",", "bucketHotness", ")", ";", "}" ]
Returns a (bucket, hotness) pair or null if there were not enough sstables in the bucket to meet minThreshold. If there are more than maxThreshold sstables, the coldest sstables will be trimmed to meet the threshold.
[ "Returns", "a", "(", "bucket", "hotness", ")", "pair", "or", "null", "if", "there", "were", "not", "enough", "sstables", "in", "the", "bucket", "to", "meet", "minThreshold", ".", "If", "there", "are", "more", "than", "maxThreshold", "sstables", "the", "coldest", "sstables", "will", "be", "trimmed", "to", "meet", "the", "threshold", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategy.java#L137-L159
alkacon/opencms-core
src/org/opencms/main/CmsSessionManager.java
CmsSessionManager.killSession
public void killSession(CmsObject cms, CmsUUID sessionid) throws CmsException { """ Destroys a session given the session id. Only allowed for users which have the "account manager" role.<p> @param cms the current CMS context @param sessionid the session id @throws CmsException if something goes wrong """ OpenCms.getRoleManager().checkRole(cms, CmsRole.ACCOUNT_MANAGER); m_sessionStorageProvider.remove(sessionid); }
java
public void killSession(CmsObject cms, CmsUUID sessionid) throws CmsException { OpenCms.getRoleManager().checkRole(cms, CmsRole.ACCOUNT_MANAGER); m_sessionStorageProvider.remove(sessionid); }
[ "public", "void", "killSession", "(", "CmsObject", "cms", ",", "CmsUUID", "sessionid", ")", "throws", "CmsException", "{", "OpenCms", ".", "getRoleManager", "(", ")", ".", "checkRole", "(", "cms", ",", "CmsRole", ".", "ACCOUNT_MANAGER", ")", ";", "m_sessionStorageProvider", ".", "remove", "(", "sessionid", ")", ";", "}" ]
Destroys a session given the session id. Only allowed for users which have the "account manager" role.<p> @param cms the current CMS context @param sessionid the session id @throws CmsException if something goes wrong
[ "Destroys", "a", "session", "given", "the", "session", "id", ".", "Only", "allowed", "for", "users", "which", "have", "the", "account", "manager", "role", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsSessionManager.java#L322-L327
jxnet/Jxnet
jxnet-core/src/main/java/com/ardikars/jxnet/PcapPktHdr.java
PcapPktHdr.newInstance
public static PcapPktHdr newInstance(final int caplen, final int len, final int tvSec, final long tvUsec) { """ Create new PcapPktHdr instance. @param caplen capture length. @param len length. @param tvSec tv_sec. @param tvUsec tv_usec. @return returns PcapPktHdr. """ return new PcapPktHdr(caplen, len, tvSec, tvUsec); }
java
public static PcapPktHdr newInstance(final int caplen, final int len, final int tvSec, final long tvUsec) { return new PcapPktHdr(caplen, len, tvSec, tvUsec); }
[ "public", "static", "PcapPktHdr", "newInstance", "(", "final", "int", "caplen", ",", "final", "int", "len", ",", "final", "int", "tvSec", ",", "final", "long", "tvUsec", ")", "{", "return", "new", "PcapPktHdr", "(", "caplen", ",", "len", ",", "tvSec", ",", "tvUsec", ")", ";", "}" ]
Create new PcapPktHdr instance. @param caplen capture length. @param len length. @param tvSec tv_sec. @param tvUsec tv_usec. @return returns PcapPktHdr.
[ "Create", "new", "PcapPktHdr", "instance", "." ]
train
https://github.com/jxnet/Jxnet/blob/3ef28eb83c149ff134df1841d12bcbea3d8fe163/jxnet-core/src/main/java/com/ardikars/jxnet/PcapPktHdr.java#L67-L69
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java
HttpRequestFactory.buildHeadRequest
public HttpRequest buildHeadRequest(GenericUrl url) throws IOException { """ Builds a {@code HEAD} request for the given URL. @param url HTTP request URL or {@code null} for none @return new HTTP request """ return buildRequest(HttpMethods.HEAD, url, null); }
java
public HttpRequest buildHeadRequest(GenericUrl url) throws IOException { return buildRequest(HttpMethods.HEAD, url, null); }
[ "public", "HttpRequest", "buildHeadRequest", "(", "GenericUrl", "url", ")", "throws", "IOException", "{", "return", "buildRequest", "(", "HttpMethods", ".", "HEAD", ",", "url", ",", "null", ")", ";", "}" ]
Builds a {@code HEAD} request for the given URL. @param url HTTP request URL or {@code null} for none @return new HTTP request
[ "Builds", "a", "{", "@code", "HEAD", "}", "request", "for", "the", "given", "URL", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java#L159-L161
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/markup/AnnotatedTextBuilder.java
AnnotatedTextBuilder.addMarkup
public AnnotatedTextBuilder addMarkup(String markup, String interpretAs) { """ Add a markup text snippet like {@code <b attr='something'>} or {@code <div>}. These parts will be ignored by LanguageTool when using {@link org.languagetool.JLanguageTool#check(AnnotatedText)}. @param interpretAs A string that will be used by the checker instead of the markup. This is usually whitespace, e.g. {@code \n\n} for {@code <p>} """ parts.add(new TextPart(markup, TextPart.Type.MARKUP)); parts.add(new TextPart(interpretAs, TextPart.Type.FAKE_CONTENT)); return this; }
java
public AnnotatedTextBuilder addMarkup(String markup, String interpretAs) { parts.add(new TextPart(markup, TextPart.Type.MARKUP)); parts.add(new TextPart(interpretAs, TextPart.Type.FAKE_CONTENT)); return this; }
[ "public", "AnnotatedTextBuilder", "addMarkup", "(", "String", "markup", ",", "String", "interpretAs", ")", "{", "parts", ".", "add", "(", "new", "TextPart", "(", "markup", ",", "TextPart", ".", "Type", ".", "MARKUP", ")", ")", ";", "parts", ".", "add", "(", "new", "TextPart", "(", "interpretAs", ",", "TextPart", ".", "Type", ".", "FAKE_CONTENT", ")", ")", ";", "return", "this", ";", "}" ]
Add a markup text snippet like {@code <b attr='something'>} or {@code <div>}. These parts will be ignored by LanguageTool when using {@link org.languagetool.JLanguageTool#check(AnnotatedText)}. @param interpretAs A string that will be used by the checker instead of the markup. This is usually whitespace, e.g. {@code \n\n} for {@code <p>}
[ "Add", "a", "markup", "text", "snippet", "like", "{" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/markup/AnnotatedTextBuilder.java#L104-L108
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/system/systemgroup_binding.java
systemgroup_binding.get
public static systemgroup_binding get(nitro_service service, String groupname) throws Exception { """ Use this API to fetch systemgroup_binding resource of given name . """ systemgroup_binding obj = new systemgroup_binding(); obj.set_groupname(groupname); systemgroup_binding response = (systemgroup_binding) obj.get_resource(service); return response; }
java
public static systemgroup_binding get(nitro_service service, String groupname) throws Exception{ systemgroup_binding obj = new systemgroup_binding(); obj.set_groupname(groupname); systemgroup_binding response = (systemgroup_binding) obj.get_resource(service); return response; }
[ "public", "static", "systemgroup_binding", "get", "(", "nitro_service", "service", ",", "String", "groupname", ")", "throws", "Exception", "{", "systemgroup_binding", "obj", "=", "new", "systemgroup_binding", "(", ")", ";", "obj", ".", "set_groupname", "(", "groupname", ")", ";", "systemgroup_binding", "response", "=", "(", "systemgroup_binding", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch systemgroup_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "systemgroup_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/system/systemgroup_binding.java#L114-L119
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java
TitlePaneMenuButtonPainter.paintMenu
private void paintMenu(Graphics2D g, JComponent c, int width, int height, ButtonColors colors) { """ Paint the button using the specified colors. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component. @param colors the color set to use to paint the button. """ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g.setColor(colors.top); g.drawLine(0, 0, width - 2, 0); g.setColor(colors.leftOuter); g.drawLine(0, 0, 0, height - 4); g.setColor(colors.leftInner); g.drawLine(1, 1, 1, height - 4); g.drawLine(2, height - 3, 2, height - 3); Shape s = decodeInterior(width, height); g.setColor(colors.interior); g.fill(s); s = decodeEdge(width, height); g.setColor(colors.edge); g.draw(s); g.setColor(colors.edgeShade); g.drawLine(2, height - 2, 2, height - 2); g.drawLine(1, height - 3, 1, height - 3); g.drawLine(0, height - 4, 0, height - 4); s = decodeShadow(width, height); g.setColor(colors.shadow); g.draw(s); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); s = decodeMarkInterior(width, height); g.setColor(colors.markInterior); g.fill(s); s = decodeMarkBorder(width, height); g.setColor(colors.markBorder); g.draw(s); }
java
private void paintMenu(Graphics2D g, JComponent c, int width, int height, ButtonColors colors) { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g.setColor(colors.top); g.drawLine(0, 0, width - 2, 0); g.setColor(colors.leftOuter); g.drawLine(0, 0, 0, height - 4); g.setColor(colors.leftInner); g.drawLine(1, 1, 1, height - 4); g.drawLine(2, height - 3, 2, height - 3); Shape s = decodeInterior(width, height); g.setColor(colors.interior); g.fill(s); s = decodeEdge(width, height); g.setColor(colors.edge); g.draw(s); g.setColor(colors.edgeShade); g.drawLine(2, height - 2, 2, height - 2); g.drawLine(1, height - 3, 1, height - 3); g.drawLine(0, height - 4, 0, height - 4); s = decodeShadow(width, height); g.setColor(colors.shadow); g.draw(s); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); s = decodeMarkInterior(width, height); g.setColor(colors.markInterior); g.fill(s); s = decodeMarkBorder(width, height); g.setColor(colors.markBorder); g.draw(s); }
[ "private", "void", "paintMenu", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ",", "ButtonColors", "colors", ")", "{", "g", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_ANTIALIASING", ",", "RenderingHints", ".", "VALUE_ANTIALIAS_OFF", ")", ";", "g", ".", "setColor", "(", "colors", ".", "top", ")", ";", "g", ".", "drawLine", "(", "0", ",", "0", ",", "width", "-", "2", ",", "0", ")", ";", "g", ".", "setColor", "(", "colors", ".", "leftOuter", ")", ";", "g", ".", "drawLine", "(", "0", ",", "0", ",", "0", ",", "height", "-", "4", ")", ";", "g", ".", "setColor", "(", "colors", ".", "leftInner", ")", ";", "g", ".", "drawLine", "(", "1", ",", "1", ",", "1", ",", "height", "-", "4", ")", ";", "g", ".", "drawLine", "(", "2", ",", "height", "-", "3", ",", "2", ",", "height", "-", "3", ")", ";", "Shape", "s", "=", "decodeInterior", "(", "width", ",", "height", ")", ";", "g", ".", "setColor", "(", "colors", ".", "interior", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "s", "=", "decodeEdge", "(", "width", ",", "height", ")", ";", "g", ".", "setColor", "(", "colors", ".", "edge", ")", ";", "g", ".", "draw", "(", "s", ")", ";", "g", ".", "setColor", "(", "colors", ".", "edgeShade", ")", ";", "g", ".", "drawLine", "(", "2", ",", "height", "-", "2", ",", "2", ",", "height", "-", "2", ")", ";", "g", ".", "drawLine", "(", "1", ",", "height", "-", "3", ",", "1", ",", "height", "-", "3", ")", ";", "g", ".", "drawLine", "(", "0", ",", "height", "-", "4", ",", "0", ",", "height", "-", "4", ")", ";", "s", "=", "decodeShadow", "(", "width", ",", "height", ")", ";", "g", ".", "setColor", "(", "colors", ".", "shadow", ")", ";", "g", ".", "draw", "(", "s", ")", ";", "g", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_ANTIALIASING", ",", "RenderingHints", ".", "VALUE_ANTIALIAS_ON", ")", ";", "s", "=", "decodeMarkInterior", "(", "width", ",", "height", ")", ";", "g", ".", "setColor", "(", "colors", ".", "markInterior", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "s", "=", "decodeMarkBorder", "(", "width", ",", "height", ")", ";", "g", ".", "setColor", "(", "colors", ".", "markBorder", ")", ";", "g", ".", "draw", "(", "s", ")", ";", "}" ]
Paint the button using the specified colors. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component. @param colors the color set to use to paint the button.
[ "Paint", "the", "button", "using", "the", "specified", "colors", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java#L147-L187
xcesco/kripton
kripton-shared-preferences/src/main/java/com/abubusoft/kripton/common/PrefsTypeAdapterUtils.java
PrefsTypeAdapterUtils.toJava
public static <D, J> J toJava(Class<? extends PreferenceTypeAdapter<J, D>> clazz, D value) { """ To java. @param <D> the generic type @param <J> the generic type @param clazz the clazz @param value the value @return the j """ @SuppressWarnings("unchecked") PreferenceTypeAdapter<J, D> adapter = cache.get(clazz); if (adapter == null) { adapter = generateAdapter(clazz); } return adapter.toJava(value); }
java
public static <D, J> J toJava(Class<? extends PreferenceTypeAdapter<J, D>> clazz, D value) { @SuppressWarnings("unchecked") PreferenceTypeAdapter<J, D> adapter = cache.get(clazz); if (adapter == null) { adapter = generateAdapter(clazz); } return adapter.toJava(value); }
[ "public", "static", "<", "D", ",", "J", ">", "J", "toJava", "(", "Class", "<", "?", "extends", "PreferenceTypeAdapter", "<", "J", ",", "D", ">", ">", "clazz", ",", "D", "value", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "PreferenceTypeAdapter", "<", "J", ",", "D", ">", "adapter", "=", "cache", ".", "get", "(", "clazz", ")", ";", "if", "(", "adapter", "==", "null", ")", "{", "adapter", "=", "generateAdapter", "(", "clazz", ")", ";", "}", "return", "adapter", ".", "toJava", "(", "value", ")", ";", "}" ]
To java. @param <D> the generic type @param <J> the generic type @param clazz the clazz @param value the value @return the j
[ "To", "java", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-shared-preferences/src/main/java/com/abubusoft/kripton/common/PrefsTypeAdapterUtils.java#L46-L55
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_protocol_GET
public OvhExchangeServiceProtocol organizationName_service_exchangeService_protocol_GET(String organizationName, String exchangeService) throws IOException { """ Get this object properties REST: GET /email/exchange/{organizationName}/service/{exchangeService}/protocol @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service """ String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/protocol"; StringBuilder sb = path(qPath, organizationName, exchangeService); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhExchangeServiceProtocol.class); }
java
public OvhExchangeServiceProtocol organizationName_service_exchangeService_protocol_GET(String organizationName, String exchangeService) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/protocol"; StringBuilder sb = path(qPath, organizationName, exchangeService); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhExchangeServiceProtocol.class); }
[ "public", "OvhExchangeServiceProtocol", "organizationName_service_exchangeService_protocol_GET", "(", "String", "organizationName", ",", "String", "exchangeService", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/exchange/{organizationName}/service/{exchangeService}/protocol\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "organizationName", ",", "exchangeService", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhExchangeServiceProtocol", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /email/exchange/{organizationName}/service/{exchangeService}/protocol @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L2282-L2287
hector-client/hector
core/src/main/java/me/prettyprint/cassandra/model/MutatorImpl.java
MutatorImpl.addSubDelete
public <SN,N,V> Mutator<K> addSubDelete(K key, String cf, HSuperColumn<SN,N,V> sc) { """ Deletes the columns defined in the HSuperColumn. If there are no HColumns attached, we delete the whole thing. """ return addSubDelete(key, cf, sc, keyspace.createClock()); }
java
public <SN,N,V> Mutator<K> addSubDelete(K key, String cf, HSuperColumn<SN,N,V> sc) { return addSubDelete(key, cf, sc, keyspace.createClock()); }
[ "public", "<", "SN", ",", "N", ",", "V", ">", "Mutator", "<", "K", ">", "addSubDelete", "(", "K", "key", ",", "String", "cf", ",", "HSuperColumn", "<", "SN", ",", "N", ",", "V", ">", "sc", ")", "{", "return", "addSubDelete", "(", "key", ",", "cf", ",", "sc", ",", "keyspace", ".", "createClock", "(", ")", ")", ";", "}" ]
Deletes the columns defined in the HSuperColumn. If there are no HColumns attached, we delete the whole thing.
[ "Deletes", "the", "columns", "defined", "in", "the", "HSuperColumn", ".", "If", "there", "are", "no", "HColumns", "attached", "we", "delete", "the", "whole", "thing", "." ]
train
https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/cassandra/model/MutatorImpl.java#L149-L151
lastaflute/lastaflute
src/main/java/org/lastaflute/core/message/UserMessages.java
UserMessages.saveSuccessAttribute
public void saveSuccessAttribute(String key, Object value) { """ Save validation success attribute, derived in validation process, e.g. selected data, <br> to avoid duplicate database access between validation and main logic. <pre> String <span style="color: #553000">keyOfProduct</span> = Product.<span style="color: #70226C">class</span>.getName(); ValidationSuccess <span style="color: #553000">success</span> = validate(<span style="color: #553000">form</span>, <span style="color: #553000">messages</span> <span style="font-size: 120%">-</span>&gt;</span> { ... selectProduct().ifPresent(<span style="color: #553000">product</span> <span style="font-size: 120%">-</span>&gt;</span> {}, () <span style="font-size: 120%">-</span>&gt;</span> { <span style="color: #553000">messages</span>.<span style="color: #CC4747">saveSuccessData</span>(<span style="color: #553000">keyOfProduct</span>, <span style="color: #553000">product</span>); }).orElse(() <span style="font-size: 120%">-</span>&gt;</span> {}, () <span style="font-size: 120%">-</span>&gt;</span> { <span style="color: #553000">messages</span>.addConstraint...(); }); }, () <span style="font-size: 120%">-</span>&gt;</span> { <span style="color: #70226C">return</span> asHtml(path_Product_ProductListJsp); }); <span style="color: #553000">success</span>.<span style="color: #994747">getAttribute</span>(keyOfProduct).alwaysPresent(product <span style="font-size: 120%">-</span>&gt;</span> { ... }); </pre> @param key The string key of the success attribute. (NotNull) @param value The value of success attribute. (NotNull) """ assertArgumentNotNull("key", key); assertArgumentNotNull("value", value); assertLocked(); if (successAttributeMap == null) { successAttributeMap = new LinkedHashMap<String, Object>(4); } successAttributeMap.put(key, value); }
java
public void saveSuccessAttribute(String key, Object value) { assertArgumentNotNull("key", key); assertArgumentNotNull("value", value); assertLocked(); if (successAttributeMap == null) { successAttributeMap = new LinkedHashMap<String, Object>(4); } successAttributeMap.put(key, value); }
[ "public", "void", "saveSuccessAttribute", "(", "String", "key", ",", "Object", "value", ")", "{", "assertArgumentNotNull", "(", "\"key\"", ",", "key", ")", ";", "assertArgumentNotNull", "(", "\"value\"", ",", "value", ")", ";", "assertLocked", "(", ")", ";", "if", "(", "successAttributeMap", "==", "null", ")", "{", "successAttributeMap", "=", "new", "LinkedHashMap", "<", "String", ",", "Object", ">", "(", "4", ")", ";", "}", "successAttributeMap", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Save validation success attribute, derived in validation process, e.g. selected data, <br> to avoid duplicate database access between validation and main logic. <pre> String <span style="color: #553000">keyOfProduct</span> = Product.<span style="color: #70226C">class</span>.getName(); ValidationSuccess <span style="color: #553000">success</span> = validate(<span style="color: #553000">form</span>, <span style="color: #553000">messages</span> <span style="font-size: 120%">-</span>&gt;</span> { ... selectProduct().ifPresent(<span style="color: #553000">product</span> <span style="font-size: 120%">-</span>&gt;</span> {}, () <span style="font-size: 120%">-</span>&gt;</span> { <span style="color: #553000">messages</span>.<span style="color: #CC4747">saveSuccessData</span>(<span style="color: #553000">keyOfProduct</span>, <span style="color: #553000">product</span>); }).orElse(() <span style="font-size: 120%">-</span>&gt;</span> {}, () <span style="font-size: 120%">-</span>&gt;</span> { <span style="color: #553000">messages</span>.addConstraint...(); }); }, () <span style="font-size: 120%">-</span>&gt;</span> { <span style="color: #70226C">return</span> asHtml(path_Product_ProductListJsp); }); <span style="color: #553000">success</span>.<span style="color: #994747">getAttribute</span>(keyOfProduct).alwaysPresent(product <span style="font-size: 120%">-</span>&gt;</span> { ... }); </pre> @param key The string key of the success attribute. (NotNull) @param value The value of success attribute. (NotNull)
[ "Save", "validation", "success", "attribute", "derived", "in", "validation", "process", "e", ".", "g", ".", "selected", "data", "<br", ">", "to", "avoid", "duplicate", "database", "access", "between", "validation", "and", "main", "logic", ".", "<pre", ">", "String", "<span", "style", "=", "color", ":", "#553000", ">", "keyOfProduct<", "/", "span", ">", "=", "Product", ".", "<span", "style", "=", "color", ":", "#70226C", ">", "class<", "/", "span", ">", ".", "getName", "()", ";", "ValidationSuccess", "<span", "style", "=", "color", ":", "#553000", ">", "success<", "/", "span", ">", "=", "validate", "(", "<span", "style", "=", "color", ":", "#553000", ">", "form<", "/", "span", ">", "<span", "style", "=", "color", ":", "#553000", ">", "messages<", "/", "span", ">", "<span", "style", "=", "font", "-", "size", ":", "120%", ">", "-", "<", "/", "span", ">", "&gt", ";", "<", "/", "span", ">", "{", "...", "selectProduct", "()", ".", "ifPresent", "(", "<span", "style", "=", "color", ":", "#553000", ">", "product<", "/", "span", ">", "<span", "style", "=", "font", "-", "size", ":", "120%", ">", "-", "<", "/", "span", ">", "&gt", ";", "<", "/", "span", ">", "{}", "()", "<span", "style", "=", "font", "-", "size", ":", "120%", ">", "-", "<", "/", "span", ">", "&gt", ";", "<", "/", "span", ">", "{", "<span", "style", "=", "color", ":", "#553000", ">", "messages<", "/", "span", ">", ".", "<span", "style", "=", "color", ":", "#CC4747", ">", "saveSuccessData<", "/", "span", ">", "(", "<span", "style", "=", "color", ":", "#553000", ">", "keyOfProduct<", "/", "span", ">", "<span", "style", "=", "color", ":", "#553000", ">", "product<", "/", "span", ">", ")", ";", "}", ")", ".", "orElse", "((", ")", "<span", "style", "=", "font", "-", "size", ":", "120%", ">", "-", "<", "/", "span", ">", "&gt", ";", "<", "/", "span", ">", "{}", "()", "<span", "style", "=", "font", "-", "size", ":", "120%", ">", "-", "<", "/", "span", ">", "&gt", ";", "<", "/", "span", ">", "{", "<span", "style", "=", "color", ":", "#553000", ">", "messages<", "/", "span", ">", ".", "addConstraint", "...", "()", ";", "}", ")", ";", "}", "()", "<span", "style", "=", "font", "-", "size", ":", "120%", ">", "-", "<", "/", "span", ">", "&gt", ";", "<", "/", "span", ">", "{", "<span", "style", "=", "color", ":", "#70226C", ">", "return<", "/", "span", ">", "asHtml", "(", "path_Product_ProductListJsp", ")", ";", "}", ")", ";", "<span", "style", "=", "color", ":", "#553000", ">", "success<", "/", "span", ">", ".", "<span", "style", "=", "color", ":", "#994747", ">", "getAttribute<", "/", "span", ">", "(", "keyOfProduct", ")", ".", "alwaysPresent", "(", "product", "<span", "style", "=", "font", "-", "size", ":", "120%", ">", "-", "<", "/", "span", ">", "&gt", ";", "<", "/", "span", ">", "{", "...", "}", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/core/message/UserMessages.java#L324-L332
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/buffer/BufferFastAggregation.java
BufferFastAggregation.priorityqueue_xor
public static MutableRoaringBitmap priorityqueue_xor(ImmutableRoaringBitmap... bitmaps) { """ Uses a priority queue to compute the xor aggregate. This function runs in linearithmic (O(n log n)) time with respect to the number of bitmaps. @param bitmaps input bitmaps @return aggregated bitmap @see #horizontal_xor(ImmutableRoaringBitmap...) """ // code could be faster, see priorityqueue_or if (bitmaps.length < 2) { throw new IllegalArgumentException("Expecting at least 2 bitmaps"); } final PriorityQueue<ImmutableRoaringBitmap> pq = new PriorityQueue<>(bitmaps.length, new Comparator<ImmutableRoaringBitmap>() { @Override public int compare(ImmutableRoaringBitmap a, ImmutableRoaringBitmap b) { return (int)(a.getLongSizeInBytes() - b.getLongSizeInBytes()); } }); Collections.addAll(pq, bitmaps); while (pq.size() > 1) { final ImmutableRoaringBitmap x1 = pq.poll(); final ImmutableRoaringBitmap x2 = pq.poll(); pq.add(ImmutableRoaringBitmap.xor(x1, x2)); } return (MutableRoaringBitmap) pq.poll(); }
java
public static MutableRoaringBitmap priorityqueue_xor(ImmutableRoaringBitmap... bitmaps) { // code could be faster, see priorityqueue_or if (bitmaps.length < 2) { throw new IllegalArgumentException("Expecting at least 2 bitmaps"); } final PriorityQueue<ImmutableRoaringBitmap> pq = new PriorityQueue<>(bitmaps.length, new Comparator<ImmutableRoaringBitmap>() { @Override public int compare(ImmutableRoaringBitmap a, ImmutableRoaringBitmap b) { return (int)(a.getLongSizeInBytes() - b.getLongSizeInBytes()); } }); Collections.addAll(pq, bitmaps); while (pq.size() > 1) { final ImmutableRoaringBitmap x1 = pq.poll(); final ImmutableRoaringBitmap x2 = pq.poll(); pq.add(ImmutableRoaringBitmap.xor(x1, x2)); } return (MutableRoaringBitmap) pq.poll(); }
[ "public", "static", "MutableRoaringBitmap", "priorityqueue_xor", "(", "ImmutableRoaringBitmap", "...", "bitmaps", ")", "{", "// code could be faster, see priorityqueue_or", "if", "(", "bitmaps", ".", "length", "<", "2", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Expecting at least 2 bitmaps\"", ")", ";", "}", "final", "PriorityQueue", "<", "ImmutableRoaringBitmap", ">", "pq", "=", "new", "PriorityQueue", "<>", "(", "bitmaps", ".", "length", ",", "new", "Comparator", "<", "ImmutableRoaringBitmap", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "ImmutableRoaringBitmap", "a", ",", "ImmutableRoaringBitmap", "b", ")", "{", "return", "(", "int", ")", "(", "a", ".", "getLongSizeInBytes", "(", ")", "-", "b", ".", "getLongSizeInBytes", "(", ")", ")", ";", "}", "}", ")", ";", "Collections", ".", "addAll", "(", "pq", ",", "bitmaps", ")", ";", "while", "(", "pq", ".", "size", "(", ")", ">", "1", ")", "{", "final", "ImmutableRoaringBitmap", "x1", "=", "pq", ".", "poll", "(", ")", ";", "final", "ImmutableRoaringBitmap", "x2", "=", "pq", ".", "poll", "(", ")", ";", "pq", ".", "add", "(", "ImmutableRoaringBitmap", ".", "xor", "(", "x1", ",", "x2", ")", ")", ";", "}", "return", "(", "MutableRoaringBitmap", ")", "pq", ".", "poll", "(", ")", ";", "}" ]
Uses a priority queue to compute the xor aggregate. This function runs in linearithmic (O(n log n)) time with respect to the number of bitmaps. @param bitmaps input bitmaps @return aggregated bitmap @see #horizontal_xor(ImmutableRoaringBitmap...)
[ "Uses", "a", "priority", "queue", "to", "compute", "the", "xor", "aggregate", "." ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/BufferFastAggregation.java#L583-L602
alkacon/opencms-core
src/org/opencms/importexport/CmsExport.java
CmsExport.exportOrgUnit
protected void exportOrgUnit(Element parent, CmsOrganizationalUnit orgunit) throws SAXException, CmsException { """ Exports one single organizational unit with all it's data.<p> @param parent the parent node to add the groups to @param orgunit the group to be exported @throws SAXException if something goes wrong processing the manifest.xml @throws CmsException if something goes wrong reading the data to export """ Element orgunitElement = parent.addElement(CmsImportVersion10.N_ORGUNIT); getSaxWriter().writeOpen(orgunitElement); Element name = orgunitElement.addElement(CmsImportVersion10.N_NAME).addText(orgunit.getName()); digestElement(orgunitElement, name); Element description = orgunitElement.addElement(CmsImportVersion10.N_DESCRIPTION).addCDATA( orgunit.getDescription()); digestElement(orgunitElement, description); Element flags = orgunitElement.addElement(CmsImportVersion10.N_FLAGS).addText( Integer.toString(orgunit.getFlags())); digestElement(orgunitElement, flags); Element resources = orgunitElement.addElement(CmsImportVersion10.N_RESOURCES); Iterator<CmsResource> it = OpenCms.getOrgUnitManager().getResourcesForOrganizationalUnit( getCms(), orgunit.getName()).iterator(); while (it.hasNext()) { CmsResource resource = it.next(); resources.addElement(CmsImportVersion10.N_RESOURCE).addText(resource.getRootPath()); } digestElement(orgunitElement, resources); getReport().println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0), I_CmsReport.FORMAT_OK); Element groupsElement = parent.addElement(CmsImportVersion10.N_GROUPS); getSaxWriter().writeOpen(groupsElement); exportGroups(groupsElement, orgunit); getSaxWriter().writeClose(groupsElement); Element usersElement = parent.addElement(CmsImportVersion10.N_USERS); getSaxWriter().writeOpen(usersElement); exportUsers(usersElement, orgunit); getSaxWriter().writeClose(usersElement); getSaxWriter().writeClose(orgunitElement); }
java
protected void exportOrgUnit(Element parent, CmsOrganizationalUnit orgunit) throws SAXException, CmsException { Element orgunitElement = parent.addElement(CmsImportVersion10.N_ORGUNIT); getSaxWriter().writeOpen(orgunitElement); Element name = orgunitElement.addElement(CmsImportVersion10.N_NAME).addText(orgunit.getName()); digestElement(orgunitElement, name); Element description = orgunitElement.addElement(CmsImportVersion10.N_DESCRIPTION).addCDATA( orgunit.getDescription()); digestElement(orgunitElement, description); Element flags = orgunitElement.addElement(CmsImportVersion10.N_FLAGS).addText( Integer.toString(orgunit.getFlags())); digestElement(orgunitElement, flags); Element resources = orgunitElement.addElement(CmsImportVersion10.N_RESOURCES); Iterator<CmsResource> it = OpenCms.getOrgUnitManager().getResourcesForOrganizationalUnit( getCms(), orgunit.getName()).iterator(); while (it.hasNext()) { CmsResource resource = it.next(); resources.addElement(CmsImportVersion10.N_RESOURCE).addText(resource.getRootPath()); } digestElement(orgunitElement, resources); getReport().println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0), I_CmsReport.FORMAT_OK); Element groupsElement = parent.addElement(CmsImportVersion10.N_GROUPS); getSaxWriter().writeOpen(groupsElement); exportGroups(groupsElement, orgunit); getSaxWriter().writeClose(groupsElement); Element usersElement = parent.addElement(CmsImportVersion10.N_USERS); getSaxWriter().writeOpen(usersElement); exportUsers(usersElement, orgunit); getSaxWriter().writeClose(usersElement); getSaxWriter().writeClose(orgunitElement); }
[ "protected", "void", "exportOrgUnit", "(", "Element", "parent", ",", "CmsOrganizationalUnit", "orgunit", ")", "throws", "SAXException", ",", "CmsException", "{", "Element", "orgunitElement", "=", "parent", ".", "addElement", "(", "CmsImportVersion10", ".", "N_ORGUNIT", ")", ";", "getSaxWriter", "(", ")", ".", "writeOpen", "(", "orgunitElement", ")", ";", "Element", "name", "=", "orgunitElement", ".", "addElement", "(", "CmsImportVersion10", ".", "N_NAME", ")", ".", "addText", "(", "orgunit", ".", "getName", "(", ")", ")", ";", "digestElement", "(", "orgunitElement", ",", "name", ")", ";", "Element", "description", "=", "orgunitElement", ".", "addElement", "(", "CmsImportVersion10", ".", "N_DESCRIPTION", ")", ".", "addCDATA", "(", "orgunit", ".", "getDescription", "(", ")", ")", ";", "digestElement", "(", "orgunitElement", ",", "description", ")", ";", "Element", "flags", "=", "orgunitElement", ".", "addElement", "(", "CmsImportVersion10", ".", "N_FLAGS", ")", ".", "addText", "(", "Integer", ".", "toString", "(", "orgunit", ".", "getFlags", "(", ")", ")", ")", ";", "digestElement", "(", "orgunitElement", ",", "flags", ")", ";", "Element", "resources", "=", "orgunitElement", ".", "addElement", "(", "CmsImportVersion10", ".", "N_RESOURCES", ")", ";", "Iterator", "<", "CmsResource", ">", "it", "=", "OpenCms", ".", "getOrgUnitManager", "(", ")", ".", "getResourcesForOrganizationalUnit", "(", "getCms", "(", ")", ",", "orgunit", ".", "getName", "(", ")", ")", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "CmsResource", "resource", "=", "it", ".", "next", "(", ")", ";", "resources", ".", "addElement", "(", "CmsImportVersion10", ".", "N_RESOURCE", ")", ".", "addText", "(", "resource", ".", "getRootPath", "(", ")", ")", ";", "}", "digestElement", "(", "orgunitElement", ",", "resources", ")", ";", "getReport", "(", ")", ".", "println", "(", "org", ".", "opencms", ".", "report", ".", "Messages", ".", "get", "(", ")", ".", "container", "(", "org", ".", "opencms", ".", "report", ".", "Messages", ".", "RPT_OK_0", ")", ",", "I_CmsReport", ".", "FORMAT_OK", ")", ";", "Element", "groupsElement", "=", "parent", ".", "addElement", "(", "CmsImportVersion10", ".", "N_GROUPS", ")", ";", "getSaxWriter", "(", ")", ".", "writeOpen", "(", "groupsElement", ")", ";", "exportGroups", "(", "groupsElement", ",", "orgunit", ")", ";", "getSaxWriter", "(", ")", ".", "writeClose", "(", "groupsElement", ")", ";", "Element", "usersElement", "=", "parent", ".", "addElement", "(", "CmsImportVersion10", ".", "N_USERS", ")", ";", "getSaxWriter", "(", ")", ".", "writeOpen", "(", "usersElement", ")", ";", "exportUsers", "(", "usersElement", ",", "orgunit", ")", ";", "getSaxWriter", "(", ")", ".", "writeClose", "(", "usersElement", ")", ";", "getSaxWriter", "(", ")", ".", "writeClose", "(", "orgunitElement", ")", ";", "}" ]
Exports one single organizational unit with all it's data.<p> @param parent the parent node to add the groups to @param orgunit the group to be exported @throws SAXException if something goes wrong processing the manifest.xml @throws CmsException if something goes wrong reading the data to export
[ "Exports", "one", "single", "organizational", "unit", "with", "all", "it", "s", "data", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsExport.java#L1021-L1061
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/storage/ConnectionPool.java
ConnectionPool.getTableCreatingConnection
public TableCreatingConnection getTableCreatingConnection() throws SQLException { """ Gets a TableCreatingConnection. <p> </p> This derives from the same pool, but wraps the Connection in an appropriate TableCreatingConnection before returning it. @return The next available Connection from the pool, wrapped as a TableCreatingException, or null if this ConnectionPool hasn't been configured with a DDLConverter (see constructor). @throws SQLException If there is any propblem in getting the SQL connection. """ if (ddlConverter == null) { return null; } else { Connection c = getReadWriteConnection(); return new TableCreatingConnection(c, ddlConverter); } }
java
public TableCreatingConnection getTableCreatingConnection() throws SQLException { if (ddlConverter == null) { return null; } else { Connection c = getReadWriteConnection(); return new TableCreatingConnection(c, ddlConverter); } }
[ "public", "TableCreatingConnection", "getTableCreatingConnection", "(", ")", "throws", "SQLException", "{", "if", "(", "ddlConverter", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "Connection", "c", "=", "getReadWriteConnection", "(", ")", ";", "return", "new", "TableCreatingConnection", "(", "c", ",", "ddlConverter", ")", ";", "}", "}" ]
Gets a TableCreatingConnection. <p> </p> This derives from the same pool, but wraps the Connection in an appropriate TableCreatingConnection before returning it. @return The next available Connection from the pool, wrapped as a TableCreatingException, or null if this ConnectionPool hasn't been configured with a DDLConverter (see constructor). @throws SQLException If there is any propblem in getting the SQL connection.
[ "Gets", "a", "TableCreatingConnection", ".", "<p", ">", "<", "/", "p", ">", "This", "derives", "from", "the", "same", "pool", "but", "wraps", "the", "Connection", "in", "an", "appropriate", "TableCreatingConnection", "before", "returning", "it", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/storage/ConnectionPool.java#L269-L277
lucasr/probe
library/src/main/java/org/lucasr/probe/ViewClassUtil.java
ViewClassUtil.findViewClass
static Class<?> findViewClass(Context context, String name) throws ClassNotFoundException { """ Tries to load class using a predefined list of class prefixes for Android views. """ if (name.indexOf('.') >= 0) { return loadViewClass(context, name); } for (String prefix : VIEW_CLASS_PREFIX_LIST) { try { return loadViewClass(context, prefix + name); } catch (ClassNotFoundException e) { continue; } } throw new ClassNotFoundException("Couldn't load View class for " + name); }
java
static Class<?> findViewClass(Context context, String name) throws ClassNotFoundException { if (name.indexOf('.') >= 0) { return loadViewClass(context, name); } for (String prefix : VIEW_CLASS_PREFIX_LIST) { try { return loadViewClass(context, prefix + name); } catch (ClassNotFoundException e) { continue; } } throw new ClassNotFoundException("Couldn't load View class for " + name); }
[ "static", "Class", "<", "?", ">", "findViewClass", "(", "Context", "context", ",", "String", "name", ")", "throws", "ClassNotFoundException", "{", "if", "(", "name", ".", "indexOf", "(", "'", "'", ")", ">=", "0", ")", "{", "return", "loadViewClass", "(", "context", ",", "name", ")", ";", "}", "for", "(", "String", "prefix", ":", "VIEW_CLASS_PREFIX_LIST", ")", "{", "try", "{", "return", "loadViewClass", "(", "context", ",", "prefix", "+", "name", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "continue", ";", "}", "}", "throw", "new", "ClassNotFoundException", "(", "\"Couldn't load View class for \"", "+", "name", ")", ";", "}" ]
Tries to load class using a predefined list of class prefixes for Android views.
[ "Tries", "to", "load", "class", "using", "a", "predefined", "list", "of", "class", "prefixes", "for", "Android", "views", "." ]
train
https://github.com/lucasr/probe/blob/cd15cc04383a1bf85de2f4c345d2018415b9ddc9/library/src/main/java/org/lucasr/probe/ViewClassUtil.java#L63-L78
JOML-CI/JOML
src/org/joml/Matrix3x2f.java
Matrix3x2f.shearY
public Matrix3x2f shearY(float xFactor, Matrix3x2f dest) { """ Apply shearing to this matrix by shearing along the Y axis using the X axis factor <code>xFactor</code>, and store the result in <code>dest</code>. @param xFactor the factor for the X component to shear along the Y axis @param dest will hold the result @return dest """ float nm00 = m00 + m10 * xFactor; float nm01 = m01 + m11 * xFactor; dest.m00 = nm00; dest.m01 = nm01; dest.m10 = m10; dest.m11 = m11; dest.m20 = m20; dest.m21 = m21; return dest; }
java
public Matrix3x2f shearY(float xFactor, Matrix3x2f dest) { float nm00 = m00 + m10 * xFactor; float nm01 = m01 + m11 * xFactor; dest.m00 = nm00; dest.m01 = nm01; dest.m10 = m10; dest.m11 = m11; dest.m20 = m20; dest.m21 = m21; return dest; }
[ "public", "Matrix3x2f", "shearY", "(", "float", "xFactor", ",", "Matrix3x2f", "dest", ")", "{", "float", "nm00", "=", "m00", "+", "m10", "*", "xFactor", ";", "float", "nm01", "=", "m01", "+", "m11", "*", "xFactor", ";", "dest", ".", "m00", "=", "nm00", ";", "dest", ".", "m01", "=", "nm01", ";", "dest", ".", "m10", "=", "m10", ";", "dest", ".", "m11", "=", "m11", ";", "dest", ".", "m20", "=", "m20", ";", "dest", ".", "m21", "=", "m21", ";", "return", "dest", ";", "}" ]
Apply shearing to this matrix by shearing along the Y axis using the X axis factor <code>xFactor</code>, and store the result in <code>dest</code>. @param xFactor the factor for the X component to shear along the Y axis @param dest will hold the result @return dest
[ "Apply", "shearing", "to", "this", "matrix", "by", "shearing", "along", "the", "Y", "axis", "using", "the", "X", "axis", "factor", "<code", ">", "xFactor<", "/", "code", ">", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", "code", ">", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2f.java#L2365-L2375
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java
SecureUtil.generateAlgorithm
public static String generateAlgorithm(AsymmetricAlgorithm asymmetricAlgorithm, DigestAlgorithm digestAlgorithm) { """ 生成算法,格式为XXXwithXXX @param asymmetricAlgorithm 非对称算法 @param digestAlgorithm 摘要算法 @return 算法 @since 4.4.1 """ final String digestPart = (null == digestAlgorithm) ? "NONE" : digestAlgorithm.name(); return StrUtil.format("{}with{}", digestPart, asymmetricAlgorithm.getValue()); }
java
public static String generateAlgorithm(AsymmetricAlgorithm asymmetricAlgorithm, DigestAlgorithm digestAlgorithm) { final String digestPart = (null == digestAlgorithm) ? "NONE" : digestAlgorithm.name(); return StrUtil.format("{}with{}", digestPart, asymmetricAlgorithm.getValue()); }
[ "public", "static", "String", "generateAlgorithm", "(", "AsymmetricAlgorithm", "asymmetricAlgorithm", ",", "DigestAlgorithm", "digestAlgorithm", ")", "{", "final", "String", "digestPart", "=", "(", "null", "==", "digestAlgorithm", ")", "?", "\"NONE\"", ":", "digestAlgorithm", ".", "name", "(", ")", ";", "return", "StrUtil", ".", "format", "(", "\"{}with{}\"", ",", "digestPart", ",", "asymmetricAlgorithm", ".", "getValue", "(", ")", ")", ";", "}" ]
生成算法,格式为XXXwithXXX @param asymmetricAlgorithm 非对称算法 @param digestAlgorithm 摘要算法 @return 算法 @since 4.4.1
[ "生成算法,格式为XXXwithXXX" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L277-L280
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/svg/inkscape/Util.java
Util.extractStyle
static String extractStyle(String style, String attribute) { """ Extract the style value from a Inkscape encoded string @param style The style string to be decoded @param attribute The style attribute to retrieve @return The value for the given attribute """ if (style == null) { return ""; } StringTokenizer tokens = new StringTokenizer(style,";"); while (tokens.hasMoreTokens()) { String token = tokens.nextToken(); String key = token.substring(0,token.indexOf(':')); if (key.equals(attribute)) { return token.substring(token.indexOf(':')+1); } } return ""; }
java
static String extractStyle(String style, String attribute) { if (style == null) { return ""; } StringTokenizer tokens = new StringTokenizer(style,";"); while (tokens.hasMoreTokens()) { String token = tokens.nextToken(); String key = token.substring(0,token.indexOf(':')); if (key.equals(attribute)) { return token.substring(token.indexOf(':')+1); } } return ""; }
[ "static", "String", "extractStyle", "(", "String", "style", ",", "String", "attribute", ")", "{", "if", "(", "style", "==", "null", ")", "{", "return", "\"\"", ";", "}", "StringTokenizer", "tokens", "=", "new", "StringTokenizer", "(", "style", ",", "\";\"", ")", ";", "while", "(", "tokens", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "token", "=", "tokens", ".", "nextToken", "(", ")", ";", "String", "key", "=", "token", ".", "substring", "(", "0", ",", "token", ".", "indexOf", "(", "'", "'", ")", ")", ";", "if", "(", "key", ".", "equals", "(", "attribute", ")", ")", "{", "return", "token", ".", "substring", "(", "token", ".", "indexOf", "(", "'", "'", ")", "+", "1", ")", ";", "}", "}", "return", "\"\"", ";", "}" ]
Extract the style value from a Inkscape encoded string @param style The style string to be decoded @param attribute The style attribute to retrieve @return The value for the given attribute
[ "Extract", "the", "style", "value", "from", "a", "Inkscape", "encoded", "string" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/svg/inkscape/Util.java#L87-L103
jhy/jsoup
src/main/java/org/jsoup/safety/Whitelist.java
Whitelist.addEnforcedAttribute
public Whitelist addEnforcedAttribute(String tag, String attribute, String value) { """ Add an enforced attribute to a tag. An enforced attribute will always be added to the element. If the element already has the attribute set, it will be overridden with this value. <p> E.g.: <code>addEnforcedAttribute("a", "rel", "nofollow")</code> will make all <code>a</code> tags output as <code>&lt;a href="..." rel="nofollow"&gt;</code> </p> @param tag The tag the enforced attribute is for. The tag will be added to the allowed tag list if necessary. @param attribute The attribute name @param value The enforced attribute value @return this (for chaining) """ Validate.notEmpty(tag); Validate.notEmpty(attribute); Validate.notEmpty(value); TagName tagName = TagName.valueOf(tag); tagNames.add(tagName); AttributeKey attrKey = AttributeKey.valueOf(attribute); AttributeValue attrVal = AttributeValue.valueOf(value); if (enforcedAttributes.containsKey(tagName)) { enforcedAttributes.get(tagName).put(attrKey, attrVal); } else { Map<AttributeKey, AttributeValue> attrMap = new HashMap<>(); attrMap.put(attrKey, attrVal); enforcedAttributes.put(tagName, attrMap); } return this; }
java
public Whitelist addEnforcedAttribute(String tag, String attribute, String value) { Validate.notEmpty(tag); Validate.notEmpty(attribute); Validate.notEmpty(value); TagName tagName = TagName.valueOf(tag); tagNames.add(tagName); AttributeKey attrKey = AttributeKey.valueOf(attribute); AttributeValue attrVal = AttributeValue.valueOf(value); if (enforcedAttributes.containsKey(tagName)) { enforcedAttributes.get(tagName).put(attrKey, attrVal); } else { Map<AttributeKey, AttributeValue> attrMap = new HashMap<>(); attrMap.put(attrKey, attrVal); enforcedAttributes.put(tagName, attrMap); } return this; }
[ "public", "Whitelist", "addEnforcedAttribute", "(", "String", "tag", ",", "String", "attribute", ",", "String", "value", ")", "{", "Validate", ".", "notEmpty", "(", "tag", ")", ";", "Validate", ".", "notEmpty", "(", "attribute", ")", ";", "Validate", ".", "notEmpty", "(", "value", ")", ";", "TagName", "tagName", "=", "TagName", ".", "valueOf", "(", "tag", ")", ";", "tagNames", ".", "add", "(", "tagName", ")", ";", "AttributeKey", "attrKey", "=", "AttributeKey", ".", "valueOf", "(", "attribute", ")", ";", "AttributeValue", "attrVal", "=", "AttributeValue", ".", "valueOf", "(", "value", ")", ";", "if", "(", "enforcedAttributes", ".", "containsKey", "(", "tagName", ")", ")", "{", "enforcedAttributes", ".", "get", "(", "tagName", ")", ".", "put", "(", "attrKey", ",", "attrVal", ")", ";", "}", "else", "{", "Map", "<", "AttributeKey", ",", "AttributeValue", ">", "attrMap", "=", "new", "HashMap", "<>", "(", ")", ";", "attrMap", ".", "put", "(", "attrKey", ",", "attrVal", ")", ";", "enforcedAttributes", ".", "put", "(", "tagName", ",", "attrMap", ")", ";", "}", "return", "this", ";", "}" ]
Add an enforced attribute to a tag. An enforced attribute will always be added to the element. If the element already has the attribute set, it will be overridden with this value. <p> E.g.: <code>addEnforcedAttribute("a", "rel", "nofollow")</code> will make all <code>a</code> tags output as <code>&lt;a href="..." rel="nofollow"&gt;</code> </p> @param tag The tag the enforced attribute is for. The tag will be added to the allowed tag list if necessary. @param attribute The attribute name @param value The enforced attribute value @return this (for chaining)
[ "Add", "an", "enforced", "attribute", "to", "a", "tag", ".", "An", "enforced", "attribute", "will", "always", "be", "added", "to", "the", "element", ".", "If", "the", "element", "already", "has", "the", "attribute", "set", "it", "will", "be", "overridden", "with", "this", "value", ".", "<p", ">", "E", ".", "g", ".", ":", "<code", ">", "addEnforcedAttribute", "(", "a", "rel", "nofollow", ")", "<", "/", "code", ">", "will", "make", "all", "<code", ">", "a<", "/", "code", ">", "tags", "output", "as", "<code", ">", "&lt", ";", "a", "href", "=", "...", "rel", "=", "nofollow", "&gt", ";", "<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/safety/Whitelist.java#L331-L349
igniterealtime/Smack
smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java
JingleManager.createOutgoingJingleSession
public JingleSession createOutgoingJingleSession(EntityFullJid responder) throws XMPPException { """ Creates an Jingle session to start a communication with another user. @param responder the fully qualified jabber ID with resource of the other user. @return The session on which the negotiation can be run. """ JingleSession session = new JingleSession(connection, null, connection.getUser(), responder, jingleMediaManagers); triggerSessionCreated(session); return session; }
java
public JingleSession createOutgoingJingleSession(EntityFullJid responder) throws XMPPException { JingleSession session = new JingleSession(connection, null, connection.getUser(), responder, jingleMediaManagers); triggerSessionCreated(session); return session; }
[ "public", "JingleSession", "createOutgoingJingleSession", "(", "EntityFullJid", "responder", ")", "throws", "XMPPException", "{", "JingleSession", "session", "=", "new", "JingleSession", "(", "connection", ",", "null", ",", "connection", ".", "getUser", "(", ")", ",", "responder", ",", "jingleMediaManagers", ")", ";", "triggerSessionCreated", "(", "session", ")", ";", "return", "session", ";", "}" ]
Creates an Jingle session to start a communication with another user. @param responder the fully qualified jabber ID with resource of the other user. @return The session on which the negotiation can be run.
[ "Creates", "an", "Jingle", "session", "to", "start", "a", "communication", "with", "another", "user", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java#L521-L527
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.supportedVpnDevices
public String supportedVpnDevices(String resourceGroupName, String virtualNetworkGatewayName) { """ Gets a xml format representation for supported vpn devices. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the String object if successful. """ return supportedVpnDevicesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body(); }
java
public String supportedVpnDevices(String resourceGroupName, String virtualNetworkGatewayName) { return supportedVpnDevicesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body(); }
[ "public", "String", "supportedVpnDevices", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ")", "{", "return", "supportedVpnDevicesWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets a xml format representation for supported vpn devices. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the String object if successful.
[ "Gets", "a", "xml", "format", "representation", "for", "supported", "vpn", "devices", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2256-L2258
Metatavu/edelphi
smvcj/src/main/java/fi/metatavu/edelphi/smvcj/dispatcher/Servlet.java
Servlet.service
@Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { """ Processes all application requests, delegating them to their corresponding page, binary and JSON controllers. """ if (sessionSynchronization) { String syncKey = getSyncKey(request); synchronized (getSyncObject(syncKey)) { try { doService(request, response); } finally { removeSyncObject(syncKey); } } } else { doService(request, response); } }
java
@Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { if (sessionSynchronization) { String syncKey = getSyncKey(request); synchronized (getSyncObject(syncKey)) { try { doService(request, response); } finally { removeSyncObject(syncKey); } } } else { doService(request, response); } }
[ "@", "Override", "protected", "void", "service", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "java", ".", "io", ".", "IOException", "{", "if", "(", "sessionSynchronization", ")", "{", "String", "syncKey", "=", "getSyncKey", "(", "request", ")", ";", "synchronized", "(", "getSyncObject", "(", "syncKey", ")", ")", "{", "try", "{", "doService", "(", "request", ",", "response", ")", ";", "}", "finally", "{", "removeSyncObject", "(", "syncKey", ")", ";", "}", "}", "}", "else", "{", "doService", "(", "request", ",", "response", ")", ";", "}", "}" ]
Processes all application requests, delegating them to their corresponding page, binary and JSON controllers.
[ "Processes", "all", "application", "requests", "delegating", "them", "to", "their", "corresponding", "page", "binary", "and", "JSON", "controllers", "." ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/smvcj/src/main/java/fi/metatavu/edelphi/smvcj/dispatcher/Servlet.java#L81-L97
Azure/azure-sdk-for-java
containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/OpenShiftManagedClustersInner.java
OpenShiftManagedClustersInner.getByResourceGroupAsync
public Observable<OpenShiftManagedClusterInner> getByResourceGroupAsync(String resourceGroupName, String resourceName) { """ Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. @param resourceGroupName The name of the resource group. @param resourceName The name of the OpenShift managed cluster resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OpenShiftManagedClusterInner object """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<OpenShiftManagedClusterInner>, OpenShiftManagedClusterInner>() { @Override public OpenShiftManagedClusterInner call(ServiceResponse<OpenShiftManagedClusterInner> response) { return response.body(); } }); }
java
public Observable<OpenShiftManagedClusterInner> getByResourceGroupAsync(String resourceGroupName, String resourceName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<OpenShiftManagedClusterInner>, OpenShiftManagedClusterInner>() { @Override public OpenShiftManagedClusterInner call(ServiceResponse<OpenShiftManagedClusterInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OpenShiftManagedClusterInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "OpenShiftManagedClusterInner", ">", ",", "OpenShiftManagedClusterInner", ">", "(", ")", "{", "@", "Override", "public", "OpenShiftManagedClusterInner", "call", "(", "ServiceResponse", "<", "OpenShiftManagedClusterInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. @param resourceGroupName The name of the resource group. @param resourceName The name of the OpenShift managed cluster resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OpenShiftManagedClusterInner object
[ "Gets", "a", "OpenShift", "managed", "cluster", ".", "Gets", "the", "details", "of", "the", "managed", "OpenShift", "cluster", "with", "a", "specified", "resource", "group", "and", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/OpenShiftManagedClustersInner.java#L382-L389
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/util/JMSServices.java
JMSServices.getQueue
public Queue getQueue(String contextUrl, String queueName) throws ServiceLocatorException { """ Looks up and returns a JMS queue. @param queueName remote queue name @param contextUrl the context url (or null for local) @return javax.jms.Queue """ try { String jndiName = null; if (contextUrl == null) { jndiName = namingProvider.qualifyJmsQueueName(queueName); } else { jndiName = queueName; // don't qualify remote queue names } return (Queue) namingProvider.lookup(contextUrl, jndiName, Queue.class); } catch (Exception ex) { throw new ServiceLocatorException(-1, ex.getMessage(), ex); } }
java
public Queue getQueue(String contextUrl, String queueName) throws ServiceLocatorException { try { String jndiName = null; if (contextUrl == null) { jndiName = namingProvider.qualifyJmsQueueName(queueName); } else { jndiName = queueName; // don't qualify remote queue names } return (Queue) namingProvider.lookup(contextUrl, jndiName, Queue.class); } catch (Exception ex) { throw new ServiceLocatorException(-1, ex.getMessage(), ex); } }
[ "public", "Queue", "getQueue", "(", "String", "contextUrl", ",", "String", "queueName", ")", "throws", "ServiceLocatorException", "{", "try", "{", "String", "jndiName", "=", "null", ";", "if", "(", "contextUrl", "==", "null", ")", "{", "jndiName", "=", "namingProvider", ".", "qualifyJmsQueueName", "(", "queueName", ")", ";", "}", "else", "{", "jndiName", "=", "queueName", ";", "// don't qualify remote queue names", "}", "return", "(", "Queue", ")", "namingProvider", ".", "lookup", "(", "contextUrl", ",", "jndiName", ",", "Queue", ".", "class", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "ServiceLocatorException", "(", "-", "1", ",", "ex", ".", "getMessage", "(", ")", ",", "ex", ")", ";", "}", "}" ]
Looks up and returns a JMS queue. @param queueName remote queue name @param contextUrl the context url (or null for local) @return javax.jms.Queue
[ "Looks", "up", "and", "returns", "a", "JMS", "queue", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/JMSServices.java#L246-L260
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java
StreamUtils.copyStreamToWriter
public static void copyStreamToWriter( InputStream in, Writer out, String encoding, boolean close ) throws IOException { """ Copies an InputStream to a Writer. @param in The input byte stream of data. @param out The Writer to receive the streamed data as characters. @param encoding The encoding used in the byte stream. @param close true if the Reader and OutputStream should be closed after the completion. @throws IOException If an underlying I/O Exception occurs. """ InputStreamReader reader = new InputStreamReader( in, encoding ); copyReaderToWriter( reader, out, close ); }
java
public static void copyStreamToWriter( InputStream in, Writer out, String encoding, boolean close ) throws IOException { InputStreamReader reader = new InputStreamReader( in, encoding ); copyReaderToWriter( reader, out, close ); }
[ "public", "static", "void", "copyStreamToWriter", "(", "InputStream", "in", ",", "Writer", "out", ",", "String", "encoding", ",", "boolean", "close", ")", "throws", "IOException", "{", "InputStreamReader", "reader", "=", "new", "InputStreamReader", "(", "in", ",", "encoding", ")", ";", "copyReaderToWriter", "(", "reader", ",", "out", ",", "close", ")", ";", "}" ]
Copies an InputStream to a Writer. @param in The input byte stream of data. @param out The Writer to receive the streamed data as characters. @param encoding The encoding used in the byte stream. @param close true if the Reader and OutputStream should be closed after the completion. @throws IOException If an underlying I/O Exception occurs.
[ "Copies", "an", "InputStream", "to", "a", "Writer", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L282-L287
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/SchedulerImpl.java
SchedulerImpl.readInTask
private ScheduleTaskImpl readInTask(Element el) throws PageException { """ read in a single task element @param el @return matching task to Element @throws PageException """ long timeout = su.toLong(el, "timeout"); if (timeout > 0 && timeout < 1000) timeout *= 1000; if (timeout < 0) timeout = 600000; try { ScheduleTaskImpl st = new ScheduleTaskImpl(this, su.toString(el, "name").trim(), su.toResource(config, el, "file"), su.toDate(config, el, "startDate"), su.toTime(config, el, "startTime"), su.toDate(config, el, "endDate"), su.toTime(config, el, "endTime"), su.toString(el, "url"), su.toInt(el, "port", -1), su.toString(el, "interval"), timeout, su.toCredentials(el, "username", "password"), ProxyDataImpl.getInstance(su.toString(el, "proxyHost"), su.toInt(el, "proxyPort", 80), su.toString(el, "proxyUser"), su.toString(el, "proxyPassword")), su.toBoolean(el, "resolveUrl"), su.toBoolean(el, "publish"), su.toBoolean(el, "hidden", false), su.toBoolean(el, "readonly", false), su.toBoolean(el, "paused", false), su.toBoolean(el, "autoDelete", false)); return st; } catch (Exception e) { SystemOut.printDate(e); throw Caster.toPageException(e); } }
java
private ScheduleTaskImpl readInTask(Element el) throws PageException { long timeout = su.toLong(el, "timeout"); if (timeout > 0 && timeout < 1000) timeout *= 1000; if (timeout < 0) timeout = 600000; try { ScheduleTaskImpl st = new ScheduleTaskImpl(this, su.toString(el, "name").trim(), su.toResource(config, el, "file"), su.toDate(config, el, "startDate"), su.toTime(config, el, "startTime"), su.toDate(config, el, "endDate"), su.toTime(config, el, "endTime"), su.toString(el, "url"), su.toInt(el, "port", -1), su.toString(el, "interval"), timeout, su.toCredentials(el, "username", "password"), ProxyDataImpl.getInstance(su.toString(el, "proxyHost"), su.toInt(el, "proxyPort", 80), su.toString(el, "proxyUser"), su.toString(el, "proxyPassword")), su.toBoolean(el, "resolveUrl"), su.toBoolean(el, "publish"), su.toBoolean(el, "hidden", false), su.toBoolean(el, "readonly", false), su.toBoolean(el, "paused", false), su.toBoolean(el, "autoDelete", false)); return st; } catch (Exception e) { SystemOut.printDate(e); throw Caster.toPageException(e); } }
[ "private", "ScheduleTaskImpl", "readInTask", "(", "Element", "el", ")", "throws", "PageException", "{", "long", "timeout", "=", "su", ".", "toLong", "(", "el", ",", "\"timeout\"", ")", ";", "if", "(", "timeout", ">", "0", "&&", "timeout", "<", "1000", ")", "timeout", "*=", "1000", ";", "if", "(", "timeout", "<", "0", ")", "timeout", "=", "600000", ";", "try", "{", "ScheduleTaskImpl", "st", "=", "new", "ScheduleTaskImpl", "(", "this", ",", "su", ".", "toString", "(", "el", ",", "\"name\"", ")", ".", "trim", "(", ")", ",", "su", ".", "toResource", "(", "config", ",", "el", ",", "\"file\"", ")", ",", "su", ".", "toDate", "(", "config", ",", "el", ",", "\"startDate\"", ")", ",", "su", ".", "toTime", "(", "config", ",", "el", ",", "\"startTime\"", ")", ",", "su", ".", "toDate", "(", "config", ",", "el", ",", "\"endDate\"", ")", ",", "su", ".", "toTime", "(", "config", ",", "el", ",", "\"endTime\"", ")", ",", "su", ".", "toString", "(", "el", ",", "\"url\"", ")", ",", "su", ".", "toInt", "(", "el", ",", "\"port\"", ",", "-", "1", ")", ",", "su", ".", "toString", "(", "el", ",", "\"interval\"", ")", ",", "timeout", ",", "su", ".", "toCredentials", "(", "el", ",", "\"username\"", ",", "\"password\"", ")", ",", "ProxyDataImpl", ".", "getInstance", "(", "su", ".", "toString", "(", "el", ",", "\"proxyHost\"", ")", ",", "su", ".", "toInt", "(", "el", ",", "\"proxyPort\"", ",", "80", ")", ",", "su", ".", "toString", "(", "el", ",", "\"proxyUser\"", ")", ",", "su", ".", "toString", "(", "el", ",", "\"proxyPassword\"", ")", ")", ",", "su", ".", "toBoolean", "(", "el", ",", "\"resolveUrl\"", ")", ",", "su", ".", "toBoolean", "(", "el", ",", "\"publish\"", ")", ",", "su", ".", "toBoolean", "(", "el", ",", "\"hidden\"", ",", "false", ")", ",", "su", ".", "toBoolean", "(", "el", ",", "\"readonly\"", ",", "false", ")", ",", "su", ".", "toBoolean", "(", "el", ",", "\"paused\"", ",", "false", ")", ",", "su", ".", "toBoolean", "(", "el", ",", "\"autoDelete\"", ",", "false", ")", ")", ";", "return", "st", ";", "}", "catch", "(", "Exception", "e", ")", "{", "SystemOut", ".", "printDate", "(", "e", ")", ";", "throw", "Caster", ".", "toPageException", "(", "e", ")", ";", "}", "}" ]
read in a single task element @param el @return matching task to Element @throws PageException
[ "read", "in", "a", "single", "task", "element" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/SchedulerImpl.java#L184-L201
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF5.java
CommonOps_DDF5.multAddOuter
public static void multAddOuter( double alpha , DMatrix5x5 A , double beta , DMatrix5 u , DMatrix5 v , DMatrix5x5 C ) { """ C = &alpha;A + &beta;u*v<sup>T</sup> @param alpha scale factor applied to A @param A matrix @param beta scale factor applies to outer product @param u vector @param v vector @param C Storage for solution. Can be same instance as A. """ C.a11 = alpha*A.a11 + beta*u.a1*v.a1; C.a12 = alpha*A.a12 + beta*u.a1*v.a2; C.a13 = alpha*A.a13 + beta*u.a1*v.a3; C.a14 = alpha*A.a14 + beta*u.a1*v.a4; C.a15 = alpha*A.a15 + beta*u.a1*v.a5; C.a21 = alpha*A.a21 + beta*u.a2*v.a1; C.a22 = alpha*A.a22 + beta*u.a2*v.a2; C.a23 = alpha*A.a23 + beta*u.a2*v.a3; C.a24 = alpha*A.a24 + beta*u.a2*v.a4; C.a25 = alpha*A.a25 + beta*u.a2*v.a5; C.a31 = alpha*A.a31 + beta*u.a3*v.a1; C.a32 = alpha*A.a32 + beta*u.a3*v.a2; C.a33 = alpha*A.a33 + beta*u.a3*v.a3; C.a34 = alpha*A.a34 + beta*u.a3*v.a4; C.a35 = alpha*A.a35 + beta*u.a3*v.a5; C.a41 = alpha*A.a41 + beta*u.a4*v.a1; C.a42 = alpha*A.a42 + beta*u.a4*v.a2; C.a43 = alpha*A.a43 + beta*u.a4*v.a3; C.a44 = alpha*A.a44 + beta*u.a4*v.a4; C.a45 = alpha*A.a45 + beta*u.a4*v.a5; C.a51 = alpha*A.a51 + beta*u.a5*v.a1; C.a52 = alpha*A.a52 + beta*u.a5*v.a2; C.a53 = alpha*A.a53 + beta*u.a5*v.a3; C.a54 = alpha*A.a54 + beta*u.a5*v.a4; C.a55 = alpha*A.a55 + beta*u.a5*v.a5; }
java
public static void multAddOuter( double alpha , DMatrix5x5 A , double beta , DMatrix5 u , DMatrix5 v , DMatrix5x5 C ) { C.a11 = alpha*A.a11 + beta*u.a1*v.a1; C.a12 = alpha*A.a12 + beta*u.a1*v.a2; C.a13 = alpha*A.a13 + beta*u.a1*v.a3; C.a14 = alpha*A.a14 + beta*u.a1*v.a4; C.a15 = alpha*A.a15 + beta*u.a1*v.a5; C.a21 = alpha*A.a21 + beta*u.a2*v.a1; C.a22 = alpha*A.a22 + beta*u.a2*v.a2; C.a23 = alpha*A.a23 + beta*u.a2*v.a3; C.a24 = alpha*A.a24 + beta*u.a2*v.a4; C.a25 = alpha*A.a25 + beta*u.a2*v.a5; C.a31 = alpha*A.a31 + beta*u.a3*v.a1; C.a32 = alpha*A.a32 + beta*u.a3*v.a2; C.a33 = alpha*A.a33 + beta*u.a3*v.a3; C.a34 = alpha*A.a34 + beta*u.a3*v.a4; C.a35 = alpha*A.a35 + beta*u.a3*v.a5; C.a41 = alpha*A.a41 + beta*u.a4*v.a1; C.a42 = alpha*A.a42 + beta*u.a4*v.a2; C.a43 = alpha*A.a43 + beta*u.a4*v.a3; C.a44 = alpha*A.a44 + beta*u.a4*v.a4; C.a45 = alpha*A.a45 + beta*u.a4*v.a5; C.a51 = alpha*A.a51 + beta*u.a5*v.a1; C.a52 = alpha*A.a52 + beta*u.a5*v.a2; C.a53 = alpha*A.a53 + beta*u.a5*v.a3; C.a54 = alpha*A.a54 + beta*u.a5*v.a4; C.a55 = alpha*A.a55 + beta*u.a5*v.a5; }
[ "public", "static", "void", "multAddOuter", "(", "double", "alpha", ",", "DMatrix5x5", "A", ",", "double", "beta", ",", "DMatrix5", "u", ",", "DMatrix5", "v", ",", "DMatrix5x5", "C", ")", "{", "C", ".", "a11", "=", "alpha", "*", "A", ".", "a11", "+", "beta", "*", "u", ".", "a1", "*", "v", ".", "a1", ";", "C", ".", "a12", "=", "alpha", "*", "A", ".", "a12", "+", "beta", "*", "u", ".", "a1", "*", "v", ".", "a2", ";", "C", ".", "a13", "=", "alpha", "*", "A", ".", "a13", "+", "beta", "*", "u", ".", "a1", "*", "v", ".", "a3", ";", "C", ".", "a14", "=", "alpha", "*", "A", ".", "a14", "+", "beta", "*", "u", ".", "a1", "*", "v", ".", "a4", ";", "C", ".", "a15", "=", "alpha", "*", "A", ".", "a15", "+", "beta", "*", "u", ".", "a1", "*", "v", ".", "a5", ";", "C", ".", "a21", "=", "alpha", "*", "A", ".", "a21", "+", "beta", "*", "u", ".", "a2", "*", "v", ".", "a1", ";", "C", ".", "a22", "=", "alpha", "*", "A", ".", "a22", "+", "beta", "*", "u", ".", "a2", "*", "v", ".", "a2", ";", "C", ".", "a23", "=", "alpha", "*", "A", ".", "a23", "+", "beta", "*", "u", ".", "a2", "*", "v", ".", "a3", ";", "C", ".", "a24", "=", "alpha", "*", "A", ".", "a24", "+", "beta", "*", "u", ".", "a2", "*", "v", ".", "a4", ";", "C", ".", "a25", "=", "alpha", "*", "A", ".", "a25", "+", "beta", "*", "u", ".", "a2", "*", "v", ".", "a5", ";", "C", ".", "a31", "=", "alpha", "*", "A", ".", "a31", "+", "beta", "*", "u", ".", "a3", "*", "v", ".", "a1", ";", "C", ".", "a32", "=", "alpha", "*", "A", ".", "a32", "+", "beta", "*", "u", ".", "a3", "*", "v", ".", "a2", ";", "C", ".", "a33", "=", "alpha", "*", "A", ".", "a33", "+", "beta", "*", "u", ".", "a3", "*", "v", ".", "a3", ";", "C", ".", "a34", "=", "alpha", "*", "A", ".", "a34", "+", "beta", "*", "u", ".", "a3", "*", "v", ".", "a4", ";", "C", ".", "a35", "=", "alpha", "*", "A", ".", "a35", "+", "beta", "*", "u", ".", "a3", "*", "v", ".", "a5", ";", "C", ".", "a41", "=", "alpha", "*", "A", ".", "a41", "+", "beta", "*", "u", ".", "a4", "*", "v", ".", "a1", ";", "C", ".", "a42", "=", "alpha", "*", "A", ".", "a42", "+", "beta", "*", "u", ".", "a4", "*", "v", ".", "a2", ";", "C", ".", "a43", "=", "alpha", "*", "A", ".", "a43", "+", "beta", "*", "u", ".", "a4", "*", "v", ".", "a3", ";", "C", ".", "a44", "=", "alpha", "*", "A", ".", "a44", "+", "beta", "*", "u", ".", "a4", "*", "v", ".", "a4", ";", "C", ".", "a45", "=", "alpha", "*", "A", ".", "a45", "+", "beta", "*", "u", ".", "a4", "*", "v", ".", "a5", ";", "C", ".", "a51", "=", "alpha", "*", "A", ".", "a51", "+", "beta", "*", "u", ".", "a5", "*", "v", ".", "a1", ";", "C", ".", "a52", "=", "alpha", "*", "A", ".", "a52", "+", "beta", "*", "u", ".", "a5", "*", "v", ".", "a2", ";", "C", ".", "a53", "=", "alpha", "*", "A", ".", "a53", "+", "beta", "*", "u", ".", "a5", "*", "v", ".", "a3", ";", "C", ".", "a54", "=", "alpha", "*", "A", ".", "a54", "+", "beta", "*", "u", ".", "a5", "*", "v", ".", "a4", ";", "C", ".", "a55", "=", "alpha", "*", "A", ".", "a55", "+", "beta", "*", "u", ".", "a5", "*", "v", ".", "a5", ";", "}" ]
C = &alpha;A + &beta;u*v<sup>T</sup> @param alpha scale factor applied to A @param A matrix @param beta scale factor applies to outer product @param u vector @param v vector @param C Storage for solution. Can be same instance as A.
[ "C", "=", "&alpha", ";", "A", "+", "&beta", ";", "u", "*", "v<sup", ">", "T<", "/", "sup", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF5.java#L999-L1025
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toDate
public static DateTime toDate(String str, TimeZone tz) throws PageException { """ cast a Object to a DateTime Object @param str String to cast @param tz @return casted DateTime Object @throws PageException """ return DateCaster.toDateAdvanced(str, tz); }
java
public static DateTime toDate(String str, TimeZone tz) throws PageException { return DateCaster.toDateAdvanced(str, tz); }
[ "public", "static", "DateTime", "toDate", "(", "String", "str", ",", "TimeZone", "tz", ")", "throws", "PageException", "{", "return", "DateCaster", ".", "toDateAdvanced", "(", "str", ",", "tz", ")", ";", "}" ]
cast a Object to a DateTime Object @param str String to cast @param tz @return casted DateTime Object @throws PageException
[ "cast", "a", "Object", "to", "a", "DateTime", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L2885-L2887
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnSitesInner.java
VpnSitesInner.updateTagsAsync
public Observable<VpnSiteInner> updateTagsAsync(String resourceGroupName, String vpnSiteName, Map<String, String> tags) { """ Updates VpnSite tags. @param resourceGroupName The resource group name of the VpnSite. @param vpnSiteName The name of the VpnSite being updated. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return updateTagsWithServiceResponseAsync(resourceGroupName, vpnSiteName, tags).map(new Func1<ServiceResponse<VpnSiteInner>, VpnSiteInner>() { @Override public VpnSiteInner call(ServiceResponse<VpnSiteInner> response) { return response.body(); } }); }
java
public Observable<VpnSiteInner> updateTagsAsync(String resourceGroupName, String vpnSiteName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, vpnSiteName, tags).map(new Func1<ServiceResponse<VpnSiteInner>, VpnSiteInner>() { @Override public VpnSiteInner call(ServiceResponse<VpnSiteInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VpnSiteInner", ">", "updateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "vpnSiteName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "vpnSiteName", ",", "tags", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VpnSiteInner", ">", ",", "VpnSiteInner", ">", "(", ")", "{", "@", "Override", "public", "VpnSiteInner", "call", "(", "ServiceResponse", "<", "VpnSiteInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Updates VpnSite tags. @param resourceGroupName The resource group name of the VpnSite. @param vpnSiteName The name of the VpnSite being updated. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "VpnSite", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnSitesInner.java#L475-L482
gallandarakhneorg/afc
advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributeCollection.java
DBaseFileAttributeCollection.fireAttributeAddedEvent
protected void fireAttributeAddedEvent(String name, AttributeValue attr) { """ Fire the addition event. @param name is the name of the attribute for which the event occured. @param attr is the value of the attribute. """ if (this.listeners != null && isEventFirable()) { final AttributeChangeEvent event = new AttributeChangeEvent( //source this, //type Type.ADDITION, //old name null, //old value null, //current name name, //current value attr); for (final AttributeChangeListener listener : this.listeners) { listener.onAttributeChangeEvent(event); } } }
java
protected void fireAttributeAddedEvent(String name, AttributeValue attr) { if (this.listeners != null && isEventFirable()) { final AttributeChangeEvent event = new AttributeChangeEvent( //source this, //type Type.ADDITION, //old name null, //old value null, //current name name, //current value attr); for (final AttributeChangeListener listener : this.listeners) { listener.onAttributeChangeEvent(event); } } }
[ "protected", "void", "fireAttributeAddedEvent", "(", "String", "name", ",", "AttributeValue", "attr", ")", "{", "if", "(", "this", ".", "listeners", "!=", "null", "&&", "isEventFirable", "(", ")", ")", "{", "final", "AttributeChangeEvent", "event", "=", "new", "AttributeChangeEvent", "(", "//source", "this", ",", "//type", "Type", ".", "ADDITION", ",", "//old name", "null", ",", "//old value", "null", ",", "//current name", "name", ",", "//current value", "attr", ")", ";", "for", "(", "final", "AttributeChangeListener", "listener", ":", "this", ".", "listeners", ")", "{", "listener", ".", "onAttributeChangeEvent", "(", "event", ")", ";", "}", "}", "}" ]
Fire the addition event. @param name is the name of the attribute for which the event occured. @param attr is the value of the attribute.
[ "Fire", "the", "addition", "event", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributeCollection.java#L860-L879
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/Config.java
Config.getProperty
public static String getProperty(Class<?> aClass,String key,ResourceBundle resourceBundle) { """ Get the property @param aClass the class associate with property @param key the property key @param resourceBundle the resource bundle default used if property not found @return the property key """ return getSettings().getProperty(aClass, key, resourceBundle); }
java
public static String getProperty(Class<?> aClass,String key,ResourceBundle resourceBundle) { return getSettings().getProperty(aClass, key, resourceBundle); }
[ "public", "static", "String", "getProperty", "(", "Class", "<", "?", ">", "aClass", ",", "String", "key", ",", "ResourceBundle", "resourceBundle", ")", "{", "return", "getSettings", "(", ")", ".", "getProperty", "(", "aClass", ",", "key", ",", "resourceBundle", ")", ";", "}" ]
Get the property @param aClass the class associate with property @param key the property key @param resourceBundle the resource bundle default used if property not found @return the property key
[ "Get", "the", "property" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Config.java#L172-L175
jayantk/jklol
src/com/jayantkrish/jklol/ccg/lambda2/Expression2.java
Expression2.substitute
public Expression2 substitute(String value, String replacement) { """ Replaces all occurrences of {@code value} in this expression with {@code replacement}. @param value @param replacement @return """ return substitute(Expression2.constant(value), Expression2.constant(replacement)); }
java
public Expression2 substitute(String value, String replacement) { return substitute(Expression2.constant(value), Expression2.constant(replacement)); }
[ "public", "Expression2", "substitute", "(", "String", "value", ",", "String", "replacement", ")", "{", "return", "substitute", "(", "Expression2", ".", "constant", "(", "value", ")", ",", "Expression2", ".", "constant", "(", "replacement", ")", ")", ";", "}" ]
Replaces all occurrences of {@code value} in this expression with {@code replacement}. @param value @param replacement @return
[ "Replaces", "all", "occurrences", "of", "{", "@code", "value", "}", "in", "this", "expression", "with", "{", "@code", "replacement", "}", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/lambda2/Expression2.java#L251-L253
bugsnag/bugsnag-java
bugsnag/src/main/java/com/bugsnag/Report.java
Report.getExceptions
@Expose protected List<Exception> getExceptions() { """ Get the exceptions for the report. @return the exceptions that make up the error. """ List<Exception> exceptions = new ArrayList<Exception>(); exceptions.add(exception); Throwable currentThrowable = exception.getThrowable().getCause(); while (currentThrowable != null) { exceptions.add(new Exception(config, currentThrowable)); currentThrowable = currentThrowable.getCause(); } return exceptions; }
java
@Expose protected List<Exception> getExceptions() { List<Exception> exceptions = new ArrayList<Exception>(); exceptions.add(exception); Throwable currentThrowable = exception.getThrowable().getCause(); while (currentThrowable != null) { exceptions.add(new Exception(config, currentThrowable)); currentThrowable = currentThrowable.getCause(); } return exceptions; }
[ "@", "Expose", "protected", "List", "<", "Exception", ">", "getExceptions", "(", ")", "{", "List", "<", "Exception", ">", "exceptions", "=", "new", "ArrayList", "<", "Exception", ">", "(", ")", ";", "exceptions", ".", "add", "(", "exception", ")", ";", "Throwable", "currentThrowable", "=", "exception", ".", "getThrowable", "(", ")", ".", "getCause", "(", ")", ";", "while", "(", "currentThrowable", "!=", "null", ")", "{", "exceptions", ".", "add", "(", "new", "Exception", "(", "config", ",", "currentThrowable", ")", ")", ";", "currentThrowable", "=", "currentThrowable", ".", "getCause", "(", ")", ";", "}", "return", "exceptions", ";", "}" ]
Get the exceptions for the report. @return the exceptions that make up the error.
[ "Get", "the", "exceptions", "for", "the", "report", "." ]
train
https://github.com/bugsnag/bugsnag-java/blob/11817d63949bcf2b2b6b765a1d37305cdec356f2/bugsnag/src/main/java/com/bugsnag/Report.java#L67-L79
OpenLiberty/open-liberty
dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/JNDIEntry.java
JNDIEntry.activate
protected synchronized void activate(BundleContext context, Map<String, Object> props) { """ Registers the JNDI service for the supplied properties as long as the jndiName and value are set @param context @param props The properties containing values for <code>"jndiName"</code> and <code>"value"</code> """ String jndiName = (String) props.get("jndiName"); String originalValue = (String) props.get("value"); //Since we declare a default value of false in the metatype, if decode isn't specified, props should return false boolean decode = (Boolean) props.get("decode"); if (jndiName == null || jndiName.isEmpty() || originalValue == null || originalValue.isEmpty()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Unable to register JNDIEntry with jndiName " + jndiName + " and value " + originalValue + " because both must be set"); } return; } String value = originalValue; if (decode) { try { value = PasswordUtil.decode(originalValue); } catch (Exception e) { Tr.error(tc, "jndi.decode.failed", originalValue, e); } } Object parsedValue = LiteralParser.parse(value); String valueClassName = parsedValue.getClass().getName(); final Object serviceObject = decode ? new Decode(originalValue) : parsedValue; Dictionary<String, Object> propertiesForJndiService = new Hashtable<String, Object>(); propertiesForJndiService.put("osgi.jndi.service.name", jndiName); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Registering JNDIEntry " + valueClassName + " with value " + parsedValue + " and JNDI name " + jndiName); } this.serviceRegistration = context.registerService(valueClassName, serviceObject, propertiesForJndiService); }
java
protected synchronized void activate(BundleContext context, Map<String, Object> props) { String jndiName = (String) props.get("jndiName"); String originalValue = (String) props.get("value"); //Since we declare a default value of false in the metatype, if decode isn't specified, props should return false boolean decode = (Boolean) props.get("decode"); if (jndiName == null || jndiName.isEmpty() || originalValue == null || originalValue.isEmpty()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Unable to register JNDIEntry with jndiName " + jndiName + " and value " + originalValue + " because both must be set"); } return; } String value = originalValue; if (decode) { try { value = PasswordUtil.decode(originalValue); } catch (Exception e) { Tr.error(tc, "jndi.decode.failed", originalValue, e); } } Object parsedValue = LiteralParser.parse(value); String valueClassName = parsedValue.getClass().getName(); final Object serviceObject = decode ? new Decode(originalValue) : parsedValue; Dictionary<String, Object> propertiesForJndiService = new Hashtable<String, Object>(); propertiesForJndiService.put("osgi.jndi.service.name", jndiName); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Registering JNDIEntry " + valueClassName + " with value " + parsedValue + " and JNDI name " + jndiName); } this.serviceRegistration = context.registerService(valueClassName, serviceObject, propertiesForJndiService); }
[ "protected", "synchronized", "void", "activate", "(", "BundleContext", "context", ",", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "String", "jndiName", "=", "(", "String", ")", "props", ".", "get", "(", "\"jndiName\"", ")", ";", "String", "originalValue", "=", "(", "String", ")", "props", ".", "get", "(", "\"value\"", ")", ";", "//Since we declare a default value of false in the metatype, if decode isn't specified, props should return false", "boolean", "decode", "=", "(", "Boolean", ")", "props", ".", "get", "(", "\"decode\"", ")", ";", "if", "(", "jndiName", "==", "null", "||", "jndiName", ".", "isEmpty", "(", ")", "||", "originalValue", "==", "null", "||", "originalValue", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Unable to register JNDIEntry with jndiName \"", "+", "jndiName", "+", "\" and value \"", "+", "originalValue", "+", "\" because both must be set\"", ")", ";", "}", "return", ";", "}", "String", "value", "=", "originalValue", ";", "if", "(", "decode", ")", "{", "try", "{", "value", "=", "PasswordUtil", ".", "decode", "(", "originalValue", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Tr", ".", "error", "(", "tc", ",", "\"jndi.decode.failed\"", ",", "originalValue", ",", "e", ")", ";", "}", "}", "Object", "parsedValue", "=", "LiteralParser", ".", "parse", "(", "value", ")", ";", "String", "valueClassName", "=", "parsedValue", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "final", "Object", "serviceObject", "=", "decode", "?", "new", "Decode", "(", "originalValue", ")", ":", "parsedValue", ";", "Dictionary", "<", "String", ",", "Object", ">", "propertiesForJndiService", "=", "new", "Hashtable", "<", "String", ",", "Object", ">", "(", ")", ";", "propertiesForJndiService", ".", "put", "(", "\"osgi.jndi.service.name\"", ",", "jndiName", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Registering JNDIEntry \"", "+", "valueClassName", "+", "\" with value \"", "+", "parsedValue", "+", "\" and JNDI name \"", "+", "jndiName", ")", ";", "}", "this", ".", "serviceRegistration", "=", "context", ".", "registerService", "(", "valueClassName", ",", "serviceObject", ",", "propertiesForJndiService", ")", ";", "}" ]
Registers the JNDI service for the supplied properties as long as the jndiName and value are set @param context @param props The properties containing values for <code>"jndiName"</code> and <code>"value"</code>
[ "Registers", "the", "JNDI", "service", "for", "the", "supplied", "properties", "as", "long", "as", "the", "jndiName", "and", "value", "are", "set" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/JNDIEntry.java#L57-L87
liferay/com-liferay-commerce
commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java
CommerceAccountPersistenceImpl.countByU_T
@Override public int countByU_T(long userId, int type) { """ Returns the number of commerce accounts where userId = &#63; and type = &#63;. @param userId the user ID @param type the type @return the number of matching commerce accounts """ FinderPath finderPath = FINDER_PATH_COUNT_BY_U_T; Object[] finderArgs = new Object[] { userId, type }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_COMMERCEACCOUNT_WHERE); query.append(_FINDER_COLUMN_U_T_USERID_2); query.append(_FINDER_COLUMN_U_T_TYPE_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(userId); qPos.add(type); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByU_T(long userId, int type) { FinderPath finderPath = FINDER_PATH_COUNT_BY_U_T; Object[] finderArgs = new Object[] { userId, type }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_COMMERCEACCOUNT_WHERE); query.append(_FINDER_COLUMN_U_T_USERID_2); query.append(_FINDER_COLUMN_U_T_TYPE_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(userId); qPos.add(type); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByU_T", "(", "long", "userId", ",", "int", "type", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_U_T", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{", "userId", ",", "type", "}", ";", "Long", "count", "=", "(", "Long", ")", "finderCache", ".", "getResult", "(", "finderPath", ",", "finderArgs", ",", "this", ")", ";", "if", "(", "count", "==", "null", ")", "{", "StringBundler", "query", "=", "new", "StringBundler", "(", "3", ")", ";", "query", ".", "append", "(", "_SQL_COUNT_COMMERCEACCOUNT_WHERE", ")", ";", "query", ".", "append", "(", "_FINDER_COLUMN_U_T_USERID_2", ")", ";", "query", ".", "append", "(", "_FINDER_COLUMN_U_T_TYPE_2", ")", ";", "String", "sql", "=", "query", ".", "toString", "(", ")", ";", "Session", "session", "=", "null", ";", "try", "{", "session", "=", "openSession", "(", ")", ";", "Query", "q", "=", "session", ".", "createQuery", "(", "sql", ")", ";", "QueryPos", "qPos", "=", "QueryPos", ".", "getInstance", "(", "q", ")", ";", "qPos", ".", "add", "(", "userId", ")", ";", "qPos", ".", "add", "(", "type", ")", ";", "count", "=", "(", "Long", ")", "q", ".", "uniqueResult", "(", ")", ";", "finderCache", ".", "putResult", "(", "finderPath", ",", "finderArgs", ",", "count", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "finderCache", ".", "removeResult", "(", "finderPath", ",", "finderArgs", ")", ";", "throw", "processException", "(", "e", ")", ";", "}", "finally", "{", "closeSession", "(", "session", ")", ";", "}", "}", "return", "count", ".", "intValue", "(", ")", ";", "}" ]
Returns the number of commerce accounts where userId = &#63; and type = &#63;. @param userId the user ID @param type the type @return the number of matching commerce accounts
[ "Returns", "the", "number", "of", "commerce", "accounts", "where", "userId", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java#L1786-L1833
mikepenz/FastAdapter
library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java
ExpandableExtension.notifyAdapterSubItemsChanged
public int notifyAdapterSubItemsChanged(int position, int previousCount) { """ notifies the fastAdapter about new / removed items within a sub hierarchy NOTE this currently only works for sub items with only 1 level @param position the global position of the parent item @param previousCount the previous count of sub items @return the new count of subItems """ Item item = mFastAdapter.getItem(position); if (item != null && item instanceof IExpandable) { IExpandable expandable = (IExpandable) item; IAdapter adapter = mFastAdapter.getAdapter(position); if (adapter != null && adapter instanceof IItemAdapter) { ((IItemAdapter) adapter).removeRange(position + 1, previousCount); ((IItemAdapter) adapter).add(position + 1, expandable.getSubItems()); } return expandable.getSubItems().size(); } return 0; }
java
public int notifyAdapterSubItemsChanged(int position, int previousCount) { Item item = mFastAdapter.getItem(position); if (item != null && item instanceof IExpandable) { IExpandable expandable = (IExpandable) item; IAdapter adapter = mFastAdapter.getAdapter(position); if (adapter != null && adapter instanceof IItemAdapter) { ((IItemAdapter) adapter).removeRange(position + 1, previousCount); ((IItemAdapter) adapter).add(position + 1, expandable.getSubItems()); } return expandable.getSubItems().size(); } return 0; }
[ "public", "int", "notifyAdapterSubItemsChanged", "(", "int", "position", ",", "int", "previousCount", ")", "{", "Item", "item", "=", "mFastAdapter", ".", "getItem", "(", "position", ")", ";", "if", "(", "item", "!=", "null", "&&", "item", "instanceof", "IExpandable", ")", "{", "IExpandable", "expandable", "=", "(", "IExpandable", ")", "item", ";", "IAdapter", "adapter", "=", "mFastAdapter", ".", "getAdapter", "(", "position", ")", ";", "if", "(", "adapter", "!=", "null", "&&", "adapter", "instanceof", "IItemAdapter", ")", "{", "(", "(", "IItemAdapter", ")", "adapter", ")", ".", "removeRange", "(", "position", "+", "1", ",", "previousCount", ")", ";", "(", "(", "IItemAdapter", ")", "adapter", ")", ".", "add", "(", "position", "+", "1", ",", "expandable", ".", "getSubItems", "(", ")", ")", ";", "}", "return", "expandable", ".", "getSubItems", "(", ")", ".", "size", "(", ")", ";", "}", "return", "0", ";", "}" ]
notifies the fastAdapter about new / removed items within a sub hierarchy NOTE this currently only works for sub items with only 1 level @param position the global position of the parent item @param previousCount the previous count of sub items @return the new count of subItems
[ "notifies", "the", "fastAdapter", "about", "new", "/", "removed", "items", "within", "a", "sub", "hierarchy", "NOTE", "this", "currently", "only", "works", "for", "sub", "items", "with", "only", "1", "level" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java#L182-L194
Metatavu/edelphi
edelphi/src/main/java/fi/metatavu/edelphi/auth/AbstractAuthenticationStrategy.java
AbstractAuthenticationStrategy.resolveUser
private User resolveUser(RequestContext requestContext, List<String> emails) { """ Determines a common <code>User</code> corresponding to the given list of e-mail addresses. If none of the e-mail addresses are in use, returns <code>null</code>. If the e-mail addresses are associated to multiple user accounts, an <code>SmvcRuntimeException</code> is thrown. @param requestContext Request context @param emails The list of e-mail addresses to validate @return The common <code>User</code> corresponding to the given list of e-mail addresses, or <code>null</code> if the addresses are not in use @throws SmvcRuntimeException If the e-mail addresses are associated to multiple user accounts """ User user = null; UserEmailDAO userEmailDAO = new UserEmailDAO(); for (String email : emails) { UserEmail userEmail = userEmailDAO.findByAddress(email); if (userEmail != null) { if (user == null) { user = userEmail.getUser(); } else if (!user.getId().equals(userEmail.getUser().getId())) { Messages messages = Messages.getInstance(); Locale locale = requestContext.getRequest().getLocale(); throw new SmvcRuntimeException(EdelfoiStatusCode.LOGIN_MULTIPLE_ACCOUNTS, messages.getText(locale, "exception.1023.loginMultipleAccounts")); } } } return user; }
java
private User resolveUser(RequestContext requestContext, List<String> emails) { User user = null; UserEmailDAO userEmailDAO = new UserEmailDAO(); for (String email : emails) { UserEmail userEmail = userEmailDAO.findByAddress(email); if (userEmail != null) { if (user == null) { user = userEmail.getUser(); } else if (!user.getId().equals(userEmail.getUser().getId())) { Messages messages = Messages.getInstance(); Locale locale = requestContext.getRequest().getLocale(); throw new SmvcRuntimeException(EdelfoiStatusCode.LOGIN_MULTIPLE_ACCOUNTS, messages.getText(locale, "exception.1023.loginMultipleAccounts")); } } } return user; }
[ "private", "User", "resolveUser", "(", "RequestContext", "requestContext", ",", "List", "<", "String", ">", "emails", ")", "{", "User", "user", "=", "null", ";", "UserEmailDAO", "userEmailDAO", "=", "new", "UserEmailDAO", "(", ")", ";", "for", "(", "String", "email", ":", "emails", ")", "{", "UserEmail", "userEmail", "=", "userEmailDAO", ".", "findByAddress", "(", "email", ")", ";", "if", "(", "userEmail", "!=", "null", ")", "{", "if", "(", "user", "==", "null", ")", "{", "user", "=", "userEmail", ".", "getUser", "(", ")", ";", "}", "else", "if", "(", "!", "user", ".", "getId", "(", ")", ".", "equals", "(", "userEmail", ".", "getUser", "(", ")", ".", "getId", "(", ")", ")", ")", "{", "Messages", "messages", "=", "Messages", ".", "getInstance", "(", ")", ";", "Locale", "locale", "=", "requestContext", ".", "getRequest", "(", ")", ".", "getLocale", "(", ")", ";", "throw", "new", "SmvcRuntimeException", "(", "EdelfoiStatusCode", ".", "LOGIN_MULTIPLE_ACCOUNTS", ",", "messages", ".", "getText", "(", "locale", ",", "\"exception.1023.loginMultipleAccounts\"", ")", ")", ";", "}", "}", "}", "return", "user", ";", "}" ]
Determines a common <code>User</code> corresponding to the given list of e-mail addresses. If none of the e-mail addresses are in use, returns <code>null</code>. If the e-mail addresses are associated to multiple user accounts, an <code>SmvcRuntimeException</code> is thrown. @param requestContext Request context @param emails The list of e-mail addresses to validate @return The common <code>User</code> corresponding to the given list of e-mail addresses, or <code>null</code> if the addresses are not in use @throws SmvcRuntimeException If the e-mail addresses are associated to multiple user accounts
[ "Determines", "a", "common", "<code", ">", "User<", "/", "code", ">", "corresponding", "to", "the", "given", "list", "of", "e", "-", "mail", "addresses", ".", "If", "none", "of", "the", "e", "-", "mail", "addresses", "are", "in", "use", "returns", "<code", ">", "null<", "/", "code", ">", ".", "If", "the", "e", "-", "mail", "addresses", "are", "associated", "to", "multiple", "user", "accounts", "an", "<code", ">", "SmvcRuntimeException<", "/", "code", ">", "is", "thrown", "." ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/auth/AbstractAuthenticationStrategy.java#L140-L157
javagl/ND
nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/i/IntTupleNeighborhoodIterables.java
IntTupleNeighborhoodIterables.vonNeumannNeighborhoodIterable
public static Iterable<MutableIntTuple> vonNeumannNeighborhoodIterable( IntTuple center, final int radius) { """ Creates an iterable that provides iterators for iterating over the Von Neumann neighborhood of the given center and the given radius.<br> <br> Also see <a href="../../package-summary.html#Neighborhoods"> Neighborhoods</a> @param center The center of the Von Neumann neighborhood. A copy of this tuple will be stored internally. @param radius The radius of the Von Neumann neighborhood @return The iterable """ final IntTuple localCenter = IntTuples.copy(center); return new Iterable<MutableIntTuple>() { @Override public Iterator<MutableIntTuple> iterator() { return new VonNeumannIntTupleIterator(localCenter, radius); } }; }
java
public static Iterable<MutableIntTuple> vonNeumannNeighborhoodIterable( IntTuple center, final int radius) { final IntTuple localCenter = IntTuples.copy(center); return new Iterable<MutableIntTuple>() { @Override public Iterator<MutableIntTuple> iterator() { return new VonNeumannIntTupleIterator(localCenter, radius); } }; }
[ "public", "static", "Iterable", "<", "MutableIntTuple", ">", "vonNeumannNeighborhoodIterable", "(", "IntTuple", "center", ",", "final", "int", "radius", ")", "{", "final", "IntTuple", "localCenter", "=", "IntTuples", ".", "copy", "(", "center", ")", ";", "return", "new", "Iterable", "<", "MutableIntTuple", ">", "(", ")", "{", "@", "Override", "public", "Iterator", "<", "MutableIntTuple", ">", "iterator", "(", ")", "{", "return", "new", "VonNeumannIntTupleIterator", "(", "localCenter", ",", "radius", ")", ";", "}", "}", ";", "}" ]
Creates an iterable that provides iterators for iterating over the Von Neumann neighborhood of the given center and the given radius.<br> <br> Also see <a href="../../package-summary.html#Neighborhoods"> Neighborhoods</a> @param center The center of the Von Neumann neighborhood. A copy of this tuple will be stored internally. @param radius The radius of the Von Neumann neighborhood @return The iterable
[ "Creates", "an", "iterable", "that", "provides", "iterators", "for", "iterating", "over", "the", "Von", "Neumann", "neighborhood", "of", "the", "given", "center", "and", "the", "given", "radius", ".", "<br", ">", "<br", ">", "Also", "see", "<a", "href", "=", "..", "/", "..", "/", "package", "-", "summary", ".", "html#Neighborhoods", ">", "Neighborhoods<", "/", "a", ">" ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/i/IntTupleNeighborhoodIterables.java#L132-L144
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getAttribute
public <T> T getAttribute(String name, Class<T> type, T defaultValue) { """ Get attribute value converted to requested type or default value if there is no attribute with requested name. If given default value is null and attribute is not found this method still returns null, that is, the requested default value. @param name attribute name, @param type type to converter attribute value to, @param defaultValue default value. @param <T> type to convert attribute value to. @return newly created value object instance or default value. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws IllegalArgumentException if <code>type</code> argument is null. @throws ConverterException if there is no converter registered for value type or value parse fails. """ Params.notNullOrEmpty(name, "Attribute name"); Params.notNull(type, "Attribute type"); String value = attributes.get(name); return value != null ? converter.asObject(value, type) : defaultValue; }
java
public <T> T getAttribute(String name, Class<T> type, T defaultValue) { Params.notNullOrEmpty(name, "Attribute name"); Params.notNull(type, "Attribute type"); String value = attributes.get(name); return value != null ? converter.asObject(value, type) : defaultValue; }
[ "public", "<", "T", ">", "T", "getAttribute", "(", "String", "name", ",", "Class", "<", "T", ">", "type", ",", "T", "defaultValue", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Attribute name\"", ")", ";", "Params", ".", "notNull", "(", "type", ",", "\"Attribute type\"", ")", ";", "String", "value", "=", "attributes", ".", "get", "(", "name", ")", ";", "return", "value", "!=", "null", "?", "converter", ".", "asObject", "(", "value", ",", "type", ")", ":", "defaultValue", ";", "}" ]
Get attribute value converted to requested type or default value if there is no attribute with requested name. If given default value is null and attribute is not found this method still returns null, that is, the requested default value. @param name attribute name, @param type type to converter attribute value to, @param defaultValue default value. @param <T> type to convert attribute value to. @return newly created value object instance or default value. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws IllegalArgumentException if <code>type</code> argument is null. @throws ConverterException if there is no converter registered for value type or value parse fails.
[ "Get", "attribute", "value", "converted", "to", "requested", "type", "or", "default", "value", "if", "there", "is", "no", "attribute", "with", "requested", "name", ".", "If", "given", "default", "value", "is", "null", "and", "attribute", "is", "not", "found", "this", "method", "still", "returns", "null", "that", "is", "the", "requested", "default", "value", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L320-L326
azkaban/azkaban
azkaban-common/src/main/java/azkaban/executor/selector/CandidateFilter.java
CandidateFilter.filterTarget
public boolean filterTarget(final T filteringTarget, final V referencingObject) { """ function to analyze the target item according to the reference object to decide whether the item should be filtered. @param filteringTarget: object to be checked. @param referencingObject: object which contains statistics based on which a decision is made whether the object being checked need to be filtered or not. @return true if the check passed, false if check failed, which means the item need to be filtered. """ logger.debug(String.format("start filtering '%s' with factor filter for '%s'", filteringTarget == null ? "(null)" : filteringTarget.toString(), this.getName())); final Collection<FactorFilter<T, V>> filterList = this.factorFilterList.values(); boolean result = true; for (final FactorFilter<T, V> filter : filterList) { result &= filter.filterTarget(filteringTarget, referencingObject); logger.debug(String.format("[Factor: %s] filter result : %s ", filter.getFactorName(), result)); if (!result) { break; } } logger.debug(String.format("Final filtering result : %s ", result)); return result; }
java
public boolean filterTarget(final T filteringTarget, final V referencingObject) { logger.debug(String.format("start filtering '%s' with factor filter for '%s'", filteringTarget == null ? "(null)" : filteringTarget.toString(), this.getName())); final Collection<FactorFilter<T, V>> filterList = this.factorFilterList.values(); boolean result = true; for (final FactorFilter<T, V> filter : filterList) { result &= filter.filterTarget(filteringTarget, referencingObject); logger.debug(String.format("[Factor: %s] filter result : %s ", filter.getFactorName(), result)); if (!result) { break; } } logger.debug(String.format("Final filtering result : %s ", result)); return result; }
[ "public", "boolean", "filterTarget", "(", "final", "T", "filteringTarget", ",", "final", "V", "referencingObject", ")", "{", "logger", ".", "debug", "(", "String", ".", "format", "(", "\"start filtering '%s' with factor filter for '%s'\"", ",", "filteringTarget", "==", "null", "?", "\"(null)\"", ":", "filteringTarget", ".", "toString", "(", ")", ",", "this", ".", "getName", "(", ")", ")", ")", ";", "final", "Collection", "<", "FactorFilter", "<", "T", ",", "V", ">", ">", "filterList", "=", "this", ".", "factorFilterList", ".", "values", "(", ")", ";", "boolean", "result", "=", "true", ";", "for", "(", "final", "FactorFilter", "<", "T", ",", "V", ">", "filter", ":", "filterList", ")", "{", "result", "&=", "filter", ".", "filterTarget", "(", "filteringTarget", ",", "referencingObject", ")", ";", "logger", ".", "debug", "(", "String", ".", "format", "(", "\"[Factor: %s] filter result : %s \"", ",", "filter", ".", "getFactorName", "(", ")", ",", "result", ")", ")", ";", "if", "(", "!", "result", ")", "{", "break", ";", "}", "}", "logger", ".", "debug", "(", "String", ".", "format", "(", "\"Final filtering result : %s \"", ",", "result", ")", ")", ";", "return", "result", ";", "}" ]
function to analyze the target item according to the reference object to decide whether the item should be filtered. @param filteringTarget: object to be checked. @param referencingObject: object which contains statistics based on which a decision is made whether the object being checked need to be filtered or not. @return true if the check passed, false if check failed, which means the item need to be filtered.
[ "function", "to", "analyze", "the", "target", "item", "according", "to", "the", "reference", "object", "to", "decide", "whether", "the", "item", "should", "be", "filtered", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/executor/selector/CandidateFilter.java#L72-L89
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java
LogFileWriter.readEvents
public List<Pair<UIEvent, Table>> readEvents(long startOffset) throws IOException { """ Read all of the events starting at a specific file offset @return All of the UI events """ if(endStaticInfoOffset >= file.length()){ return Collections.emptyList(); } List<Pair<UIEvent, Table>> out = new ArrayList<>(); try (RandomAccessFile f = new RandomAccessFile(file, "r"); FileChannel fc = f.getChannel()) { f.seek(startOffset); while (f.getFilePointer() < f.length()) { //read 2 header ints int lengthHeader = f.readInt(); int lengthContent = f.readInt(); //Read header ByteBuffer bb = ByteBuffer.allocate(lengthHeader); f.getChannel().read(bb); bb.flip(); //Flip for reading UIEvent e = UIEvent.getRootAsUIEvent(bb); //Read Content bb = ByteBuffer.allocate(lengthContent); f.getChannel().read(bb); bb.flip(); //Flip for reading byte infoType = e.eventType(); Table t; switch (infoType) { case UIEventType.ADD_NAME: t = UIAddName.getRootAsUIAddName(bb); break; case UIEventType.SCALAR: case UIEventType.ARRAY: t = FlatArray.getRootAsFlatArray(bb); break; //TODO case UIEventType.ARRAY_LIST: case UIEventType.HISTOGRAM: case UIEventType.IMAGE: case UIEventType.SUMMARY_STATISTICS: case UIEventType.OP_TIMING: case UIEventType.HARDWARE_STATE: case UIEventType.GC_EVENT: default: throw new RuntimeException("Unknown or not yet implemented event type: " + e.eventType()); } //TODO do we need to close file here? out.add(new Pair<>(e, t)); } return out; } }
java
public List<Pair<UIEvent, Table>> readEvents(long startOffset) throws IOException { if(endStaticInfoOffset >= file.length()){ return Collections.emptyList(); } List<Pair<UIEvent, Table>> out = new ArrayList<>(); try (RandomAccessFile f = new RandomAccessFile(file, "r"); FileChannel fc = f.getChannel()) { f.seek(startOffset); while (f.getFilePointer() < f.length()) { //read 2 header ints int lengthHeader = f.readInt(); int lengthContent = f.readInt(); //Read header ByteBuffer bb = ByteBuffer.allocate(lengthHeader); f.getChannel().read(bb); bb.flip(); //Flip for reading UIEvent e = UIEvent.getRootAsUIEvent(bb); //Read Content bb = ByteBuffer.allocate(lengthContent); f.getChannel().read(bb); bb.flip(); //Flip for reading byte infoType = e.eventType(); Table t; switch (infoType) { case UIEventType.ADD_NAME: t = UIAddName.getRootAsUIAddName(bb); break; case UIEventType.SCALAR: case UIEventType.ARRAY: t = FlatArray.getRootAsFlatArray(bb); break; //TODO case UIEventType.ARRAY_LIST: case UIEventType.HISTOGRAM: case UIEventType.IMAGE: case UIEventType.SUMMARY_STATISTICS: case UIEventType.OP_TIMING: case UIEventType.HARDWARE_STATE: case UIEventType.GC_EVENT: default: throw new RuntimeException("Unknown or not yet implemented event type: " + e.eventType()); } //TODO do we need to close file here? out.add(new Pair<>(e, t)); } return out; } }
[ "public", "List", "<", "Pair", "<", "UIEvent", ",", "Table", ">", ">", "readEvents", "(", "long", "startOffset", ")", "throws", "IOException", "{", "if", "(", "endStaticInfoOffset", ">=", "file", ".", "length", "(", ")", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "List", "<", "Pair", "<", "UIEvent", ",", "Table", ">", ">", "out", "=", "new", "ArrayList", "<>", "(", ")", ";", "try", "(", "RandomAccessFile", "f", "=", "new", "RandomAccessFile", "(", "file", ",", "\"r\"", ")", ";", "FileChannel", "fc", "=", "f", ".", "getChannel", "(", ")", ")", "{", "f", ".", "seek", "(", "startOffset", ")", ";", "while", "(", "f", ".", "getFilePointer", "(", ")", "<", "f", ".", "length", "(", ")", ")", "{", "//read 2 header ints", "int", "lengthHeader", "=", "f", ".", "readInt", "(", ")", ";", "int", "lengthContent", "=", "f", ".", "readInt", "(", ")", ";", "//Read header", "ByteBuffer", "bb", "=", "ByteBuffer", ".", "allocate", "(", "lengthHeader", ")", ";", "f", ".", "getChannel", "(", ")", ".", "read", "(", "bb", ")", ";", "bb", ".", "flip", "(", ")", ";", "//Flip for reading", "UIEvent", "e", "=", "UIEvent", ".", "getRootAsUIEvent", "(", "bb", ")", ";", "//Read Content", "bb", "=", "ByteBuffer", ".", "allocate", "(", "lengthContent", ")", ";", "f", ".", "getChannel", "(", ")", ".", "read", "(", "bb", ")", ";", "bb", ".", "flip", "(", ")", ";", "//Flip for reading", "byte", "infoType", "=", "e", ".", "eventType", "(", ")", ";", "Table", "t", ";", "switch", "(", "infoType", ")", "{", "case", "UIEventType", ".", "ADD_NAME", ":", "t", "=", "UIAddName", ".", "getRootAsUIAddName", "(", "bb", ")", ";", "break", ";", "case", "UIEventType", ".", "SCALAR", ":", "case", "UIEventType", ".", "ARRAY", ":", "t", "=", "FlatArray", ".", "getRootAsFlatArray", "(", "bb", ")", ";", "break", ";", "//TODO", "case", "UIEventType", ".", "ARRAY_LIST", ":", "case", "UIEventType", ".", "HISTOGRAM", ":", "case", "UIEventType", ".", "IMAGE", ":", "case", "UIEventType", ".", "SUMMARY_STATISTICS", ":", "case", "UIEventType", ".", "OP_TIMING", ":", "case", "UIEventType", ".", "HARDWARE_STATE", ":", "case", "UIEventType", ".", "GC_EVENT", ":", "default", ":", "throw", "new", "RuntimeException", "(", "\"Unknown or not yet implemented event type: \"", "+", "e", ".", "eventType", "(", ")", ")", ";", "}", "//TODO do we need to close file here?", "out", ".", "add", "(", "new", "Pair", "<>", "(", "e", ",", "t", ")", ")", ";", "}", "return", "out", ";", "}", "}" ]
Read all of the events starting at a specific file offset @return All of the UI events
[ "Read", "all", "of", "the", "events", "starting", "at", "a", "specific", "file", "offset" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java#L189-L242