repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/metadata/BaseMetadataHandler.java
BaseMetadataHandler.processProcedureName
private String processProcedureName(String dbProductName, String procedureName) { """ Processes Procedure/Function name so it would be compatible with database Also is responsible for cleaning procedure name returned by DatabaseMetadata @param dbProductName short database name @param procedureName Stored Procedure/Function @return processed Procedure/Function name """ String result = null; if (procedureName != null) { if ("Microsoft SQL Server".equals(dbProductName) == true || "Sybase".equals(dbProductName) == true) { if ("Microsoft SQL Server".equals(dbProductName) == true && procedureName.indexOf(";") > 1) { result = procedureName.substring(0, procedureName.indexOf(";")).toUpperCase(); } else if (procedureName.length() > 1 && procedureName.startsWith("@") == true) { result = procedureName.substring(1).toUpperCase(); } else { result = procedureName.toUpperCase(); } } else if ("PostgreSQL".equals(dbProductName) == true) { result = procedureName.toLowerCase(); } else { result = procedureName.toUpperCase(); } } return result; }
java
private String processProcedureName(String dbProductName, String procedureName) { String result = null; if (procedureName != null) { if ("Microsoft SQL Server".equals(dbProductName) == true || "Sybase".equals(dbProductName) == true) { if ("Microsoft SQL Server".equals(dbProductName) == true && procedureName.indexOf(";") > 1) { result = procedureName.substring(0, procedureName.indexOf(";")).toUpperCase(); } else if (procedureName.length() > 1 && procedureName.startsWith("@") == true) { result = procedureName.substring(1).toUpperCase(); } else { result = procedureName.toUpperCase(); } } else if ("PostgreSQL".equals(dbProductName) == true) { result = procedureName.toLowerCase(); } else { result = procedureName.toUpperCase(); } } return result; }
[ "private", "String", "processProcedureName", "(", "String", "dbProductName", ",", "String", "procedureName", ")", "{", "String", "result", "=", "null", ";", "if", "(", "procedureName", "!=", "null", ")", "{", "if", "(", "\"Microsoft SQL Server\"", ".", "equals", "(", "dbProductName", ")", "==", "true", "||", "\"Sybase\"", ".", "equals", "(", "dbProductName", ")", "==", "true", ")", "{", "if", "(", "\"Microsoft SQL Server\"", ".", "equals", "(", "dbProductName", ")", "==", "true", "&&", "procedureName", ".", "indexOf", "(", "\";\"", ")", ">", "1", ")", "{", "result", "=", "procedureName", ".", "substring", "(", "0", ",", "procedureName", ".", "indexOf", "(", "\";\"", ")", ")", ".", "toUpperCase", "(", ")", ";", "}", "else", "if", "(", "procedureName", ".", "length", "(", ")", ">", "1", "&&", "procedureName", ".", "startsWith", "(", "\"@\"", ")", "==", "true", ")", "{", "result", "=", "procedureName", ".", "substring", "(", "1", ")", ".", "toUpperCase", "(", ")", ";", "}", "else", "{", "result", "=", "procedureName", ".", "toUpperCase", "(", ")", ";", "}", "}", "else", "if", "(", "\"PostgreSQL\"", ".", "equals", "(", "dbProductName", ")", "==", "true", ")", "{", "result", "=", "procedureName", ".", "toLowerCase", "(", ")", ";", "}", "else", "{", "result", "=", "procedureName", ".", "toUpperCase", "(", ")", ";", "}", "}", "return", "result", ";", "}" ]
Processes Procedure/Function name so it would be compatible with database Also is responsible for cleaning procedure name returned by DatabaseMetadata @param dbProductName short database name @param procedureName Stored Procedure/Function @return processed Procedure/Function name
[ "Processes", "Procedure", "/", "Function", "name", "so", "it", "would", "be", "compatible", "with", "database", "Also", "is", "responsible", "for", "cleaning", "procedure", "name", "returned", "by", "DatabaseMetadata" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/metadata/BaseMetadataHandler.java#L279-L299
google/closure-templates
java/src/com/google/template/soy/types/SoyTypeRegistry.java
SoyTypeRegistry.getOrCreateMapType
public MapType getOrCreateMapType(SoyType keyType, SoyType valueType) { """ Factory function which creates a map type, given a key and value type. This folds map types with identical key/value types together, so asking for the same key/value type twice will return a pointer to the same type object. @param keyType The key type of the map. @param valueType The value type of the map. @return The map type. """ return mapTypes.intern(MapType.of(keyType, valueType)); }
java
public MapType getOrCreateMapType(SoyType keyType, SoyType valueType) { return mapTypes.intern(MapType.of(keyType, valueType)); }
[ "public", "MapType", "getOrCreateMapType", "(", "SoyType", "keyType", ",", "SoyType", "valueType", ")", "{", "return", "mapTypes", ".", "intern", "(", "MapType", ".", "of", "(", "keyType", ",", "valueType", ")", ")", ";", "}" ]
Factory function which creates a map type, given a key and value type. This folds map types with identical key/value types together, so asking for the same key/value type twice will return a pointer to the same type object. @param keyType The key type of the map. @param valueType The value type of the map. @return The map type.
[ "Factory", "function", "which", "creates", "a", "map", "type", "given", "a", "key", "and", "value", "type", ".", "This", "folds", "map", "types", "with", "identical", "key", "/", "value", "types", "together", "so", "asking", "for", "the", "same", "key", "/", "value", "type", "twice", "will", "return", "a", "pointer", "to", "the", "same", "type", "object", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/SoyTypeRegistry.java#L259-L261
threerings/nenya
tools/src/main/java/com/threerings/media/tile/tools/MapFileTileSetIDBroker.java
MapFileTileSetIDBroker.readMapFile
public static void readMapFile (BufferedReader bin, HashMap<String, Integer> map) throws IOException { """ Reads in a mapping from strings to integers, which should have been written via {@link #writeMapFile}. """ String line; while ((line = bin.readLine()) != null) { int eidx = line.indexOf(SEP_STR); if (eidx == -1) { throw new IOException("Malformed line, no '" + SEP_STR + "': '" + line + "'"); } try { String code = line.substring(eidx+SEP_STR.length()); map.put(line.substring(0, eidx), Integer.valueOf(code)); } catch (NumberFormatException nfe) { String errmsg = "Malformed line, invalid code: '" + line + "'"; throw new IOException(errmsg); } } }
java
public static void readMapFile (BufferedReader bin, HashMap<String, Integer> map) throws IOException { String line; while ((line = bin.readLine()) != null) { int eidx = line.indexOf(SEP_STR); if (eidx == -1) { throw new IOException("Malformed line, no '" + SEP_STR + "': '" + line + "'"); } try { String code = line.substring(eidx+SEP_STR.length()); map.put(line.substring(0, eidx), Integer.valueOf(code)); } catch (NumberFormatException nfe) { String errmsg = "Malformed line, invalid code: '" + line + "'"; throw new IOException(errmsg); } } }
[ "public", "static", "void", "readMapFile", "(", "BufferedReader", "bin", ",", "HashMap", "<", "String", ",", "Integer", ">", "map", ")", "throws", "IOException", "{", "String", "line", ";", "while", "(", "(", "line", "=", "bin", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "int", "eidx", "=", "line", ".", "indexOf", "(", "SEP_STR", ")", ";", "if", "(", "eidx", "==", "-", "1", ")", "{", "throw", "new", "IOException", "(", "\"Malformed line, no '\"", "+", "SEP_STR", "+", "\"': '\"", "+", "line", "+", "\"'\"", ")", ";", "}", "try", "{", "String", "code", "=", "line", ".", "substring", "(", "eidx", "+", "SEP_STR", ".", "length", "(", ")", ")", ";", "map", ".", "put", "(", "line", ".", "substring", "(", "0", ",", "eidx", ")", ",", "Integer", ".", "valueOf", "(", "code", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "nfe", ")", "{", "String", "errmsg", "=", "\"Malformed line, invalid code: '\"", "+", "line", "+", "\"'\"", ";", "throw", "new", "IOException", "(", "errmsg", ")", ";", "}", "}", "}" ]
Reads in a mapping from strings to integers, which should have been written via {@link #writeMapFile}.
[ "Reads", "in", "a", "mapping", "from", "strings", "to", "integers", "which", "should", "have", "been", "written", "via", "{" ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/media/tile/tools/MapFileTileSetIDBroker.java#L138-L156
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateWord
public static <T extends CharSequence> T validateWord(T value, String errorMsg) throws ValidateException { """ 验证是否为字母(包括大写和小写字母) @param <T> 字符串类型 @param value 表单值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常 @since 4.1.8 """ if (false == isWord(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T extends CharSequence> T validateWord(T value, String errorMsg) throws ValidateException { if (false == isWord(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validateWord", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isWord", "(", "value", ")", ")", "{", "throw", "new", "ValidateException", "(", "errorMsg", ")", ";", "}", "return", "value", ";", "}" ]
验证是否为字母(包括大写和小写字母) @param <T> 字符串类型 @param value 表单值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常 @since 4.1.8
[ "验证是否为字母(包括大写和小写字母)" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L572-L577
datasift/datasift-java
src/main/java/com/datasift/client/push/connectors/Prepared.java
Prepared.verifyAndGet
public Map<String, String> verifyAndGet() { """ /* Verifies that all required parameters have been set @return a map of the parameters """ for (String paramName : required) { if (params.get(paramName) == null) { throw new IllegalStateException(format("Param %s is required but has not been supplied", paramName)); } } return params; }
java
public Map<String, String> verifyAndGet() { for (String paramName : required) { if (params.get(paramName) == null) { throw new IllegalStateException(format("Param %s is required but has not been supplied", paramName)); } } return params; }
[ "public", "Map", "<", "String", ",", "String", ">", "verifyAndGet", "(", ")", "{", "for", "(", "String", "paramName", ":", "required", ")", "{", "if", "(", "params", ".", "get", "(", "paramName", ")", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "format", "(", "\"Param %s is required but has not been supplied\"", ",", "paramName", ")", ")", ";", "}", "}", "return", "params", ";", "}" ]
/* Verifies that all required parameters have been set @return a map of the parameters
[ "/", "*", "Verifies", "that", "all", "required", "parameters", "have", "been", "set" ]
train
https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/push/connectors/Prepared.java#L27-L34
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/SplitMergeLineFitLoop.java
SplitMergeLineFitLoop.selectSplitOffset
protected int selectSplitOffset( int indexStart , int length ) { """ Finds the point between indexStart and the end point which is the greater distance from the line (set up prior to calling). Returns the index of the element with a distances greater than tolerance, otherwise -1 @return Selected offset from start of the split. -1 if no split was selected """ int bestOffset = -1; int indexEnd = (indexStart + length) % N; Point2D_I32 startPt = contour.get(indexStart); Point2D_I32 endPt = contour.get(indexEnd); line.p.set(startPt.x,startPt.y); line.slope.set(endPt.x-startPt.x,endPt.y-startPt.y); double bestDistanceSq = splitThresholdSq(contour.get(indexStart), contour.get(indexEnd)); // adjusting using 'minimumSideLengthPixel' to ensure it doesn't create a new line which is too short int minLength = Math.max(1,minimumSideLengthPixel);// 1 is the minimum so that you don't split on the same corner length -= minLength; for( int i = minLength; i <= length; i++ ) { Point2D_I32 b = contour.get((indexStart+i)%N); point2D.set(b.x,b.y); double dist = Distance2D_F64.distanceSq(line, point2D); if( dist >= bestDistanceSq ) { bestDistanceSq = dist; bestOffset = i; } } return bestOffset; }
java
protected int selectSplitOffset( int indexStart , int length ) { int bestOffset = -1; int indexEnd = (indexStart + length) % N; Point2D_I32 startPt = contour.get(indexStart); Point2D_I32 endPt = contour.get(indexEnd); line.p.set(startPt.x,startPt.y); line.slope.set(endPt.x-startPt.x,endPt.y-startPt.y); double bestDistanceSq = splitThresholdSq(contour.get(indexStart), contour.get(indexEnd)); // adjusting using 'minimumSideLengthPixel' to ensure it doesn't create a new line which is too short int minLength = Math.max(1,minimumSideLengthPixel);// 1 is the minimum so that you don't split on the same corner length -= minLength; for( int i = minLength; i <= length; i++ ) { Point2D_I32 b = contour.get((indexStart+i)%N); point2D.set(b.x,b.y); double dist = Distance2D_F64.distanceSq(line, point2D); if( dist >= bestDistanceSq ) { bestDistanceSq = dist; bestOffset = i; } } return bestOffset; }
[ "protected", "int", "selectSplitOffset", "(", "int", "indexStart", ",", "int", "length", ")", "{", "int", "bestOffset", "=", "-", "1", ";", "int", "indexEnd", "=", "(", "indexStart", "+", "length", ")", "%", "N", ";", "Point2D_I32", "startPt", "=", "contour", ".", "get", "(", "indexStart", ")", ";", "Point2D_I32", "endPt", "=", "contour", ".", "get", "(", "indexEnd", ")", ";", "line", ".", "p", ".", "set", "(", "startPt", ".", "x", ",", "startPt", ".", "y", ")", ";", "line", ".", "slope", ".", "set", "(", "endPt", ".", "x", "-", "startPt", ".", "x", ",", "endPt", ".", "y", "-", "startPt", ".", "y", ")", ";", "double", "bestDistanceSq", "=", "splitThresholdSq", "(", "contour", ".", "get", "(", "indexStart", ")", ",", "contour", ".", "get", "(", "indexEnd", ")", ")", ";", "// adjusting using 'minimumSideLengthPixel' to ensure it doesn't create a new line which is too short", "int", "minLength", "=", "Math", ".", "max", "(", "1", ",", "minimumSideLengthPixel", ")", ";", "// 1 is the minimum so that you don't split on the same corner", "length", "-=", "minLength", ";", "for", "(", "int", "i", "=", "minLength", ";", "i", "<=", "length", ";", "i", "++", ")", "{", "Point2D_I32", "b", "=", "contour", ".", "get", "(", "(", "indexStart", "+", "i", ")", "%", "N", ")", ";", "point2D", ".", "set", "(", "b", ".", "x", ",", "b", ".", "y", ")", ";", "double", "dist", "=", "Distance2D_F64", ".", "distanceSq", "(", "line", ",", "point2D", ")", ";", "if", "(", "dist", ">=", "bestDistanceSq", ")", "{", "bestDistanceSq", "=", "dist", ";", "bestOffset", "=", "i", ";", "}", "}", "return", "bestOffset", ";", "}" ]
Finds the point between indexStart and the end point which is the greater distance from the line (set up prior to calling). Returns the index of the element with a distances greater than tolerance, otherwise -1 @return Selected offset from start of the split. -1 if no split was selected
[ "Finds", "the", "point", "between", "indexStart", "and", "the", "end", "point", "which", "is", "the", "greater", "distance", "from", "the", "line", "(", "set", "up", "prior", "to", "calling", ")", ".", "Returns", "the", "index", "of", "the", "element", "with", "a", "distances", "greater", "than", "tolerance", "otherwise", "-", "1" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/SplitMergeLineFitLoop.java#L228-L255
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java
SecureDfuImpl.readChecksum
private ObjectChecksum readChecksum() throws DeviceDisconnectedException, DfuException, UploadAbortedException, RemoteDfuException, UnknownResponseException { """ Sends the Calculate Checksum request. As a response a notification will be sent with current offset and CRC32 of the current object. @return requested object info. @throws DeviceDisconnectedException @throws DfuException @throws UploadAbortedException @throws RemoteDfuException thrown when the returned status code is not equal to {@link #DFU_STATUS_SUCCESS}. """ if (!mConnected) throw new DeviceDisconnectedException("Unable to read Checksum: device disconnected"); writeOpCode(mControlPointCharacteristic, OP_CODE_CALCULATE_CHECKSUM); final byte[] response = readNotificationResponse(); final int status = getStatusCode(response, OP_CODE_CALCULATE_CHECKSUM_KEY); if (status == SecureDfuError.EXTENDED_ERROR) throw new RemoteDfuExtendedErrorException("Receiving Checksum failed", response[3]); if (status != DFU_STATUS_SUCCESS) throw new RemoteDfuException("Receiving Checksum failed", status); final ObjectChecksum checksum = new ObjectChecksum(); checksum.offset = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3); checksum.CRC32 = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3 + 4); return checksum; }
java
private ObjectChecksum readChecksum() throws DeviceDisconnectedException, DfuException, UploadAbortedException, RemoteDfuException, UnknownResponseException { if (!mConnected) throw new DeviceDisconnectedException("Unable to read Checksum: device disconnected"); writeOpCode(mControlPointCharacteristic, OP_CODE_CALCULATE_CHECKSUM); final byte[] response = readNotificationResponse(); final int status = getStatusCode(response, OP_CODE_CALCULATE_CHECKSUM_KEY); if (status == SecureDfuError.EXTENDED_ERROR) throw new RemoteDfuExtendedErrorException("Receiving Checksum failed", response[3]); if (status != DFU_STATUS_SUCCESS) throw new RemoteDfuException("Receiving Checksum failed", status); final ObjectChecksum checksum = new ObjectChecksum(); checksum.offset = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3); checksum.CRC32 = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3 + 4); return checksum; }
[ "private", "ObjectChecksum", "readChecksum", "(", ")", "throws", "DeviceDisconnectedException", ",", "DfuException", ",", "UploadAbortedException", ",", "RemoteDfuException", ",", "UnknownResponseException", "{", "if", "(", "!", "mConnected", ")", "throw", "new", "DeviceDisconnectedException", "(", "\"Unable to read Checksum: device disconnected\"", ")", ";", "writeOpCode", "(", "mControlPointCharacteristic", ",", "OP_CODE_CALCULATE_CHECKSUM", ")", ";", "final", "byte", "[", "]", "response", "=", "readNotificationResponse", "(", ")", ";", "final", "int", "status", "=", "getStatusCode", "(", "response", ",", "OP_CODE_CALCULATE_CHECKSUM_KEY", ")", ";", "if", "(", "status", "==", "SecureDfuError", ".", "EXTENDED_ERROR", ")", "throw", "new", "RemoteDfuExtendedErrorException", "(", "\"Receiving Checksum failed\"", ",", "response", "[", "3", "]", ")", ";", "if", "(", "status", "!=", "DFU_STATUS_SUCCESS", ")", "throw", "new", "RemoteDfuException", "(", "\"Receiving Checksum failed\"", ",", "status", ")", ";", "final", "ObjectChecksum", "checksum", "=", "new", "ObjectChecksum", "(", ")", ";", "checksum", ".", "offset", "=", "mControlPointCharacteristic", ".", "getIntValue", "(", "BluetoothGattCharacteristic", ".", "FORMAT_UINT32", ",", "3", ")", ";", "checksum", ".", "CRC32", "=", "mControlPointCharacteristic", ".", "getIntValue", "(", "BluetoothGattCharacteristic", ".", "FORMAT_UINT32", ",", "3", "+", "4", ")", ";", "return", "checksum", ";", "}" ]
Sends the Calculate Checksum request. As a response a notification will be sent with current offset and CRC32 of the current object. @return requested object info. @throws DeviceDisconnectedException @throws DfuException @throws UploadAbortedException @throws RemoteDfuException thrown when the returned status code is not equal to {@link #DFU_STATUS_SUCCESS}.
[ "Sends", "the", "Calculate", "Checksum", "request", ".", "As", "a", "response", "a", "notification", "will", "be", "sent", "with", "current", "offset", "and", "CRC32", "of", "the", "current", "object", "." ]
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java#L870-L888
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/storage/translation/AtomDODeserializer.java
AtomDODeserializer.getContentSrcAsFile
protected File getContentSrcAsFile(IRI contentSrc, File tempDir) throws ObjectIntegrityException, IOException { """ Returns the an Entry's contentSrc as a File relative to the tempDir param. @param contentSrc @param tempDir @return the contentSrc as a File relative to tempDir. @throws ObjectIntegrityException """ if (contentSrc.isAbsolute() || contentSrc.isPathAbsolute()) { throw new ObjectIntegrityException("contentSrc must not be absolute"); } try { // Normalize the IRI to resolve percent-encoding and // backtracking (e.g. "../") NormalizedURI nUri = new NormalizedURI(tempDir.toURI().toString() + contentSrc.toString()); nUri.normalize(); File f = new File(nUri.toURI()); if (f.getParentFile().equals(tempDir)) { File temp = File.createTempFile("binary-datastream", null); FileUtils.move(f, temp); temp.deleteOnExit(); return temp; //return f; } else { throw new ObjectIntegrityException(contentSrc.toString() + " is not a valid path."); } } catch (URISyntaxException e) { throw new ObjectIntegrityException(e.getMessage(), e); } }
java
protected File getContentSrcAsFile(IRI contentSrc, File tempDir) throws ObjectIntegrityException, IOException { if (contentSrc.isAbsolute() || contentSrc.isPathAbsolute()) { throw new ObjectIntegrityException("contentSrc must not be absolute"); } try { // Normalize the IRI to resolve percent-encoding and // backtracking (e.g. "../") NormalizedURI nUri = new NormalizedURI(tempDir.toURI().toString() + contentSrc.toString()); nUri.normalize(); File f = new File(nUri.toURI()); if (f.getParentFile().equals(tempDir)) { File temp = File.createTempFile("binary-datastream", null); FileUtils.move(f, temp); temp.deleteOnExit(); return temp; //return f; } else { throw new ObjectIntegrityException(contentSrc.toString() + " is not a valid path."); } } catch (URISyntaxException e) { throw new ObjectIntegrityException(e.getMessage(), e); } }
[ "protected", "File", "getContentSrcAsFile", "(", "IRI", "contentSrc", ",", "File", "tempDir", ")", "throws", "ObjectIntegrityException", ",", "IOException", "{", "if", "(", "contentSrc", ".", "isAbsolute", "(", ")", "||", "contentSrc", ".", "isPathAbsolute", "(", ")", ")", "{", "throw", "new", "ObjectIntegrityException", "(", "\"contentSrc must not be absolute\"", ")", ";", "}", "try", "{", "// Normalize the IRI to resolve percent-encoding and", "// backtracking (e.g. \"../\")", "NormalizedURI", "nUri", "=", "new", "NormalizedURI", "(", "tempDir", ".", "toURI", "(", ")", ".", "toString", "(", ")", "+", "contentSrc", ".", "toString", "(", ")", ")", ";", "nUri", ".", "normalize", "(", ")", ";", "File", "f", "=", "new", "File", "(", "nUri", ".", "toURI", "(", ")", ")", ";", "if", "(", "f", ".", "getParentFile", "(", ")", ".", "equals", "(", "tempDir", ")", ")", "{", "File", "temp", "=", "File", ".", "createTempFile", "(", "\"binary-datastream\"", ",", "null", ")", ";", "FileUtils", ".", "move", "(", "f", ",", "temp", ")", ";", "temp", ".", "deleteOnExit", "(", ")", ";", "return", "temp", ";", "//return f;", "}", "else", "{", "throw", "new", "ObjectIntegrityException", "(", "contentSrc", ".", "toString", "(", ")", "+", "\" is not a valid path.\"", ")", ";", "}", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "throw", "new", "ObjectIntegrityException", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}" ]
Returns the an Entry's contentSrc as a File relative to the tempDir param. @param contentSrc @param tempDir @return the contentSrc as a File relative to tempDir. @throws ObjectIntegrityException
[ "Returns", "the", "an", "Entry", "s", "contentSrc", "as", "a", "File", "relative", "to", "the", "tempDir", "param", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/storage/translation/AtomDODeserializer.java#L607-L631
google/closure-compiler
src/com/google/javascript/jscomp/FunctionTypeBuilder.java
FunctionTypeBuilder.registerTemplates
private void registerTemplates(Iterable<TemplateType> templates, @Nullable Node scopeRoot) { """ Register the template keys in a template scope and on the function node. """ if (!Iterables.isEmpty(templates)) { // Add any templates from JSDoc into our template scope. this.templateScope = typeRegistry.createScopeWithTemplates(templateScope, templates); // Register the template types on the scope root node, if there is one. if (scopeRoot != null) { typeRegistry.registerTemplateTypeNamesInScope(templates, scopeRoot); } } }
java
private void registerTemplates(Iterable<TemplateType> templates, @Nullable Node scopeRoot) { if (!Iterables.isEmpty(templates)) { // Add any templates from JSDoc into our template scope. this.templateScope = typeRegistry.createScopeWithTemplates(templateScope, templates); // Register the template types on the scope root node, if there is one. if (scopeRoot != null) { typeRegistry.registerTemplateTypeNamesInScope(templates, scopeRoot); } } }
[ "private", "void", "registerTemplates", "(", "Iterable", "<", "TemplateType", ">", "templates", ",", "@", "Nullable", "Node", "scopeRoot", ")", "{", "if", "(", "!", "Iterables", ".", "isEmpty", "(", "templates", ")", ")", "{", "// Add any templates from JSDoc into our template scope.", "this", ".", "templateScope", "=", "typeRegistry", ".", "createScopeWithTemplates", "(", "templateScope", ",", "templates", ")", ";", "// Register the template types on the scope root node, if there is one.", "if", "(", "scopeRoot", "!=", "null", ")", "{", "typeRegistry", ".", "registerTemplateTypeNamesInScope", "(", "templates", ",", "scopeRoot", ")", ";", "}", "}", "}" ]
Register the template keys in a template scope and on the function node.
[ "Register", "the", "template", "keys", "in", "a", "template", "scope", "and", "on", "the", "function", "node", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FunctionTypeBuilder.java#L669-L678
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java
ActiveSyncManager.stopSyncInternal
public void stopSyncInternal(AlluxioURI syncPoint, MountTable.Resolution resolution) { """ stop active sync on a URI. @param syncPoint sync point to be stopped @param resolution path resolution for the sync point """ try (LockResource r = new LockResource(mSyncManagerLock)) { LOG.debug("stop syncPoint {}", syncPoint.getPath()); RemoveSyncPointEntry removeSyncPoint = File.RemoveSyncPointEntry.newBuilder() .setSyncpointPath(syncPoint.toString()) .setMountId(resolution.getMountId()) .build(); apply(removeSyncPoint); try { stopSyncPostJournal(syncPoint); } catch (Throwable e) { // revert state; AddSyncPointEntry addSyncPoint = File.AddSyncPointEntry.newBuilder() .setSyncpointPath(syncPoint.toString()).build(); apply(addSyncPoint); recoverFromStopSync(syncPoint, resolution.getMountId()); } } }
java
public void stopSyncInternal(AlluxioURI syncPoint, MountTable.Resolution resolution) { try (LockResource r = new LockResource(mSyncManagerLock)) { LOG.debug("stop syncPoint {}", syncPoint.getPath()); RemoveSyncPointEntry removeSyncPoint = File.RemoveSyncPointEntry.newBuilder() .setSyncpointPath(syncPoint.toString()) .setMountId(resolution.getMountId()) .build(); apply(removeSyncPoint); try { stopSyncPostJournal(syncPoint); } catch (Throwable e) { // revert state; AddSyncPointEntry addSyncPoint = File.AddSyncPointEntry.newBuilder() .setSyncpointPath(syncPoint.toString()).build(); apply(addSyncPoint); recoverFromStopSync(syncPoint, resolution.getMountId()); } } }
[ "public", "void", "stopSyncInternal", "(", "AlluxioURI", "syncPoint", ",", "MountTable", ".", "Resolution", "resolution", ")", "{", "try", "(", "LockResource", "r", "=", "new", "LockResource", "(", "mSyncManagerLock", ")", ")", "{", "LOG", ".", "debug", "(", "\"stop syncPoint {}\"", ",", "syncPoint", ".", "getPath", "(", ")", ")", ";", "RemoveSyncPointEntry", "removeSyncPoint", "=", "File", ".", "RemoveSyncPointEntry", ".", "newBuilder", "(", ")", ".", "setSyncpointPath", "(", "syncPoint", ".", "toString", "(", ")", ")", ".", "setMountId", "(", "resolution", ".", "getMountId", "(", ")", ")", ".", "build", "(", ")", ";", "apply", "(", "removeSyncPoint", ")", ";", "try", "{", "stopSyncPostJournal", "(", "syncPoint", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "// revert state;", "AddSyncPointEntry", "addSyncPoint", "=", "File", ".", "AddSyncPointEntry", ".", "newBuilder", "(", ")", ".", "setSyncpointPath", "(", "syncPoint", ".", "toString", "(", ")", ")", ".", "build", "(", ")", ";", "apply", "(", "addSyncPoint", ")", ";", "recoverFromStopSync", "(", "syncPoint", ",", "resolution", ".", "getMountId", "(", ")", ")", ";", "}", "}", "}" ]
stop active sync on a URI. @param syncPoint sync point to be stopped @param resolution path resolution for the sync point
[ "stop", "active", "sync", "on", "a", "URI", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java#L302-L321
scalecube/scalecube-services
services-api/src/main/java/io/scalecube/services/api/Qualifier.java
Qualifier.asString
public static String asString(String namespace, String action) { """ Builds qualifier string out of given namespace and action. @param namespace qualifier namespace. @param action qualifier action. @return constructed qualifier. """ return DELIMITER + namespace + DELIMITER + action; }
java
public static String asString(String namespace, String action) { return DELIMITER + namespace + DELIMITER + action; }
[ "public", "static", "String", "asString", "(", "String", "namespace", ",", "String", "action", ")", "{", "return", "DELIMITER", "+", "namespace", "+", "DELIMITER", "+", "action", ";", "}" ]
Builds qualifier string out of given namespace and action. @param namespace qualifier namespace. @param action qualifier action. @return constructed qualifier.
[ "Builds", "qualifier", "string", "out", "of", "given", "namespace", "and", "action", "." ]
train
https://github.com/scalecube/scalecube-services/blob/76c8de6019e5480a1436d12b37acf163f70eea47/services-api/src/main/java/io/scalecube/services/api/Qualifier.java#L27-L29
sonatype/sisu-guice
extensions/servlet/src/com/google/inject/servlet/ServletScopes.java
ServletScopes.scopeRequest
public static RequestScoper scopeRequest(Map<Key<?>, Object> seedMap) { """ Returns an object that will apply request scope to a block of code. This is not the same as the HTTP request scope, but is used if no HTTP request scope is in progress. In this way, keys can be scoped as @RequestScoped and exist in non-HTTP requests (for example: RPC requests) as well as in HTTP request threads. <p>The returned object will throw a {@link ScopingException} when opened if there is a request scope already active on the current thread. @param seedMap the initial set of scoped instances for Guice to seed the request scope with. To seed a key with null, use {@code null} as the value. @return an object that when opened will initiate the request scope @since 4.1 """ Preconditions.checkArgument( null != seedMap, "Seed map cannot be null, try passing in Collections.emptyMap() instead."); // Copy the seed values into our local scope map. final Context context = new Context(); Map<Key<?>, Object> validatedAndCanonicalizedMap = Maps.transformEntries( seedMap, new EntryTransformer<Key<?>, Object, Object>() { @Override public Object transformEntry(Key<?> key, Object value) { return validateAndCanonicalizeValue(key, value); } }); context.map.putAll(validatedAndCanonicalizedMap); return new RequestScoper() { @Override public CloseableScope open() { checkScopingState( null == GuiceFilter.localContext.get(), "An HTTP request is already in progress, cannot scope a new request in this thread."); checkScopingState( null == requestScopeContext.get(), "A request scope is already in progress, cannot scope a new request in this thread."); return context.open(); } }; }
java
public static RequestScoper scopeRequest(Map<Key<?>, Object> seedMap) { Preconditions.checkArgument( null != seedMap, "Seed map cannot be null, try passing in Collections.emptyMap() instead."); // Copy the seed values into our local scope map. final Context context = new Context(); Map<Key<?>, Object> validatedAndCanonicalizedMap = Maps.transformEntries( seedMap, new EntryTransformer<Key<?>, Object, Object>() { @Override public Object transformEntry(Key<?> key, Object value) { return validateAndCanonicalizeValue(key, value); } }); context.map.putAll(validatedAndCanonicalizedMap); return new RequestScoper() { @Override public CloseableScope open() { checkScopingState( null == GuiceFilter.localContext.get(), "An HTTP request is already in progress, cannot scope a new request in this thread."); checkScopingState( null == requestScopeContext.get(), "A request scope is already in progress, cannot scope a new request in this thread."); return context.open(); } }; }
[ "public", "static", "RequestScoper", "scopeRequest", "(", "Map", "<", "Key", "<", "?", ">", ",", "Object", ">", "seedMap", ")", "{", "Preconditions", ".", "checkArgument", "(", "null", "!=", "seedMap", ",", "\"Seed map cannot be null, try passing in Collections.emptyMap() instead.\"", ")", ";", "// Copy the seed values into our local scope map.", "final", "Context", "context", "=", "new", "Context", "(", ")", ";", "Map", "<", "Key", "<", "?", ">", ",", "Object", ">", "validatedAndCanonicalizedMap", "=", "Maps", ".", "transformEntries", "(", "seedMap", ",", "new", "EntryTransformer", "<", "Key", "<", "?", ">", ",", "Object", ",", "Object", ">", "(", ")", "{", "@", "Override", "public", "Object", "transformEntry", "(", "Key", "<", "?", ">", "key", ",", "Object", "value", ")", "{", "return", "validateAndCanonicalizeValue", "(", "key", ",", "value", ")", ";", "}", "}", ")", ";", "context", ".", "map", ".", "putAll", "(", "validatedAndCanonicalizedMap", ")", ";", "return", "new", "RequestScoper", "(", ")", "{", "@", "Override", "public", "CloseableScope", "open", "(", ")", "{", "checkScopingState", "(", "null", "==", "GuiceFilter", ".", "localContext", ".", "get", "(", ")", ",", "\"An HTTP request is already in progress, cannot scope a new request in this thread.\"", ")", ";", "checkScopingState", "(", "null", "==", "requestScopeContext", ".", "get", "(", ")", ",", "\"A request scope is already in progress, cannot scope a new request in this thread.\"", ")", ";", "return", "context", ".", "open", "(", ")", ";", "}", "}", ";", "}" ]
Returns an object that will apply request scope to a block of code. This is not the same as the HTTP request scope, but is used if no HTTP request scope is in progress. In this way, keys can be scoped as @RequestScoped and exist in non-HTTP requests (for example: RPC requests) as well as in HTTP request threads. <p>The returned object will throw a {@link ScopingException} when opened if there is a request scope already active on the current thread. @param seedMap the initial set of scoped instances for Guice to seed the request scope with. To seed a key with null, use {@code null} as the value. @return an object that when opened will initiate the request scope @since 4.1
[ "Returns", "an", "object", "that", "will", "apply", "request", "scope", "to", "a", "block", "of", "code", ".", "This", "is", "not", "the", "same", "as", "the", "HTTP", "request", "scope", "but", "is", "used", "if", "no", "HTTP", "request", "scope", "is", "in", "progress", ".", "In", "this", "way", "keys", "can", "be", "scoped", "as", "@RequestScoped", "and", "exist", "in", "non", "-", "HTTP", "requests", "(", "for", "example", ":", "RPC", "requests", ")", "as", "well", "as", "in", "HTTP", "request", "threads", "." ]
train
https://github.com/sonatype/sisu-guice/blob/45f5c89834c189c5338640bf55e6e6181b9b5611/extensions/servlet/src/com/google/inject/servlet/ServletScopes.java#L359-L387
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java
ScenarioPortrayal.updateDataSerieToHistogram
public void updateDataSerieToHistogram(String histogramID, double[] dataSerie, int index) { """ Updates the given Histogram (index). The index will be the order of the histogram. @param histogramID @param dataSerie @param index """ this.histograms.get(histogramID).updateSeries(index, dataSerie); }
java
public void updateDataSerieToHistogram(String histogramID, double[] dataSerie, int index){ this.histograms.get(histogramID).updateSeries(index, dataSerie); }
[ "public", "void", "updateDataSerieToHistogram", "(", "String", "histogramID", ",", "double", "[", "]", "dataSerie", ",", "int", "index", ")", "{", "this", ".", "histograms", ".", "get", "(", "histogramID", ")", ".", "updateSeries", "(", "index", ",", "dataSerie", ")", ";", "}" ]
Updates the given Histogram (index). The index will be the order of the histogram. @param histogramID @param dataSerie @param index
[ "Updates", "the", "given", "Histogram", "(", "index", ")", ".", "The", "index", "will", "be", "the", "order", "of", "the", "histogram", "." ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java#L442-L444
UrielCh/ovh-java-sdk
ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java
ApiOvhCaasregistry.serviceName_users_userId_DELETE
public void serviceName_users_userId_DELETE(String serviceName, String userId) throws IOException { """ Delete user REST: DELETE /caas/registry/{serviceName}/users/{userId} @param serviceName [required] Service name @param userId [required] User id API beta """ String qPath = "/caas/registry/{serviceName}/users/{userId}"; StringBuilder sb = path(qPath, serviceName, userId); exec(qPath, "DELETE", sb.toString(), null); }
java
public void serviceName_users_userId_DELETE(String serviceName, String userId) throws IOException { String qPath = "/caas/registry/{serviceName}/users/{userId}"; StringBuilder sb = path(qPath, serviceName, userId); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "serviceName_users_userId_DELETE", "(", "String", "serviceName", ",", "String", "userId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/caas/registry/{serviceName}/users/{userId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "userId", ")", ";", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "}" ]
Delete user REST: DELETE /caas/registry/{serviceName}/users/{userId} @param serviceName [required] Service name @param userId [required] User id API beta
[ "Delete", "user" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java#L139-L143
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointUser.java
EndpointUser.setUserAttributes
public void setUserAttributes(java.util.Map<String, java.util.List<String>> userAttributes) { """ Custom attributes that describe the user by associating a name with an array of values. For example, an attribute named "interests" might have the following values: ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create segments. The Amazon Pinpoint console can't display attribute names that include the following characters: hash/pound sign (#), colon (:), question mark (?), backslash (\), and forward slash (/). For this reason, you should avoid using these characters in the names of custom attributes. @param userAttributes Custom attributes that describe the user by associating a name with an array of values. For example, an attribute named "interests" might have the following values: ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create segments. The Amazon Pinpoint console can't display attribute names that include the following characters: hash/pound sign (#), colon (:), question mark (?), backslash (\), and forward slash (/). For this reason, you should avoid using these characters in the names of custom attributes. """ this.userAttributes = userAttributes; }
java
public void setUserAttributes(java.util.Map<String, java.util.List<String>> userAttributes) { this.userAttributes = userAttributes; }
[ "public", "void", "setUserAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", "userAttributes", ")", "{", "this", ".", "userAttributes", "=", "userAttributes", ";", "}" ]
Custom attributes that describe the user by associating a name with an array of values. For example, an attribute named "interests" might have the following values: ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create segments. The Amazon Pinpoint console can't display attribute names that include the following characters: hash/pound sign (#), colon (:), question mark (?), backslash (\), and forward slash (/). For this reason, you should avoid using these characters in the names of custom attributes. @param userAttributes Custom attributes that describe the user by associating a name with an array of values. For example, an attribute named "interests" might have the following values: ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create segments. The Amazon Pinpoint console can't display attribute names that include the following characters: hash/pound sign (#), colon (:), question mark (?), backslash (\), and forward slash (/). For this reason, you should avoid using these characters in the names of custom attributes.
[ "Custom", "attributes", "that", "describe", "the", "user", "by", "associating", "a", "name", "with", "an", "array", "of", "values", ".", "For", "example", "an", "attribute", "named", "interests", "might", "have", "the", "following", "values", ":", "[", "science", "politics", "travel", "]", ".", "You", "can", "use", "these", "attributes", "as", "selection", "criteria", "when", "you", "create", "segments", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointUser.java#L83-L85
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java
HttpHeaderMap.addDateHeader
public void addDateHeader (@Nonnull @Nonempty final String sName, @Nonnull final ZonedDateTime aDT) { """ Add the passed header as a date header. @param sName Header name. May neither be <code>null</code> nor empty. @param aDT The DateTime to set as a date. May not be <code>null</code>. """ _addHeader (sName, getDateTimeAsString (aDT)); }
java
public void addDateHeader (@Nonnull @Nonempty final String sName, @Nonnull final ZonedDateTime aDT) { _addHeader (sName, getDateTimeAsString (aDT)); }
[ "public", "void", "addDateHeader", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sName", ",", "@", "Nonnull", "final", "ZonedDateTime", "aDT", ")", "{", "_addHeader", "(", "sName", ",", "getDateTimeAsString", "(", "aDT", ")", ")", ";", "}" ]
Add the passed header as a date header. @param sName Header name. May neither be <code>null</code> nor empty. @param aDT The DateTime to set as a date. May not be <code>null</code>.
[ "Add", "the", "passed", "header", "as", "a", "date", "header", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java#L330-L333
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.listFromComputeNodeNextAsync
public Observable<Page<NodeFile>> listFromComputeNodeNextAsync(final String nextPageLink, final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions) { """ Lists all of the files in task directories on the specified compute node. @param nextPageLink The NextLink from the previous successful call to List operation. @param fileListFromComputeNodeNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;NodeFile&gt; object """ return listFromComputeNodeNextWithServiceResponseAsync(nextPageLink, fileListFromComputeNodeNextOptions) .map(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>, Page<NodeFile>>() { @Override public Page<NodeFile> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders> response) { return response.body(); } }); }
java
public Observable<Page<NodeFile>> listFromComputeNodeNextAsync(final String nextPageLink, final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions) { return listFromComputeNodeNextWithServiceResponseAsync(nextPageLink, fileListFromComputeNodeNextOptions) .map(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>, Page<NodeFile>>() { @Override public Page<NodeFile> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "NodeFile", ">", ">", "listFromComputeNodeNextAsync", "(", "final", "String", "nextPageLink", ",", "final", "FileListFromComputeNodeNextOptions", "fileListFromComputeNodeNextOptions", ")", "{", "return", "listFromComputeNodeNextWithServiceResponseAsync", "(", "nextPageLink", ",", "fileListFromComputeNodeNextOptions", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromComputeNodeHeaders", ">", ",", "Page", "<", "NodeFile", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "NodeFile", ">", "call", "(", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromComputeNodeHeaders", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Lists all of the files in task directories on the specified compute node. @param nextPageLink The NextLink from the previous successful call to List operation. @param fileListFromComputeNodeNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;NodeFile&gt; object
[ "Lists", "all", "of", "the", "files", "in", "task", "directories", "on", "the", "specified", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L2628-L2636
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/opengl/TextureLoader.java
TextureLoader.getTexture
public static Texture getTexture(String format, InputStream in) throws IOException { """ Load a texture with a given format from the supplied input stream @param format The format of the texture to be loaded (something like "PNG" or "TGA") @param in The input stream from which the image data will be read @return The newly created texture @throws IOException Indicates a failure to read the image data """ return getTexture(format, in, false, GL11.GL_LINEAR); }
java
public static Texture getTexture(String format, InputStream in) throws IOException { return getTexture(format, in, false, GL11.GL_LINEAR); }
[ "public", "static", "Texture", "getTexture", "(", "String", "format", ",", "InputStream", "in", ")", "throws", "IOException", "{", "return", "getTexture", "(", "format", ",", "in", ",", "false", ",", "GL11", ".", "GL_LINEAR", ")", ";", "}" ]
Load a texture with a given format from the supplied input stream @param format The format of the texture to be loaded (something like "PNG" or "TGA") @param in The input stream from which the image data will be read @return The newly created texture @throws IOException Indicates a failure to read the image data
[ "Load", "a", "texture", "with", "a", "given", "format", "from", "the", "supplied", "input", "stream" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/TextureLoader.java#L23-L25
Swrve/rate-limited-logger
src/main/java/com/swrve/ratelimitedlogger/RateLimitedLog.java
RateLimitedLog.get
public LogWithPatternAndLevel get(String pattern, Level level) { """ @return a LogWithPatternAndLevel object for the supplied @param message and @param level . This can be cached and reused by callers in performance-sensitive cases to avoid performing two ConcurrentHashMap lookups. Note that the string is the sole key used, so the same string cannot be reused with differing period settings; any periods which differ from the first one used are ignored. @throws IllegalStateException if we exceed the limit on number of RateLimitedLogWithPattern objects in any one period; if this happens, it's probable that an already-interpolated string is accidentally being used as a log pattern. """ return get(pattern).get(level); }
java
public LogWithPatternAndLevel get(String pattern, Level level) { return get(pattern).get(level); }
[ "public", "LogWithPatternAndLevel", "get", "(", "String", "pattern", ",", "Level", "level", ")", "{", "return", "get", "(", "pattern", ")", ".", "get", "(", "level", ")", ";", "}" ]
@return a LogWithPatternAndLevel object for the supplied @param message and @param level . This can be cached and reused by callers in performance-sensitive cases to avoid performing two ConcurrentHashMap lookups. Note that the string is the sole key used, so the same string cannot be reused with differing period settings; any periods which differ from the first one used are ignored. @throws IllegalStateException if we exceed the limit on number of RateLimitedLogWithPattern objects in any one period; if this happens, it's probable that an already-interpolated string is accidentally being used as a log pattern.
[ "@return", "a", "LogWithPatternAndLevel", "object", "for", "the", "supplied", "@param", "message", "and", "@param", "level", ".", "This", "can", "be", "cached", "and", "reused", "by", "callers", "in", "performance", "-", "sensitive", "cases", "to", "avoid", "performing", "two", "ConcurrentHashMap", "lookups", "." ]
train
https://github.com/Swrve/rate-limited-logger/blob/9094d3961f35dad0d6114aafade4a34b0b264b0b/src/main/java/com/swrve/ratelimitedlogger/RateLimitedLog.java#L433-L435
logic-ng/LogicNG
src/main/java/org/logicng/formulas/FormulaFactory.java
FormulaFactory.naryOperator
public Formula naryOperator(final FType type, final Collection<? extends Formula> operands) { """ Creates a new n-ary operator with a given type and a list of operands. @param type the type of the formula @param operands the list of operands @return the newly generated formula @throws IllegalArgumentException if a wrong formula type is passed """ return this.naryOperator(type, operands.toArray(new Formula[0])); }
java
public Formula naryOperator(final FType type, final Collection<? extends Formula> operands) { return this.naryOperator(type, operands.toArray(new Formula[0])); }
[ "public", "Formula", "naryOperator", "(", "final", "FType", "type", ",", "final", "Collection", "<", "?", "extends", "Formula", ">", "operands", ")", "{", "return", "this", ".", "naryOperator", "(", "type", ",", "operands", ".", "toArray", "(", "new", "Formula", "[", "0", "]", ")", ")", ";", "}" ]
Creates a new n-ary operator with a given type and a list of operands. @param type the type of the formula @param operands the list of operands @return the newly generated formula @throws IllegalArgumentException if a wrong formula type is passed
[ "Creates", "a", "new", "n", "-", "ary", "operator", "with", "a", "given", "type", "and", "a", "list", "of", "operands", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/FormulaFactory.java#L367-L369
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_modem_reset_POST
public OvhTask serviceName_modem_reset_POST(String serviceName, Boolean resetOvhConfig) throws IOException { """ Reset the modem to its default configuration REST: POST /xdsl/{serviceName}/modem/reset @param resetOvhConfig [required] Reset configuration stored in OVH databases @param serviceName [required] The internal name of your XDSL offer """ String qPath = "/xdsl/{serviceName}/modem/reset"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "resetOvhConfig", resetOvhConfig); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_modem_reset_POST(String serviceName, Boolean resetOvhConfig) throws IOException { String qPath = "/xdsl/{serviceName}/modem/reset"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "resetOvhConfig", resetOvhConfig); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_modem_reset_POST", "(", "String", "serviceName", ",", "Boolean", "resetOvhConfig", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/modem/reset\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"resetOvhConfig\"", ",", "resetOvhConfig", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTask", ".", "class", ")", ";", "}" ]
Reset the modem to its default configuration REST: POST /xdsl/{serviceName}/modem/reset @param resetOvhConfig [required] Reset configuration stored in OVH databases @param serviceName [required] The internal name of your XDSL offer
[ "Reset", "the", "modem", "to", "its", "default", "configuration" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1257-L1264
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getCompositeEntityRole
public EntityRole getCompositeEntityRole(UUID appId, String versionId, UUID cEntityId, UUID roleId) { """ Get one entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @param roleId entity role ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the EntityRole object if successful. """ return getCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, roleId).toBlocking().single().body(); }
java
public EntityRole getCompositeEntityRole(UUID appId, String versionId, UUID cEntityId, UUID roleId) { return getCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, roleId).toBlocking().single().body(); }
[ "public", "EntityRole", "getCompositeEntityRole", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "cEntityId", ",", "UUID", "roleId", ")", "{", "return", "getCompositeEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "cEntityId", ",", "roleId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Get one entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @param roleId entity role ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the EntityRole object if successful.
[ "Get", "one", "entity", "role", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L12354-L12356
avarabyeu/restendpoint
src/main/java/com/github/avarabyeu/restendpoint/serializer/StringSerializer.java
StringSerializer.canRead
@Override public boolean canRead(@Nonnull MediaType mimeType, Type resultType) { """ Checks whether mime types is supported by this serializer implementation """ MediaType type = mimeType.withoutParameters(); return (type.is(MediaType.ANY_TEXT_TYPE) || MediaType.APPLICATION_XML_UTF_8.withoutParameters().is(type) || MediaType.JSON_UTF_8.withoutParameters().is(type)) && String.class.equals(TypeToken.of(resultType).getRawType()); }
java
@Override public boolean canRead(@Nonnull MediaType mimeType, Type resultType) { MediaType type = mimeType.withoutParameters(); return (type.is(MediaType.ANY_TEXT_TYPE) || MediaType.APPLICATION_XML_UTF_8.withoutParameters().is(type) || MediaType.JSON_UTF_8.withoutParameters().is(type)) && String.class.equals(TypeToken.of(resultType).getRawType()); }
[ "@", "Override", "public", "boolean", "canRead", "(", "@", "Nonnull", "MediaType", "mimeType", ",", "Type", "resultType", ")", "{", "MediaType", "type", "=", "mimeType", ".", "withoutParameters", "(", ")", ";", "return", "(", "type", ".", "is", "(", "MediaType", ".", "ANY_TEXT_TYPE", ")", "||", "MediaType", ".", "APPLICATION_XML_UTF_8", ".", "withoutParameters", "(", ")", ".", "is", "(", "type", ")", "||", "MediaType", ".", "JSON_UTF_8", ".", "withoutParameters", "(", ")", ".", "is", "(", "type", ")", ")", "&&", "String", ".", "class", ".", "equals", "(", "TypeToken", ".", "of", "(", "resultType", ")", ".", "getRawType", "(", ")", ")", ";", "}" ]
Checks whether mime types is supported by this serializer implementation
[ "Checks", "whether", "mime", "types", "is", "supported", "by", "this", "serializer", "implementation" ]
train
https://github.com/avarabyeu/restendpoint/blob/e11fc0813ea4cefbe4d8bca292cd48b40abf185d/src/main/java/com/github/avarabyeu/restendpoint/serializer/StringSerializer.java#L87-L92
zaproxy/zaproxy
src/org/zaproxy/zap/extension/api/API.java
API.validateMandatoryParams
private void validateMandatoryParams(JSONObject params, ApiElement element) throws ApiException { """ Validates that the mandatory parameters of the given {@code ApiElement} are present, throwing an {@code ApiException} if not. @param params the parameters of the API request. @param element the API element to validate. @throws ApiException if any of the mandatory parameters is missing. """ if (element == null) { return; } List<String> mandatoryParams = element.getMandatoryParamNames(); if (mandatoryParams != null) { for (String param : mandatoryParams) { if (!params.has(param) || params.getString(param).length() == 0) { throw new ApiException(ApiException.Type.MISSING_PARAMETER, param); } } } }
java
private void validateMandatoryParams(JSONObject params, ApiElement element) throws ApiException { if (element == null) { return; } List<String> mandatoryParams = element.getMandatoryParamNames(); if (mandatoryParams != null) { for (String param : mandatoryParams) { if (!params.has(param) || params.getString(param).length() == 0) { throw new ApiException(ApiException.Type.MISSING_PARAMETER, param); } } } }
[ "private", "void", "validateMandatoryParams", "(", "JSONObject", "params", ",", "ApiElement", "element", ")", "throws", "ApiException", "{", "if", "(", "element", "==", "null", ")", "{", "return", ";", "}", "List", "<", "String", ">", "mandatoryParams", "=", "element", ".", "getMandatoryParamNames", "(", ")", ";", "if", "(", "mandatoryParams", "!=", "null", ")", "{", "for", "(", "String", "param", ":", "mandatoryParams", ")", "{", "if", "(", "!", "params", ".", "has", "(", "param", ")", "||", "params", ".", "getString", "(", "param", ")", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "ApiException", "(", "ApiException", ".", "Type", ".", "MISSING_PARAMETER", ",", "param", ")", ";", "}", "}", "}", "}" ]
Validates that the mandatory parameters of the given {@code ApiElement} are present, throwing an {@code ApiException} if not. @param params the parameters of the API request. @param element the API element to validate. @throws ApiException if any of the mandatory parameters is missing.
[ "Validates", "that", "the", "mandatory", "parameters", "of", "the", "given", "{", "@code", "ApiElement", "}", "are", "present", "throwing", "an", "{", "@code", "ApiException", "}", "if", "not", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/api/API.java#L558-L571
sebastiangraf/jSCSI
bundles/target/src/main/java/org/jscsi/target/util/BitManip.java
BitManip.getByteWithBitSet
public static final byte getByteWithBitSet (final byte b, final int bitNumber, final boolean value) { """ Sets a single bit. If the <i>value</i> parameter is <code>true</code>, the bit will be set to <code>one</code>, and to <code>zero</code> otherwise. All other bits will be left unchanged. <p> The bits are numbered in big-endian format, from 0 (LSB) to 7 (MSB). <p> <code> +---+---+---+---+---+---+---+---+<br> | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | bit number<br> +---+---+---+---+---+---+---+---+<br> </code> @param b the original byte value @param bitNumber the big-endian position of the bit to be changed, from 0 to 7 @param value <code>true</code> for <i>1</i>, <code>false</code> for <i>0</i> @return the edited byte value """ int number = b; if (value) { // make sure bit is set to true int mask = 1; mask <<= bitNumber; number |= mask; } else { int mask = 1; mask <<= bitNumber; mask ^= 255;// flip bits number &= mask; } return (byte) number; }
java
public static final byte getByteWithBitSet (final byte b, final int bitNumber, final boolean value) { int number = b; if (value) { // make sure bit is set to true int mask = 1; mask <<= bitNumber; number |= mask; } else { int mask = 1; mask <<= bitNumber; mask ^= 255;// flip bits number &= mask; } return (byte) number; }
[ "public", "static", "final", "byte", "getByteWithBitSet", "(", "final", "byte", "b", ",", "final", "int", "bitNumber", ",", "final", "boolean", "value", ")", "{", "int", "number", "=", "b", ";", "if", "(", "value", ")", "{", "// make sure bit is set to true\r", "int", "mask", "=", "1", ";", "mask", "<<=", "bitNumber", ";", "number", "|=", "mask", ";", "}", "else", "{", "int", "mask", "=", "1", ";", "mask", "<<=", "bitNumber", ";", "mask", "^=", "255", ";", "// flip bits\r", "number", "&=", "mask", ";", "}", "return", "(", "byte", ")", "number", ";", "}" ]
Sets a single bit. If the <i>value</i> parameter is <code>true</code>, the bit will be set to <code>one</code>, and to <code>zero</code> otherwise. All other bits will be left unchanged. <p> The bits are numbered in big-endian format, from 0 (LSB) to 7 (MSB). <p> <code> +---+---+---+---+---+---+---+---+<br> | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | bit number<br> +---+---+---+---+---+---+---+---+<br> </code> @param b the original byte value @param bitNumber the big-endian position of the bit to be changed, from 0 to 7 @param value <code>true</code> for <i>1</i>, <code>false</code> for <i>0</i> @return the edited byte value
[ "Sets", "a", "single", "bit", ".", "If", "the", "<i", ">", "value<", "/", "i", ">", "parameter", "is", "<code", ">", "true<", "/", "code", ">", "the", "bit", "will", "be", "set", "to", "<code", ">", "one<", "/", "code", ">", "and", "to", "<code", ">", "zero<", "/", "code", ">", "otherwise", ".", "All", "other", "bits", "will", "be", "left", "unchanged", ".", "<p", ">", "The", "bits", "are", "numbered", "in", "big", "-", "endian", "format", "from", "0", "(", "LSB", ")", "to", "7", "(", "MSB", ")", ".", "<p", ">", "<code", ">", "+", "---", "+", "---", "+", "---", "+", "---", "+", "---", "+", "---", "+", "---", "+", "---", "+", "<br", ">", "|", "7", "|", "6", "|", "5", "|", "4", "|", "3", "|", "2", "|", "1", "|", "0", "|", "bit", "number<br", ">", "+", "---", "+", "---", "+", "---", "+", "---", "+", "---", "+", "---", "+", "---", "+", "---", "+", "<br", ">", "<", "/", "code", ">" ]
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/target/src/main/java/org/jscsi/target/util/BitManip.java#L35-L52
GII/broccoli
broccoli-api/src/main/java/com/hi3project/broccoli/bsdl/impl/meta/MetaPropertyVersion.java
MetaPropertyVersion.compareTo
private static int compareTo(Deque<String> first, Deque<String> second) { """ Compares two string ordered lists containing numbers. @return -1 when first group is higher, 0 if equals, 1 when second group is higher """ if (0 == first.size() && 0 == second.size()) { return 0; } if (0 == first.size()) { return 1; } if (0 == second.size()) { return -1; } int headsComparation = (Integer.valueOf(first.remove())).compareTo(Integer.parseInt(second.remove())); if (0 == headsComparation) { return compareTo(first, second); } else { return headsComparation; } }
java
private static int compareTo(Deque<String> first, Deque<String> second) { if (0 == first.size() && 0 == second.size()) { return 0; } if (0 == first.size()) { return 1; } if (0 == second.size()) { return -1; } int headsComparation = (Integer.valueOf(first.remove())).compareTo(Integer.parseInt(second.remove())); if (0 == headsComparation) { return compareTo(first, second); } else { return headsComparation; } }
[ "private", "static", "int", "compareTo", "(", "Deque", "<", "String", ">", "first", ",", "Deque", "<", "String", ">", "second", ")", "{", "if", "(", "0", "==", "first", ".", "size", "(", ")", "&&", "0", "==", "second", ".", "size", "(", ")", ")", "{", "return", "0", ";", "}", "if", "(", "0", "==", "first", ".", "size", "(", ")", ")", "{", "return", "1", ";", "}", "if", "(", "0", "==", "second", ".", "size", "(", ")", ")", "{", "return", "-", "1", ";", "}", "int", "headsComparation", "=", "(", "Integer", ".", "valueOf", "(", "first", ".", "remove", "(", ")", ")", ")", ".", "compareTo", "(", "Integer", ".", "parseInt", "(", "second", ".", "remove", "(", ")", ")", ")", ";", "if", "(", "0", "==", "headsComparation", ")", "{", "return", "compareTo", "(", "first", ",", "second", ")", ";", "}", "else", "{", "return", "headsComparation", ";", "}", "}" ]
Compares two string ordered lists containing numbers. @return -1 when first group is higher, 0 if equals, 1 when second group is higher
[ "Compares", "two", "string", "ordered", "lists", "containing", "numbers", "." ]
train
https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-api/src/main/java/com/hi3project/broccoli/bsdl/impl/meta/MetaPropertyVersion.java#L82-L98
threerings/narya
core/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java
PresentsDObjectMgr.setDefaultAccessController
public void setDefaultAccessController (AccessController controller) { """ Sets up an access controller that will be provided to any distributed objects created on the server. The controllers can subsequently be overridden if desired, but a default controller is useful for implementing basic access control policies. """ AccessController oldDefault = _defaultController; _defaultController = controller; // switch all objects from the old default (null, usually) to the new default. for (DObject obj : _objects.values()) { if (oldDefault == obj.getAccessController()) { obj.setAccessController(controller); } } }
java
public void setDefaultAccessController (AccessController controller) { AccessController oldDefault = _defaultController; _defaultController = controller; // switch all objects from the old default (null, usually) to the new default. for (DObject obj : _objects.values()) { if (oldDefault == obj.getAccessController()) { obj.setAccessController(controller); } } }
[ "public", "void", "setDefaultAccessController", "(", "AccessController", "controller", ")", "{", "AccessController", "oldDefault", "=", "_defaultController", ";", "_defaultController", "=", "controller", ";", "// switch all objects from the old default (null, usually) to the new default.", "for", "(", "DObject", "obj", ":", "_objects", ".", "values", "(", ")", ")", "{", "if", "(", "oldDefault", "==", "obj", ".", "getAccessController", "(", ")", ")", "{", "obj", ".", "setAccessController", "(", "controller", ")", ";", "}", "}", "}" ]
Sets up an access controller that will be provided to any distributed objects created on the server. The controllers can subsequently be overridden if desired, but a default controller is useful for implementing basic access control policies.
[ "Sets", "up", "an", "access", "controller", "that", "will", "be", "provided", "to", "any", "distributed", "objects", "created", "on", "the", "server", ".", "The", "controllers", "can", "subsequently", "be", "overridden", "if", "desired", "but", "a", "default", "controller", "is", "useful", "for", "implementing", "basic", "access", "control", "policies", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java#L152-L163
m-m-m/util
resource/src/main/java/net/sf/mmm/util/resource/base/ClasspathResource.java
ClasspathResource.getAbsolutePath
private static String getAbsolutePath(Class<?> someClass, String nameOrSuffix, boolean append) { """ @see #ClasspathResource(Class, String, boolean) @param someClass is the class identifying the path where the resource is located and the prefix of its filename. @param nameOrSuffix is the filename of the resource or a suffix (e.g. ".properties" or "-test.xml") for it depending on {@code append}. @param append - if {@code true} the {@code nameOrSuffix} is appended to the {@link Class#getSimpleName() simple classname} of {@code someClass} or {@code false} if the simple name is replaced by {@code nameOrSuffix}. @return the absolute path. """ if (append) { return someClass.getName().replace('.', '/') + nameOrSuffix; } else { return someClass.getPackage().getName().replace('.', '/') + '/' + nameOrSuffix; } }
java
private static String getAbsolutePath(Class<?> someClass, String nameOrSuffix, boolean append) { if (append) { return someClass.getName().replace('.', '/') + nameOrSuffix; } else { return someClass.getPackage().getName().replace('.', '/') + '/' + nameOrSuffix; } }
[ "private", "static", "String", "getAbsolutePath", "(", "Class", "<", "?", ">", "someClass", ",", "String", "nameOrSuffix", ",", "boolean", "append", ")", "{", "if", "(", "append", ")", "{", "return", "someClass", ".", "getName", "(", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "nameOrSuffix", ";", "}", "else", "{", "return", "someClass", ".", "getPackage", "(", ")", ".", "getName", "(", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "'", "'", "+", "nameOrSuffix", ";", "}", "}" ]
@see #ClasspathResource(Class, String, boolean) @param someClass is the class identifying the path where the resource is located and the prefix of its filename. @param nameOrSuffix is the filename of the resource or a suffix (e.g. ".properties" or "-test.xml") for it depending on {@code append}. @param append - if {@code true} the {@code nameOrSuffix} is appended to the {@link Class#getSimpleName() simple classname} of {@code someClass} or {@code false} if the simple name is replaced by {@code nameOrSuffix}. @return the absolute path.
[ "@see", "#ClasspathResource", "(", "Class", "String", "boolean", ")" ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/resource/src/main/java/net/sf/mmm/util/resource/base/ClasspathResource.java#L159-L166
alkacon/opencms-core
src/org/opencms/workplace/editors/CmsEditorDisplayOptions.java
CmsEditorDisplayOptions.showElement
public boolean showElement(String key, String defaultValue, Properties displayOptions) { """ Determines if the given element should be shown in the editor.<p> @param key the element key name which should be displayed @param defaultValue the default value to use in case the property is not found, should be a boolean value as String @param displayOptions the display options for the current user @return true if the element should be shown, otherwise false """ if (defaultValue == null) { return ((displayOptions != null) && Boolean.valueOf(displayOptions.getProperty(key)).booleanValue()); } if (displayOptions == null) { return Boolean.valueOf(defaultValue).booleanValue(); } return Boolean.valueOf(displayOptions.getProperty(key, defaultValue)).booleanValue(); }
java
public boolean showElement(String key, String defaultValue, Properties displayOptions) { if (defaultValue == null) { return ((displayOptions != null) && Boolean.valueOf(displayOptions.getProperty(key)).booleanValue()); } if (displayOptions == null) { return Boolean.valueOf(defaultValue).booleanValue(); } return Boolean.valueOf(displayOptions.getProperty(key, defaultValue)).booleanValue(); }
[ "public", "boolean", "showElement", "(", "String", "key", ",", "String", "defaultValue", ",", "Properties", "displayOptions", ")", "{", "if", "(", "defaultValue", "==", "null", ")", "{", "return", "(", "(", "displayOptions", "!=", "null", ")", "&&", "Boolean", ".", "valueOf", "(", "displayOptions", ".", "getProperty", "(", "key", ")", ")", ".", "booleanValue", "(", ")", ")", ";", "}", "if", "(", "displayOptions", "==", "null", ")", "{", "return", "Boolean", ".", "valueOf", "(", "defaultValue", ")", ".", "booleanValue", "(", ")", ";", "}", "return", "Boolean", ".", "valueOf", "(", "displayOptions", ".", "getProperty", "(", "key", ",", "defaultValue", ")", ")", ".", "booleanValue", "(", ")", ";", "}" ]
Determines if the given element should be shown in the editor.<p> @param key the element key name which should be displayed @param defaultValue the default value to use in case the property is not found, should be a boolean value as String @param displayOptions the display options for the current user @return true if the element should be shown, otherwise false
[ "Determines", "if", "the", "given", "element", "should", "be", "shown", "in", "the", "editor", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsEditorDisplayOptions.java#L253-L262
hansenji/pocketknife
pocketknife/src/main/java/pocketknife/PocketKnife.java
PocketKnife.bindExtras
public static <T> void bindExtras(T target, Intent intent) { """ Bind annotated fields in the specified {@code target} from the {@link android.content.Intent}. @param target Target object to bind the extras. @param intent Intent containing the extras. """ @SuppressWarnings("unchecked") IntentBinding<T> binding = (IntentBinding<T>) getIntentBinding(target.getClass().getClassLoader(), target.getClass()); if (binding != null) { binding.bindExtras(target, intent); } }
java
public static <T> void bindExtras(T target, Intent intent) { @SuppressWarnings("unchecked") IntentBinding<T> binding = (IntentBinding<T>) getIntentBinding(target.getClass().getClassLoader(), target.getClass()); if (binding != null) { binding.bindExtras(target, intent); } }
[ "public", "static", "<", "T", ">", "void", "bindExtras", "(", "T", "target", ",", "Intent", "intent", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "IntentBinding", "<", "T", ">", "binding", "=", "(", "IntentBinding", "<", "T", ">", ")", "getIntentBinding", "(", "target", ".", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ",", "target", ".", "getClass", "(", ")", ")", ";", "if", "(", "binding", "!=", "null", ")", "{", "binding", ".", "bindExtras", "(", "target", ",", "intent", ")", ";", "}", "}" ]
Bind annotated fields in the specified {@code target} from the {@link android.content.Intent}. @param target Target object to bind the extras. @param intent Intent containing the extras.
[ "Bind", "annotated", "fields", "in", "the", "specified", "{", "@code", "target", "}", "from", "the", "{", "@link", "android", ".", "content", ".", "Intent", "}", "." ]
train
https://github.com/hansenji/pocketknife/blob/f225dd66bcafdd702f472a5c99be1fb48202e6ca/pocketknife/src/main/java/pocketknife/PocketKnife.java#L114-L120
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/SwingUtils.java
SwingUtils.getDescendantNamed
public static Component getDescendantNamed(String name, Component parent) { """ Does a pre-order search of a component with a given name. @param name the name. @param parent the root component in hierarchy. @return the found component (may be null). """ Assert.notNull(name, "name"); Assert.notNull(parent, "parent"); if (name.equals(parent.getName())) { // Base case return parent; } else if (parent instanceof Container) { // Recursive case for (final Component component : ((Container) parent).getComponents()) { final Component foundComponent = SwingUtils.getDescendantNamed(name, component); if (foundComponent != null) { return foundComponent; } } } return null; }
java
public static Component getDescendantNamed(String name, Component parent) { Assert.notNull(name, "name"); Assert.notNull(parent, "parent"); if (name.equals(parent.getName())) { // Base case return parent; } else if (parent instanceof Container) { // Recursive case for (final Component component : ((Container) parent).getComponents()) { final Component foundComponent = SwingUtils.getDescendantNamed(name, component); if (foundComponent != null) { return foundComponent; } } } return null; }
[ "public", "static", "Component", "getDescendantNamed", "(", "String", "name", ",", "Component", "parent", ")", "{", "Assert", ".", "notNull", "(", "name", ",", "\"name\"", ")", ";", "Assert", ".", "notNull", "(", "parent", ",", "\"parent\"", ")", ";", "if", "(", "name", ".", "equals", "(", "parent", ".", "getName", "(", ")", ")", ")", "{", "// Base case", "return", "parent", ";", "}", "else", "if", "(", "parent", "instanceof", "Container", ")", "{", "// Recursive case", "for", "(", "final", "Component", "component", ":", "(", "(", "Container", ")", "parent", ")", ".", "getComponents", "(", ")", ")", "{", "final", "Component", "foundComponent", "=", "SwingUtils", ".", "getDescendantNamed", "(", "name", ",", "component", ")", ";", "if", "(", "foundComponent", "!=", "null", ")", "{", "return", "foundComponent", ";", "}", "}", "}", "return", "null", ";", "}" ]
Does a pre-order search of a component with a given name. @param name the name. @param parent the root component in hierarchy. @return the found component (may be null).
[ "Does", "a", "pre", "-", "order", "search", "of", "a", "component", "with", "a", "given", "name", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/SwingUtils.java#L90-L109
JOML-CI/JOML
src/org/joml/Matrix3d.java
Matrix3d.rotateLocal
public Matrix3d rotateLocal(double ang, double x, double y, double z) { """ Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified <code>(x, y, z)</code> axis. <p> The axis described by the three components needs to be a unit vector. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotation(double, double, double, double) rotation()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotation(double, double, double, double) @param ang the angle in radians @param x the x component of the axis @param y the y component of the axis @param z the z component of the axis @return this """ return rotateLocal(ang, x, y, z, this); }
java
public Matrix3d rotateLocal(double ang, double x, double y, double z) { return rotateLocal(ang, x, y, z, this); }
[ "public", "Matrix3d", "rotateLocal", "(", "double", "ang", ",", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "return", "rotateLocal", "(", "ang", ",", "x", ",", "y", ",", "z", ",", "this", ")", ";", "}" ]
Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified <code>(x, y, z)</code> axis. <p> The axis described by the three components needs to be a unit vector. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotation(double, double, double, double) rotation()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotation(double, double, double, double) @param ang the angle in radians @param x the x component of the axis @param y the y component of the axis @param z the z component of the axis @return this
[ "Pre", "-", "multiply", "a", "rotation", "to", "this", "matrix", "by", "rotating", "the", "given", "amount", "of", "radians", "about", "the", "specified", "<code", ">", "(", "x", "y", "z", ")", "<", "/", "code", ">", "axis", ".", "<p", ">", "The", "axis", "described", "by", "the", "three", "components", "needs", "to", "be", "a", "unit", "vector", ".", "<p", ">", "When", "used", "with", "a", "right", "-", "handed", "coordinate", "system", "the", "produced", "rotation", "will", "rotate", "a", "vector", "counter", "-", "clockwise", "around", "the", "rotation", "axis", "when", "viewing", "along", "the", "negative", "axis", "direction", "towards", "the", "origin", ".", "When", "used", "with", "a", "left", "-", "handed", "coordinate", "system", "the", "rotation", "is", "clockwise", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "R<", "/", "code", ">", "the", "rotation", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "R", "*", "M<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "R", "*", "M", "*", "v<", "/", "code", ">", "the", "rotation", "will", "be", "applied", "last!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "a", "rotation", "matrix", "without", "pre", "-", "multiplying", "the", "rotation", "transformation", "use", "{", "@link", "#rotation", "(", "double", "double", "double", "double", ")", "rotation", "()", "}", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Rotation_matrix#Rotation_matrix_from_axis_and_angle", ">", "http", ":", "//", "en", ".", "wikipedia", ".", "org<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3d.java#L2652-L2654
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/sockets/SocketFactory.java
SocketFactory.createWebSocketAdapter
protected WebSocketAdapter createWebSocketAdapter(@NonNull final WeakReference<SocketStateListener> stateListenerWeakReference) { """ Create adapter for websocket library events. @param stateListenerWeakReference Listener for socket state changes. @return Adapter for websocket library events. """ return new WebSocketAdapter() { @Override public void onConnected(WebSocket websocket, Map<String, List<String>> headers) throws Exception { super.onConnected(websocket, headers); final SocketStateListener stateListener = stateListenerWeakReference.get(); if (stateListener != null) { stateListener.onConnected(); } } @Override public void onConnectError(WebSocket websocket, WebSocketException exception) throws Exception { super.onConnectError(websocket, exception); final SocketStateListener stateListener = stateListenerWeakReference.get(); if (stateListener != null) { stateListener.onError(uri.getRawPath(), proxyAddress, exception); } } @Override public void onDisconnected(WebSocket websocket, WebSocketFrame serverCloseFrame, WebSocketFrame clientCloseFrame, boolean closedByServer) throws Exception { super.onDisconnected(websocket, serverCloseFrame, clientCloseFrame, closedByServer); final SocketStateListener stateListener = stateListenerWeakReference.get(); if (stateListener != null) { stateListener.onDisconnected(); } } @Override public void onTextMessage(WebSocket websocket, String text) throws Exception { super.onTextMessage(websocket, text); log.d("Socket message received = " + text); messageListener.onMessage(text); } @Override public void onBinaryMessage(WebSocket websocket, byte[] binary) throws Exception { super.onBinaryMessage(websocket, binary); log.d("Socket binary message received."); } }; }
java
protected WebSocketAdapter createWebSocketAdapter(@NonNull final WeakReference<SocketStateListener> stateListenerWeakReference) { return new WebSocketAdapter() { @Override public void onConnected(WebSocket websocket, Map<String, List<String>> headers) throws Exception { super.onConnected(websocket, headers); final SocketStateListener stateListener = stateListenerWeakReference.get(); if (stateListener != null) { stateListener.onConnected(); } } @Override public void onConnectError(WebSocket websocket, WebSocketException exception) throws Exception { super.onConnectError(websocket, exception); final SocketStateListener stateListener = stateListenerWeakReference.get(); if (stateListener != null) { stateListener.onError(uri.getRawPath(), proxyAddress, exception); } } @Override public void onDisconnected(WebSocket websocket, WebSocketFrame serverCloseFrame, WebSocketFrame clientCloseFrame, boolean closedByServer) throws Exception { super.onDisconnected(websocket, serverCloseFrame, clientCloseFrame, closedByServer); final SocketStateListener stateListener = stateListenerWeakReference.get(); if (stateListener != null) { stateListener.onDisconnected(); } } @Override public void onTextMessage(WebSocket websocket, String text) throws Exception { super.onTextMessage(websocket, text); log.d("Socket message received = " + text); messageListener.onMessage(text); } @Override public void onBinaryMessage(WebSocket websocket, byte[] binary) throws Exception { super.onBinaryMessage(websocket, binary); log.d("Socket binary message received."); } }; }
[ "protected", "WebSocketAdapter", "createWebSocketAdapter", "(", "@", "NonNull", "final", "WeakReference", "<", "SocketStateListener", ">", "stateListenerWeakReference", ")", "{", "return", "new", "WebSocketAdapter", "(", ")", "{", "@", "Override", "public", "void", "onConnected", "(", "WebSocket", "websocket", ",", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "headers", ")", "throws", "Exception", "{", "super", ".", "onConnected", "(", "websocket", ",", "headers", ")", ";", "final", "SocketStateListener", "stateListener", "=", "stateListenerWeakReference", ".", "get", "(", ")", ";", "if", "(", "stateListener", "!=", "null", ")", "{", "stateListener", ".", "onConnected", "(", ")", ";", "}", "}", "@", "Override", "public", "void", "onConnectError", "(", "WebSocket", "websocket", ",", "WebSocketException", "exception", ")", "throws", "Exception", "{", "super", ".", "onConnectError", "(", "websocket", ",", "exception", ")", ";", "final", "SocketStateListener", "stateListener", "=", "stateListenerWeakReference", ".", "get", "(", ")", ";", "if", "(", "stateListener", "!=", "null", ")", "{", "stateListener", ".", "onError", "(", "uri", ".", "getRawPath", "(", ")", ",", "proxyAddress", ",", "exception", ")", ";", "}", "}", "@", "Override", "public", "void", "onDisconnected", "(", "WebSocket", "websocket", ",", "WebSocketFrame", "serverCloseFrame", ",", "WebSocketFrame", "clientCloseFrame", ",", "boolean", "closedByServer", ")", "throws", "Exception", "{", "super", ".", "onDisconnected", "(", "websocket", ",", "serverCloseFrame", ",", "clientCloseFrame", ",", "closedByServer", ")", ";", "final", "SocketStateListener", "stateListener", "=", "stateListenerWeakReference", ".", "get", "(", ")", ";", "if", "(", "stateListener", "!=", "null", ")", "{", "stateListener", ".", "onDisconnected", "(", ")", ";", "}", "}", "@", "Override", "public", "void", "onTextMessage", "(", "WebSocket", "websocket", ",", "String", "text", ")", "throws", "Exception", "{", "super", ".", "onTextMessage", "(", "websocket", ",", "text", ")", ";", "log", ".", "d", "(", "\"Socket message received = \"", "+", "text", ")", ";", "messageListener", ".", "onMessage", "(", "text", ")", ";", "}", "@", "Override", "public", "void", "onBinaryMessage", "(", "WebSocket", "websocket", ",", "byte", "[", "]", "binary", ")", "throws", "Exception", "{", "super", ".", "onBinaryMessage", "(", "websocket", ",", "binary", ")", ";", "log", ".", "d", "(", "\"Socket binary message received.\"", ")", ";", "}", "}", ";", "}" ]
Create adapter for websocket library events. @param stateListenerWeakReference Listener for socket state changes. @return Adapter for websocket library events.
[ "Create", "adapter", "for", "websocket", "library", "events", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/sockets/SocketFactory.java#L136-L180
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/Reflection.java
Reflection.findBestMethodWithSignature
public Method findBestMethodWithSignature( String methodName, Class<?>... argumentsClasses ) throws NoSuchMethodException, SecurityException { """ Find the best method on the target class that matches the signature specified with the specified name and the list of argument classes. This method first attempts to find the method with the specified argument classes; if no such method is found, a NoSuchMethodException is thrown. @param methodName the name of the method that is to be invoked. @param argumentsClasses the list of Class instances that correspond to the classes for each argument passed to the method. @return the Method object that references the method that satisfies the requirements, or null if no satisfactory method could be found. @throws NoSuchMethodException if a matching method is not found. @throws SecurityException if access to the information is denied. """ return findBestMethodWithSignature(methodName, true, argumentsClasses); }
java
public Method findBestMethodWithSignature( String methodName, Class<?>... argumentsClasses ) throws NoSuchMethodException, SecurityException { return findBestMethodWithSignature(methodName, true, argumentsClasses); }
[ "public", "Method", "findBestMethodWithSignature", "(", "String", "methodName", ",", "Class", "<", "?", ">", "...", "argumentsClasses", ")", "throws", "NoSuchMethodException", ",", "SecurityException", "{", "return", "findBestMethodWithSignature", "(", "methodName", ",", "true", ",", "argumentsClasses", ")", ";", "}" ]
Find the best method on the target class that matches the signature specified with the specified name and the list of argument classes. This method first attempts to find the method with the specified argument classes; if no such method is found, a NoSuchMethodException is thrown. @param methodName the name of the method that is to be invoked. @param argumentsClasses the list of Class instances that correspond to the classes for each argument passed to the method. @return the Method object that references the method that satisfies the requirements, or null if no satisfactory method could be found. @throws NoSuchMethodException if a matching method is not found. @throws SecurityException if access to the information is denied.
[ "Find", "the", "best", "method", "on", "the", "target", "class", "that", "matches", "the", "signature", "specified", "with", "the", "specified", "name", "and", "the", "list", "of", "argument", "classes", ".", "This", "method", "first", "attempts", "to", "find", "the", "method", "with", "the", "specified", "argument", "classes", ";", "if", "no", "such", "method", "is", "found", "a", "NoSuchMethodException", "is", "thrown", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/Reflection.java#L692-L696
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/host/controller/jvm/JvmType.java
JvmType.createFromJavaHome
public static JvmType createFromJavaHome(final String javaHome, boolean forLaunch) { """ Create a {@code JvmType} based on the location of the root dir of the JRE/JDK installation. @param javaHome the root dir of the JRE/JDK installation. Cannot be {@code null} or empty @param forLaunch {@code true} if the created object will be used for launching servers; {@code false} if it is simply a data holder. A value of {@code true} will disable some validity checks and may disable determining if the JVM is modular @return the {@code JvmType}. Will not return {@code null} @throws IllegalStateException if the {@code JvmType} cannot be determined. """ if (javaHome == null || javaHome.trim().equals("")) { throw HostControllerLogger.ROOT_LOGGER.invalidJavaHome(javaHome); } final File javaHomeDir = new File(javaHome); if (forLaunch && !javaHomeDir.exists()) { throw HostControllerLogger.ROOT_LOGGER.invalidJavaHome(javaHomeDir.getAbsolutePath()); } final File javaBinDir = new File(javaHomeDir, BIN_DIR); if (forLaunch && !javaBinDir.exists()) { throw HostControllerLogger.ROOT_LOGGER.invalidJavaHomeBin(javaBinDir.getAbsolutePath(), javaHomeDir.getAbsolutePath()); } final File javaExecutable = new File(javaBinDir, JAVA_EXECUTABLE); if (forLaunch && !javaExecutable.exists()) { throw HostControllerLogger.ROOT_LOGGER.cannotFindJavaExe(javaBinDir.getAbsolutePath()); } return new JvmType(forLaunch, isModularJvm(javaExecutable.getAbsolutePath(), forLaunch), javaExecutable.getAbsolutePath()); }
java
public static JvmType createFromJavaHome(final String javaHome, boolean forLaunch) { if (javaHome == null || javaHome.trim().equals("")) { throw HostControllerLogger.ROOT_LOGGER.invalidJavaHome(javaHome); } final File javaHomeDir = new File(javaHome); if (forLaunch && !javaHomeDir.exists()) { throw HostControllerLogger.ROOT_LOGGER.invalidJavaHome(javaHomeDir.getAbsolutePath()); } final File javaBinDir = new File(javaHomeDir, BIN_DIR); if (forLaunch && !javaBinDir.exists()) { throw HostControllerLogger.ROOT_LOGGER.invalidJavaHomeBin(javaBinDir.getAbsolutePath(), javaHomeDir.getAbsolutePath()); } final File javaExecutable = new File(javaBinDir, JAVA_EXECUTABLE); if (forLaunch && !javaExecutable.exists()) { throw HostControllerLogger.ROOT_LOGGER.cannotFindJavaExe(javaBinDir.getAbsolutePath()); } return new JvmType(forLaunch, isModularJvm(javaExecutable.getAbsolutePath(), forLaunch), javaExecutable.getAbsolutePath()); }
[ "public", "static", "JvmType", "createFromJavaHome", "(", "final", "String", "javaHome", ",", "boolean", "forLaunch", ")", "{", "if", "(", "javaHome", "==", "null", "||", "javaHome", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "throw", "HostControllerLogger", ".", "ROOT_LOGGER", ".", "invalidJavaHome", "(", "javaHome", ")", ";", "}", "final", "File", "javaHomeDir", "=", "new", "File", "(", "javaHome", ")", ";", "if", "(", "forLaunch", "&&", "!", "javaHomeDir", ".", "exists", "(", ")", ")", "{", "throw", "HostControllerLogger", ".", "ROOT_LOGGER", ".", "invalidJavaHome", "(", "javaHomeDir", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "final", "File", "javaBinDir", "=", "new", "File", "(", "javaHomeDir", ",", "BIN_DIR", ")", ";", "if", "(", "forLaunch", "&&", "!", "javaBinDir", ".", "exists", "(", ")", ")", "{", "throw", "HostControllerLogger", ".", "ROOT_LOGGER", ".", "invalidJavaHomeBin", "(", "javaBinDir", ".", "getAbsolutePath", "(", ")", ",", "javaHomeDir", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "final", "File", "javaExecutable", "=", "new", "File", "(", "javaBinDir", ",", "JAVA_EXECUTABLE", ")", ";", "if", "(", "forLaunch", "&&", "!", "javaExecutable", ".", "exists", "(", ")", ")", "{", "throw", "HostControllerLogger", ".", "ROOT_LOGGER", ".", "cannotFindJavaExe", "(", "javaBinDir", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "return", "new", "JvmType", "(", "forLaunch", ",", "isModularJvm", "(", "javaExecutable", ".", "getAbsolutePath", "(", ")", ",", "forLaunch", ")", ",", "javaExecutable", ".", "getAbsolutePath", "(", ")", ")", ";", "}" ]
Create a {@code JvmType} based on the location of the root dir of the JRE/JDK installation. @param javaHome the root dir of the JRE/JDK installation. Cannot be {@code null} or empty @param forLaunch {@code true} if the created object will be used for launching servers; {@code false} if it is simply a data holder. A value of {@code true} will disable some validity checks and may disable determining if the JVM is modular @return the {@code JvmType}. Will not return {@code null} @throws IllegalStateException if the {@code JvmType} cannot be determined.
[ "Create", "a", "{", "@code", "JvmType", "}", "based", "on", "the", "location", "of", "the", "root", "dir", "of", "the", "JRE", "/", "JDK", "installation", ".", "@param", "javaHome", "the", "root", "dir", "of", "the", "JRE", "/", "JDK", "installation", ".", "Cannot", "be", "{", "@code", "null", "}", "or", "empty", "@param", "forLaunch", "{", "@code", "true", "}", "if", "the", "created", "object", "will", "be", "used", "for", "launching", "servers", ";", "{", "@code", "false", "}", "if", "it", "is", "simply", "a", "data", "holder", ".", "A", "value", "of", "{", "@code", "true", "}", "will", "disable", "some", "validity", "checks", "and", "may", "disable", "determining", "if", "the", "JVM", "is", "modular", "@return", "the", "{", "@code", "JvmType", "}", ".", "Will", "not", "return", "{", "@code", "null", "}" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/jvm/JvmType.java#L106-L123
hellosign/hellosign-java-sdk
src/main/java/com/hellosign/sdk/resource/TemplateSignatureRequest.java
TemplateSignatureRequest.setCustomFieldValue
public void setCustomFieldValue(String fieldNameOrApiId, String value) { """ Adds the value to fill in for a custom field with the given field name. @param fieldNameOrApiId String name (or "Field Label") of the custom field to be filled in. The "api_id" can also be used instead of the name. @param value String value """ CustomField f = new CustomField(); f.setName(fieldNameOrApiId); f.setValue(value); customFields.add(f); }
java
public void setCustomFieldValue(String fieldNameOrApiId, String value) { CustomField f = new CustomField(); f.setName(fieldNameOrApiId); f.setValue(value); customFields.add(f); }
[ "public", "void", "setCustomFieldValue", "(", "String", "fieldNameOrApiId", ",", "String", "value", ")", "{", "CustomField", "f", "=", "new", "CustomField", "(", ")", ";", "f", ".", "setName", "(", "fieldNameOrApiId", ")", ";", "f", ".", "setValue", "(", "value", ")", ";", "customFields", ".", "add", "(", "f", ")", ";", "}" ]
Adds the value to fill in for a custom field with the given field name. @param fieldNameOrApiId String name (or "Field Label") of the custom field to be filled in. The "api_id" can also be used instead of the name. @param value String value
[ "Adds", "the", "value", "to", "fill", "in", "for", "a", "custom", "field", "with", "the", "given", "field", "name", "." ]
train
https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/resource/TemplateSignatureRequest.java#L202-L207
aws/aws-sdk-java
aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/DescribeSimulationApplicationResult.java
DescribeSimulationApplicationResult.withTags
public DescribeSimulationApplicationResult withTags(java.util.Map<String, String> tags) { """ <p> The list of all tags added to the specified simulation application. </p> @param tags The list of all tags added to the specified simulation application. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public DescribeSimulationApplicationResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "DescribeSimulationApplicationResult", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The list of all tags added to the specified simulation application. </p> @param tags The list of all tags added to the specified simulation application. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "list", "of", "all", "tags", "added", "to", "the", "specified", "simulation", "application", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/DescribeSimulationApplicationResult.java#L513-L516
lessthanoptimal/ddogleg
src/org/ddogleg/sorting/ApproximateSort_F32.java
ApproximateSort_F32.sortObject
public void sortObject( SortableParameter_F32 input[] , int start , int length ) { """ Sorts the input list @param input (Input) Data which is to be sorted. Not modified. @param start First element in input list @param length Length of the input list """ for( int i = 0; i < histIndexes.size; i++ ) { histObjs[i].reset(); } for( int i = 0; i < length; i++ ) { int indexInput = i+start; SortableParameter_F32 p = input[indexInput]; int discretized = (int)((p.sortValue-minValue)/divisor); histObjs[discretized].add(p); } // over wrist the input data with sorted elements int index = start; for( int i = 0; i < histIndexes.size; i++ ) { FastQueue<SortableParameter_F32> matches = histObjs[i]; for( int j = 0; j < matches.size; j++ ) { input[index++] = matches.data[j]; } } }
java
public void sortObject( SortableParameter_F32 input[] , int start , int length ) { for( int i = 0; i < histIndexes.size; i++ ) { histObjs[i].reset(); } for( int i = 0; i < length; i++ ) { int indexInput = i+start; SortableParameter_F32 p = input[indexInput]; int discretized = (int)((p.sortValue-minValue)/divisor); histObjs[discretized].add(p); } // over wrist the input data with sorted elements int index = start; for( int i = 0; i < histIndexes.size; i++ ) { FastQueue<SortableParameter_F32> matches = histObjs[i]; for( int j = 0; j < matches.size; j++ ) { input[index++] = matches.data[j]; } } }
[ "public", "void", "sortObject", "(", "SortableParameter_F32", "input", "[", "]", ",", "int", "start", ",", "int", "length", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "histIndexes", ".", "size", ";", "i", "++", ")", "{", "histObjs", "[", "i", "]", ".", "reset", "(", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "indexInput", "=", "i", "+", "start", ";", "SortableParameter_F32", "p", "=", "input", "[", "indexInput", "]", ";", "int", "discretized", "=", "(", "int", ")", "(", "(", "p", ".", "sortValue", "-", "minValue", ")", "/", "divisor", ")", ";", "histObjs", "[", "discretized", "]", ".", "add", "(", "p", ")", ";", "}", "// over wrist the input data with sorted elements", "int", "index", "=", "start", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "histIndexes", ".", "size", ";", "i", "++", ")", "{", "FastQueue", "<", "SortableParameter_F32", ">", "matches", "=", "histObjs", "[", "i", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "matches", ".", "size", ";", "j", "++", ")", "{", "input", "[", "index", "++", "]", "=", "matches", ".", "data", "[", "j", "]", ";", "}", "}", "}" ]
Sorts the input list @param input (Input) Data which is to be sorted. Not modified. @param start First element in input list @param length Length of the input list
[ "Sorts", "the", "input", "list" ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/sorting/ApproximateSort_F32.java#L155-L176
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/filesystem/PathAlterationObserver.java
PathAlterationObserver.checkAndNotify
private void checkAndNotify(final FileStatusEntry parent, final FileStatusEntry[] previous, final Path[] currentPaths) throws IOException { """ Compare two file lists for files which have been created, modified or deleted. @param parent The parent entry @param previous The original list of paths @param currentPaths The current list of paths """ int c = 0; final FileStatusEntry[] current = currentPaths.length > 0 ? new FileStatusEntry[currentPaths.length] : FileStatusEntry.EMPTY_ENTRIES; for (final FileStatusEntry previousEntry : previous) { while (c < currentPaths.length && comparator.compare(previousEntry.getPath(), currentPaths[c]) > 0) { current[c] = createPathEntry(parent, currentPaths[c]); doCreate(current[c]); c++; } if (c < currentPaths.length && comparator.compare(previousEntry.getPath(), currentPaths[c]) == 0) { doMatch(previousEntry, currentPaths[c]); checkAndNotify(previousEntry, previousEntry.getChildren(), listPaths(currentPaths[c])); current[c] = previousEntry; c++; } else { checkAndNotify(previousEntry, previousEntry.getChildren(), EMPTY_PATH_ARRAY); doDelete(previousEntry); } } for (; c < currentPaths.length; c++) { current[c] = createPathEntry(parent, currentPaths[c]); doCreate(current[c]); } parent.setChildren(current); }
java
private void checkAndNotify(final FileStatusEntry parent, final FileStatusEntry[] previous, final Path[] currentPaths) throws IOException { int c = 0; final FileStatusEntry[] current = currentPaths.length > 0 ? new FileStatusEntry[currentPaths.length] : FileStatusEntry.EMPTY_ENTRIES; for (final FileStatusEntry previousEntry : previous) { while (c < currentPaths.length && comparator.compare(previousEntry.getPath(), currentPaths[c]) > 0) { current[c] = createPathEntry(parent, currentPaths[c]); doCreate(current[c]); c++; } if (c < currentPaths.length && comparator.compare(previousEntry.getPath(), currentPaths[c]) == 0) { doMatch(previousEntry, currentPaths[c]); checkAndNotify(previousEntry, previousEntry.getChildren(), listPaths(currentPaths[c])); current[c] = previousEntry; c++; } else { checkAndNotify(previousEntry, previousEntry.getChildren(), EMPTY_PATH_ARRAY); doDelete(previousEntry); } } for (; c < currentPaths.length; c++) { current[c] = createPathEntry(parent, currentPaths[c]); doCreate(current[c]); } parent.setChildren(current); }
[ "private", "void", "checkAndNotify", "(", "final", "FileStatusEntry", "parent", ",", "final", "FileStatusEntry", "[", "]", "previous", ",", "final", "Path", "[", "]", "currentPaths", ")", "throws", "IOException", "{", "int", "c", "=", "0", ";", "final", "FileStatusEntry", "[", "]", "current", "=", "currentPaths", ".", "length", ">", "0", "?", "new", "FileStatusEntry", "[", "currentPaths", ".", "length", "]", ":", "FileStatusEntry", ".", "EMPTY_ENTRIES", ";", "for", "(", "final", "FileStatusEntry", "previousEntry", ":", "previous", ")", "{", "while", "(", "c", "<", "currentPaths", ".", "length", "&&", "comparator", ".", "compare", "(", "previousEntry", ".", "getPath", "(", ")", ",", "currentPaths", "[", "c", "]", ")", ">", "0", ")", "{", "current", "[", "c", "]", "=", "createPathEntry", "(", "parent", ",", "currentPaths", "[", "c", "]", ")", ";", "doCreate", "(", "current", "[", "c", "]", ")", ";", "c", "++", ";", "}", "if", "(", "c", "<", "currentPaths", ".", "length", "&&", "comparator", ".", "compare", "(", "previousEntry", ".", "getPath", "(", ")", ",", "currentPaths", "[", "c", "]", ")", "==", "0", ")", "{", "doMatch", "(", "previousEntry", ",", "currentPaths", "[", "c", "]", ")", ";", "checkAndNotify", "(", "previousEntry", ",", "previousEntry", ".", "getChildren", "(", ")", ",", "listPaths", "(", "currentPaths", "[", "c", "]", ")", ")", ";", "current", "[", "c", "]", "=", "previousEntry", ";", "c", "++", ";", "}", "else", "{", "checkAndNotify", "(", "previousEntry", ",", "previousEntry", ".", "getChildren", "(", ")", ",", "EMPTY_PATH_ARRAY", ")", ";", "doDelete", "(", "previousEntry", ")", ";", "}", "}", "for", "(", ";", "c", "<", "currentPaths", ".", "length", ";", "c", "++", ")", "{", "current", "[", "c", "]", "=", "createPathEntry", "(", "parent", ",", "currentPaths", "[", "c", "]", ")", ";", "doCreate", "(", "current", "[", "c", "]", ")", ";", "}", "parent", ".", "setChildren", "(", "current", ")", ";", "}" ]
Compare two file lists for files which have been created, modified or deleted. @param parent The parent entry @param previous The original list of paths @param currentPaths The current list of paths
[ "Compare", "two", "file", "lists", "for", "files", "which", "have", "been", "created", "modified", "or", "deleted", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/filesystem/PathAlterationObserver.java#L201-L229
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.perspectiveRect
public Matrix4f perspectiveRect(float width, float height, float zNear, float zFar, boolean zZeroToOne) { """ Apply a symmetric perspective projection frustum transformation using for a right-handed coordinate system the given NDC z range to this matrix. <p> If <code>M</code> is <code>this</code> matrix and <code>P</code> the perspective projection matrix, then the new matrix will be <code>M * P</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * P * v</code>, the perspective projection will be applied first! <p> In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveRect(float, float, float, float, boolean) setPerspectiveRect}. @see #setPerspectiveRect(float, float, float, float, boolean) @param width the width of the near frustum plane @param height the height of the near frustum plane @param zNear near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}. @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return a matrix holding the result """ return perspectiveRect(width, height, zNear, zFar, zZeroToOne, thisOrNew()); }
java
public Matrix4f perspectiveRect(float width, float height, float zNear, float zFar, boolean zZeroToOne) { return perspectiveRect(width, height, zNear, zFar, zZeroToOne, thisOrNew()); }
[ "public", "Matrix4f", "perspectiveRect", "(", "float", "width", ",", "float", "height", ",", "float", "zNear", ",", "float", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "return", "perspectiveRect", "(", "width", ",", "height", ",", "zNear", ",", "zFar", ",", "zZeroToOne", ",", "thisOrNew", "(", ")", ")", ";", "}" ]
Apply a symmetric perspective projection frustum transformation using for a right-handed coordinate system the given NDC z range to this matrix. <p> If <code>M</code> is <code>this</code> matrix and <code>P</code> the perspective projection matrix, then the new matrix will be <code>M * P</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * P * v</code>, the perspective projection will be applied first! <p> In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveRect(float, float, float, float, boolean) setPerspectiveRect}. @see #setPerspectiveRect(float, float, float, float, boolean) @param width the width of the near frustum plane @param height the height of the near frustum plane @param zNear near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}. @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return a matrix holding the result
[ "Apply", "a", "symmetric", "perspective", "projection", "frustum", "transformation", "using", "for", "a", "right", "-", "handed", "coordinate", "system", "the", "given", "NDC", "z", "range", "to", "this", "matrix", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "P<", "/", "code", ">", "the", "perspective", "projection", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "P<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "P", "*", "v<", "/", "code", ">", "the", "perspective", "projection", "will", "be", "applied", "first!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "a", "perspective", "frustum", "transformation", "without", "post", "-", "multiplying", "use", "{", "@link", "#setPerspectiveRect", "(", "float", "float", "float", "float", "boolean", ")", "setPerspectiveRect", "}", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L9535-L9537
Azure/azure-sdk-for-java
notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java
NotificationHubsInner.getPnsCredentials
public PnsCredentialsResourceInner getPnsCredentials(String resourceGroupName, String namespaceName, String notificationHubName) { """ Lists the PNS Credentials associated with a notification hub . @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param notificationHubName The notification hub name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PnsCredentialsResourceInner object if successful. """ return getPnsCredentialsWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName).toBlocking().single().body(); }
java
public PnsCredentialsResourceInner getPnsCredentials(String resourceGroupName, String namespaceName, String notificationHubName) { return getPnsCredentialsWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName).toBlocking().single().body(); }
[ "public", "PnsCredentialsResourceInner", "getPnsCredentials", "(", "String", "resourceGroupName", ",", "String", "namespaceName", ",", "String", "notificationHubName", ")", "{", "return", "getPnsCredentialsWithServiceResponseAsync", "(", "resourceGroupName", ",", "namespaceName", ",", "notificationHubName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Lists the PNS Credentials associated with a notification hub . @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param notificationHubName The notification hub name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PnsCredentialsResourceInner object if successful.
[ "Lists", "the", "PNS", "Credentials", "associated", "with", "a", "notification", "hub", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java#L1765-L1767
sematext/ActionGenerator
ag-player-es/src/main/java/com/sematext/ag/es/util/JSONUtils.java
JSONUtils.getElasticSearchAddDocument
public static String getElasticSearchAddDocument(Map<String, String> values) { """ Returns ElasticSearch add command. @param values values to include @return XML as String """ StringBuilder builder = new StringBuilder(); builder.append("{"); boolean first = true; for (Map.Entry<String, String> pair : values.entrySet()) { if (!first) { builder.append(","); } JSONUtils.addElasticSearchField(builder, pair); first = false; } builder.append("}"); return builder.toString(); }
java
public static String getElasticSearchAddDocument(Map<String, String> values) { StringBuilder builder = new StringBuilder(); builder.append("{"); boolean first = true; for (Map.Entry<String, String> pair : values.entrySet()) { if (!first) { builder.append(","); } JSONUtils.addElasticSearchField(builder, pair); first = false; } builder.append("}"); return builder.toString(); }
[ "public", "static", "String", "getElasticSearchAddDocument", "(", "Map", "<", "String", ",", "String", ">", "values", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "builder", ".", "append", "(", "\"{\"", ")", ";", "boolean", "first", "=", "true", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "pair", ":", "values", ".", "entrySet", "(", ")", ")", "{", "if", "(", "!", "first", ")", "{", "builder", ".", "append", "(", "\",\"", ")", ";", "}", "JSONUtils", ".", "addElasticSearchField", "(", "builder", ",", "pair", ")", ";", "first", "=", "false", ";", "}", "builder", ".", "append", "(", "\"}\"", ")", ";", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Returns ElasticSearch add command. @param values values to include @return XML as String
[ "Returns", "ElasticSearch", "add", "command", "." ]
train
https://github.com/sematext/ActionGenerator/blob/10f4a3e680f20d7d151f5d40e6758aeb072d474f/ag-player-es/src/main/java/com/sematext/ag/es/util/JSONUtils.java#L39-L52
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/form/FormErrorList.java
FormErrorList.addFieldWarning
public void addFieldWarning (@Nonnull @Nonempty final String sFieldName, @Nonnull @Nonempty final String sText) { """ Add a field specific warning message. @param sFieldName The field name for which the message is to be recorded. May neither be <code>null</code> nor empty. @param sText The text to use. May neither be <code>null</code> nor empty. """ add (SingleError.builderWarn ().setErrorFieldName (sFieldName).setErrorText (sText).build ()); }
java
public void addFieldWarning (@Nonnull @Nonempty final String sFieldName, @Nonnull @Nonempty final String sText) { add (SingleError.builderWarn ().setErrorFieldName (sFieldName).setErrorText (sText).build ()); }
[ "public", "void", "addFieldWarning", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sFieldName", ",", "@", "Nonnull", "@", "Nonempty", "final", "String", "sText", ")", "{", "add", "(", "SingleError", ".", "builderWarn", "(", ")", ".", "setErrorFieldName", "(", "sFieldName", ")", ".", "setErrorText", "(", "sText", ")", ".", "build", "(", ")", ")", ";", "}" ]
Add a field specific warning message. @param sFieldName The field name for which the message is to be recorded. May neither be <code>null</code> nor empty. @param sText The text to use. May neither be <code>null</code> nor empty.
[ "Add", "a", "field", "specific", "warning", "message", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/form/FormErrorList.java#L66-L69
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java
SVGPath.moveTo
public SVGPath moveTo(double x, double y) { """ Move to the given coordinates. @param x new coordinates @param y new coordinates @return path object, for compact syntax. """ return append(PATH_MOVE).append(x).append(y); }
java
public SVGPath moveTo(double x, double y) { return append(PATH_MOVE).append(x).append(y); }
[ "public", "SVGPath", "moveTo", "(", "double", "x", ",", "double", "y", ")", "{", "return", "append", "(", "PATH_MOVE", ")", ".", "append", "(", "x", ")", ".", "append", "(", "y", ")", ";", "}" ]
Move to the given coordinates. @param x new coordinates @param y new coordinates @return path object, for compact syntax.
[ "Move", "to", "the", "given", "coordinates", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L311-L313
diffplug/durian
src/com/diffplug/common/base/MoreCollectors.java
MoreCollectors.singleOrEmpty
public static <T> Collector<T, ?, Optional<T>> singleOrEmpty() { """ Collector which traverses a stream and returns either a single element (if there was only one element) or empty (if there were 0 or more than 1 elements). It traverses the entire stream, even if two elements have been encountered and the empty return value is now certain. <p> Implementation credit to Misha <a href="http://stackoverflow.com/a/26812693/1153071">on StackOverflow</a>. """ return Collectors.collectingAndThen(Collectors.toList(), lst -> lst.size() == 1 ? Optional.of(lst.get(0)) : Optional.empty()); }
java
public static <T> Collector<T, ?, Optional<T>> singleOrEmpty() { return Collectors.collectingAndThen(Collectors.toList(), lst -> lst.size() == 1 ? Optional.of(lst.get(0)) : Optional.empty()); }
[ "public", "static", "<", "T", ">", "Collector", "<", "T", ",", "?", ",", "Optional", "<", "T", ">", ">", "singleOrEmpty", "(", ")", "{", "return", "Collectors", ".", "collectingAndThen", "(", "Collectors", ".", "toList", "(", ")", ",", "lst", "->", "lst", ".", "size", "(", ")", "==", "1", "?", "Optional", ".", "of", "(", "lst", ".", "get", "(", "0", ")", ")", ":", "Optional", ".", "empty", "(", ")", ")", ";", "}" ]
Collector which traverses a stream and returns either a single element (if there was only one element) or empty (if there were 0 or more than 1 elements). It traverses the entire stream, even if two elements have been encountered and the empty return value is now certain. <p> Implementation credit to Misha <a href="http://stackoverflow.com/a/26812693/1153071">on StackOverflow</a>.
[ "Collector", "which", "traverses", "a", "stream", "and", "returns", "either", "a", "single", "element", "(", "if", "there", "was", "only", "one", "element", ")", "or", "empty", "(", "if", "there", "were", "0", "or", "more", "than", "1", "elements", ")", ".", "It", "traverses", "the", "entire", "stream", "even", "if", "two", "elements", "have", "been", "encountered", "and", "the", "empty", "return", "value", "is", "now", "certain", ".", "<p", ">", "Implementation", "credit", "to", "Misha", "<a", "href", "=", "http", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "26812693", "/", "1153071", ">", "on", "StackOverflow<", "/", "a", ">", "." ]
train
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/MoreCollectors.java#L34-L37
anotheria/moskito
moskito-core/src/main/java/net/anotheria/moskito/core/plugins/PluginRepository.java
PluginRepository.addPlugin
public void addPlugin(String name, MoskitoPlugin plugin, PluginConfig config) { """ Adds a new loaded plugin. @param name name of the plugin for ui. @param plugin the plugin instance. @param config plugin config which was used to load the plugin. """ plugins.put(name, plugin); try{ plugin.initialize(); configs.put(name, config); }catch(Exception e){ log.warn("couldn't initialize plugin "+name+" - "+plugin+", removing", e); plugins.remove(name); } }
java
public void addPlugin(String name, MoskitoPlugin plugin, PluginConfig config){ plugins.put(name, plugin); try{ plugin.initialize(); configs.put(name, config); }catch(Exception e){ log.warn("couldn't initialize plugin "+name+" - "+plugin+", removing", e); plugins.remove(name); } }
[ "public", "void", "addPlugin", "(", "String", "name", ",", "MoskitoPlugin", "plugin", ",", "PluginConfig", "config", ")", "{", "plugins", ".", "put", "(", "name", ",", "plugin", ")", ";", "try", "{", "plugin", ".", "initialize", "(", ")", ";", "configs", ".", "put", "(", "name", ",", "config", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "warn", "(", "\"couldn't initialize plugin \"", "+", "name", "+", "\" - \"", "+", "plugin", "+", "\", removing\"", ",", "e", ")", ";", "plugins", ".", "remove", "(", "name", ")", ";", "}", "}" ]
Adds a new loaded plugin. @param name name of the plugin for ui. @param plugin the plugin instance. @param config plugin config which was used to load the plugin.
[ "Adds", "a", "new", "loaded", "plugin", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/plugins/PluginRepository.java#L82-L91
josueeduardo/snappy
plugin-parent/snappy-loader/src/main/java/io/joshworks/snappy/loader/jar/JarEntryData.java
JarEntryData.decodeMsDosFormatDateTime
private Calendar decodeMsDosFormatDateTime(long date, long time) { """ Decode MS-DOS Date Time details. See <a href="http://mindprod.com/jgloss/zip.html">mindprod.com/jgloss/zip.html</a> for more details of the format. @param date the date part @param time the time part @return a {@link Calendar} containing the decoded date. """ int year = (int) ((date >> 9) & 0x7F) + 1980; int month = (int) ((date >> 5) & 0xF) - 1; int day = (int) (date & 0x1F); int hours = (int) ((time >> 11) & 0x1F); int minutes = (int) ((time >> 5) & 0x3F); int seconds = (int) ((time << 1) & 0x3E); return new GregorianCalendar(year, month, day, hours, minutes, seconds); }
java
private Calendar decodeMsDosFormatDateTime(long date, long time) { int year = (int) ((date >> 9) & 0x7F) + 1980; int month = (int) ((date >> 5) & 0xF) - 1; int day = (int) (date & 0x1F); int hours = (int) ((time >> 11) & 0x1F); int minutes = (int) ((time >> 5) & 0x3F); int seconds = (int) ((time << 1) & 0x3E); return new GregorianCalendar(year, month, day, hours, minutes, seconds); }
[ "private", "Calendar", "decodeMsDosFormatDateTime", "(", "long", "date", ",", "long", "time", ")", "{", "int", "year", "=", "(", "int", ")", "(", "(", "date", ">>", "9", ")", "&", "0x7F", ")", "+", "1980", ";", "int", "month", "=", "(", "int", ")", "(", "(", "date", ">>", "5", ")", "&", "0xF", ")", "-", "1", ";", "int", "day", "=", "(", "int", ")", "(", "date", "&", "0x1F", ")", ";", "int", "hours", "=", "(", "int", ")", "(", "(", "time", ">>", "11", ")", "&", "0x1F", ")", ";", "int", "minutes", "=", "(", "int", ")", "(", "(", "time", ">>", "5", ")", "&", "0x3F", ")", ";", "int", "seconds", "=", "(", "int", ")", "(", "(", "time", "<<", "1", ")", "&", "0x3E", ")", ";", "return", "new", "GregorianCalendar", "(", "year", ",", "month", ",", "day", ",", "hours", ",", "minutes", ",", "seconds", ")", ";", "}" ]
Decode MS-DOS Date Time details. See <a href="http://mindprod.com/jgloss/zip.html">mindprod.com/jgloss/zip.html</a> for more details of the format. @param date the date part @param time the time part @return a {@link Calendar} containing the decoded date.
[ "Decode", "MS", "-", "DOS", "Date", "Time", "details", ".", "See", "<a", "href", "=", "http", ":", "//", "mindprod", ".", "com", "/", "jgloss", "/", "zip", ".", "html", ">", "mindprod", ".", "com", "/", "jgloss", "/", "zip", ".", "html<", "/", "a", ">", "for", "more", "details", "of", "the", "format", "." ]
train
https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/plugin-parent/snappy-loader/src/main/java/io/joshworks/snappy/loader/jar/JarEntryData.java#L176-L184
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.requiredStringAttribute
public static String requiredStringAttribute(final XMLStreamReader reader, final String localName) throws XMLStreamException { """ Returns the value of an attribute as a String. If the attribute is empty, this method throws an exception. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @return value of attribute as String @throws XMLStreamException if attribute is empty. """ return requiredStringAttribute(reader, null, localName); }
java
public static String requiredStringAttribute(final XMLStreamReader reader, final String localName) throws XMLStreamException { return requiredStringAttribute(reader, null, localName); }
[ "public", "static", "String", "requiredStringAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "localName", ")", "throws", "XMLStreamException", "{", "return", "requiredStringAttribute", "(", "reader", ",", "null", ",", "localName", ")", ";", "}" ]
Returns the value of an attribute as a String. If the attribute is empty, this method throws an exception. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @return value of attribute as String @throws XMLStreamException if attribute is empty.
[ "Returns", "the", "value", "of", "an", "attribute", "as", "a", "String", ".", "If", "the", "attribute", "is", "empty", "this", "method", "throws", "an", "exception", "." ]
train
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L1346-L1349
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/DefaultMappableValidator.java
DefaultMappableValidator.processRule
private void processRule(final Rule<RI, RO> rule, final RI data) { """ Processes the specified rule by finding all the mapped results handlers, checking the rule and processing the rule result using all found result handlers. @param rule Rule to be processed. @param data Data to be checked against the rule. """ // Get result handlers matching the rule final List<ResultHandler<RO>> mappedResultHandlers = rulesToResultHandlers.get(rule); if ((mappedResultHandlers == null) || mappedResultHandlers.isEmpty()) { LOGGER.warn("No matching result handler in mappable validator for rule: " + rule); } else { // Check rule final RO result = rule.validate(data); // Process result with all matching result handlers for (final ResultHandler<RO> resultHandler : mappedResultHandlers) { processResultHandler(resultHandler, result); } } }
java
private void processRule(final Rule<RI, RO> rule, final RI data) { // Get result handlers matching the rule final List<ResultHandler<RO>> mappedResultHandlers = rulesToResultHandlers.get(rule); if ((mappedResultHandlers == null) || mappedResultHandlers.isEmpty()) { LOGGER.warn("No matching result handler in mappable validator for rule: " + rule); } else { // Check rule final RO result = rule.validate(data); // Process result with all matching result handlers for (final ResultHandler<RO> resultHandler : mappedResultHandlers) { processResultHandler(resultHandler, result); } } }
[ "private", "void", "processRule", "(", "final", "Rule", "<", "RI", ",", "RO", ">", "rule", ",", "final", "RI", "data", ")", "{", "// Get result handlers matching the rule", "final", "List", "<", "ResultHandler", "<", "RO", ">", ">", "mappedResultHandlers", "=", "rulesToResultHandlers", ".", "get", "(", "rule", ")", ";", "if", "(", "(", "mappedResultHandlers", "==", "null", ")", "||", "mappedResultHandlers", ".", "isEmpty", "(", ")", ")", "{", "LOGGER", ".", "warn", "(", "\"No matching result handler in mappable validator for rule: \"", "+", "rule", ")", ";", "}", "else", "{", "// Check rule", "final", "RO", "result", "=", "rule", ".", "validate", "(", "data", ")", ";", "// Process result with all matching result handlers", "for", "(", "final", "ResultHandler", "<", "RO", ">", "resultHandler", ":", "mappedResultHandlers", ")", "{", "processResultHandler", "(", "resultHandler", ",", "result", ")", ";", "}", "}", "}" ]
Processes the specified rule by finding all the mapped results handlers, checking the rule and processing the rule result using all found result handlers. @param rule Rule to be processed. @param data Data to be checked against the rule.
[ "Processes", "the", "specified", "rule", "by", "finding", "all", "the", "mapped", "results", "handlers", "checking", "the", "rule", "and", "processing", "the", "rule", "result", "using", "all", "found", "result", "handlers", "." ]
train
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/DefaultMappableValidator.java#L110-L124
jtmelton/appsensor
execution-modes/appsensor-ws-rest-server/src/main/java/org/owasp/appsensor/rest/AccessControlUtils.java
AccessControlUtils.checkAuthorization
public void checkAuthorization(Action action, ContainerRequestContext requestContext) throws NotAuthorizedException { """ Check authz before performing action. @param action desired action @throws NotAuthorizedException thrown if user does not have role. """ String clientApplicationName = (String)requestContext.getProperty(RequestHandler.APPSENSOR_CLIENT_APPLICATION_IDENTIFIER_ATTR); ClientApplication clientApplication = appSensorServer.getConfiguration().findClientApplication(clientApplicationName); appSensorServer.getAccessController().assertAuthorized(clientApplication, action, new Context()); }
java
public void checkAuthorization(Action action, ContainerRequestContext requestContext) throws NotAuthorizedException { String clientApplicationName = (String)requestContext.getProperty(RequestHandler.APPSENSOR_CLIENT_APPLICATION_IDENTIFIER_ATTR); ClientApplication clientApplication = appSensorServer.getConfiguration().findClientApplication(clientApplicationName); appSensorServer.getAccessController().assertAuthorized(clientApplication, action, new Context()); }
[ "public", "void", "checkAuthorization", "(", "Action", "action", ",", "ContainerRequestContext", "requestContext", ")", "throws", "NotAuthorizedException", "{", "String", "clientApplicationName", "=", "(", "String", ")", "requestContext", ".", "getProperty", "(", "RequestHandler", ".", "APPSENSOR_CLIENT_APPLICATION_IDENTIFIER_ATTR", ")", ";", "ClientApplication", "clientApplication", "=", "appSensorServer", ".", "getConfiguration", "(", ")", ".", "findClientApplication", "(", "clientApplicationName", ")", ";", "appSensorServer", ".", "getAccessController", "(", ")", ".", "assertAuthorized", "(", "clientApplication", ",", "action", ",", "new", "Context", "(", ")", ")", ";", "}" ]
Check authz before performing action. @param action desired action @throws NotAuthorizedException thrown if user does not have role.
[ "Check", "authz", "before", "performing", "action", "." ]
train
https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/execution-modes/appsensor-ws-rest-server/src/main/java/org/owasp/appsensor/rest/AccessControlUtils.java#L32-L38
duracloud/duracloud
durastore/src/main/java/org/duracloud/durastore/rest/SpaceRest.java
SpaceRest.getSpaceACLs
@Path("/acl/ { """ see SpaceResource.getSpaceACLs(String, String); @return 200 response with space ACLs included as header values """spaceID}") @HEAD public Response getSpaceACLs(@PathParam("spaceID") String spaceID, @QueryParam("storeID") String storeID) { String msg = "getting space ACLs(" + spaceID + ", " + storeID + ")"; try { log.debug(msg); return addSpaceACLsToResponse(Response.ok(), spaceID, storeID); } catch (ResourceNotFoundException e) { return responseNotFound(msg, e, NOT_FOUND); } catch (ResourceException e) { return responseBad(msg, e, INTERNAL_SERVER_ERROR); } catch (Exception e) { return responseBad(msg, e, INTERNAL_SERVER_ERROR); } }
java
@Path("/acl/{spaceID}") @HEAD public Response getSpaceACLs(@PathParam("spaceID") String spaceID, @QueryParam("storeID") String storeID) { String msg = "getting space ACLs(" + spaceID + ", " + storeID + ")"; try { log.debug(msg); return addSpaceACLsToResponse(Response.ok(), spaceID, storeID); } catch (ResourceNotFoundException e) { return responseNotFound(msg, e, NOT_FOUND); } catch (ResourceException e) { return responseBad(msg, e, INTERNAL_SERVER_ERROR); } catch (Exception e) { return responseBad(msg, e, INTERNAL_SERVER_ERROR); } }
[ "@", "Path", "(", "\"/acl/{spaceID}\"", ")", "@", "HEAD", "public", "Response", "getSpaceACLs", "(", "@", "PathParam", "(", "\"spaceID\"", ")", "String", "spaceID", ",", "@", "QueryParam", "(", "\"storeID\"", ")", "String", "storeID", ")", "{", "String", "msg", "=", "\"getting space ACLs(\"", "+", "spaceID", "+", "\", \"", "+", "storeID", "+", "\")\"", ";", "try", "{", "log", ".", "debug", "(", "msg", ")", ";", "return", "addSpaceACLsToResponse", "(", "Response", ".", "ok", "(", ")", ",", "spaceID", ",", "storeID", ")", ";", "}", "catch", "(", "ResourceNotFoundException", "e", ")", "{", "return", "responseNotFound", "(", "msg", ",", "e", ",", "NOT_FOUND", ")", ";", "}", "catch", "(", "ResourceException", "e", ")", "{", "return", "responseBad", "(", "msg", ",", "e", ",", "INTERNAL_SERVER_ERROR", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "responseBad", "(", "msg", ",", "e", ",", "INTERNAL_SERVER_ERROR", ")", ";", "}", "}" ]
see SpaceResource.getSpaceACLs(String, String); @return 200 response with space ACLs included as header values
[ "see", "SpaceResource", ".", "getSpaceACLs", "(", "String", "String", ")", ";" ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/durastore/src/main/java/org/duracloud/durastore/rest/SpaceRest.java#L194-L213
Metatavu/edelphi
rest/src/main/java/fi/metatavu/edelphi/rest/AbstractApi.java
AbstractApi.streamResponse
protected Response streamResponse(String type, InputStream inputStream, int contentLength) { """ Creates streamed response from input stream @param inputStream data @param type content type @param contentLength content length @return Response """ return Response.ok(new StreamingOutputImpl(inputStream), type) .header("Content-Length", contentLength) .build(); }
java
protected Response streamResponse(String type, InputStream inputStream, int contentLength) { return Response.ok(new StreamingOutputImpl(inputStream), type) .header("Content-Length", contentLength) .build(); }
[ "protected", "Response", "streamResponse", "(", "String", "type", ",", "InputStream", "inputStream", ",", "int", "contentLength", ")", "{", "return", "Response", ".", "ok", "(", "new", "StreamingOutputImpl", "(", "inputStream", ")", ",", "type", ")", ".", "header", "(", "\"Content-Length\"", ",", "contentLength", ")", ".", "build", "(", ")", ";", "}" ]
Creates streamed response from input stream @param inputStream data @param type content type @param contentLength content length @return Response
[ "Creates", "streamed", "response", "from", "input", "stream" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/rest/src/main/java/fi/metatavu/edelphi/rest/AbstractApi.java#L177-L181
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.getPropFunctionAndThis
public static Callable getPropFunctionAndThis(Object obj, String property, Context cx, Scriptable scope) { """ Prepare for calling obj.property(...): return function corresponding to obj.property and make obj properly converted to Scriptable available as ScriptRuntime.lastStoredScriptable() for consumption as thisObj. The caller must call ScriptRuntime.lastStoredScriptable() immediately after calling this method. """ Scriptable thisObj = toObjectOrNull(cx, obj, scope); return getPropFunctionAndThisHelper(obj, property, cx, thisObj); }
java
public static Callable getPropFunctionAndThis(Object obj, String property, Context cx, Scriptable scope) { Scriptable thisObj = toObjectOrNull(cx, obj, scope); return getPropFunctionAndThisHelper(obj, property, cx, thisObj); }
[ "public", "static", "Callable", "getPropFunctionAndThis", "(", "Object", "obj", ",", "String", "property", ",", "Context", "cx", ",", "Scriptable", "scope", ")", "{", "Scriptable", "thisObj", "=", "toObjectOrNull", "(", "cx", ",", "obj", ",", "scope", ")", ";", "return", "getPropFunctionAndThisHelper", "(", "obj", ",", "property", ",", "cx", ",", "thisObj", ")", ";", "}" ]
Prepare for calling obj.property(...): return function corresponding to obj.property and make obj properly converted to Scriptable available as ScriptRuntime.lastStoredScriptable() for consumption as thisObj. The caller must call ScriptRuntime.lastStoredScriptable() immediately after calling this method.
[ "Prepare", "for", "calling", "obj", ".", "property", "(", "...", ")", ":", "return", "function", "corresponding", "to", "obj", ".", "property", "and", "make", "obj", "properly", "converted", "to", "Scriptable", "available", "as", "ScriptRuntime", ".", "lastStoredScriptable", "()", "for", "consumption", "as", "thisObj", ".", "The", "caller", "must", "call", "ScriptRuntime", ".", "lastStoredScriptable", "()", "immediately", "after", "calling", "this", "method", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L2557-L2563
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuGraphAddDependencies
public static int cuGraphAddDependencies(CUgraph hGraph, CUgraphNode from[], CUgraphNode to[], long numDependencies) { """ Adds dependency edges to a graph.<br> <br> The number of dependencies to be added is defined by \p numDependencies Elements in \p from and \p to at corresponding indices define a dependency. Each node in \p from and \p to must belong to \p hGraph.<br> <br> If \p numDependencies is 0, elements in \p from and \p to will be ignored. Specifying an existing dependency will return an error.<br> @param hGraph - Graph to which dependencies are added @param from - Array of nodes that provide the dependencies @param to - Array of dependent nodes @param numDependencies - Number of dependencies to be added @return CUDA_SUCCESS, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuGraphRemoveDependencies JCudaDriver#cuGraphGetEdges JCudaDriver#cuGraphNodeGetDependencies JCudaDriver#cuGraphNodeGetDependentNodes """ return checkResult(cuGraphAddDependenciesNative(hGraph, from, to, numDependencies)); }
java
public static int cuGraphAddDependencies(CUgraph hGraph, CUgraphNode from[], CUgraphNode to[], long numDependencies) { return checkResult(cuGraphAddDependenciesNative(hGraph, from, to, numDependencies)); }
[ "public", "static", "int", "cuGraphAddDependencies", "(", "CUgraph", "hGraph", ",", "CUgraphNode", "from", "[", "]", ",", "CUgraphNode", "to", "[", "]", ",", "long", "numDependencies", ")", "{", "return", "checkResult", "(", "cuGraphAddDependenciesNative", "(", "hGraph", ",", "from", ",", "to", ",", "numDependencies", ")", ")", ";", "}" ]
Adds dependency edges to a graph.<br> <br> The number of dependencies to be added is defined by \p numDependencies Elements in \p from and \p to at corresponding indices define a dependency. Each node in \p from and \p to must belong to \p hGraph.<br> <br> If \p numDependencies is 0, elements in \p from and \p to will be ignored. Specifying an existing dependency will return an error.<br> @param hGraph - Graph to which dependencies are added @param from - Array of nodes that provide the dependencies @param to - Array of dependent nodes @param numDependencies - Number of dependencies to be added @return CUDA_SUCCESS, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuGraphRemoveDependencies JCudaDriver#cuGraphGetEdges JCudaDriver#cuGraphNodeGetDependencies JCudaDriver#cuGraphNodeGetDependentNodes
[ "Adds", "dependency", "edges", "to", "a", "graph", ".", "<br", ">", "<br", ">", "The", "number", "of", "dependencies", "to", "be", "added", "is", "defined", "by", "\\", "p", "numDependencies", "Elements", "in", "\\", "p", "from", "and", "\\", "p", "to", "at", "corresponding", "indices", "define", "a", "dependency", ".", "Each", "node", "in", "\\", "p", "from", "and", "\\", "p", "to", "must", "belong", "to", "\\", "p", "hGraph", ".", "<br", ">", "<br", ">", "If", "\\", "p", "numDependencies", "is", "0", "elements", "in", "\\", "p", "from", "and", "\\", "p", "to", "will", "be", "ignored", ".", "Specifying", "an", "existing", "dependency", "will", "return", "an", "error", ".", "<br", ">" ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L12848-L12851
fracpete/multisearch-weka-package
src/main/java/weka/classifiers/meta/multisearch/Performance.java
Performance.setPerformance
public void setPerformance(int evaluation, double value) { """ returns the performance measure. @param evaluation the type of evaluation to return @param value the performance measure """ if ((m_Metrics != null) && !m_Metrics.check(evaluation)) return; m_MetricValues.put(evaluation, value); }
java
public void setPerformance(int evaluation, double value) { if ((m_Metrics != null) && !m_Metrics.check(evaluation)) return; m_MetricValues.put(evaluation, value); }
[ "public", "void", "setPerformance", "(", "int", "evaluation", ",", "double", "value", ")", "{", "if", "(", "(", "m_Metrics", "!=", "null", ")", "&&", "!", "m_Metrics", ".", "check", "(", "evaluation", ")", ")", "return", ";", "m_MetricValues", ".", "put", "(", "evaluation", ",", "value", ")", ";", "}" ]
returns the performance measure. @param evaluation the type of evaluation to return @param value the performance measure
[ "returns", "the", "performance", "measure", "." ]
train
https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/Performance.java#L148-L152
ehcache/ehcache3
core/src/main/java/org/ehcache/core/EhcacheManager.java
EhcacheManager.closeEhcache
protected void closeEhcache(final String alias, final InternalCache<?, ?> ehcache) { """ Perform cache closure actions specific to a cache manager implementation. This method is called <i>after</i> the {@code InternalCache} instance is closed. @param alias the cache alias @param ehcache the {@code InternalCache} instance for the cache to close """ for (ResourceType<?> resourceType : ehcache.getRuntimeConfiguration().getResourcePools().getResourceTypeSet()) { if (resourceType.isPersistable()) { ResourcePool resourcePool = ehcache.getRuntimeConfiguration() .getResourcePools() .getPoolForResource(resourceType); if (!resourcePool.isPersistent()) { PersistableResourceService persistableResourceService = getPersistableResourceService(resourceType); try { persistableResourceService.destroy(alias); } catch (CachePersistenceException e) { LOGGER.warn("Unable to clear persistence space for cache {}", alias, e); } } } } }
java
protected void closeEhcache(final String alias, final InternalCache<?, ?> ehcache) { for (ResourceType<?> resourceType : ehcache.getRuntimeConfiguration().getResourcePools().getResourceTypeSet()) { if (resourceType.isPersistable()) { ResourcePool resourcePool = ehcache.getRuntimeConfiguration() .getResourcePools() .getPoolForResource(resourceType); if (!resourcePool.isPersistent()) { PersistableResourceService persistableResourceService = getPersistableResourceService(resourceType); try { persistableResourceService.destroy(alias); } catch (CachePersistenceException e) { LOGGER.warn("Unable to clear persistence space for cache {}", alias, e); } } } } }
[ "protected", "void", "closeEhcache", "(", "final", "String", "alias", ",", "final", "InternalCache", "<", "?", ",", "?", ">", "ehcache", ")", "{", "for", "(", "ResourceType", "<", "?", ">", "resourceType", ":", "ehcache", ".", "getRuntimeConfiguration", "(", ")", ".", "getResourcePools", "(", ")", ".", "getResourceTypeSet", "(", ")", ")", "{", "if", "(", "resourceType", ".", "isPersistable", "(", ")", ")", "{", "ResourcePool", "resourcePool", "=", "ehcache", ".", "getRuntimeConfiguration", "(", ")", ".", "getResourcePools", "(", ")", ".", "getPoolForResource", "(", "resourceType", ")", ";", "if", "(", "!", "resourcePool", ".", "isPersistent", "(", ")", ")", "{", "PersistableResourceService", "persistableResourceService", "=", "getPersistableResourceService", "(", "resourceType", ")", ";", "try", "{", "persistableResourceService", ".", "destroy", "(", "alias", ")", ";", "}", "catch", "(", "CachePersistenceException", "e", ")", "{", "LOGGER", ".", "warn", "(", "\"Unable to clear persistence space for cache {}\"", ",", "alias", ",", "e", ")", ";", "}", "}", "}", "}", "}" ]
Perform cache closure actions specific to a cache manager implementation. This method is called <i>after</i> the {@code InternalCache} instance is closed. @param alias the cache alias @param ehcache the {@code InternalCache} instance for the cache to close
[ "Perform", "cache", "closure", "actions", "specific", "to", "a", "cache", "manager", "implementation", ".", "This", "method", "is", "called", "<i", ">", "after<", "/", "i", ">", "the", "{", "@code", "InternalCache", "}", "instance", "is", "closed", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/core/src/main/java/org/ehcache/core/EhcacheManager.java#L229-L245
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.getFragmentInHours
@GwtIncompatible("incompatible method") public static long getFragmentInHours(final Date date, final int fragment) { """ <p>Returns the number of hours within the fragment. All datefields greater than the fragment will be ignored.</p> <p>Asking the hours of any date will only return the number of hours of the current day (resulting in a number between 0 and 23). This method will retrieve the number of hours for any fragment. For example, if you want to calculate the number of hours past this month, your fragment is Calendar.MONTH. The result will be all hours of the past day(s).</p> <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND A fragment less than or equal to a HOUR field will return 0.</p> <ul> <li>January 1, 2008 7:15:10.538 with Calendar.DAY_OF_YEAR as fragment will return 7 (equivalent to deprecated date.getHours())</li> <li>January 6, 2008 7:15:10.538 with Calendar.DAY_OF_YEAR as fragment will return 7 (equivalent to deprecated date.getHours())</li> <li>January 1, 2008 7:15:10.538 with Calendar.MONTH as fragment will return 7</li> <li>January 6, 2008 7:15:10.538 with Calendar.MONTH as fragment will return 127 (5*24 + 7)</li> <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0 (a millisecond cannot be split in hours)</li> </ul> @param date the date to work with, not null @param fragment the {@code Calendar} field part of date to calculate @return number of hours within the fragment of date @throws IllegalArgumentException if the date is <code>null</code> or fragment is not supported @since 2.4 """ return getFragment(date, fragment, TimeUnit.HOURS); }
java
@GwtIncompatible("incompatible method") public static long getFragmentInHours(final Date date, final int fragment) { return getFragment(date, fragment, TimeUnit.HOURS); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "long", "getFragmentInHours", "(", "final", "Date", "date", ",", "final", "int", "fragment", ")", "{", "return", "getFragment", "(", "date", ",", "fragment", ",", "TimeUnit", ".", "HOURS", ")", ";", "}" ]
<p>Returns the number of hours within the fragment. All datefields greater than the fragment will be ignored.</p> <p>Asking the hours of any date will only return the number of hours of the current day (resulting in a number between 0 and 23). This method will retrieve the number of hours for any fragment. For example, if you want to calculate the number of hours past this month, your fragment is Calendar.MONTH. The result will be all hours of the past day(s).</p> <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND A fragment less than or equal to a HOUR field will return 0.</p> <ul> <li>January 1, 2008 7:15:10.538 with Calendar.DAY_OF_YEAR as fragment will return 7 (equivalent to deprecated date.getHours())</li> <li>January 6, 2008 7:15:10.538 with Calendar.DAY_OF_YEAR as fragment will return 7 (equivalent to deprecated date.getHours())</li> <li>January 1, 2008 7:15:10.538 with Calendar.MONTH as fragment will return 7</li> <li>January 6, 2008 7:15:10.538 with Calendar.MONTH as fragment will return 127 (5*24 + 7)</li> <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0 (a millisecond cannot be split in hours)</li> </ul> @param date the date to work with, not null @param fragment the {@code Calendar} field part of date to calculate @return number of hours within the fragment of date @throws IllegalArgumentException if the date is <code>null</code> or fragment is not supported @since 2.4
[ "<p", ">", "Returns", "the", "number", "of", "hours", "within", "the", "fragment", ".", "All", "datefields", "greater", "than", "the", "fragment", "will", "be", "ignored", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L1413-L1416
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/util/SchedulerUtils.java
SchedulerUtils.loadGenericJobConfigs
public static List<Properties> loadGenericJobConfigs(Properties sysProps) throws ConfigurationException, IOException { """ Load job configuration from job configuration files stored in general file system, located by Path @param sysProps Gobblin framework configuration properties @return a list of job configurations in the form of {@link java.util.Properties} """ Path rootPath = new Path(sysProps.getProperty(ConfigurationKeys.JOB_CONFIG_FILE_GENERAL_PATH_KEY)); PullFileLoader loader = new PullFileLoader(rootPath, rootPath.getFileSystem(new Configuration()), getJobConfigurationFileExtensions(sysProps), PullFileLoader.DEFAULT_HOCON_PULL_FILE_EXTENSIONS); Config sysConfig = ConfigUtils.propertiesToConfig(sysProps); Collection<Config> configs = loader.loadPullFilesRecursively(rootPath, sysConfig, true); List<Properties> jobConfigs = Lists.newArrayList(); for (Config config : configs) { try { jobConfigs.add(resolveTemplate(ConfigUtils.configToProperties(config))); } catch (IOException ioe) { LOGGER.error("Could not parse job config at " + ConfigUtils.getString(config, ConfigurationKeys.JOB_CONFIG_FILE_PATH_KEY, "Unknown path"), ioe); } } return jobConfigs; }
java
public static List<Properties> loadGenericJobConfigs(Properties sysProps) throws ConfigurationException, IOException { Path rootPath = new Path(sysProps.getProperty(ConfigurationKeys.JOB_CONFIG_FILE_GENERAL_PATH_KEY)); PullFileLoader loader = new PullFileLoader(rootPath, rootPath.getFileSystem(new Configuration()), getJobConfigurationFileExtensions(sysProps), PullFileLoader.DEFAULT_HOCON_PULL_FILE_EXTENSIONS); Config sysConfig = ConfigUtils.propertiesToConfig(sysProps); Collection<Config> configs = loader.loadPullFilesRecursively(rootPath, sysConfig, true); List<Properties> jobConfigs = Lists.newArrayList(); for (Config config : configs) { try { jobConfigs.add(resolveTemplate(ConfigUtils.configToProperties(config))); } catch (IOException ioe) { LOGGER.error("Could not parse job config at " + ConfigUtils.getString(config, ConfigurationKeys.JOB_CONFIG_FILE_PATH_KEY, "Unknown path"), ioe); } } return jobConfigs; }
[ "public", "static", "List", "<", "Properties", ">", "loadGenericJobConfigs", "(", "Properties", "sysProps", ")", "throws", "ConfigurationException", ",", "IOException", "{", "Path", "rootPath", "=", "new", "Path", "(", "sysProps", ".", "getProperty", "(", "ConfigurationKeys", ".", "JOB_CONFIG_FILE_GENERAL_PATH_KEY", ")", ")", ";", "PullFileLoader", "loader", "=", "new", "PullFileLoader", "(", "rootPath", ",", "rootPath", ".", "getFileSystem", "(", "new", "Configuration", "(", ")", ")", ",", "getJobConfigurationFileExtensions", "(", "sysProps", ")", ",", "PullFileLoader", ".", "DEFAULT_HOCON_PULL_FILE_EXTENSIONS", ")", ";", "Config", "sysConfig", "=", "ConfigUtils", ".", "propertiesToConfig", "(", "sysProps", ")", ";", "Collection", "<", "Config", ">", "configs", "=", "loader", ".", "loadPullFilesRecursively", "(", "rootPath", ",", "sysConfig", ",", "true", ")", ";", "List", "<", "Properties", ">", "jobConfigs", "=", "Lists", ".", "newArrayList", "(", ")", ";", "for", "(", "Config", "config", ":", "configs", ")", "{", "try", "{", "jobConfigs", ".", "add", "(", "resolveTemplate", "(", "ConfigUtils", ".", "configToProperties", "(", "config", ")", ")", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "LOGGER", ".", "error", "(", "\"Could not parse job config at \"", "+", "ConfigUtils", ".", "getString", "(", "config", ",", "ConfigurationKeys", ".", "JOB_CONFIG_FILE_PATH_KEY", ",", "\"Unknown path\"", ")", ",", "ioe", ")", ";", "}", "}", "return", "jobConfigs", ";", "}" ]
Load job configuration from job configuration files stored in general file system, located by Path @param sysProps Gobblin framework configuration properties @return a list of job configurations in the form of {@link java.util.Properties}
[ "Load", "job", "configuration", "from", "job", "configuration", "files", "stored", "in", "general", "file", "system", "located", "by", "Path" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/util/SchedulerUtils.java#L68-L88
GoogleCloudPlatform/appengine-pipelines
java/src/main/java/com/google/appengine/tools/pipeline/impl/tasks/Task.java
Task.fromProperties
public static Task fromProperties(String taskName, Properties properties) { """ Construct a task from {@code Properties}. This method is used on the receiving side. That is, it is used to construct a {@code Task} from an HttpRequest sent from the App Engine task queue. {@code properties} must contain a property named {@link #TASK_TYPE_PARAMETER}. In addition it must contain the properties specified by the concrete subclass of this class corresponding to the task type. """ String taskTypeString = properties.getProperty(TASK_TYPE_PARAMETER); if (null == taskTypeString) { throw new IllegalArgumentException(TASK_TYPE_PARAMETER + " property is missing: " + properties.toString()); } Type type = Type.valueOf(taskTypeString); return type.createInstance(taskName, properties); }
java
public static Task fromProperties(String taskName, Properties properties) { String taskTypeString = properties.getProperty(TASK_TYPE_PARAMETER); if (null == taskTypeString) { throw new IllegalArgumentException(TASK_TYPE_PARAMETER + " property is missing: " + properties.toString()); } Type type = Type.valueOf(taskTypeString); return type.createInstance(taskName, properties); }
[ "public", "static", "Task", "fromProperties", "(", "String", "taskName", ",", "Properties", "properties", ")", "{", "String", "taskTypeString", "=", "properties", ".", "getProperty", "(", "TASK_TYPE_PARAMETER", ")", ";", "if", "(", "null", "==", "taskTypeString", ")", "{", "throw", "new", "IllegalArgumentException", "(", "TASK_TYPE_PARAMETER", "+", "\" property is missing: \"", "+", "properties", ".", "toString", "(", ")", ")", ";", "}", "Type", "type", "=", "Type", ".", "valueOf", "(", "taskTypeString", ")", ";", "return", "type", ".", "createInstance", "(", "taskName", ",", "properties", ")", ";", "}" ]
Construct a task from {@code Properties}. This method is used on the receiving side. That is, it is used to construct a {@code Task} from an HttpRequest sent from the App Engine task queue. {@code properties} must contain a property named {@link #TASK_TYPE_PARAMETER}. In addition it must contain the properties specified by the concrete subclass of this class corresponding to the task type.
[ "Construct", "a", "task", "from", "{" ]
train
https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/tasks/Task.java#L204-L212
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/STGD.java
STGD.setLearningRate
public void setLearningRate(double learningRate) { """ Sets the learning rate to use @param learningRate the learning rate &gt; 0. """ if(Double.isInfinite(learningRate) || Double.isNaN(learningRate) || learningRate <= 0) throw new IllegalArgumentException("Learning rate must be positive, not " + learningRate); this.learningRate = learningRate; }
java
public void setLearningRate(double learningRate) { if(Double.isInfinite(learningRate) || Double.isNaN(learningRate) || learningRate <= 0) throw new IllegalArgumentException("Learning rate must be positive, not " + learningRate); this.learningRate = learningRate; }
[ "public", "void", "setLearningRate", "(", "double", "learningRate", ")", "{", "if", "(", "Double", ".", "isInfinite", "(", "learningRate", ")", "||", "Double", ".", "isNaN", "(", "learningRate", ")", "||", "learningRate", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"Learning rate must be positive, not \"", "+", "learningRate", ")", ";", "this", ".", "learningRate", "=", "learningRate", ";", "}" ]
Sets the learning rate to use @param learningRate the learning rate &gt; 0.
[ "Sets", "the", "learning", "rate", "to", "use" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/STGD.java#L108-L113
jbundle/jbundle
base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/html/HAppletHtmlScreen.java
HAppletHtmlScreen.printReport
public void printReport(PrintWriter out, ResourceBundle reg) throws DBException { """ Output this screen using HTML. Display the html headers, etc. then: <ol> - Parse any parameters passed in and set the field values. - Process any command (such as move=Next). - Render this screen as Html (by calling printHtmlScreen()). </ol> @param out The html out stream. @exception DBException File exception. """ if (reg == null) reg = ((BaseApplication)this.getTask().getApplication()).getResources("HtmlApplet", false); super.printReport(out, reg); }
java
public void printReport(PrintWriter out, ResourceBundle reg) throws DBException { if (reg == null) reg = ((BaseApplication)this.getTask().getApplication()).getResources("HtmlApplet", false); super.printReport(out, reg); }
[ "public", "void", "printReport", "(", "PrintWriter", "out", ",", "ResourceBundle", "reg", ")", "throws", "DBException", "{", "if", "(", "reg", "==", "null", ")", "reg", "=", "(", "(", "BaseApplication", ")", "this", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", ")", ".", "getResources", "(", "\"HtmlApplet\"", ",", "false", ")", ";", "super", ".", "printReport", "(", "out", ",", "reg", ")", ";", "}" ]
Output this screen using HTML. Display the html headers, etc. then: <ol> - Parse any parameters passed in and set the field values. - Process any command (such as move=Next). - Render this screen as Html (by calling printHtmlScreen()). </ol> @param out The html out stream. @exception DBException File exception.
[ "Output", "this", "screen", "using", "HTML", ".", "Display", "the", "html", "headers", "etc", ".", "then", ":", "<ol", ">", "-", "Parse", "any", "parameters", "passed", "in", "and", "set", "the", "field", "values", ".", "-", "Process", "any", "command", "(", "such", "as", "move", "=", "Next", ")", ".", "-", "Render", "this", "screen", "as", "Html", "(", "by", "calling", "printHtmlScreen", "()", ")", ".", "<", "/", "ol", ">" ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/html/HAppletHtmlScreen.java#L78-L84
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/GeneralPurposeFFT_F64_2D.java
GeneralPurposeFFT_F64_2D.realInverse
public void realInverse(double[] a, boolean scale) { """ Computes 2D inverse DFT of real data leaving the result in <code>a</code> . This method only works when the sizes of both dimensions are power-of-two numbers. The physical layout of the input data has to be as follows: <pre> a[k1*columns+2*k2] = Re[k1][k2] = Re[rows-k1][columns-k2], a[k1*columns+2*k2+1] = Im[k1][k2] = -Im[rows-k1][columns-k2], 0&lt;k1&lt;rows, 0&lt;k2&lt;columns/2, a[2*k2] = Re[0][k2] = Re[0][columns-k2], a[2*k2+1] = Im[0][k2] = -Im[0][columns-k2], 0&lt;k2&lt;columns/2, a[k1*columns] = Re[k1][0] = Re[rows-k1][0], a[k1*columns+1] = Im[k1][0] = -Im[rows-k1][0], a[(rows-k1)*columns+1] = Re[k1][columns/2] = Re[rows-k1][columns/2], a[(rows-k1)*columns] = -Im[k1][columns/2] = Im[rows-k1][columns/2], 0&lt;k1&lt;rows/2, a[0] = Re[0][0], a[1] = Re[0][columns/2], a[(rows/2)*columns] = Re[rows/2][0], a[(rows/2)*columns+1] = Re[rows/2][columns/2] </pre> This method computes only half of the elements of the real transform. The other half satisfies the symmetry condition. If you want the full real inverse transform, use <code>realInverseFull</code>. @param a data to transform @param scale if true then scaling is performed """ // handle special case if( rows == 1 || columns == 1 ) { if( rows > 1 ) fftRows.realInverse(a, scale); else fftColumns.realInverse(a, scale); return; } if (isPowerOfTwo == false) { throw new IllegalArgumentException("rows and columns must be power of two numbers"); } else { rdft2d_sub(-1, a); cdft2d_sub(1, a, scale); for (int r = 0; r < rows; r++) { fftColumns.realInverse(a, r * columns, scale); } } }
java
public void realInverse(double[] a, boolean scale) { // handle special case if( rows == 1 || columns == 1 ) { if( rows > 1 ) fftRows.realInverse(a, scale); else fftColumns.realInverse(a, scale); return; } if (isPowerOfTwo == false) { throw new IllegalArgumentException("rows and columns must be power of two numbers"); } else { rdft2d_sub(-1, a); cdft2d_sub(1, a, scale); for (int r = 0; r < rows; r++) { fftColumns.realInverse(a, r * columns, scale); } } }
[ "public", "void", "realInverse", "(", "double", "[", "]", "a", ",", "boolean", "scale", ")", "{", "// handle special case", "if", "(", "rows", "==", "1", "||", "columns", "==", "1", ")", "{", "if", "(", "rows", ">", "1", ")", "fftRows", ".", "realInverse", "(", "a", ",", "scale", ")", ";", "else", "fftColumns", ".", "realInverse", "(", "a", ",", "scale", ")", ";", "return", ";", "}", "if", "(", "isPowerOfTwo", "==", "false", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"rows and columns must be power of two numbers\"", ")", ";", "}", "else", "{", "rdft2d_sub", "(", "-", "1", ",", "a", ")", ";", "cdft2d_sub", "(", "1", ",", "a", ",", "scale", ")", ";", "for", "(", "int", "r", "=", "0", ";", "r", "<", "rows", ";", "r", "++", ")", "{", "fftColumns", ".", "realInverse", "(", "a", ",", "r", "*", "columns", ",", "scale", ")", ";", "}", "}", "}" ]
Computes 2D inverse DFT of real data leaving the result in <code>a</code> . This method only works when the sizes of both dimensions are power-of-two numbers. The physical layout of the input data has to be as follows: <pre> a[k1*columns+2*k2] = Re[k1][k2] = Re[rows-k1][columns-k2], a[k1*columns+2*k2+1] = Im[k1][k2] = -Im[rows-k1][columns-k2], 0&lt;k1&lt;rows, 0&lt;k2&lt;columns/2, a[2*k2] = Re[0][k2] = Re[0][columns-k2], a[2*k2+1] = Im[0][k2] = -Im[0][columns-k2], 0&lt;k2&lt;columns/2, a[k1*columns] = Re[k1][0] = Re[rows-k1][0], a[k1*columns+1] = Im[k1][0] = -Im[rows-k1][0], a[(rows-k1)*columns+1] = Re[k1][columns/2] = Re[rows-k1][columns/2], a[(rows-k1)*columns] = -Im[k1][columns/2] = Im[rows-k1][columns/2], 0&lt;k1&lt;rows/2, a[0] = Re[0][0], a[1] = Re[0][columns/2], a[(rows/2)*columns] = Re[rows/2][0], a[(rows/2)*columns+1] = Re[rows/2][columns/2] </pre> This method computes only half of the elements of the real transform. The other half satisfies the symmetry condition. If you want the full real inverse transform, use <code>realInverseFull</code>. @param a data to transform @param scale if true then scaling is performed
[ "Computes", "2D", "inverse", "DFT", "of", "real", "data", "leaving", "the", "result", "in", "<code", ">", "a<", "/", "code", ">", ".", "This", "method", "only", "works", "when", "the", "sizes", "of", "both", "dimensions", "are", "power", "-", "of", "-", "two", "numbers", ".", "The", "physical", "layout", "of", "the", "input", "data", "has", "to", "be", "as", "follows", ":" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/GeneralPurposeFFT_F64_2D.java#L342-L361
apereo/cas
core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/view/AbstractCasView.java
AbstractCasView.prepareViewModelWithAuthenticationPrincipal
protected Map prepareViewModelWithAuthenticationPrincipal(final Map<String, Object> model) { """ Prepare view model with authentication principal. @param model the model @return the map """ putIntoModel(model, CasViewConstants.MODEL_ATTRIBUTE_NAME_PRINCIPAL, getPrincipal(model)); putIntoModel(model, CasViewConstants.MODEL_ATTRIBUTE_NAME_CHAINED_AUTHENTICATIONS, getChainedAuthentications(model)); putIntoModel(model, CasViewConstants.MODEL_ATTRIBUTE_NAME_PRIMARY_AUTHENTICATION, getPrimaryAuthenticationFrom(model)); LOGGER.trace("Prepared CAS response output model with attribute names [{}]", model.keySet()); return model; }
java
protected Map prepareViewModelWithAuthenticationPrincipal(final Map<String, Object> model) { putIntoModel(model, CasViewConstants.MODEL_ATTRIBUTE_NAME_PRINCIPAL, getPrincipal(model)); putIntoModel(model, CasViewConstants.MODEL_ATTRIBUTE_NAME_CHAINED_AUTHENTICATIONS, getChainedAuthentications(model)); putIntoModel(model, CasViewConstants.MODEL_ATTRIBUTE_NAME_PRIMARY_AUTHENTICATION, getPrimaryAuthenticationFrom(model)); LOGGER.trace("Prepared CAS response output model with attribute names [{}]", model.keySet()); return model; }
[ "protected", "Map", "prepareViewModelWithAuthenticationPrincipal", "(", "final", "Map", "<", "String", ",", "Object", ">", "model", ")", "{", "putIntoModel", "(", "model", ",", "CasViewConstants", ".", "MODEL_ATTRIBUTE_NAME_PRINCIPAL", ",", "getPrincipal", "(", "model", ")", ")", ";", "putIntoModel", "(", "model", ",", "CasViewConstants", ".", "MODEL_ATTRIBUTE_NAME_CHAINED_AUTHENTICATIONS", ",", "getChainedAuthentications", "(", "model", ")", ")", ";", "putIntoModel", "(", "model", ",", "CasViewConstants", ".", "MODEL_ATTRIBUTE_NAME_PRIMARY_AUTHENTICATION", ",", "getPrimaryAuthenticationFrom", "(", "model", ")", ")", ";", "LOGGER", ".", "trace", "(", "\"Prepared CAS response output model with attribute names [{}]\"", ",", "model", ".", "keySet", "(", ")", ")", ";", "return", "model", ";", "}" ]
Prepare view model with authentication principal. @param model the model @return the map
[ "Prepare", "view", "model", "with", "authentication", "principal", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/view/AbstractCasView.java#L219-L225
stripe/stripe-java
src/main/java/com/stripe/model/Account.java
Account.persons
public PersonCollection persons() throws StripeException { """ Returns a list of people associated with the account’s legal entity. The people are returned sorted by creation date, with the most recent people appearing first. """ return persons((Map<String, Object>) null, (RequestOptions) null); }
java
public PersonCollection persons() throws StripeException { return persons((Map<String, Object>) null, (RequestOptions) null); }
[ "public", "PersonCollection", "persons", "(", ")", "throws", "StripeException", "{", "return", "persons", "(", "(", "Map", "<", "String", ",", "Object", ">", ")", "null", ",", "(", "RequestOptions", ")", "null", ")", ";", "}" ]
Returns a list of people associated with the account’s legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
[ "Returns", "a", "list", "of", "people", "associated", "with", "the", "account’s", "legal", "entity", ".", "The", "people", "are", "returned", "sorted", "by", "creation", "date", "with", "the", "most", "recent", "people", "appearing", "first", "." ]
train
https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/model/Account.java#L451-L453
VoltDB/voltdb
src/frontend/org/voltdb/AbstractTopology.java
AbstractTopology.getTopology
public static AbstractTopology getTopology(Map<Integer, HostInfo> hostInfos, Set<Integer> missingHosts, int kfactor) { """ Create a new topology using {@code hosts} @param hostInfos hosts to put in topology @param missingHosts set of missing host IDs @param kfactor for cluster @return {@link AbstractTopology} for cluster @throws RuntimeException if hosts are not valid for topology """ return getTopology(hostInfos, missingHosts, kfactor, false); }
java
public static AbstractTopology getTopology(Map<Integer, HostInfo> hostInfos, Set<Integer> missingHosts, int kfactor) { return getTopology(hostInfos, missingHosts, kfactor, false); }
[ "public", "static", "AbstractTopology", "getTopology", "(", "Map", "<", "Integer", ",", "HostInfo", ">", "hostInfos", ",", "Set", "<", "Integer", ">", "missingHosts", ",", "int", "kfactor", ")", "{", "return", "getTopology", "(", "hostInfos", ",", "missingHosts", ",", "kfactor", ",", "false", ")", ";", "}" ]
Create a new topology using {@code hosts} @param hostInfos hosts to put in topology @param missingHosts set of missing host IDs @param kfactor for cluster @return {@link AbstractTopology} for cluster @throws RuntimeException if hosts are not valid for topology
[ "Create", "a", "new", "topology", "using", "{", "@code", "hosts", "}" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/AbstractTopology.java#L961-L964
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java
FSEditLogLoader.loadFSEdits
int loadFSEdits(EditLogInputStream edits, long lastAppliedTxId) throws IOException { """ Load an edit log, and apply the changes to the in-memory structure This is where we apply edits that we've been writing to disk all along. """ long startTime = now(); this.lastAppliedTxId = lastAppliedTxId; int numEdits = loadFSEdits(edits, true); FSImage.LOG.info("Edits file " + edits.toString() + " of size: " + edits.length() + ", # of edits: " + numEdits + " loaded in: " + (now()-startTime)/1000 + " seconds."); return numEdits; }
java
int loadFSEdits(EditLogInputStream edits, long lastAppliedTxId) throws IOException { long startTime = now(); this.lastAppliedTxId = lastAppliedTxId; int numEdits = loadFSEdits(edits, true); FSImage.LOG.info("Edits file " + edits.toString() + " of size: " + edits.length() + ", # of edits: " + numEdits + " loaded in: " + (now()-startTime)/1000 + " seconds."); return numEdits; }
[ "int", "loadFSEdits", "(", "EditLogInputStream", "edits", ",", "long", "lastAppliedTxId", ")", "throws", "IOException", "{", "long", "startTime", "=", "now", "(", ")", ";", "this", ".", "lastAppliedTxId", "=", "lastAppliedTxId", ";", "int", "numEdits", "=", "loadFSEdits", "(", "edits", ",", "true", ")", ";", "FSImage", ".", "LOG", ".", "info", "(", "\"Edits file \"", "+", "edits", ".", "toString", "(", ")", "+", "\" of size: \"", "+", "edits", ".", "length", "(", ")", "+", "\", # of edits: \"", "+", "numEdits", "+", "\" loaded in: \"", "+", "(", "now", "(", ")", "-", "startTime", ")", "/", "1000", "+", "\" seconds.\"", ")", ";", "return", "numEdits", ";", "}" ]
Load an edit log, and apply the changes to the in-memory structure This is where we apply edits that we've been writing to disk all along.
[ "Load", "an", "edit", "log", "and", "apply", "the", "changes", "to", "the", "in", "-", "memory", "structure", "This", "is", "where", "we", "apply", "edits", "that", "we", "ve", "been", "writing", "to", "disk", "all", "along", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java#L107-L116
grpc/grpc-java
netty/src/main/java/io/grpc/netty/ProtocolNegotiators.java
ProtocolNegotiators.httpProxy
public static ProtocolNegotiator httpProxy(final SocketAddress proxyAddress, final @Nullable String proxyUsername, final @Nullable String proxyPassword, final ProtocolNegotiator negotiator) { """ Returns a {@link ProtocolNegotiator} that does HTTP CONNECT proxy negotiation. """ final AsciiString scheme = negotiator.scheme(); Preconditions.checkNotNull(proxyAddress, "proxyAddress"); Preconditions.checkNotNull(negotiator, "negotiator"); class ProxyNegotiator implements ProtocolNegotiator { @Override public ChannelHandler newHandler(GrpcHttp2ConnectionHandler http2Handler) { HttpProxyHandler proxyHandler; if (proxyUsername == null || proxyPassword == null) { proxyHandler = new HttpProxyHandler(proxyAddress); } else { proxyHandler = new HttpProxyHandler(proxyAddress, proxyUsername, proxyPassword); } return new BufferUntilProxyTunnelledHandler( proxyHandler, negotiator.newHandler(http2Handler)); } @Override public AsciiString scheme() { return scheme; } // This method is not normally called, because we use httpProxy on a per-connection basis in // NettyChannelBuilder. Instead, we expect `negotiator' to be closed by NettyTransportFactory. @Override public void close() { negotiator.close(); } } return new ProxyNegotiator(); }
java
public static ProtocolNegotiator httpProxy(final SocketAddress proxyAddress, final @Nullable String proxyUsername, final @Nullable String proxyPassword, final ProtocolNegotiator negotiator) { final AsciiString scheme = negotiator.scheme(); Preconditions.checkNotNull(proxyAddress, "proxyAddress"); Preconditions.checkNotNull(negotiator, "negotiator"); class ProxyNegotiator implements ProtocolNegotiator { @Override public ChannelHandler newHandler(GrpcHttp2ConnectionHandler http2Handler) { HttpProxyHandler proxyHandler; if (proxyUsername == null || proxyPassword == null) { proxyHandler = new HttpProxyHandler(proxyAddress); } else { proxyHandler = new HttpProxyHandler(proxyAddress, proxyUsername, proxyPassword); } return new BufferUntilProxyTunnelledHandler( proxyHandler, negotiator.newHandler(http2Handler)); } @Override public AsciiString scheme() { return scheme; } // This method is not normally called, because we use httpProxy on a per-connection basis in // NettyChannelBuilder. Instead, we expect `negotiator' to be closed by NettyTransportFactory. @Override public void close() { negotiator.close(); } } return new ProxyNegotiator(); }
[ "public", "static", "ProtocolNegotiator", "httpProxy", "(", "final", "SocketAddress", "proxyAddress", ",", "final", "@", "Nullable", "String", "proxyUsername", ",", "final", "@", "Nullable", "String", "proxyPassword", ",", "final", "ProtocolNegotiator", "negotiator", ")", "{", "final", "AsciiString", "scheme", "=", "negotiator", ".", "scheme", "(", ")", ";", "Preconditions", ".", "checkNotNull", "(", "proxyAddress", ",", "\"proxyAddress\"", ")", ";", "Preconditions", ".", "checkNotNull", "(", "negotiator", ",", "\"negotiator\"", ")", ";", "class", "ProxyNegotiator", "implements", "ProtocolNegotiator", "{", "@", "Override", "public", "ChannelHandler", "newHandler", "(", "GrpcHttp2ConnectionHandler", "http2Handler", ")", "{", "HttpProxyHandler", "proxyHandler", ";", "if", "(", "proxyUsername", "==", "null", "||", "proxyPassword", "==", "null", ")", "{", "proxyHandler", "=", "new", "HttpProxyHandler", "(", "proxyAddress", ")", ";", "}", "else", "{", "proxyHandler", "=", "new", "HttpProxyHandler", "(", "proxyAddress", ",", "proxyUsername", ",", "proxyPassword", ")", ";", "}", "return", "new", "BufferUntilProxyTunnelledHandler", "(", "proxyHandler", ",", "negotiator", ".", "newHandler", "(", "http2Handler", ")", ")", ";", "}", "@", "Override", "public", "AsciiString", "scheme", "(", ")", "{", "return", "scheme", ";", "}", "// This method is not normally called, because we use httpProxy on a per-connection basis in", "// NettyChannelBuilder. Instead, we expect `negotiator' to be closed by NettyTransportFactory.", "@", "Override", "public", "void", "close", "(", ")", "{", "negotiator", ".", "close", "(", ")", ";", "}", "}", "return", "new", "ProxyNegotiator", "(", ")", ";", "}" ]
Returns a {@link ProtocolNegotiator} that does HTTP CONNECT proxy negotiation.
[ "Returns", "a", "{" ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/ProtocolNegotiators.java#L204-L237
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/operations/ValueURLIOHelper.java
ValueURLIOHelper.getContent
public static InputStream getContent(ValueStoragePlugin plugin, ValueData value, String resourceId, boolean spoolContent) throws IOException { """ Extracts the content of the given {@link ValueData} and links the data to the {@link URL} in the Value Storage if needed @param plugin the plug-in that will manage the storage of the provided {@link ValueData} @param value the value from which we want to extract the content @param resourceId the internal id of the {@link ValueData} @param spoolContent Indicates whether or not the content should always be spooled @return the content of the {@link ValueData} @throws IOException if the content could not be extracted """ if (value.isByteArray()) { return new ByteArrayInputStream(value.getAsByteArray()); } else if (value instanceof StreamPersistedValueData) { StreamPersistedValueData streamed = (StreamPersistedValueData)value; if (!streamed.isPersisted()) { InputStream stream; // the Value not yet persisted, i.e. or in client stream or spooled to a temp file File tempFile; if ((tempFile = streamed.getTempFile()) != null) { // it's spooled Value, try move its file to VS stream = new FileInputStream(tempFile); } else { // not spooled, use client InputStream stream = streamed.getStream(); } // link this Value to URL in VS InputStream result = streamed.setPersistedURL(plugin.createURL(resourceId), spoolContent); return result != null ? result : stream; } } return value.getAsStream(); }
java
public static InputStream getContent(ValueStoragePlugin plugin, ValueData value, String resourceId, boolean spoolContent) throws IOException { if (value.isByteArray()) { return new ByteArrayInputStream(value.getAsByteArray()); } else if (value instanceof StreamPersistedValueData) { StreamPersistedValueData streamed = (StreamPersistedValueData)value; if (!streamed.isPersisted()) { InputStream stream; // the Value not yet persisted, i.e. or in client stream or spooled to a temp file File tempFile; if ((tempFile = streamed.getTempFile()) != null) { // it's spooled Value, try move its file to VS stream = new FileInputStream(tempFile); } else { // not spooled, use client InputStream stream = streamed.getStream(); } // link this Value to URL in VS InputStream result = streamed.setPersistedURL(plugin.createURL(resourceId), spoolContent); return result != null ? result : stream; } } return value.getAsStream(); }
[ "public", "static", "InputStream", "getContent", "(", "ValueStoragePlugin", "plugin", ",", "ValueData", "value", ",", "String", "resourceId", ",", "boolean", "spoolContent", ")", "throws", "IOException", "{", "if", "(", "value", ".", "isByteArray", "(", ")", ")", "{", "return", "new", "ByteArrayInputStream", "(", "value", ".", "getAsByteArray", "(", ")", ")", ";", "}", "else", "if", "(", "value", "instanceof", "StreamPersistedValueData", ")", "{", "StreamPersistedValueData", "streamed", "=", "(", "StreamPersistedValueData", ")", "value", ";", "if", "(", "!", "streamed", ".", "isPersisted", "(", ")", ")", "{", "InputStream", "stream", ";", "// the Value not yet persisted, i.e. or in client stream or spooled to a temp file", "File", "tempFile", ";", "if", "(", "(", "tempFile", "=", "streamed", ".", "getTempFile", "(", ")", ")", "!=", "null", ")", "{", "// it's spooled Value, try move its file to VS", "stream", "=", "new", "FileInputStream", "(", "tempFile", ")", ";", "}", "else", "{", "// not spooled, use client InputStream", "stream", "=", "streamed", ".", "getStream", "(", ")", ";", "}", "// link this Value to URL in VS", "InputStream", "result", "=", "streamed", ".", "setPersistedURL", "(", "plugin", ".", "createURL", "(", "resourceId", ")", ",", "spoolContent", ")", ";", "return", "result", "!=", "null", "?", "result", ":", "stream", ";", "}", "}", "return", "value", ".", "getAsStream", "(", ")", ";", "}" ]
Extracts the content of the given {@link ValueData} and links the data to the {@link URL} in the Value Storage if needed @param plugin the plug-in that will manage the storage of the provided {@link ValueData} @param value the value from which we want to extract the content @param resourceId the internal id of the {@link ValueData} @param spoolContent Indicates whether or not the content should always be spooled @return the content of the {@link ValueData} @throws IOException if the content could not be extracted
[ "Extracts", "the", "content", "of", "the", "given", "{" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/operations/ValueURLIOHelper.java#L53-L84
yidongnan/grpc-spring-boot-starter
grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/channelfactory/AbstractChannelFactory.java
AbstractChannelFactory.configureCompression
protected void configureCompression(final T builder, final String name) { """ Configures the compression options that should be used by the channel. @param builder The channel builder to configure. @param name The name of the client to configure. """ final GrpcChannelProperties properties = getPropertiesFor(name); if (properties.isFullStreamDecompression()) { builder.enableFullStreamDecompression(); } }
java
protected void configureCompression(final T builder, final String name) { final GrpcChannelProperties properties = getPropertiesFor(name); if (properties.isFullStreamDecompression()) { builder.enableFullStreamDecompression(); } }
[ "protected", "void", "configureCompression", "(", "final", "T", "builder", ",", "final", "String", "name", ")", "{", "final", "GrpcChannelProperties", "properties", "=", "getPropertiesFor", "(", "name", ")", ";", "if", "(", "properties", ".", "isFullStreamDecompression", "(", ")", ")", "{", "builder", ".", "enableFullStreamDecompression", "(", ")", ";", "}", "}" ]
Configures the compression options that should be used by the channel. @param builder The channel builder to configure. @param name The name of the client to configure.
[ "Configures", "the", "compression", "options", "that", "should", "be", "used", "by", "the", "channel", "." ]
train
https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/channelfactory/AbstractChannelFactory.java#L244-L249
sniffy/sniffy
sniffy-core/src/main/java/io/sniffy/LegacySpy.java
LegacySpy.verifyAtLeast
@Deprecated public C verifyAtLeast(int allowedStatements, Threads threadMatcher) throws WrongNumberOfQueriesError { """ Alias for {@link #verifyBetween(int, int, Threads, Query)} with arguments {@code allowedStatements}, {@link Integer#MAX_VALUE}, {@code threads}, {@link Query#ANY} @since 2.0 """ return verify(SqlQueries.minQueries(allowedStatements).threads(threadMatcher)); }
java
@Deprecated public C verifyAtLeast(int allowedStatements, Threads threadMatcher) throws WrongNumberOfQueriesError { return verify(SqlQueries.minQueries(allowedStatements).threads(threadMatcher)); }
[ "@", "Deprecated", "public", "C", "verifyAtLeast", "(", "int", "allowedStatements", ",", "Threads", "threadMatcher", ")", "throws", "WrongNumberOfQueriesError", "{", "return", "verify", "(", "SqlQueries", ".", "minQueries", "(", "allowedStatements", ")", ".", "threads", "(", "threadMatcher", ")", ")", ";", "}" ]
Alias for {@link #verifyBetween(int, int, Threads, Query)} with arguments {@code allowedStatements}, {@link Integer#MAX_VALUE}, {@code threads}, {@link Query#ANY} @since 2.0
[ "Alias", "for", "{" ]
train
https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/LegacySpy.java#L548-L551
grpc/grpc-java
stub/src/main/java/io/grpc/stub/AbstractStub.java
AbstractStub.withDeadlineAfter
public final S withDeadlineAfter(long duration, TimeUnit unit) { """ Returns a new stub with a deadline that is after the given {@code duration} from now. @since 1.0.0 @see CallOptions#withDeadlineAfter """ return build(channel, callOptions.withDeadlineAfter(duration, unit)); }
java
public final S withDeadlineAfter(long duration, TimeUnit unit) { return build(channel, callOptions.withDeadlineAfter(duration, unit)); }
[ "public", "final", "S", "withDeadlineAfter", "(", "long", "duration", ",", "TimeUnit", "unit", ")", "{", "return", "build", "(", "channel", ",", "callOptions", ".", "withDeadlineAfter", "(", "duration", ",", "unit", ")", ")", ";", "}" ]
Returns a new stub with a deadline that is after the given {@code duration} from now. @since 1.0.0 @see CallOptions#withDeadlineAfter
[ "Returns", "a", "new", "stub", "with", "a", "deadline", "that", "is", "after", "the", "given", "{", "@code", "duration", "}", "from", "now", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/stub/src/main/java/io/grpc/stub/AbstractStub.java#L123-L125
astrapi69/mystic-crypt
crypt-data/src/main/java/de/alpharogroup/crypto/key/PublicKeyExtensions.java
PublicKeyExtensions.toHexString
public static String toHexString(final PublicKey publicKey, final boolean lowerCase) { """ Transform the given {@link PublicKey} to a hexadecimal {@link String} value. @param publicKey the public key @param lowerCase the flag if the result shell be transform in lower case. If true the result is @return the new hexadecimal {@link String} value. """ return HexExtensions.toHexString(publicKey.getEncoded(), lowerCase); }
java
public static String toHexString(final PublicKey publicKey, final boolean lowerCase) { return HexExtensions.toHexString(publicKey.getEncoded(), lowerCase); }
[ "public", "static", "String", "toHexString", "(", "final", "PublicKey", "publicKey", ",", "final", "boolean", "lowerCase", ")", "{", "return", "HexExtensions", ".", "toHexString", "(", "publicKey", ".", "getEncoded", "(", ")", ",", "lowerCase", ")", ";", "}" ]
Transform the given {@link PublicKey} to a hexadecimal {@link String} value. @param publicKey the public key @param lowerCase the flag if the result shell be transform in lower case. If true the result is @return the new hexadecimal {@link String} value.
[ "Transform", "the", "given", "{", "@link", "PublicKey", "}", "to", "a", "hexadecimal", "{", "@link", "String", "}", "value", "." ]
train
https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/key/PublicKeyExtensions.java#L138-L141
mjiderhamn/classloader-leak-prevention
classloader-leak-prevention/classloader-leak-prevention-core/src/main/java/se/jiderhamn/classloader/leak/prevention/cleanup/RmiTargetsCleanUp.java
RmiTargetsCleanUp.clearRmiTargetsMap
@SuppressWarnings("WeakerAccess") protected void clearRmiTargetsMap(ClassLoaderLeakPreventor preventor, Map<?, ?> rmiTargetsMap) { """ Iterate RMI Targets Map and remove entries loaded by protected ClassLoader """ try { final Field cclField = preventor.findFieldOfClass("sun.rmi.transport.Target", "ccl"); preventor.debug("Looping " + rmiTargetsMap.size() + " RMI Targets to find leaks"); for(Iterator<?> iter = rmiTargetsMap.values().iterator(); iter.hasNext(); ) { Object target = iter.next(); // sun.rmi.transport.Target ClassLoader ccl = (ClassLoader) cclField.get(target); if(preventor.isClassLoaderOrChild(ccl)) { preventor.warn("Removing RMI Target: " + target); iter.remove(); } } } catch (Exception ex) { preventor.error(ex); } }
java
@SuppressWarnings("WeakerAccess") protected void clearRmiTargetsMap(ClassLoaderLeakPreventor preventor, Map<?, ?> rmiTargetsMap) { try { final Field cclField = preventor.findFieldOfClass("sun.rmi.transport.Target", "ccl"); preventor.debug("Looping " + rmiTargetsMap.size() + " RMI Targets to find leaks"); for(Iterator<?> iter = rmiTargetsMap.values().iterator(); iter.hasNext(); ) { Object target = iter.next(); // sun.rmi.transport.Target ClassLoader ccl = (ClassLoader) cclField.get(target); if(preventor.isClassLoaderOrChild(ccl)) { preventor.warn("Removing RMI Target: " + target); iter.remove(); } } } catch (Exception ex) { preventor.error(ex); } }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "protected", "void", "clearRmiTargetsMap", "(", "ClassLoaderLeakPreventor", "preventor", ",", "Map", "<", "?", ",", "?", ">", "rmiTargetsMap", ")", "{", "try", "{", "final", "Field", "cclField", "=", "preventor", ".", "findFieldOfClass", "(", "\"sun.rmi.transport.Target\"", ",", "\"ccl\"", ")", ";", "preventor", ".", "debug", "(", "\"Looping \"", "+", "rmiTargetsMap", ".", "size", "(", ")", "+", "\" RMI Targets to find leaks\"", ")", ";", "for", "(", "Iterator", "<", "?", ">", "iter", "=", "rmiTargetsMap", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "Object", "target", "=", "iter", ".", "next", "(", ")", ";", "// sun.rmi.transport.Target", "ClassLoader", "ccl", "=", "(", "ClassLoader", ")", "cclField", ".", "get", "(", "target", ")", ";", "if", "(", "preventor", ".", "isClassLoaderOrChild", "(", "ccl", ")", ")", "{", "preventor", ".", "warn", "(", "\"Removing RMI Target: \"", "+", "target", ")", ";", "iter", ".", "remove", "(", ")", ";", "}", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "preventor", ".", "error", "(", "ex", ")", ";", "}", "}" ]
Iterate RMI Targets Map and remove entries loaded by protected ClassLoader
[ "Iterate", "RMI", "Targets", "Map", "and", "remove", "entries", "loaded", "by", "protected", "ClassLoader" ]
train
https://github.com/mjiderhamn/classloader-leak-prevention/blob/eea8e3cef64f8096dbbb87552df0a1bd272bcb63/classloader-leak-prevention/classloader-leak-prevention-core/src/main/java/se/jiderhamn/classloader/leak/prevention/cleanup/RmiTargetsCleanUp.java#L30-L47
finnyb/javampd
src/main/java/org/bff/javampd/player/MPDPlayer.java
MPDPlayer.firePlayerChangeEvent
protected synchronized void firePlayerChangeEvent(PlayerChangeEvent.Event event) { """ Sends the appropriate {@link PlayerChangeEvent} to all registered {@link PlayerChangeListener}s. @param event the {@link PlayerChangeEvent.Event} to send """ PlayerChangeEvent pce = new PlayerChangeEvent(this, event); for (PlayerChangeListener pcl : listeners) { pcl.playerChanged(pce); } }
java
protected synchronized void firePlayerChangeEvent(PlayerChangeEvent.Event event) { PlayerChangeEvent pce = new PlayerChangeEvent(this, event); for (PlayerChangeListener pcl : listeners) { pcl.playerChanged(pce); } }
[ "protected", "synchronized", "void", "firePlayerChangeEvent", "(", "PlayerChangeEvent", ".", "Event", "event", ")", "{", "PlayerChangeEvent", "pce", "=", "new", "PlayerChangeEvent", "(", "this", ",", "event", ")", ";", "for", "(", "PlayerChangeListener", "pcl", ":", "listeners", ")", "{", "pcl", ".", "playerChanged", "(", "pce", ")", ";", "}", "}" ]
Sends the appropriate {@link PlayerChangeEvent} to all registered {@link PlayerChangeListener}s. @param event the {@link PlayerChangeEvent.Event} to send
[ "Sends", "the", "appropriate", "{", "@link", "PlayerChangeEvent", "}", "to", "all", "registered", "{", "@link", "PlayerChangeListener", "}", "s", "." ]
train
https://github.com/finnyb/javampd/blob/186736e85fc238b4208cc9ee23373f9249376b4c/src/main/java/org/bff/javampd/player/MPDPlayer.java#L76-L82
structr/structr
structr-core/src/main/java/org/structr/schema/action/Function.java
Function.logException
protected void logException (final Throwable t, final String msg, final Object[] messageParams) { """ Logging of an Exception in a function with custom message and message parameters. @param t The thrown Exception @param msg The message to be printed @param messageParams The parameters for the message """ logger.error(msg, messageParams, t); }
java
protected void logException (final Throwable t, final String msg, final Object[] messageParams) { logger.error(msg, messageParams, t); }
[ "protected", "void", "logException", "(", "final", "Throwable", "t", ",", "final", "String", "msg", ",", "final", "Object", "[", "]", "messageParams", ")", "{", "logger", ".", "error", "(", "msg", ",", "messageParams", ",", "t", ")", ";", "}" ]
Logging of an Exception in a function with custom message and message parameters. @param t The thrown Exception @param msg The message to be printed @param messageParams The parameters for the message
[ "Logging", "of", "an", "Exception", "in", "a", "function", "with", "custom", "message", "and", "message", "parameters", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/schema/action/Function.java#L109-L111
javagl/Common
src/main/java/de/javagl/common/collections/Maps.java
Maps.incrementCount
public static <K> void incrementCount(Map<K, Integer> map, K k) { """ Increments the value that is stored for the given key in the given map by one, or sets it to 1 if there was no value stored for the given key. @param <K> The key type @param map The map @param k The key """ map.put(k, getCount(map, k)+1); }
java
public static <K> void incrementCount(Map<K, Integer> map, K k) { map.put(k, getCount(map, k)+1); }
[ "public", "static", "<", "K", ">", "void", "incrementCount", "(", "Map", "<", "K", ",", "Integer", ">", "map", ",", "K", "k", ")", "{", "map", ".", "put", "(", "k", ",", "getCount", "(", "map", ",", "k", ")", "+", "1", ")", ";", "}" ]
Increments the value that is stored for the given key in the given map by one, or sets it to 1 if there was no value stored for the given key. @param <K> The key type @param map The map @param k The key
[ "Increments", "the", "value", "that", "is", "stored", "for", "the", "given", "key", "in", "the", "given", "map", "by", "one", "or", "sets", "it", "to", "1", "if", "there", "was", "no", "value", "stored", "for", "the", "given", "key", "." ]
train
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/collections/Maps.java#L52-L55
cdk/cdk
base/valencycheck/src/main/java/org/openscience/cdk/tools/AtomTypeAwareSaturationChecker.java
AtomTypeAwareSaturationChecker.decideBondOrder
private void decideBondOrder(IAtomContainer atomContainer, int start) throws CDKException { """ This method decides the bond order on bonds that has the <code>SINGLE_OR_DOUBLE</code>-flag raised. @param atomContainer The molecule to investigate @param start The bond to start with @throws CDKException """ for (int i = 0; i < atomContainer.getBondCount(); i++) if (atomContainer.getBond(i).getFlag(CDKConstants.SINGLE_OR_DOUBLE)) atomContainer.getBond(i).setOrder(IBond.Order.SINGLE); for (int i = start; i < atomContainer.getBondCount(); i++) { checkBond(atomContainer, i); } /* * If we don't start with first bond, then we have to check the bonds * before the bond we started with. */ if (start > 0) { for (int i = start - 1; i >= 0; i--) { checkBond(atomContainer, i); } } }
java
private void decideBondOrder(IAtomContainer atomContainer, int start) throws CDKException { for (int i = 0; i < atomContainer.getBondCount(); i++) if (atomContainer.getBond(i).getFlag(CDKConstants.SINGLE_OR_DOUBLE)) atomContainer.getBond(i).setOrder(IBond.Order.SINGLE); for (int i = start; i < atomContainer.getBondCount(); i++) { checkBond(atomContainer, i); } /* * If we don't start with first bond, then we have to check the bonds * before the bond we started with. */ if (start > 0) { for (int i = start - 1; i >= 0; i--) { checkBond(atomContainer, i); } } }
[ "private", "void", "decideBondOrder", "(", "IAtomContainer", "atomContainer", ",", "int", "start", ")", "throws", "CDKException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "atomContainer", ".", "getBondCount", "(", ")", ";", "i", "++", ")", "if", "(", "atomContainer", ".", "getBond", "(", "i", ")", ".", "getFlag", "(", "CDKConstants", ".", "SINGLE_OR_DOUBLE", ")", ")", "atomContainer", ".", "getBond", "(", "i", ")", ".", "setOrder", "(", "IBond", ".", "Order", ".", "SINGLE", ")", ";", "for", "(", "int", "i", "=", "start", ";", "i", "<", "atomContainer", ".", "getBondCount", "(", ")", ";", "i", "++", ")", "{", "checkBond", "(", "atomContainer", ",", "i", ")", ";", "}", "/*\n * If we don't start with first bond, then we have to check the bonds\n * before the bond we started with.\n */", "if", "(", "start", ">", "0", ")", "{", "for", "(", "int", "i", "=", "start", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "checkBond", "(", "atomContainer", ",", "i", ")", ";", "}", "}", "}" ]
This method decides the bond order on bonds that has the <code>SINGLE_OR_DOUBLE</code>-flag raised. @param atomContainer The molecule to investigate @param start The bond to start with @throws CDKException
[ "This", "method", "decides", "the", "bond", "order", "on", "bonds", "that", "has", "the", "<code", ">", "SINGLE_OR_DOUBLE<", "/", "code", ">", "-", "flag", "raised", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/valencycheck/src/main/java/org/openscience/cdk/tools/AtomTypeAwareSaturationChecker.java#L138-L155
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
ExceptionUtils.printRootCauseStackTrace
@GwtIncompatible("incompatible method") public static void printRootCauseStackTrace(final Throwable throwable, final PrintWriter writer) { """ <p>Prints a compact stack trace for the root cause of a throwable.</p> <p>The compact stack trace starts with the root cause and prints stack frames up to the place where it was caught and wrapped. Then it prints the wrapped exception and continues with stack frames until the wrapper exception is caught and wrapped again, etc.</p> <p>The output of this method is consistent across JDK versions. Note that this is the opposite order to the JDK1.4 display.</p> <p>The method is equivalent to <code>printStackTrace</code> for throwables that don't have nested causes.</p> @param throwable the throwable to output, may be null @param writer the writer to output to, may not be null @throws IllegalArgumentException if the writer is <code>null</code> @since 2.0 """ if (throwable == null) { return; } Validate.isTrue(writer != null, "The PrintWriter must not be null"); final String trace[] = getRootCauseStackTrace(throwable); for (final String element : trace) { writer.println(element); } writer.flush(); }
java
@GwtIncompatible("incompatible method") public static void printRootCauseStackTrace(final Throwable throwable, final PrintWriter writer) { if (throwable == null) { return; } Validate.isTrue(writer != null, "The PrintWriter must not be null"); final String trace[] = getRootCauseStackTrace(throwable); for (final String element : trace) { writer.println(element); } writer.flush(); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "void", "printRootCauseStackTrace", "(", "final", "Throwable", "throwable", ",", "final", "PrintWriter", "writer", ")", "{", "if", "(", "throwable", "==", "null", ")", "{", "return", ";", "}", "Validate", ".", "isTrue", "(", "writer", "!=", "null", ",", "\"The PrintWriter must not be null\"", ")", ";", "final", "String", "trace", "[", "]", "=", "getRootCauseStackTrace", "(", "throwable", ")", ";", "for", "(", "final", "String", "element", ":", "trace", ")", "{", "writer", ".", "println", "(", "element", ")", ";", "}", "writer", ".", "flush", "(", ")", ";", "}" ]
<p>Prints a compact stack trace for the root cause of a throwable.</p> <p>The compact stack trace starts with the root cause and prints stack frames up to the place where it was caught and wrapped. Then it prints the wrapped exception and continues with stack frames until the wrapper exception is caught and wrapped again, etc.</p> <p>The output of this method is consistent across JDK versions. Note that this is the opposite order to the JDK1.4 display.</p> <p>The method is equivalent to <code>printStackTrace</code> for throwables that don't have nested causes.</p> @param throwable the throwable to output, may be null @param writer the writer to output to, may not be null @throws IllegalArgumentException if the writer is <code>null</code> @since 2.0
[ "<p", ">", "Prints", "a", "compact", "stack", "trace", "for", "the", "root", "cause", "of", "a", "throwable", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java#L503-L514
auth0/auth0-java
src/main/java/com/auth0/client/mgmt/filter/ClientGrantsFilter.java
ClientGrantsFilter.withPage
public ClientGrantsFilter withPage(int pageNumber, int amountPerPage) { """ Filter by page @param pageNumber the page number to retrieve. @param amountPerPage the amount of items per page to retrieve. @return this filter instance """ parameters.put("page", pageNumber); parameters.put("per_page", amountPerPage); return this; }
java
public ClientGrantsFilter withPage(int pageNumber, int amountPerPage) { parameters.put("page", pageNumber); parameters.put("per_page", amountPerPage); return this; }
[ "public", "ClientGrantsFilter", "withPage", "(", "int", "pageNumber", ",", "int", "amountPerPage", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "pageNumber", ")", ";", "parameters", ".", "put", "(", "\"per_page\"", ",", "amountPerPage", ")", ";", "return", "this", ";", "}" ]
Filter by page @param pageNumber the page number to retrieve. @param amountPerPage the amount of items per page to retrieve. @return this filter instance
[ "Filter", "by", "page" ]
train
https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/mgmt/filter/ClientGrantsFilter.java#L37-L41
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/query/Criteria.java
Criteria.endsWith
public Criteria endsWith(String s) { """ Crates new {@link Predicate} with leading wildcard <br /> <strong>NOTE: </strong>mind your schema and execution times as leading wildcards may not be supported. <strong>NOTE: </strong>Strings will not be automatically split on whitespace. @param s @return @throws InvalidDataAccessApiUsageException for strings with whitespace """ assertNoBlankInWildcardedQuery(s, true, false); predicates.add(new Predicate(OperationKey.ENDS_WITH, s)); return this; }
java
public Criteria endsWith(String s) { assertNoBlankInWildcardedQuery(s, true, false); predicates.add(new Predicate(OperationKey.ENDS_WITH, s)); return this; }
[ "public", "Criteria", "endsWith", "(", "String", "s", ")", "{", "assertNoBlankInWildcardedQuery", "(", "s", ",", "true", ",", "false", ")", ";", "predicates", ".", "add", "(", "new", "Predicate", "(", "OperationKey", ".", "ENDS_WITH", ",", "s", ")", ")", ";", "return", "this", ";", "}" ]
Crates new {@link Predicate} with leading wildcard <br /> <strong>NOTE: </strong>mind your schema and execution times as leading wildcards may not be supported. <strong>NOTE: </strong>Strings will not be automatically split on whitespace. @param s @return @throws InvalidDataAccessApiUsageException for strings with whitespace
[ "Crates", "new", "{", "@link", "Predicate", "}", "with", "leading", "wildcard", "<br", "/", ">", "<strong", ">", "NOTE", ":", "<", "/", "strong", ">", "mind", "your", "schema", "and", "execution", "times", "as", "leading", "wildcards", "may", "not", "be", "supported", ".", "<strong", ">", "NOTE", ":", "<", "/", "strong", ">", "Strings", "will", "not", "be", "automatically", "split", "on", "whitespace", "." ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L263-L267
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java
P2sVpnServerConfigurationsInner.beginCreateOrUpdate
public P2SVpnServerConfigurationInner beginCreateOrUpdate(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName, P2SVpnServerConfigurationInner p2SVpnServerConfigurationParameters) { """ Creates a P2SVpnServerConfiguration to associate with a VirtualWan if it doesn't exist else updates the existing P2SVpnServerConfiguration. @param resourceGroupName The resource group name of the VirtualWan. @param virtualWanName The name of the VirtualWan. @param p2SVpnServerConfigurationName The name of the P2SVpnServerConfiguration. @param p2SVpnServerConfigurationParameters Parameters supplied to create or Update a P2SVpnServerConfiguration. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the P2SVpnServerConfigurationInner object if successful. """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName, p2SVpnServerConfigurationParameters).toBlocking().single().body(); }
java
public P2SVpnServerConfigurationInner beginCreateOrUpdate(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName, P2SVpnServerConfigurationInner p2SVpnServerConfigurationParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName, p2SVpnServerConfigurationParameters).toBlocking().single().body(); }
[ "public", "P2SVpnServerConfigurationInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "virtualWanName", ",", "String", "p2SVpnServerConfigurationName", ",", "P2SVpnServerConfigurationInner", "p2SVpnServerConfigurationParameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualWanName", ",", "p2SVpnServerConfigurationName", ",", "p2SVpnServerConfigurationParameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates a P2SVpnServerConfiguration to associate with a VirtualWan if it doesn't exist else updates the existing P2SVpnServerConfiguration. @param resourceGroupName The resource group name of the VirtualWan. @param virtualWanName The name of the VirtualWan. @param p2SVpnServerConfigurationName The name of the P2SVpnServerConfiguration. @param p2SVpnServerConfigurationParameters Parameters supplied to create or Update a P2SVpnServerConfiguration. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the P2SVpnServerConfigurationInner object if successful.
[ "Creates", "a", "P2SVpnServerConfiguration", "to", "associate", "with", "a", "VirtualWan", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "P2SVpnServerConfiguration", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java#L279-L281
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java
JobSchedulesImpl.disableAsync
public Observable<Void> disableAsync(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions) { """ Disables a job schedule. No new jobs will be created until the job schedule is enabled again. @param jobScheduleId The ID of the job schedule to disable. @param jobScheduleDisableOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful. """ return disableWithServiceResponseAsync(jobScheduleId, jobScheduleDisableOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders> response) { return response.body(); } }); }
java
public Observable<Void> disableAsync(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions) { return disableWithServiceResponseAsync(jobScheduleId, jobScheduleDisableOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, JobScheduleDisableHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "disableAsync", "(", "String", "jobScheduleId", ",", "JobScheduleDisableOptions", "jobScheduleDisableOptions", ")", "{", "return", "disableWithServiceResponseAsync", "(", "jobScheduleId", ",", "jobScheduleDisableOptions", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "Void", ",", "JobScheduleDisableHeaders", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponseWithHeaders", "<", "Void", ",", "JobScheduleDisableHeaders", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Disables a job schedule. No new jobs will be created until the job schedule is enabled again. @param jobScheduleId The ID of the job schedule to disable. @param jobScheduleDisableOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Disables", "a", "job", "schedule", ".", "No", "new", "jobs", "will", "be", "created", "until", "the", "job", "schedule", "is", "enabled", "again", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java#L1450-L1457
meltmedia/cadmium
core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java
Jsr250Utils.createJsr250Executor
public static Jsr250Executor createJsr250Executor(Injector injector, final Logger log, Scope... scopes ) { """ Creates a Jsr250Executor for the specified scopes. @param injector @param log @param scopes @return """ final Set<Object> instances = findInstancesInScopes(injector, scopes); final List<Object> reverseInstances = new ArrayList<Object>(instances); Collections.reverse(reverseInstances); return new Jsr250Executor() { @Override public Set<Object> getInstances() { return instances; } @Override public void postConstruct() { for( Object instance : instances ) { postConstructQuietly(instance, log); } } @Override public void preDestroy() { for( Object instance : reverseInstances ) { preDestroyQuietly(instance, log); } } }; }
java
public static Jsr250Executor createJsr250Executor(Injector injector, final Logger log, Scope... scopes ) { final Set<Object> instances = findInstancesInScopes(injector, scopes); final List<Object> reverseInstances = new ArrayList<Object>(instances); Collections.reverse(reverseInstances); return new Jsr250Executor() { @Override public Set<Object> getInstances() { return instances; } @Override public void postConstruct() { for( Object instance : instances ) { postConstructQuietly(instance, log); } } @Override public void preDestroy() { for( Object instance : reverseInstances ) { preDestroyQuietly(instance, log); } } }; }
[ "public", "static", "Jsr250Executor", "createJsr250Executor", "(", "Injector", "injector", ",", "final", "Logger", "log", ",", "Scope", "...", "scopes", ")", "{", "final", "Set", "<", "Object", ">", "instances", "=", "findInstancesInScopes", "(", "injector", ",", "scopes", ")", ";", "final", "List", "<", "Object", ">", "reverseInstances", "=", "new", "ArrayList", "<", "Object", ">", "(", "instances", ")", ";", "Collections", ".", "reverse", "(", "reverseInstances", ")", ";", "return", "new", "Jsr250Executor", "(", ")", "{", "@", "Override", "public", "Set", "<", "Object", ">", "getInstances", "(", ")", "{", "return", "instances", ";", "}", "@", "Override", "public", "void", "postConstruct", "(", ")", "{", "for", "(", "Object", "instance", ":", "instances", ")", "{", "postConstructQuietly", "(", "instance", ",", "log", ")", ";", "}", "}", "@", "Override", "public", "void", "preDestroy", "(", ")", "{", "for", "(", "Object", "instance", ":", "reverseInstances", ")", "{", "preDestroyQuietly", "(", "instance", ",", "log", ")", ";", "}", "}", "}", ";", "}" ]
Creates a Jsr250Executor for the specified scopes. @param injector @param log @param scopes @return
[ "Creates", "a", "Jsr250Executor", "for", "the", "specified", "scopes", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java#L237-L263
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.sounds_id_PUT
public void sounds_id_PUT(Long id, OvhSound body) throws IOException { """ Alter this object properties REST: PUT /telephony/sounds/{id} @param body [required] New object properties @param id [required] Sound ID """ String qPath = "/telephony/sounds/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
java
public void sounds_id_PUT(Long id, OvhSound body) throws IOException { String qPath = "/telephony/sounds/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "sounds_id_PUT", "(", "Long", "id", ",", "OvhSound", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/sounds/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "id", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /telephony/sounds/{id} @param body [required] New object properties @param id [required] Sound ID
[ "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#L8741-L8745
Netflix/conductor
grpc-client/src/main/java/com/netflix/conductor/client/grpc/WorkflowClient.java
WorkflowClient.deleteWorkflow
public void deleteWorkflow(String workflowId, boolean archiveWorkflow) { """ Removes a workflow from the system @param workflowId the id of the workflow to be deleted @param archiveWorkflow flag to indicate if the workflow should be archived before deletion """ Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "Workflow id cannot be blank"); stub.removeWorkflow( WorkflowServicePb.RemoveWorkflowRequest.newBuilder() .setWorkflodId(workflowId) .setArchiveWorkflow(archiveWorkflow) .build() ); }
java
public void deleteWorkflow(String workflowId, boolean archiveWorkflow) { Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "Workflow id cannot be blank"); stub.removeWorkflow( WorkflowServicePb.RemoveWorkflowRequest.newBuilder() .setWorkflodId(workflowId) .setArchiveWorkflow(archiveWorkflow) .build() ); }
[ "public", "void", "deleteWorkflow", "(", "String", "workflowId", ",", "boolean", "archiveWorkflow", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "workflowId", ")", ",", "\"Workflow id cannot be blank\"", ")", ";", "stub", ".", "removeWorkflow", "(", "WorkflowServicePb", ".", "RemoveWorkflowRequest", ".", "newBuilder", "(", ")", ".", "setWorkflodId", "(", "workflowId", ")", ".", "setArchiveWorkflow", "(", "archiveWorkflow", ")", ".", "build", "(", ")", ")", ";", "}" ]
Removes a workflow from the system @param workflowId the id of the workflow to be deleted @param archiveWorkflow flag to indicate if the workflow should be archived before deletion
[ "Removes", "a", "workflow", "from", "the", "system" ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/grpc-client/src/main/java/com/netflix/conductor/client/grpc/WorkflowClient.java#L97-L105
baratine/baratine
core/src/main/java/com/caucho/v5/util/LruCache.java
LruCache.updateLru
private void updateLru(CacheItem<K,V> item) { """ Put item at the head of the used-twice lru list. This is always called while synchronized. """ long lruCounter = _lruCounter; long itemCounter = item._lruCounter; long delta = (lruCounter - itemCounter) & 0x3fffffff; if (_lruTimeout < delta || delta < 0) { // update LRU only if not used recently updateLruImpl(item); } }
java
private void updateLru(CacheItem<K,V> item) { long lruCounter = _lruCounter; long itemCounter = item._lruCounter; long delta = (lruCounter - itemCounter) & 0x3fffffff; if (_lruTimeout < delta || delta < 0) { // update LRU only if not used recently updateLruImpl(item); } }
[ "private", "void", "updateLru", "(", "CacheItem", "<", "K", ",", "V", ">", "item", ")", "{", "long", "lruCounter", "=", "_lruCounter", ";", "long", "itemCounter", "=", "item", ".", "_lruCounter", ";", "long", "delta", "=", "(", "lruCounter", "-", "itemCounter", ")", "&", "0x3fffffff", ";", "if", "(", "_lruTimeout", "<", "delta", "||", "delta", "<", "0", ")", "{", "// update LRU only if not used recently", "updateLruImpl", "(", "item", ")", ";", "}", "}" ]
Put item at the head of the used-twice lru list. This is always called while synchronized.
[ "Put", "item", "at", "the", "head", "of", "the", "used", "-", "twice", "lru", "list", ".", "This", "is", "always", "called", "while", "synchronized", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/LruCache.java#L413-L424
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
SourceToHTMLConverter.convertRoot
public static void convertRoot(ConfigurationImpl configuration, DocletEnvironment docEnv, DocPath outputdir) throws DocFileIOException, SimpleDocletException { """ Translate the TypeElements in the given DocletEnvironment to HTML representation. @param configuration the configuration. @param docEnv the DocletEnvironment to convert. @param outputdir the name of the directory to output to. @throws DocFileIOException if there is a problem generating an output file @throws SimpleDocletException if there is a problem reading a source file """ new SourceToHTMLConverter(configuration, docEnv, outputdir).generate(); }
java
public static void convertRoot(ConfigurationImpl configuration, DocletEnvironment docEnv, DocPath outputdir) throws DocFileIOException, SimpleDocletException { new SourceToHTMLConverter(configuration, docEnv, outputdir).generate(); }
[ "public", "static", "void", "convertRoot", "(", "ConfigurationImpl", "configuration", ",", "DocletEnvironment", "docEnv", ",", "DocPath", "outputdir", ")", "throws", "DocFileIOException", ",", "SimpleDocletException", "{", "new", "SourceToHTMLConverter", "(", "configuration", ",", "docEnv", ",", "outputdir", ")", ".", "generate", "(", ")", ";", "}" ]
Translate the TypeElements in the given DocletEnvironment to HTML representation. @param configuration the configuration. @param docEnv the DocletEnvironment to convert. @param outputdir the name of the directory to output to. @throws DocFileIOException if there is a problem generating an output file @throws SimpleDocletException if there is a problem reading a source file
[ "Translate", "the", "TypeElements", "in", "the", "given", "DocletEnvironment", "to", "HTML", "representation", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java#L109-L112
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/cache/CacheArgumentServices.java
CacheArgumentServices.computeSpecifiedArgPart
String computeSpecifiedArgPart(String[] keys, List<String> jsonArgs, List<String> paramNames) { """ Compute the part of cache key that depends of arguments @param keys : key from annotation @param jsonArgs : actual args @param paramNames : parameter name of concern method @return """ StringBuilder sb = new StringBuilder("["); boolean first = true; for (String key : keys) { if (!first) { sb.append(","); } first = false; String[] path = key.split("\\."); logger.debug("Process '{}' : {} token(s)", key, path.length); String paramName = path[0]; int idx = paramNames.indexOf(paramName); logger.debug("Index of param '{}' : '{}'", paramName, idx); String jsonArg = jsonArgs.get(idx); logger.debug("Param '{}' : '{}'", paramName, jsonArg); sb.append(processArg(Arrays.copyOfRange(path, 1, path.length), jsonArg)); } sb.append("]"); return sb.toString(); }
java
String computeSpecifiedArgPart(String[] keys, List<String> jsonArgs, List<String> paramNames) { StringBuilder sb = new StringBuilder("["); boolean first = true; for (String key : keys) { if (!first) { sb.append(","); } first = false; String[] path = key.split("\\."); logger.debug("Process '{}' : {} token(s)", key, path.length); String paramName = path[0]; int idx = paramNames.indexOf(paramName); logger.debug("Index of param '{}' : '{}'", paramName, idx); String jsonArg = jsonArgs.get(idx); logger.debug("Param '{}' : '{}'", paramName, jsonArg); sb.append(processArg(Arrays.copyOfRange(path, 1, path.length), jsonArg)); } sb.append("]"); return sb.toString(); }
[ "String", "computeSpecifiedArgPart", "(", "String", "[", "]", "keys", ",", "List", "<", "String", ">", "jsonArgs", ",", "List", "<", "String", ">", "paramNames", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"[\"", ")", ";", "boolean", "first", "=", "true", ";", "for", "(", "String", "key", ":", "keys", ")", "{", "if", "(", "!", "first", ")", "{", "sb", ".", "append", "(", "\",\"", ")", ";", "}", "first", "=", "false", ";", "String", "[", "]", "path", "=", "key", ".", "split", "(", "\"\\\\.\"", ")", ";", "logger", ".", "debug", "(", "\"Process '{}' : {} token(s)\"", ",", "key", ",", "path", ".", "length", ")", ";", "String", "paramName", "=", "path", "[", "0", "]", ";", "int", "idx", "=", "paramNames", ".", "indexOf", "(", "paramName", ")", ";", "logger", ".", "debug", "(", "\"Index of param '{}' : '{}'\"", ",", "paramName", ",", "idx", ")", ";", "String", "jsonArg", "=", "jsonArgs", ".", "get", "(", "idx", ")", ";", "logger", ".", "debug", "(", "\"Param '{}' : '{}'\"", ",", "paramName", ",", "jsonArg", ")", ";", "sb", ".", "append", "(", "processArg", "(", "Arrays", ".", "copyOfRange", "(", "path", ",", "1", ",", "path", ".", "length", ")", ",", "jsonArg", ")", ")", ";", "}", "sb", ".", "append", "(", "\"]\"", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Compute the part of cache key that depends of arguments @param keys : key from annotation @param jsonArgs : actual args @param paramNames : parameter name of concern method @return
[ "Compute", "the", "part", "of", "cache", "key", "that", "depends", "of", "arguments" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/cache/CacheArgumentServices.java#L56-L75
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java
CommerceSubscriptionEntryPersistenceImpl.findByUUID_G
@Override public CommerceSubscriptionEntry findByUUID_G(String uuid, long groupId) throws NoSuchSubscriptionEntryException { """ Returns the commerce subscription entry where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchSubscriptionEntryException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce subscription entry @throws NoSuchSubscriptionEntryException if a matching commerce subscription entry could not be found """ CommerceSubscriptionEntry commerceSubscriptionEntry = fetchByUUID_G(uuid, groupId); if (commerceSubscriptionEntry == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchSubscriptionEntryException(msg.toString()); } return commerceSubscriptionEntry; }
java
@Override public CommerceSubscriptionEntry findByUUID_G(String uuid, long groupId) throws NoSuchSubscriptionEntryException { CommerceSubscriptionEntry commerceSubscriptionEntry = fetchByUUID_G(uuid, groupId); if (commerceSubscriptionEntry == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchSubscriptionEntryException(msg.toString()); } return commerceSubscriptionEntry; }
[ "@", "Override", "public", "CommerceSubscriptionEntry", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchSubscriptionEntryException", "{", "CommerceSubscriptionEntry", "commerceSubscriptionEntry", "=", "fetchByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "if", "(", "commerceSubscriptionEntry", "==", "null", ")", "{", "StringBundler", "msg", "=", "new", "StringBundler", "(", "6", ")", ";", "msg", ".", "append", "(", "_NO_SUCH_ENTITY_WITH_KEY", ")", ";", "msg", ".", "append", "(", "\"uuid=\"", ")", ";", "msg", ".", "append", "(", "uuid", ")", ";", "msg", ".", "append", "(", "\", groupId=\"", ")", ";", "msg", ".", "append", "(", "groupId", ")", ";", "msg", ".", "append", "(", "\"}\"", ")", ";", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "throw", "new", "NoSuchSubscriptionEntryException", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "return", "commerceSubscriptionEntry", ";", "}" ]
Returns the commerce subscription entry where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchSubscriptionEntryException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce subscription entry @throws NoSuchSubscriptionEntryException if a matching commerce subscription entry could not be found
[ "Returns", "the", "commerce", "subscription", "entry", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchSubscriptionEntryException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java#L675-L702
microfocus-idol/java-configuration-impl
src/main/java/com/hp/autonomy/frontend/configuration/redis/RedisConfig.java
RedisConfig.basicValidate
@Override public void basicValidate(final String section) throws ConfigException { """ Validates the configuration @throws ConfigException If either: <ul> <li>address is non null and invalid</li> <li>address is null and sentinels is null or empty </li> <li>sentinels is non null and non empty and masterName is null or blank</li> <li>any sentinels are invalid</li> </ul> """ super.basicValidate(CONFIG_SECTION); if (address == null && (sentinels == null || sentinels.isEmpty())) { throw new ConfigException(CONFIG_SECTION, "Redis configuration requires either an address or at least one sentinel to connect to"); } if (sentinels != null && !sentinels.isEmpty()) { if (StringUtils.isBlank(masterName)) { throw new ConfigException(CONFIG_SECTION, "Redis configuration requires a masterName when connecting to sentinel"); } for (final HostAndPort sentinel : sentinels) { sentinel.basicValidate(CONFIG_SECTION); } } }
java
@Override public void basicValidate(final String section) throws ConfigException { super.basicValidate(CONFIG_SECTION); if (address == null && (sentinels == null || sentinels.isEmpty())) { throw new ConfigException(CONFIG_SECTION, "Redis configuration requires either an address or at least one sentinel to connect to"); } if (sentinels != null && !sentinels.isEmpty()) { if (StringUtils.isBlank(masterName)) { throw new ConfigException(CONFIG_SECTION, "Redis configuration requires a masterName when connecting to sentinel"); } for (final HostAndPort sentinel : sentinels) { sentinel.basicValidate(CONFIG_SECTION); } } }
[ "@", "Override", "public", "void", "basicValidate", "(", "final", "String", "section", ")", "throws", "ConfigException", "{", "super", ".", "basicValidate", "(", "CONFIG_SECTION", ")", ";", "if", "(", "address", "==", "null", "&&", "(", "sentinels", "==", "null", "||", "sentinels", ".", "isEmpty", "(", ")", ")", ")", "{", "throw", "new", "ConfigException", "(", "CONFIG_SECTION", ",", "\"Redis configuration requires either an address or at least one sentinel to connect to\"", ")", ";", "}", "if", "(", "sentinels", "!=", "null", "&&", "!", "sentinels", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "masterName", ")", ")", "{", "throw", "new", "ConfigException", "(", "CONFIG_SECTION", ",", "\"Redis configuration requires a masterName when connecting to sentinel\"", ")", ";", "}", "for", "(", "final", "HostAndPort", "sentinel", ":", "sentinels", ")", "{", "sentinel", ".", "basicValidate", "(", "CONFIG_SECTION", ")", ";", "}", "}", "}" ]
Validates the configuration @throws ConfigException If either: <ul> <li>address is non null and invalid</li> <li>address is null and sentinels is null or empty </li> <li>sentinels is non null and non empty and masterName is null or blank</li> <li>any sentinels are invalid</li> </ul>
[ "Validates", "the", "configuration" ]
train
https://github.com/microfocus-idol/java-configuration-impl/blob/cd9d744cacfaaae3c76cacc211e65742bbc7b00a/src/main/java/com/hp/autonomy/frontend/configuration/redis/RedisConfig.java#L57-L74
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/table/StandardTableSliceGroup.java
StandardTableSliceGroup.create
public static StandardTableSliceGroup create(Table original, String... columnsNames) { """ Returns a viewGroup splitting the original table on the given columns. The named columns must be CategoricalColumns """ List<CategoricalColumn<?>> columns = original.categoricalColumns(columnsNames); return new StandardTableSliceGroup(original, columns.toArray(new CategoricalColumn<?>[0])); }
java
public static StandardTableSliceGroup create(Table original, String... columnsNames) { List<CategoricalColumn<?>> columns = original.categoricalColumns(columnsNames); return new StandardTableSliceGroup(original, columns.toArray(new CategoricalColumn<?>[0])); }
[ "public", "static", "StandardTableSliceGroup", "create", "(", "Table", "original", ",", "String", "...", "columnsNames", ")", "{", "List", "<", "CategoricalColumn", "<", "?", ">", ">", "columns", "=", "original", ".", "categoricalColumns", "(", "columnsNames", ")", ";", "return", "new", "StandardTableSliceGroup", "(", "original", ",", "columns", ".", "toArray", "(", "new", "CategoricalColumn", "<", "?", ">", "[", "0", "]", ")", ")", ";", "}" ]
Returns a viewGroup splitting the original table on the given columns. The named columns must be CategoricalColumns
[ "Returns", "a", "viewGroup", "splitting", "the", "original", "table", "on", "the", "given", "columns", ".", "The", "named", "columns", "must", "be", "CategoricalColumns" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/table/StandardTableSliceGroup.java#L50-L53
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleUtility.java
LocaleUtility.isFallbackOf
public static boolean isFallbackOf(Locale parent, Locale child) { """ Compare two locales, and return true if the parent is a 'strict' fallback of the child (parent string is a fallback of child string). """ return isFallbackOf(parent.toString(), child.toString()); }
java
public static boolean isFallbackOf(Locale parent, Locale child) { return isFallbackOf(parent.toString(), child.toString()); }
[ "public", "static", "boolean", "isFallbackOf", "(", "Locale", "parent", ",", "Locale", "child", ")", "{", "return", "isFallbackOf", "(", "parent", ".", "toString", "(", ")", ",", "child", ".", "toString", "(", ")", ")", ";", "}" ]
Compare two locales, and return true if the parent is a 'strict' fallback of the child (parent string is a fallback of child string).
[ "Compare", "two", "locales", "and", "return", "true", "if", "the", "parent", "is", "a", "strict", "fallback", "of", "the", "child", "(", "parent", "string", "is", "a", "fallback", "of", "child", "string", ")", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleUtility.java#L69-L71
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java
AuditorFactory.getAuditor
public static IHEAuditor getAuditor(String className, AuditorModuleConfig config, AuditorModuleContext context) { """ Get an auditor instance for the specified auditor class name, auditor configuration, and auditor context. @param className Class name of the auditor class to instantiate @param config Auditor configuration to use @param context Auditor context to use @return Instance of an IHE Auditor """ Class<? extends IHEAuditor> clazz = AuditorFactory.getAuditorClassForClassName(className); return getAuditor(clazz, config, context); }
java
public static IHEAuditor getAuditor(String className, AuditorModuleConfig config, AuditorModuleContext context) { Class<? extends IHEAuditor> clazz = AuditorFactory.getAuditorClassForClassName(className); return getAuditor(clazz, config, context); }
[ "public", "static", "IHEAuditor", "getAuditor", "(", "String", "className", ",", "AuditorModuleConfig", "config", ",", "AuditorModuleContext", "context", ")", "{", "Class", "<", "?", "extends", "IHEAuditor", ">", "clazz", "=", "AuditorFactory", ".", "getAuditorClassForClassName", "(", "className", ")", ";", "return", "getAuditor", "(", "clazz", ",", "config", ",", "context", ")", ";", "}" ]
Get an auditor instance for the specified auditor class name, auditor configuration, and auditor context. @param className Class name of the auditor class to instantiate @param config Auditor configuration to use @param context Auditor context to use @return Instance of an IHE Auditor
[ "Get", "an", "auditor", "instance", "for", "the", "specified", "auditor", "class", "name", "auditor", "configuration", "and", "auditor", "context", "." ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java#L106-L110
apache/groovy
subprojects/groovy-sql/src/main/java/groovy/sql/GroovyResultSetExtension.java
GroovyResultSetExtension.putAt
public void putAt(int index, Object newValue) throws SQLException { """ Supports integer based subscript operators for updating the values of numbered columns starting at zero. Negative indices are supported, they will count from the last column backwards. @param index is the number of the column to look at starting at 1 @param newValue the updated value @throws java.sql.SQLException if something goes wrong @see ResultSet#updateObject(java.lang.String, java.lang.Object) """ index = normalizeIndex(index); getResultSet().updateObject(index, newValue); }
java
public void putAt(int index, Object newValue) throws SQLException { index = normalizeIndex(index); getResultSet().updateObject(index, newValue); }
[ "public", "void", "putAt", "(", "int", "index", ",", "Object", "newValue", ")", "throws", "SQLException", "{", "index", "=", "normalizeIndex", "(", "index", ")", ";", "getResultSet", "(", ")", ".", "updateObject", "(", "index", ",", "newValue", ")", ";", "}" ]
Supports integer based subscript operators for updating the values of numbered columns starting at zero. Negative indices are supported, they will count from the last column backwards. @param index is the number of the column to look at starting at 1 @param newValue the updated value @throws java.sql.SQLException if something goes wrong @see ResultSet#updateObject(java.lang.String, java.lang.Object)
[ "Supports", "integer", "based", "subscript", "operators", "for", "updating", "the", "values", "of", "numbered", "columns", "starting", "at", "zero", ".", "Negative", "indices", "are", "supported", "they", "will", "count", "from", "the", "last", "column", "backwards", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/GroovyResultSetExtension.java#L166-L169
contentful/contentful-management.java
src/main/java/com/contentful/java/cma/ModuleSpaceMemberships.java
ModuleSpaceMemberships.fetchAll
public CMAArray<CMASpaceMembership> fetchAll(Map<String, String> query) { """ Fetch all memberships of the configured space. @param query define which space memberships to return. @return the array of memberships. @throws IllegalArgumentException if spaceId is null. @throws CMANotWithEnvironmentsException if environmentId was set using {@link CMAClient.Builder#setEnvironmentId(String)}. @see CMAClient.Builder#setSpaceId(String) """ throwIfEnvironmentIdIsSet(); return fetchAll(spaceId, query); }
java
public CMAArray<CMASpaceMembership> fetchAll(Map<String, String> query) { throwIfEnvironmentIdIsSet(); return fetchAll(spaceId, query); }
[ "public", "CMAArray", "<", "CMASpaceMembership", ">", "fetchAll", "(", "Map", "<", "String", ",", "String", ">", "query", ")", "{", "throwIfEnvironmentIdIsSet", "(", ")", ";", "return", "fetchAll", "(", "spaceId", ",", "query", ")", ";", "}" ]
Fetch all memberships of the configured space. @param query define which space memberships to return. @return the array of memberships. @throws IllegalArgumentException if spaceId is null. @throws CMANotWithEnvironmentsException if environmentId was set using {@link CMAClient.Builder#setEnvironmentId(String)}. @see CMAClient.Builder#setSpaceId(String)
[ "Fetch", "all", "memberships", "of", "the", "configured", "space", "." ]
train
https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleSpaceMemberships.java#L100-L103
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.elementMult
public static void elementMult(DMatrixD1 a , DMatrixD1 b ) { """ <p>Performs the an element by element multiplication operation:<br> <br> a<sub>ij</sub> = a<sub>ij</sub> * b<sub>ij</sub> <br> </p> @param a The left matrix in the multiplication operation. Modified. @param b The right matrix in the multiplication operation. Not modified. """ if( a.numCols != b.numCols || a.numRows != b.numRows ) { throw new MatrixDimensionException("The 'a' and 'b' matrices do not have compatible dimensions"); } int length = a.getNumElements(); for( int i = 0; i < length; i++ ) { a.times(i, b.get(i)); } }
java
public static void elementMult(DMatrixD1 a , DMatrixD1 b ) { if( a.numCols != b.numCols || a.numRows != b.numRows ) { throw new MatrixDimensionException("The 'a' and 'b' matrices do not have compatible dimensions"); } int length = a.getNumElements(); for( int i = 0; i < length; i++ ) { a.times(i, b.get(i)); } }
[ "public", "static", "void", "elementMult", "(", "DMatrixD1", "a", ",", "DMatrixD1", "b", ")", "{", "if", "(", "a", ".", "numCols", "!=", "b", ".", "numCols", "||", "a", ".", "numRows", "!=", "b", ".", "numRows", ")", "{", "throw", "new", "MatrixDimensionException", "(", "\"The 'a' and 'b' matrices do not have compatible dimensions\"", ")", ";", "}", "int", "length", "=", "a", ".", "getNumElements", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "a", ".", "times", "(", "i", ",", "b", ".", "get", "(", "i", ")", ")", ";", "}", "}" ]
<p>Performs the an element by element multiplication operation:<br> <br> a<sub>ij</sub> = a<sub>ij</sub> * b<sub>ij</sub> <br> </p> @param a The left matrix in the multiplication operation. Modified. @param b The right matrix in the multiplication operation. Not modified.
[ "<p", ">", "Performs", "the", "an", "element", "by", "element", "multiplication", "operation", ":", "<br", ">", "<br", ">", "a<sub", ">", "ij<", "/", "sub", ">", "=", "a<sub", ">", "ij<", "/", "sub", ">", "*", "b<sub", ">", "ij<", "/", "sub", ">", "<br", ">", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1507-L1518
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java
VirtualMachineScaleSetVMsInner.getInstanceView
public VirtualMachineScaleSetVMInstanceViewInner getInstanceView(String resourceGroupName, String vmScaleSetName, String instanceId) { """ Gets the status of a virtual machine from a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @param instanceId The instance ID of the virtual machine. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualMachineScaleSetVMInstanceViewInner object if successful. """ return getInstanceViewWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).toBlocking().single().body(); }
java
public VirtualMachineScaleSetVMInstanceViewInner getInstanceView(String resourceGroupName, String vmScaleSetName, String instanceId) { return getInstanceViewWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).toBlocking().single().body(); }
[ "public", "VirtualMachineScaleSetVMInstanceViewInner", "getInstanceView", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ",", "String", "instanceId", ")", "{", "return", "getInstanceViewWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ",", "instanceId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets the status of a virtual machine from a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @param instanceId The instance ID of the virtual machine. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualMachineScaleSetVMInstanceViewInner object if successful.
[ "Gets", "the", "status", "of", "a", "virtual", "machine", "from", "a", "VM", "scale", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java#L1134-L1136
jhalterman/failsafe
src/main/java/net/jodah/failsafe/FailsafeExecutor.java
FailsafeExecutor.runAsyncExecution
public CompletableFuture<Void> runAsyncExecution(AsyncRunnable runnable) { """ Executes the {@code runnable} asynchronously until successful or until the configured policies are exceeded. This method is intended for integration with asynchronous code. Retries must be manually scheduled via one of the {@code AsyncExecution.retry} methods. <p> If a configured circuit breaker is open, the resulting future is completed with {@link CircuitBreakerOpenException}. @throws NullPointerException if the {@code runnable} is null @throws RejectedExecutionException if the {@code runnable} cannot be scheduled for execution """ return callAsync(execution -> Functions.asyncOfExecution(runnable, execution), true); }
java
public CompletableFuture<Void> runAsyncExecution(AsyncRunnable runnable) { return callAsync(execution -> Functions.asyncOfExecution(runnable, execution), true); }
[ "public", "CompletableFuture", "<", "Void", ">", "runAsyncExecution", "(", "AsyncRunnable", "runnable", ")", "{", "return", "callAsync", "(", "execution", "->", "Functions", ".", "asyncOfExecution", "(", "runnable", ",", "execution", ")", ",", "true", ")", ";", "}" ]
Executes the {@code runnable} asynchronously until successful or until the configured policies are exceeded. This method is intended for integration with asynchronous code. Retries must be manually scheduled via one of the {@code AsyncExecution.retry} methods. <p> If a configured circuit breaker is open, the resulting future is completed with {@link CircuitBreakerOpenException}. @throws NullPointerException if the {@code runnable} is null @throws RejectedExecutionException if the {@code runnable} cannot be scheduled for execution
[ "Executes", "the", "{", "@code", "runnable", "}", "asynchronously", "until", "successful", "or", "until", "the", "configured", "policies", "are", "exceeded", ".", "This", "method", "is", "intended", "for", "integration", "with", "asynchronous", "code", ".", "Retries", "must", "be", "manually", "scheduled", "via", "one", "of", "the", "{", "@code", "AsyncExecution", ".", "retry", "}", "methods", ".", "<p", ">", "If", "a", "configured", "circuit", "breaker", "is", "open", "the", "resulting", "future", "is", "completed", "with", "{", "@link", "CircuitBreakerOpenException", "}", "." ]
train
https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/FailsafeExecutor.java#L269-L271
h2oai/h2o-3
h2o-core/src/main/java/water/MRTask.java
MRTask.outputFrame
public Frame outputFrame(Key<Frame> key, String [] names, String [][] domains) { """ Get the resulting Frame from this invoked MRTask. If the passed in <code>key</code> is not null, then the resulting Frame will appear in the DKV. AppendableVec instances are closed into Vec instances, which then appear in the DKV. @param key If null, then the Frame will not appear in the DKV. Otherwise, this result will appear in the DKV under this key. @param names The names of the columns in the resulting Frame. @param domains The domains of the columns in the resulting Frame. @return null if _noutputs is 0, otherwise returns a Frame. """ Futures fs = new Futures(); Frame res = closeFrame(key, names, domains, fs); if( key != null ) DKV.put(res,fs); fs.blockForPending(); return res; }
java
public Frame outputFrame(Key<Frame> key, String [] names, String [][] domains){ Futures fs = new Futures(); Frame res = closeFrame(key, names, domains, fs); if( key != null ) DKV.put(res,fs); fs.blockForPending(); return res; }
[ "public", "Frame", "outputFrame", "(", "Key", "<", "Frame", ">", "key", ",", "String", "[", "]", "names", ",", "String", "[", "]", "[", "]", "domains", ")", "{", "Futures", "fs", "=", "new", "Futures", "(", ")", ";", "Frame", "res", "=", "closeFrame", "(", "key", ",", "names", ",", "domains", ",", "fs", ")", ";", "if", "(", "key", "!=", "null", ")", "DKV", ".", "put", "(", "res", ",", "fs", ")", ";", "fs", ".", "blockForPending", "(", ")", ";", "return", "res", ";", "}" ]
Get the resulting Frame from this invoked MRTask. If the passed in <code>key</code> is not null, then the resulting Frame will appear in the DKV. AppendableVec instances are closed into Vec instances, which then appear in the DKV. @param key If null, then the Frame will not appear in the DKV. Otherwise, this result will appear in the DKV under this key. @param names The names of the columns in the resulting Frame. @param domains The domains of the columns in the resulting Frame. @return null if _noutputs is 0, otherwise returns a Frame.
[ "Get", "the", "resulting", "Frame", "from", "this", "invoked", "MRTask", ".", "If", "the", "passed", "in", "<code", ">", "key<", "/", "code", ">", "is", "not", "null", "then", "the", "resulting", "Frame", "will", "appear", "in", "the", "DKV", ".", "AppendableVec", "instances", "are", "closed", "into", "Vec", "instances", "which", "then", "appear", "in", "the", "DKV", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/MRTask.java#L218-L224
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/common/Similarity.java
Similarity.check
private static void check(Vector a, Vector b) { """ Throws an exception if either {@code Vector} is {@code null} or if the {@code Vector} lengths do not match. """ if (a.length() != b.length()) throw new IllegalArgumentException( "input vector lengths do not match"); }
java
private static void check(Vector a, Vector b) { if (a.length() != b.length()) throw new IllegalArgumentException( "input vector lengths do not match"); }
[ "private", "static", "void", "check", "(", "Vector", "a", ",", "Vector", "b", ")", "{", "if", "(", "a", ".", "length", "(", ")", "!=", "b", ".", "length", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"input vector lengths do not match\"", ")", ";", "}" ]
Throws an exception if either {@code Vector} is {@code null} or if the {@code Vector} lengths do not match.
[ "Throws", "an", "exception", "if", "either", "{" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/common/Similarity.java#L313-L317