repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java
VariableInterpreter.setVariable
public static Object setVariable(PageContext pc, String var, Object value) throws PageException { StringList list = parse(pc, new ParserString(var), false); if (list == null) throw new InterpreterException("invalid variable name declaration [" + var + "]"); if (list.size() == 1) { return pc.undefinedScope().set(list.next(), value); } // min 2 elements int scope = scopeString2Int(pc.ignoreScopes(), list.next()); Object coll; if (scope == Scope.SCOPE_UNDEFINED) { coll = pc.touch(pc.undefinedScope(), KeyImpl.init(list.current())); } else { coll = VariableInterpreter.scope(pc, scope, true); // coll=pc.scope(scope); } while (list.hasNextNext()) { coll = pc.touch(coll, KeyImpl.init(list.next())); } return pc.set(coll, KeyImpl.init(list.next()), value); }
java
public static Object setVariable(PageContext pc, String var, Object value) throws PageException { StringList list = parse(pc, new ParserString(var), false); if (list == null) throw new InterpreterException("invalid variable name declaration [" + var + "]"); if (list.size() == 1) { return pc.undefinedScope().set(list.next(), value); } // min 2 elements int scope = scopeString2Int(pc.ignoreScopes(), list.next()); Object coll; if (scope == Scope.SCOPE_UNDEFINED) { coll = pc.touch(pc.undefinedScope(), KeyImpl.init(list.current())); } else { coll = VariableInterpreter.scope(pc, scope, true); // coll=pc.scope(scope); } while (list.hasNextNext()) { coll = pc.touch(coll, KeyImpl.init(list.next())); } return pc.set(coll, KeyImpl.init(list.next()), value); }
[ "public", "static", "Object", "setVariable", "(", "PageContext", "pc", ",", "String", "var", ",", "Object", "value", ")", "throws", "PageException", "{", "StringList", "list", "=", "parse", "(", "pc", ",", "new", "ParserString", "(", "var", ")", ",", "fals...
sets a variable to page Context @param pc pagecontext of the new variable @param var String of variable definition @param value value to set to variable @return value setted @throws PageException
[ "sets", "a", "variable", "to", "page", "Context" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java#L361-L384
aws/aws-sdk-java
aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/InventoryResultItem.java
InventoryResultItem.withContent
public InventoryResultItem withContent(java.util.Collection<java.util.Map<String, String>> content) { setContent(content); return this; }
java
public InventoryResultItem withContent(java.util.Collection<java.util.Map<String, String>> content) { setContent(content); return this; }
[ "public", "InventoryResultItem", "withContent", "(", "java", ".", "util", ".", "Collection", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", ">", "content", ")", "{", "setContent", "(", "content", ")", ";", "return", "this", ";",...
<p> Contains all the inventory data of the item type. Results include attribute names and values. </p> @param content Contains all the inventory data of the item type. Results include attribute names and values. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Contains", "all", "the", "inventory", "data", "of", "the", "item", "type", ".", "Results", "include", "attribute", "names", "and", "values", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/InventoryResultItem.java#L304-L307
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newSystemException
public static SystemException newSystemException(Throwable cause, String message, Object... args) { return new SystemException(format(message, args), cause); }
java
public static SystemException newSystemException(Throwable cause, String message, Object... args) { return new SystemException(format(message, args), cause); }
[ "public", "static", "SystemException", "newSystemException", "(", "Throwable", "cause", ",", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "new", "SystemException", "(", "format", "(", "message", ",", "args", ")", ",", "cause", ")", ...
Constructs and initializes a new {@link SystemException} with the given {@link Throwable cause} and {@link String message} formatted with the given {@link Object[] arguments}. @param cause {@link Throwable} identified as the reason this {@link SystemException} was thrown. @param message {@link String} describing the {@link SystemException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link SystemException} with the given {@link Throwable cause} and {@link String message}. @see org.cp.elements.util.SystemException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "SystemException", "}", "with", "the", "given", "{", "@link", "Throwable", "cause", "}", "and", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object",...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L915-L917
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.fileDump
public static final void fileDump(String fileName, byte[] data) { System.out.println("FILE DUMP"); try { FileOutputStream os = new FileOutputStream(fileName); os.write(data); os.close(); } catch (IOException ex) { ex.printStackTrace(); } }
java
public static final void fileDump(String fileName, byte[] data) { System.out.println("FILE DUMP"); try { FileOutputStream os = new FileOutputStream(fileName); os.write(data); os.close(); } catch (IOException ex) { ex.printStackTrace(); } }
[ "public", "static", "final", "void", "fileDump", "(", "String", "fileName", ",", "byte", "[", "]", "data", ")", "{", "System", ".", "out", ".", "println", "(", "\"FILE DUMP\"", ")", ";", "try", "{", "FileOutputStream", "os", "=", "new", "FileOutputStream",...
Writes a large byte array to a file. @param fileName output file name @param data target data
[ "Writes", "a", "large", "byte", "array", "to", "a", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L1000-L1014
SUSE/salt-netapi-client
src/main/java/com/suse/salt/netapi/event/WebSocketEventStream.java
WebSocketEventStream.initializeStream
private void initializeStream(URI uri, Token token, long sessionIdleTimeout, long idleTimeout) throws SaltException { try { URI adjustedURI = new URI(uri.getScheme() == "https" ? "wss" : "ws", uri.getSchemeSpecificPart(), uri.getFragment()) .resolve("ws/" + token.getToken()); websocketContainer.setDefaultMaxSessionIdleTimeout(sessionIdleTimeout); // Initiate the websocket handshake synchronized (websocketContainer) { session = websocketContainer.connectToServer(this, adjustedURI); session.setMaxIdleTimeout(idleTimeout); } } catch (URISyntaxException | DeploymentException | IOException e) { throw new SaltException(e); } }
java
private void initializeStream(URI uri, Token token, long sessionIdleTimeout, long idleTimeout) throws SaltException { try { URI adjustedURI = new URI(uri.getScheme() == "https" ? "wss" : "ws", uri.getSchemeSpecificPart(), uri.getFragment()) .resolve("ws/" + token.getToken()); websocketContainer.setDefaultMaxSessionIdleTimeout(sessionIdleTimeout); // Initiate the websocket handshake synchronized (websocketContainer) { session = websocketContainer.connectToServer(this, adjustedURI); session.setMaxIdleTimeout(idleTimeout); } } catch (URISyntaxException | DeploymentException | IOException e) { throw new SaltException(e); } }
[ "private", "void", "initializeStream", "(", "URI", "uri", ",", "Token", "token", ",", "long", "sessionIdleTimeout", ",", "long", "idleTimeout", ")", "throws", "SaltException", "{", "try", "{", "URI", "adjustedURI", "=", "new", "URI", "(", "uri", ".", "getSch...
Connect the WebSocket to the server pointing to /ws/{token} to receive events. @throws SaltException in case of an error during stream initialization
[ "Connect", "the", "WebSocket", "to", "the", "server", "pointing", "to", "/", "ws", "/", "{", "token", "}", "to", "receive", "events", "." ]
train
https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/event/WebSocketEventStream.java#L88-L104
facebookarchive/hadoop-20
src/core/org/apache/hadoop/raid/GaloisField.java
GaloisField.solveVandermondeSystem
public void solveVandermondeSystem(int[] x, int[] y, int len) { assert(x.length <= len && y.length <= len); for (int i = 0; i < len - 1; i++) { for (int j = len - 1; j > i; j--) { y[j] = y[j] ^ mulTable[x[i]][y[j - 1]]; } } for (int i = len - 1; i >= 0; i--) { for (int j = i + 1; j < len; j++) { y[j] = divTable[y[j]][x[j] ^ x[j - i - 1]]; } for (int j = i; j < len - 1; j++) { y[j] = y[j] ^ y[j + 1]; } } }
java
public void solveVandermondeSystem(int[] x, int[] y, int len) { assert(x.length <= len && y.length <= len); for (int i = 0; i < len - 1; i++) { for (int j = len - 1; j > i; j--) { y[j] = y[j] ^ mulTable[x[i]][y[j - 1]]; } } for (int i = len - 1; i >= 0; i--) { for (int j = i + 1; j < len; j++) { y[j] = divTable[y[j]][x[j] ^ x[j - i - 1]]; } for (int j = i; j < len - 1; j++) { y[j] = y[j] ^ y[j + 1]; } } }
[ "public", "void", "solveVandermondeSystem", "(", "int", "[", "]", "x", ",", "int", "[", "]", "y", ",", "int", "len", ")", "{", "assert", "(", "x", ".", "length", "<=", "len", "&&", "y", ".", "length", "<=", "len", ")", ";", "for", "(", "int", "...
Given a Vandermonde matrix V[i][j]=x[j]^i and vector y, solve for z such that Vz=y. The output z will be placed in y. @param x the vector which describe the Vandermonde matrix @param y right-hand side of the Vandermonde system equation. will be replaced the output in this vector @param len consider x and y only from 0...len-1
[ "Given", "a", "Vandermonde", "matrix", "V", "[", "i", "]", "[", "j", "]", "=", "x", "[", "j", "]", "^i", "and", "vector", "y", "solve", "for", "z", "such", "that", "Vz", "=", "y", ".", "The", "output", "z", "will", "be", "placed", "in", "y", ...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/raid/GaloisField.java#L207-L222
ksclarke/vertx-pairtree
src/main/java/info/freelibrary/pairtree/s3/S3Client.java
S3Client.createPutRequest
public S3ClientRequest createPutRequest(final String aBucket, final String aKey, final Handler<HttpClientResponse> aHandler) { final HttpClientRequest httpRequest = myHTTPClient.put(PATH_SEP + aBucket + PATH_SEP + aKey, aHandler); return new S3ClientRequest("PUT", aBucket, aKey, httpRequest, myAccessKey, mySecretKey, mySessionToken); }
java
public S3ClientRequest createPutRequest(final String aBucket, final String aKey, final Handler<HttpClientResponse> aHandler) { final HttpClientRequest httpRequest = myHTTPClient.put(PATH_SEP + aBucket + PATH_SEP + aKey, aHandler); return new S3ClientRequest("PUT", aBucket, aKey, httpRequest, myAccessKey, mySecretKey, mySessionToken); }
[ "public", "S3ClientRequest", "createPutRequest", "(", "final", "String", "aBucket", ",", "final", "String", "aKey", ",", "final", "Handler", "<", "HttpClientResponse", ">", "aHandler", ")", "{", "final", "HttpClientRequest", "httpRequest", "=", "myHTTPClient", ".", ...
Creates an S3 PUT request. <p> <code>create PUT -&gt; requestObject</code> </p> @param aBucket An S3 bucket @param aKey An S3 key @param aHandler A response handler @return An S3 PUT request
[ "Creates", "an", "S3", "PUT", "request", ".", "<p", ">", "<code", ">", "create", "PUT", "-", "&gt", ";", "requestObject<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/ksclarke/vertx-pairtree/blob/b2ea1e32057e5df262e9265540d346a732b718df/src/main/java/info/freelibrary/pairtree/s3/S3Client.java#L251-L255
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java
RTMPHandshake.getBlowfishSignature
public final static void getBlowfishSignature(byte[] array, int offset, int keyid) { BlowfishEngine bf = new BlowfishEngine(); // need to use little endian bf.init(true, new KeyParameter(BLOWFISH_KEYS[keyid])); byte[] output = new byte[8]; bf.processBlock(array, offset, output, 0); System.arraycopy(output, 0, array, offset, 8); }
java
public final static void getBlowfishSignature(byte[] array, int offset, int keyid) { BlowfishEngine bf = new BlowfishEngine(); // need to use little endian bf.init(true, new KeyParameter(BLOWFISH_KEYS[keyid])); byte[] output = new byte[8]; bf.processBlock(array, offset, output, 0); System.arraycopy(output, 0, array, offset, 8); }
[ "public", "final", "static", "void", "getBlowfishSignature", "(", "byte", "[", "]", "array", ",", "int", "offset", ",", "int", "keyid", ")", "{", "BlowfishEngine", "bf", "=", "new", "BlowfishEngine", "(", ")", ";", "// need to use little endian\r", "bf", ".", ...
RTMPE type 9 uses Blowfish on the regular signature http://en.wikipedia.org/wiki/Blowfish_(cipher) @param array array to get signature @param offset offset to start from @param keyid ID of XTEA key
[ "RTMPE", "type", "9", "uses", "Blowfish", "on", "the", "regular", "signature", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Blowfish_", "(", "cipher", ")" ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L582-L589
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/jdbc/MultiRowJdbcPersonAttributeDao.java
MultiRowJdbcPersonAttributeDao.setNameValueColumnMappings
public void setNameValueColumnMappings(final Map<String, ?> nameValueColumnMap) { if (nameValueColumnMap == null) { this.nameValueColumnMappings = null; } else { final Map<String, Set<String>> mappings = MultivaluedPersonAttributeUtils.parseAttributeToAttributeMapping(nameValueColumnMap); if (mappings.containsValue(null)) { throw new IllegalArgumentException("nameValueColumnMap may not have null values"); } this.nameValueColumnMappings = mappings; } }
java
public void setNameValueColumnMappings(final Map<String, ?> nameValueColumnMap) { if (nameValueColumnMap == null) { this.nameValueColumnMappings = null; } else { final Map<String, Set<String>> mappings = MultivaluedPersonAttributeUtils.parseAttributeToAttributeMapping(nameValueColumnMap); if (mappings.containsValue(null)) { throw new IllegalArgumentException("nameValueColumnMap may not have null values"); } this.nameValueColumnMappings = mappings; } }
[ "public", "void", "setNameValueColumnMappings", "(", "final", "Map", "<", "String", ",", "?", ">", "nameValueColumnMap", ")", "{", "if", "(", "nameValueColumnMap", "==", "null", ")", "{", "this", ".", "nameValueColumnMappings", "=", "null", ";", "}", "else", ...
The {@link Map} of columns from a name column to value columns. Keys are Strings, Values are Strings or {@link java.util.List} of Strings. @param nameValueColumnMap The Map of name column to value column(s).
[ "The", "{", "@link", "Map", "}", "of", "columns", "from", "a", "name", "column", "to", "value", "columns", ".", "Keys", "are", "Strings", "Values", "are", "Strings", "or", "{", "@link", "java", ".", "util", ".", "List", "}", "of", "Strings", "." ]
train
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/jdbc/MultiRowJdbcPersonAttributeDao.java#L140-L152
alkacon/opencms-core
src/org/opencms/main/CmsShellCommands.java
CmsShellCommands.importResourcesWithTempProject
public void importResourcesWithTempProject(String importFile) throws Exception { CmsProject project = m_cms.createProject( "SystemUpdate", getMessages().key(Messages.GUI_SHELL_IMPORT_TEMP_PROJECT_NAME_0), OpenCms.getDefaultUsers().getGroupAdministrators(), OpenCms.getDefaultUsers().getGroupAdministrators(), CmsProject.PROJECT_TYPE_TEMPORARY); CmsUUID id = project.getUuid(); m_cms.getRequestContext().setCurrentProject(project); m_cms.copyResourceToProject("/"); CmsImportParameters params = new CmsImportParameters(importFile, "/", true); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); m_cms.unlockProject(id); OpenCms.getPublishManager().publishProject(m_cms); OpenCms.getPublishManager().waitWhileRunning(); }
java
public void importResourcesWithTempProject(String importFile) throws Exception { CmsProject project = m_cms.createProject( "SystemUpdate", getMessages().key(Messages.GUI_SHELL_IMPORT_TEMP_PROJECT_NAME_0), OpenCms.getDefaultUsers().getGroupAdministrators(), OpenCms.getDefaultUsers().getGroupAdministrators(), CmsProject.PROJECT_TYPE_TEMPORARY); CmsUUID id = project.getUuid(); m_cms.getRequestContext().setCurrentProject(project); m_cms.copyResourceToProject("/"); CmsImportParameters params = new CmsImportParameters(importFile, "/", true); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); m_cms.unlockProject(id); OpenCms.getPublishManager().publishProject(m_cms); OpenCms.getPublishManager().waitWhileRunning(); }
[ "public", "void", "importResourcesWithTempProject", "(", "String", "importFile", ")", "throws", "Exception", "{", "CmsProject", "project", "=", "m_cms", ".", "createProject", "(", "\"SystemUpdate\"", ",", "getMessages", "(", ")", ".", "key", "(", "Messages", ".", ...
Imports a folder or a ZIP file to the root folder of the current site, creating a temporary project for this.<p> @param importFile the absolute path of the import resource @throws Exception if something goes wrong
[ "Imports", "a", "folder", "or", "a", "ZIP", "file", "to", "the", "root", "folder", "of", "the", "current", "site", "creating", "a", "temporary", "project", "for", "this", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L954-L976
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/PippoSettings.java
PippoSettings.getLong
public long getLong(String name, long defaultValue) { try { String value = getString(name, null); if (!StringUtils.isNullOrEmpty(value)) { return Long.parseLong(value.trim()); } } catch (NumberFormatException e) { log.warn("Failed to parse long for " + name + USING_DEFAULT_OF + defaultValue); } return defaultValue; }
java
public long getLong(String name, long defaultValue) { try { String value = getString(name, null); if (!StringUtils.isNullOrEmpty(value)) { return Long.parseLong(value.trim()); } } catch (NumberFormatException e) { log.warn("Failed to parse long for " + name + USING_DEFAULT_OF + defaultValue); } return defaultValue; }
[ "public", "long", "getLong", "(", "String", "name", ",", "long", "defaultValue", ")", "{", "try", "{", "String", "value", "=", "getString", "(", "name", ",", "null", ")", ";", "if", "(", "!", "StringUtils", ".", "isNullOrEmpty", "(", "value", ")", ")",...
Returns the long value for the specified name. If the name does not exist or the value for the name can not be interpreted as an long, the defaultValue is returned. @param name @param defaultValue @return name value or defaultValue
[ "Returns", "the", "long", "value", "for", "the", "specified", "name", ".", "If", "the", "name", "does", "not", "exist", "or", "the", "value", "for", "the", "name", "can", "not", "be", "interpreted", "as", "an", "long", "the", "defaultValue", "is", "retur...
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L518-L530
linkedin/PalDB
paldb/src/main/java/com/linkedin/paldb/utils/LongPacker.java
LongPacker.packLong
static public int packLong(DataOutput os, long value) throws IOException { if (value < 0) { throw new IllegalArgumentException("negative value: v=" + value); } int i = 1; while ((value & ~0x7FL) != 0) { os.write((((int) value & 0x7F) | 0x80)); value >>>= 7; i++; } os.write((byte) value); return i; }
java
static public int packLong(DataOutput os, long value) throws IOException { if (value < 0) { throw new IllegalArgumentException("negative value: v=" + value); } int i = 1; while ((value & ~0x7FL) != 0) { os.write((((int) value & 0x7F) | 0x80)); value >>>= 7; i++; } os.write((byte) value); return i; }
[ "static", "public", "int", "packLong", "(", "DataOutput", "os", ",", "long", "value", ")", "throws", "IOException", "{", "if", "(", "value", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"negative value: v=\"", "+", "value", ")", ";"...
Pack non-negative long into output stream. It will occupy 1-10 bytes depending on value (lower values occupy smaller space) @param os the data output @param value the long value @return the number of bytes written @throws IOException if an error occurs with the stream
[ "Pack", "non", "-", "negative", "long", "into", "output", "stream", ".", "It", "will", "occupy", "1", "-", "10", "bytes", "depending", "on", "value", "(", "lower", "values", "occupy", "smaller", "space", ")" ]
train
https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/utils/LongPacker.java#L45-L60
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java
WhiteboxImpl.getField
@SuppressWarnings({"unchecked", "rawtypes"}) public static Field getField(Class<?> type, String fieldName) { LinkedList<Class<?>> examine = new LinkedList<Class<?>>(); examine.add(type); Set<Class<?>> done = new HashSet<Class<?>>(); while (!examine.isEmpty()) { Class<?> thisType = examine.removeFirst(); done.add(thisType); final Field[] declaredField = thisType.getDeclaredFields(); for (Field field : declaredField) { if (fieldName.equals(field.getName())) { field.setAccessible(true); return field; } } Set<Class<?>> potential = new HashSet<Class<?>>(); final Class<?> clazz = thisType.getSuperclass(); if (clazz != null) { potential.add(thisType.getSuperclass()); } potential.addAll((Collection) Arrays.asList(thisType.getInterfaces())); potential.removeAll(done); examine.addAll(potential); } throwExceptionIfFieldWasNotFound(type, fieldName, null); return null; }
java
@SuppressWarnings({"unchecked", "rawtypes"}) public static Field getField(Class<?> type, String fieldName) { LinkedList<Class<?>> examine = new LinkedList<Class<?>>(); examine.add(type); Set<Class<?>> done = new HashSet<Class<?>>(); while (!examine.isEmpty()) { Class<?> thisType = examine.removeFirst(); done.add(thisType); final Field[] declaredField = thisType.getDeclaredFields(); for (Field field : declaredField) { if (fieldName.equals(field.getName())) { field.setAccessible(true); return field; } } Set<Class<?>> potential = new HashSet<Class<?>>(); final Class<?> clazz = thisType.getSuperclass(); if (clazz != null) { potential.add(thisType.getSuperclass()); } potential.addAll((Collection) Arrays.asList(thisType.getInterfaces())); potential.removeAll(done); examine.addAll(potential); } throwExceptionIfFieldWasNotFound(type, fieldName, null); return null; }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "static", "Field", "getField", "(", "Class", "<", "?", ">", "type", ",", "String", "fieldName", ")", "{", "LinkedList", "<", "Class", "<", "?", ">", ">", "examin...
Convenience method to get a field from a class type. The method will first try to look for a declared field in the same class. If the method is not declared in this class it will look for the field in the super class. This will continue throughout the whole class hierarchy. If the field is not found an {@link IllegalArgumentException} is thrown. @param type The type of the class where the method is located. @param fieldName The method names. @return A .
[ "Convenience", "method", "to", "get", "a", "field", "from", "a", "class", "type", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L198-L225
landawn/AbacusUtil
src/com/landawn/abacus/util/Maps.java
Maps.getOrDefault
public static <K, V> V getOrDefault(final Map<K, V> map, final Object key, final V defaultValue) { if (N.isNullOrEmpty(map)) { return defaultValue; } final V val = map.get(key); if (val != null || map.containsKey(key)) { return val; } else { return defaultValue; } }
java
public static <K, V> V getOrDefault(final Map<K, V> map, final Object key, final V defaultValue) { if (N.isNullOrEmpty(map)) { return defaultValue; } final V val = map.get(key); if (val != null || map.containsKey(key)) { return val; } else { return defaultValue; } }
[ "public", "static", "<", "K", ",", "V", ">", "V", "getOrDefault", "(", "final", "Map", "<", "K", ",", "V", ">", "map", ",", "final", "Object", "key", ",", "final", "V", "defaultValue", ")", "{", "if", "(", "N", ".", "isNullOrEmpty", "(", "map", "...
Returns the value to which the specified key is mapped, or {@code defaultValue} if this map contains no mapping for the key. @param map @param key @param defaultValue @return
[ "Returns", "the", "value", "to", "which", "the", "specified", "key", "is", "mapped", "or", "{", "@code", "defaultValue", "}", "if", "this", "map", "contains", "no", "mapping", "for", "the", "key", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Maps.java#L234-L246
Azure/azure-sdk-for-java
features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeaturesInner.java
FeaturesInner.registerAsync
public Observable<FeatureResultInner> registerAsync(String resourceProviderNamespace, String featureName) { return registerWithServiceResponseAsync(resourceProviderNamespace, featureName).map(new Func1<ServiceResponse<FeatureResultInner>, FeatureResultInner>() { @Override public FeatureResultInner call(ServiceResponse<FeatureResultInner> response) { return response.body(); } }); }
java
public Observable<FeatureResultInner> registerAsync(String resourceProviderNamespace, String featureName) { return registerWithServiceResponseAsync(resourceProviderNamespace, featureName).map(new Func1<ServiceResponse<FeatureResultInner>, FeatureResultInner>() { @Override public FeatureResultInner call(ServiceResponse<FeatureResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "FeatureResultInner", ">", "registerAsync", "(", "String", "resourceProviderNamespace", ",", "String", "featureName", ")", "{", "return", "registerWithServiceResponseAsync", "(", "resourceProviderNamespace", ",", "featureName", ")", ".", "map"...
Registers the preview feature for the subscription. @param resourceProviderNamespace The namespace of the resource provider. @param featureName The name of the feature to register. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the FeatureResultInner object
[ "Registers", "the", "preview", "feature", "for", "the", "subscription", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeaturesInner.java#L430-L437
samskivert/pythagoras
src/main/java/pythagoras/d/Quaternion.java
Quaternion.fromAxes
public Quaternion fromAxes (IVector3 nx, IVector3 ny, IVector3 nz) { double nxx = nx.x(), nyy = ny.y(), nzz = nz.z(); double x2 = (1f + nxx - nyy - nzz)/4f; double y2 = (1f - nxx + nyy - nzz)/4f; double z2 = (1f - nxx - nyy + nzz)/4f; double w2 = (1f - x2 - y2 - z2); return set(Math.sqrt(x2) * (ny.z() >= nz.y() ? +1f : -1f), Math.sqrt(y2) * (nz.x() >= nx.z() ? +1f : -1f), Math.sqrt(z2) * (nx.y() >= ny.x() ? +1f : -1f), Math.sqrt(w2)); }
java
public Quaternion fromAxes (IVector3 nx, IVector3 ny, IVector3 nz) { double nxx = nx.x(), nyy = ny.y(), nzz = nz.z(); double x2 = (1f + nxx - nyy - nzz)/4f; double y2 = (1f - nxx + nyy - nzz)/4f; double z2 = (1f - nxx - nyy + nzz)/4f; double w2 = (1f - x2 - y2 - z2); return set(Math.sqrt(x2) * (ny.z() >= nz.y() ? +1f : -1f), Math.sqrt(y2) * (nz.x() >= nx.z() ? +1f : -1f), Math.sqrt(z2) * (nx.y() >= ny.x() ? +1f : -1f), Math.sqrt(w2)); }
[ "public", "Quaternion", "fromAxes", "(", "IVector3", "nx", ",", "IVector3", "ny", ",", "IVector3", "nz", ")", "{", "double", "nxx", "=", "nx", ".", "x", "(", ")", ",", "nyy", "=", "ny", ".", "y", "(", ")", ",", "nzz", "=", "nz", ".", "z", "(", ...
Sets this quaternion to one that rotates onto the given unit axes. @return a reference to this quaternion, for chaining.
[ "Sets", "this", "quaternion", "to", "one", "that", "rotates", "onto", "the", "given", "unit", "axes", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Quaternion.java#L137-L147
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
ConstantsSummaryBuilder.buildClassConstantSummary
public void buildClassConstantSummary(XMLNode node, Content summariesTree) { ClassDoc[] classes = currentPackage.name().length() > 0 ? currentPackage.allClasses() : configuration.classDocCatalog.allClasses( DocletConstants.DEFAULT_PACKAGE_NAME); Arrays.sort(classes); Content classConstantTree = writer.getClassConstantHeader(); for (int i = 0; i < classes.length; i++) { if (! classDocsWithConstFields.contains(classes[i]) || ! classes[i].isIncluded()) { continue; } currentClass = classes[i]; //Build the documentation for the current class. buildChildren(node, classConstantTree); } summariesTree.addContent(classConstantTree); }
java
public void buildClassConstantSummary(XMLNode node, Content summariesTree) { ClassDoc[] classes = currentPackage.name().length() > 0 ? currentPackage.allClasses() : configuration.classDocCatalog.allClasses( DocletConstants.DEFAULT_PACKAGE_NAME); Arrays.sort(classes); Content classConstantTree = writer.getClassConstantHeader(); for (int i = 0; i < classes.length; i++) { if (! classDocsWithConstFields.contains(classes[i]) || ! classes[i].isIncluded()) { continue; } currentClass = classes[i]; //Build the documentation for the current class. buildChildren(node, classConstantTree); } summariesTree.addContent(classConstantTree); }
[ "public", "void", "buildClassConstantSummary", "(", "XMLNode", "node", ",", "Content", "summariesTree", ")", "{", "ClassDoc", "[", "]", "classes", "=", "currentPackage", ".", "name", "(", ")", ".", "length", "(", ")", ">", "0", "?", "currentPackage", ".", ...
Build the summary for the current class. @param node the XML element that specifies which components to document @param summariesTree the tree to which the class constant summary will be added
[ "Build", "the", "summary", "for", "the", "current", "class", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java#L207-L224
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.resolveSelfContaining
Symbol resolveSelfContaining(DiagnosticPosition pos, Env<AttrContext> env, Symbol member, boolean isSuperCall) { Symbol sym = resolveSelfContainingInternal(env, member, isSuperCall); if (sym == null) { log.error(pos, "encl.class.required", member); return syms.errSymbol; } else { return accessBase(sym, pos, env.enclClass.sym.type, sym.name, true); } }
java
Symbol resolveSelfContaining(DiagnosticPosition pos, Env<AttrContext> env, Symbol member, boolean isSuperCall) { Symbol sym = resolveSelfContainingInternal(env, member, isSuperCall); if (sym == null) { log.error(pos, "encl.class.required", member); return syms.errSymbol; } else { return accessBase(sym, pos, env.enclClass.sym.type, sym.name, true); } }
[ "Symbol", "resolveSelfContaining", "(", "DiagnosticPosition", "pos", ",", "Env", "<", "AttrContext", ">", "env", ",", "Symbol", "member", ",", "boolean", "isSuperCall", ")", "{", "Symbol", "sym", "=", "resolveSelfContainingInternal", "(", "env", ",", "member", "...
Resolve `c.this' for an enclosing class c that contains the named member. @param pos The position to use for error reporting. @param env The environment current at the expression. @param member The member that must be contained in the result.
[ "Resolve", "c", ".", "this", "for", "an", "enclosing", "class", "c", "that", "contains", "the", "named", "member", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L3577-L3588
jledit/jledit
core/src/main/java/org/jledit/utils/Strings.java
Strings.tryToTrimToSize
public static String tryToTrimToSize(String s, int length, boolean trimSuffix) { if (s == null || s.isEmpty()) { return s; } else if (s.length() <= length) { return s; } else if (s.contains(File.separator)) { String before = s.substring(0, s.lastIndexOf(File.separator)); String after = s.substring(s.lastIndexOf(File.separator)); if (!trimSuffix && length - after.length() > 4) { return Strings.tryToTrimToSize(before, length - after.length(), true) + after; } else { return Strings.tryToTrimToSize(before, length - 3, true) + File.separator + ".."; } } else { return ".."; } }
java
public static String tryToTrimToSize(String s, int length, boolean trimSuffix) { if (s == null || s.isEmpty()) { return s; } else if (s.length() <= length) { return s; } else if (s.contains(File.separator)) { String before = s.substring(0, s.lastIndexOf(File.separator)); String after = s.substring(s.lastIndexOf(File.separator)); if (!trimSuffix && length - after.length() > 4) { return Strings.tryToTrimToSize(before, length - after.length(), true) + after; } else { return Strings.tryToTrimToSize(before, length - 3, true) + File.separator + ".."; } } else { return ".."; } }
[ "public", "static", "String", "tryToTrimToSize", "(", "String", "s", ",", "int", "length", ",", "boolean", "trimSuffix", ")", "{", "if", "(", "s", "==", "null", "||", "s", ".", "isEmpty", "(", ")", ")", "{", "return", "s", ";", "}", "else", "if", "...
Try to trim a String to the given size. @param s The String to trim. @param length The trim length. @param trimSuffix Flag the specifies if trimming should be applied to the suffix of the String. @return
[ "Try", "to", "trim", "a", "String", "to", "the", "given", "size", "." ]
train
https://github.com/jledit/jledit/blob/ced2c4b44330664adb65f8be4c8fff780ccaa6fd/core/src/main/java/org/jledit/utils/Strings.java#L44-L60
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/lock/LockTable.java
LockTable.addLock
public synchronized SessionInfo addLock(Object bookmark, SessionInfo sessionInfo) { Utility.getLogger().info("Lock: " + bookmark + ", Session: " + sessionInfo.m_iSessionID + " success: " + !this.containsKey(bookmark)); if (this.containsKey(bookmark)) return (SessionInfo)this.get(bookmark); // Error, already locked return (SessionInfo)this.put(bookmark, sessionInfo); // Returns null }
java
public synchronized SessionInfo addLock(Object bookmark, SessionInfo sessionInfo) { Utility.getLogger().info("Lock: " + bookmark + ", Session: " + sessionInfo.m_iSessionID + " success: " + !this.containsKey(bookmark)); if (this.containsKey(bookmark)) return (SessionInfo)this.get(bookmark); // Error, already locked return (SessionInfo)this.put(bookmark, sessionInfo); // Returns null }
[ "public", "synchronized", "SessionInfo", "addLock", "(", "Object", "bookmark", ",", "SessionInfo", "sessionInfo", ")", "{", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"Lock: \"", "+", "bookmark", "+", "\", Session: \"", "+", "sessionInfo", ".", ...
Add this lock to the table. @param bookmark The bookmark to lock. @param session The session to lock. @return null if successful, the session of the locking user if not successful.
[ "Add", "this", "lock", "to", "the", "table", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/lock/LockTable.java#L34-L40
sockeqwe/AdapterDelegates
library/src/main/java/com/hannesdorfmann/adapterdelegates4/AdapterDelegatesManager.java
AdapterDelegatesManager.onCreateViewHolder
@NonNull public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { AdapterDelegate<T> delegate = getDelegateForViewType(viewType); if (delegate == null) { throw new NullPointerException("No AdapterDelegate added for ViewType " + viewType); } RecyclerView.ViewHolder vh = delegate.onCreateViewHolder(parent); if (vh == null) { throw new NullPointerException("ViewHolder returned from AdapterDelegate " + delegate + " for ViewType =" + viewType + " is null!"); } return vh; }
java
@NonNull public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { AdapterDelegate<T> delegate = getDelegateForViewType(viewType); if (delegate == null) { throw new NullPointerException("No AdapterDelegate added for ViewType " + viewType); } RecyclerView.ViewHolder vh = delegate.onCreateViewHolder(parent); if (vh == null) { throw new NullPointerException("ViewHolder returned from AdapterDelegate " + delegate + " for ViewType =" + viewType + " is null!"); } return vh; }
[ "@", "NonNull", "public", "RecyclerView", ".", "ViewHolder", "onCreateViewHolder", "(", "@", "NonNull", "ViewGroup", "parent", ",", "int", "viewType", ")", "{", "AdapterDelegate", "<", "T", ">", "delegate", "=", "getDelegateForViewType", "(", "viewType", ")", ";...
This method must be called in {@link RecyclerView.Adapter#onCreateViewHolder(ViewGroup, int)} @param parent the parent @param viewType the view type @return The new created ViewHolder @throws NullPointerException if no AdapterDelegate has been registered for ViewHolders viewType
[ "This", "method", "must", "be", "called", "in", "{", "@link", "RecyclerView", ".", "Adapter#onCreateViewHolder", "(", "ViewGroup", "int", ")", "}" ]
train
https://github.com/sockeqwe/AdapterDelegates/blob/d18dc609415e5d17a3354bddf4bae62440e017af/library/src/main/java/com/hannesdorfmann/adapterdelegates4/AdapterDelegatesManager.java#L245-L261
apache/flink
flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java
MemorySegment.putLongBigEndian
public final void putLongBigEndian(int index, long value) { if (LITTLE_ENDIAN) { putLong(index, Long.reverseBytes(value)); } else { putLong(index, value); } }
java
public final void putLongBigEndian(int index, long value) { if (LITTLE_ENDIAN) { putLong(index, Long.reverseBytes(value)); } else { putLong(index, value); } }
[ "public", "final", "void", "putLongBigEndian", "(", "int", "index", ",", "long", "value", ")", "{", "if", "(", "LITTLE_ENDIAN", ")", "{", "putLong", "(", "index", ",", "Long", ".", "reverseBytes", "(", "value", ")", ")", ";", "}", "else", "{", "putLong...
Writes the given long value (64bit, 8 bytes) to the given position in big endian byte order. This method's speed depends on the system's native byte order, and it is possibly slower than {@link #putLong(int, long)}. For most cases (such as transient storage in memory or serialization for I/O and network), it suffices to know that the byte order in which the value is written is the same as the one in which it is read, and {@link #putLong(int, long)} is the preferable choice. @param index The position at which the value will be written. @param value The long value to be written. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 8.
[ "Writes", "the", "given", "long", "value", "(", "64bit", "8", "bytes", ")", "to", "the", "given", "position", "in", "big", "endian", "byte", "order", ".", "This", "method", "s", "speed", "depends", "on", "the", "system", "s", "native", "byte", "order", ...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L956-L962
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java
WikipediaTemplateInfo.getPagesContainingTemplateFragments
public Iterable<Page> getPagesContainingTemplateFragments(List<String> templateFragments) throws WikiApiException{ return getFragmentFilteredPages(templateFragments, true); }
java
public Iterable<Page> getPagesContainingTemplateFragments(List<String> templateFragments) throws WikiApiException{ return getFragmentFilteredPages(templateFragments, true); }
[ "public", "Iterable", "<", "Page", ">", "getPagesContainingTemplateFragments", "(", "List", "<", "String", ">", "templateFragments", ")", "throws", "WikiApiException", "{", "return", "getFragmentFilteredPages", "(", "templateFragments", ",", "true", ")", ";", "}" ]
Return an iterable containing all pages that contain a template the name of which starts with any of the given Strings. @param templateFragments the beginning of the templates that have to be matched @return An iterable with the page objects that contain templates beginning with any String in templateFragments @throws WikiApiException If there was any error retrieving the page object (most likely if the templates are corrupted)
[ "Return", "an", "iterable", "containing", "all", "pages", "that", "contain", "a", "template", "the", "name", "of", "which", "starts", "with", "any", "of", "the", "given", "Strings", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java#L407-L409
Red5/red5-server-common
src/main/java/org/red5/server/so/SharedObject.java
SharedObject.getAttribute
@Override public Object getAttribute(String name, Object value) { log.debug("getAttribute - name: {} value: {}", name, value); Object result = null; if (name != null) { result = attributes.putIfAbsent(name, value); if (result == null) { // no previous value modified.set(true); final SharedObjectEvent event = new SharedObjectEvent(Type.CLIENT_UPDATE_DATA, name, value); if (ownerMessage.addEvent(event) && syncEvents.add(event)) { notifyModified(); changeStats.incrementAndGet(); } result = value; } } return result; }
java
@Override public Object getAttribute(String name, Object value) { log.debug("getAttribute - name: {} value: {}", name, value); Object result = null; if (name != null) { result = attributes.putIfAbsent(name, value); if (result == null) { // no previous value modified.set(true); final SharedObjectEvent event = new SharedObjectEvent(Type.CLIENT_UPDATE_DATA, name, value); if (ownerMessage.addEvent(event) && syncEvents.add(event)) { notifyModified(); changeStats.incrementAndGet(); } result = value; } } return result; }
[ "@", "Override", "public", "Object", "getAttribute", "(", "String", "name", ",", "Object", "value", ")", "{", "log", ".", "debug", "(", "\"getAttribute - name: {} value: {}\"", ",", "name", ",", "value", ")", ";", "Object", "result", "=", "null", ";", "if", ...
Return attribute by name and set if it doesn't exist yet. @param name Attribute name @param value Value to set if attribute doesn't exist @return Attribute value
[ "Return", "attribute", "by", "name", "and", "set", "if", "it", "doesn", "t", "exist", "yet", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/so/SharedObject.java#L408-L426
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/JobLauncherUtils.java
JobLauncherUtils.newMultiTaskId
public static String newMultiTaskId(String jobId, int sequence) { return Id.MultiTask.create(Id.parse(jobId).get(Id.Parts.INSTANCE_NAME), sequence).toString(); }
java
public static String newMultiTaskId(String jobId, int sequence) { return Id.MultiTask.create(Id.parse(jobId).get(Id.Parts.INSTANCE_NAME), sequence).toString(); }
[ "public", "static", "String", "newMultiTaskId", "(", "String", "jobId", ",", "int", "sequence", ")", "{", "return", "Id", ".", "MultiTask", ".", "create", "(", "Id", ".", "parse", "(", "jobId", ")", ".", "get", "(", "Id", ".", "Parts", ".", "INSTANCE_N...
Create an ID for a new multi-task (corresponding to a {@link org.apache.gobblin.source.workunit.MultiWorkUnit}) for the job with the given job ID. @param jobId job ID @param sequence multi-task sequence number @return new multi-task ID
[ "Create", "an", "ID", "for", "a", "new", "multi", "-", "task", "(", "corresponding", "to", "a", "{", "@link", "org", ".", "apache", ".", "gobblin", ".", "source", ".", "workunit", ".", "MultiWorkUnit", "}", ")", "for", "the", "job", "with", "the", "g...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/JobLauncherUtils.java#L90-L92
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java
KeyVaultClientCustomImpl.getPendingCertificateSigningRequest
public String getPendingCertificateSigningRequest(String vaultBaseUrl, String certificateName) { return getPendingCertificateSigningRequestWithServiceResponseAsync(vaultBaseUrl, certificateName).toBlocking() .single().body(); }
java
public String getPendingCertificateSigningRequest(String vaultBaseUrl, String certificateName) { return getPendingCertificateSigningRequestWithServiceResponseAsync(vaultBaseUrl, certificateName).toBlocking() .single().body(); }
[ "public", "String", "getPendingCertificateSigningRequest", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ")", "{", "return", "getPendingCertificateSigningRequestWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "certificateName", ")", ".", "toBlocking", ...
Gets the pending certificate signing request response. @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net @param certificateName The name of the certificate @return the String if successful.
[ "Gets", "the", "pending", "certificate", "signing", "request", "response", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java#L1800-L1803
ksclarke/vertx-pairtree
src/main/java/info/freelibrary/pairtree/s3/S3ClientRequest.java
S3ClientRequest.b64SignHmacSha1
private static String b64SignHmacSha1(final String aAwsSecretKey, final String aCanonicalString) throws NoSuchAlgorithmException, InvalidKeyException { final SecretKeySpec signingKey = new SecretKeySpec(aAwsSecretKey.getBytes(), HASH_CODE); final Mac mac = Mac.getInstance(HASH_CODE); mac.init(signingKey); return new String(Base64.getEncoder().encode(mac.doFinal(aCanonicalString.getBytes()))); }
java
private static String b64SignHmacSha1(final String aAwsSecretKey, final String aCanonicalString) throws NoSuchAlgorithmException, InvalidKeyException { final SecretKeySpec signingKey = new SecretKeySpec(aAwsSecretKey.getBytes(), HASH_CODE); final Mac mac = Mac.getInstance(HASH_CODE); mac.init(signingKey); return new String(Base64.getEncoder().encode(mac.doFinal(aCanonicalString.getBytes()))); }
[ "private", "static", "String", "b64SignHmacSha1", "(", "final", "String", "aAwsSecretKey", ",", "final", "String", "aCanonicalString", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeyException", "{", "final", "SecretKeySpec", "signingKey", "=", "new", "Secret...
Returns a Base64 HmacSha1 signature. @param aAwsSecretKey An AWS secret key @param aCanonicalString A canonical string to encode @return A Base64 HmacSha1 signature @throws NoSuchAlgorithmException If the system doesn't support the encoding algorithm @throws InvalidKeyException If the supplied AWS secret key is invalid
[ "Returns", "a", "Base64", "HmacSha1", "signature", "." ]
train
https://github.com/ksclarke/vertx-pairtree/blob/b2ea1e32057e5df262e9265540d346a732b718df/src/main/java/info/freelibrary/pairtree/s3/S3ClientRequest.java#L434-L442
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/services/WebSocketService.java
WebSocketService.setChannels
public void setChannels(String uri, Set<WebSocketChannel> channels) { Objects.requireNonNull(uri, Required.URI.toString()); Objects.requireNonNull(channels, Required.URI_CONNECTIONS.toString()); this.cache.put(Default.WSS_CACHE_PREFIX.toString() + uri, channels); }
java
public void setChannels(String uri, Set<WebSocketChannel> channels) { Objects.requireNonNull(uri, Required.URI.toString()); Objects.requireNonNull(channels, Required.URI_CONNECTIONS.toString()); this.cache.put(Default.WSS_CACHE_PREFIX.toString() + uri, channels); }
[ "public", "void", "setChannels", "(", "String", "uri", ",", "Set", "<", "WebSocketChannel", ">", "channels", ")", "{", "Objects", ".", "requireNonNull", "(", "uri", ",", "Required", ".", "URI", ".", "toString", "(", ")", ")", ";", "Objects", ".", "requir...
Sets the URI resources for a given URL @param uri The URI resource for the connection @param channels The channels for the URI resource
[ "Sets", "the", "URI", "resources", "for", "a", "given", "URL" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/services/WebSocketService.java#L60-L65
jenkinsci/jenkins
core/src/main/java/hudson/scm/SCM.java
SCM.buildEnvironment
public void buildEnvironment(@Nonnull Run<?,?> build, @Nonnull Map<String,String> env) { if (build instanceof AbstractBuild) { buildEnvVars((AbstractBuild)build, env); } }
java
public void buildEnvironment(@Nonnull Run<?,?> build, @Nonnull Map<String,String> env) { if (build instanceof AbstractBuild) { buildEnvVars((AbstractBuild)build, env); } }
[ "public", "void", "buildEnvironment", "(", "@", "Nonnull", "Run", "<", "?", ",", "?", ">", "build", ",", "@", "Nonnull", "Map", "<", "String", ",", "String", ">", "env", ")", "{", "if", "(", "build", "instanceof", "AbstractBuild", ")", "{", "buildEnvVa...
Adds environmental variables for the builds to the given map. <p> This can be used to propagate information from SCM to builds (for example, SVN revision number.) <p> This method is invoked whenever someone does {@link AbstractBuild#getEnvironment(TaskListener)}, via {@link #buildEnvVars(AbstractBuild, Map)}, which can be before/after your checkout method is invoked. So if you are going to provide information about check out (like SVN revision number that was checked out), be prepared for the possibility that the check out hasn't happened yet. @since 2.60
[ "Adds", "environmental", "variables", "for", "the", "builds", "to", "the", "given", "map", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/scm/SCM.java#L541-L545
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/TypeUtil.java
TypeUtil.defaultIfNotInteger
public static int defaultIfNotInteger(String _possibleInt, int _default) { if (isInteger(_possibleInt)) { return Integer.parseInt(_possibleInt); } return _default; }
java
public static int defaultIfNotInteger(String _possibleInt, int _default) { if (isInteger(_possibleInt)) { return Integer.parseInt(_possibleInt); } return _default; }
[ "public", "static", "int", "defaultIfNotInteger", "(", "String", "_possibleInt", ",", "int", "_default", ")", "{", "if", "(", "isInteger", "(", "_possibleInt", ")", ")", "{", "return", "Integer", ".", "parseInt", "(", "_possibleInt", ")", ";", "}", "return",...
Returns integer converted from string or default if string could not be converted to int. @param _possibleInt string to convert @param _default default to use if string cannot be converted @return int
[ "Returns", "integer", "converted", "from", "string", "or", "default", "if", "string", "could", "not", "be", "converted", "to", "int", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/TypeUtil.java#L367-L372
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java
AbstractBeanDefinition.injectBeanMethod
@Internal @SuppressWarnings("WeakerAccess") protected void injectBeanMethod(BeanResolutionContext resolutionContext, DefaultBeanContext context, int methodIndex, Object bean) { MethodInjectionPoint methodInjectionPoint = methodInjectionPoints.get(methodIndex); Argument[] methodArgumentTypes = methodInjectionPoint.getArguments(); Object[] methodArgs = new Object[methodArgumentTypes.length]; for (int i = 0; i < methodArgumentTypes.length; i++) { methodArgs[i] = getBeanForMethodArgument(resolutionContext, context, methodIndex, i); } try { methodInjectionPoint.invoke(bean, methodArgs); } catch (Throwable e) { throw new BeanInstantiationException(this, e); } }
java
@Internal @SuppressWarnings("WeakerAccess") protected void injectBeanMethod(BeanResolutionContext resolutionContext, DefaultBeanContext context, int methodIndex, Object bean) { MethodInjectionPoint methodInjectionPoint = methodInjectionPoints.get(methodIndex); Argument[] methodArgumentTypes = methodInjectionPoint.getArguments(); Object[] methodArgs = new Object[methodArgumentTypes.length]; for (int i = 0; i < methodArgumentTypes.length; i++) { methodArgs[i] = getBeanForMethodArgument(resolutionContext, context, methodIndex, i); } try { methodInjectionPoint.invoke(bean, methodArgs); } catch (Throwable e) { throw new BeanInstantiationException(this, e); } }
[ "@", "Internal", "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "protected", "void", "injectBeanMethod", "(", "BeanResolutionContext", "resolutionContext", ",", "DefaultBeanContext", "context", ",", "int", "methodIndex", ",", "Object", "bean", ")", "{", "Metho...
Inject a bean method that requires reflection. @param resolutionContext The resolution context @param context The bean context @param methodIndex The method index @param bean The bean
[ "Inject", "a", "bean", "method", "that", "requires", "reflection", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L682-L696
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/internal/DefaultReentrantTypeResolver.java
DefaultReentrantTypeResolver.getInvalidWritableVariableAccessMessage
protected String getInvalidWritableVariableAccessMessage(XVariableDeclaration variable, XAbstractFeatureCall featureCall, IResolvedTypes resolvedTypes) { // TODO this should be part of a separate validation service XClosure containingClosure = EcoreUtil2.getContainerOfType(featureCall, XClosure.class); if (containingClosure != null && !EcoreUtil.isAncestor(containingClosure, variable)) { return String.format("Cannot %srefer to the non-final variable %s inside a lambda expression", getImplicitlyMessagePart(featureCall), variable.getSimpleName()); } return null; }
java
protected String getInvalidWritableVariableAccessMessage(XVariableDeclaration variable, XAbstractFeatureCall featureCall, IResolvedTypes resolvedTypes) { // TODO this should be part of a separate validation service XClosure containingClosure = EcoreUtil2.getContainerOfType(featureCall, XClosure.class); if (containingClosure != null && !EcoreUtil.isAncestor(containingClosure, variable)) { return String.format("Cannot %srefer to the non-final variable %s inside a lambda expression", getImplicitlyMessagePart(featureCall), variable.getSimpleName()); } return null; }
[ "protected", "String", "getInvalidWritableVariableAccessMessage", "(", "XVariableDeclaration", "variable", ",", "XAbstractFeatureCall", "featureCall", ",", "IResolvedTypes", "resolvedTypes", ")", "{", "// TODO this should be part of a separate validation service", "XClosure", "contai...
Provide the error message for mutable variables that may not be captured in lambdas. @param variable the writable variable declaration @param featureCall the reference to the variable @param resolvedTypes type information
[ "Provide", "the", "error", "message", "for", "mutable", "variables", "that", "may", "not", "be", "captured", "in", "lambdas", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/internal/DefaultReentrantTypeResolver.java#L208-L215
apiman/apiman
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/ESRegistry.java
ESRegistry.lookupClient
@SuppressWarnings("nls") // Do beans need escaping or will that be done 'automatically'. Test it. Strings do, but probably only quotes? private Client lookupClient(String orgId, String clientId, String version) { String query = "{" + " \"query\": {" + " \"bool\": {" + " \"filter\": [{" + " \"term\": {" + " \"organizationId\": ? " + // orgId " }" + " }," + " {" + " \"term\": {" + " \"clientId\": ? " + // clientId " }" + " }," + " {" + " \"term\": {" + " \"version\": ? " + // version " }" + " }" + " ]" + " }" + " }" + "}"; String escaped = ESUtils.queryWithEscapedArgs(query, orgId, clientId, version); try { Search search = new Search.Builder(escaped) .addIndex(getIndexName()) .addType("client") .build(); SearchResult response = getClient().execute(search); if (!response.isSucceeded()) { throw new RuntimeException(response.getErrorMessage()); } if (response.getTotal() < 1) { throw new IOException(); } Hit<Client,Void> hit = response.getFirstHit(Client.class); return hit.source; } catch (IOException e) { throw new ClientNotFoundException(Messages.i18n.format("ESRegistry.ClientNotFound"), e); //$NON-NLS-1$ } }
java
@SuppressWarnings("nls") // Do beans need escaping or will that be done 'automatically'. Test it. Strings do, but probably only quotes? private Client lookupClient(String orgId, String clientId, String version) { String query = "{" + " \"query\": {" + " \"bool\": {" + " \"filter\": [{" + " \"term\": {" + " \"organizationId\": ? " + // orgId " }" + " }," + " {" + " \"term\": {" + " \"clientId\": ? " + // clientId " }" + " }," + " {" + " \"term\": {" + " \"version\": ? " + // version " }" + " }" + " ]" + " }" + " }" + "}"; String escaped = ESUtils.queryWithEscapedArgs(query, orgId, clientId, version); try { Search search = new Search.Builder(escaped) .addIndex(getIndexName()) .addType("client") .build(); SearchResult response = getClient().execute(search); if (!response.isSucceeded()) { throw new RuntimeException(response.getErrorMessage()); } if (response.getTotal() < 1) { throw new IOException(); } Hit<Client,Void> hit = response.getFirstHit(Client.class); return hit.source; } catch (IOException e) { throw new ClientNotFoundException(Messages.i18n.format("ESRegistry.ClientNotFound"), e); //$NON-NLS-1$ } }
[ "@", "SuppressWarnings", "(", "\"nls\"", ")", "// Do beans need escaping or will that be done 'automatically'. Test it. Strings do, but probably only quotes?", "private", "Client", "lookupClient", "(", "String", "orgId", ",", "String", "clientId", ",", "String", "version", ")", ...
Searches for a client by its orgid:clientId:version and returns it. @param orgId @param clientId @param version
[ "Searches", "for", "a", "client", "by", "its", "orgid", ":", "clientId", ":", "version", "and", "returns", "it", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/ESRegistry.java#L207-L250
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/permission/PermissionTemplateService.java
PermissionTemplateService.applyDefault
public void applyDefault(DbSession dbSession, ComponentDto component, @Nullable Integer projectCreatorUserId) { PermissionTemplateDto template = findTemplate(dbSession, component); checkArgument(template != null, "Cannot retrieve default permission template"); copyPermissions(dbSession, template, component, projectCreatorUserId); }
java
public void applyDefault(DbSession dbSession, ComponentDto component, @Nullable Integer projectCreatorUserId) { PermissionTemplateDto template = findTemplate(dbSession, component); checkArgument(template != null, "Cannot retrieve default permission template"); copyPermissions(dbSession, template, component, projectCreatorUserId); }
[ "public", "void", "applyDefault", "(", "DbSession", "dbSession", ",", "ComponentDto", "component", ",", "@", "Nullable", "Integer", "projectCreatorUserId", ")", "{", "PermissionTemplateDto", "template", "=", "findTemplate", "(", "dbSession", ",", "component", ")", "...
Apply the default permission template to project. The project can already exist (so it has permissions) or can be provisioned (so has no permissions yet). @param projectCreatorUserId id of the user who creates the project, only if project is provisioned. He will
[ "Apply", "the", "default", "permission", "template", "to", "project", ".", "The", "project", "can", "already", "exist", "(", "so", "it", "has", "permissions", ")", "or", "can", "be", "provisioned", "(", "so", "has", "no", "permissions", "yet", ")", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionTemplateService.java#L108-L112
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/util/JsonSerializer.java
JsonSerializer.fromString
public static <T> T fromString(String value, Class<T> valueType) throws IOException { return jsonMapper.readValue(value, valueType); }
java
public static <T> T fromString(String value, Class<T> valueType) throws IOException { return jsonMapper.readValue(value, valueType); }
[ "public", "static", "<", "T", ">", "T", "fromString", "(", "String", "value", ",", "Class", "<", "T", ">", "valueType", ")", "throws", "IOException", "{", "return", "jsonMapper", ".", "readValue", "(", "value", ",", "valueType", ")", ";", "}" ]
Returns the object of the specified class represented by the specified JSON {@code String}. @param value A JSON {@code String} to be parsed. @param valueType The class of the object to be parsed. @param <T> The type of the object to be parsed. @return The object of the specified class represented by the specified JSON {@code String}. @throws IOException If there are parsing problems.
[ "Returns", "the", "object", "of", "the", "specified", "class", "represented", "by", "the", "specified", "JSON", "{", "@code", "String", "}", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/util/JsonSerializer.java#L69-L71
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getCharacterSkills
public void getCharacterSkills(String API, String name, Callback<CharacterSkills> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); gw2API.getCharacterSkills(name, API).enqueue(callback); }
java
public void getCharacterSkills(String API, String name, Callback<CharacterSkills> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); gw2API.getCharacterSkills(name, API).enqueue(callback); }
[ "public", "void", "getCharacterSkills", "(", "String", "API", ",", "String", "name", ",", "Callback", "<", "CharacterSkills", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", ...
For more info on Character Skills API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Skills">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param API API key @param name character name @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception invalid API key | empty character name @throws NullPointerException if given {@link Callback} is empty @see CharacterSkills character skills info
[ "For", "more", "info", "on", "Character", "Skills", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "characters#Skills", ">", "here<", "/", "a", ">", "<br", "/", ">"...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L829-L832
zeromq/jeromq
src/main/java/org/zeromq/ZMsg.java
ZMsg.recvMsg
@Draft public static void recvMsg(ZMQ.Socket socket, int flags, Consumer<ZMsg> handler) { handler.accept(ZMsg.recvMsg(socket, flags)); }
java
@Draft public static void recvMsg(ZMQ.Socket socket, int flags, Consumer<ZMsg> handler) { handler.accept(ZMsg.recvMsg(socket, flags)); }
[ "@", "Draft", "public", "static", "void", "recvMsg", "(", "ZMQ", ".", "Socket", "socket", ",", "int", "flags", ",", "Consumer", "<", "ZMsg", ">", "handler", ")", "{", "handler", ".", "accept", "(", "ZMsg", ".", "recvMsg", "(", "socket", ",", "flags", ...
This API is in DRAFT state and is subject to change at ANY time until declared stable handle incoming message with a handler @param socket @param flags see ZMQ constants @param handler handler to handle incoming message
[ "This", "API", "is", "in", "DRAFT", "state", "and", "is", "subject", "to", "change", "at", "ANY", "time", "until", "declared", "stable", "handle", "incoming", "message", "with", "a", "handler" ]
train
https://github.com/zeromq/jeromq/blob/8b4a2960b468d08b7aebb0d40bfb947e08fed040/src/main/java/org/zeromq/ZMsg.java#L286-L290
MKLab-ITI/multimedia-indexing
src/main/java/gr/iti/mklab/visual/dimreduction/PCA.java
PCA.sampleToEigenSpace
public double[] sampleToEigenSpace(double[] sampleData) throws Exception { if (!isPcaInitialized) { // initiallize PCA correctly! throw new Exception("PCA is not correctly initiallized!"); } if (sampleData.length != sampleSize) { throw new IllegalArgumentException("Unexpected vector length!"); } DenseMatrix64F sample = new DenseMatrix64F(sampleSize, 1, true, sampleData); DenseMatrix64F projectedSample = new DenseMatrix64F(numComponents, 1); // mean subtraction CommonOps.sub(sample, means, sample); // projection CommonOps.mult(V_t, sample, projectedSample); // whitening if (doWhitening) { // always perform this normalization step when whitening is used return Normalization.normalizeL2(projectedSample.data); } else { return projectedSample.data; } }
java
public double[] sampleToEigenSpace(double[] sampleData) throws Exception { if (!isPcaInitialized) { // initiallize PCA correctly! throw new Exception("PCA is not correctly initiallized!"); } if (sampleData.length != sampleSize) { throw new IllegalArgumentException("Unexpected vector length!"); } DenseMatrix64F sample = new DenseMatrix64F(sampleSize, 1, true, sampleData); DenseMatrix64F projectedSample = new DenseMatrix64F(numComponents, 1); // mean subtraction CommonOps.sub(sample, means, sample); // projection CommonOps.mult(V_t, sample, projectedSample); // whitening if (doWhitening) { // always perform this normalization step when whitening is used return Normalization.normalizeL2(projectedSample.data); } else { return projectedSample.data; } }
[ "public", "double", "[", "]", "sampleToEigenSpace", "(", "double", "[", "]", "sampleData", ")", "throws", "Exception", "{", "if", "(", "!", "isPcaInitialized", ")", "{", "// initiallize PCA correctly!\r", "throw", "new", "Exception", "(", "\"PCA is not correctly ini...
Converts a vector from sample space into eigen space. If {@link #doWhitening} is true, then the vector is also L2 normalized after projection. @param sampleData Sample space vector @return Eigen space projected vector @throws Exception
[ "Converts", "a", "vector", "from", "sample", "space", "into", "eigen", "space", ".", "If", "{", "@link", "#doWhitening", "}", "is", "true", "then", "the", "vector", "is", "also", "L2", "normalized", "after", "projection", "." ]
train
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/dimreduction/PCA.java#L188-L208
facebookarchive/hadoop-20
src/core/org/apache/hadoop/conf/Configuration.java
Configuration.getLocalPath
public Path getLocalPath(String dirsProp, String path) throws IOException { String[] dirs = getStrings(dirsProp); int hashCode = path.hashCode(); FileSystem fs = FileSystem.getLocal(this); for (int i = 0; i < dirs.length; i++) { // try each local dir int index = (hashCode+i & Integer.MAX_VALUE) % dirs.length; Path file = new Path(dirs[index], path); Path dir = file.getParent(); if (fs.mkdirs(dir) || fs.exists(dir)) { return file; } } LOG.warn("Could not make " + path + " in local directories from " + dirsProp); for(int i=0; i < dirs.length; i++) { int index = (hashCode+i & Integer.MAX_VALUE) % dirs.length; LOG.warn(dirsProp + "[" + index + "]=" + dirs[index]); } throw new IOException("No valid local directories in property: "+dirsProp); }
java
public Path getLocalPath(String dirsProp, String path) throws IOException { String[] dirs = getStrings(dirsProp); int hashCode = path.hashCode(); FileSystem fs = FileSystem.getLocal(this); for (int i = 0; i < dirs.length; i++) { // try each local dir int index = (hashCode+i & Integer.MAX_VALUE) % dirs.length; Path file = new Path(dirs[index], path); Path dir = file.getParent(); if (fs.mkdirs(dir) || fs.exists(dir)) { return file; } } LOG.warn("Could not make " + path + " in local directories from " + dirsProp); for(int i=0; i < dirs.length; i++) { int index = (hashCode+i & Integer.MAX_VALUE) % dirs.length; LOG.warn(dirsProp + "[" + index + "]=" + dirs[index]); } throw new IOException("No valid local directories in property: "+dirsProp); }
[ "public", "Path", "getLocalPath", "(", "String", "dirsProp", ",", "String", "path", ")", "throws", "IOException", "{", "String", "[", "]", "dirs", "=", "getStrings", "(", "dirsProp", ")", ";", "int", "hashCode", "=", "path", ".", "hashCode", "(", ")", ";...
Get a local file under a directory named by <i>dirsProp</i> with the given <i>path</i>. If <i>dirsProp</i> contains multiple directories, then one is chosen based on <i>path</i>'s hash code. If the selected directory does not exist, an attempt is made to create it. @param dirsProp directory in which to locate the file. @param path file-path. @return local file under the directory with the given path.
[ "Get", "a", "local", "file", "under", "a", "directory", "named", "by", "<i", ">", "dirsProp<", "/", "i", ">", "with", "the", "given", "<i", ">", "path<", "/", "i", ">", ".", "If", "<i", ">", "dirsProp<", "/", "i", ">", "contains", "multiple", "dire...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/conf/Configuration.java#L961-L981
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_scheduler_serviceName_PUT
public void billingAccount_scheduler_serviceName_PUT(String billingAccount, String serviceName, OvhScheduler body) throws IOException { String qPath = "/telephony/{billingAccount}/scheduler/{serviceName}"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_scheduler_serviceName_PUT(String billingAccount, String serviceName, OvhScheduler body) throws IOException { String qPath = "/telephony/{billingAccount}/scheduler/{serviceName}"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_scheduler_serviceName_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhScheduler", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/scheduler/{serviceName}\"", ";",...
Alter this object properties REST: PUT /telephony/{billingAccount}/scheduler/{serviceName} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L546-L550
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/edge/GradientToEdgeFeatures.java
GradientToEdgeFeatures.nonMaxSuppression4
static public GrayF32 nonMaxSuppression4(GrayF32 intensity , GrayS8 direction , GrayF32 output ) { InputSanityCheck.checkSameShape(intensity,direction); output = InputSanityCheck.checkDeclare(intensity,output); if( BoofConcurrency.USE_CONCURRENT ) { ImplEdgeNonMaxSuppression_MT.inner4(intensity, direction, output); ImplEdgeNonMaxSuppression_MT.border4(intensity, direction, output); } else { ImplEdgeNonMaxSuppression.inner4(intensity, direction, output); ImplEdgeNonMaxSuppression.border4(intensity, direction, output); } return output; }
java
static public GrayF32 nonMaxSuppression4(GrayF32 intensity , GrayS8 direction , GrayF32 output ) { InputSanityCheck.checkSameShape(intensity,direction); output = InputSanityCheck.checkDeclare(intensity,output); if( BoofConcurrency.USE_CONCURRENT ) { ImplEdgeNonMaxSuppression_MT.inner4(intensity, direction, output); ImplEdgeNonMaxSuppression_MT.border4(intensity, direction, output); } else { ImplEdgeNonMaxSuppression.inner4(intensity, direction, output); ImplEdgeNonMaxSuppression.border4(intensity, direction, output); } return output; }
[ "static", "public", "GrayF32", "nonMaxSuppression4", "(", "GrayF32", "intensity", ",", "GrayS8", "direction", ",", "GrayF32", "output", ")", "{", "InputSanityCheck", ".", "checkSameShape", "(", "intensity", ",", "direction", ")", ";", "output", "=", "InputSanityCh...
<p> Sets edge intensities to zero if the pixel has an intensity which is less than either of the two adjacent pixels. Pixel adjacency is determined by the gradients discretized direction. </p> @param intensity Edge intensities. Not modified. @param direction 4-Discretized direction. See {@link #discretizeDirection4(GrayF32, GrayS8)}. Not modified. @param output Filtered intensity. If null a new image will be declared and returned. Modified. @return Filtered edge intensity.
[ "<p", ">", "Sets", "edge", "intensities", "to", "zero", "if", "the", "pixel", "has", "an", "intensity", "which", "is", "less", "than", "either", "of", "the", "two", "adjacent", "pixels", ".", "Pixel", "adjacency", "is", "determined", "by", "the", "gradient...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/edge/GradientToEdgeFeatures.java#L467-L481
fuinorg/units4j
src/main/java/org/fuin/units4j/Units4JUtils.java
Units4JUtils.classInfo
public static ClassInfo classInfo(final ClassLoader cl, final Class<?> clasz) { return classInfo(cl, clasz.getName()); }
java
public static ClassInfo classInfo(final ClassLoader cl, final Class<?> clasz) { return classInfo(cl, clasz.getName()); }
[ "public", "static", "ClassInfo", "classInfo", "(", "final", "ClassLoader", "cl", ",", "final", "Class", "<", "?", ">", "clasz", ")", "{", "return", "classInfo", "(", "cl", ",", "clasz", ".", "getName", "(", ")", ")", ";", "}" ]
Loads a class and creates a Jandex class information for it. @param cl Class loader to use. @param clasz Class to load. @return Jandex class information.
[ "Loads", "a", "class", "and", "creates", "a", "Jandex", "class", "information", "for", "it", "." ]
train
https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/Units4JUtils.java#L423-L425
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/other/HtmlTableTemplate.java
HtmlTableTemplate.getCell
public static TableCellElement getCell( Element root, int column, int row ) { TableSectionElement tbody = getTBodyElement( root ); TableRowElement tr = tbody.getChild( row ).cast(); TableCellElement td = tr.getChild( column ).cast(); return td; }
java
public static TableCellElement getCell( Element root, int column, int row ) { TableSectionElement tbody = getTBodyElement( root ); TableRowElement tr = tbody.getChild( row ).cast(); TableCellElement td = tr.getChild( column ).cast(); return td; }
[ "public", "static", "TableCellElement", "getCell", "(", "Element", "root", ",", "int", "column", ",", "int", "row", ")", "{", "TableSectionElement", "tbody", "=", "getTBodyElement", "(", "root", ")", ";", "TableRowElement", "tr", "=", "tbody", ".", "getChild",...
Get the TD element @param root @param column @param row @return
[ "Get", "the", "TD", "element" ]
train
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/other/HtmlTableTemplate.java#L74-L82
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/memorymanager/CheckedMemorySegment.java
CheckedMemorySegment.put
public final CheckedMemorySegment put(int index, byte b) { if (index >= 0 && index < this.size) { this.memory[this.offset + index] = b; return this; } else { throw new IndexOutOfBoundsException(); } }
java
public final CheckedMemorySegment put(int index, byte b) { if (index >= 0 && index < this.size) { this.memory[this.offset + index] = b; return this; } else { throw new IndexOutOfBoundsException(); } }
[ "public", "final", "CheckedMemorySegment", "put", "(", "int", "index", ",", "byte", "b", ")", "{", "if", "(", "index", ">=", "0", "&&", "index", "<", "this", ".", "size", ")", "{", "this", ".", "memory", "[", "this", ".", "offset", "+", "index", "]...
Writes the given byte into this buffer at the given position. @param position The position at which the byte will be written. @param b The byte value to be written. @return This view itself. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger or equal to the size of the memory segment.
[ "Writes", "the", "given", "byte", "into", "this", "buffer", "at", "the", "given", "position", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/memorymanager/CheckedMemorySegment.java#L186-L193
bazaarvoice/jersey-hmac-auth
common/src/main/java/com/bazaarvoice/auth/hmac/server/AbstractAuthenticator.java
AbstractAuthenticator.createSignature
private String createSignature(Credentials credentials, String secretKey) { return new SignatureGenerator().generate( secretKey, credentials.getMethod(), credentials.getTimestamp(), credentials.getPath(), credentials.getContent()); }
java
private String createSignature(Credentials credentials, String secretKey) { return new SignatureGenerator().generate( secretKey, credentials.getMethod(), credentials.getTimestamp(), credentials.getPath(), credentials.getContent()); }
[ "private", "String", "createSignature", "(", "Credentials", "credentials", ",", "String", "secretKey", ")", "{", "return", "new", "SignatureGenerator", "(", ")", ".", "generate", "(", "secretKey", ",", "credentials", ".", "getMethod", "(", ")", ",", "credentials...
Create a signature given the set of request credentials and a secret key. @param credentials the credentials specified on the request @param secretKey the secret key that will be used to generate the signature @return the signature
[ "Create", "a", "signature", "given", "the", "set", "of", "request", "credentials", "and", "a", "secret", "key", "." ]
train
https://github.com/bazaarvoice/jersey-hmac-auth/blob/17e2a40a4b7b783de4d77ad97f8a623af6baf688/common/src/main/java/com/bazaarvoice/auth/hmac/server/AbstractAuthenticator.java#L130-L137
pmwmedia/tinylog
tinylog-impl/src/main/java/org/tinylog/pattern/FormatPatternParser.java
FormatPatternParser.createThreadContextToken
private static Token createThreadContextToken(final String configuration) { if (configuration == null) { InternalLogger.log(Level.ERROR, "\"{context}\" requires a key"); return new PlainTextToken(""); } else { int splitIndex = configuration.indexOf(','); String key = splitIndex == -1 ? configuration.trim() : configuration.substring(0, splitIndex).trim(); if (key.isEmpty()) { InternalLogger.log(Level.ERROR, "\"{context}\" requires a key"); return new PlainTextToken(""); } else { String defaultValue = splitIndex == -1 ? null : configuration.substring(splitIndex + 1).trim(); return defaultValue == null ? new ThreadContextToken(key) : new ThreadContextToken(key, defaultValue); } } }
java
private static Token createThreadContextToken(final String configuration) { if (configuration == null) { InternalLogger.log(Level.ERROR, "\"{context}\" requires a key"); return new PlainTextToken(""); } else { int splitIndex = configuration.indexOf(','); String key = splitIndex == -1 ? configuration.trim() : configuration.substring(0, splitIndex).trim(); if (key.isEmpty()) { InternalLogger.log(Level.ERROR, "\"{context}\" requires a key"); return new PlainTextToken(""); } else { String defaultValue = splitIndex == -1 ? null : configuration.substring(splitIndex + 1).trim(); return defaultValue == null ? new ThreadContextToken(key) : new ThreadContextToken(key, defaultValue); } } }
[ "private", "static", "Token", "createThreadContextToken", "(", "final", "String", "configuration", ")", "{", "if", "(", "configuration", "==", "null", ")", "{", "InternalLogger", ".", "log", "(", "Level", ".", "ERROR", ",", "\"\\\"{context}\\\" requires a key\"", ...
Creates a new {@link ThreadContextToken}. @param configuration Key and optional placeholder for empty values @return New instance of {@link ThreadContextToken} or {@code null} if key is missing
[ "Creates", "a", "new", "{", "@link", "ThreadContextToken", "}", "." ]
train
https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-impl/src/main/java/org/tinylog/pattern/FormatPatternParser.java#L191-L206
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java
TitlePaneIconifyButtonPainter.paintRestorePressed
private void paintRestorePressed(Graphics2D g, JComponent c, int width, int height) { restorePainter.paintPressed(g, c, width, height); }
java
private void paintRestorePressed(Graphics2D g, JComponent c, int width, int height) { restorePainter.paintPressed(g, c, width, height); }
[ "private", "void", "paintRestorePressed", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "restorePainter", ".", "paintPressed", "(", "g", ",", "c", ",", "width", ",", "height", ")", ";", "}" ]
Paint the foreground restore button pressed state. @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.
[ "Paint", "the", "foreground", "restore", "button", "pressed", "state", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java#L231-L233
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitDocComment
@Override public R visitDocComment(DocCommentTree node, P p) { return defaultAction(node, p); }
java
@Override public R visitDocComment(DocCommentTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitDocComment", "(", "DocCommentTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L153-L156
cdk/cdk
misc/extra/src/main/java/org/openscience/cdk/geometry/AtomTools.java
AtomTools.calculate3DCoordinates0
public static Point3d[] calculate3DCoordinates0(Point3d aPoint, int nwanted, double length) { Point3d[] points; if (nwanted == 1) { points = new Point3d[1]; points[0] = new Point3d(aPoint); points[0].add(new Vector3d(length, 0.0, 0.0)); } else if (nwanted == 2) { points = new Point3d[2]; points[0] = new Point3d(aPoint); points[0].add(new Vector3d(length, 0.0, 0.0)); points[1] = new Point3d(aPoint); points[1].add(new Vector3d(-length, 0.0, 0.0)); } else if (nwanted == 3) { points = new Point3d[3]; points[0] = new Point3d(aPoint); points[0].add(new Vector3d(length, 0.0, 0.0)); points[1] = new Point3d(aPoint); points[1].add(new Vector3d(-length * 0.5, -length * 0.5 * Math.sqrt(3.0), 0.0f)); points[2] = new Point3d(aPoint); points[2].add(new Vector3d(-length * 0.5, length * 0.5 * Math.sqrt(3.0), 0.0f)); } else if (nwanted == 4) { points = new Point3d[4]; double dx = length / Math.sqrt(3.0); points[0] = new Point3d(aPoint); points[0].add(new Vector3d(dx, dx, dx)); points[1] = new Point3d(aPoint); points[1].add(new Vector3d(dx, -dx, -dx)); points[2] = new Point3d(aPoint); points[2].add(new Vector3d(-dx, -dx, dx)); points[3] = new Point3d(aPoint); points[3].add(new Vector3d(-dx, dx, -dx)); } else points = new Point3d[0]; return points; }
java
public static Point3d[] calculate3DCoordinates0(Point3d aPoint, int nwanted, double length) { Point3d[] points; if (nwanted == 1) { points = new Point3d[1]; points[0] = new Point3d(aPoint); points[0].add(new Vector3d(length, 0.0, 0.0)); } else if (nwanted == 2) { points = new Point3d[2]; points[0] = new Point3d(aPoint); points[0].add(new Vector3d(length, 0.0, 0.0)); points[1] = new Point3d(aPoint); points[1].add(new Vector3d(-length, 0.0, 0.0)); } else if (nwanted == 3) { points = new Point3d[3]; points[0] = new Point3d(aPoint); points[0].add(new Vector3d(length, 0.0, 0.0)); points[1] = new Point3d(aPoint); points[1].add(new Vector3d(-length * 0.5, -length * 0.5 * Math.sqrt(3.0), 0.0f)); points[2] = new Point3d(aPoint); points[2].add(new Vector3d(-length * 0.5, length * 0.5 * Math.sqrt(3.0), 0.0f)); } else if (nwanted == 4) { points = new Point3d[4]; double dx = length / Math.sqrt(3.0); points[0] = new Point3d(aPoint); points[0].add(new Vector3d(dx, dx, dx)); points[1] = new Point3d(aPoint); points[1].add(new Vector3d(dx, -dx, -dx)); points[2] = new Point3d(aPoint); points[2].add(new Vector3d(-dx, -dx, dx)); points[3] = new Point3d(aPoint); points[3].add(new Vector3d(-dx, dx, -dx)); } else points = new Point3d[0]; return points; }
[ "public", "static", "Point3d", "[", "]", "calculate3DCoordinates0", "(", "Point3d", "aPoint", ",", "int", "nwanted", ",", "double", "length", ")", "{", "Point3d", "[", "]", "points", ";", "if", "(", "nwanted", "==", "1", ")", "{", "points", "=", "new", ...
Calculates substituent points. Calculate substituent points for (0) zero ligands of aPoint. The resultant points are randomly oriented: (i) 1 points required; +x,0,0 (ii) 2 points: use +x,0,0 and -x,0,0 (iii) 3 points: equilateral triangle in xy plane (iv) 4 points x,x,x, x,-x,-x, -x,x,-x, -x,-x,x where 3x**2 = bond length @param aPoint to which substituents are added @param nwanted number of points to calculate (1-4) @param length from aPoint @return Point3d[] nwanted points (or zero if failed)
[ "Calculates", "substituent", "points", ".", "Calculate", "substituent", "points", "for", "(", "0", ")", "zero", "ligands", "of", "aPoint", ".", "The", "resultant", "points", "are", "randomly", "oriented", ":", "(", "i", ")", "1", "points", "required", ";", ...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/misc/extra/src/main/java/org/openscience/cdk/geometry/AtomTools.java#L244-L278
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_secondaryDnsNameDomainToken_GET
public OvhSecondaryDNSCheckField serviceName_secondaryDnsNameDomainToken_GET(String serviceName, String domain) throws IOException { String qPath = "/dedicated/server/{serviceName}/secondaryDnsNameDomainToken"; StringBuilder sb = path(qPath, serviceName); query(sb, "domain", domain); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSecondaryDNSCheckField.class); }
java
public OvhSecondaryDNSCheckField serviceName_secondaryDnsNameDomainToken_GET(String serviceName, String domain) throws IOException { String qPath = "/dedicated/server/{serviceName}/secondaryDnsNameDomainToken"; StringBuilder sb = path(qPath, serviceName); query(sb, "domain", domain); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSecondaryDNSCheckField.class); }
[ "public", "OvhSecondaryDNSCheckField", "serviceName_secondaryDnsNameDomainToken_GET", "(", "String", "serviceName", ",", "String", "domain", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/secondaryDnsNameDomainToken\"", ";", "StringB...
DNS field to temporarily add to your zone so that we can verify you are the owner of this domain REST: GET /dedicated/server/{serviceName}/secondaryDnsNameDomainToken @param domain [required] The domain to check @param serviceName [required] The internal name of your dedicated server
[ "DNS", "field", "to", "temporarily", "add", "to", "your", "zone", "so", "that", "we", "can", "verify", "you", "are", "the", "owner", "of", "this", "domain" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1843-L1849
google/closure-compiler
src/com/google/javascript/jscomp/NodeUtil.java
NodeUtil.evaluatesToLocalValue
static boolean evaluatesToLocalValue(Node value, Predicate<Node> locals) { switch (value.getToken()) { case ASSIGN: // A result that is aliased by a non-local name, is the effectively the // same as returning a non-local name, but this doesn't matter if the // value is immutable. return NodeUtil.isImmutableValue(value.getLastChild()) || (locals.apply(value) && evaluatesToLocalValue(value.getLastChild(), locals)); case COMMA: return evaluatesToLocalValue(value.getLastChild(), locals); case AND: case OR: return evaluatesToLocalValue(value.getFirstChild(), locals) && evaluatesToLocalValue(value.getLastChild(), locals); case HOOK: return evaluatesToLocalValue(value.getSecondChild(), locals) && evaluatesToLocalValue(value.getLastChild(), locals); case THIS: case SUPER: return locals.apply(value); case NAME: return isImmutableValue(value) || locals.apply(value); case GETELEM: case GETPROP: // There is no information about the locality of object properties. return locals.apply(value); case CALL: return callHasLocalResult(value) || isToStringMethodCall(value) || locals.apply(value); case TAGGED_TEMPLATELIT: return callHasLocalResult(value) || locals.apply(value); case NEW: return newHasLocalResult(value) || locals.apply(value); case DELPROP: case INC: case DEC: case CLASS: case FUNCTION: case REGEXP: case EMPTY: case ARRAYLIT: case OBJECTLIT: case TEMPLATELIT: return true; case CAST: return evaluatesToLocalValue(value.getFirstChild(), locals); case SPREAD: case YIELD: case AWAIT: // TODO(johnlenz): we can do better for await if we use type information. That is, // if we know the promise being awaited on is a immutable value type (string, etc) // we could return true here. return false; default: // Other op force a local value: // '' + g (a local string) // x -= g (x is now an local number) if (isAssignmentOp(value) || isSimpleOperator(value) || isImmutableValue(value)) { return true; } throw new IllegalStateException( "Unexpected expression node: " + value + "\n parent:" + value.getParent()); } }
java
static boolean evaluatesToLocalValue(Node value, Predicate<Node> locals) { switch (value.getToken()) { case ASSIGN: // A result that is aliased by a non-local name, is the effectively the // same as returning a non-local name, but this doesn't matter if the // value is immutable. return NodeUtil.isImmutableValue(value.getLastChild()) || (locals.apply(value) && evaluatesToLocalValue(value.getLastChild(), locals)); case COMMA: return evaluatesToLocalValue(value.getLastChild(), locals); case AND: case OR: return evaluatesToLocalValue(value.getFirstChild(), locals) && evaluatesToLocalValue(value.getLastChild(), locals); case HOOK: return evaluatesToLocalValue(value.getSecondChild(), locals) && evaluatesToLocalValue(value.getLastChild(), locals); case THIS: case SUPER: return locals.apply(value); case NAME: return isImmutableValue(value) || locals.apply(value); case GETELEM: case GETPROP: // There is no information about the locality of object properties. return locals.apply(value); case CALL: return callHasLocalResult(value) || isToStringMethodCall(value) || locals.apply(value); case TAGGED_TEMPLATELIT: return callHasLocalResult(value) || locals.apply(value); case NEW: return newHasLocalResult(value) || locals.apply(value); case DELPROP: case INC: case DEC: case CLASS: case FUNCTION: case REGEXP: case EMPTY: case ARRAYLIT: case OBJECTLIT: case TEMPLATELIT: return true; case CAST: return evaluatesToLocalValue(value.getFirstChild(), locals); case SPREAD: case YIELD: case AWAIT: // TODO(johnlenz): we can do better for await if we use type information. That is, // if we know the promise being awaited on is a immutable value type (string, etc) // we could return true here. return false; default: // Other op force a local value: // '' + g (a local string) // x -= g (x is now an local number) if (isAssignmentOp(value) || isSimpleOperator(value) || isImmutableValue(value)) { return true; } throw new IllegalStateException( "Unexpected expression node: " + value + "\n parent:" + value.getParent()); } }
[ "static", "boolean", "evaluatesToLocalValue", "(", "Node", "value", ",", "Predicate", "<", "Node", ">", "locals", ")", "{", "switch", "(", "value", ".", "getToken", "(", ")", ")", "{", "case", "ASSIGN", ":", "// A result that is aliased by a non-local name, is the...
@param locals A predicate to apply to unknown local values. @return Whether the result of the expression node is known to be a primitive value or an object that has not yet escaped. This guarantee is different than that provided by isLiteralValue (where literal values are immune to side-effects if unescaped) or isImmutableValue (which can be safely aliased). The concept of "local values" allow for the containment of side-effect operations. For example, setting a property on a local value does not produce a global side-effect. Note that the concept of "local value" is not deep, it does not say anything about the properties of the "local value" (all class instances have "constructor" properties that are not local values for instance). Note that this method only provides the starting state of the expression result, it does not guarantee that the value is forever a local value. If the containing method has any non-local side-effect, "local values" may escape.
[ "@param", "locals", "A", "predicate", "to", "apply", "to", "unknown", "local", "values", ".", "@return", "Whether", "the", "result", "of", "the", "expression", "node", "is", "known", "to", "be", "a", "primitive", "value", "or", "an", "object", "that", "has...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L5050-L5117
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java
PoolsImpl.getAsync
public Observable<CloudPool> getAsync(String poolId, PoolGetOptions poolGetOptions) { return getWithServiceResponseAsync(poolId, poolGetOptions).map(new Func1<ServiceResponseWithHeaders<CloudPool, PoolGetHeaders>, CloudPool>() { @Override public CloudPool call(ServiceResponseWithHeaders<CloudPool, PoolGetHeaders> response) { return response.body(); } }); }
java
public Observable<CloudPool> getAsync(String poolId, PoolGetOptions poolGetOptions) { return getWithServiceResponseAsync(poolId, poolGetOptions).map(new Func1<ServiceResponseWithHeaders<CloudPool, PoolGetHeaders>, CloudPool>() { @Override public CloudPool call(ServiceResponseWithHeaders<CloudPool, PoolGetHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CloudPool", ">", "getAsync", "(", "String", "poolId", ",", "PoolGetOptions", "poolGetOptions", ")", "{", "return", "getWithServiceResponseAsync", "(", "poolId", ",", "poolGetOptions", ")", ".", "map", "(", "new", "Func1", "<", "Serv...
Gets information about the specified pool. @param poolId The ID of the pool to get. @param poolGetOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CloudPool object
[ "Gets", "information", "about", "the", "specified", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L1721-L1728
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java
ImageModerationsImpl.evaluateFileInputAsync
public Observable<Evaluate> evaluateFileInputAsync(byte[] imageStream, EvaluateFileInputOptionalParameter evaluateFileInputOptionalParameter) { return evaluateFileInputWithServiceResponseAsync(imageStream, evaluateFileInputOptionalParameter).map(new Func1<ServiceResponse<Evaluate>, Evaluate>() { @Override public Evaluate call(ServiceResponse<Evaluate> response) { return response.body(); } }); }
java
public Observable<Evaluate> evaluateFileInputAsync(byte[] imageStream, EvaluateFileInputOptionalParameter evaluateFileInputOptionalParameter) { return evaluateFileInputWithServiceResponseAsync(imageStream, evaluateFileInputOptionalParameter).map(new Func1<ServiceResponse<Evaluate>, Evaluate>() { @Override public Evaluate call(ServiceResponse<Evaluate> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Evaluate", ">", "evaluateFileInputAsync", "(", "byte", "[", "]", "imageStream", ",", "EvaluateFileInputOptionalParameter", "evaluateFileInputOptionalParameter", ")", "{", "return", "evaluateFileInputWithServiceResponseAsync", "(", "imageStream", ...
Returns probabilities of the image containing racy or adult content. @param imageStream The image file. @param evaluateFileInputOptionalParameter 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 Evaluate object
[ "Returns", "probabilities", "of", "the", "image", "containing", "racy", "or", "adult", "content", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java#L1451-L1458
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMaterial.java
GVRMaterial.setSpecularColor
public void setSpecularColor(float r, float g, float b, float a) { setVec4("specular_color", r, g, b, a); }
java
public void setSpecularColor(float r, float g, float b, float a) { setVec4("specular_color", r, g, b, a); }
[ "public", "void", "setSpecularColor", "(", "float", "r", ",", "float", "g", ",", "float", "b", ",", "float", "a", ")", "{", "setVec4", "(", "\"specular_color\"", ",", "r", ",", "g", ",", "b", ",", "a", ")", ";", "}" ]
Set the {@code specular_color} uniform for lighting. By convention, GVRF shaders can use a {@code vec4} uniform named {@code specular_color}. With the {@linkplain GVRShaderType.Texture hader,} this allows you to add an overlay specular light color on top of the texture. Values are between {@code 0.0f} and {@code 1.0f}, inclusive. @param r Red @param g Green @param b Blue @param a Alpha
[ "Set", "the", "{", "@code", "specular_color", "}", "uniform", "for", "lighting", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMaterial.java#L483-L485
apache/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/monitoring/FsJobStatusRetriever.java
FsJobStatusRetriever.shouldFilterJobStatus
private boolean shouldFilterJobStatus(List<String> tableNames, String tableName) { return tableNames.size() > 1 && JobStatusRetriever.NA_KEY .equals(Splitter.on(KafkaJobStatusMonitor.STATE_STORE_KEY_SEPARATION_CHARACTER).splitToList(tableName).get(1)); }
java
private boolean shouldFilterJobStatus(List<String> tableNames, String tableName) { return tableNames.size() > 1 && JobStatusRetriever.NA_KEY .equals(Splitter.on(KafkaJobStatusMonitor.STATE_STORE_KEY_SEPARATION_CHARACTER).splitToList(tableName).get(1)); }
[ "private", "boolean", "shouldFilterJobStatus", "(", "List", "<", "String", ">", "tableNames", ",", "String", "tableName", ")", "{", "return", "tableNames", ".", "size", "(", ")", ">", "1", "&&", "JobStatusRetriever", ".", "NA_KEY", ".", "equals", "(", "Split...
A helper method to determine if {@link JobStatus}es for jobs without a jobGroup/jobName should be filtered out. Once a job has been orchestrated, {@link JobStatus}es without a jobGroup/jobName can be filtered out. @param tableNames @param tableName @return
[ "A", "helper", "method", "to", "determine", "if", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/monitoring/FsJobStatusRetriever.java#L142-L145
apache/incubator-druid
server/src/main/java/org/apache/druid/segment/realtime/plumber/RealtimePlumber.java
RealtimePlumber.abandonSegment
protected void abandonSegment(final long truncatedTime, final Sink sink) { if (sinks.containsKey(truncatedTime)) { try { segmentAnnouncer.unannounceSegment(sink.getSegment()); removeSegment(sink, computePersistDir(schema, sink.getInterval())); log.info("Removing sinkKey %d for segment %s", truncatedTime, sink.getSegment().getId()); sinks.remove(truncatedTime); metrics.setSinkCount(sinks.size()); sinkTimeline.remove( sink.getInterval(), sink.getVersion(), new SingleElementPartitionChunk<>(sink) ); for (FireHydrant hydrant : sink) { cache.close(SinkQuerySegmentWalker.makeHydrantCacheIdentifier(hydrant)); hydrant.swapSegment(null); } synchronized (handoffCondition) { handoffCondition.notifyAll(); } } catch (Exception e) { log.makeAlert(e, "Unable to abandon old segment for dataSource[%s]", schema.getDataSource()) .addData("interval", sink.getInterval()) .emit(); } } }
java
protected void abandonSegment(final long truncatedTime, final Sink sink) { if (sinks.containsKey(truncatedTime)) { try { segmentAnnouncer.unannounceSegment(sink.getSegment()); removeSegment(sink, computePersistDir(schema, sink.getInterval())); log.info("Removing sinkKey %d for segment %s", truncatedTime, sink.getSegment().getId()); sinks.remove(truncatedTime); metrics.setSinkCount(sinks.size()); sinkTimeline.remove( sink.getInterval(), sink.getVersion(), new SingleElementPartitionChunk<>(sink) ); for (FireHydrant hydrant : sink) { cache.close(SinkQuerySegmentWalker.makeHydrantCacheIdentifier(hydrant)); hydrant.swapSegment(null); } synchronized (handoffCondition) { handoffCondition.notifyAll(); } } catch (Exception e) { log.makeAlert(e, "Unable to abandon old segment for dataSource[%s]", schema.getDataSource()) .addData("interval", sink.getInterval()) .emit(); } } }
[ "protected", "void", "abandonSegment", "(", "final", "long", "truncatedTime", ",", "final", "Sink", "sink", ")", "{", "if", "(", "sinks", ".", "containsKey", "(", "truncatedTime", ")", ")", "{", "try", "{", "segmentAnnouncer", ".", "unannounceSegment", "(", ...
Unannounces a given sink and removes all local references to it. It is important that this is only called from the single-threaded mergeExecutor, since otherwise chaos may ensue if merged segments are deleted while being created. @param truncatedTime sink key @param sink sink to unannounce
[ "Unannounces", "a", "given", "sink", "and", "removes", "all", "local", "references", "to", "it", ".", "It", "is", "important", "that", "this", "is", "only", "called", "from", "the", "single", "-", "threaded", "mergeExecutor", "since", "otherwise", "chaos", "...
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/segment/realtime/plumber/RealtimePlumber.java#L872-L900
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/StreamHandler.java
StreamHandler.setOutputStream
protected synchronized void setOutputStream(OutputStream out) throws SecurityException { if (out == null) { throw new NullPointerException(); } flushAndClose(); output = out; doneHeader = false; String encoding = getEncoding(); if (encoding == null) { writer = new OutputStreamWriter(output); } else { try { writer = new OutputStreamWriter(output, encoding); } catch (UnsupportedEncodingException ex) { // This shouldn't happen. The setEncoding method // should have validated that the encoding is OK. throw new Error("Unexpected exception " + ex); } } }
java
protected synchronized void setOutputStream(OutputStream out) throws SecurityException { if (out == null) { throw new NullPointerException(); } flushAndClose(); output = out; doneHeader = false; String encoding = getEncoding(); if (encoding == null) { writer = new OutputStreamWriter(output); } else { try { writer = new OutputStreamWriter(output, encoding); } catch (UnsupportedEncodingException ex) { // This shouldn't happen. The setEncoding method // should have validated that the encoding is OK. throw new Error("Unexpected exception " + ex); } } }
[ "protected", "synchronized", "void", "setOutputStream", "(", "OutputStream", "out", ")", "throws", "SecurityException", "{", "if", "(", "out", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "flushAndClose", "(", ")", ";", ...
Change the output stream. <P> If there is a current output stream then the <tt>Formatter</tt>'s tail string is written and the stream is flushed and closed. Then the output stream is replaced with the new output stream. @param out New output stream. May not be null. @exception SecurityException if a security manager exists and if the caller does not have <tt>LoggingPermission("control")</tt>.
[ "Change", "the", "output", "stream", ".", "<P", ">", "If", "there", "is", "a", "current", "output", "stream", "then", "the", "<tt", ">", "Formatter<", "/", "tt", ">", "s", "tail", "string", "is", "written", "and", "the", "stream", "is", "flushed", "and...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/StreamHandler.java#L137-L156
Alluxio/alluxio
underfs/s3a/src/main/java/alluxio/underfs/s3a/S3AUnderFileSystem.java
S3AUnderFileSystem.getPermissionsInternal
private ObjectPermissions getPermissionsInternal() { short bucketMode = ModeUtils.getUMask(mUfsConf.get(PropertyKey.UNDERFS_S3A_DEFAULT_MODE)).toShort(); String accountOwner = DEFAULT_OWNER; // if ACL enabled try to inherit bucket acl for all the objects. if (Boolean.parseBoolean(mConf.get(PropertyKey.UNDERFS_S3A_INHERIT_ACL))) { try { Owner owner = mClient.getS3AccountOwner(); AccessControlList acl = mClient.getBucketAcl(mBucketName); bucketMode = S3AUtils.translateBucketAcl(acl, owner.getId()); if (mConf.isSet(PropertyKey.UNDERFS_S3_OWNER_ID_TO_USERNAME_MAPPING)) { accountOwner = CommonUtils.getValueFromStaticMapping( mConf.get(PropertyKey.UNDERFS_S3_OWNER_ID_TO_USERNAME_MAPPING), owner.getId()); } else { // If there is no user-defined mapping, use display name or id. accountOwner = owner.getDisplayName() != null ? owner.getDisplayName() : owner.getId(); } } catch (AmazonClientException e) { LOG.warn("Failed to inherit bucket ACLs, proceeding with defaults. {}", e.getMessage()); } } return new ObjectPermissions(accountOwner, accountOwner, bucketMode); }
java
private ObjectPermissions getPermissionsInternal() { short bucketMode = ModeUtils.getUMask(mUfsConf.get(PropertyKey.UNDERFS_S3A_DEFAULT_MODE)).toShort(); String accountOwner = DEFAULT_OWNER; // if ACL enabled try to inherit bucket acl for all the objects. if (Boolean.parseBoolean(mConf.get(PropertyKey.UNDERFS_S3A_INHERIT_ACL))) { try { Owner owner = mClient.getS3AccountOwner(); AccessControlList acl = mClient.getBucketAcl(mBucketName); bucketMode = S3AUtils.translateBucketAcl(acl, owner.getId()); if (mConf.isSet(PropertyKey.UNDERFS_S3_OWNER_ID_TO_USERNAME_MAPPING)) { accountOwner = CommonUtils.getValueFromStaticMapping( mConf.get(PropertyKey.UNDERFS_S3_OWNER_ID_TO_USERNAME_MAPPING), owner.getId()); } else { // If there is no user-defined mapping, use display name or id. accountOwner = owner.getDisplayName() != null ? owner.getDisplayName() : owner.getId(); } } catch (AmazonClientException e) { LOG.warn("Failed to inherit bucket ACLs, proceeding with defaults. {}", e.getMessage()); } } return new ObjectPermissions(accountOwner, accountOwner, bucketMode); }
[ "private", "ObjectPermissions", "getPermissionsInternal", "(", ")", "{", "short", "bucketMode", "=", "ModeUtils", ".", "getUMask", "(", "mUfsConf", ".", "get", "(", "PropertyKey", ".", "UNDERFS_S3A_DEFAULT_MODE", ")", ")", ".", "toShort", "(", ")", ";", "String"...
Since there is no group in S3 acl, the owner is reused as the group. This method calls the S3 API and requires additional permissions aside from just read only. This method is best effort and will continue with default permissions (no owner, no group, 0700). @return the permissions associated with this under storage system
[ "Since", "there", "is", "no", "group", "in", "S3", "acl", "the", "owner", "is", "reused", "as", "the", "group", ".", "This", "method", "calls", "the", "S3", "API", "and", "requires", "additional", "permissions", "aside", "from", "just", "read", "only", "...
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/underfs/s3a/src/main/java/alluxio/underfs/s3a/S3AUnderFileSystem.java#L564-L589
rhuss/jolokia
agent/core/src/main/java/org/jolokia/http/HttpRequestHandler.java
HttpRequestHandler.getErrorJSON
public JSONObject getErrorJSON(int pErrorCode, Throwable pExp, JmxRequest pJmxReq) { JSONObject jsonObject = new JSONObject(); jsonObject.put("status",pErrorCode); jsonObject.put("error",getExceptionMessage(pExp)); jsonObject.put("error_type", pExp.getClass().getName()); addErrorInfo(jsonObject, pExp, pJmxReq); if (backendManager.isDebug()) { backendManager.error("Error " + pErrorCode,pExp); } if (pJmxReq != null) { jsonObject.put("request",pJmxReq.toJSON()); } return jsonObject; }
java
public JSONObject getErrorJSON(int pErrorCode, Throwable pExp, JmxRequest pJmxReq) { JSONObject jsonObject = new JSONObject(); jsonObject.put("status",pErrorCode); jsonObject.put("error",getExceptionMessage(pExp)); jsonObject.put("error_type", pExp.getClass().getName()); addErrorInfo(jsonObject, pExp, pJmxReq); if (backendManager.isDebug()) { backendManager.error("Error " + pErrorCode,pExp); } if (pJmxReq != null) { jsonObject.put("request",pJmxReq.toJSON()); } return jsonObject; }
[ "public", "JSONObject", "getErrorJSON", "(", "int", "pErrorCode", ",", "Throwable", "pExp", ",", "JmxRequest", "pJmxReq", ")", "{", "JSONObject", "jsonObject", "=", "new", "JSONObject", "(", ")", ";", "jsonObject", ".", "put", "(", "\"status\"", ",", "pErrorCo...
Get the JSON representation for a an exception @param pErrorCode the HTTP error code to return @param pExp the exception or error occured @param pJmxReq request from where to get processing options @return the json representation
[ "Get", "the", "JSON", "representation", "for", "a", "an", "exception" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/http/HttpRequestHandler.java#L258-L271
logic-ng/LogicNG
src/main/java/org/logicng/backbones/BackboneGeneration.java
BackboneGeneration.computePositive
public static Backbone computePositive(final Formula formula, final Collection<Variable> variables) { return compute(formula, variables, BackboneType.ONLY_POSITIVE); }
java
public static Backbone computePositive(final Formula formula, final Collection<Variable> variables) { return compute(formula, variables, BackboneType.ONLY_POSITIVE); }
[ "public", "static", "Backbone", "computePositive", "(", "final", "Formula", "formula", ",", "final", "Collection", "<", "Variable", ">", "variables", ")", "{", "return", "compute", "(", "formula", ",", "variables", ",", "BackboneType", ".", "ONLY_POSITIVE", ")",...
Computes the positive backbone allVariablesInFormulas for a given formula w.r.t. a collection of variables. @param formula the given formula @param variables the given collection of relevant variables for the backbone computation @return the positive backbone or {@code null} if the formula is UNSAT
[ "Computes", "the", "positive", "backbone", "allVariablesInFormulas", "for", "a", "given", "formula", "w", ".", "r", ".", "t", ".", "a", "collection", "of", "variables", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/BackboneGeneration.java#L183-L185
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLStreamHandler.java
URLStreamHandler.hostsEqual
protected boolean hostsEqual(URL u1, URL u2) { // Android-changed: Don't compare the InetAddresses of the hosts. if (u1.getHost() != null && u2.getHost() != null) return u1.getHost().equalsIgnoreCase(u2.getHost()); else return u1.getHost() == null && u2.getHost() == null; }
java
protected boolean hostsEqual(URL u1, URL u2) { // Android-changed: Don't compare the InetAddresses of the hosts. if (u1.getHost() != null && u2.getHost() != null) return u1.getHost().equalsIgnoreCase(u2.getHost()); else return u1.getHost() == null && u2.getHost() == null; }
[ "protected", "boolean", "hostsEqual", "(", "URL", "u1", ",", "URL", "u2", ")", "{", "// Android-changed: Don't compare the InetAddresses of the hosts.", "if", "(", "u1", ".", "getHost", "(", ")", "!=", "null", "&&", "u2", ".", "getHost", "(", ")", "!=", "null"...
Compares the host components of two URLs. @param u1 the URL of the first host to compare @param u2 the URL of the second host to compare @return {@code true} if and only if they are equal, {@code false} otherwise. @since 1.3
[ "Compares", "the", "host", "components", "of", "two", "URLs", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLStreamHandler.java#L482-L488
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/form/CmsBasicFormField.java
CmsBasicFormField.createField
public static CmsBasicFormField createField( CmsXmlContentProperty propertyConfig, String fieldId, I_CmsFormWidgetMultiFactory factory, Map<String, String> additionalParams, boolean alwaysAllowEmpty) { String widgetConfigStr = propertyConfig.getWidgetConfiguration(); if (widgetConfigStr == null) { widgetConfigStr = ""; } String label = propertyConfig.getNiceName(); if (label == null) { label = propertyConfig.getName(); } String description = propertyConfig.getDescription(); if (CmsStringUtil.isEmpty(description)) { description = ""; } Map<String, String> widgetConfig = CmsStringUtil.splitAsMap(widgetConfigStr, "|", ":"); widgetConfig.putAll(additionalParams); String widgetType = propertyConfig.getWidget(); I_CmsFormWidget widget = factory.createFormWidget( widgetType, widgetConfig, Optional.fromNullable(propertyConfig.getDefault())); CmsBasicFormField field = new CmsBasicFormField( fieldId, description, label, propertyConfig.getDefault(), widget); String ruleRegex = propertyConfig.getRuleRegex(); if (!CmsStringUtil.isEmpty(ruleRegex)) { field.setValidator(new CmsRegexValidator(ruleRegex, propertyConfig.getError(), alwaysAllowEmpty)); } return field; }
java
public static CmsBasicFormField createField( CmsXmlContentProperty propertyConfig, String fieldId, I_CmsFormWidgetMultiFactory factory, Map<String, String> additionalParams, boolean alwaysAllowEmpty) { String widgetConfigStr = propertyConfig.getWidgetConfiguration(); if (widgetConfigStr == null) { widgetConfigStr = ""; } String label = propertyConfig.getNiceName(); if (label == null) { label = propertyConfig.getName(); } String description = propertyConfig.getDescription(); if (CmsStringUtil.isEmpty(description)) { description = ""; } Map<String, String> widgetConfig = CmsStringUtil.splitAsMap(widgetConfigStr, "|", ":"); widgetConfig.putAll(additionalParams); String widgetType = propertyConfig.getWidget(); I_CmsFormWidget widget = factory.createFormWidget( widgetType, widgetConfig, Optional.fromNullable(propertyConfig.getDefault())); CmsBasicFormField field = new CmsBasicFormField( fieldId, description, label, propertyConfig.getDefault(), widget); String ruleRegex = propertyConfig.getRuleRegex(); if (!CmsStringUtil.isEmpty(ruleRegex)) { field.setValidator(new CmsRegexValidator(ruleRegex, propertyConfig.getError(), alwaysAllowEmpty)); } return field; }
[ "public", "static", "CmsBasicFormField", "createField", "(", "CmsXmlContentProperty", "propertyConfig", ",", "String", "fieldId", ",", "I_CmsFormWidgetMultiFactory", "factory", ",", "Map", "<", "String", ",", "String", ">", "additionalParams", ",", "boolean", "alwaysAll...
Utility method for creating a single basic form field from an id and a property configuration. @param propertyConfig the configuration of the property @param fieldId the field id @param factory a factory for creating form widgets @param additionalParams additional field parameters @param alwaysAllowEmpty indicates an empty value is allowed @return the newly created form field
[ "Utility", "method", "for", "creating", "a", "single", "basic", "form", "field", "from", "an", "id", "and", "a", "property", "configuration", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/form/CmsBasicFormField.java#L148-L188
GCRC/nunaliit
nunaliit2-utils/src/main/java/ca/carleton/gcrc/utils/PropertiesWriter.java
PropertiesWriter.saveConvert
private String saveConvert(String theString, boolean escapeSpace) { int len = theString.length(); int bufLen = len * 2; if (bufLen < 0) { bufLen = Integer.MAX_VALUE; } StringBuffer outBuffer = new StringBuffer(bufLen); for (int x = 0; x < len; x++) { char aChar = theString.charAt(x); // Handle common case first, selecting largest block that // avoids the specials below if ((aChar > 61) && (aChar < 127)) { if (aChar == '\\') { outBuffer.append('\\'); outBuffer.append('\\'); continue; } outBuffer.append(aChar); continue; } switch (aChar) { case ' ': if (x == 0 || escapeSpace) outBuffer.append('\\'); outBuffer.append(' '); break; case '\t': outBuffer.append('\\'); outBuffer.append('t'); break; case '\n': outBuffer.append('\\'); outBuffer.append('n'); break; case '\r': outBuffer.append('\\'); outBuffer.append('r'); break; case '\f': outBuffer.append('\\'); outBuffer.append('f'); break; case '=': // Fall through case ':': // Fall through case '#': // Fall through case '!': outBuffer.append('\\'); outBuffer.append(aChar); break; default: outBuffer.append(aChar); } } return outBuffer.toString(); }
java
private String saveConvert(String theString, boolean escapeSpace) { int len = theString.length(); int bufLen = len * 2; if (bufLen < 0) { bufLen = Integer.MAX_VALUE; } StringBuffer outBuffer = new StringBuffer(bufLen); for (int x = 0; x < len; x++) { char aChar = theString.charAt(x); // Handle common case first, selecting largest block that // avoids the specials below if ((aChar > 61) && (aChar < 127)) { if (aChar == '\\') { outBuffer.append('\\'); outBuffer.append('\\'); continue; } outBuffer.append(aChar); continue; } switch (aChar) { case ' ': if (x == 0 || escapeSpace) outBuffer.append('\\'); outBuffer.append(' '); break; case '\t': outBuffer.append('\\'); outBuffer.append('t'); break; case '\n': outBuffer.append('\\'); outBuffer.append('n'); break; case '\r': outBuffer.append('\\'); outBuffer.append('r'); break; case '\f': outBuffer.append('\\'); outBuffer.append('f'); break; case '=': // Fall through case ':': // Fall through case '#': // Fall through case '!': outBuffer.append('\\'); outBuffer.append(aChar); break; default: outBuffer.append(aChar); } } return outBuffer.toString(); }
[ "private", "String", "saveConvert", "(", "String", "theString", ",", "boolean", "escapeSpace", ")", "{", "int", "len", "=", "theString", ".", "length", "(", ")", ";", "int", "bufLen", "=", "len", "*", "2", ";", "if", "(", "bufLen", "<", "0", ")", "{"...
/* Converts unicodes to encoded &#92;uxxxx and escapes special characters with a preceding slash
[ "/", "*", "Converts", "unicodes", "to", "encoded", "&#92", ";", "uxxxx", "and", "escapes", "special", "characters", "with", "a", "preceding", "slash" ]
train
https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-utils/src/main/java/ca/carleton/gcrc/utils/PropertiesWriter.java#L66-L121
sahan/RoboZombie
robozombie/src/main/java/com/lonepulse/robozombie/util/Assert.java
Assert.assertValid
public static <T> T assertValid(T context, Validator<T> validator) { assertNotNull(context); if(validator != null) { validator.validate(context); } return context; }
java
public static <T> T assertValid(T context, Validator<T> validator) { assertNotNull(context); if(validator != null) { validator.validate(context); } return context; }
[ "public", "static", "<", "T", ">", "T", "assertValid", "(", "T", "context", ",", "Validator", "<", "T", ">", "validator", ")", "{", "assertNotNull", "(", "context", ")", ";", "if", "(", "validator", "!=", "null", ")", "{", "validator", ".", "validate",...
<p>Asserts that the given context is valid using the supplied {@link Validator} along with a few other trivial validations such as a {@code null} check.</p> @param context the context to be validated using the given {@link Validator} <br><br> @param validator the {@link Validator} to be used on the given context <br><br> @return the given context which was asserted to be valid <br><br> @since 1.3.0
[ "<p", ">", "Asserts", "that", "the", "given", "context", "is", "valid", "using", "the", "supplied", "{", "@link", "Validator", "}", "along", "with", "a", "few", "other", "trivial", "validations", "such", "as", "a", "{", "@code", "null", "}", "check", "."...
train
https://github.com/sahan/RoboZombie/blob/2e02f0d41647612e9d89360c5c48811ea86b33c8/robozombie/src/main/java/com/lonepulse/robozombie/util/Assert.java#L295-L305
kiegroup/drools
drools-core/src/main/java/org/drools/core/reteoo/builder/BuildUtils.java
BuildUtils.isSharingEnabledForNode
private boolean isSharingEnabledForNode(BuildContext context, BaseNode node) { if ( NodeTypeEnums.isLeftTupleSource( node )) { return context.getKnowledgeBase().getConfiguration().isShareBetaNodes(); } else if ( NodeTypeEnums.isObjectSource( node ) ) { return context.getKnowledgeBase().getConfiguration().isShareAlphaNodes(); } return false; }
java
private boolean isSharingEnabledForNode(BuildContext context, BaseNode node) { if ( NodeTypeEnums.isLeftTupleSource( node )) { return context.getKnowledgeBase().getConfiguration().isShareBetaNodes(); } else if ( NodeTypeEnums.isObjectSource( node ) ) { return context.getKnowledgeBase().getConfiguration().isShareAlphaNodes(); } return false; }
[ "private", "boolean", "isSharingEnabledForNode", "(", "BuildContext", "context", ",", "BaseNode", "node", ")", "{", "if", "(", "NodeTypeEnums", ".", "isLeftTupleSource", "(", "node", ")", ")", "{", "return", "context", ".", "getKnowledgeBase", "(", ")", ".", "...
Utility function to check if sharing is enabled for nodes of the given class
[ "Utility", "function", "to", "check", "if", "sharing", "is", "enabled", "for", "nodes", "of", "the", "given", "class" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/reteoo/builder/BuildUtils.java#L185-L192
NessComputing/components-ness-jms
src/main/java/com/nesscomputing/jms/JmsRunnableFactory.java
JmsRunnableFactory.createQueueListener
public QueueConsumer createQueueListener(final String topic, final ConsumerCallback<Message> messageCallback) { Preconditions.checkState(connectionFactory != null, "connection factory was never injected!"); return new QueueConsumer(connectionFactory, jmsConfig, topic, messageCallback); }
java
public QueueConsumer createQueueListener(final String topic, final ConsumerCallback<Message> messageCallback) { Preconditions.checkState(connectionFactory != null, "connection factory was never injected!"); return new QueueConsumer(connectionFactory, jmsConfig, topic, messageCallback); }
[ "public", "QueueConsumer", "createQueueListener", "(", "final", "String", "topic", ",", "final", "ConsumerCallback", "<", "Message", ">", "messageCallback", ")", "{", "Preconditions", ".", "checkState", "(", "connectionFactory", "!=", "null", ",", "\"connection factor...
Creates a new {@link QueueConsumer}. For every message received (or when the timeout waiting for messages is hit), the callback is invoked with the message received.
[ "Creates", "a", "new", "{" ]
train
https://github.com/NessComputing/components-ness-jms/blob/29e0d320ada3a1a375483437a9f3ff629822b714/src/main/java/com/nesscomputing/jms/JmsRunnableFactory.java#L134-L138
Azure/azure-sdk-for-java
iotcentral/resource-manager/v2017_07_01_privatepreview/src/main/java/com/microsoft/azure/management/iotcentral/v2017_07_01_privatepreview/implementation/AppsInner.java
AppsInner.beginCreateOrUpdateAsync
public Observable<AppInner> beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, AppInner app) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, app).map(new Func1<ServiceResponse<AppInner>, AppInner>() { @Override public AppInner call(ServiceResponse<AppInner> response) { return response.body(); } }); }
java
public Observable<AppInner> beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, AppInner app) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, app).map(new Func1<ServiceResponse<AppInner>, AppInner>() { @Override public AppInner call(ServiceResponse<AppInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AppInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "AppInner", "app", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "resource...
Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to retrieve the IoT Central application metadata and security metadata, and then combine them with the modified values in a new body to update the IoT Central application. @param resourceGroupName The name of the resource group that contains the IoT Central application. @param resourceName The ARM resource name of the IoT Central application. @param app The IoT Central application metadata and security metadata. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AppInner object
[ "Create", "or", "update", "the", "metadata", "of", "an", "IoT", "Central", "application", ".", "The", "usual", "pattern", "to", "modify", "a", "property", "is", "to", "retrieve", "the", "IoT", "Central", "application", "metadata", "and", "security", "metadata"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iotcentral/resource-manager/v2017_07_01_privatepreview/src/main/java/com/microsoft/azure/management/iotcentral/v2017_07_01_privatepreview/implementation/AppsInner.java#L322-L329
waldheinz/fat32-lib
src/main/java/de/waldheinz/fs/fat/FatFile.java
FatFile.write
@Override public void write(long offset, ByteBuffer srcBuf) throws ReadOnlyException, IOException { checkWritable(); updateTimeStamps(true); final long lastByte = offset + srcBuf.remaining(); if (lastByte > getLength()) { setLength(lastByte); } chain.writeData(offset, srcBuf); }
java
@Override public void write(long offset, ByteBuffer srcBuf) throws ReadOnlyException, IOException { checkWritable(); updateTimeStamps(true); final long lastByte = offset + srcBuf.remaining(); if (lastByte > getLength()) { setLength(lastByte); } chain.writeData(offset, srcBuf); }
[ "@", "Override", "public", "void", "write", "(", "long", "offset", ",", "ByteBuffer", "srcBuf", ")", "throws", "ReadOnlyException", ",", "IOException", "{", "checkWritable", "(", ")", ";", "updateTimeStamps", "(", "true", ")", ";", "final", "long", "lastByte",...
<p> {@inheritDoc} </p><p> If the data to be written extends beyond the current {@link #getLength() length} of this file, an attempt is made to {@link #setLength(long) grow} the file so that the data will fit. Additionally, this method updates the "last accessed" and "last modified" fields on the directory entry that is associated with this file. </p> @param offset {@inheritDoc} @param srcBuf {@inheritDoc}
[ "<p", ">", "{", "@inheritDoc", "}", "<", "/", "p", ">", "<p", ">", "If", "the", "data", "to", "be", "written", "extends", "beyond", "the", "current", "{", "@link", "#getLength", "()", "length", "}", "of", "this", "file", "an", "attempt", "is", "made"...
train
https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/FatFile.java#L145-L160
michael-rapp/AndroidMaterialDialog
library/src/main/java/de/mrapp/android/dialog/adapter/RecyclerViewAdapterWrapper.java
RecyclerViewAdapterWrapper.setItemChecked
public final void setItemChecked(final int position, final boolean checked) { if (choiceMode.setItemChecked(position, checked)) { notifyDataSetChanged(); if (checked && itemSelectedListener != null) { itemSelectedListener.onItemSelected(position); } } }
java
public final void setItemChecked(final int position, final boolean checked) { if (choiceMode.setItemChecked(position, checked)) { notifyDataSetChanged(); if (checked && itemSelectedListener != null) { itemSelectedListener.onItemSelected(position); } } }
[ "public", "final", "void", "setItemChecked", "(", "final", "int", "position", ",", "final", "boolean", "checked", ")", "{", "if", "(", "choiceMode", ".", "setItemChecked", "(", "position", ",", "checked", ")", ")", "{", "notifyDataSetChanged", "(", ")", ";",...
Sets, whether the list item at a specific position should be selected, or not. @param position The position of the list item, whose selection state should be changed, as an {@link Integer} value @param checked True, if the list item should be selected, false otherwise
[ "Sets", "whether", "the", "list", "item", "at", "a", "specific", "position", "should", "be", "selected", "or", "not", "." ]
train
https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/adapter/RecyclerViewAdapterWrapper.java#L373-L381
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/MessagesApi.java
MessagesApi.getAggregatesHistogram
public AggregatesHistogramResponse getAggregatesHistogram(Long startDate, Long endDate, String sdid, String field, String interval) throws ApiException { ApiResponse<AggregatesHistogramResponse> resp = getAggregatesHistogramWithHttpInfo(startDate, endDate, sdid, field, interval); return resp.getData(); }
java
public AggregatesHistogramResponse getAggregatesHistogram(Long startDate, Long endDate, String sdid, String field, String interval) throws ApiException { ApiResponse<AggregatesHistogramResponse> resp = getAggregatesHistogramWithHttpInfo(startDate, endDate, sdid, field, interval); return resp.getData(); }
[ "public", "AggregatesHistogramResponse", "getAggregatesHistogram", "(", "Long", "startDate", ",", "Long", "endDate", ",", "String", "sdid", ",", "String", "field", ",", "String", "interval", ")", "throws", "ApiException", "{", "ApiResponse", "<", "AggregatesHistogramR...
Get Normalized Message Histogram Get Histogram on normalized messages. @param startDate Timestamp of earliest message (in milliseconds since epoch). (required) @param endDate Timestamp of latest message (in milliseconds since epoch). (required) @param sdid Source device ID of the messages being searched. (optional) @param field Message field being queried for building histogram. (optional) @param interval Interval of time for building histogram blocks. (Valid values: minute, hour, day, month, year) (optional) @return AggregatesHistogramResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "Normalized", "Message", "Histogram", "Get", "Histogram", "on", "normalized", "messages", "." ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/MessagesApi.java#L150-L153
Nexmo/nexmo-java
src/main/java/com/nexmo/client/account/AccountClient.java
AccountClient.getSecret
public SecretResponse getSecret(String apiKey, String secretId) throws IOException, NexmoClientException { return getSecret(new SecretRequest(apiKey, secretId)); }
java
public SecretResponse getSecret(String apiKey, String secretId) throws IOException, NexmoClientException { return getSecret(new SecretRequest(apiKey, secretId)); }
[ "public", "SecretResponse", "getSecret", "(", "String", "apiKey", ",", "String", "secretId", ")", "throws", "IOException", ",", "NexmoClientException", "{", "return", "getSecret", "(", "new", "SecretRequest", "(", "apiKey", ",", "secretId", ")", ")", ";", "}" ]
Get information for a specific secret id associated to a given API key. @param apiKey The API key that the secret is associated to. @param secretId The id of the secret to get information on. @return SecretResponse object which contains the results from the API. @throws IOException if a network error occurred contacting the Nexmo Account API @throws NexmoClientException if there was a problem wit hthe Nexmo request or response object indicating that the request was unsuccessful.
[ "Get", "information", "for", "a", "specific", "secret", "id", "associated", "to", "a", "given", "API", "key", "." ]
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/account/AccountClient.java#L159-L161
milaboratory/milib
src/main/java/com/milaboratory/core/alignment/BandedLinearAligner.java
BandedLinearAligner.alignSemiLocalLeft
public static Alignment<NucleotideSequence> alignSemiLocalLeft(LinearGapAlignmentScoring scoring, NucleotideSequence seq1, NucleotideSequence seq2, int width, int stopPenalty) { return alignSemiLocalLeft(scoring, seq1, seq2, 0, seq1.size(), 0, seq2.size(), width, stopPenalty); }
java
public static Alignment<NucleotideSequence> alignSemiLocalLeft(LinearGapAlignmentScoring scoring, NucleotideSequence seq1, NucleotideSequence seq2, int width, int stopPenalty) { return alignSemiLocalLeft(scoring, seq1, seq2, 0, seq1.size(), 0, seq2.size(), width, stopPenalty); }
[ "public", "static", "Alignment", "<", "NucleotideSequence", ">", "alignSemiLocalLeft", "(", "LinearGapAlignmentScoring", "scoring", ",", "NucleotideSequence", "seq1", ",", "NucleotideSequence", "seq2", ",", "int", "width", ",", "int", "stopPenalty", ")", "{", "return"...
Alignment which identifies what is the highly similar part of the both sequences. <p/> <p>Alignment is done in the way that beginning of second sequences is aligned to beginning of first sequence.</p> <p/> <p>Alignment terminates when score in banded alignment matrix reaches {@code stopPenalty} value.</p> <p/> <p>In other words, only left part of second sequence is to be aligned</p> @param scoring scoring system @param seq1 first sequence @param seq2 second sequence @param stopPenalty alignment score value in banded alignment matrix at which alignment terminates @return object which contains positions at which alignment terminated and array of mutations
[ "Alignment", "which", "identifies", "what", "is", "the", "highly", "similar", "part", "of", "the", "both", "sequences", ".", "<p", "/", ">", "<p", ">", "Alignment", "is", "done", "in", "the", "way", "that", "beginning", "of", "second", "sequences", "is", ...
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/alignment/BandedLinearAligner.java#L699-L703
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/UnLockCommand.java
UnLockCommand.unLock
public Response unLock(Session session, String path, List<String> tokens) { try { try { Node node = (Node)session.getItem(path); if (node.isLocked()) { node.unlock(); session.save(); } return Response.status(HTTPStatus.NO_CONTENT).build(); } catch (PathNotFoundException exc) { if (nullResourceLocks.isLocked(session, path)) { nullResourceLocks.checkLock(session, path, tokens); nullResourceLocks.removeLock(session, path); return Response.status(HTTPStatus.NO_CONTENT).build(); } return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build(); } } catch (LockException exc) { return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build(); } catch (Exception exc) { log.error(exc.getMessage(), exc); return Response.serverError().entity(exc.getMessage()).build(); } }
java
public Response unLock(Session session, String path, List<String> tokens) { try { try { Node node = (Node)session.getItem(path); if (node.isLocked()) { node.unlock(); session.save(); } return Response.status(HTTPStatus.NO_CONTENT).build(); } catch (PathNotFoundException exc) { if (nullResourceLocks.isLocked(session, path)) { nullResourceLocks.checkLock(session, path, tokens); nullResourceLocks.removeLock(session, path); return Response.status(HTTPStatus.NO_CONTENT).build(); } return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build(); } } catch (LockException exc) { return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build(); } catch (Exception exc) { log.error(exc.getMessage(), exc); return Response.serverError().entity(exc.getMessage()).build(); } }
[ "public", "Response", "unLock", "(", "Session", "session", ",", "String", "path", ",", "List", "<", "String", ">", "tokens", ")", "{", "try", "{", "try", "{", "Node", "node", "=", "(", "Node", ")", "session", ".", "getItem", "(", "path", ")", ";", ...
Webdav Unlock method implementation. @param session current seesion @param path resource path @param tokens tokens @return the instance of javax.ws.rs.core.Response
[ "Webdav", "Unlock", "method", "implementation", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/UnLockCommand.java#L72-L111
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/Channel.java
Channel.unregisterChaincodeEventListener
public boolean unregisterChaincodeEventListener(String handle) throws InvalidArgumentException { boolean ret; if (shutdown) { throw new InvalidArgumentException(format("Channel %s has been shutdown.", name)); } checkHandle(CHAINCODE_EVENTS_TAG, handle); synchronized (chainCodeListeners) { ret = null != chainCodeListeners.remove(handle); } synchronized (this) { if (null != blh && chainCodeListeners.isEmpty()) { unregisterBlockListener(blh); blh = null; } } return ret; }
java
public boolean unregisterChaincodeEventListener(String handle) throws InvalidArgumentException { boolean ret; if (shutdown) { throw new InvalidArgumentException(format("Channel %s has been shutdown.", name)); } checkHandle(CHAINCODE_EVENTS_TAG, handle); synchronized (chainCodeListeners) { ret = null != chainCodeListeners.remove(handle); } synchronized (this) { if (null != blh && chainCodeListeners.isEmpty()) { unregisterBlockListener(blh); blh = null; } } return ret; }
[ "public", "boolean", "unregisterChaincodeEventListener", "(", "String", "handle", ")", "throws", "InvalidArgumentException", "{", "boolean", "ret", ";", "if", "(", "shutdown", ")", "{", "throw", "new", "InvalidArgumentException", "(", "format", "(", "\"Channel %s has ...
Unregister an existing chaincode event listener. @param handle Chaincode event listener handle to be unregistered. @return True if the chaincode handler was found and removed. @throws InvalidArgumentException
[ "Unregister", "an", "existing", "chaincode", "event", "listener", "." ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L5933-L5957
DaGeRe/KoPeMe
kopeme-core/src/main/java/de/dagere/kopeme/kieker/KiekerTraceEntry.java
KiekerTraceEntry.getCellProcessors
public static CellProcessor[] getCellProcessors(){ return new CellProcessor[] { new ParseInt(){ @Override public Object execute(Object value, CsvContext context) { String content = value.toString(); String[] split = content.split("\\$"); return super.execute(split[1], context); } }, new ParseLong(), null, null, new ParseLong(), new ParseLong(), new ParseLong(), null, new ParseInt(), new ParseInt() }; }
java
public static CellProcessor[] getCellProcessors(){ return new CellProcessor[] { new ParseInt(){ @Override public Object execute(Object value, CsvContext context) { String content = value.toString(); String[] split = content.split("\\$"); return super.execute(split[1], context); } }, new ParseLong(), null, null, new ParseLong(), new ParseLong(), new ParseLong(), null, new ParseInt(), new ParseInt() }; }
[ "public", "static", "CellProcessor", "[", "]", "getCellProcessors", "(", ")", "{", "return", "new", "CellProcessor", "[", "]", "{", "new", "ParseInt", "(", ")", "{", "@", "Override", "public", "Object", "execute", "(", "Object", "value", ",", "CsvContext", ...
Provide this array to parse the columns of the csv into the right type using the Super CSV framework. @return
[ "Provide", "this", "array", "to", "parse", "the", "columns", "of", "the", "csv", "into", "the", "right", "type", "using", "the", "Super", "CSV", "framework", "." ]
train
https://github.com/DaGeRe/KoPeMe/blob/a4939113cba73cb20a2c7d6dc8d34d0139a3e340/kopeme-core/src/main/java/de/dagere/kopeme/kieker/KiekerTraceEntry.java#L45-L65
GerdHolz/TOVAL
src/de/invation/code/toval/misc/ListUtils.java
ListUtils.insertHeader
public static <T> void insertHeader(List<T> list, T headerValue, int headerSize) { for (int i = 0; i < headerSize; i++) list.add(0, headerValue); }
java
public static <T> void insertHeader(List<T> list, T headerValue, int headerSize) { for (int i = 0; i < headerSize; i++) list.add(0, headerValue); }
[ "public", "static", "<", "T", ">", "void", "insertHeader", "(", "List", "<", "T", ">", "list", ",", "T", "headerValue", ",", "int", "headerSize", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "headerSize", ";", "i", "++", ")", "list"...
Inserts a header @param <T> @param list @param headerValue @param headerSize
[ "Inserts", "a", "header" ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/ListUtils.java#L44-L47
kiegroup/droolsjbpm-integration
kie-server-parent/kie-server-common/src/main/java/org/kie/server/common/rest/KieServerHttpRequest.java
KieServerHttpRequest.appendQueryParameters
static String appendQueryParameters( final CharSequence url, final Object... params ) { final String baseUrl = url.toString(); if( params == null || params.length == 0 ) { return baseUrl; } if( params.length % 2 != 0 ) { throw new IllegalArgumentException("Must specify an even number of parameter names/values"); } final StringBuilder result = new StringBuilder(baseUrl); addPathSeparator(baseUrl, result); addParamPrefix(baseUrl, result); Object value; result.append(params[0]); result.append('='); value = params[1]; if( value != null ) result.append(value); for( int i = 2; i < params.length; i += 2 ) { result.append('&'); result.append(params[i]); result.append('='); value = params[i + 1]; if( value != null ) { result.append(value); } } return result.toString(); }
java
static String appendQueryParameters( final CharSequence url, final Object... params ) { final String baseUrl = url.toString(); if( params == null || params.length == 0 ) { return baseUrl; } if( params.length % 2 != 0 ) { throw new IllegalArgumentException("Must specify an even number of parameter names/values"); } final StringBuilder result = new StringBuilder(baseUrl); addPathSeparator(baseUrl, result); addParamPrefix(baseUrl, result); Object value; result.append(params[0]); result.append('='); value = params[1]; if( value != null ) result.append(value); for( int i = 2; i < params.length; i += 2 ) { result.append('&'); result.append(params[i]); result.append('='); value = params[i + 1]; if( value != null ) { result.append(value); } } return result.toString(); }
[ "static", "String", "appendQueryParameters", "(", "final", "CharSequence", "url", ",", "final", "Object", "...", "params", ")", "{", "final", "String", "baseUrl", "=", "url", ".", "toString", "(", ")", ";", "if", "(", "params", "==", "null", "||", "params"...
Append given name/value pairs as query parameters to the base URL <p> The params argument is interpreted as a sequence of name/value pairs so the given number of params must be divisible by 2. @param url @param params name/value pairs @return URL with appended query params
[ "Append", "given", "name", "/", "value", "pairs", "as", "query", "parameters", "to", "the", "base", "URL", "<p", ">", "The", "params", "argument", "is", "interpreted", "as", "a", "sequence", "of", "name", "/", "value", "pairs", "so", "the", "given", "num...
train
https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-common/src/main/java/org/kie/server/common/rest/KieServerHttpRequest.java#L548-L581
protostuff/protostuff
protostuff-api/src/main/java/io/protostuff/UnsignedNumberUtil.java
UnsignedNumberUtil.remainder
private static long remainder(long dividend, long divisor) { if (divisor < 0) { // i.e., divisor >= 2^63: if (compareUnsigned(dividend, divisor) < 0) { return dividend; // dividend < divisor } else { return dividend - divisor; // dividend >= divisor } } // Optimization - use signed modulus if dividend < 2^63 if (dividend >= 0) { return dividend % divisor; } /* * Otherwise, approximate the quotient, check, and correct if necessary. Our approximation is guaranteed to be * either exact or one less than the correct value. This follows from fact that floor(floor(x)/i) == floor(x/i) * for any real x and integer i != 0. The proof is not quite trivial. */ long quotient = ((dividend >>> 1) / divisor) << 1; long rem = dividend - quotient * divisor; return rem - (compareUnsigned(rem, divisor) >= 0 ? divisor : 0); }
java
private static long remainder(long dividend, long divisor) { if (divisor < 0) { // i.e., divisor >= 2^63: if (compareUnsigned(dividend, divisor) < 0) { return dividend; // dividend < divisor } else { return dividend - divisor; // dividend >= divisor } } // Optimization - use signed modulus if dividend < 2^63 if (dividend >= 0) { return dividend % divisor; } /* * Otherwise, approximate the quotient, check, and correct if necessary. Our approximation is guaranteed to be * either exact or one less than the correct value. This follows from fact that floor(floor(x)/i) == floor(x/i) * for any real x and integer i != 0. The proof is not quite trivial. */ long quotient = ((dividend >>> 1) / divisor) << 1; long rem = dividend - quotient * divisor; return rem - (compareUnsigned(rem, divisor) >= 0 ? divisor : 0); }
[ "private", "static", "long", "remainder", "(", "long", "dividend", ",", "long", "divisor", ")", "{", "if", "(", "divisor", "<", "0", ")", "{", "// i.e., divisor >= 2^63:", "if", "(", "compareUnsigned", "(", "dividend", ",", "divisor", ")", "<", "0", ")", ...
Returns dividend % divisor, where the dividend and divisor are treated as unsigned 64-bit quantities. @param dividend the dividend (numerator) @param divisor the divisor (denominator) @throws ArithmeticException if divisor is 0 @since 11.0
[ "Returns", "dividend", "%", "divisor", "where", "the", "dividend", "and", "divisor", "are", "treated", "as", "unsigned", "64", "-", "bit", "quantities", "." ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-api/src/main/java/io/protostuff/UnsignedNumberUtil.java#L227-L255
LevelFourAB/commons
commons-serialization/src/main/java/se/l4/commons/serialization/internal/reflection/FactoryDefinition.java
FactoryDefinition.getScore
public int getScore(Map<String, Object> data) { if(! hasSerializedFields) { return 0; } int score = 0; for(Argument arg : arguments) { if(arg instanceof FactoryDefinition.SerializedArgument) { if(data.containsKey(((SerializedArgument) arg).name)) { score++; } } } return score; }
java
public int getScore(Map<String, Object> data) { if(! hasSerializedFields) { return 0; } int score = 0; for(Argument arg : arguments) { if(arg instanceof FactoryDefinition.SerializedArgument) { if(data.containsKey(((SerializedArgument) arg).name)) { score++; } } } return score; }
[ "public", "int", "getScore", "(", "Map", "<", "String", ",", "Object", ">", "data", ")", "{", "if", "(", "!", "hasSerializedFields", ")", "{", "return", "0", ";", "}", "int", "score", "=", "0", ";", "for", "(", "Argument", "arg", ":", "arguments", ...
Get a score for this factory based on the given data. The higher the score the more arguments were found. @param data @return
[ "Get", "a", "score", "for", "this", "factory", "based", "on", "the", "given", "data", ".", "The", "higher", "the", "score", "the", "more", "arguments", "were", "found", "." ]
train
https://github.com/LevelFourAB/commons/blob/aa121b3a5504b43d0c10450a1b984694fcd2b8ee/commons-serialization/src/main/java/se/l4/commons/serialization/internal/reflection/FactoryDefinition.java#L287-L308
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/util/PropertyValueNavigator.java
PropertyValueNavigator.get
public static Object get(final Object obj, final String property) { return new PropertyValueNavigator().getProperty(obj, property); }
java
public static Object get(final Object obj, final String property) { return new PropertyValueNavigator().getProperty(obj, property); }
[ "public", "static", "Object", "get", "(", "final", "Object", "obj", ",", "final", "String", "property", ")", "{", "return", "new", "PropertyValueNavigator", "(", ")", ".", "getProperty", "(", "obj", ",", "property", ")", ";", "}" ]
プロパティの値を取得する。 <p>オプションはデフォルト値で処理する。</p> @param obj 取得元となるオブジェクト。 @param property プロパティ名。 @return @throws IllegalArgumentException peropety is null or empty. @throws PropertyAccessException 存在しないプロパティを指定した場合など。 @throws NullPointerException アクセスしようとしたプロパティがnullの場合。 @throws IndexOutOfBoundsException リスト、配列にアクセスする際に存在しないインデックスにアクセスした場合。 @throws IllegalStateException マップにアクセスする際に存在しないキーにアクセスした場合。
[ "プロパティの値を取得する。", "<p", ">", "オプションはデフォルト値で処理する。<", "/", "p", ">" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/PropertyValueNavigator.java#L104-L106
modelmapper/modelmapper
core/src/main/java/org/modelmapper/internal/PropertyInfoRegistry.java
PropertyInfoRegistry.mutatorFor
static synchronized Mutator mutatorFor(Class<?> type, String name, InheritingConfiguration configuration) { PropertyInfoKey key = new PropertyInfoKey(type, name, configuration); if (!MUTATOR_CACHE.containsKey(key) || !FIELD_CACHE.containsKey(key)) { @SuppressWarnings("unchecked") Class<Object> uncheckedType = (Class<Object>) type; for (Entry<String, Mutator> entry : TypeInfoRegistry.typeInfoFor(uncheckedType, configuration).getMutators().entrySet()) { if (entry.getValue().getMember() instanceof Method) mutatorFor(type, (Method) entry.getValue().getMember(), configuration, entry.getKey()); else if (entry.getValue().getMember() instanceof Field) fieldPropertyFor(type, (Field) entry.getValue().getMember(), configuration, entry.getKey()); } } if (MUTATOR_CACHE.containsKey(key)) return MUTATOR_CACHE.get(key); return FIELD_CACHE.get(key); }
java
static synchronized Mutator mutatorFor(Class<?> type, String name, InheritingConfiguration configuration) { PropertyInfoKey key = new PropertyInfoKey(type, name, configuration); if (!MUTATOR_CACHE.containsKey(key) || !FIELD_CACHE.containsKey(key)) { @SuppressWarnings("unchecked") Class<Object> uncheckedType = (Class<Object>) type; for (Entry<String, Mutator> entry : TypeInfoRegistry.typeInfoFor(uncheckedType, configuration).getMutators().entrySet()) { if (entry.getValue().getMember() instanceof Method) mutatorFor(type, (Method) entry.getValue().getMember(), configuration, entry.getKey()); else if (entry.getValue().getMember() instanceof Field) fieldPropertyFor(type, (Field) entry.getValue().getMember(), configuration, entry.getKey()); } } if (MUTATOR_CACHE.containsKey(key)) return MUTATOR_CACHE.get(key); return FIELD_CACHE.get(key); }
[ "static", "synchronized", "Mutator", "mutatorFor", "(", "Class", "<", "?", ">", "type", ",", "String", "name", ",", "InheritingConfiguration", "configuration", ")", "{", "PropertyInfoKey", "key", "=", "new", "PropertyInfoKey", "(", "type", ",", "name", ",", "c...
Returns an mutator for the {@code accessorName}, else {@code null} if none exists. Returns a Mutator instance for the given mutator method. The method must be externally validated to ensure that it accepts one argument and returns void.class.
[ "Returns", "an", "mutator", "for", "the", "{" ]
train
https://github.com/modelmapper/modelmapper/blob/491d165ded9dc9aba7ce8b56984249e1a1363204/core/src/main/java/org/modelmapper/internal/PropertyInfoRegistry.java#L130-L146
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/ReplicationInternal.java
ReplicationInternal.refreshRemoteCheckpointDoc
@InterfaceAudience.Private private void refreshRemoteCheckpointDoc() { Log.i(Log.TAG_SYNC, "%s: Refreshing remote checkpoint to get its _rev...", this); Future future = sendAsyncRequest("GET", "_local/" + remoteCheckpointDocID(), null, new RemoteRequestCompletion() { @Override public void onCompletion(RemoteRequest remoteRequest, Response httpResponse, Object result, Throwable e) { if (db == null) { Log.w(Log.TAG_SYNC, "%s: db == null while refreshing remote checkpoint. aborting", this); return; } if (e != null && Utils.getStatusFromError(e) != Status.NOT_FOUND) { Log.e(Log.TAG_SYNC, "%s: Error refreshing remote checkpoint", e, this); } else { Log.d(Log.TAG_SYNC, "%s: Refreshed remote checkpoint: %s", this, result); remoteCheckpoint = (Map<String, Object>) result; lastSequenceChanged = true; saveLastSequence(); // try saving again } } }); pendingFutures.add(future); }
java
@InterfaceAudience.Private private void refreshRemoteCheckpointDoc() { Log.i(Log.TAG_SYNC, "%s: Refreshing remote checkpoint to get its _rev...", this); Future future = sendAsyncRequest("GET", "_local/" + remoteCheckpointDocID(), null, new RemoteRequestCompletion() { @Override public void onCompletion(RemoteRequest remoteRequest, Response httpResponse, Object result, Throwable e) { if (db == null) { Log.w(Log.TAG_SYNC, "%s: db == null while refreshing remote checkpoint. aborting", this); return; } if (e != null && Utils.getStatusFromError(e) != Status.NOT_FOUND) { Log.e(Log.TAG_SYNC, "%s: Error refreshing remote checkpoint", e, this); } else { Log.d(Log.TAG_SYNC, "%s: Refreshed remote checkpoint: %s", this, result); remoteCheckpoint = (Map<String, Object>) result; lastSequenceChanged = true; saveLastSequence(); // try saving again } } }); pendingFutures.add(future); }
[ "@", "InterfaceAudience", ".", "Private", "private", "void", "refreshRemoteCheckpointDoc", "(", ")", "{", "Log", ".", "i", "(", "Log", ".", "TAG_SYNC", ",", "\"%s: Refreshing remote checkpoint to get its _rev...\"", ",", "this", ")", ";", "Future", "future", "=", ...
Variant of -fetchRemoveCheckpointDoc that's used while replication is running, to reload the checkpoint to get its current revision number, if there was an error saving it.
[ "Variant", "of", "-", "fetchRemoveCheckpointDoc", "that", "s", "used", "while", "replication", "is", "running", "to", "reload", "the", "checkpoint", "to", "get", "its", "current", "revision", "number", "if", "there", "was", "an", "error", "saving", "it", "." ]
train
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/ReplicationInternal.java#L922-L943
ontop/ontop
mapping/core/src/main/java/it/unibz/inf/ontop/spec/mapping/validation/impl/MappingOntologyComplianceValidatorImpl.java
MappingOntologyComplianceValidatorImpl.validate
@Override public void validate(MappingWithProvenance mapping, Ontology ontology) throws MappingOntologyMismatchException { ImmutableMultimap<IRI, Datatype> datatypeMap = computeDataTypeMap(ontology.tbox()); for (Map.Entry<IQ, PPMappingAssertionProvenance> entry : mapping.getProvenanceMap().entrySet()) { validateAssertion(entry.getKey(), entry.getValue(), ontology, datatypeMap); } }
java
@Override public void validate(MappingWithProvenance mapping, Ontology ontology) throws MappingOntologyMismatchException { ImmutableMultimap<IRI, Datatype> datatypeMap = computeDataTypeMap(ontology.tbox()); for (Map.Entry<IQ, PPMappingAssertionProvenance> entry : mapping.getProvenanceMap().entrySet()) { validateAssertion(entry.getKey(), entry.getValue(), ontology, datatypeMap); } }
[ "@", "Override", "public", "void", "validate", "(", "MappingWithProvenance", "mapping", ",", "Ontology", "ontology", ")", "throws", "MappingOntologyMismatchException", "{", "ImmutableMultimap", "<", "IRI", ",", "Datatype", ">", "datatypeMap", "=", "computeDataTypeMap", ...
Requires the annotation, data and object properties to be clearly distinguished (disjoint sets, according to the OWL semantics) Be careful if you are using a T-box bootstrapped from the mapping It is NOT assumed that the declared vocabulary contains information on every RDF predicate used in the mapping.
[ "Requires", "the", "annotation", "data", "and", "object", "properties", "to", "be", "clearly", "distinguished", "(", "disjoint", "sets", "according", "to", "the", "OWL", "semantics", ")" ]
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/mapping/core/src/main/java/it/unibz/inf/ontop/spec/mapping/validation/impl/MappingOntologyComplianceValidatorImpl.java#L67-L76
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/smtp_server.java
smtp_server.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { smtp_server_responses result = (smtp_server_responses) service.get_payload_formatter().string_to_resource(smtp_server_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.smtp_server_response_array); } smtp_server[] result_smtp_server = new smtp_server[result.smtp_server_response_array.length]; for(int i = 0; i < result.smtp_server_response_array.length; i++) { result_smtp_server[i] = result.smtp_server_response_array[i].smtp_server[0]; } return result_smtp_server; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { smtp_server_responses result = (smtp_server_responses) service.get_payload_formatter().string_to_resource(smtp_server_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.smtp_server_response_array); } smtp_server[] result_smtp_server = new smtp_server[result.smtp_server_response_array.length]; for(int i = 0; i < result.smtp_server_response_array.length; i++) { result_smtp_server[i] = result.smtp_server_response_array[i].smtp_server[0]; } return result_smtp_server; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "smtp_server_responses", "result", "=", "(", "smtp_server_responses", ")", "service", ".", "get_payload_format...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/smtp_server.java#L431-L448
apereo/cas
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/AbstractSamlProfileHandlerController.java
AbstractSamlProfileHandlerController.buildRedirectUrlByRequestedAuthnContext
protected String buildRedirectUrlByRequestedAuthnContext(final String initialUrl, final AuthnRequest authnRequest, final HttpServletRequest request) { val authenticationContextClassMappings = samlProfileHandlerConfigurationContext.getCasProperties() .getAuthn().getSamlIdp().getAuthenticationContextClassMappings(); if (authnRequest.getRequestedAuthnContext() == null || authenticationContextClassMappings == null || authenticationContextClassMappings.isEmpty()) { return initialUrl; } val mappings = getAuthenticationContextMappings(); val p = authnRequest.getRequestedAuthnContext().getAuthnContextClassRefs() .stream() .filter(ref -> { val clazz = ref.getAuthnContextClassRef(); return mappings.containsKey(clazz); }) .findFirst(); if (p.isPresent()) { val mappedClazz = mappings.get(p.get().getAuthnContextClassRef()); return initialUrl + '&' + samlProfileHandlerConfigurationContext.getCasProperties() .getAuthn().getMfa().getRequestParameter() + '=' + mappedClazz; } return initialUrl; }
java
protected String buildRedirectUrlByRequestedAuthnContext(final String initialUrl, final AuthnRequest authnRequest, final HttpServletRequest request) { val authenticationContextClassMappings = samlProfileHandlerConfigurationContext.getCasProperties() .getAuthn().getSamlIdp().getAuthenticationContextClassMappings(); if (authnRequest.getRequestedAuthnContext() == null || authenticationContextClassMappings == null || authenticationContextClassMappings.isEmpty()) { return initialUrl; } val mappings = getAuthenticationContextMappings(); val p = authnRequest.getRequestedAuthnContext().getAuthnContextClassRefs() .stream() .filter(ref -> { val clazz = ref.getAuthnContextClassRef(); return mappings.containsKey(clazz); }) .findFirst(); if (p.isPresent()) { val mappedClazz = mappings.get(p.get().getAuthnContextClassRef()); return initialUrl + '&' + samlProfileHandlerConfigurationContext.getCasProperties() .getAuthn().getMfa().getRequestParameter() + '=' + mappedClazz; } return initialUrl; }
[ "protected", "String", "buildRedirectUrlByRequestedAuthnContext", "(", "final", "String", "initialUrl", ",", "final", "AuthnRequest", "authnRequest", ",", "final", "HttpServletRequest", "request", ")", "{", "val", "authenticationContextClassMappings", "=", "samlProfileHandler...
Build redirect url by requested authn context. @param initialUrl the initial url @param authnRequest the authn request @param request the request @return the redirect url
[ "Build", "redirect", "url", "by", "requested", "authn", "context", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/AbstractSamlProfileHandlerController.java#L249-L274
hankcs/HanLP
src/main/java/com/hankcs/hanlp/mining/word/TfIdf.java
TfIdf.idf
public static <TERM> Map<TERM, Double> idf(Iterable<Iterable<TERM>> documentVocabularies) { return idf(documentVocabularies, true, true); }
java
public static <TERM> Map<TERM, Double> idf(Iterable<Iterable<TERM>> documentVocabularies) { return idf(documentVocabularies, true, true); }
[ "public", "static", "<", "TERM", ">", "Map", "<", "TERM", ",", "Double", ">", "idf", "(", "Iterable", "<", "Iterable", "<", "TERM", ">", ">", "documentVocabularies", ")", "{", "return", "idf", "(", "documentVocabularies", ",", "true", ",", "true", ")", ...
平滑处理后的一系列文档的倒排词频 @param documentVocabularies 词表 @param <TERM> 词语类型 @return 一个词语->倒排文档的Map
[ "平滑处理后的一系列文档的倒排词频" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word/TfIdf.java#L166-L169
janus-project/guava.janusproject.io
guava/src/com/google/common/collect/MapMakerInternalMap.java
MapMakerInternalMap.getLiveValue
V getLiveValue(ReferenceEntry<K, V> entry) { if (entry.getKey() == null) { return null; } V value = entry.getValueReference().get(); if (value == null) { return null; } if (expires() && isExpired(entry)) { return null; } return value; }
java
V getLiveValue(ReferenceEntry<K, V> entry) { if (entry.getKey() == null) { return null; } V value = entry.getValueReference().get(); if (value == null) { return null; } if (expires() && isExpired(entry)) { return null; } return value; }
[ "V", "getLiveValue", "(", "ReferenceEntry", "<", "K", ",", "V", ">", "entry", ")", "{", "if", "(", "entry", ".", "getKey", "(", ")", "==", "null", ")", "{", "return", "null", ";", "}", "V", "value", "=", "entry", ".", "getValueReference", "(", ")",...
Gets the value from an entry. Returns {@code null} if the entry is invalid, partially-collected, computing, or expired. Unlike {@link Segment#getLiveValue} this method does not attempt to clean up stale entries.
[ "Gets", "the", "value", "from", "an", "entry", ".", "Returns", "{" ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/collect/MapMakerInternalMap.java#L1895-L1908
resilience4j/resilience4j
resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/RateLimiterExports.java
RateLimiterExports.ofRateLimiter
public static RateLimiterExports ofRateLimiter(String prefix, RateLimiter rateLimiter) { return new RateLimiterExports(prefix, Array.of(rateLimiter)); }
java
public static RateLimiterExports ofRateLimiter(String prefix, RateLimiter rateLimiter) { return new RateLimiterExports(prefix, Array.of(rateLimiter)); }
[ "public", "static", "RateLimiterExports", "ofRateLimiter", "(", "String", "prefix", ",", "RateLimiter", "rateLimiter", ")", "{", "return", "new", "RateLimiterExports", "(", "prefix", ",", "Array", ".", "of", "(", "rateLimiter", ")", ")", ";", "}" ]
Creates a new instance of {@link RateLimiterExports} with default metrics names prefix and a rate limiter as a source. @param prefix the prefix of metrics names @param rateLimiter the rate limiter
[ "Creates", "a", "new", "instance", "of", "{", "@link", "RateLimiterExports", "}", "with", "default", "metrics", "names", "prefix", "and", "a", "rate", "limiter", "as", "a", "source", "." ]
train
https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/RateLimiterExports.java#L128-L130
apache/spark
sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java
VectorizedParquetRecordReader.initialize
@Override public void initialize(String path, List<String> columns) throws IOException, UnsupportedOperationException { super.initialize(path, columns); initializeInternal(); }
java
@Override public void initialize(String path, List<String> columns) throws IOException, UnsupportedOperationException { super.initialize(path, columns); initializeInternal(); }
[ "@", "Override", "public", "void", "initialize", "(", "String", "path", ",", "List", "<", "String", ">", "columns", ")", "throws", "IOException", ",", "UnsupportedOperationException", "{", "super", ".", "initialize", "(", "path", ",", "columns", ")", ";", "i...
Utility API that will read all the data in path. This circumvents the need to create Hadoop objects to use this class. `columns` can contain the list of columns to project.
[ "Utility", "API", "that", "will", "read", "all", "the", "data", "in", "path", ".", "This", "circumvents", "the", "need", "to", "create", "Hadoop", "objects", "to", "use", "this", "class", ".", "columns", "can", "contain", "the", "list", "of", "columns", ...
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java#L139-L144
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_OffSetCurve.java
ST_OffSetCurve.lineStringOffSetCurve
public static void lineStringOffSetCurve(ArrayList<LineString> list, LineString lineString, double offset, BufferParameters bufferParameters) { list.add(lineString.getFactory().createLineString(new OffsetCurveBuilder(lineString.getPrecisionModel(), bufferParameters).getOffsetCurve(lineString.getCoordinates(), offset))); }
java
public static void lineStringOffSetCurve(ArrayList<LineString> list, LineString lineString, double offset, BufferParameters bufferParameters) { list.add(lineString.getFactory().createLineString(new OffsetCurveBuilder(lineString.getPrecisionModel(), bufferParameters).getOffsetCurve(lineString.getCoordinates(), offset))); }
[ "public", "static", "void", "lineStringOffSetCurve", "(", "ArrayList", "<", "LineString", ">", "list", ",", "LineString", "lineString", ",", "double", "offset", ",", "BufferParameters", "bufferParameters", ")", "{", "list", ".", "add", "(", "lineString", ".", "g...
Compute the offset curve for a linestring @param list @param lineString @param offset @param bufferParameters
[ "Compute", "the", "offset", "curve", "for", "a", "linestring" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_OffSetCurve.java#L149-L151
tiesebarrell/process-assertions
process-assertions-api/src/main/java/org/toxos/processassertions/api/internal/AssertUtils.java
AssertUtils.isEqualCollection
public static boolean isEqualCollection(Collection<String> list1, Collection<String> list2) { Validate.notNull(list1); Validate.notNull(list2); boolean result = true; if (list1.size() == list2.size()) { for (final String currentString : list1) { if (!list2.contains(currentString)) { result = false; break; } } } else { result = false; } return result; }
java
public static boolean isEqualCollection(Collection<String> list1, Collection<String> list2) { Validate.notNull(list1); Validate.notNull(list2); boolean result = true; if (list1.size() == list2.size()) { for (final String currentString : list1) { if (!list2.contains(currentString)) { result = false; break; } } } else { result = false; } return result; }
[ "public", "static", "boolean", "isEqualCollection", "(", "Collection", "<", "String", ">", "list1", ",", "Collection", "<", "String", ">", "list2", ")", "{", "Validate", ".", "notNull", "(", "list1", ")", ";", "Validate", ".", "notNull", "(", "list2", ")",...
Determines whether the provided collections of strings are equal. Equality is considered: <ul> <li>Both lists are empty, or</li> <li>Both lists are of the same size and contain the same elements.</li> </ul> @param list1 the first list, may not be {@code null} @param list2 the second list, may not be {@code null} @return true if the lists are equal, false otherwise
[ "Determines", "whether", "the", "provided", "collections", "of", "strings", "are", "equal", ".", "Equality", "is", "considered", ":" ]
train
https://github.com/tiesebarrell/process-assertions/blob/932a8443982e356cdf5a230165a35c725d9306ab/process-assertions-api/src/main/java/org/toxos/processassertions/api/internal/AssertUtils.java#L126-L144
yanzhenjie/AndServer
api/src/main/java/com/yanzhenjie/andserver/http/multipart/StandardMultipartResolver.java
StandardMultipartResolver.parseFileItems
protected MultipartParsingResult parseFileItems(List<FileItem> fileItems, String encoding) { MultiValueMap<String, MultipartFile> multipartFiles = new LinkedMultiValueMap<>(); MultiValueMap<String, String> multipartParameters = new LinkedMultiValueMap<>(); Map<String, String> multipartContentTypes = new HashMap<>(); // Extract multipart files and multipart parameters. for (FileItem fileItem : fileItems) { if (fileItem.isFormField()) { String value; String partEncoding = determineEncoding(fileItem.getContentType(), encoding); if (partEncoding != null) { try { value = fileItem.getString(partEncoding); } catch (UnsupportedEncodingException ex) { value = fileItem.getString(); } } else { value = fileItem.getString(); } List<String> curParam = multipartParameters.get(fileItem.getFieldName()); if (curParam == null) { // Simple form field. curParam = new LinkedList<>(); curParam.add(value); multipartParameters.put(fileItem.getFieldName(), curParam); } else { // Array of simple form fields. curParam.add(value); } multipartContentTypes.put(fileItem.getFieldName(), fileItem.getContentType()); } else { StandardMultipartFile file = createMultipartFile(fileItem); multipartFiles.add(file.getName(), file); } } return new MultipartParsingResult(multipartFiles, multipartParameters, multipartContentTypes); }
java
protected MultipartParsingResult parseFileItems(List<FileItem> fileItems, String encoding) { MultiValueMap<String, MultipartFile> multipartFiles = new LinkedMultiValueMap<>(); MultiValueMap<String, String> multipartParameters = new LinkedMultiValueMap<>(); Map<String, String> multipartContentTypes = new HashMap<>(); // Extract multipart files and multipart parameters. for (FileItem fileItem : fileItems) { if (fileItem.isFormField()) { String value; String partEncoding = determineEncoding(fileItem.getContentType(), encoding); if (partEncoding != null) { try { value = fileItem.getString(partEncoding); } catch (UnsupportedEncodingException ex) { value = fileItem.getString(); } } else { value = fileItem.getString(); } List<String> curParam = multipartParameters.get(fileItem.getFieldName()); if (curParam == null) { // Simple form field. curParam = new LinkedList<>(); curParam.add(value); multipartParameters.put(fileItem.getFieldName(), curParam); } else { // Array of simple form fields. curParam.add(value); } multipartContentTypes.put(fileItem.getFieldName(), fileItem.getContentType()); } else { StandardMultipartFile file = createMultipartFile(fileItem); multipartFiles.add(file.getName(), file); } } return new MultipartParsingResult(multipartFiles, multipartParameters, multipartContentTypes); }
[ "protected", "MultipartParsingResult", "parseFileItems", "(", "List", "<", "FileItem", ">", "fileItems", ",", "String", "encoding", ")", "{", "MultiValueMap", "<", "String", ",", "MultipartFile", ">", "multipartFiles", "=", "new", "LinkedMultiValueMap", "<>", "(", ...
Parse the given List of Commons FileItems into a MultipartParsingResult, containing MultipartFile instances and a Map of multipart parameter. @param fileItems the Commons FileItems to parse. @param encoding the encoding to use for form fields. @return the MultipartParsingResult. @see StandardMultipartFile#StandardMultipartFile(FileItem)
[ "Parse", "the", "given", "List", "of", "Commons", "FileItems", "into", "a", "MultipartParsingResult", "containing", "MultipartFile", "instances", "and", "a", "Map", "of", "multipart", "parameter", "." ]
train
https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/http/multipart/StandardMultipartResolver.java#L219-L255
hawkular/hawkular-agent
hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java
SecurityDomainJBossASClient.createNewSecurityDomain
public void createNewSecurityDomain(String securityDomainName, LoginModuleRequest... loginModules) throws Exception { //do not close the controller client here, we're using our own.. CoreJBossASClient coreClient = new CoreJBossASClient(getModelControllerClient()); String serverVersion = coreClient.getAppServerVersion(); if (serverVersion.startsWith("7.2")) { createNewSecurityDomain72(securityDomainName, loginModules); } else { createNewSecurityDomain71(securityDomainName, loginModules); } }
java
public void createNewSecurityDomain(String securityDomainName, LoginModuleRequest... loginModules) throws Exception { //do not close the controller client here, we're using our own.. CoreJBossASClient coreClient = new CoreJBossASClient(getModelControllerClient()); String serverVersion = coreClient.getAppServerVersion(); if (serverVersion.startsWith("7.2")) { createNewSecurityDomain72(securityDomainName, loginModules); } else { createNewSecurityDomain71(securityDomainName, loginModules); } }
[ "public", "void", "createNewSecurityDomain", "(", "String", "securityDomainName", ",", "LoginModuleRequest", "...", "loginModules", ")", "throws", "Exception", "{", "//do not close the controller client here, we're using our own..", "CoreJBossASClient", "coreClient", "=", "new", ...
Creates a new security domain including one or more login modules. The security domain will be replaced if it exists. @param securityDomainName the name of the new security domain @param loginModules an array of login modules to place in the security domain. They are ordered top-down in the same index order of the array. @throws Exception if failed to create security domain
[ "Creates", "a", "new", "security", "domain", "including", "one", "or", "more", "login", "modules", ".", "The", "security", "domain", "will", "be", "replaced", "if", "it", "exists", "." ]
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java#L274-L286
fuinorg/event-store-commons
spi/src/main/java/org/fuin/esc/spi/EscSpiUtils.java
EscSpiUtils.nodeToString
public static String nodeToString(final Node node) { try { final Transformer t = TransformerFactory.newInstance().newTransformer(); t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); final StringWriter sw = new StringWriter(); t.transform(new DOMSource(node), new StreamResult(sw)); return sw.toString(); } catch (final TransformerException ex) { throw new RuntimeException("Failed to render node", ex); } }
java
public static String nodeToString(final Node node) { try { final Transformer t = TransformerFactory.newInstance().newTransformer(); t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); final StringWriter sw = new StringWriter(); t.transform(new DOMSource(node), new StreamResult(sw)); return sw.toString(); } catch (final TransformerException ex) { throw new RuntimeException("Failed to render node", ex); } }
[ "public", "static", "String", "nodeToString", "(", "final", "Node", "node", ")", "{", "try", "{", "final", "Transformer", "t", "=", "TransformerFactory", ".", "newInstance", "(", ")", ".", "newTransformer", "(", ")", ";", "t", ".", "setOutputProperty", "(", ...
Render a node as string. @param node Node to render. @return XML.
[ "Render", "a", "node", "as", "string", "." ]
train
https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/spi/src/main/java/org/fuin/esc/spi/EscSpiUtils.java#L243-L253
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.consumption_usage_forecast_GET
public ArrayList<net.minidev.ovh.api.me.consumption.OvhTransaction> consumption_usage_forecast_GET() throws IOException { String qPath = "/me/consumption/usage/forecast"; StringBuilder sb = path(qPath); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t7); }
java
public ArrayList<net.minidev.ovh.api.me.consumption.OvhTransaction> consumption_usage_forecast_GET() throws IOException { String qPath = "/me/consumption/usage/forecast"; StringBuilder sb = path(qPath); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t7); }
[ "public", "ArrayList", "<", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "me", ".", "consumption", ".", "OvhTransaction", ">", "consumption_usage_forecast_GET", "(", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/consumption/usage/forecas...
Get forecasted consumptions for all services REST: GET /me/consumption/usage/forecast
[ "Get", "forecasted", "consumptions", "for", "all", "services" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2143-L2148
knowm/XChart
xchart/src/main/java/org/knowm/xchart/OHLCChart.java
OHLCChart.addSeries
private OHLCSeries addSeries( String seriesName, double[] xData, double[] openData, double[] highData, double[] lowData, double[] closeData, DataType dataType) { if (seriesMap.keySet().contains(seriesName)) { throw new IllegalArgumentException( "Series name >" + seriesName + "< has already been used. Use unique names for each series!!!"); } // Sanity checks sanityCheck(seriesName, openData, highData, lowData, closeData); final double[] xDataToUse; if (xData != null) { // Sanity check checkDataLengths(seriesName, "X-Axis", "Close", xData, closeData); xDataToUse = xData; } else { // generate xData xDataToUse = Utils.getGeneratedDataAsArray(closeData.length); } OHLCSeries series = new OHLCSeries(seriesName, xDataToUse, openData, highData, lowData, closeData, dataType); ; seriesMap.put(seriesName, series); return series; }
java
private OHLCSeries addSeries( String seriesName, double[] xData, double[] openData, double[] highData, double[] lowData, double[] closeData, DataType dataType) { if (seriesMap.keySet().contains(seriesName)) { throw new IllegalArgumentException( "Series name >" + seriesName + "< has already been used. Use unique names for each series!!!"); } // Sanity checks sanityCheck(seriesName, openData, highData, lowData, closeData); final double[] xDataToUse; if (xData != null) { // Sanity check checkDataLengths(seriesName, "X-Axis", "Close", xData, closeData); xDataToUse = xData; } else { // generate xData xDataToUse = Utils.getGeneratedDataAsArray(closeData.length); } OHLCSeries series = new OHLCSeries(seriesName, xDataToUse, openData, highData, lowData, closeData, dataType); ; seriesMap.put(seriesName, series); return series; }
[ "private", "OHLCSeries", "addSeries", "(", "String", "seriesName", ",", "double", "[", "]", "xData", ",", "double", "[", "]", "openData", ",", "double", "[", "]", "highData", ",", "double", "[", "]", "lowData", ",", "double", "[", "]", "closeData", ",", ...
Add a series for a OHLC type chart @param seriesName @param xData the x-axis data @param openData the open data @param highData the high data @param lowData the low data @param closeData the close data @return A Series object that you can set properties on
[ "Add", "a", "series", "for", "a", "OHLC", "type", "chart" ]
train
https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/OHLCChart.java#L291-L326
checkstyle-addons/checkstyle-addons
buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/BuildUtil.java
BuildUtil.getTask
@Nonnull public Task getTask(@Nonnull final TaskNames pTaskName, @Nonnull final DependencyConfig pDepConfig) { return project.getTasks().getByName(pTaskName.getName(pDepConfig)); }
java
@Nonnull public Task getTask(@Nonnull final TaskNames pTaskName, @Nonnull final DependencyConfig pDepConfig) { return project.getTasks().getByName(pTaskName.getName(pDepConfig)); }
[ "@", "Nonnull", "public", "Task", "getTask", "(", "@", "Nonnull", "final", "TaskNames", "pTaskName", ",", "@", "Nonnull", "final", "DependencyConfig", "pDepConfig", ")", "{", "return", "project", ".", "getTasks", "(", ")", ".", "getByName", "(", "pTaskName", ...
Convenience method for getting a specific task directly. @param pTaskName the task to get @param pDepConfig the dependency configuration for which the task is intended @return a task object
[ "Convenience", "method", "for", "getting", "a", "specific", "task", "directly", "." ]
train
https://github.com/checkstyle-addons/checkstyle-addons/blob/fae1b4d341639c8e32c3e59ec5abdc0ffc11b865/buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/BuildUtil.java#L144-L148
greenjoe/sergeants
src/main/java/pl/joegreen/sergeants/framework/queue/QueueConfiguration.java
QueueConfiguration.customGame
public static QueueConfiguration customGame(boolean force, String gameId, int team) { return new CustomGameQueueConfiguration(force, gameId, team); }
java
public static QueueConfiguration customGame(boolean force, String gameId, int team) { return new CustomGameQueueConfiguration(force, gameId, team); }
[ "public", "static", "QueueConfiguration", "customGame", "(", "boolean", "force", ",", "String", "gameId", ",", "int", "team", ")", "{", "return", "new", "CustomGameQueueConfiguration", "(", "force", ",", "gameId", ",", "team", ")", ";", "}" ]
Joins custom game. @param force indicates if player should vote for "force start" @param gameId identifier of the game to join (displayed in browser URL when starting custom game) @param team number of team that bot will join in the custom game
[ "Joins", "custom", "game", "." ]
train
https://github.com/greenjoe/sergeants/blob/db624bcea8597843210f138b82bc4a26b3ec92ca/src/main/java/pl/joegreen/sergeants/framework/queue/QueueConfiguration.java#L52-L54
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsQueueConnectionImpl.java
JmsQueueConnectionImpl.instantiateSession
JmsSessionImpl instantiateSession(boolean transacted, int acknowledgeMode, SICoreConnection coreConnection, JmsJcaSession jcaSession) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateSession", new Object[]{transacted, acknowledgeMode, coreConnection, jcaSession}); JmsQueueSessionImpl jmsQueueSession = new JmsQueueSessionImpl(transacted, acknowledgeMode, coreConnection, this, jcaSession); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateSession", jmsQueueSession); return jmsQueueSession; }
java
JmsSessionImpl instantiateSession(boolean transacted, int acknowledgeMode, SICoreConnection coreConnection, JmsJcaSession jcaSession) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateSession", new Object[]{transacted, acknowledgeMode, coreConnection, jcaSession}); JmsQueueSessionImpl jmsQueueSession = new JmsQueueSessionImpl(transacted, acknowledgeMode, coreConnection, this, jcaSession); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateSession", jmsQueueSession); return jmsQueueSession; }
[ "JmsSessionImpl", "instantiateSession", "(", "boolean", "transacted", ",", "int", "acknowledgeMode", ",", "SICoreConnection", "coreConnection", ",", "JmsJcaSession", "jcaSession", ")", "throws", "JMSException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled",...
This method overrides a superclass method, so that the superclass's createSession() method can be inherited, but still return an object of this class's type.
[ "This", "method", "overrides", "a", "superclass", "method", "so", "that", "the", "superclass", "s", "createSession", "()", "method", "can", "be", "inherited", "but", "still", "return", "an", "object", "of", "this", "class", "s", "type", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsQueueConnectionImpl.java#L105-L110
ReactiveX/RxNetty
rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/server/HttpServer.java
HttpServer.newServer
public static HttpServer<ByteBuf, ByteBuf> newServer(SocketAddress socketAddress, EventLoopGroup serverGroup, EventLoopGroup clientGroup, Class<? extends ServerChannel> channelClass) { return _newServer(TcpServer.newServer(socketAddress, serverGroup, clientGroup, channelClass)); }
java
public static HttpServer<ByteBuf, ByteBuf> newServer(SocketAddress socketAddress, EventLoopGroup serverGroup, EventLoopGroup clientGroup, Class<? extends ServerChannel> channelClass) { return _newServer(TcpServer.newServer(socketAddress, serverGroup, clientGroup, channelClass)); }
[ "public", "static", "HttpServer", "<", "ByteBuf", ",", "ByteBuf", ">", "newServer", "(", "SocketAddress", "socketAddress", ",", "EventLoopGroup", "serverGroup", ",", "EventLoopGroup", "clientGroup", ",", "Class", "<", "?", "extends", "ServerChannel", ">", "channelCl...
Creates a new server using the passed port. @param socketAddress Socket address for the server. @param serverGroup Eventloop group to be used for server sockets. @param clientGroup Eventloop group to be used for client sockets. @param channelClass The class to be used for server channel. @return A new {@link HttpServer}
[ "Creates", "a", "new", "server", "using", "the", "passed", "port", "." ]
train
https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/server/HttpServer.java#L436-L440