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
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAsymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.java
OWLAsymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLAsymmetricObjectPropertyAxiomImpl instance) throws SerializationException { """ Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful """ serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLAsymmetricObjectPropertyAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLAsymmetricObjectPropertyAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAsymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.java#L73-L76
JoeKerouac/utils
src/main/java/com/joe/utils/common/StringUtils.java
StringUtils.lcs
private static long lcs(String arg0, String arg1, int i, int j) { """ 求两个字符串的最大公共子序列的长度 @param arg0 字符串1 @param arg1 字符串2 @param i 字符串1的当前位置指针 @param j 字符串2的当前位置指针 @return 两个字符串的最大公共子序列的长度 """ if (arg0.length() == i || arg1.length() == j) { return 0; } if (arg0.charAt(i) == arg1.charAt(j)) { return 1 + lcs(arg0, arg1, ++i, ++j); } else { return Math.max(lcs(arg0, arg1, ++i, j), lcs(arg0, arg1, i, ++j)); } }
java
private static long lcs(String arg0, String arg1, int i, int j) { if (arg0.length() == i || arg1.length() == j) { return 0; } if (arg0.charAt(i) == arg1.charAt(j)) { return 1 + lcs(arg0, arg1, ++i, ++j); } else { return Math.max(lcs(arg0, arg1, ++i, j), lcs(arg0, arg1, i, ++j)); } }
[ "private", "static", "long", "lcs", "(", "String", "arg0", ",", "String", "arg1", ",", "int", "i", ",", "int", "j", ")", "{", "if", "(", "arg0", ".", "length", "(", ")", "==", "i", "||", "arg1", ".", "length", "(", ")", "==", "j", ")", "{", "return", "0", ";", "}", "if", "(", "arg0", ".", "charAt", "(", "i", ")", "==", "arg1", ".", "charAt", "(", "j", ")", ")", "{", "return", "1", "+", "lcs", "(", "arg0", ",", "arg1", ",", "++", "i", ",", "++", "j", ")", ";", "}", "else", "{", "return", "Math", ".", "max", "(", "lcs", "(", "arg0", ",", "arg1", ",", "++", "i", ",", "j", ")", ",", "lcs", "(", "arg0", ",", "arg1", ",", "i", ",", "++", "j", ")", ")", ";", "}", "}" ]
求两个字符串的最大公共子序列的长度 @param arg0 字符串1 @param arg1 字符串2 @param i 字符串1的当前位置指针 @param j 字符串2的当前位置指针 @return 两个字符串的最大公共子序列的长度
[ "求两个字符串的最大公共子序列的长度" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/StringUtils.java#L261-L271
jmeetsma/Iglu-Http
src/main/java/org/ijsberg/iglu/util/http/ServletSupport.java
ServletSupport.getCookieValue
public static String getCookieValue(ServletRequest request, String key) { """ Retrieves a value from a cookie @param request @param key @return """ Cookie[] cookies = ((HttpServletRequest) request).getCookies(); if (cookies != null) { for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equals(key)) { return cookies[i].getValue(); } } } return null; }
java
public static String getCookieValue(ServletRequest request, String key) { Cookie[] cookies = ((HttpServletRequest) request).getCookies(); if (cookies != null) { for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equals(key)) { return cookies[i].getValue(); } } } return null; }
[ "public", "static", "String", "getCookieValue", "(", "ServletRequest", "request", ",", "String", "key", ")", "{", "Cookie", "[", "]", "cookies", "=", "(", "(", "HttpServletRequest", ")", "request", ")", ".", "getCookies", "(", ")", ";", "if", "(", "cookies", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cookies", ".", "length", ";", "i", "++", ")", "{", "if", "(", "cookies", "[", "i", "]", ".", "getName", "(", ")", ".", "equals", "(", "key", ")", ")", "{", "return", "cookies", "[", "i", "]", ".", "getValue", "(", ")", ";", "}", "}", "}", "return", "null", ";", "}" ]
Retrieves a value from a cookie @param request @param key @return
[ "Retrieves", "a", "value", "from", "a", "cookie" ]
train
https://github.com/jmeetsma/Iglu-Http/blob/5b5ed3b417285dc79b7aa013bf2340bb5ba1ffbe/src/main/java/org/ijsberg/iglu/util/http/ServletSupport.java#L553-L567
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java
SimpleRandomSampling.xbarStd
public static double xbarStd(double std, int sampleN) { """ Calculates Standard Deviation for Xbar for infinite population size @param std @param sampleN @return """ return Math.sqrt(xbarVariance(std*std, sampleN, Integer.MAX_VALUE)); }
java
public static double xbarStd(double std, int sampleN) { return Math.sqrt(xbarVariance(std*std, sampleN, Integer.MAX_VALUE)); }
[ "public", "static", "double", "xbarStd", "(", "double", "std", ",", "int", "sampleN", ")", "{", "return", "Math", ".", "sqrt", "(", "xbarVariance", "(", "std", "*", "std", ",", "sampleN", ",", "Integer", ".", "MAX_VALUE", ")", ")", ";", "}" ]
Calculates Standard Deviation for Xbar for infinite population size @param std @param sampleN @return
[ "Calculates", "Standard", "Deviation", "for", "Xbar", "for", "infinite", "population", "size" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L178-L180
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java
ReviewsImpl.addVideoFrameUrlWithServiceResponseAsync
public Observable<ServiceResponse<Void>> addVideoFrameUrlWithServiceResponseAsync(String teamName, String reviewId, String contentType, List<VideoFrameBodyItem> videoFrameBody, AddVideoFrameUrlOptionalParameter addVideoFrameUrlOptionalParameter) { """ Use this method to add frames for a video review.Timescale: This parameter is a factor which is used to convert the timestamp on a frame into milliseconds. Timescale is provided in the output of the Content Moderator video media processor on the Azure Media Services platform.Timescale in the Video Moderation output is Ticks/Second. @param teamName Your team name. @param reviewId Id of the review. @param contentType The content type. @param videoFrameBody Body for add video frames API @param addVideoFrameUrlOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (teamName == null) { throw new IllegalArgumentException("Parameter teamName is required and cannot be null."); } if (reviewId == null) { throw new IllegalArgumentException("Parameter reviewId is required and cannot be null."); } if (contentType == null) { throw new IllegalArgumentException("Parameter contentType is required and cannot be null."); } if (videoFrameBody == null) { throw new IllegalArgumentException("Parameter videoFrameBody is required and cannot be null."); } Validator.validate(videoFrameBody); final Integer timescale = addVideoFrameUrlOptionalParameter != null ? addVideoFrameUrlOptionalParameter.timescale() : null; return addVideoFrameUrlWithServiceResponseAsync(teamName, reviewId, contentType, videoFrameBody, timescale); }
java
public Observable<ServiceResponse<Void>> addVideoFrameUrlWithServiceResponseAsync(String teamName, String reviewId, String contentType, List<VideoFrameBodyItem> videoFrameBody, AddVideoFrameUrlOptionalParameter addVideoFrameUrlOptionalParameter) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (teamName == null) { throw new IllegalArgumentException("Parameter teamName is required and cannot be null."); } if (reviewId == null) { throw new IllegalArgumentException("Parameter reviewId is required and cannot be null."); } if (contentType == null) { throw new IllegalArgumentException("Parameter contentType is required and cannot be null."); } if (videoFrameBody == null) { throw new IllegalArgumentException("Parameter videoFrameBody is required and cannot be null."); } Validator.validate(videoFrameBody); final Integer timescale = addVideoFrameUrlOptionalParameter != null ? addVideoFrameUrlOptionalParameter.timescale() : null; return addVideoFrameUrlWithServiceResponseAsync(teamName, reviewId, contentType, videoFrameBody, timescale); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Void", ">", ">", "addVideoFrameUrlWithServiceResponseAsync", "(", "String", "teamName", ",", "String", "reviewId", ",", "String", "contentType", ",", "List", "<", "VideoFrameBodyItem", ">", "videoFrameBody", ",", "AddVideoFrameUrlOptionalParameter", "addVideoFrameUrlOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "baseUrl", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.baseUrl() is required and cannot be null.\"", ")", ";", "}", "if", "(", "teamName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter teamName is required and cannot be null.\"", ")", ";", "}", "if", "(", "reviewId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter reviewId is required and cannot be null.\"", ")", ";", "}", "if", "(", "contentType", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter contentType is required and cannot be null.\"", ")", ";", "}", "if", "(", "videoFrameBody", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter videoFrameBody is required and cannot be null.\"", ")", ";", "}", "Validator", ".", "validate", "(", "videoFrameBody", ")", ";", "final", "Integer", "timescale", "=", "addVideoFrameUrlOptionalParameter", "!=", "null", "?", "addVideoFrameUrlOptionalParameter", ".", "timescale", "(", ")", ":", "null", ";", "return", "addVideoFrameUrlWithServiceResponseAsync", "(", "teamName", ",", "reviewId", ",", "contentType", ",", "videoFrameBody", ",", "timescale", ")", ";", "}" ]
Use this method to add frames for a video review.Timescale: This parameter is a factor which is used to convert the timestamp on a frame into milliseconds. Timescale is provided in the output of the Content Moderator video media processor on the Azure Media Services platform.Timescale in the Video Moderation output is Ticks/Second. @param teamName Your team name. @param reviewId Id of the review. @param contentType The content type. @param videoFrameBody Body for add video frames API @param addVideoFrameUrlOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Use", "this", "method", "to", "add", "frames", "for", "a", "video", "review", ".", "Timescale", ":", "This", "parameter", "is", "a", "factor", "which", "is", "used", "to", "convert", "the", "timestamp", "on", "a", "frame", "into", "milliseconds", ".", "Timescale", "is", "provided", "in", "the", "output", "of", "the", "Content", "Moderator", "video", "media", "processor", "on", "the", "Azure", "Media", "Services", "platform", ".", "Timescale", "in", "the", "Video", "Moderation", "output", "is", "Ticks", "/", "Second", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L2232-L2252
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java
SnowflakeChunkDownloader.createChunkDownloaderExecutorService
private static ThreadPoolExecutor createChunkDownloaderExecutorService( final String threadNamePrefix, final int parallel) { """ Create a pool of downloader threads. @param threadNamePrefix name of threads in pool @param parallel number of thread in pool @return new thread pool """ ThreadFactory threadFactory = new ThreadFactory() { private int threadCount = 1; public Thread newThread(final Runnable r) { final Thread thread = new Thread(r); thread.setName(threadNamePrefix + threadCount++); thread.setUncaughtExceptionHandler( new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { logger.error( "uncaughtException in thread: " + t + " {}", e); } }); thread.setDaemon(true); return thread; } }; return (ThreadPoolExecutor) Executors.newFixedThreadPool(parallel, threadFactory); }
java
private static ThreadPoolExecutor createChunkDownloaderExecutorService( final String threadNamePrefix, final int parallel) { ThreadFactory threadFactory = new ThreadFactory() { private int threadCount = 1; public Thread newThread(final Runnable r) { final Thread thread = new Thread(r); thread.setName(threadNamePrefix + threadCount++); thread.setUncaughtExceptionHandler( new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { logger.error( "uncaughtException in thread: " + t + " {}", e); } }); thread.setDaemon(true); return thread; } }; return (ThreadPoolExecutor) Executors.newFixedThreadPool(parallel, threadFactory); }
[ "private", "static", "ThreadPoolExecutor", "createChunkDownloaderExecutorService", "(", "final", "String", "threadNamePrefix", ",", "final", "int", "parallel", ")", "{", "ThreadFactory", "threadFactory", "=", "new", "ThreadFactory", "(", ")", "{", "private", "int", "threadCount", "=", "1", ";", "public", "Thread", "newThread", "(", "final", "Runnable", "r", ")", "{", "final", "Thread", "thread", "=", "new", "Thread", "(", "r", ")", ";", "thread", ".", "setName", "(", "threadNamePrefix", "+", "threadCount", "++", ")", ";", "thread", ".", "setUncaughtExceptionHandler", "(", "new", "Thread", ".", "UncaughtExceptionHandler", "(", ")", "{", "public", "void", "uncaughtException", "(", "Thread", "t", ",", "Throwable", "e", ")", "{", "logger", ".", "error", "(", "\"uncaughtException in thread: \"", "+", "t", "+", "\" {}\"", ",", "e", ")", ";", "}", "}", ")", ";", "thread", ".", "setDaemon", "(", "true", ")", ";", "return", "thread", ";", "}", "}", ";", "return", "(", "ThreadPoolExecutor", ")", "Executors", ".", "newFixedThreadPool", "(", "parallel", ",", "threadFactory", ")", ";", "}" ]
Create a pool of downloader threads. @param threadNamePrefix name of threads in pool @param parallel number of thread in pool @return new thread pool
[ "Create", "a", "pool", "of", "downloader", "threads", "." ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java#L154-L184
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/metadata/index/IndexMgr.java
IndexMgr.createIndex
public void createIndex(String idxName, String tblName, List<String> fldNames, IndexType idxType, Transaction tx) { """ Creates an index of the specified type for the specified field. A unique ID is assigned to this index, and its information is stored in the idxcat table. @param idxName the name of the index @param tblName the name of the indexed table @param fldNames the name of the indexed field @param idxType the index type of the indexed field @param tx the calling transaction """ // Add the index infos to the index catalog RecordFile rf = idxTi.open(tx, true); rf.insert(); rf.setVal(ICAT_IDXNAME, new VarcharConstant(idxName)); rf.setVal(ICAT_TBLNAME, new VarcharConstant(tblName)); rf.setVal(ICAT_IDXTYPE, new IntegerConstant(idxType.toInteger())); rf.close(); // Add the field names to the key catalog rf = keyTi.open(tx, true); for (String fldName : fldNames) { rf.insert(); rf.setVal(KCAT_IDXNAME, new VarcharConstant(idxName)); rf.setVal(KCAT_KEYNAME, new VarcharConstant(fldName)); rf.close(); } updateCache(new IndexInfo(idxName, tblName, fldNames, idxType)); }
java
public void createIndex(String idxName, String tblName, List<String> fldNames, IndexType idxType, Transaction tx) { // Add the index infos to the index catalog RecordFile rf = idxTi.open(tx, true); rf.insert(); rf.setVal(ICAT_IDXNAME, new VarcharConstant(idxName)); rf.setVal(ICAT_TBLNAME, new VarcharConstant(tblName)); rf.setVal(ICAT_IDXTYPE, new IntegerConstant(idxType.toInteger())); rf.close(); // Add the field names to the key catalog rf = keyTi.open(tx, true); for (String fldName : fldNames) { rf.insert(); rf.setVal(KCAT_IDXNAME, new VarcharConstant(idxName)); rf.setVal(KCAT_KEYNAME, new VarcharConstant(fldName)); rf.close(); } updateCache(new IndexInfo(idxName, tblName, fldNames, idxType)); }
[ "public", "void", "createIndex", "(", "String", "idxName", ",", "String", "tblName", ",", "List", "<", "String", ">", "fldNames", ",", "IndexType", "idxType", ",", "Transaction", "tx", ")", "{", "// Add the index infos to the index catalog\r", "RecordFile", "rf", "=", "idxTi", ".", "open", "(", "tx", ",", "true", ")", ";", "rf", ".", "insert", "(", ")", ";", "rf", ".", "setVal", "(", "ICAT_IDXNAME", ",", "new", "VarcharConstant", "(", "idxName", ")", ")", ";", "rf", ".", "setVal", "(", "ICAT_TBLNAME", ",", "new", "VarcharConstant", "(", "tblName", ")", ")", ";", "rf", ".", "setVal", "(", "ICAT_IDXTYPE", ",", "new", "IntegerConstant", "(", "idxType", ".", "toInteger", "(", ")", ")", ")", ";", "rf", ".", "close", "(", ")", ";", "// Add the field names to the key catalog\r", "rf", "=", "keyTi", ".", "open", "(", "tx", ",", "true", ")", ";", "for", "(", "String", "fldName", ":", "fldNames", ")", "{", "rf", ".", "insert", "(", ")", ";", "rf", ".", "setVal", "(", "KCAT_IDXNAME", ",", "new", "VarcharConstant", "(", "idxName", ")", ")", ";", "rf", ".", "setVal", "(", "KCAT_KEYNAME", ",", "new", "VarcharConstant", "(", "fldName", ")", ")", ";", "rf", ".", "close", "(", ")", ";", "}", "updateCache", "(", "new", "IndexInfo", "(", "idxName", ",", "tblName", ",", "fldNames", ",", "idxType", ")", ")", ";", "}" ]
Creates an index of the specified type for the specified field. A unique ID is assigned to this index, and its information is stored in the idxcat table. @param idxName the name of the index @param tblName the name of the indexed table @param fldNames the name of the indexed field @param idxType the index type of the indexed field @param tx the calling transaction
[ "Creates", "an", "index", "of", "the", "specified", "type", "for", "the", "specified", "field", ".", "A", "unique", "ID", "is", "assigned", "to", "this", "index", "and", "its", "information", "is", "stored", "in", "the", "idxcat", "table", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/index/IndexMgr.java#L132-L153
Domo42/saga-lib
saga-lib/src/main/java/com/codebullets/sagalib/startup/MessageHandler.java
MessageHandler.reflectionInvokedHandler
public static MessageHandler reflectionInvokedHandler(final Class<?> messageType, final Method methodToInvoke, final boolean startsSaga) { """ Creates new handler, with the reflection information about the method to call. """ return new MessageHandler(messageType, methodToInvoke, startsSaga); }
java
public static MessageHandler reflectionInvokedHandler(final Class<?> messageType, final Method methodToInvoke, final boolean startsSaga) { return new MessageHandler(messageType, methodToInvoke, startsSaga); }
[ "public", "static", "MessageHandler", "reflectionInvokedHandler", "(", "final", "Class", "<", "?", ">", "messageType", ",", "final", "Method", "methodToInvoke", ",", "final", "boolean", "startsSaga", ")", "{", "return", "new", "MessageHandler", "(", "messageType", ",", "methodToInvoke", ",", "startsSaga", ")", ";", "}" ]
Creates new handler, with the reflection information about the method to call.
[ "Creates", "new", "handler", "with", "the", "reflection", "information", "about", "the", "method", "to", "call", "." ]
train
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/startup/MessageHandler.java#L70-L72
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/Quaternion.java
Quaternion.setAxisAngle
public final void setAxisAngle(double x1, double y1, double z1, double angle) { """ Sets the value of this quaternion to the equivalent rotation of the Axis-Angle arguments. @param x1 is the x coordinate of the rotation axis @param y1 is the y coordinate of the rotation axis @param z1 is the z coordinate of the rotation axis @param angle is the rotation around the axis. """ double mag,amag; // Quat = cos(theta/2) + sin(theta/2)(roation_axis) amag = Math.sqrt(x1*x1 + y1*y1 + z1*z1); if (amag < EPS ) { this.w = 0.0f; this.x = 0.0f; this.y = 0.0f; this.z = 0.0f; } else { amag = 1.0f/amag; mag = Math.sin(angle/2.0); this.w = Math.cos(angle/2.0); this.x = x1*amag*mag; this.y = y1*amag*mag; this.z = z1*amag*mag; } }
java
public final void setAxisAngle(double x1, double y1, double z1, double angle) { double mag,amag; // Quat = cos(theta/2) + sin(theta/2)(roation_axis) amag = Math.sqrt(x1*x1 + y1*y1 + z1*z1); if (amag < EPS ) { this.w = 0.0f; this.x = 0.0f; this.y = 0.0f; this.z = 0.0f; } else { amag = 1.0f/amag; mag = Math.sin(angle/2.0); this.w = Math.cos(angle/2.0); this.x = x1*amag*mag; this.y = y1*amag*mag; this.z = z1*amag*mag; } }
[ "public", "final", "void", "setAxisAngle", "(", "double", "x1", ",", "double", "y1", ",", "double", "z1", ",", "double", "angle", ")", "{", "double", "mag", ",", "amag", ";", "// Quat = cos(theta/2) + sin(theta/2)(roation_axis) ", "amag", "=", "Math", ".", "sqrt", "(", "x1", "*", "x1", "+", "y1", "*", "y1", "+", "z1", "*", "z1", ")", ";", "if", "(", "amag", "<", "EPS", ")", "{", "this", ".", "w", "=", "0.0f", ";", "this", ".", "x", "=", "0.0f", ";", "this", ".", "y", "=", "0.0f", ";", "this", ".", "z", "=", "0.0f", ";", "}", "else", "{", "amag", "=", "1.0f", "/", "amag", ";", "mag", "=", "Math", ".", "sin", "(", "angle", "/", "2.0", ")", ";", "this", ".", "w", "=", "Math", ".", "cos", "(", "angle", "/", "2.0", ")", ";", "this", ".", "x", "=", "x1", "*", "amag", "*", "mag", ";", "this", ".", "y", "=", "y1", "*", "amag", "*", "mag", ";", "this", ".", "z", "=", "z1", "*", "amag", "*", "mag", ";", "}", "}" ]
Sets the value of this quaternion to the equivalent rotation of the Axis-Angle arguments. @param x1 is the x coordinate of the rotation axis @param y1 is the y coordinate of the rotation axis @param z1 is the z coordinate of the rotation axis @param angle is the rotation around the axis.
[ "Sets", "the", "value", "of", "this", "quaternion", "to", "the", "equivalent", "rotation", "of", "the", "Axis", "-", "Angle", "arguments", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Quaternion.java#L648-L666
alkacon/opencms-core
src/org/opencms/util/CmsHtmlConverter.java
CmsHtmlConverter.getConversionSettings
public static String getConversionSettings(CmsObject cms, CmsResource resource) { """ Reads the content conversion property of a given resource and returns its value.<p> A default value (disabled) is returned if the property could not be read.<p> @param cms the CmsObject @param resource the resource in the VFS @return the content conversion property value """ // read the content-conversion property String contentConversion; try { String resourceName = cms.getSitePath(resource); CmsProperty contentConversionProperty = cms.readPropertyObject( resourceName, CmsPropertyDefinition.PROPERTY_CONTENT_CONVERSION, true); contentConversion = contentConversionProperty.getValue(CmsHtmlConverter.PARAM_DISABLED); } catch (CmsException e) { // if there was an error reading the property, choose a default value contentConversion = CmsHtmlConverter.PARAM_DISABLED; } return contentConversion; }
java
public static String getConversionSettings(CmsObject cms, CmsResource resource) { // read the content-conversion property String contentConversion; try { String resourceName = cms.getSitePath(resource); CmsProperty contentConversionProperty = cms.readPropertyObject( resourceName, CmsPropertyDefinition.PROPERTY_CONTENT_CONVERSION, true); contentConversion = contentConversionProperty.getValue(CmsHtmlConverter.PARAM_DISABLED); } catch (CmsException e) { // if there was an error reading the property, choose a default value contentConversion = CmsHtmlConverter.PARAM_DISABLED; } return contentConversion; }
[ "public", "static", "String", "getConversionSettings", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ")", "{", "// read the content-conversion property", "String", "contentConversion", ";", "try", "{", "String", "resourceName", "=", "cms", ".", "getSitePath", "(", "resource", ")", ";", "CmsProperty", "contentConversionProperty", "=", "cms", ".", "readPropertyObject", "(", "resourceName", ",", "CmsPropertyDefinition", ".", "PROPERTY_CONTENT_CONVERSION", ",", "true", ")", ";", "contentConversion", "=", "contentConversionProperty", ".", "getValue", "(", "CmsHtmlConverter", ".", "PARAM_DISABLED", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "// if there was an error reading the property, choose a default value", "contentConversion", "=", "CmsHtmlConverter", ".", "PARAM_DISABLED", ";", "}", "return", "contentConversion", ";", "}" ]
Reads the content conversion property of a given resource and returns its value.<p> A default value (disabled) is returned if the property could not be read.<p> @param cms the CmsObject @param resource the resource in the VFS @return the content conversion property value
[ "Reads", "the", "content", "conversion", "property", "of", "a", "given", "resource", "and", "returns", "its", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsHtmlConverter.java#L125-L141
apache/incubator-gobblin
gobblin-api/src/main/java/org/apache/gobblin/compat/hadoop/TextSerializer.java
TextSerializer.writeVLong
private static void writeVLong(DataOutput stream, long i) throws IOException { """ From org.apache.hadoop.io.WritableUtis Serializes a long to a binary stream with zero-compressed encoding. For -112 <= i <= 127, only one byte is used with the actual value. For other values of i, the first byte value indicates whether the long is positive or negative, and the number of bytes that follow. If the first byte value v is between -113 and -120, the following long is positive, with number of bytes that follow are -(v+112). If the first byte value v is between -121 and -128, the following long is negative, with number of bytes that follow are -(v+120). Bytes are stored in the high-non-zero-byte-first order. @param stream Binary output stream @param i Long to be serialized @throws java.io.IOException """ if (i >= -112 && i <= 127) { stream.writeByte((byte)i); return; } int len = -112; if (i < 0) { i ^= -1L; // take one's complement' len = -120; } long tmp = i; while (tmp != 0) { tmp = tmp >> 8; len--; } stream.writeByte((byte)len); len = (len < -120) ? -(len + 120) : -(len + 112); for (int idx = len; idx != 0; idx--) { int shiftbits = (idx - 1) * 8; long mask = 0xFFL << shiftbits; stream.writeByte((byte)((i & mask) >> shiftbits)); } }
java
private static void writeVLong(DataOutput stream, long i) throws IOException { if (i >= -112 && i <= 127) { stream.writeByte((byte)i); return; } int len = -112; if (i < 0) { i ^= -1L; // take one's complement' len = -120; } long tmp = i; while (tmp != 0) { tmp = tmp >> 8; len--; } stream.writeByte((byte)len); len = (len < -120) ? -(len + 120) : -(len + 112); for (int idx = len; idx != 0; idx--) { int shiftbits = (idx - 1) * 8; long mask = 0xFFL << shiftbits; stream.writeByte((byte)((i & mask) >> shiftbits)); } }
[ "private", "static", "void", "writeVLong", "(", "DataOutput", "stream", ",", "long", "i", ")", "throws", "IOException", "{", "if", "(", "i", ">=", "-", "112", "&&", "i", "<=", "127", ")", "{", "stream", ".", "writeByte", "(", "(", "byte", ")", "i", ")", ";", "return", ";", "}", "int", "len", "=", "-", "112", ";", "if", "(", "i", "<", "0", ")", "{", "i", "^=", "-", "1L", ";", "// take one's complement'", "len", "=", "-", "120", ";", "}", "long", "tmp", "=", "i", ";", "while", "(", "tmp", "!=", "0", ")", "{", "tmp", "=", "tmp", ">>", "8", ";", "len", "--", ";", "}", "stream", ".", "writeByte", "(", "(", "byte", ")", "len", ")", ";", "len", "=", "(", "len", "<", "-", "120", ")", "?", "-", "(", "len", "+", "120", ")", ":", "-", "(", "len", "+", "112", ")", ";", "for", "(", "int", "idx", "=", "len", ";", "idx", "!=", "0", ";", "idx", "--", ")", "{", "int", "shiftbits", "=", "(", "idx", "-", "1", ")", "*", "8", ";", "long", "mask", "=", "0xFF", "L", "<<", "shiftbits", ";", "stream", ".", "writeByte", "(", "(", "byte", ")", "(", "(", "i", "&", "mask", ")", ">>", "shiftbits", ")", ")", ";", "}", "}" ]
From org.apache.hadoop.io.WritableUtis Serializes a long to a binary stream with zero-compressed encoding. For -112 <= i <= 127, only one byte is used with the actual value. For other values of i, the first byte value indicates whether the long is positive or negative, and the number of bytes that follow. If the first byte value v is between -113 and -120, the following long is positive, with number of bytes that follow are -(v+112). If the first byte value v is between -121 and -128, the following long is negative, with number of bytes that follow are -(v+120). Bytes are stored in the high-non-zero-byte-first order. @param stream Binary output stream @param i Long to be serialized @throws java.io.IOException
[ "From", "org", ".", "apache", ".", "hadoop", ".", "io", ".", "WritableUtis" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/compat/hadoop/TextSerializer.java#L67-L94
structr/structr
structr-ui/src/main/java/org/structr/web/common/FileHelper.java
FileHelper.getContentMimeType
public static String getContentMimeType(final java.io.File file, final String name) throws IOException { """ Return mime type of given file @param file @param name @return content type @throws java.io.IOException """ String mimeType; // try name first, if not null if (name != null) { mimeType = mimeTypeMap.getContentType(name); if (mimeType != null && !UNKNOWN_MIME_TYPE.equals(mimeType)) { return mimeType; } } try (final InputStream is = new BufferedInputStream(new FileInputStream(file))) { final MediaType mediaType = new DefaultDetector().detect(is, new Metadata()); if (mediaType != null) { mimeType = mediaType.toString(); if (mimeType != null) { return mimeType; } } } catch (NoClassDefFoundError t) { logger.warn("Unable to instantiate MIME type detector: {}", t.getMessage()); } // no success :( return UNKNOWN_MIME_TYPE; }
java
public static String getContentMimeType(final java.io.File file, final String name) throws IOException { String mimeType; // try name first, if not null if (name != null) { mimeType = mimeTypeMap.getContentType(name); if (mimeType != null && !UNKNOWN_MIME_TYPE.equals(mimeType)) { return mimeType; } } try (final InputStream is = new BufferedInputStream(new FileInputStream(file))) { final MediaType mediaType = new DefaultDetector().detect(is, new Metadata()); if (mediaType != null) { mimeType = mediaType.toString(); if (mimeType != null) { return mimeType; } } } catch (NoClassDefFoundError t) { logger.warn("Unable to instantiate MIME type detector: {}", t.getMessage()); } // no success :( return UNKNOWN_MIME_TYPE; }
[ "public", "static", "String", "getContentMimeType", "(", "final", "java", ".", "io", ".", "File", "file", ",", "final", "String", "name", ")", "throws", "IOException", "{", "String", "mimeType", ";", "// try name first, if not null", "if", "(", "name", "!=", "null", ")", "{", "mimeType", "=", "mimeTypeMap", ".", "getContentType", "(", "name", ")", ";", "if", "(", "mimeType", "!=", "null", "&&", "!", "UNKNOWN_MIME_TYPE", ".", "equals", "(", "mimeType", ")", ")", "{", "return", "mimeType", ";", "}", "}", "try", "(", "final", "InputStream", "is", "=", "new", "BufferedInputStream", "(", "new", "FileInputStream", "(", "file", ")", ")", ")", "{", "final", "MediaType", "mediaType", "=", "new", "DefaultDetector", "(", ")", ".", "detect", "(", "is", ",", "new", "Metadata", "(", ")", ")", ";", "if", "(", "mediaType", "!=", "null", ")", "{", "mimeType", "=", "mediaType", ".", "toString", "(", ")", ";", "if", "(", "mimeType", "!=", "null", ")", "{", "return", "mimeType", ";", "}", "}", "}", "catch", "(", "NoClassDefFoundError", "t", ")", "{", "logger", ".", "warn", "(", "\"Unable to instantiate MIME type detector: {}\"", ",", "t", ".", "getMessage", "(", ")", ")", ";", "}", "// no success :(", "return", "UNKNOWN_MIME_TYPE", ";", "}" ]
Return mime type of given file @param file @param name @return content type @throws java.io.IOException
[ "Return", "mime", "type", "of", "given", "file" ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/common/FileHelper.java#L594-L624
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ManagedBeanHome.java
ManagedBeanHome.createLocalBusinessObject
@Override public Object createLocalBusinessObject(String interfaceName, boolean useSupporting) throws RemoteException, CreateException { """ Method to create a local business reference object. Override EJSHome to ensure to handle managed beans properly. Use the createBusinessObject method specific to managed beans. @param interfaceName Remote interface name used instead of the class to avoid class loading @param useSupporting (not used for Managed Bean's) @throws RemoteException @throws CreateException """ return createBusinessObject(interfaceName, useSupporting); }
java
@Override public Object createLocalBusinessObject(String interfaceName, boolean useSupporting) throws RemoteException, CreateException { return createBusinessObject(interfaceName, useSupporting); }
[ "@", "Override", "public", "Object", "createLocalBusinessObject", "(", "String", "interfaceName", ",", "boolean", "useSupporting", ")", "throws", "RemoteException", ",", "CreateException", "{", "return", "createBusinessObject", "(", "interfaceName", ",", "useSupporting", ")", ";", "}" ]
Method to create a local business reference object. Override EJSHome to ensure to handle managed beans properly. Use the createBusinessObject method specific to managed beans. @param interfaceName Remote interface name used instead of the class to avoid class loading @param useSupporting (not used for Managed Bean's) @throws RemoteException @throws CreateException
[ "Method", "to", "create", "a", "local", "business", "reference", "object", ".", "Override", "EJSHome", "to", "ensure", "to", "handle", "managed", "beans", "properly", ".", "Use", "the", "createBusinessObject", "method", "specific", "to", "managed", "beans", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ManagedBeanHome.java#L262-L268
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLClause.java
AbstractSQLClause.startContext
protected SQLListenerContextImpl startContext(Connection connection, QueryMetadata metadata, RelationalPath<?> entity) { """ Called to create and start a new SQL Listener context @param connection the database connection @param metadata the meta data for that context @param entity the entity for that context @return the newly started context """ SQLListenerContextImpl context = new SQLListenerContextImpl(metadata, connection, entity); listeners.start(context); return context; }
java
protected SQLListenerContextImpl startContext(Connection connection, QueryMetadata metadata, RelationalPath<?> entity) { SQLListenerContextImpl context = new SQLListenerContextImpl(metadata, connection, entity); listeners.start(context); return context; }
[ "protected", "SQLListenerContextImpl", "startContext", "(", "Connection", "connection", ",", "QueryMetadata", "metadata", ",", "RelationalPath", "<", "?", ">", "entity", ")", "{", "SQLListenerContextImpl", "context", "=", "new", "SQLListenerContextImpl", "(", "metadata", ",", "connection", ",", "entity", ")", ";", "listeners", ".", "start", "(", "context", ")", ";", "return", "context", ";", "}" ]
Called to create and start a new SQL Listener context @param connection the database connection @param metadata the meta data for that context @param entity the entity for that context @return the newly started context
[ "Called", "to", "create", "and", "start", "a", "new", "SQL", "Listener", "context" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLClause.java#L98-L102
apache/spark
launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
CommandBuilderUtils.checkState
static void checkState(boolean check, String msg, Object... args) { """ Throws IllegalStateException with the given message if the check is false. """ if (!check) { throw new IllegalStateException(String.format(msg, args)); } }
java
static void checkState(boolean check, String msg, Object... args) { if (!check) { throw new IllegalStateException(String.format(msg, args)); } }
[ "static", "void", "checkState", "(", "boolean", "check", ",", "String", "msg", ",", "Object", "...", "args", ")", "{", "if", "(", "!", "check", ")", "{", "throw", "new", "IllegalStateException", "(", "String", ".", "format", "(", "msg", ",", "args", ")", ")", ";", "}", "}" ]
Throws IllegalStateException with the given message if the check is false.
[ "Throws", "IllegalStateException", "with", "the", "given", "message", "if", "the", "check", "is", "false", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L226-L230
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/util/ApiUtilities.java
ApiUtilities.printProgressInfo
public static void printProgressInfo(int counter, int size, int step, ProgressInfoMode mode, String text) { """ Prints a progress counter. @param counter Indicates the position in the task. @param size Size of the overall task. @param step How many parts should the progress counter have? @param mode Sets the output mode. @param text The text that should be print along with the progress indicator. """ if (size < step) { return; } if (counter % (size / step) == 0) { double progressPercent = counter * 100 / size; progressPercent = 1 + Math.round(progressPercent * 100) / 100.0; if (mode.equals(ApiUtilities.ProgressInfoMode.TEXT)) { logger.info(text + ": " + progressPercent + " - " + OS.getUsedMemory() + " MB"); } else if (mode.equals(ApiUtilities.ProgressInfoMode.DOTS)) { System.out.print("."); if (progressPercent >= 100) { System.out.println(); } } } }
java
public static void printProgressInfo(int counter, int size, int step, ProgressInfoMode mode, String text) { if (size < step) { return; } if (counter % (size / step) == 0) { double progressPercent = counter * 100 / size; progressPercent = 1 + Math.round(progressPercent * 100) / 100.0; if (mode.equals(ApiUtilities.ProgressInfoMode.TEXT)) { logger.info(text + ": " + progressPercent + " - " + OS.getUsedMemory() + " MB"); } else if (mode.equals(ApiUtilities.ProgressInfoMode.DOTS)) { System.out.print("."); if (progressPercent >= 100) { System.out.println(); } } } }
[ "public", "static", "void", "printProgressInfo", "(", "int", "counter", ",", "int", "size", ",", "int", "step", ",", "ProgressInfoMode", "mode", ",", "String", "text", ")", "{", "if", "(", "size", "<", "step", ")", "{", "return", ";", "}", "if", "(", "counter", "%", "(", "size", "/", "step", ")", "==", "0", ")", "{", "double", "progressPercent", "=", "counter", "*", "100", "/", "size", ";", "progressPercent", "=", "1", "+", "Math", ".", "round", "(", "progressPercent", "*", "100", ")", "/", "100.0", ";", "if", "(", "mode", ".", "equals", "(", "ApiUtilities", ".", "ProgressInfoMode", ".", "TEXT", ")", ")", "{", "logger", ".", "info", "(", "text", "+", "\": \"", "+", "progressPercent", "+", "\" - \"", "+", "OS", ".", "getUsedMemory", "(", ")", "+", "\" MB\"", ")", ";", "}", "else", "if", "(", "mode", ".", "equals", "(", "ApiUtilities", ".", "ProgressInfoMode", ".", "DOTS", ")", ")", "{", "System", ".", "out", ".", "print", "(", "\".\"", ")", ";", "if", "(", "progressPercent", ">=", "100", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "}", "}", "}", "}" ]
Prints a progress counter. @param counter Indicates the position in the task. @param size Size of the overall task. @param step How many parts should the progress counter have? @param mode Sets the output mode. @param text The text that should be print along with the progress indicator.
[ "Prints", "a", "progress", "counter", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/util/ApiUtilities.java#L44-L62
matthewhorridge/owlapi-gwt
owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/util/OWLAPIPreconditions.java
OWLAPIPreconditions.checkNotNull
@Nonnull public static <T> T checkNotNull(T object, @Nonnull String message) { """ check for null and throw NullPointerException if null @param object reference to check @param message message for the illegal argument exception @param <T> reference type @return the input reference if not null @throws NullPointerException if object is null """ if (object == null) { throw new NullPointerException(message); } return object; }
java
@Nonnull public static <T> T checkNotNull(T object, @Nonnull String message) { if (object == null) { throw new NullPointerException(message); } return object; }
[ "@", "Nonnull", "public", "static", "<", "T", ">", "T", "checkNotNull", "(", "T", "object", ",", "@", "Nonnull", "String", "message", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "message", ")", ";", "}", "return", "object", ";", "}" ]
check for null and throw NullPointerException if null @param object reference to check @param message message for the illegal argument exception @param <T> reference type @return the input reference if not null @throws NullPointerException if object is null
[ "check", "for", "null", "and", "throw", "NullPointerException", "if", "null" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/util/OWLAPIPreconditions.java#L95-L101
zaproxy/zaproxy
src/org/zaproxy/zap/spider/parser/SpiderHtmlFormParser.java
SpiderHtmlFormParser.notifyPostResourceFound
private void notifyPostResourceFound(HttpMessage message, int depth, String url, String requestBody) { """ Notifies listeners that a new POST resource was found. @param message the source message @param depth the current depth @param url the URL of the resource @param requestBody the request body @see #notifyListenersPostResourceFound(HttpMessage, int, String, String) """ log.debug("Submiting form with POST method and message body with form parameters (normal encoding): " + requestBody); notifyListenersPostResourceFound(message, depth + 1, url, requestBody); }
java
private void notifyPostResourceFound(HttpMessage message, int depth, String url, String requestBody) { log.debug("Submiting form with POST method and message body with form parameters (normal encoding): " + requestBody); notifyListenersPostResourceFound(message, depth + 1, url, requestBody); }
[ "private", "void", "notifyPostResourceFound", "(", "HttpMessage", "message", ",", "int", "depth", ",", "String", "url", ",", "String", "requestBody", ")", "{", "log", ".", "debug", "(", "\"Submiting form with POST method and message body with form parameters (normal encoding): \"", "+", "requestBody", ")", ";", "notifyListenersPostResourceFound", "(", "message", ",", "depth", "+", "1", ",", "url", ",", "requestBody", ")", ";", "}" ]
Notifies listeners that a new POST resource was found. @param message the source message @param depth the current depth @param url the URL of the resource @param requestBody the request body @see #notifyListenersPostResourceFound(HttpMessage, int, String, String)
[ "Notifies", "listeners", "that", "a", "new", "POST", "resource", "was", "found", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/parser/SpiderHtmlFormParser.java#L378-L381
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipsesIntoClusters.java
EllipsesIntoClusters.joinClusters
void joinClusters( int mouth , int food ) { """ Moves all the members of 'food' into 'mouth' @param mouth The group which will not be changed. @param food All members of this group are put into mouth """ List<Node> listMouth = clusters.get(mouth); List<Node> listFood = clusters.get(food); // put all members of food into mouth for (int i = 0; i < listFood.size(); i++) { listMouth.add( listFood.get(i) ); listFood.get(i).cluster = mouth; } // zero food members listFood.clear(); }
java
void joinClusters( int mouth , int food ) { List<Node> listMouth = clusters.get(mouth); List<Node> listFood = clusters.get(food); // put all members of food into mouth for (int i = 0; i < listFood.size(); i++) { listMouth.add( listFood.get(i) ); listFood.get(i).cluster = mouth; } // zero food members listFood.clear(); }
[ "void", "joinClusters", "(", "int", "mouth", ",", "int", "food", ")", "{", "List", "<", "Node", ">", "listMouth", "=", "clusters", ".", "get", "(", "mouth", ")", ";", "List", "<", "Node", ">", "listFood", "=", "clusters", ".", "get", "(", "food", ")", ";", "// put all members of food into mouth", "for", "(", "int", "i", "=", "0", ";", "i", "<", "listFood", ".", "size", "(", ")", ";", "i", "++", ")", "{", "listMouth", ".", "add", "(", "listFood", ".", "get", "(", "i", ")", ")", ";", "listFood", ".", "get", "(", "i", ")", ".", "cluster", "=", "mouth", ";", "}", "// zero food members", "listFood", ".", "clear", "(", ")", ";", "}" ]
Moves all the members of 'food' into 'mouth' @param mouth The group which will not be changed. @param food All members of this group are put into mouth
[ "Moves", "all", "the", "members", "of", "food", "into", "mouth" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipsesIntoClusters.java#L309-L322
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/languagemodel/LuceneSingleIndexLanguageModel.java
LuceneSingleIndexLanguageModel.validateDirectory
public static void validateDirectory(File topIndexDir) { """ Throw RuntimeException is the given directory does not seem to be a valid ngram top directory with sub directories {@code 1grams} etc. @since 3.0 """ if (!topIndexDir.exists() || !topIndexDir.isDirectory()) { throw new RuntimeException("Not found or is not a directory:\n" + topIndexDir + "\n" + "As ngram directory, please select the directory that has a subdirectory like 'en'\n" + "(or whatever language code you're using)."); } List<String> dirs = new ArrayList<>(); for (String name : topIndexDir.list()) { if (name.matches("[123]grams")) { dirs.add(name); } } if (dirs.isEmpty()) { throw new RuntimeException("Directory must contain at least '1grams', '2grams', and '3grams': " + topIndexDir.getAbsolutePath()); } if (dirs.size() < 3) { throw new RuntimeException("Expected at least '1grams', '2grams', and '3grams' sub directories but only got " + dirs + " in " + topIndexDir.getAbsolutePath()); } }
java
public static void validateDirectory(File topIndexDir) { if (!topIndexDir.exists() || !topIndexDir.isDirectory()) { throw new RuntimeException("Not found or is not a directory:\n" + topIndexDir + "\n" + "As ngram directory, please select the directory that has a subdirectory like 'en'\n" + "(or whatever language code you're using)."); } List<String> dirs = new ArrayList<>(); for (String name : topIndexDir.list()) { if (name.matches("[123]grams")) { dirs.add(name); } } if (dirs.isEmpty()) { throw new RuntimeException("Directory must contain at least '1grams', '2grams', and '3grams': " + topIndexDir.getAbsolutePath()); } if (dirs.size() < 3) { throw new RuntimeException("Expected at least '1grams', '2grams', and '3grams' sub directories but only got " + dirs + " in " + topIndexDir.getAbsolutePath()); } }
[ "public", "static", "void", "validateDirectory", "(", "File", "topIndexDir", ")", "{", "if", "(", "!", "topIndexDir", ".", "exists", "(", ")", "||", "!", "topIndexDir", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Not found or is not a directory:\\n\"", "+", "topIndexDir", "+", "\"\\n\"", "+", "\"As ngram directory, please select the directory that has a subdirectory like 'en'\\n\"", "+", "\"(or whatever language code you're using).\"", ")", ";", "}", "List", "<", "String", ">", "dirs", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "name", ":", "topIndexDir", ".", "list", "(", ")", ")", "{", "if", "(", "name", ".", "matches", "(", "\"[123]grams\"", ")", ")", "{", "dirs", ".", "add", "(", "name", ")", ";", "}", "}", "if", "(", "dirs", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Directory must contain at least '1grams', '2grams', and '3grams': \"", "+", "topIndexDir", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "if", "(", "dirs", ".", "size", "(", ")", "<", "3", ")", "{", "throw", "new", "RuntimeException", "(", "\"Expected at least '1grams', '2grams', and '3grams' sub directories but only got \"", "+", "dirs", "+", "\" in \"", "+", "topIndexDir", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "}" ]
Throw RuntimeException is the given directory does not seem to be a valid ngram top directory with sub directories {@code 1grams} etc. @since 3.0
[ "Throw", "RuntimeException", "is", "the", "given", "directory", "does", "not", "seem", "to", "be", "a", "valid", "ngram", "top", "directory", "with", "sub", "directories", "{" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/languagemodel/LuceneSingleIndexLanguageModel.java#L55-L74
database-rider/database-rider
rider-core/src/main/java/com/github/database/rider/core/dataset/DataSetExecutorImpl.java
DataSetExecutorImpl.performReplacements
@SuppressWarnings("unchecked") private IDataSet performReplacements(IDataSet dataSet) { """ Perform replacements from all {@link Replacer} implementations, registered in {@link #dbUnitConfig}. """ if (!dbUnitConfig.getProperties().containsKey("replacers")) { return dataSet; } return performReplacements(dataSet, (List<Replacer>) dbUnitConfig.getProperties().get("replacers")); }
java
@SuppressWarnings("unchecked") private IDataSet performReplacements(IDataSet dataSet) { if (!dbUnitConfig.getProperties().containsKey("replacers")) { return dataSet; } return performReplacements(dataSet, (List<Replacer>) dbUnitConfig.getProperties().get("replacers")); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "IDataSet", "performReplacements", "(", "IDataSet", "dataSet", ")", "{", "if", "(", "!", "dbUnitConfig", ".", "getProperties", "(", ")", ".", "containsKey", "(", "\"replacers\"", ")", ")", "{", "return", "dataSet", ";", "}", "return", "performReplacements", "(", "dataSet", ",", "(", "List", "<", "Replacer", ">", ")", "dbUnitConfig", ".", "getProperties", "(", ")", ".", "get", "(", "\"replacers\"", ")", ")", ";", "}" ]
Perform replacements from all {@link Replacer} implementations, registered in {@link #dbUnitConfig}.
[ "Perform", "replacements", "from", "all", "{" ]
train
https://github.com/database-rider/database-rider/blob/7545cc31118df9cfef3f89e27223b433a24fb5dd/rider-core/src/main/java/com/github/database/rider/core/dataset/DataSetExecutorImpl.java#L446-L452
craftercms/deployer
src/main/java/org/craftercms/deployer/utils/ConfigUtils.java
ConfigUtils.getStringProperty
public static String getStringProperty(Configuration config, String key, String defaultValue) throws DeployerConfigurationException { """ Returns the specified String property from the configuration @param config the configuration @param key the key of the property @param defaultValue the default value if the property is not found @return the String value of the property, or the default value if not found @throws DeployerConfigurationException if an error occurred """ try { return config.getString(key, defaultValue); } catch (Exception e) { throw new DeployerConfigurationException("Failed to retrieve property '" + key + "'", e); } }
java
public static String getStringProperty(Configuration config, String key, String defaultValue) throws DeployerConfigurationException { try { return config.getString(key, defaultValue); } catch (Exception e) { throw new DeployerConfigurationException("Failed to retrieve property '" + key + "'", e); } }
[ "public", "static", "String", "getStringProperty", "(", "Configuration", "config", ",", "String", "key", ",", "String", "defaultValue", ")", "throws", "DeployerConfigurationException", "{", "try", "{", "return", "config", ".", "getString", "(", "key", ",", "defaultValue", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "DeployerConfigurationException", "(", "\"Failed to retrieve property '\"", "+", "key", "+", "\"'\"", ",", "e", ")", ";", "}", "}" ]
Returns the specified String property from the configuration @param config the configuration @param key the key of the property @param defaultValue the default value if the property is not found @return the String value of the property, or the default value if not found @throws DeployerConfigurationException if an error occurred
[ "Returns", "the", "specified", "String", "property", "from", "the", "configuration" ]
train
https://github.com/craftercms/deployer/blob/3ed446e3cc8af1055de2de6f871907f90ef27f63/src/main/java/org/craftercms/deployer/utils/ConfigUtils.java#L103-L110
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.deleteSasDefinitionAsync
public Observable<DeletedSasDefinitionBundle> deleteSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName) { """ Deletes a SAS definition from a specified storage account. This operation requires the storage/deletesas permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param sasDefinitionName The name of the SAS definition. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DeletedSasDefinitionBundle object """ return deleteSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName).map(new Func1<ServiceResponse<DeletedSasDefinitionBundle>, DeletedSasDefinitionBundle>() { @Override public DeletedSasDefinitionBundle call(ServiceResponse<DeletedSasDefinitionBundle> response) { return response.body(); } }); }
java
public Observable<DeletedSasDefinitionBundle> deleteSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName) { return deleteSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName).map(new Func1<ServiceResponse<DeletedSasDefinitionBundle>, DeletedSasDefinitionBundle>() { @Override public DeletedSasDefinitionBundle call(ServiceResponse<DeletedSasDefinitionBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DeletedSasDefinitionBundle", ">", "deleteSasDefinitionAsync", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ",", "String", "sasDefinitionName", ")", "{", "return", "deleteSasDefinitionWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "storageAccountName", ",", "sasDefinitionName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DeletedSasDefinitionBundle", ">", ",", "DeletedSasDefinitionBundle", ">", "(", ")", "{", "@", "Override", "public", "DeletedSasDefinitionBundle", "call", "(", "ServiceResponse", "<", "DeletedSasDefinitionBundle", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Deletes a SAS definition from a specified storage account. This operation requires the storage/deletesas permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param sasDefinitionName The name of the SAS definition. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DeletedSasDefinitionBundle object
[ "Deletes", "a", "SAS", "definition", "from", "a", "specified", "storage", "account", ".", "This", "operation", "requires", "the", "storage", "/", "deletesas", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L11096-L11103
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/VelocityRenderer.java
VelocityRenderer.noTemplatePaintHtml
@Deprecated protected void noTemplatePaintHtml(final WComponent component, final Writer writer) { """ Paints the component in HTML using the NoTemplateLayout. @param component the component to paint. @param writer the writer to send the HTML output to. @deprecated Unused. Will be removed in the next major release. """ try { writer.write("<!-- Start " + url + " not found -->\n"); new VelocityRenderer(NO_TEMPLATE_LAYOUT).paintXml(component, writer); writer.write("<!-- End " + url + " (template not found) -->\n"); } catch (IOException e) { LOG.error("Failed to paint component", e); } }
java
@Deprecated protected void noTemplatePaintHtml(final WComponent component, final Writer writer) { try { writer.write("<!-- Start " + url + " not found -->\n"); new VelocityRenderer(NO_TEMPLATE_LAYOUT).paintXml(component, writer); writer.write("<!-- End " + url + " (template not found) -->\n"); } catch (IOException e) { LOG.error("Failed to paint component", e); } }
[ "@", "Deprecated", "protected", "void", "noTemplatePaintHtml", "(", "final", "WComponent", "component", ",", "final", "Writer", "writer", ")", "{", "try", "{", "writer", ".", "write", "(", "\"<!-- Start \"", "+", "url", "+", "\" not found -->\\n\"", ")", ";", "new", "VelocityRenderer", "(", "NO_TEMPLATE_LAYOUT", ")", ".", "paintXml", "(", "component", ",", "writer", ")", ";", "writer", ".", "write", "(", "\"<!-- End \"", "+", "url", "+", "\" (template not found) -->\\n\"", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "LOG", ".", "error", "(", "\"Failed to paint component\"", ",", "e", ")", ";", "}", "}" ]
Paints the component in HTML using the NoTemplateLayout. @param component the component to paint. @param writer the writer to send the HTML output to. @deprecated Unused. Will be removed in the next major release.
[ "Paints", "the", "component", "in", "HTML", "using", "the", "NoTemplateLayout", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/VelocityRenderer.java#L319-L328
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/cluster/topology/TopologyComparators.java
TopologyComparators.essentiallyEqualsTo
static boolean essentiallyEqualsTo(RedisClusterNode o1, RedisClusterNode o2) { """ Check for {@code MASTER} or {@code SLAVE} flags and whether the responsible slots changed. @param o1 the first object to be compared. @param o2 the second object to be compared. @return {@literal true} if {@code MASTER} or {@code SLAVE} flags changed or the responsible slots changed. """ if (o2 == null) { return false; } if (!sameFlags(o1, o2, RedisClusterNode.NodeFlag.MASTER)) { return false; } if (!sameFlags(o1, o2, RedisClusterNode.NodeFlag.SLAVE)) { return false; } if (!o1.hasSameSlotsAs(o2)) { return false; } return true; }
java
static boolean essentiallyEqualsTo(RedisClusterNode o1, RedisClusterNode o2) { if (o2 == null) { return false; } if (!sameFlags(o1, o2, RedisClusterNode.NodeFlag.MASTER)) { return false; } if (!sameFlags(o1, o2, RedisClusterNode.NodeFlag.SLAVE)) { return false; } if (!o1.hasSameSlotsAs(o2)) { return false; } return true; }
[ "static", "boolean", "essentiallyEqualsTo", "(", "RedisClusterNode", "o1", ",", "RedisClusterNode", "o2", ")", "{", "if", "(", "o2", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "!", "sameFlags", "(", "o1", ",", "o2", ",", "RedisClusterNode", ".", "NodeFlag", ".", "MASTER", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "sameFlags", "(", "o1", ",", "o2", ",", "RedisClusterNode", ".", "NodeFlag", ".", "SLAVE", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "o1", ".", "hasSameSlotsAs", "(", "o2", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Check for {@code MASTER} or {@code SLAVE} flags and whether the responsible slots changed. @param o1 the first object to be compared. @param o2 the second object to be compared. @return {@literal true} if {@code MASTER} or {@code SLAVE} flags changed or the responsible slots changed.
[ "Check", "for", "{", "@code", "MASTER", "}", "or", "{", "@code", "SLAVE", "}", "flags", "and", "whether", "the", "responsible", "slots", "changed", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/cluster/topology/TopologyComparators.java#L143-L162
apache/flink
flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/ZookeeperOffsetHandler.java
ZookeeperOffsetHandler.prepareAndCommitOffsets
public void prepareAndCommitOffsets(Map<KafkaTopicPartition, Long> internalOffsets) throws Exception { """ Commits offsets for Kafka partitions to ZooKeeper. The given offsets to this method should be the offsets of the last processed records; this method will take care of incrementing the offsets by 1 before committing them so that the committed offsets to Zookeeper represent the next record to process. @param internalOffsets The internal offsets (representing last processed records) for the partitions to commit. @throws Exception The method forwards exceptions. """ for (Map.Entry<KafkaTopicPartition, Long> entry : internalOffsets.entrySet()) { KafkaTopicPartition tp = entry.getKey(); Long lastProcessedOffset = entry.getValue(); if (lastProcessedOffset != null && lastProcessedOffset >= 0) { setOffsetInZooKeeper(curatorClient, groupId, tp.getTopic(), tp.getPartition(), lastProcessedOffset + 1); } } }
java
public void prepareAndCommitOffsets(Map<KafkaTopicPartition, Long> internalOffsets) throws Exception { for (Map.Entry<KafkaTopicPartition, Long> entry : internalOffsets.entrySet()) { KafkaTopicPartition tp = entry.getKey(); Long lastProcessedOffset = entry.getValue(); if (lastProcessedOffset != null && lastProcessedOffset >= 0) { setOffsetInZooKeeper(curatorClient, groupId, tp.getTopic(), tp.getPartition(), lastProcessedOffset + 1); } } }
[ "public", "void", "prepareAndCommitOffsets", "(", "Map", "<", "KafkaTopicPartition", ",", "Long", ">", "internalOffsets", ")", "throws", "Exception", "{", "for", "(", "Map", ".", "Entry", "<", "KafkaTopicPartition", ",", "Long", ">", "entry", ":", "internalOffsets", ".", "entrySet", "(", ")", ")", "{", "KafkaTopicPartition", "tp", "=", "entry", ".", "getKey", "(", ")", ";", "Long", "lastProcessedOffset", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "lastProcessedOffset", "!=", "null", "&&", "lastProcessedOffset", ">=", "0", ")", "{", "setOffsetInZooKeeper", "(", "curatorClient", ",", "groupId", ",", "tp", ".", "getTopic", "(", ")", ",", "tp", ".", "getPartition", "(", ")", ",", "lastProcessedOffset", "+", "1", ")", ";", "}", "}", "}" ]
Commits offsets for Kafka partitions to ZooKeeper. The given offsets to this method should be the offsets of the last processed records; this method will take care of incrementing the offsets by 1 before committing them so that the committed offsets to Zookeeper represent the next record to process. @param internalOffsets The internal offsets (representing last processed records) for the partitions to commit. @throws Exception The method forwards exceptions.
[ "Commits", "offsets", "for", "Kafka", "partitions", "to", "ZooKeeper", ".", "The", "given", "offsets", "to", "this", "method", "should", "be", "the", "offsets", "of", "the", "last", "processed", "records", ";", "this", "method", "will", "take", "care", "of", "incrementing", "the", "offsets", "by", "1", "before", "committing", "them", "so", "that", "the", "committed", "offsets", "to", "Zookeeper", "represent", "the", "next", "record", "to", "process", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/ZookeeperOffsetHandler.java#L86-L95
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/tools/ApiBuilder.java
ApiBuilder.getUrlFromProps
private static String getUrlFromProps(Map<String, String> properties) throws RottenTomatoesException { """ Get and process the URL from the properties map @param properties @return The processed URL @throws RottenTomatoesException """ if (properties.containsKey(PROPERTY_URL) && StringUtils.isNotBlank(properties.get(PROPERTY_URL))) { String url = properties.get(PROPERTY_URL); // If we have the ID, then we need to replace the "{movie-id}" in the URL if (properties.containsKey(PROPERTY_ID) && StringUtils.isNotBlank(properties.get(PROPERTY_ID))) { url = url.replace(MOVIE_ID, String.valueOf(properties.get(PROPERTY_ID))); // We don't need this property anymore properties.remove(PROPERTY_ID); } // We don't need this property anymore properties.remove(PROPERTY_URL); return url; } else { throw new RottenTomatoesException(ApiExceptionType.INVALID_URL, "No URL specified"); } }
java
private static String getUrlFromProps(Map<String, String> properties) throws RottenTomatoesException { if (properties.containsKey(PROPERTY_URL) && StringUtils.isNotBlank(properties.get(PROPERTY_URL))) { String url = properties.get(PROPERTY_URL); // If we have the ID, then we need to replace the "{movie-id}" in the URL if (properties.containsKey(PROPERTY_ID) && StringUtils.isNotBlank(properties.get(PROPERTY_ID))) { url = url.replace(MOVIE_ID, String.valueOf(properties.get(PROPERTY_ID))); // We don't need this property anymore properties.remove(PROPERTY_ID); } // We don't need this property anymore properties.remove(PROPERTY_URL); return url; } else { throw new RottenTomatoesException(ApiExceptionType.INVALID_URL, "No URL specified"); } }
[ "private", "static", "String", "getUrlFromProps", "(", "Map", "<", "String", ",", "String", ">", "properties", ")", "throws", "RottenTomatoesException", "{", "if", "(", "properties", ".", "containsKey", "(", "PROPERTY_URL", ")", "&&", "StringUtils", ".", "isNotBlank", "(", "properties", ".", "get", "(", "PROPERTY_URL", ")", ")", ")", "{", "String", "url", "=", "properties", ".", "get", "(", "PROPERTY_URL", ")", ";", "// If we have the ID, then we need to replace the \"{movie-id}\" in the URL", "if", "(", "properties", ".", "containsKey", "(", "PROPERTY_ID", ")", "&&", "StringUtils", ".", "isNotBlank", "(", "properties", ".", "get", "(", "PROPERTY_ID", ")", ")", ")", "{", "url", "=", "url", ".", "replace", "(", "MOVIE_ID", ",", "String", ".", "valueOf", "(", "properties", ".", "get", "(", "PROPERTY_ID", ")", ")", ")", ";", "// We don't need this property anymore", "properties", ".", "remove", "(", "PROPERTY_ID", ")", ";", "}", "// We don't need this property anymore", "properties", ".", "remove", "(", "PROPERTY_URL", ")", ";", "return", "url", ";", "}", "else", "{", "throw", "new", "RottenTomatoesException", "(", "ApiExceptionType", ".", "INVALID_URL", ",", "\"No URL specified\"", ")", ";", "}", "}" ]
Get and process the URL from the properties map @param properties @return The processed URL @throws RottenTomatoesException
[ "Get", "and", "process", "the", "URL", "from", "the", "properties", "map" ]
train
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/tools/ApiBuilder.java#L99-L115
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java
Messenger.bindFile
@NotNull @ObjectiveCName("bindFileWithReference:autoStart:withCallback:") public FileVM bindFile(FileReference fileReference, boolean isAutoStart, FileVMCallback callback) { """ Bind File View Model @param fileReference reference to file @param isAutoStart automatically start download @param callback View Model file state callback @return File View Model """ return new FileVM(fileReference, isAutoStart, modules, callback); }
java
@NotNull @ObjectiveCName("bindFileWithReference:autoStart:withCallback:") public FileVM bindFile(FileReference fileReference, boolean isAutoStart, FileVMCallback callback) { return new FileVM(fileReference, isAutoStart, modules, callback); }
[ "@", "NotNull", "@", "ObjectiveCName", "(", "\"bindFileWithReference:autoStart:withCallback:\"", ")", "public", "FileVM", "bindFile", "(", "FileReference", "fileReference", ",", "boolean", "isAutoStart", ",", "FileVMCallback", "callback", ")", "{", "return", "new", "FileVM", "(", "fileReference", ",", "isAutoStart", ",", "modules", ",", "callback", ")", ";", "}" ]
Bind File View Model @param fileReference reference to file @param isAutoStart automatically start download @param callback View Model file state callback @return File View Model
[ "Bind", "File", "View", "Model" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L1904-L1908
gwtbootstrap3/gwtbootstrap3-extras
src/main/java/org/gwtbootstrap3/extras/notify/client/ui/NotifySettings.java
NotifySettings.setAnimation
public final void setAnimation(Animation enter, Animation exit) { """ Set Animation to Notify when it enters and exit the screen. Default is enter = Animation.FADE_IN_DOWN, exit = Animation.FADE_OUT_UP @see org.gwtbootstrap3.extras.animate.client.ui.constants.Animation @param enter animation style when Notify enters the screen @param exit animation style when Notify exists the screen """ setAnimation((enter != null) ? enter.getCssName() : Animation.NO_ANIMATION.getCssName(), (exit != null) ? exit.getCssName() : Animation.NO_ANIMATION.getCssName()); }
java
public final void setAnimation(Animation enter, Animation exit) { setAnimation((enter != null) ? enter.getCssName() : Animation.NO_ANIMATION.getCssName(), (exit != null) ? exit.getCssName() : Animation.NO_ANIMATION.getCssName()); }
[ "public", "final", "void", "setAnimation", "(", "Animation", "enter", ",", "Animation", "exit", ")", "{", "setAnimation", "(", "(", "enter", "!=", "null", ")", "?", "enter", ".", "getCssName", "(", ")", ":", "Animation", ".", "NO_ANIMATION", ".", "getCssName", "(", ")", ",", "(", "exit", "!=", "null", ")", "?", "exit", ".", "getCssName", "(", ")", ":", "Animation", ".", "NO_ANIMATION", ".", "getCssName", "(", ")", ")", ";", "}" ]
Set Animation to Notify when it enters and exit the screen. Default is enter = Animation.FADE_IN_DOWN, exit = Animation.FADE_OUT_UP @see org.gwtbootstrap3.extras.animate.client.ui.constants.Animation @param enter animation style when Notify enters the screen @param exit animation style when Notify exists the screen
[ "Set", "Animation", "to", "Notify", "when", "it", "enters", "and", "exit", "the", "screen", "." ]
train
https://github.com/gwtbootstrap3/gwtbootstrap3-extras/blob/8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94/src/main/java/org/gwtbootstrap3/extras/notify/client/ui/NotifySettings.java#L261-L264
Azure/azure-sdk-for-java
batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/ClustersInner.java
ClustersInner.getAsync
public Observable<ClusterInner> getAsync(String resourceGroupName, String workspaceName, String clusterName) { """ Gets information about a Cluster. @param resourceGroupName Name of the resource group to which the resource belongs. @param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param clusterName The name of the cluster within the specified resource group. Cluster names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ClusterInner object """ return getWithServiceResponseAsync(resourceGroupName, workspaceName, clusterName).map(new Func1<ServiceResponse<ClusterInner>, ClusterInner>() { @Override public ClusterInner call(ServiceResponse<ClusterInner> response) { return response.body(); } }); }
java
public Observable<ClusterInner> getAsync(String resourceGroupName, String workspaceName, String clusterName) { return getWithServiceResponseAsync(resourceGroupName, workspaceName, clusterName).map(new Func1<ServiceResponse<ClusterInner>, ClusterInner>() { @Override public ClusterInner call(ServiceResponse<ClusterInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ClusterInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "workspaceName", ",", "String", "clusterName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "workspaceName", ",", "clusterName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ClusterInner", ">", ",", "ClusterInner", ">", "(", ")", "{", "@", "Override", "public", "ClusterInner", "call", "(", "ServiceResponse", "<", "ClusterInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets information about a Cluster. @param resourceGroupName Name of the resource group to which the resource belongs. @param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param clusterName The name of the cluster within the specified resource group. Cluster names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ClusterInner object
[ "Gets", "information", "about", "a", "Cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/ClustersInner.java#L1078-L1085
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/AliasManager.java
AliasManager.loadFromProperties
public void loadFromProperties(java.util.Properties properties) { """ Loads Aliases from a java.util.Properties file located at the specified URL. The properties must be of the form: <pre><code>[alias name]=[fully qualified classname]</code></pre> each of which may have an optional <pre><code>[alias name].desc=[alias description]</code></pre> For example, to create an alias called " <code>myprog</code>" for class <code> com.mydomain.myapp.MyProg</code>, the following properties would be defined: <pre><code>myprog=com.mydomain.myapp.MyProg myprog.desc=Runs my program. </code></pre> @param properties the Properties to load. """ for (Iterator i = properties.keySet().iterator(); i.hasNext(); ) { String key = (String) i.next(); if (!key.endsWith(".desc")) { try { Class clazz = Class.forName(properties.getProperty(key)); String desc = properties.getProperty(key + ".desc", ""); addAlias(new Alias(key, desc, clazz)); } catch (ClassNotFoundException e) { System.err.println("Unable to locate class " + properties.getProperty(key)); } } } }
java
public void loadFromProperties(java.util.Properties properties) { for (Iterator i = properties.keySet().iterator(); i.hasNext(); ) { String key = (String) i.next(); if (!key.endsWith(".desc")) { try { Class clazz = Class.forName(properties.getProperty(key)); String desc = properties.getProperty(key + ".desc", ""); addAlias(new Alias(key, desc, clazz)); } catch (ClassNotFoundException e) { System.err.println("Unable to locate class " + properties.getProperty(key)); } } } }
[ "public", "void", "loadFromProperties", "(", "java", ".", "util", ".", "Properties", "properties", ")", "{", "for", "(", "Iterator", "i", "=", "properties", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "String", "key", "=", "(", "String", ")", "i", ".", "next", "(", ")", ";", "if", "(", "!", "key", ".", "endsWith", "(", "\".desc\"", ")", ")", "{", "try", "{", "Class", "clazz", "=", "Class", ".", "forName", "(", "properties", ".", "getProperty", "(", "key", ")", ")", ";", "String", "desc", "=", "properties", ".", "getProperty", "(", "key", "+", "\".desc\"", ",", "\"\"", ")", ";", "addAlias", "(", "new", "Alias", "(", "key", ",", "desc", ",", "clazz", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"Unable to locate class \"", "+", "properties", ".", "getProperty", "(", "key", ")", ")", ";", "}", "}", "}", "}" ]
Loads Aliases from a java.util.Properties file located at the specified URL. The properties must be of the form: <pre><code>[alias name]=[fully qualified classname]</code></pre> each of which may have an optional <pre><code>[alias name].desc=[alias description]</code></pre> For example, to create an alias called " <code>myprog</code>" for class <code> com.mydomain.myapp.MyProg</code>, the following properties would be defined: <pre><code>myprog=com.mydomain.myapp.MyProg myprog.desc=Runs my program. </code></pre> @param properties the Properties to load.
[ "Loads", "Aliases", "from", "a", "java", ".", "util", ".", "Properties", "file", "located", "at", "the", "specified", "URL", ".", "The", "properties", "must", "be", "of", "the", "form", ":" ]
train
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/AliasManager.java#L74-L87
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.escapeUriFragmentId
public static void escapeUriFragmentId(final Reader reader, final Writer writer, final String encoding) throws IOException { """ <p> Perform am URI fragment identifier <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> The following are the only allowed chars in an URI fragment identifier (will not be escaped): </p> <ul> <li><tt>A-Z a-z 0-9</tt></li> <li><tt>- . _ ~</tt></li> <li><tt>! $ &amp; ' ( ) * + , ; =</tt></li> <li><tt>: @</tt></li> <li><tt>/ ?</tt></li> </ul> <p> All other chars will be escaped by converting them to the sequence of bytes that represents them in the specified <em>encoding</em> and then representing each byte in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param encoding the encoding to be used for escaping. @throws IOException if an input/output exception occurs @since 1.1.2 """ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } UriEscapeUtil.escape(reader, writer, UriEscapeUtil.UriEscapeType.FRAGMENT_ID, encoding); }
java
public static void escapeUriFragmentId(final Reader reader, final Writer writer, final String encoding) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } UriEscapeUtil.escape(reader, writer, UriEscapeUtil.UriEscapeType.FRAGMENT_ID, encoding); }
[ "public", "static", "void", "escapeUriFragmentId", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Argument 'writer' cannot be null\"", ")", ";", "}", "if", "(", "encoding", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Argument 'encoding' cannot be null\"", ")", ";", "}", "UriEscapeUtil", ".", "escape", "(", "reader", ",", "writer", ",", "UriEscapeUtil", ".", "UriEscapeType", ".", "FRAGMENT_ID", ",", "encoding", ")", ";", "}" ]
<p> Perform am URI fragment identifier <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> The following are the only allowed chars in an URI fragment identifier (will not be escaped): </p> <ul> <li><tt>A-Z a-z 0-9</tt></li> <li><tt>- . _ ~</tt></li> <li><tt>! $ &amp; ' ( ) * + , ; =</tt></li> <li><tt>: @</tt></li> <li><tt>/ ?</tt></li> </ul> <p> All other chars will be escaped by converting them to the sequence of bytes that represents them in the specified <em>encoding</em> and then representing each byte in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param encoding the encoding to be used for escaping. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "am", "URI", "fragment", "identifier", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "The", "following", "are", "the", "only", "allowed", "chars", "in", "an", "URI", "fragment", "identifier", "(", "will", "not", "be", "escaped", ")", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "<tt", ">", "A", "-", "Z", "a", "-", "z", "0", "-", "9<", "/", "tt", ">", "<", "/", "li", ">", "<li", ">", "<tt", ">", "-", ".", "_", "~<", "/", "tt", ">", "<", "/", "li", ">", "<li", ">", "<tt", ">", "!", "$", "&amp", ";", "(", ")", "*", "+", ";", "=", "<", "/", "tt", ">", "<", "/", "li", ">", "<li", ">", "<tt", ">", ":", "@<", "/", "tt", ">", "<", "/", "li", ">", "<li", ">", "<tt", ">", "/", "?<", "/", "tt", ">", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "All", "other", "chars", "will", "be", "escaped", "by", "converting", "them", "to", "the", "sequence", "of", "bytes", "that", "represents", "them", "in", "the", "specified", "<em", ">", "encoding<", "/", "em", ">", "and", "then", "representing", "each", "byte", "in", "<tt", ">", "%HH<", "/", "tt", ">", "syntax", "being", "<tt", ">", "HH<", "/", "tt", ">", "the", "hexadecimal", "representation", "of", "the", "byte", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L1094-L1107
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.NTFLambdaPhi_NTFLambert
@SuppressWarnings( { """ This function convert the geographical NTF Lambda-Phi coordinate to one of the France NTF standard coordinate. @param lambda is the NTF coordinate. @param phi is the NTF coordinate. @param n is the exponential of the Lambert projection. @param c is the constant of projection. @param Xs is the x coordinate of the origine of the Lambert projection. @param Ys is the y coordinate of the origine of the Lambert projection. @return the extended France Lambert II coordinates. """"checkstyle:parametername", "checkstyle:magicnumber", "checkstyle:localfinalvariablename", "checkstyle:localvariablename"}) private static Point2d NTFLambdaPhi_NTFLambert(double lambda, double phi, double n, double c, double Xs, double Ys) { //--------------------------------------------------------- // 3) cartesian coordinate NTF (X_n,Y_n,Z_n) // -> geographical coordinate NTF (phi_n,lambda_n) // One formula is given by the IGN, and two constants about // the ellipsoide are from the NTF system specification of Clarke 1880. // Ref: // http://www.ign.fr/telechargement/MPro/geodesie/CIRCE/NTG_80.pdf // http://support.esrifrance.fr/Documents/Generalites/Projections/Generalites/Generalites.htm#2 final double a_n = 6378249.2; final double b_n = 6356515.0; // then final double e2_n = (a_n * a_n - b_n * b_n) / (a_n * a_n); //--------------------------------------------------------- // 4) Geographical coordinate NTF (phi_n,lambda_n) // -> Extended Lambert II coordinate (X_l2e, Y_l2e) // Formula are given by the IGN from another specification // Ref: // http://www.ign.fr/telechargement/MPro/geodesie/CIRCE/NTG_71.pdf final double e_n = Math.sqrt(e2_n); // Let the longitude in radians of Paris (2°20'14.025" E) from the Greenwich meridian final double lambda0 = 0.04079234433198; // Compute the isometric latitude final double L = Math.log(Math.tan(Math.PI / 4. + phi / 2.) * Math.pow((1. - e_n * Math.sin(phi)) / (1. + e_n * Math.sin(phi)), e_n / 2.)); // Then do the projection according to extended Lambert II final double X_l2e = Xs + c * Math.exp(-n * L) * Math.sin(n * (lambda - lambda0)); final double Y_l2e = Ys - c * Math.exp(-n * L) * Math.cos(n * (lambda - lambda0)); return new Point2d(X_l2e, Y_l2e); }
java
@SuppressWarnings({"checkstyle:parametername", "checkstyle:magicnumber", "checkstyle:localfinalvariablename", "checkstyle:localvariablename"}) private static Point2d NTFLambdaPhi_NTFLambert(double lambda, double phi, double n, double c, double Xs, double Ys) { //--------------------------------------------------------- // 3) cartesian coordinate NTF (X_n,Y_n,Z_n) // -> geographical coordinate NTF (phi_n,lambda_n) // One formula is given by the IGN, and two constants about // the ellipsoide are from the NTF system specification of Clarke 1880. // Ref: // http://www.ign.fr/telechargement/MPro/geodesie/CIRCE/NTG_80.pdf // http://support.esrifrance.fr/Documents/Generalites/Projections/Generalites/Generalites.htm#2 final double a_n = 6378249.2; final double b_n = 6356515.0; // then final double e2_n = (a_n * a_n - b_n * b_n) / (a_n * a_n); //--------------------------------------------------------- // 4) Geographical coordinate NTF (phi_n,lambda_n) // -> Extended Lambert II coordinate (X_l2e, Y_l2e) // Formula are given by the IGN from another specification // Ref: // http://www.ign.fr/telechargement/MPro/geodesie/CIRCE/NTG_71.pdf final double e_n = Math.sqrt(e2_n); // Let the longitude in radians of Paris (2°20'14.025" E) from the Greenwich meridian final double lambda0 = 0.04079234433198; // Compute the isometric latitude final double L = Math.log(Math.tan(Math.PI / 4. + phi / 2.) * Math.pow((1. - e_n * Math.sin(phi)) / (1. + e_n * Math.sin(phi)), e_n / 2.)); // Then do the projection according to extended Lambert II final double X_l2e = Xs + c * Math.exp(-n * L) * Math.sin(n * (lambda - lambda0)); final double Y_l2e = Ys - c * Math.exp(-n * L) * Math.cos(n * (lambda - lambda0)); return new Point2d(X_l2e, Y_l2e); }
[ "@", "SuppressWarnings", "(", "{", "\"checkstyle:parametername\"", ",", "\"checkstyle:magicnumber\"", ",", "\"checkstyle:localfinalvariablename\"", ",", "\"checkstyle:localvariablename\"", "}", ")", "private", "static", "Point2d", "NTFLambdaPhi_NTFLambert", "(", "double", "lambda", ",", "double", "phi", ",", "double", "n", ",", "double", "c", ",", "double", "Xs", ",", "double", "Ys", ")", "{", "//---------------------------------------------------------", "// 3) cartesian coordinate NTF (X_n,Y_n,Z_n)", "// -> geographical coordinate NTF (phi_n,lambda_n)", "// One formula is given by the IGN, and two constants about", "// the ellipsoide are from the NTF system specification of Clarke 1880.", "// Ref:", "//\t\thttp://www.ign.fr/telechargement/MPro/geodesie/CIRCE/NTG_80.pdf", "//\t\thttp://support.esrifrance.fr/Documents/Generalites/Projections/Generalites/Generalites.htm#2", "final", "double", "a_n", "=", "6378249.2", ";", "final", "double", "b_n", "=", "6356515.0", ";", "// then", "final", "double", "e2_n", "=", "(", "a_n", "*", "a_n", "-", "b_n", "*", "b_n", ")", "/", "(", "a_n", "*", "a_n", ")", ";", "//---------------------------------------------------------", "// 4) Geographical coordinate NTF (phi_n,lambda_n)", "// -> Extended Lambert II coordinate (X_l2e, Y_l2e)", "// Formula are given by the IGN from another specification", "// Ref:", "//\t\thttp://www.ign.fr/telechargement/MPro/geodesie/CIRCE/NTG_71.pdf", "final", "double", "e_n", "=", "Math", ".", "sqrt", "(", "e2_n", ")", ";", "// Let the longitude in radians of Paris (2°20'14.025\" E) from the Greenwich meridian", "final", "double", "lambda0", "=", "0.04079234433198", ";", "// Compute the isometric latitude", "final", "double", "L", "=", "Math", ".", "log", "(", "Math", ".", "tan", "(", "Math", ".", "PI", "/", "4.", "+", "phi", "/", "2.", ")", "*", "Math", ".", "pow", "(", "(", "1.", "-", "e_n", "*", "Math", ".", "sin", "(", "phi", ")", ")", "/", "(", "1.", "+", "e_n", "*", "Math", ".", "sin", "(", "phi", ")", ")", ",", "e_n", "/", "2.", ")", ")", ";", "// Then do the projection according to extended Lambert II", "final", "double", "X_l2e", "=", "Xs", "+", "c", "*", "Math", ".", "exp", "(", "-", "n", "*", "L", ")", "*", "Math", ".", "sin", "(", "n", "*", "(", "lambda", "-", "lambda0", ")", ")", ";", "final", "double", "Y_l2e", "=", "Ys", "-", "c", "*", "Math", ".", "exp", "(", "-", "n", "*", "L", ")", "*", "Math", ".", "cos", "(", "n", "*", "(", "lambda", "-", "lambda0", ")", ")", ";", "return", "new", "Point2d", "(", "X_l2e", ",", "Y_l2e", ")", ";", "}" ]
This function convert the geographical NTF Lambda-Phi coordinate to one of the France NTF standard coordinate. @param lambda is the NTF coordinate. @param phi is the NTF coordinate. @param n is the exponential of the Lambert projection. @param c is the constant of projection. @param Xs is the x coordinate of the origine of the Lambert projection. @param Ys is the y coordinate of the origine of the Lambert projection. @return the extended France Lambert II coordinates.
[ "This", "function", "convert", "the", "geographical", "NTF", "Lambda", "-", "Phi", "coordinate", "to", "one", "of", "the", "France", "NTF", "standard", "coordinate", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1155-L1194
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java
BackupLongTermRetentionVaultsInner.listByServerAsync
public Observable<List<BackupLongTermRetentionVaultInner>> listByServerAsync(String resourceGroupName, String serverName) { """ Gets server backup long term retention vaults in a server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;BackupLongTermRetentionVaultInner&gt; object """ return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<BackupLongTermRetentionVaultInner>>, List<BackupLongTermRetentionVaultInner>>() { @Override public List<BackupLongTermRetentionVaultInner> call(ServiceResponse<List<BackupLongTermRetentionVaultInner>> response) { return response.body(); } }); }
java
public Observable<List<BackupLongTermRetentionVaultInner>> listByServerAsync(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<BackupLongTermRetentionVaultInner>>, List<BackupLongTermRetentionVaultInner>>() { @Override public List<BackupLongTermRetentionVaultInner> call(ServiceResponse<List<BackupLongTermRetentionVaultInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "BackupLongTermRetentionVaultInner", ">", ">", "listByServerAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "listByServerWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "BackupLongTermRetentionVaultInner", ">", ">", ",", "List", "<", "BackupLongTermRetentionVaultInner", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "BackupLongTermRetentionVaultInner", ">", "call", "(", "ServiceResponse", "<", "List", "<", "BackupLongTermRetentionVaultInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets server backup long term retention vaults in a server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;BackupLongTermRetentionVaultInner&gt; object
[ "Gets", "server", "backup", "long", "term", "retention", "vaults", "in", "a", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java#L374-L381
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.recognizePrintedTextInStream
public OcrResult recognizePrintedTextInStream(boolean detectOrientation, byte[] image, RecognizePrintedTextInStreamOptionalParameter recognizePrintedTextInStreamOptionalParameter) { """ Optical Character Recognition (OCR) detects printed text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError. @param detectOrientation Whether detect the text orientation in the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down). @param image An image stream. @param recognizePrintedTextInStreamOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ComputerVisionErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OcrResult object if successful. """ return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, recognizePrintedTextInStreamOptionalParameter).toBlocking().single().body(); }
java
public OcrResult recognizePrintedTextInStream(boolean detectOrientation, byte[] image, RecognizePrintedTextInStreamOptionalParameter recognizePrintedTextInStreamOptionalParameter) { return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, recognizePrintedTextInStreamOptionalParameter).toBlocking().single().body(); }
[ "public", "OcrResult", "recognizePrintedTextInStream", "(", "boolean", "detectOrientation", ",", "byte", "[", "]", "image", ",", "RecognizePrintedTextInStreamOptionalParameter", "recognizePrintedTextInStreamOptionalParameter", ")", "{", "return", "recognizePrintedTextInStreamWithServiceResponseAsync", "(", "detectOrientation", ",", "image", ",", "recognizePrintedTextInStreamOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Optical Character Recognition (OCR) detects printed text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError. @param detectOrientation Whether detect the text orientation in the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down). @param image An image stream. @param recognizePrintedTextInStreamOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ComputerVisionErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OcrResult object if successful.
[ "Optical", "Character", "Recognition", "(", "OCR", ")", "detects", "printed", "text", "in", "an", "image", "and", "extracts", "the", "recognized", "characters", "into", "a", "machine", "-", "usable", "character", "stream", ".", "Upon", "success", "the", "OCR", "results", "will", "be", "returned", ".", "Upon", "failure", "the", "error", "code", "together", "with", "an", "error", "message", "will", "be", "returned", ".", "The", "error", "code", "can", "be", "one", "of", "InvalidImageUrl", "InvalidImageFormat", "InvalidImageSize", "NotSupportedImage", "NotSupportedLanguage", "or", "InternalServerError", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L740-L742
h2oai/h2o-3
h2o-core/src/main/java/water/FJPacket.java
FJPacket.onExceptionalCompletion
@Override public boolean onExceptionalCompletion(Throwable ex, jsr166y.CountedCompleter caller) { """ Exceptional completion path; mostly does printing if the exception was not handled earlier in the stack. """ System.err.println("onExCompletion for "+this); ex.printStackTrace(); water.util.Log.err(ex); return true; }
java
@Override public boolean onExceptionalCompletion(Throwable ex, jsr166y.CountedCompleter caller) { System.err.println("onExCompletion for "+this); ex.printStackTrace(); water.util.Log.err(ex); return true; }
[ "@", "Override", "public", "boolean", "onExceptionalCompletion", "(", "Throwable", "ex", ",", "jsr166y", ".", "CountedCompleter", "caller", ")", "{", "System", ".", "err", ".", "println", "(", "\"onExCompletion for \"", "+", "this", ")", ";", "ex", ".", "printStackTrace", "(", ")", ";", "water", ".", "util", ".", "Log", ".", "err", "(", "ex", ")", ";", "return", "true", ";", "}" ]
Exceptional completion path; mostly does printing if the exception was not handled earlier in the stack.
[ "Exceptional", "completion", "path", ";", "mostly", "does", "printing", "if", "the", "exception", "was", "not", "handled", "earlier", "in", "the", "stack", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/FJPacket.java#L37-L42
paypal/SeLion
server/src/main/java/com/paypal/selion/grid/servlets/SauceServlet.java
SauceServlet.registerVirtualSauceNodeToGrid
private synchronized void registerVirtualSauceNodeToGrid(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { """ /* A helper method that takes care of registering a virtual node to the hub. """ // Redirecting to login page if session is not found if (req.getSession(false) == null) { resp.sendRedirect(LoginServlet.class.getSimpleName()); return; } String respMsg = "Sauce node already registered."; if (registered) { ServletHelper.respondAsHtmlWithMessage(resp, formatForHtmlTemplate(respMsg)); LOGGER.info(respMsg); return; } HttpClientFactory httpClientFactory = new HttpClientFactory(); respMsg = "Sauce node registration failed. Please refer to the log file for failure details."; try { final int port = getRegistry().getHub().getConfiguration().port; final URL registration = new URL("http://localhost:" + port + "/grid/register"); BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", registration.toExternalForm()); request.setEntity(new StringEntity(getRegistrationRequestEntity())); HttpHost host = new HttpHost(registration.getHost(), registration.getPort()); HttpClient client = httpClientFactory.getHttpClient(); HttpResponse response = client.execute(host, request); if (response.getStatusLine().getStatusCode() == HttpServletResponse.SC_OK) { respMsg = "Sauce node registered successfully."; registered = true; } } catch (IOException | GridConfigurationException e) { // We catch the GridConfigurationException here to fail // gracefully // TODO Consider retrying on failure LOGGER.log(Level.WARNING, "Unable to register sauce node: ", e); } finally { httpClientFactory.close(); } LOGGER.info(respMsg); ServletHelper.respondAsHtmlWithMessage(resp, formatForHtmlTemplate(respMsg)); }
java
private synchronized void registerVirtualSauceNodeToGrid(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // Redirecting to login page if session is not found if (req.getSession(false) == null) { resp.sendRedirect(LoginServlet.class.getSimpleName()); return; } String respMsg = "Sauce node already registered."; if (registered) { ServletHelper.respondAsHtmlWithMessage(resp, formatForHtmlTemplate(respMsg)); LOGGER.info(respMsg); return; } HttpClientFactory httpClientFactory = new HttpClientFactory(); respMsg = "Sauce node registration failed. Please refer to the log file for failure details."; try { final int port = getRegistry().getHub().getConfiguration().port; final URL registration = new URL("http://localhost:" + port + "/grid/register"); BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", registration.toExternalForm()); request.setEntity(new StringEntity(getRegistrationRequestEntity())); HttpHost host = new HttpHost(registration.getHost(), registration.getPort()); HttpClient client = httpClientFactory.getHttpClient(); HttpResponse response = client.execute(host, request); if (response.getStatusLine().getStatusCode() == HttpServletResponse.SC_OK) { respMsg = "Sauce node registered successfully."; registered = true; } } catch (IOException | GridConfigurationException e) { // We catch the GridConfigurationException here to fail // gracefully // TODO Consider retrying on failure LOGGER.log(Level.WARNING, "Unable to register sauce node: ", e); } finally { httpClientFactory.close(); } LOGGER.info(respMsg); ServletHelper.respondAsHtmlWithMessage(resp, formatForHtmlTemplate(respMsg)); }
[ "private", "synchronized", "void", "registerVirtualSauceNodeToGrid", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "// Redirecting to login page if session is not found", "if", "(", "req", ".", "getSession", "(", "false", ")", "==", "null", ")", "{", "resp", ".", "sendRedirect", "(", "LoginServlet", ".", "class", ".", "getSimpleName", "(", ")", ")", ";", "return", ";", "}", "String", "respMsg", "=", "\"Sauce node already registered.\"", ";", "if", "(", "registered", ")", "{", "ServletHelper", ".", "respondAsHtmlWithMessage", "(", "resp", ",", "formatForHtmlTemplate", "(", "respMsg", ")", ")", ";", "LOGGER", ".", "info", "(", "respMsg", ")", ";", "return", ";", "}", "HttpClientFactory", "httpClientFactory", "=", "new", "HttpClientFactory", "(", ")", ";", "respMsg", "=", "\"Sauce node registration failed. Please refer to the log file for failure details.\"", ";", "try", "{", "final", "int", "port", "=", "getRegistry", "(", ")", ".", "getHub", "(", ")", ".", "getConfiguration", "(", ")", ".", "port", ";", "final", "URL", "registration", "=", "new", "URL", "(", "\"http://localhost:\"", "+", "port", "+", "\"/grid/register\"", ")", ";", "BasicHttpEntityEnclosingRequest", "request", "=", "new", "BasicHttpEntityEnclosingRequest", "(", "\"POST\"", ",", "registration", ".", "toExternalForm", "(", ")", ")", ";", "request", ".", "setEntity", "(", "new", "StringEntity", "(", "getRegistrationRequestEntity", "(", ")", ")", ")", ";", "HttpHost", "host", "=", "new", "HttpHost", "(", "registration", ".", "getHost", "(", ")", ",", "registration", ".", "getPort", "(", ")", ")", ";", "HttpClient", "client", "=", "httpClientFactory", ".", "getHttpClient", "(", ")", ";", "HttpResponse", "response", "=", "client", ".", "execute", "(", "host", ",", "request", ")", ";", "if", "(", "response", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", "==", "HttpServletResponse", ".", "SC_OK", ")", "{", "respMsg", "=", "\"Sauce node registered successfully.\"", ";", "registered", "=", "true", ";", "}", "}", "catch", "(", "IOException", "|", "GridConfigurationException", "e", ")", "{", "// We catch the GridConfigurationException here to fail", "// gracefully", "// TODO Consider retrying on failure", "LOGGER", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Unable to register sauce node: \"", ",", "e", ")", ";", "}", "finally", "{", "httpClientFactory", ".", "close", "(", ")", ";", "}", "LOGGER", ".", "info", "(", "respMsg", ")", ";", "ServletHelper", ".", "respondAsHtmlWithMessage", "(", "resp", ",", "formatForHtmlTemplate", "(", "respMsg", ")", ")", ";", "}" ]
/* A helper method that takes care of registering a virtual node to the hub.
[ "/", "*", "A", "helper", "method", "that", "takes", "care", "of", "registering", "a", "virtual", "node", "to", "the", "hub", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/grid/servlets/SauceServlet.java#L123-L165
bwkimmel/java-util
src/main/java/ca/eandb/util/io/FileUtil.java
FileUtil.isAncestor
public static boolean isAncestor(File file, File ancestor) throws IOException { """ Determines if the specified directory is an ancestor of the specified file or directory. @param file The file or directory to test. @param ancestor The directory for which to determine whether <code>file</code> is an ancestor. @return <code>true</code> if <code>ancestor</code> is equal to or an ancestor of <code>file</code>, <code>false</code> otherwise. @throws IOException if an error occurs in attempting to canonicalize {@code file} or {@code ancestor}. """ file = file.getCanonicalFile(); ancestor = ancestor.getCanonicalFile(); do { if (file.equals(ancestor)) { return true; } file = file.getParentFile(); } while (file != null); return false; }
java
public static boolean isAncestor(File file, File ancestor) throws IOException { file = file.getCanonicalFile(); ancestor = ancestor.getCanonicalFile(); do { if (file.equals(ancestor)) { return true; } file = file.getParentFile(); } while (file != null); return false; }
[ "public", "static", "boolean", "isAncestor", "(", "File", "file", ",", "File", "ancestor", ")", "throws", "IOException", "{", "file", "=", "file", ".", "getCanonicalFile", "(", ")", ";", "ancestor", "=", "ancestor", ".", "getCanonicalFile", "(", ")", ";", "do", "{", "if", "(", "file", ".", "equals", "(", "ancestor", ")", ")", "{", "return", "true", ";", "}", "file", "=", "file", ".", "getParentFile", "(", ")", ";", "}", "while", "(", "file", "!=", "null", ")", ";", "return", "false", ";", "}" ]
Determines if the specified directory is an ancestor of the specified file or directory. @param file The file or directory to test. @param ancestor The directory for which to determine whether <code>file</code> is an ancestor. @return <code>true</code> if <code>ancestor</code> is equal to or an ancestor of <code>file</code>, <code>false</code> otherwise. @throws IOException if an error occurs in attempting to canonicalize {@code file} or {@code ancestor}.
[ "Determines", "if", "the", "specified", "directory", "is", "an", "ancestor", "of", "the", "specified", "file", "or", "directory", "." ]
train
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/io/FileUtil.java#L194-L204
jeluard/semantic-versioning
api/src/main/java/org/osjava/jardiff/JarDiff.java
JarDiff.loadClasses
private void loadClasses(Map infoMap, File file) throws DiffException { """ Load all the classes from the specified URL and store information about them in the specified map. This currently only works for jar files, <b>not</b> directories which contain classes in subdirectories or in the current directory. @param infoMap the map to store the ClassInfo in. @param file the jarfile to load classes from. @throws IOException if there is an IOException reading info about a class. """ try { JarFile jar = new JarFile(file); Enumeration e = jar.entries(); while (e.hasMoreElements()) { JarEntry entry = (JarEntry) e.nextElement(); String name = entry.getName(); if (!entry.isDirectory() && name.endsWith(".class")) { ClassReader reader = new ClassReader(jar.getInputStream(entry)); ClassInfo ci = loadClassInfo(reader); infoMap.put(ci.getName(), ci); } } } catch (IOException ioe) { throw new DiffException(ioe); } }
java
private void loadClasses(Map infoMap, File file) throws DiffException { try { JarFile jar = new JarFile(file); Enumeration e = jar.entries(); while (e.hasMoreElements()) { JarEntry entry = (JarEntry) e.nextElement(); String name = entry.getName(); if (!entry.isDirectory() && name.endsWith(".class")) { ClassReader reader = new ClassReader(jar.getInputStream(entry)); ClassInfo ci = loadClassInfo(reader); infoMap.put(ci.getName(), ci); } } } catch (IOException ioe) { throw new DiffException(ioe); } }
[ "private", "void", "loadClasses", "(", "Map", "infoMap", ",", "File", "file", ")", "throws", "DiffException", "{", "try", "{", "JarFile", "jar", "=", "new", "JarFile", "(", "file", ")", ";", "Enumeration", "e", "=", "jar", ".", "entries", "(", ")", ";", "while", "(", "e", ".", "hasMoreElements", "(", ")", ")", "{", "JarEntry", "entry", "=", "(", "JarEntry", ")", "e", ".", "nextElement", "(", ")", ";", "String", "name", "=", "entry", ".", "getName", "(", ")", ";", "if", "(", "!", "entry", ".", "isDirectory", "(", ")", "&&", "name", ".", "endsWith", "(", "\".class\"", ")", ")", "{", "ClassReader", "reader", "=", "new", "ClassReader", "(", "jar", ".", "getInputStream", "(", "entry", ")", ")", ";", "ClassInfo", "ci", "=", "loadClassInfo", "(", "reader", ")", ";", "infoMap", ".", "put", "(", "ci", ".", "getName", "(", ")", ",", "ci", ")", ";", "}", "}", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "new", "DiffException", "(", "ioe", ")", ";", "}", "}" ]
Load all the classes from the specified URL and store information about them in the specified map. This currently only works for jar files, <b>not</b> directories which contain classes in subdirectories or in the current directory. @param infoMap the map to store the ClassInfo in. @param file the jarfile to load classes from. @throws IOException if there is an IOException reading info about a class.
[ "Load", "all", "the", "classes", "from", "the", "specified", "URL", "and", "store", "information", "about", "them", "in", "the", "specified", "map", ".", "This", "currently", "only", "works", "for", "jar", "files", "<b", ">", "not<", "/", "b", ">", "directories", "which", "contain", "classes", "in", "subdirectories", "or", "in", "the", "current", "directory", "." ]
train
https://github.com/jeluard/semantic-versioning/blob/d0bfbeddca8ac4202f5225810227c72a708360a9/api/src/main/java/org/osjava/jardiff/JarDiff.java#L217-L234
apiman/apiman
manager/api/es/src/main/java/io/apiman/manager/api/es/EsStorage.java
EsStorage.getAll
private <T> Iterator<T> getAll(String entityType, IUnmarshaller<T> unmarshaller) throws StorageException { """ Returns an iterator over all instances of the given entity type. @param entityType @param unmarshaller @throws StorageException """ String query = matchAllQuery(); return getAll(entityType, unmarshaller, query); }
java
private <T> Iterator<T> getAll(String entityType, IUnmarshaller<T> unmarshaller) throws StorageException { String query = matchAllQuery(); return getAll(entityType, unmarshaller, query); }
[ "private", "<", "T", ">", "Iterator", "<", "T", ">", "getAll", "(", "String", "entityType", ",", "IUnmarshaller", "<", "T", ">", "unmarshaller", ")", "throws", "StorageException", "{", "String", "query", "=", "matchAllQuery", "(", ")", ";", "return", "getAll", "(", "entityType", ",", "unmarshaller", ",", "query", ")", ";", "}" ]
Returns an iterator over all instances of the given entity type. @param entityType @param unmarshaller @throws StorageException
[ "Returns", "an", "iterator", "over", "all", "instances", "of", "the", "given", "entity", "type", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsStorage.java#L2564-L2567
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperCube.java
SVGHyperCube.drawFrame
public static Element drawFrame(SVGPlot svgp, Projection2D proj, double[] min, double[] max) { """ Wireframe hypercube. @param svgp SVG Plot @param proj Visualization projection @param min First corner @param max Opposite corner @return path element """ SVGPath path = new SVGPath(); ArrayList<double[]> edges = getVisibleEdges(proj, min, max); double[] rv_min = proj.fastProjectDataToRenderSpace(min); recDrawEdges(path, rv_min[0], rv_min[1], edges, BitsUtil.zero(edges.size())); return path.makeElement(svgp); }
java
public static Element drawFrame(SVGPlot svgp, Projection2D proj, double[] min, double[] max) { SVGPath path = new SVGPath(); ArrayList<double[]> edges = getVisibleEdges(proj, min, max); double[] rv_min = proj.fastProjectDataToRenderSpace(min); recDrawEdges(path, rv_min[0], rv_min[1], edges, BitsUtil.zero(edges.size())); return path.makeElement(svgp); }
[ "public", "static", "Element", "drawFrame", "(", "SVGPlot", "svgp", ",", "Projection2D", "proj", ",", "double", "[", "]", "min", ",", "double", "[", "]", "max", ")", "{", "SVGPath", "path", "=", "new", "SVGPath", "(", ")", ";", "ArrayList", "<", "double", "[", "]", ">", "edges", "=", "getVisibleEdges", "(", "proj", ",", "min", ",", "max", ")", ";", "double", "[", "]", "rv_min", "=", "proj", ".", "fastProjectDataToRenderSpace", "(", "min", ")", ";", "recDrawEdges", "(", "path", ",", "rv_min", "[", "0", "]", ",", "rv_min", "[", "1", "]", ",", "edges", ",", "BitsUtil", ".", "zero", "(", "edges", ".", "size", "(", ")", ")", ")", ";", "return", "path", ".", "makeElement", "(", "svgp", ")", ";", "}" ]
Wireframe hypercube. @param svgp SVG Plot @param proj Visualization projection @param min First corner @param max Opposite corner @return path element
[ "Wireframe", "hypercube", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperCube.java#L61-L67
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/Unicode.java
Unicode.char2DOS437
public static synchronized String char2DOS437( StringBuffer stringbuffer, int i, char c ) { """ Char to DOS437 converter @param stringbuffer @param i @param c @return String """ if (unicode2DOS437 == null) { unicode2DOS437 = new char[0x10000]; for( int j = 0; j < 256; j++ ) { char c1; if ((c1 = unicode[2][j]) != '\uFFFF') unicode2DOS437[c1] = (char) j; } } if (i != 2) { StringBuffer stringbuffer1 = new StringBuffer(stringbuffer.length()); for( int k = 0; k < stringbuffer.length(); k++ ) { char c2 = unicode2DOS437[stringbuffer.charAt(k)]; stringbuffer1.append(c2 == 0 ? c : c2); } return new String(stringbuffer1); } else { return new String(stringbuffer); } }
java
public static synchronized String char2DOS437( StringBuffer stringbuffer, int i, char c ) { if (unicode2DOS437 == null) { unicode2DOS437 = new char[0x10000]; for( int j = 0; j < 256; j++ ) { char c1; if ((c1 = unicode[2][j]) != '\uFFFF') unicode2DOS437[c1] = (char) j; } } if (i != 2) { StringBuffer stringbuffer1 = new StringBuffer(stringbuffer.length()); for( int k = 0; k < stringbuffer.length(); k++ ) { char c2 = unicode2DOS437[stringbuffer.charAt(k)]; stringbuffer1.append(c2 == 0 ? c : c2); } return new String(stringbuffer1); } else { return new String(stringbuffer); } }
[ "public", "static", "synchronized", "String", "char2DOS437", "(", "StringBuffer", "stringbuffer", ",", "int", "i", ",", "char", "c", ")", "{", "if", "(", "unicode2DOS437", "==", "null", ")", "{", "unicode2DOS437", "=", "new", "char", "[", "0x10000", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "256", ";", "j", "++", ")", "{", "char", "c1", ";", "if", "(", "(", "c1", "=", "unicode", "[", "2", "]", "[", "j", "]", ")", "!=", "'", "'", ")", "unicode2DOS437", "[", "c1", "]", "=", "(", "char", ")", "j", ";", "}", "}", "if", "(", "i", "!=", "2", ")", "{", "StringBuffer", "stringbuffer1", "=", "new", "StringBuffer", "(", "stringbuffer", ".", "length", "(", ")", ")", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "stringbuffer", ".", "length", "(", ")", ";", "k", "++", ")", "{", "char", "c2", "=", "unicode2DOS437", "[", "stringbuffer", ".", "charAt", "(", "k", ")", "]", ";", "stringbuffer1", ".", "append", "(", "c2", "==", "0", "?", "c", ":", "c2", ")", ";", "}", "return", "new", "String", "(", "stringbuffer1", ")", ";", "}", "else", "{", "return", "new", "String", "(", "stringbuffer", ")", ";", "}", "}" ]
Char to DOS437 converter @param stringbuffer @param i @param c @return String
[ "Char", "to", "DOS437", "converter" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/Unicode.java#L293-L313
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/randomizers/range/OffsetDateTimeRangeRandomizer.java
OffsetDateTimeRangeRandomizer.aNewOffsetDateTimeRangeRandomizer
public static OffsetDateTimeRangeRandomizer aNewOffsetDateTimeRangeRandomizer(final OffsetDateTime min, final OffsetDateTime max, final long seed) { """ Create a new {@link OffsetDateTimeRangeRandomizer}. @param min min value @param max max value @param seed initial seed @return a new {@link OffsetDateTimeRangeRandomizer}. """ return new OffsetDateTimeRangeRandomizer(min, max, seed); }
java
public static OffsetDateTimeRangeRandomizer aNewOffsetDateTimeRangeRandomizer(final OffsetDateTime min, final OffsetDateTime max, final long seed) { return new OffsetDateTimeRangeRandomizer(min, max, seed); }
[ "public", "static", "OffsetDateTimeRangeRandomizer", "aNewOffsetDateTimeRangeRandomizer", "(", "final", "OffsetDateTime", "min", ",", "final", "OffsetDateTime", "max", ",", "final", "long", "seed", ")", "{", "return", "new", "OffsetDateTimeRangeRandomizer", "(", "min", ",", "max", ",", "seed", ")", ";", "}" ]
Create a new {@link OffsetDateTimeRangeRandomizer}. @param min min value @param max max value @param seed initial seed @return a new {@link OffsetDateTimeRangeRandomizer}.
[ "Create", "a", "new", "{", "@link", "OffsetDateTimeRangeRandomizer", "}", "." ]
train
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/range/OffsetDateTimeRangeRandomizer.java#L76-L78
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/TxConfidenceTable.java
TxConfidenceTable.seen
public TransactionConfidence seen(Sha256Hash hash, PeerAddress byPeer) { """ Called by peers when they see a transaction advertised in an "inv" message. It passes the data on to the relevant {@link TransactionConfidence} object, creating it if needed. @return the number of peers that have now announced this hash (including the caller) """ TransactionConfidence confidence; boolean fresh = false; lock.lock(); try { cleanTable(); confidence = getOrCreate(hash); fresh = confidence.markBroadcastBy(byPeer); } finally { lock.unlock(); } if (fresh) confidence.queueListeners(TransactionConfidence.Listener.ChangeReason.SEEN_PEERS); return confidence; }
java
public TransactionConfidence seen(Sha256Hash hash, PeerAddress byPeer) { TransactionConfidence confidence; boolean fresh = false; lock.lock(); try { cleanTable(); confidence = getOrCreate(hash); fresh = confidence.markBroadcastBy(byPeer); } finally { lock.unlock(); } if (fresh) confidence.queueListeners(TransactionConfidence.Listener.ChangeReason.SEEN_PEERS); return confidence; }
[ "public", "TransactionConfidence", "seen", "(", "Sha256Hash", "hash", ",", "PeerAddress", "byPeer", ")", "{", "TransactionConfidence", "confidence", ";", "boolean", "fresh", "=", "false", ";", "lock", ".", "lock", "(", ")", ";", "try", "{", "cleanTable", "(", ")", ";", "confidence", "=", "getOrCreate", "(", "hash", ")", ";", "fresh", "=", "confidence", ".", "markBroadcastBy", "(", "byPeer", ")", ";", "}", "finally", "{", "lock", ".", "unlock", "(", ")", ";", "}", "if", "(", "fresh", ")", "confidence", ".", "queueListeners", "(", "TransactionConfidence", ".", "Listener", ".", "ChangeReason", ".", "SEEN_PEERS", ")", ";", "return", "confidence", ";", "}" ]
Called by peers when they see a transaction advertised in an "inv" message. It passes the data on to the relevant {@link TransactionConfidence} object, creating it if needed. @return the number of peers that have now announced this hash (including the caller)
[ "Called", "by", "peers", "when", "they", "see", "a", "transaction", "advertised", "in", "an", "inv", "message", ".", "It", "passes", "the", "data", "on", "to", "the", "relevant", "{", "@link", "TransactionConfidence", "}", "object", "creating", "it", "if", "needed", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/TxConfidenceTable.java#L144-L158
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobVertex.java
JobVertex.setResources
public void setResources(ResourceSpec minResources, ResourceSpec preferredResources) { """ Sets the minimum and preferred resources for the task. @param minResources The minimum resource for the task. @param preferredResources The preferred resource for the task. """ this.minResources = checkNotNull(minResources); this.preferredResources = checkNotNull(preferredResources); }
java
public void setResources(ResourceSpec minResources, ResourceSpec preferredResources) { this.minResources = checkNotNull(minResources); this.preferredResources = checkNotNull(preferredResources); }
[ "public", "void", "setResources", "(", "ResourceSpec", "minResources", ",", "ResourceSpec", "preferredResources", ")", "{", "this", ".", "minResources", "=", "checkNotNull", "(", "minResources", ")", ";", "this", ".", "preferredResources", "=", "checkNotNull", "(", "preferredResources", ")", ";", "}" ]
Sets the minimum and preferred resources for the task. @param minResources The minimum resource for the task. @param preferredResources The preferred resource for the task.
[ "Sets", "the", "minimum", "and", "preferred", "resources", "for", "the", "task", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobVertex.java#L339-L342
jcuda/jcudnn
JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java
JCudnn.cudnnBatchNormalizationForwardTrainingEx
public static int cudnnBatchNormalizationForwardTrainingEx( cudnnHandle handle, int mode, int bnOps, Pointer alpha, /** alpha[0] = result blend factor */ Pointer beta, /** beta[0] = dest layer blend factor */ cudnnTensorDescriptor xDesc, Pointer xData, cudnnTensorDescriptor zDesc, Pointer zData, cudnnTensorDescriptor yDesc, Pointer yData, cudnnTensorDescriptor bnScaleBiasMeanVarDesc, Pointer bnScale, Pointer bnBias, double exponentialAverageFactor, Pointer resultRunningMean, Pointer resultRunningVariance, /** Has to be >= CUDNN_BN_MIN_EPSILON. Should be the same in forward and backward functions. */ double epsilon, /** Optionally save intermediate results from the forward pass here - can be reused to speed up backward pass. NULL if unused */ Pointer resultSaveMean, Pointer resultSaveInvVariance, cudnnActivationDescriptor activationDesc, Pointer workspace, long workSpaceSizeInBytes, Pointer reserveSpace, long reserveSpaceSizeInBytes) { """ Computes y = relu(BN(x) + z). Also accumulates moving averages of mean and inverse variances """ return checkResult(cudnnBatchNormalizationForwardTrainingExNative(handle, mode, bnOps, alpha, beta, xDesc, xData, zDesc, zData, yDesc, yData, bnScaleBiasMeanVarDesc, bnScale, bnBias, exponentialAverageFactor, resultRunningMean, resultRunningVariance, epsilon, resultSaveMean, resultSaveInvVariance, activationDesc, workspace, workSpaceSizeInBytes, reserveSpace, reserveSpaceSizeInBytes)); }
java
public static int cudnnBatchNormalizationForwardTrainingEx( cudnnHandle handle, int mode, int bnOps, Pointer alpha, /** alpha[0] = result blend factor */ Pointer beta, /** beta[0] = dest layer blend factor */ cudnnTensorDescriptor xDesc, Pointer xData, cudnnTensorDescriptor zDesc, Pointer zData, cudnnTensorDescriptor yDesc, Pointer yData, cudnnTensorDescriptor bnScaleBiasMeanVarDesc, Pointer bnScale, Pointer bnBias, double exponentialAverageFactor, Pointer resultRunningMean, Pointer resultRunningVariance, /** Has to be >= CUDNN_BN_MIN_EPSILON. Should be the same in forward and backward functions. */ double epsilon, /** Optionally save intermediate results from the forward pass here - can be reused to speed up backward pass. NULL if unused */ Pointer resultSaveMean, Pointer resultSaveInvVariance, cudnnActivationDescriptor activationDesc, Pointer workspace, long workSpaceSizeInBytes, Pointer reserveSpace, long reserveSpaceSizeInBytes) { return checkResult(cudnnBatchNormalizationForwardTrainingExNative(handle, mode, bnOps, alpha, beta, xDesc, xData, zDesc, zData, yDesc, yData, bnScaleBiasMeanVarDesc, bnScale, bnBias, exponentialAverageFactor, resultRunningMean, resultRunningVariance, epsilon, resultSaveMean, resultSaveInvVariance, activationDesc, workspace, workSpaceSizeInBytes, reserveSpace, reserveSpaceSizeInBytes)); }
[ "public", "static", "int", "cudnnBatchNormalizationForwardTrainingEx", "(", "cudnnHandle", "handle", ",", "int", "mode", ",", "int", "bnOps", ",", "Pointer", "alpha", ",", "/** alpha[0] = result blend factor */", "Pointer", "beta", ",", "/** beta[0] = dest layer blend factor */", "cudnnTensorDescriptor", "xDesc", ",", "Pointer", "xData", ",", "cudnnTensorDescriptor", "zDesc", ",", "Pointer", "zData", ",", "cudnnTensorDescriptor", "yDesc", ",", "Pointer", "yData", ",", "cudnnTensorDescriptor", "bnScaleBiasMeanVarDesc", ",", "Pointer", "bnScale", ",", "Pointer", "bnBias", ",", "double", "exponentialAverageFactor", ",", "Pointer", "resultRunningMean", ",", "Pointer", "resultRunningVariance", ",", "/** Has to be >= CUDNN_BN_MIN_EPSILON. Should be the same in forward and backward functions. */", "double", "epsilon", ",", "/** Optionally save intermediate results from the forward pass here\n - can be reused to speed up backward pass. NULL if unused */", "Pointer", "resultSaveMean", ",", "Pointer", "resultSaveInvVariance", ",", "cudnnActivationDescriptor", "activationDesc", ",", "Pointer", "workspace", ",", "long", "workSpaceSizeInBytes", ",", "Pointer", "reserveSpace", ",", "long", "reserveSpaceSizeInBytes", ")", "{", "return", "checkResult", "(", "cudnnBatchNormalizationForwardTrainingExNative", "(", "handle", ",", "mode", ",", "bnOps", ",", "alpha", ",", "beta", ",", "xDesc", ",", "xData", ",", "zDesc", ",", "zData", ",", "yDesc", ",", "yData", ",", "bnScaleBiasMeanVarDesc", ",", "bnScale", ",", "bnBias", ",", "exponentialAverageFactor", ",", "resultRunningMean", ",", "resultRunningVariance", ",", "epsilon", ",", "resultSaveMean", ",", "resultSaveInvVariance", ",", "activationDesc", ",", "workspace", ",", "workSpaceSizeInBytes", ",", "reserveSpace", ",", "reserveSpaceSizeInBytes", ")", ")", ";", "}" ]
Computes y = relu(BN(x) + z). Also accumulates moving averages of mean and inverse variances
[ "Computes", "y", "=", "relu", "(", "BN", "(", "x", ")", "+", "z", ")", ".", "Also", "accumulates", "moving", "averages", "of", "mean", "and", "inverse", "variances" ]
train
https://github.com/jcuda/jcudnn/blob/ce71f2fc02817cecace51a80e6db5f0c7f10cffc/JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java#L2378-L2409
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java
HttpFields.put
public void put(String name, List<String> list) { """ Set a field. @param name the name of the field @param list the List value of the field. If null the field is cleared. """ remove(name); for (String v : list) if (v != null) add(name, v); }
java
public void put(String name, List<String> list) { remove(name); for (String v : list) if (v != null) add(name, v); }
[ "public", "void", "put", "(", "String", "name", ",", "List", "<", "String", ">", "list", ")", "{", "remove", "(", "name", ")", ";", "for", "(", "String", "v", ":", "list", ")", "if", "(", "v", "!=", "null", ")", "add", "(", "name", ",", "v", ")", ";", "}" ]
Set a field. @param name the name of the field @param list the List value of the field. If null the field is cleared.
[ "Set", "a", "field", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java#L532-L537
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsInner.java
ServerAdvisorsInner.updateAsync
public Observable<AdvisorInner> updateAsync(String resourceGroupName, String serverName, String advisorName, AutoExecuteStatus autoExecuteStatus) { """ Updates a server advisor. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param advisorName The name of the Server Advisor. @param autoExecuteStatus Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AdvisorInner object """ return updateWithServiceResponseAsync(resourceGroupName, serverName, advisorName, autoExecuteStatus).map(new Func1<ServiceResponse<AdvisorInner>, AdvisorInner>() { @Override public AdvisorInner call(ServiceResponse<AdvisorInner> response) { return response.body(); } }); }
java
public Observable<AdvisorInner> updateAsync(String resourceGroupName, String serverName, String advisorName, AutoExecuteStatus autoExecuteStatus) { return updateWithServiceResponseAsync(resourceGroupName, serverName, advisorName, autoExecuteStatus).map(new Func1<ServiceResponse<AdvisorInner>, AdvisorInner>() { @Override public AdvisorInner call(ServiceResponse<AdvisorInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AdvisorInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "advisorName", ",", "AutoExecuteStatus", "autoExecuteStatus", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "advisorName", ",", "autoExecuteStatus", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "AdvisorInner", ">", ",", "AdvisorInner", ">", "(", ")", "{", "@", "Override", "public", "AdvisorInner", "call", "(", "ServiceResponse", "<", "AdvisorInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Updates a server advisor. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param advisorName The name of the Server Advisor. @param autoExecuteStatus Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AdvisorInner object
[ "Updates", "a", "server", "advisor", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsInner.java#L292-L299
Harium/keel
src/main/java/com/harium/keel/catalano/core/FloatPoint.java
FloatPoint.Divide
public FloatPoint Divide(FloatPoint point1, FloatPoint point2) { """ Divide values of two points. @param point1 FloatPoint. @param point2 FloatPoint. @return A new FloatPoint with the division operation. """ FloatPoint result = new FloatPoint(point1); result.Divide(point2); return result; }
java
public FloatPoint Divide(FloatPoint point1, FloatPoint point2) { FloatPoint result = new FloatPoint(point1); result.Divide(point2); return result; }
[ "public", "FloatPoint", "Divide", "(", "FloatPoint", "point1", ",", "FloatPoint", "point2", ")", "{", "FloatPoint", "result", "=", "new", "FloatPoint", "(", "point1", ")", ";", "result", ".", "Divide", "(", "point2", ")", ";", "return", "result", ";", "}" ]
Divide values of two points. @param point1 FloatPoint. @param point2 FloatPoint. @return A new FloatPoint with the division operation.
[ "Divide", "values", "of", "two", "points", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/FloatPoint.java#L236-L240
UrielCh/ovh-java-sdk
ovh-java-sdk-veeamveeamEnterprise/src/main/java/net/minidev/ovh/api/ApiOvhVeeamveeamEnterprise.java
ApiOvhVeeamveeamEnterprise.serviceName_update_POST
public ArrayList<OvhTask> serviceName_update_POST(String serviceName, String ip, String password, Long port, String username) throws IOException { """ Update Veeam enterprise configuration REST: POST /veeam/veeamEnterprise/{serviceName}/update @param port [required] Your Veeam Backup And Replication Server Port @param ip [required] Your Veeam Backup And Replication Server IP @param password [required] Your Veeam Backup And Replication associated password @param username [required] Your Veeam Backup And Replication username @param serviceName [required] Domain of the service API beta """ String qPath = "/veeam/veeamEnterprise/{serviceName}/update"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ip", ip); addBody(o, "password", password); addBody(o, "port", port); addBody(o, "username", username); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t1); }
java
public ArrayList<OvhTask> serviceName_update_POST(String serviceName, String ip, String password, Long port, String username) throws IOException { String qPath = "/veeam/veeamEnterprise/{serviceName}/update"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ip", ip); addBody(o, "password", password); addBody(o, "port", port); addBody(o, "username", username); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "OvhTask", ">", "serviceName_update_POST", "(", "String", "serviceName", ",", "String", "ip", ",", "String", "password", ",", "Long", "port", ",", "String", "username", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/veeam/veeamEnterprise/{serviceName}/update\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"ip\"", ",", "ip", ")", ";", "addBody", "(", "o", ",", "\"password\"", ",", "password", ")", ";", "addBody", "(", "o", ",", "\"port\"", ",", "port", ")", ";", "addBody", "(", "o", ",", "\"username\"", ",", "username", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "t1", ")", ";", "}" ]
Update Veeam enterprise configuration REST: POST /veeam/veeamEnterprise/{serviceName}/update @param port [required] Your Veeam Backup And Replication Server Port @param ip [required] Your Veeam Backup And Replication Server IP @param password [required] Your Veeam Backup And Replication associated password @param username [required] Your Veeam Backup And Replication username @param serviceName [required] Domain of the service API beta
[ "Update", "Veeam", "enterprise", "configuration" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-veeamveeamEnterprise/src/main/java/net/minidev/ovh/api/ApiOvhVeeamveeamEnterprise.java#L117-L127
apache/reef
lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/evaluator/REEFExecutor.java
REEFExecutor.launchTask
@Override public void launchTask(final ExecutorDriver driver, final TaskInfo task) { """ We assume a long-running Mesos Task that manages a REEF Evaluator process, leveraging Mesos Executor's interface. """ driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(TaskID.newBuilder().setValue(this.mesosExecutorId).build()) .setState(TaskState.TASK_STARTING) .setSlaveId(task.getSlaveId()) .setMessage(this.mesosRemoteManager.getMyIdentifier()) .build()); }
java
@Override public void launchTask(final ExecutorDriver driver, final TaskInfo task) { driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(TaskID.newBuilder().setValue(this.mesosExecutorId).build()) .setState(TaskState.TASK_STARTING) .setSlaveId(task.getSlaveId()) .setMessage(this.mesosRemoteManager.getMyIdentifier()) .build()); }
[ "@", "Override", "public", "void", "launchTask", "(", "final", "ExecutorDriver", "driver", ",", "final", "TaskInfo", "task", ")", "{", "driver", ".", "sendStatusUpdate", "(", "TaskStatus", ".", "newBuilder", "(", ")", ".", "setTaskId", "(", "TaskID", ".", "newBuilder", "(", ")", ".", "setValue", "(", "this", ".", "mesosExecutorId", ")", ".", "build", "(", ")", ")", ".", "setState", "(", "TaskState", ".", "TASK_STARTING", ")", ".", "setSlaveId", "(", "task", ".", "getSlaveId", "(", ")", ")", ".", "setMessage", "(", "this", ".", "mesosRemoteManager", ".", "getMyIdentifier", "(", ")", ")", ".", "build", "(", ")", ")", ";", "}" ]
We assume a long-running Mesos Task that manages a REEF Evaluator process, leveraging Mesos Executor's interface.
[ "We", "assume", "a", "long", "-", "running", "Mesos", "Task", "that", "manages", "a", "REEF", "Evaluator", "process", "leveraging", "Mesos", "Executor", "s", "interface", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/evaluator/REEFExecutor.java#L109-L117
Azure/azure-sdk-for-java
locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java
ManagementLocksInner.listAtResourceLevelWithServiceResponseAsync
public Observable<ServiceResponse<Page<ManagementLockObjectInner>>> listAtResourceLevelWithServiceResponseAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { """ Gets all the management locks for a resource or any level below resource. @param resourceGroupName The name of the resource group containing the locked resource. The name is case insensitive. @param resourceProviderNamespace The namespace of the resource provider. @param parentResourcePath The parent resource identity. @param resourceType The resource type of the locked resource. @param resourceName The name of the locked resource. @param filter The filter to apply on the operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ManagementLockObjectInner&gt; object """ return listAtResourceLevelSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) .concatMap(new Func1<ServiceResponse<Page<ManagementLockObjectInner>>, Observable<ServiceResponse<Page<ManagementLockObjectInner>>>>() { @Override public Observable<ServiceResponse<Page<ManagementLockObjectInner>>> call(ServiceResponse<Page<ManagementLockObjectInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listAtResourceLevelNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<ManagementLockObjectInner>>> listAtResourceLevelWithServiceResponseAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { return listAtResourceLevelSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) .concatMap(new Func1<ServiceResponse<Page<ManagementLockObjectInner>>, Observable<ServiceResponse<Page<ManagementLockObjectInner>>>>() { @Override public Observable<ServiceResponse<Page<ManagementLockObjectInner>>> call(ServiceResponse<Page<ManagementLockObjectInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listAtResourceLevelNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ManagementLockObjectInner", ">", ">", ">", "listAtResourceLevelWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "resourceProviderNamespace", ",", "final", "String", "parentResourcePath", ",", "final", "String", "resourceType", ",", "final", "String", "resourceName", ",", "final", "String", "filter", ")", "{", "return", "listAtResourceLevelSinglePageAsync", "(", "resourceGroupName", ",", "resourceProviderNamespace", ",", "parentResourcePath", ",", "resourceType", ",", "resourceName", ",", "filter", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "ManagementLockObjectInner", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ManagementLockObjectInner", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ManagementLockObjectInner", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "ManagementLockObjectInner", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listAtResourceLevelNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
Gets all the management locks for a resource or any level below resource. @param resourceGroupName The name of the resource group containing the locked resource. The name is case insensitive. @param resourceProviderNamespace The namespace of the resource provider. @param parentResourcePath The parent resource identity. @param resourceType The resource type of the locked resource. @param resourceName The name of the locked resource. @param filter The filter to apply on the operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ManagementLockObjectInner&gt; object
[ "Gets", "all", "the", "management", "locks", "for", "a", "resource", "or", "any", "level", "below", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java#L1739-L1751
quattor/pan
panc/src/main/java/org/quattor/pan/dml/DML.java
DML.getUnoptimizedInstance
public static DML getUnoptimizedInstance(SourceRange sourceRange, Operation... operations) { """ Factory method to create a new DML block, although this may return another Operation because of optimization. @param sourceRange location of this block in the source file @param operations the operations that make up this block @return optimized Operation representing DML block """ // Build a duplicate list to "flatten" the DML block. List<Operation> list = new LinkedList<Operation>(); // Inline operations from referenced DML blocks. for (Operation op : operations) { if (op instanceof DML) { DML dml = (DML) op; for (Operation dmlOp : dml.ops) { list.add(dmlOp); } } else { list.add(op); } } Operation[] dmlOps = list.toArray(new Operation[list.size()]); return new DML(sourceRange, dmlOps); }
java
public static DML getUnoptimizedInstance(SourceRange sourceRange, Operation... operations) { // Build a duplicate list to "flatten" the DML block. List<Operation> list = new LinkedList<Operation>(); // Inline operations from referenced DML blocks. for (Operation op : operations) { if (op instanceof DML) { DML dml = (DML) op; for (Operation dmlOp : dml.ops) { list.add(dmlOp); } } else { list.add(op); } } Operation[] dmlOps = list.toArray(new Operation[list.size()]); return new DML(sourceRange, dmlOps); }
[ "public", "static", "DML", "getUnoptimizedInstance", "(", "SourceRange", "sourceRange", ",", "Operation", "...", "operations", ")", "{", "// Build a duplicate list to \"flatten\" the DML block.", "List", "<", "Operation", ">", "list", "=", "new", "LinkedList", "<", "Operation", ">", "(", ")", ";", "// Inline operations from referenced DML blocks.", "for", "(", "Operation", "op", ":", "operations", ")", "{", "if", "(", "op", "instanceof", "DML", ")", "{", "DML", "dml", "=", "(", "DML", ")", "op", ";", "for", "(", "Operation", "dmlOp", ":", "dml", ".", "ops", ")", "{", "list", ".", "add", "(", "dmlOp", ")", ";", "}", "}", "else", "{", "list", ".", "add", "(", "op", ")", ";", "}", "}", "Operation", "[", "]", "dmlOps", "=", "list", ".", "toArray", "(", "new", "Operation", "[", "list", ".", "size", "(", ")", "]", ")", ";", "return", "new", "DML", "(", "sourceRange", ",", "dmlOps", ")", ";", "}" ]
Factory method to create a new DML block, although this may return another Operation because of optimization. @param sourceRange location of this block in the source file @param operations the operations that make up this block @return optimized Operation representing DML block
[ "Factory", "method", "to", "create", "a", "new", "DML", "block", "although", "this", "may", "return", "another", "Operation", "because", "of", "optimization", "." ]
train
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/DML.java#L88-L108
xebia/Xebium
src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java
SeleniumDriverFixture.startBrowserOnUrl
public void startBrowserOnUrl(final String browser, final String browserUrl) { """ <p><code> | start browser | <i>firefox</i> | on url | <i>http://localhost</i> | </code></p> @param browser @param browserUrl """ setBrowser(browser); startDriverOnUrl(defaultWebDriverInstance(), browserUrl); }
java
public void startBrowserOnUrl(final String browser, final String browserUrl) { setBrowser(browser); startDriverOnUrl(defaultWebDriverInstance(), browserUrl); }
[ "public", "void", "startBrowserOnUrl", "(", "final", "String", "browser", ",", "final", "String", "browserUrl", ")", "{", "setBrowser", "(", "browser", ")", ";", "startDriverOnUrl", "(", "defaultWebDriverInstance", "(", ")", ",", "browserUrl", ")", ";", "}" ]
<p><code> | start browser | <i>firefox</i> | on url | <i>http://localhost</i> | </code></p> @param browser @param browserUrl
[ "<p", ">", "<code", ">", "|", "start", "browser", "|", "<i", ">", "firefox<", "/", "i", ">", "|", "on", "url", "|", "<i", ">", "http", ":", "//", "localhost<", "/", "i", ">", "|", "<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/xebia/Xebium/blob/594f6d9e65622acdbd03dba0700b17645981da1f/src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java#L182-L185
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java
PrivacyListManager.getActiveList
public PrivacyList getActiveList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { """ Answer the active privacy list. Returns <code>null</code> if there is no active list. @return the privacy list of the active list. @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException """ Privacy privacyAnswer = this.getPrivacyWithListNames(); String listName = privacyAnswer.getActiveName(); if (StringUtils.isNullOrEmpty(listName)) { return null; } boolean isDefaultAndActive = listName != null && listName.equals(privacyAnswer.getDefaultName()); return new PrivacyList(true, isDefaultAndActive, listName, getPrivacyListItems(listName)); }
java
public PrivacyList getActiveList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { Privacy privacyAnswer = this.getPrivacyWithListNames(); String listName = privacyAnswer.getActiveName(); if (StringUtils.isNullOrEmpty(listName)) { return null; } boolean isDefaultAndActive = listName != null && listName.equals(privacyAnswer.getDefaultName()); return new PrivacyList(true, isDefaultAndActive, listName, getPrivacyListItems(listName)); }
[ "public", "PrivacyList", "getActiveList", "(", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "Privacy", "privacyAnswer", "=", "this", ".", "getPrivacyWithListNames", "(", ")", ";", "String", "listName", "=", "privacyAnswer", ".", "getActiveName", "(", ")", ";", "if", "(", "StringUtils", ".", "isNullOrEmpty", "(", "listName", ")", ")", "{", "return", "null", ";", "}", "boolean", "isDefaultAndActive", "=", "listName", "!=", "null", "&&", "listName", ".", "equals", "(", "privacyAnswer", ".", "getDefaultName", "(", ")", ")", ";", "return", "new", "PrivacyList", "(", "true", ",", "isDefaultAndActive", ",", "listName", ",", "getPrivacyListItems", "(", "listName", ")", ")", ";", "}" ]
Answer the active privacy list. Returns <code>null</code> if there is no active list. @return the privacy list of the active list. @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Answer", "the", "active", "privacy", "list", ".", "Returns", "<code", ">", "null<", "/", "code", ">", "if", "there", "is", "no", "active", "list", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L284-L292
Metatavu/edelphi
edelphi-persistence/src/main/java/fi/metatavu/edelphi/dao/panels/PanelUserDAO.java
PanelUserDAO.countByPanelStateUserAndRole
public Long countByPanelStateUserAndRole(User user, DelfoiAction action, PanelState state) { """ Returns count of panels in specific state where user has permission to perform specific action @param user user @param action action @param state panel state @return count of panels in specific state where user has permission to perform specific action """ EntityManager entityManager = getEntityManager(); CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaQuery<Long> criteria = criteriaBuilder.createQuery(Long.class); Root<PanelUser> panelUserRoot = criteria.from(PanelUser.class); Root<PanelUserRoleAction> roleActionRoot = criteria.from(PanelUserRoleAction.class); Join<PanelUser, Panel> panelJoin = panelUserRoot.join(PanelUser_.panel); criteria.select(criteriaBuilder.countDistinct(panelJoin)); criteria.where( criteriaBuilder.and( criteriaBuilder.equal(panelJoin, roleActionRoot.get(PanelUserRoleAction_.panel)), criteriaBuilder.equal(roleActionRoot.get(PanelUserRoleAction_.delfoiAction), action), criteriaBuilder.equal(panelUserRoot.get(PanelUser_.role), roleActionRoot.get(PanelUserRoleAction_.userRole)), criteriaBuilder.equal(panelJoin.get(Panel_.state), state), criteriaBuilder.equal(panelUserRoot.get(PanelUser_.user), user), criteriaBuilder.equal(panelUserRoot.get(PanelUser_.archived), Boolean.FALSE), criteriaBuilder.equal(panelJoin.get(Panel_.archived), Boolean.FALSE) ) ); return entityManager.createQuery(criteria).getSingleResult(); }
java
public Long countByPanelStateUserAndRole(User user, DelfoiAction action, PanelState state) { EntityManager entityManager = getEntityManager(); CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaQuery<Long> criteria = criteriaBuilder.createQuery(Long.class); Root<PanelUser> panelUserRoot = criteria.from(PanelUser.class); Root<PanelUserRoleAction> roleActionRoot = criteria.from(PanelUserRoleAction.class); Join<PanelUser, Panel> panelJoin = panelUserRoot.join(PanelUser_.panel); criteria.select(criteriaBuilder.countDistinct(panelJoin)); criteria.where( criteriaBuilder.and( criteriaBuilder.equal(panelJoin, roleActionRoot.get(PanelUserRoleAction_.panel)), criteriaBuilder.equal(roleActionRoot.get(PanelUserRoleAction_.delfoiAction), action), criteriaBuilder.equal(panelUserRoot.get(PanelUser_.role), roleActionRoot.get(PanelUserRoleAction_.userRole)), criteriaBuilder.equal(panelJoin.get(Panel_.state), state), criteriaBuilder.equal(panelUserRoot.get(PanelUser_.user), user), criteriaBuilder.equal(panelUserRoot.get(PanelUser_.archived), Boolean.FALSE), criteriaBuilder.equal(panelJoin.get(Panel_.archived), Boolean.FALSE) ) ); return entityManager.createQuery(criteria).getSingleResult(); }
[ "public", "Long", "countByPanelStateUserAndRole", "(", "User", "user", ",", "DelfoiAction", "action", ",", "PanelState", "state", ")", "{", "EntityManager", "entityManager", "=", "getEntityManager", "(", ")", ";", "CriteriaBuilder", "criteriaBuilder", "=", "entityManager", ".", "getCriteriaBuilder", "(", ")", ";", "CriteriaQuery", "<", "Long", ">", "criteria", "=", "criteriaBuilder", ".", "createQuery", "(", "Long", ".", "class", ")", ";", "Root", "<", "PanelUser", ">", "panelUserRoot", "=", "criteria", ".", "from", "(", "PanelUser", ".", "class", ")", ";", "Root", "<", "PanelUserRoleAction", ">", "roleActionRoot", "=", "criteria", ".", "from", "(", "PanelUserRoleAction", ".", "class", ")", ";", "Join", "<", "PanelUser", ",", "Panel", ">", "panelJoin", "=", "panelUserRoot", ".", "join", "(", "PanelUser_", ".", "panel", ")", ";", "criteria", ".", "select", "(", "criteriaBuilder", ".", "countDistinct", "(", "panelJoin", ")", ")", ";", "criteria", ".", "where", "(", "criteriaBuilder", ".", "and", "(", "criteriaBuilder", ".", "equal", "(", "panelJoin", ",", "roleActionRoot", ".", "get", "(", "PanelUserRoleAction_", ".", "panel", ")", ")", ",", "criteriaBuilder", ".", "equal", "(", "roleActionRoot", ".", "get", "(", "PanelUserRoleAction_", ".", "delfoiAction", ")", ",", "action", ")", ",", "criteriaBuilder", ".", "equal", "(", "panelUserRoot", ".", "get", "(", "PanelUser_", ".", "role", ")", ",", "roleActionRoot", ".", "get", "(", "PanelUserRoleAction_", ".", "userRole", ")", ")", ",", "criteriaBuilder", ".", "equal", "(", "panelJoin", ".", "get", "(", "Panel_", ".", "state", ")", ",", "state", ")", ",", "criteriaBuilder", ".", "equal", "(", "panelUserRoot", ".", "get", "(", "PanelUser_", ".", "user", ")", ",", "user", ")", ",", "criteriaBuilder", ".", "equal", "(", "panelUserRoot", ".", "get", "(", "PanelUser_", ".", "archived", ")", ",", "Boolean", ".", "FALSE", ")", ",", "criteriaBuilder", ".", "equal", "(", "panelJoin", ".", "get", "(", "Panel_", ".", "archived", ")", ",", "Boolean", ".", "FALSE", ")", ")", ")", ";", "return", "entityManager", ".", "createQuery", "(", "criteria", ")", ".", "getSingleResult", "(", ")", ";", "}" ]
Returns count of panels in specific state where user has permission to perform specific action @param user user @param action action @param state panel state @return count of panels in specific state where user has permission to perform specific action
[ "Returns", "count", "of", "panels", "in", "specific", "state", "where", "user", "has", "permission", "to", "perform", "specific", "action" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi-persistence/src/main/java/fi/metatavu/edelphi/dao/panels/PanelUserDAO.java#L260-L284
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java
DateFunctions.datePartMillis
public static Expression datePartMillis(String expression, DatePartExt part) { """ Returned expression results in Date part as an integer. The date expression is a number representing UNIX milliseconds, and part is a {@link DatePartExt}. """ return datePartMillis(x(expression), part); }
java
public static Expression datePartMillis(String expression, DatePartExt part) { return datePartMillis(x(expression), part); }
[ "public", "static", "Expression", "datePartMillis", "(", "String", "expression", ",", "DatePartExt", "part", ")", "{", "return", "datePartMillis", "(", "x", "(", "expression", ")", ",", "part", ")", ";", "}" ]
Returned expression results in Date part as an integer. The date expression is a number representing UNIX milliseconds, and part is a {@link DatePartExt}.
[ "Returned", "expression", "results", "in", "Date", "part", "as", "an", "integer", ".", "The", "date", "expression", "is", "a", "number", "representing", "UNIX", "milliseconds", "and", "part", "is", "a", "{" ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L148-L150
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java
TableSession.remove
public void remove(Object data, int iOpenMode) throws DBException, RemoteException { """ Delete the current record. @param data This is a dummy param, because this call conflicts with a call in EJBHome. @exception DBException File exception. """ Record record = this.getMainRecord(); int iOldOpenMode = record.getOpenMode(); try { Utility.getLogger().info("EJB Remove"); synchronized (this.getTask()) { record.setOpenMode((iOldOpenMode & ~DBConstants.LOCK_TYPE_MASK) | (iOpenMode & DBConstants.LOCK_TYPE_MASK)); // Use client's lock data if (record.getEditMode() == Constants.EDIT_CURRENT) record.edit(); if (DBConstants.TRUE.equals(record.getTable().getProperty(DBParams.SUPRESSREMOTEDBMESSAGES))) record.setSupressRemoteMessages(true); record.remove(); } } catch (DBException ex) { throw ex; } catch (Exception ex) { ex.printStackTrace(); throw new DBException(ex.getMessage()); } finally { record.setSupressRemoteMessages(false); this.getMainRecord().setOpenMode(iOldOpenMode); } }
java
public void remove(Object data, int iOpenMode) throws DBException, RemoteException { Record record = this.getMainRecord(); int iOldOpenMode = record.getOpenMode(); try { Utility.getLogger().info("EJB Remove"); synchronized (this.getTask()) { record.setOpenMode((iOldOpenMode & ~DBConstants.LOCK_TYPE_MASK) | (iOpenMode & DBConstants.LOCK_TYPE_MASK)); // Use client's lock data if (record.getEditMode() == Constants.EDIT_CURRENT) record.edit(); if (DBConstants.TRUE.equals(record.getTable().getProperty(DBParams.SUPRESSREMOTEDBMESSAGES))) record.setSupressRemoteMessages(true); record.remove(); } } catch (DBException ex) { throw ex; } catch (Exception ex) { ex.printStackTrace(); throw new DBException(ex.getMessage()); } finally { record.setSupressRemoteMessages(false); this.getMainRecord().setOpenMode(iOldOpenMode); } }
[ "public", "void", "remove", "(", "Object", "data", ",", "int", "iOpenMode", ")", "throws", "DBException", ",", "RemoteException", "{", "Record", "record", "=", "this", ".", "getMainRecord", "(", ")", ";", "int", "iOldOpenMode", "=", "record", ".", "getOpenMode", "(", ")", ";", "try", "{", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"EJB Remove\"", ")", ";", "synchronized", "(", "this", ".", "getTask", "(", ")", ")", "{", "record", ".", "setOpenMode", "(", "(", "iOldOpenMode", "&", "~", "DBConstants", ".", "LOCK_TYPE_MASK", ")", "|", "(", "iOpenMode", "&", "DBConstants", ".", "LOCK_TYPE_MASK", ")", ")", ";", "// Use client's lock data", "if", "(", "record", ".", "getEditMode", "(", ")", "==", "Constants", ".", "EDIT_CURRENT", ")", "record", ".", "edit", "(", ")", ";", "if", "(", "DBConstants", ".", "TRUE", ".", "equals", "(", "record", ".", "getTable", "(", ")", ".", "getProperty", "(", "DBParams", ".", "SUPRESSREMOTEDBMESSAGES", ")", ")", ")", "record", ".", "setSupressRemoteMessages", "(", "true", ")", ";", "record", ".", "remove", "(", ")", ";", "}", "}", "catch", "(", "DBException", "ex", ")", "{", "throw", "ex", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "throw", "new", "DBException", "(", "ex", ".", "getMessage", "(", ")", ")", ";", "}", "finally", "{", "record", ".", "setSupressRemoteMessages", "(", "false", ")", ";", "this", ".", "getMainRecord", "(", ")", ".", "setOpenMode", "(", "iOldOpenMode", ")", ";", "}", "}" ]
Delete the current record. @param data This is a dummy param, because this call conflicts with a call in EJBHome. @exception DBException File exception.
[ "Delete", "the", "current", "record", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java#L389-L413
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainsInner.java
DomainsInner.renewAsync
public Observable<Void> renewAsync(String resourceGroupName, String domainName) { """ Renew a domain. Renew a domain. @param resourceGroupName Name of the resource group to which the resource belongs. @param domainName Name of the domain. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return renewWithServiceResponseAsync(resourceGroupName, domainName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> renewAsync(String resourceGroupName, String domainName) { return renewWithServiceResponseAsync(resourceGroupName, domainName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "renewAsync", "(", "String", "resourceGroupName", ",", "String", "domainName", ")", "{", "return", "renewWithServiceResponseAsync", "(", "resourceGroupName", ",", "domainName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Renew a domain. Renew a domain. @param resourceGroupName Name of the resource group to which the resource belongs. @param domainName Name of the domain. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Renew", "a", "domain", ".", "Renew", "a", "domain", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainsInner.java#L1852-L1859
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScriptAddRepoPlugin.java
GroovyScriptAddRepoPlugin.getWorkingRepositoryName
private String getWorkingRepositoryName(PropertiesParam props) { """ Get working repository name. Returns the repository name from configuration if it previously configured and returns the name of current repository in other case. @props PropertiesParam the properties parameters @return String repository name @throws RepositoryException """ if (props.getProperty("repository") == null) { try { return repositoryService.getCurrentRepository().getConfiguration().getName(); } catch (RepositoryException e) { throw new RuntimeException("Can not get current repository and repository name was not configured", e); } } else { return props.getProperty("repository"); } }
java
private String getWorkingRepositoryName(PropertiesParam props) { if (props.getProperty("repository") == null) { try { return repositoryService.getCurrentRepository().getConfiguration().getName(); } catch (RepositoryException e) { throw new RuntimeException("Can not get current repository and repository name was not configured", e); } } else { return props.getProperty("repository"); } }
[ "private", "String", "getWorkingRepositoryName", "(", "PropertiesParam", "props", ")", "{", "if", "(", "props", ".", "getProperty", "(", "\"repository\"", ")", "==", "null", ")", "{", "try", "{", "return", "repositoryService", ".", "getCurrentRepository", "(", ")", ".", "getConfiguration", "(", ")", ".", "getName", "(", ")", ";", "}", "catch", "(", "RepositoryException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Can not get current repository and repository name was not configured\"", ",", "e", ")", ";", "}", "}", "else", "{", "return", "props", ".", "getProperty", "(", "\"repository\"", ")", ";", "}", "}" ]
Get working repository name. Returns the repository name from configuration if it previously configured and returns the name of current repository in other case. @props PropertiesParam the properties parameters @return String repository name @throws RepositoryException
[ "Get", "working", "repository", "name", ".", "Returns", "the", "repository", "name", "from", "configuration", "if", "it", "previously", "configured", "and", "returns", "the", "name", "of", "current", "repository", "in", "other", "case", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScriptAddRepoPlugin.java#L107-L125
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java
DatabaseUtils.queryIsEmpty
public static boolean queryIsEmpty(SQLiteDatabase db, String table) { """ Query the table to check whether a table is empty or not @param db the database the table is in @param table the name of the table to query @return True if the table is empty @hide """ long isEmpty = longForQuery(db, "select exists(select 1 from " + table + ")", null); return isEmpty == 0; }
java
public static boolean queryIsEmpty(SQLiteDatabase db, String table) { long isEmpty = longForQuery(db, "select exists(select 1 from " + table + ")", null); return isEmpty == 0; }
[ "public", "static", "boolean", "queryIsEmpty", "(", "SQLiteDatabase", "db", ",", "String", "table", ")", "{", "long", "isEmpty", "=", "longForQuery", "(", "db", ",", "\"select exists(select 1 from \"", "+", "table", "+", "\")\"", ",", "null", ")", ";", "return", "isEmpty", "==", "0", ";", "}" ]
Query the table to check whether a table is empty or not @param db the database the table is in @param table the name of the table to query @return True if the table is empty @hide
[ "Query", "the", "table", "to", "check", "whether", "a", "table", "is", "empty", "or", "not" ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L823-L826
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java
BoxApiMetadata.getDeleteFolderMetadataTemplateRequest
public BoxRequestsMetadata.DeleteItemMetadata getDeleteFolderMetadataTemplateRequest(String id, String template) { """ Gets a request that deletes the metadata for a specific template on a folder @param id id of the folder to retrieve metadata for @param template metadata template to use @return request to delete metadata on a folder """ BoxRequestsMetadata.DeleteItemMetadata request = new BoxRequestsMetadata.DeleteItemMetadata(getFolderMetadataUrl(id, template), mSession); return request; }
java
public BoxRequestsMetadata.DeleteItemMetadata getDeleteFolderMetadataTemplateRequest(String id, String template) { BoxRequestsMetadata.DeleteItemMetadata request = new BoxRequestsMetadata.DeleteItemMetadata(getFolderMetadataUrl(id, template), mSession); return request; }
[ "public", "BoxRequestsMetadata", ".", "DeleteItemMetadata", "getDeleteFolderMetadataTemplateRequest", "(", "String", "id", ",", "String", "template", ")", "{", "BoxRequestsMetadata", ".", "DeleteItemMetadata", "request", "=", "new", "BoxRequestsMetadata", ".", "DeleteItemMetadata", "(", "getFolderMetadataUrl", "(", "id", ",", "template", ")", ",", "mSession", ")", ";", "return", "request", ";", "}" ]
Gets a request that deletes the metadata for a specific template on a folder @param id id of the folder to retrieve metadata for @param template metadata template to use @return request to delete metadata on a folder
[ "Gets", "a", "request", "that", "deletes", "the", "metadata", "for", "a", "specific", "template", "on", "a", "folder" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java#L277-L280
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.deleteImageTags
public void deleteImageTags(UUID projectId, List<String> imageIds, List<String> tagIds) { """ Remove a set of tags from a set of images. @param projectId The project id @param imageIds Image ids. Limited to 64 images @param tagIds Tags to be deleted from the specified images. Limted to 20 tags @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 """ deleteImageTagsWithServiceResponseAsync(projectId, imageIds, tagIds).toBlocking().single().body(); }
java
public void deleteImageTags(UUID projectId, List<String> imageIds, List<String> tagIds) { deleteImageTagsWithServiceResponseAsync(projectId, imageIds, tagIds).toBlocking().single().body(); }
[ "public", "void", "deleteImageTags", "(", "UUID", "projectId", ",", "List", "<", "String", ">", "imageIds", ",", "List", "<", "String", ">", "tagIds", ")", "{", "deleteImageTagsWithServiceResponseAsync", "(", "projectId", ",", "imageIds", ",", "tagIds", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Remove a set of tags from a set of images. @param projectId The project id @param imageIds Image ids. Limited to 64 images @param tagIds Tags to be deleted from the specified images. Limted to 20 tags @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
[ "Remove", "a", "set", "of", "tags", "from", "a", "set", "of", "images", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3505-L3507
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfContentByte.java
PdfContentByte.createGraphicsShapes
public java.awt.Graphics2D createGraphicsShapes(float width, float height, boolean convertImagesToJPEG, float quality) { """ Gets a <CODE>Graphics2D</CODE> to print on. The graphics are translated to PDF commands. @param width @param height @param convertImagesToJPEG @param quality @return A Graphics2D object """ return new PdfGraphics2D(this, width, height, null, true, convertImagesToJPEG, quality); }
java
public java.awt.Graphics2D createGraphicsShapes(float width, float height, boolean convertImagesToJPEG, float quality) { return new PdfGraphics2D(this, width, height, null, true, convertImagesToJPEG, quality); }
[ "public", "java", ".", "awt", ".", "Graphics2D", "createGraphicsShapes", "(", "float", "width", ",", "float", "height", ",", "boolean", "convertImagesToJPEG", ",", "float", "quality", ")", "{", "return", "new", "PdfGraphics2D", "(", "this", ",", "width", ",", "height", ",", "null", ",", "true", ",", "convertImagesToJPEG", ",", "quality", ")", ";", "}" ]
Gets a <CODE>Graphics2D</CODE> to print on. The graphics are translated to PDF commands. @param width @param height @param convertImagesToJPEG @param quality @return A Graphics2D object
[ "Gets", "a", "<CODE", ">", "Graphics2D<", "/", "CODE", ">", "to", "print", "on", ".", "The", "graphics", "are", "translated", "to", "PDF", "commands", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L2860-L2862
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/RC4.java
RC4.encrypt
public byte[] encrypt(String message, Charset charset) throws CryptoException { """ 加密 @param message 消息 @param charset 编码 @return 密文 @throws CryptoException key长度小于5或者大于255抛出此异常 """ return crypt(StrUtil.bytes(message, charset)); }
java
public byte[] encrypt(String message, Charset charset) throws CryptoException { return crypt(StrUtil.bytes(message, charset)); }
[ "public", "byte", "[", "]", "encrypt", "(", "String", "message", ",", "Charset", "charset", ")", "throws", "CryptoException", "{", "return", "crypt", "(", "StrUtil", ".", "bytes", "(", "message", ",", "charset", ")", ")", ";", "}" ]
加密 @param message 消息 @param charset 编码 @return 密文 @throws CryptoException key长度小于5或者大于255抛出此异常
[ "加密" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/RC4.java#L49-L51
chanjarster/weixin-java-tools
weixin-java-common/src/main/java/me/chanjar/weixin/common/util/crypto/WxCryptUtil.java
WxCryptUtil.decrypt
public String decrypt(String msgSignature, String timeStamp, String nonce, String encryptedXml) { """ 检验消息的真实性,并且获取解密后的明文. <ol> <li>利用收到的密文生成安全签名,进行签名验证</li> <li>若验证通过,则提取xml中的加密消息</li> <li>对消息进行解密</li> </ol> @param msgSignature 签名串,对应URL参数的msg_signature @param timeStamp 时间戳,对应URL参数的timestamp @param nonce 随机串,对应URL参数的nonce @param encryptedXml 密文,对应POST请求的数据 @return 解密后的原文 """ // 密钥,公众账号的app corpSecret // 提取密文 String cipherText = extractEncryptPart(encryptedXml); try { // 验证安全签名 String signature = SHA1.gen(token, timeStamp, nonce, cipherText); if (!signature.equals(msgSignature)) { throw new RuntimeException("加密消息签名校验失败"); } } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } // 解密 String result = decrypt(cipherText); return result; }
java
public String decrypt(String msgSignature, String timeStamp, String nonce, String encryptedXml) { // 密钥,公众账号的app corpSecret // 提取密文 String cipherText = extractEncryptPart(encryptedXml); try { // 验证安全签名 String signature = SHA1.gen(token, timeStamp, nonce, cipherText); if (!signature.equals(msgSignature)) { throw new RuntimeException("加密消息签名校验失败"); } } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } // 解密 String result = decrypt(cipherText); return result; }
[ "public", "String", "decrypt", "(", "String", "msgSignature", ",", "String", "timeStamp", ",", "String", "nonce", ",", "String", "encryptedXml", ")", "{", "// 密钥,公众账号的app corpSecret\r", "// 提取密文\r", "String", "cipherText", "=", "extractEncryptPart", "(", "encryptedXml", ")", ";", "try", "{", "// 验证安全签名\r", "String", "signature", "=", "SHA1", ".", "gen", "(", "token", ",", "timeStamp", ",", "nonce", ",", "cipherText", ")", ";", "if", "(", "!", "signature", ".", "equals", "(", "msgSignature", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"加密消息签名校验失败\");\r", "", "", "}", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "// 解密\r", "String", "result", "=", "decrypt", "(", "cipherText", ")", ";", "return", "result", ";", "}" ]
检验消息的真实性,并且获取解密后的明文. <ol> <li>利用收到的密文生成安全签名,进行签名验证</li> <li>若验证通过,则提取xml中的加密消息</li> <li>对消息进行解密</li> </ol> @param msgSignature 签名串,对应URL参数的msg_signature @param timeStamp 时间戳,对应URL参数的timestamp @param nonce 随机串,对应URL参数的nonce @param encryptedXml 密文,对应POST请求的数据 @return 解密后的原文
[ "检验消息的真实性,并且获取解密后的明文", ".", "<ol", ">", "<li", ">", "利用收到的密文生成安全签名,进行签名验证<", "/", "li", ">", "<li", ">", "若验证通过,则提取xml中的加密消息<", "/", "li", ">", "<li", ">", "对消息进行解密<", "/", "li", ">", "<", "/", "ol", ">" ]
train
https://github.com/chanjarster/weixin-java-tools/blob/2a0b1c30c0f60c2de466cb8933c945bc0d391edf/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/crypto/WxCryptUtil.java#L157-L175
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java
PerspectiveOps.matrixToPinhole
public static <C extends CameraPinhole>C matrixToPinhole(FMatrixRMaj K , int width , int height , C output ) { """ Converts a calibration matrix into intrinsic parameters @param K Camera calibration matrix. @param width Image width in pixels @param height Image height in pixels @param output (Output) Where the intrinsic parameter are written to. If null then a new instance is declared. @return camera parameters """ return (C)ImplPerspectiveOps_F32.matrixToPinhole(K, width, height, output); }
java
public static <C extends CameraPinhole>C matrixToPinhole(FMatrixRMaj K , int width , int height , C output ) { return (C)ImplPerspectiveOps_F32.matrixToPinhole(K, width, height, output); }
[ "public", "static", "<", "C", "extends", "CameraPinhole", ">", "C", "matrixToPinhole", "(", "FMatrixRMaj", "K", ",", "int", "width", ",", "int", "height", ",", "C", "output", ")", "{", "return", "(", "C", ")", "ImplPerspectiveOps_F32", ".", "matrixToPinhole", "(", "K", ",", "width", ",", "height", ",", "output", ")", ";", "}" ]
Converts a calibration matrix into intrinsic parameters @param K Camera calibration matrix. @param width Image width in pixels @param height Image height in pixels @param output (Output) Where the intrinsic parameter are written to. If null then a new instance is declared. @return camera parameters
[ "Converts", "a", "calibration", "matrix", "into", "intrinsic", "parameters" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L311-L314
wwadge/bonecp
bonecp/src/main/java/com/jolbox/bonecp/AbstractConnectionStrategy.java
AbstractConnectionStrategy.postConnection
protected void postConnection(ConnectionHandle handle, long statsObtainTime) { """ After obtaining a connection, perform additional tasks. @param handle @param statsObtainTime """ handle.renewConnection(); // mark it as being logically "open" // Give an application a chance to do something with it. if (handle.getConnectionHook() != null){ handle.getConnectionHook().onCheckOut(handle); } if (this.pool.closeConnectionWatch){ // a debugging tool this.pool.watchConnection(handle); } if (this.pool.statisticsEnabled){ this.pool.statistics.addCumulativeConnectionWaitTime(System.nanoTime()-statsObtainTime); } }
java
protected void postConnection(ConnectionHandle handle, long statsObtainTime){ handle.renewConnection(); // mark it as being logically "open" // Give an application a chance to do something with it. if (handle.getConnectionHook() != null){ handle.getConnectionHook().onCheckOut(handle); } if (this.pool.closeConnectionWatch){ // a debugging tool this.pool.watchConnection(handle); } if (this.pool.statisticsEnabled){ this.pool.statistics.addCumulativeConnectionWaitTime(System.nanoTime()-statsObtainTime); } }
[ "protected", "void", "postConnection", "(", "ConnectionHandle", "handle", ",", "long", "statsObtainTime", ")", "{", "handle", ".", "renewConnection", "(", ")", ";", "// mark it as being logically \"open\"\r", "// Give an application a chance to do something with it.\r", "if", "(", "handle", ".", "getConnectionHook", "(", ")", "!=", "null", ")", "{", "handle", ".", "getConnectionHook", "(", ")", ".", "onCheckOut", "(", "handle", ")", ";", "}", "if", "(", "this", ".", "pool", ".", "closeConnectionWatch", ")", "{", "// a debugging tool\r", "this", ".", "pool", ".", "watchConnection", "(", "handle", ")", ";", "}", "if", "(", "this", ".", "pool", ".", "statisticsEnabled", ")", "{", "this", ".", "pool", ".", "statistics", ".", "addCumulativeConnectionWaitTime", "(", "System", ".", "nanoTime", "(", ")", "-", "statsObtainTime", ")", ";", "}", "}" ]
After obtaining a connection, perform additional tasks. @param handle @param statsObtainTime
[ "After", "obtaining", "a", "connection", "perform", "additional", "tasks", "." ]
train
https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/AbstractConnectionStrategy.java#L69-L85
jhalterman/failsafe
src/main/java/net/jodah/failsafe/Execution.java
Execution.canRetryOn
public boolean canRetryOn(Throwable failure) { """ Records an execution and returns true if a retry can be performed for the {@code failure}, else returns false and marks the execution as complete. @throws NullPointerException if {@code failure} is null @throws IllegalStateException if the execution is already complete """ Assert.notNull(failure, "failure"); return !postExecute(new ExecutionResult(null, failure)); }
java
public boolean canRetryOn(Throwable failure) { Assert.notNull(failure, "failure"); return !postExecute(new ExecutionResult(null, failure)); }
[ "public", "boolean", "canRetryOn", "(", "Throwable", "failure", ")", "{", "Assert", ".", "notNull", "(", "failure", ",", "\"failure\"", ")", ";", "return", "!", "postExecute", "(", "new", "ExecutionResult", "(", "null", ",", "failure", ")", ")", ";", "}" ]
Records an execution and returns true if a retry can be performed for the {@code failure}, else returns false and marks the execution as complete. @throws NullPointerException if {@code failure} is null @throws IllegalStateException if the execution is already complete
[ "Records", "an", "execution", "and", "returns", "true", "if", "a", "retry", "can", "be", "performed", "for", "the", "{", "@code", "failure", "}", "else", "returns", "false", "and", "marks", "the", "execution", "as", "complete", "." ]
train
https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/Execution.java#L74-L77
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java
AsyncMutateInBuilder.arrayInsert
public <T> AsyncMutateInBuilder arrayInsert(String path, T value) { """ Insert into an existing array at a specific position (denoted in the path, eg. "sub.array[2]"). @param path the path (including array position) where to insert the value. @param value the value to insert in the array. """ if (StringUtil.isNullOrEmpty(path)) { throw new IllegalArgumentException("Path must not be empty for arrayInsert"); } this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_INSERT, path, value)); return this; }
java
public <T> AsyncMutateInBuilder arrayInsert(String path, T value) { if (StringUtil.isNullOrEmpty(path)) { throw new IllegalArgumentException("Path must not be empty for arrayInsert"); } this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_INSERT, path, value)); return this; }
[ "public", "<", "T", ">", "AsyncMutateInBuilder", "arrayInsert", "(", "String", "path", ",", "T", "value", ")", "{", "if", "(", "StringUtil", ".", "isNullOrEmpty", "(", "path", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Path must not be empty for arrayInsert\"", ")", ";", "}", "this", ".", "mutationSpecs", ".", "add", "(", "new", "MutationSpec", "(", "Mutation", ".", "ARRAY_INSERT", ",", "path", ",", "value", ")", ")", ";", "return", "this", ";", "}" ]
Insert into an existing array at a specific position (denoted in the path, eg. "sub.array[2]"). @param path the path (including array position) where to insert the value. @param value the value to insert in the array.
[ "Insert", "into", "an", "existing", "array", "at", "a", "specific", "position", "(", "denoted", "in", "the", "path", "eg", ".", "sub", ".", "array", "[", "2", "]", ")", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L1075-L1081
carewebframework/carewebframework-vista
org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.documents/src/main/java/org/carewebframework/vista/plugin/documents/DocumentListRenderer.java
DocumentListRenderer.renderItem
@Override public void renderItem(Listitem item, Document doc) { """ Render the list item for the specified document. @param item List item to render. @param doc The document associated with the list item. """ log.trace("item render"); item.setSelectable(true); item.addForward(Events.ON_DOUBLE_CLICK, item.getListbox(), Events.ON_DOUBLE_CLICK); addCell(item, ""); addCell(item, doc.getDateTime()); addCell(item, doc.getTitle()); addCell(item, doc.getLocationName()); addCell(item, doc.getAuthorName()); }
java
@Override public void renderItem(Listitem item, Document doc) { log.trace("item render"); item.setSelectable(true); item.addForward(Events.ON_DOUBLE_CLICK, item.getListbox(), Events.ON_DOUBLE_CLICK); addCell(item, ""); addCell(item, doc.getDateTime()); addCell(item, doc.getTitle()); addCell(item, doc.getLocationName()); addCell(item, doc.getAuthorName()); }
[ "@", "Override", "public", "void", "renderItem", "(", "Listitem", "item", ",", "Document", "doc", ")", "{", "log", ".", "trace", "(", "\"item render\"", ")", ";", "item", ".", "setSelectable", "(", "true", ")", ";", "item", ".", "addForward", "(", "Events", ".", "ON_DOUBLE_CLICK", ",", "item", ".", "getListbox", "(", ")", ",", "Events", ".", "ON_DOUBLE_CLICK", ")", ";", "addCell", "(", "item", ",", "\"\"", ")", ";", "addCell", "(", "item", ",", "doc", ".", "getDateTime", "(", ")", ")", ";", "addCell", "(", "item", ",", "doc", ".", "getTitle", "(", ")", ")", ";", "addCell", "(", "item", ",", "doc", ".", "getLocationName", "(", ")", ")", ";", "addCell", "(", "item", ",", "doc", ".", "getAuthorName", "(", ")", ")", ";", "}" ]
Render the list item for the specified document. @param item List item to render. @param doc The document associated with the list item.
[ "Render", "the", "list", "item", "for", "the", "specified", "document", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.documents/src/main/java/org/carewebframework/vista/plugin/documents/DocumentListRenderer.java#L54-L64
eiichiro/acidhouse
acidhouse-appengine/src/main/java/org/eiichiro/acidhouse/appengine/Translation.java
Translation.toEntities
public static List<Entity> toEntities(AppEngineTransaction transaction, com.google.appengine.api.datastore.Key parent) { """ Translates Acid House {@code AppEngineTransaction} entity to Google App Engine Datastore entities with the specified {@code Key} of parent. @param transaction Acid House {@code Lock} entity. @param parent The {@code Key} of parent. @return Google App Engine Datastore entities translated from Acid House {@code AppEngineTransaction} entity. """ List<Entity> entities = new ArrayList<Entity>(); com.google.appengine.api.datastore.Key key = Keys.create(parent, TRANSACTION_KIND, transaction.id()); entities.add(new Entity(key)); for (Log log : transaction.logs()) { Entity entity = new Entity(Keys.create(key, LOG_KIND, log.sequence())); entity.setUnindexedProperty(OPERATION_PROPERTY, log.operation().name()); entity.setUnindexedProperty(CLASS_PROPERTY, log.entity().getClass().getName()); List<Blob> blobs = new ArrayList<Blob>(); entity.setUnindexedProperty(PROTO_PROPERTY, blobs); entities.add(entity); for (Entity e : toEntities(log.entity())) { EntityProto proto = EntityTranslator.convertToPb(e); byte[] bytes = proto.toByteArray(); blobs.add(new Blob(bytes)); } } return entities; }
java
public static List<Entity> toEntities(AppEngineTransaction transaction, com.google.appengine.api.datastore.Key parent) { List<Entity> entities = new ArrayList<Entity>(); com.google.appengine.api.datastore.Key key = Keys.create(parent, TRANSACTION_KIND, transaction.id()); entities.add(new Entity(key)); for (Log log : transaction.logs()) { Entity entity = new Entity(Keys.create(key, LOG_KIND, log.sequence())); entity.setUnindexedProperty(OPERATION_PROPERTY, log.operation().name()); entity.setUnindexedProperty(CLASS_PROPERTY, log.entity().getClass().getName()); List<Blob> blobs = new ArrayList<Blob>(); entity.setUnindexedProperty(PROTO_PROPERTY, blobs); entities.add(entity); for (Entity e : toEntities(log.entity())) { EntityProto proto = EntityTranslator.convertToPb(e); byte[] bytes = proto.toByteArray(); blobs.add(new Blob(bytes)); } } return entities; }
[ "public", "static", "List", "<", "Entity", ">", "toEntities", "(", "AppEngineTransaction", "transaction", ",", "com", ".", "google", ".", "appengine", ".", "api", ".", "datastore", ".", "Key", "parent", ")", "{", "List", "<", "Entity", ">", "entities", "=", "new", "ArrayList", "<", "Entity", ">", "(", ")", ";", "com", ".", "google", ".", "appengine", ".", "api", ".", "datastore", ".", "Key", "key", "=", "Keys", ".", "create", "(", "parent", ",", "TRANSACTION_KIND", ",", "transaction", ".", "id", "(", ")", ")", ";", "entities", ".", "add", "(", "new", "Entity", "(", "key", ")", ")", ";", "for", "(", "Log", "log", ":", "transaction", ".", "logs", "(", ")", ")", "{", "Entity", "entity", "=", "new", "Entity", "(", "Keys", ".", "create", "(", "key", ",", "LOG_KIND", ",", "log", ".", "sequence", "(", ")", ")", ")", ";", "entity", ".", "setUnindexedProperty", "(", "OPERATION_PROPERTY", ",", "log", ".", "operation", "(", ")", ".", "name", "(", ")", ")", ";", "entity", ".", "setUnindexedProperty", "(", "CLASS_PROPERTY", ",", "log", ".", "entity", "(", ")", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "List", "<", "Blob", ">", "blobs", "=", "new", "ArrayList", "<", "Blob", ">", "(", ")", ";", "entity", ".", "setUnindexedProperty", "(", "PROTO_PROPERTY", ",", "blobs", ")", ";", "entities", ".", "add", "(", "entity", ")", ";", "for", "(", "Entity", "e", ":", "toEntities", "(", "log", ".", "entity", "(", ")", ")", ")", "{", "EntityProto", "proto", "=", "EntityTranslator", ".", "convertToPb", "(", "e", ")", ";", "byte", "[", "]", "bytes", "=", "proto", ".", "toByteArray", "(", ")", ";", "blobs", ".", "add", "(", "new", "Blob", "(", "bytes", ")", ")", ";", "}", "}", "return", "entities", ";", "}" ]
Translates Acid House {@code AppEngineTransaction} entity to Google App Engine Datastore entities with the specified {@code Key} of parent. @param transaction Acid House {@code Lock} entity. @param parent The {@code Key} of parent. @return Google App Engine Datastore entities translated from Acid House {@code AppEngineTransaction} entity.
[ "Translates", "Acid", "House", "{", "@code", "AppEngineTransaction", "}", "entity", "to", "Google", "App", "Engine", "Datastore", "entities", "with", "the", "specified", "{", "@code", "Key", "}", "of", "parent", "." ]
train
https://github.com/eiichiro/acidhouse/blob/c50eaa0bb0f24abb46def4afa611f170637cdd62/acidhouse-appengine/src/main/java/org/eiichiro/acidhouse/appengine/Translation.java#L586-L609
alexxiyang/jdbctemplatetool
src/main/java/org/crazycake/jdbcTemplateTool/utils/ModelSqlUtils.java
ModelSqlUtils.getColumnNameFromGetter
private static String getColumnNameFromGetter(Method getter,Field f) { """ use getter to guess column name, if there is annotation then use annotation value, if not then guess from field name @param getter @param f @return @throws NoColumnAnnotationFoundException """ String columnName = ""; Column columnAnno = getter.getAnnotation(Column.class); if(columnAnno != null){ //如果是列注解就读取name属性 columnName = columnAnno.name(); } if(columnName == null || "".equals(columnName)){ //如果没有列注解就用命名方式去猜 columnName = IdUtils.toUnderscore(f.getName()); } return columnName; }
java
private static String getColumnNameFromGetter(Method getter,Field f){ String columnName = ""; Column columnAnno = getter.getAnnotation(Column.class); if(columnAnno != null){ //如果是列注解就读取name属性 columnName = columnAnno.name(); } if(columnName == null || "".equals(columnName)){ //如果没有列注解就用命名方式去猜 columnName = IdUtils.toUnderscore(f.getName()); } return columnName; }
[ "private", "static", "String", "getColumnNameFromGetter", "(", "Method", "getter", ",", "Field", "f", ")", "{", "String", "columnName", "=", "\"\"", ";", "Column", "columnAnno", "=", "getter", ".", "getAnnotation", "(", "Column", ".", "class", ")", ";", "if", "(", "columnAnno", "!=", "null", ")", "{", "//如果是列注解就读取name属性", "columnName", "=", "columnAnno", ".", "name", "(", ")", ";", "}", "if", "(", "columnName", "==", "null", "||", "\"\"", ".", "equals", "(", "columnName", ")", ")", "{", "//如果没有列注解就用命名方式去猜", "columnName", "=", "IdUtils", ".", "toUnderscore", "(", "f", ".", "getName", "(", ")", ")", ";", "}", "return", "columnName", ";", "}" ]
use getter to guess column name, if there is annotation then use annotation value, if not then guess from field name @param getter @param f @return @throws NoColumnAnnotationFoundException
[ "use", "getter", "to", "guess", "column", "name", "if", "there", "is", "annotation", "then", "use", "annotation", "value", "if", "not", "then", "guess", "from", "field", "name" ]
train
https://github.com/alexxiyang/jdbctemplatetool/blob/8406e0a7eb13677c4b7147a12f5f95caf9498aeb/src/main/java/org/crazycake/jdbcTemplateTool/utils/ModelSqlUtils.java#L362-L375
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.createManagedUser
public ManagedUser createManagedUser(final String username, final String passwordHash) { """ Creates a new ManagedUser object. @param username The username for the user @param passwordHash The hashed password. @return a ManagedUser @see alpine.auth.PasswordService @since 1.0.0 """ return createManagedUser(username, null, null, passwordHash, false, false, false); }
java
public ManagedUser createManagedUser(final String username, final String passwordHash) { return createManagedUser(username, null, null, passwordHash, false, false, false); }
[ "public", "ManagedUser", "createManagedUser", "(", "final", "String", "username", ",", "final", "String", "passwordHash", ")", "{", "return", "createManagedUser", "(", "username", ",", "null", ",", "null", ",", "passwordHash", ",", "false", ",", "false", ",", "false", ")", ";", "}" ]
Creates a new ManagedUser object. @param username The username for the user @param passwordHash The hashed password. @return a ManagedUser @see alpine.auth.PasswordService @since 1.0.0
[ "Creates", "a", "new", "ManagedUser", "object", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L233-L235
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java
Utils.compareQNames
public static boolean compareQNames(QName qn1, QName qn2) { """ Compares two QNames for equality. Either or both of the values may be null. @param qn1 @param qn2 @return """ if (qn1 == qn2) return true; if (qn1 == null || qn2 == null) return false; return qn1.equals(qn2); }
java
public static boolean compareQNames(QName qn1, QName qn2) { if (qn1 == qn2) return true; if (qn1 == null || qn2 == null) return false; return qn1.equals(qn2); }
[ "public", "static", "boolean", "compareQNames", "(", "QName", "qn1", ",", "QName", "qn2", ")", "{", "if", "(", "qn1", "==", "qn2", ")", "return", "true", ";", "if", "(", "qn1", "==", "null", "||", "qn2", "==", "null", ")", "return", "false", ";", "return", "qn1", ".", "equals", "(", "qn2", ")", ";", "}" ]
Compares two QNames for equality. Either or both of the values may be null. @param qn1 @param qn2 @return
[ "Compares", "two", "QNames", "for", "equality", ".", "Either", "or", "both", "of", "the", "values", "may", "be", "null", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/Utils.java#L61-L67
overturetool/overture
core/interpreter/src/main/java/org/overture/interpreter/assistant/statement/PStmAssistantInterpreter.java
PStmAssistantInterpreter.findStatement
public PStm findStatement(PStm stm, int lineno) { """ Find a statement starting on the given line. Single statements just compare their location to lineno, but block statements and statements with sub-statements iterate over their branches. @param stm the statement @param lineno The line number to locate. @return A statement starting on the line, or null. """ try { return stm.apply(af.getStatementFinder(), lineno);// FIXME: should we handle exceptions like this } catch (AnalysisException e) { return null; // Most have none } }
java
public PStm findStatement(PStm stm, int lineno) { try { return stm.apply(af.getStatementFinder(), lineno);// FIXME: should we handle exceptions like this } catch (AnalysisException e) { return null; // Most have none } }
[ "public", "PStm", "findStatement", "(", "PStm", "stm", ",", "int", "lineno", ")", "{", "try", "{", "return", "stm", ".", "apply", "(", "af", ".", "getStatementFinder", "(", ")", ",", "lineno", ")", ";", "// FIXME: should we handle exceptions like this", "}", "catch", "(", "AnalysisException", "e", ")", "{", "return", "null", ";", "// Most have none", "}", "}" ]
Find a statement starting on the given line. Single statements just compare their location to lineno, but block statements and statements with sub-statements iterate over their branches. @param stm the statement @param lineno The line number to locate. @return A statement starting on the line, or null.
[ "Find", "a", "statement", "starting", "on", "the", "given", "line", ".", "Single", "statements", "just", "compare", "their", "location", "to", "lineno", "but", "block", "statements", "and", "statements", "with", "sub", "-", "statements", "iterate", "over", "their", "branches", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/assistant/statement/PStmAssistantInterpreter.java#L41-L51
apache/reef
lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/storage/StorageKeyCloudBlobProvider.java
StorageKeyCloudBlobProvider.generateSharedAccessSignature
@Override public URI generateSharedAccessSignature(final CloudBlob cloudBlob, final SharedAccessBlobPolicy policy) throws IOException { """ Generates a Shared Access Key URI for the given {@link CloudBlob}. @param cloudBlob cloud blob to create a Shared Access Key URI for. @param policy an instance of {@link SharedAccessBlobPolicy} that specifies permissions and signature's validity time period. @return a Shared Access Key URI for the given {@link CloudBlob}. @throws IOException """ try { final String sas = cloudBlob.generateSharedAccessSignature(policy, null); final String uri = cloudBlob.getStorageUri().getPrimaryUri().toString(); return new URI(uri + "?" + sas); } catch (StorageException | InvalidKeyException | URISyntaxException e) { throw new IOException("Failed to generated a Shared Access Signature.", e); } }
java
@Override public URI generateSharedAccessSignature(final CloudBlob cloudBlob, final SharedAccessBlobPolicy policy) throws IOException { try { final String sas = cloudBlob.generateSharedAccessSignature(policy, null); final String uri = cloudBlob.getStorageUri().getPrimaryUri().toString(); return new URI(uri + "?" + sas); } catch (StorageException | InvalidKeyException | URISyntaxException e) { throw new IOException("Failed to generated a Shared Access Signature.", e); } }
[ "@", "Override", "public", "URI", "generateSharedAccessSignature", "(", "final", "CloudBlob", "cloudBlob", ",", "final", "SharedAccessBlobPolicy", "policy", ")", "throws", "IOException", "{", "try", "{", "final", "String", "sas", "=", "cloudBlob", ".", "generateSharedAccessSignature", "(", "policy", ",", "null", ")", ";", "final", "String", "uri", "=", "cloudBlob", ".", "getStorageUri", "(", ")", ".", "getPrimaryUri", "(", ")", ".", "toString", "(", ")", ";", "return", "new", "URI", "(", "uri", "+", "\"?\"", "+", "sas", ")", ";", "}", "catch", "(", "StorageException", "|", "InvalidKeyException", "|", "URISyntaxException", "e", ")", "{", "throw", "new", "IOException", "(", "\"Failed to generated a Shared Access Signature.\"", ",", "e", ")", ";", "}", "}" ]
Generates a Shared Access Key URI for the given {@link CloudBlob}. @param cloudBlob cloud blob to create a Shared Access Key URI for. @param policy an instance of {@link SharedAccessBlobPolicy} that specifies permissions and signature's validity time period. @return a Shared Access Key URI for the given {@link CloudBlob}. @throws IOException
[ "Generates", "a", "Shared", "Access", "Key", "URI", "for", "the", "given", "{" ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/storage/StorageKeyCloudBlobProvider.java#L81-L91
jenetics/jenetics
jenetics/src/main/java/io/jenetics/ProbabilitySelector.java
ProbabilitySelector.sum2one
static boolean sum2one(final double[] probabilities) { """ Check if the given probabilities sum to one. @param probabilities the probabilities to check. @return {@code true} if the sum of the probabilities are within the error range, {@code false} otherwise. """ final double sum = probabilities.length > 0 ? DoubleAdder.sum(probabilities) : 1.0; return abs(ulpDistance(sum, 1.0)) < MAX_ULP_DISTANCE; }
java
static boolean sum2one(final double[] probabilities) { final double sum = probabilities.length > 0 ? DoubleAdder.sum(probabilities) : 1.0; return abs(ulpDistance(sum, 1.0)) < MAX_ULP_DISTANCE; }
[ "static", "boolean", "sum2one", "(", "final", "double", "[", "]", "probabilities", ")", "{", "final", "double", "sum", "=", "probabilities", ".", "length", ">", "0", "?", "DoubleAdder", ".", "sum", "(", "probabilities", ")", ":", "1.0", ";", "return", "abs", "(", "ulpDistance", "(", "sum", ",", "1.0", ")", ")", "<", "MAX_ULP_DISTANCE", ";", "}" ]
Check if the given probabilities sum to one. @param probabilities the probabilities to check. @return {@code true} if the sum of the probabilities are within the error range, {@code false} otherwise.
[ "Check", "if", "the", "given", "probabilities", "sum", "to", "one", "." ]
train
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/ProbabilitySelector.java#L223-L228
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/GameContainer.java
GameContainer.setAnimatedMouseCursor
public void setAnimatedMouseCursor(String ref, int x, int y, int width, int height, int[] cursorDelays) throws SlickException { """ Get a cursor based on a image reference on the classpath. The image is assumed to be a set/strip of cursor animation frames running from top to bottom. @param ref The reference to the image to be loaded @param x The x-coordinate of the cursor hotspot (left -> right) @param y The y-coordinate of the cursor hotspot (bottom -> top) @param width The x width of the cursor @param height The y height of the cursor @param cursorDelays image delays between changing frames in animation @throws SlickException Indicates a failure to load the image or a failure to create the hardware cursor """ try { Cursor cursor; cursor = CursorLoader.get().getAnimatedCursor(ref, x, y, width, height, cursorDelays); setMouseCursor(cursor, x, y); } catch (IOException e) { throw new SlickException("Failed to set mouse cursor", e); } catch (LWJGLException e) { throw new SlickException("Failed to set mouse cursor", e); } }
java
public void setAnimatedMouseCursor(String ref, int x, int y, int width, int height, int[] cursorDelays) throws SlickException { try { Cursor cursor; cursor = CursorLoader.get().getAnimatedCursor(ref, x, y, width, height, cursorDelays); setMouseCursor(cursor, x, y); } catch (IOException e) { throw new SlickException("Failed to set mouse cursor", e); } catch (LWJGLException e) { throw new SlickException("Failed to set mouse cursor", e); } }
[ "public", "void", "setAnimatedMouseCursor", "(", "String", "ref", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ",", "int", "[", "]", "cursorDelays", ")", "throws", "SlickException", "{", "try", "{", "Cursor", "cursor", ";", "cursor", "=", "CursorLoader", ".", "get", "(", ")", ".", "getAnimatedCursor", "(", "ref", ",", "x", ",", "y", ",", "width", ",", "height", ",", "cursorDelays", ")", ";", "setMouseCursor", "(", "cursor", ",", "x", ",", "y", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "SlickException", "(", "\"Failed to set mouse cursor\"", ",", "e", ")", ";", "}", "catch", "(", "LWJGLException", "e", ")", "{", "throw", "new", "SlickException", "(", "\"Failed to set mouse cursor\"", ",", "e", ")", ";", "}", "}" ]
Get a cursor based on a image reference on the classpath. The image is assumed to be a set/strip of cursor animation frames running from top to bottom. @param ref The reference to the image to be loaded @param x The x-coordinate of the cursor hotspot (left -> right) @param y The y-coordinate of the cursor hotspot (bottom -> top) @param width The x width of the cursor @param height The y height of the cursor @param cursorDelays image delays between changing frames in animation @throws SlickException Indicates a failure to load the image or a failure to create the hardware cursor
[ "Get", "a", "cursor", "based", "on", "a", "image", "reference", "on", "the", "classpath", ".", "The", "image", "is", "assumed", "to", "be", "a", "set", "/", "strip", "of", "cursor", "animation", "frames", "running", "from", "top", "to", "bottom", "." ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/GameContainer.java#L529-L540
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrieBuilder.java
CharsTrieBuilder.writeValueAndType
@Deprecated @Override protected int writeValueAndType(boolean hasValue, int value, int node) { """ {@inheritDoc} @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android """ if(!hasValue) { return write(node); } int length; if(value<0 || value>CharsTrie.kMaxTwoUnitNodeValue) { intUnits[0]=(char)(CharsTrie.kThreeUnitNodeValueLead); intUnits[1]=(char)(value>>16); intUnits[2]=(char)value; length=3; } else if(value<=CharsTrie.kMaxOneUnitNodeValue) { intUnits[0]=(char)((value+1)<<6); length=1; } else { intUnits[0]=(char)(CharsTrie.kMinTwoUnitNodeValueLead+((value>>10)&0x7fc0)); intUnits[1]=(char)value; length=2; } intUnits[0]|=(char)node; return write(intUnits, length); }
java
@Deprecated @Override protected int writeValueAndType(boolean hasValue, int value, int node) { if(!hasValue) { return write(node); } int length; if(value<0 || value>CharsTrie.kMaxTwoUnitNodeValue) { intUnits[0]=(char)(CharsTrie.kThreeUnitNodeValueLead); intUnits[1]=(char)(value>>16); intUnits[2]=(char)value; length=3; } else if(value<=CharsTrie.kMaxOneUnitNodeValue) { intUnits[0]=(char)((value+1)<<6); length=1; } else { intUnits[0]=(char)(CharsTrie.kMinTwoUnitNodeValueLead+((value>>10)&0x7fc0)); intUnits[1]=(char)value; length=2; } intUnits[0]|=(char)node; return write(intUnits, length); }
[ "@", "Deprecated", "@", "Override", "protected", "int", "writeValueAndType", "(", "boolean", "hasValue", ",", "int", "value", ",", "int", "node", ")", "{", "if", "(", "!", "hasValue", ")", "{", "return", "write", "(", "node", ")", ";", "}", "int", "length", ";", "if", "(", "value", "<", "0", "||", "value", ">", "CharsTrie", ".", "kMaxTwoUnitNodeValue", ")", "{", "intUnits", "[", "0", "]", "=", "(", "char", ")", "(", "CharsTrie", ".", "kThreeUnitNodeValueLead", ")", ";", "intUnits", "[", "1", "]", "=", "(", "char", ")", "(", "value", ">>", "16", ")", ";", "intUnits", "[", "2", "]", "=", "(", "char", ")", "value", ";", "length", "=", "3", ";", "}", "else", "if", "(", "value", "<=", "CharsTrie", ".", "kMaxOneUnitNodeValue", ")", "{", "intUnits", "[", "0", "]", "=", "(", "char", ")", "(", "(", "value", "+", "1", ")", "<<", "6", ")", ";", "length", "=", "1", ";", "}", "else", "{", "intUnits", "[", "0", "]", "=", "(", "char", ")", "(", "CharsTrie", ".", "kMinTwoUnitNodeValueLead", "+", "(", "(", "value", ">>", "10", ")", "&", "0x7fc0", ")", ")", ";", "intUnits", "[", "1", "]", "=", "(", "char", ")", "value", ";", "length", "=", "2", ";", "}", "intUnits", "[", "0", "]", "|=", "(", "char", ")", "node", ";", "return", "write", "(", "intUnits", ",", "length", ")", ";", "}" ]
{@inheritDoc} @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android
[ "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrieBuilder.java#L223-L245
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/widget/file/FileUtils.java
FileUtils.readableFileSize
public static String readableFileSize (long size) { """ Converts byte file size to human readable, eg:<br> 500 becomes 500 B<br> 1024 becomes 1 KB<br> 123456 becomes 120.6 KB<br> 10000000000 becomes 9.3 GB<br> Max supported unit is yottabyte (YB). @param size file size in bytes. @return human readable file size. """ if (size <= 0) return "0 B"; int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)).replace(",", ".") + " " + UNITS[digitGroups]; }
java
public static String readableFileSize (long size) { if (size <= 0) return "0 B"; int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)).replace(",", ".") + " " + UNITS[digitGroups]; }
[ "public", "static", "String", "readableFileSize", "(", "long", "size", ")", "{", "if", "(", "size", "<=", "0", ")", "return", "\"0 B\"", ";", "int", "digitGroups", "=", "(", "int", ")", "(", "Math", ".", "log10", "(", "size", ")", "/", "Math", ".", "log10", "(", "1024", ")", ")", ";", "return", "new", "DecimalFormat", "(", "\"#,##0.#\"", ")", ".", "format", "(", "size", "/", "Math", ".", "pow", "(", "1024", ",", "digitGroups", ")", ")", ".", "replace", "(", "\",\"", ",", "\".\"", ")", "+", "\" \"", "+", "UNITS", "[", "digitGroups", "]", ";", "}" ]
Converts byte file size to human readable, eg:<br> 500 becomes 500 B<br> 1024 becomes 1 KB<br> 123456 becomes 120.6 KB<br> 10000000000 becomes 9.3 GB<br> Max supported unit is yottabyte (YB). @param size file size in bytes. @return human readable file size.
[ "Converts", "byte", "file", "size", "to", "human", "readable", "eg", ":", "<br", ">", "500", "becomes", "500", "B<br", ">", "1024", "becomes", "1", "KB<br", ">", "123456", "becomes", "120", ".", "6", "KB<br", ">", "10000000000", "becomes", "9", ".", "3", "GB<br", ">", "Max", "supported", "unit", "is", "yottabyte", "(", "YB", ")", "." ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/widget/file/FileUtils.java#L77-L81
facebookarchive/hadoop-20
src/tools/org/apache/hadoop/tools/rumen/ZombieJob.java
ZombieJob.getTaskAttemptInfo
public TaskAttemptInfo getTaskAttemptInfo(TaskType taskType, int taskNumber, int taskAttemptNumber) { """ Get a {@link TaskAttemptInfo} with a {@link TaskAttemptID} associated with taskType, taskNumber, and taskAttemptNumber. This function does not care about locality, and follows the following decision logic: 1. Make up a {@link TaskAttemptInfo} if the task attempt is missing in trace, 2. Make up a {@link TaskAttemptInfo} if the task attempt has a KILLED final status in trace, 3. Otherwise (final state is SUCCEEDED or FAILED), construct the {@link TaskAttemptInfo} from the trace. """ // does not care about locality. assume default locality is NODE_LOCAL. // But if both task and task attempt exist in trace, use logged locality. int locality = 0; LoggedTask loggedTask = getLoggedTask(taskType, taskNumber); if (loggedTask == null) { // TODO insert parameters TaskInfo taskInfo = new TaskInfo(0, 0, 0, 0, 0); return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber, taskNumber, locality); } LoggedTaskAttempt loggedAttempt = getLoggedTaskAttempt(taskType, taskNumber, taskAttemptNumber); if (loggedAttempt == null) { // Task exists, but attempt is missing. TaskInfo taskInfo = getTaskInfo(loggedTask); return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber, taskNumber, locality); } else { // TODO should we handle killed attempts later? if (loggedAttempt.getResult()== Values.KILLED) { TaskInfo taskInfo = getTaskInfo(loggedTask); return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber, taskNumber, locality); } else { return getTaskAttemptInfo(loggedTask, loggedAttempt); } } }
java
public TaskAttemptInfo getTaskAttemptInfo(TaskType taskType, int taskNumber, int taskAttemptNumber) { // does not care about locality. assume default locality is NODE_LOCAL. // But if both task and task attempt exist in trace, use logged locality. int locality = 0; LoggedTask loggedTask = getLoggedTask(taskType, taskNumber); if (loggedTask == null) { // TODO insert parameters TaskInfo taskInfo = new TaskInfo(0, 0, 0, 0, 0); return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber, taskNumber, locality); } LoggedTaskAttempt loggedAttempt = getLoggedTaskAttempt(taskType, taskNumber, taskAttemptNumber); if (loggedAttempt == null) { // Task exists, but attempt is missing. TaskInfo taskInfo = getTaskInfo(loggedTask); return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber, taskNumber, locality); } else { // TODO should we handle killed attempts later? if (loggedAttempt.getResult()== Values.KILLED) { TaskInfo taskInfo = getTaskInfo(loggedTask); return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber, taskNumber, locality); } else { return getTaskAttemptInfo(loggedTask, loggedAttempt); } } }
[ "public", "TaskAttemptInfo", "getTaskAttemptInfo", "(", "TaskType", "taskType", ",", "int", "taskNumber", ",", "int", "taskAttemptNumber", ")", "{", "// does not care about locality. assume default locality is NODE_LOCAL.", "// But if both task and task attempt exist in trace, use logged locality.", "int", "locality", "=", "0", ";", "LoggedTask", "loggedTask", "=", "getLoggedTask", "(", "taskType", ",", "taskNumber", ")", ";", "if", "(", "loggedTask", "==", "null", ")", "{", "// TODO insert parameters", "TaskInfo", "taskInfo", "=", "new", "TaskInfo", "(", "0", ",", "0", ",", "0", ",", "0", ",", "0", ")", ";", "return", "makeUpTaskAttemptInfo", "(", "taskType", ",", "taskInfo", ",", "taskAttemptNumber", ",", "taskNumber", ",", "locality", ")", ";", "}", "LoggedTaskAttempt", "loggedAttempt", "=", "getLoggedTaskAttempt", "(", "taskType", ",", "taskNumber", ",", "taskAttemptNumber", ")", ";", "if", "(", "loggedAttempt", "==", "null", ")", "{", "// Task exists, but attempt is missing.", "TaskInfo", "taskInfo", "=", "getTaskInfo", "(", "loggedTask", ")", ";", "return", "makeUpTaskAttemptInfo", "(", "taskType", ",", "taskInfo", ",", "taskAttemptNumber", ",", "taskNumber", ",", "locality", ")", ";", "}", "else", "{", "// TODO should we handle killed attempts later?", "if", "(", "loggedAttempt", ".", "getResult", "(", ")", "==", "Values", ".", "KILLED", ")", "{", "TaskInfo", "taskInfo", "=", "getTaskInfo", "(", "loggedTask", ")", ";", "return", "makeUpTaskAttemptInfo", "(", "taskType", ",", "taskInfo", ",", "taskAttemptNumber", ",", "taskNumber", ",", "locality", ")", ";", "}", "else", "{", "return", "getTaskAttemptInfo", "(", "loggedTask", ",", "loggedAttempt", ")", ";", "}", "}", "}" ]
Get a {@link TaskAttemptInfo} with a {@link TaskAttemptID} associated with taskType, taskNumber, and taskAttemptNumber. This function does not care about locality, and follows the following decision logic: 1. Make up a {@link TaskAttemptInfo} if the task attempt is missing in trace, 2. Make up a {@link TaskAttemptInfo} if the task attempt has a KILLED final status in trace, 3. Otherwise (final state is SUCCEEDED or FAILED), construct the {@link TaskAttemptInfo} from the trace.
[ "Get", "a", "{" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/tools/org/apache/hadoop/tools/rumen/ZombieJob.java#L394-L424
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/NodeAuditAnalyzer.java
NodeAuditAnalyzer.prepareFileTypeAnalyzer
@Override public void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { """ Initializes the analyzer once before any analysis is performed. @param engine a reference to the dependency-check engine @throws InitializationException if there's an error during initialization """ LOGGER.debug("Initializing {}", getName()); try { searcher = new NodeAuditSearch(getSettings()); } catch (MalformedURLException ex) { setEnabled(false); throw new InitializationException("The configured URL to NPM Audit API is malformed", ex); } try { final Settings settings = engine.getSettings(); final boolean nodeEnabled = settings.getBoolean(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED); if (!nodeEnabled) { LOGGER.warn("The Node Package Analyzer has been disabled; the resulting report will only " + " contain the known vulnerable dependency - not a bill of materials for the node project."); } } catch (InvalidSettingException ex) { throw new InitializationException("Unable to read configuration settings", ex); } }
java
@Override public void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { LOGGER.debug("Initializing {}", getName()); try { searcher = new NodeAuditSearch(getSettings()); } catch (MalformedURLException ex) { setEnabled(false); throw new InitializationException("The configured URL to NPM Audit API is malformed", ex); } try { final Settings settings = engine.getSettings(); final boolean nodeEnabled = settings.getBoolean(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED); if (!nodeEnabled) { LOGGER.warn("The Node Package Analyzer has been disabled; the resulting report will only " + " contain the known vulnerable dependency - not a bill of materials for the node project."); } } catch (InvalidSettingException ex) { throw new InitializationException("Unable to read configuration settings", ex); } }
[ "@", "Override", "public", "void", "prepareFileTypeAnalyzer", "(", "Engine", "engine", ")", "throws", "InitializationException", "{", "LOGGER", ".", "debug", "(", "\"Initializing {}\"", ",", "getName", "(", ")", ")", ";", "try", "{", "searcher", "=", "new", "NodeAuditSearch", "(", "getSettings", "(", ")", ")", ";", "}", "catch", "(", "MalformedURLException", "ex", ")", "{", "setEnabled", "(", "false", ")", ";", "throw", "new", "InitializationException", "(", "\"The configured URL to NPM Audit API is malformed\"", ",", "ex", ")", ";", "}", "try", "{", "final", "Settings", "settings", "=", "engine", ".", "getSettings", "(", ")", ";", "final", "boolean", "nodeEnabled", "=", "settings", ".", "getBoolean", "(", "Settings", ".", "KEYS", ".", "ANALYZER_NODE_PACKAGE_ENABLED", ")", ";", "if", "(", "!", "nodeEnabled", ")", "{", "LOGGER", ".", "warn", "(", "\"The Node Package Analyzer has been disabled; the resulting report will only \"", "+", "\" contain the known vulnerable dependency - not a bill of materials for the node project.\"", ")", ";", "}", "}", "catch", "(", "InvalidSettingException", "ex", ")", "{", "throw", "new", "InitializationException", "(", "\"Unable to read configuration settings\"", ",", "ex", ")", ";", "}", "}" ]
Initializes the analyzer once before any analysis is performed. @param engine a reference to the dependency-check engine @throws InitializationException if there's an error during initialization
[ "Initializes", "the", "analyzer", "once", "before", "any", "analysis", "is", "performed", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/NodeAuditAnalyzer.java#L113-L132
fabric8io/fabric8-forge
addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelCatalogHelper.java
CamelCatalogHelper.isModelSupportOutput
public static boolean isModelSupportOutput(CamelCatalog camelCatalog, String modelName) { """ Whether the EIP supports outputs @param modelName the model name @return <tt>true</tt> if output supported, <tt>false</tt> otherwise """ // use the camel catalog String json = camelCatalog.modelJSonSchema(modelName); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false); if (data != null) { for (Map<String, String> propertyMap : data) { String output = propertyMap.get("output"); if (output != null) { return "true".equals(output); } } } return false; }
java
public static boolean isModelSupportOutput(CamelCatalog camelCatalog, String modelName) { // use the camel catalog String json = camelCatalog.modelJSonSchema(modelName); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false); if (data != null) { for (Map<String, String> propertyMap : data) { String output = propertyMap.get("output"); if (output != null) { return "true".equals(output); } } } return false; }
[ "public", "static", "boolean", "isModelSupportOutput", "(", "CamelCatalog", "camelCatalog", ",", "String", "modelName", ")", "{", "// use the camel catalog", "String", "json", "=", "camelCatalog", ".", "modelJSonSchema", "(", "modelName", ")", ";", "if", "(", "json", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Could not find catalog entry for model name: \"", "+", "modelName", ")", ";", "}", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "data", "=", "JSonSchemaHelper", ".", "parseJsonSchema", "(", "\"model\"", ",", "json", ",", "false", ")", ";", "if", "(", "data", "!=", "null", ")", "{", "for", "(", "Map", "<", "String", ",", "String", ">", "propertyMap", ":", "data", ")", "{", "String", "output", "=", "propertyMap", ".", "get", "(", "\"output\"", ")", ";", "if", "(", "output", "!=", "null", ")", "{", "return", "\"true\"", ".", "equals", "(", "output", ")", ";", "}", "}", "}", "return", "false", ";", "}" ]
Whether the EIP supports outputs @param modelName the model name @return <tt>true</tt> if output supported, <tt>false</tt> otherwise
[ "Whether", "the", "EIP", "supports", "outputs" ]
train
https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelCatalogHelper.java#L429-L446
livetribe/livetribe-slp
core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java
StandardDirectoryAgentServer.handleTCPAttrRqst
protected void handleTCPAttrRqst(AttrRqst attrRqst, Socket socket) { """ Handles a unicast TCP AttrRqst message arrived to this directory agent. <br /> This directory agent will reply with an AttrRply containing the result of the attribute request. @param attrRqst the AttrRqst message to handle @param socket the socket connected to the client where to write the reply """ // Match scopes, RFC 2608, 11.1 if (!scopes.weakMatch(attrRqst.getScopes())) { tcpAttrRply.perform(socket, attrRqst, SLPError.SCOPE_NOT_SUPPORTED); return; } Attributes attributes = matchAttributes(attrRqst); if (logger.isLoggable(Level.FINE)) logger.fine("DirectoryAgent " + this + " returning attributes for service " + attrRqst.getURL() + ": " + attributes.asString()); tcpAttrRply.perform(socket, attrRqst, attributes); }
java
protected void handleTCPAttrRqst(AttrRqst attrRqst, Socket socket) { // Match scopes, RFC 2608, 11.1 if (!scopes.weakMatch(attrRqst.getScopes())) { tcpAttrRply.perform(socket, attrRqst, SLPError.SCOPE_NOT_SUPPORTED); return; } Attributes attributes = matchAttributes(attrRqst); if (logger.isLoggable(Level.FINE)) logger.fine("DirectoryAgent " + this + " returning attributes for service " + attrRqst.getURL() + ": " + attributes.asString()); tcpAttrRply.perform(socket, attrRqst, attributes); }
[ "protected", "void", "handleTCPAttrRqst", "(", "AttrRqst", "attrRqst", ",", "Socket", "socket", ")", "{", "// Match scopes, RFC 2608, 11.1", "if", "(", "!", "scopes", ".", "weakMatch", "(", "attrRqst", ".", "getScopes", "(", ")", ")", ")", "{", "tcpAttrRply", ".", "perform", "(", "socket", ",", "attrRqst", ",", "SLPError", ".", "SCOPE_NOT_SUPPORTED", ")", ";", "return", ";", "}", "Attributes", "attributes", "=", "matchAttributes", "(", "attrRqst", ")", ";", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "logger", ".", "fine", "(", "\"DirectoryAgent \"", "+", "this", "+", "\" returning attributes for service \"", "+", "attrRqst", ".", "getURL", "(", ")", "+", "\": \"", "+", "attributes", ".", "asString", "(", ")", ")", ";", "tcpAttrRply", ".", "perform", "(", "socket", ",", "attrRqst", ",", "attributes", ")", ";", "}" ]
Handles a unicast TCP AttrRqst message arrived to this directory agent. <br /> This directory agent will reply with an AttrRply containing the result of the attribute request. @param attrRqst the AttrRqst message to handle @param socket the socket connected to the client where to write the reply
[ "Handles", "a", "unicast", "TCP", "AttrRqst", "message", "arrived", "to", "this", "directory", "agent", ".", "<br", "/", ">", "This", "directory", "agent", "will", "reply", "with", "an", "AttrRply", "containing", "the", "result", "of", "the", "attribute", "request", "." ]
train
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java#L642-L656
VoltDB/voltdb
third_party/java/src/org/json_voltpatches/JSONWriter.java
JSONWriter.keySymbolValuePair
public JSONWriter keySymbolValuePair(String aKey, String aValue) throws JSONException { """ Write a JSON key-value pair in one optimized step that assumes that the key is a symbol composed of normal characters requiring no escaping and asserts that keys are non-null and unique within an object ONLY if asserts are enabled. This method is most suitable in the common case where the caller is making a hard-coded series of calls with the same hard-coded strings for keys. Any sequencing errors can be detected in debug runs with asserts enabled. @param aKey @param aValue @return this @throws JSONException """ assert(aKey != null); assert(m_mode == 'k'); // The key should not have already been seen in this scope. assert(m_scopeStack[m_top].add(aKey)); try { m_writer.write(m_expectingComma ? ",\"" : "\""); m_writer.write(aKey); if (aValue == null) { m_writer.write("\":null"); } else { m_writer.write("\":\""); m_writer.write(JSONObject.quotable(aValue)); m_writer.write('"'); } } catch (IOException e) { throw new JSONException(e); } m_expectingComma = true; return this; }
java
public JSONWriter keySymbolValuePair(String aKey, String aValue) throws JSONException { assert(aKey != null); assert(m_mode == 'k'); // The key should not have already been seen in this scope. assert(m_scopeStack[m_top].add(aKey)); try { m_writer.write(m_expectingComma ? ",\"" : "\""); m_writer.write(aKey); if (aValue == null) { m_writer.write("\":null"); } else { m_writer.write("\":\""); m_writer.write(JSONObject.quotable(aValue)); m_writer.write('"'); } } catch (IOException e) { throw new JSONException(e); } m_expectingComma = true; return this; }
[ "public", "JSONWriter", "keySymbolValuePair", "(", "String", "aKey", ",", "String", "aValue", ")", "throws", "JSONException", "{", "assert", "(", "aKey", "!=", "null", ")", ";", "assert", "(", "m_mode", "==", "'", "'", ")", ";", "// The key should not have already been seen in this scope.", "assert", "(", "m_scopeStack", "[", "m_top", "]", ".", "add", "(", "aKey", ")", ")", ";", "try", "{", "m_writer", ".", "write", "(", "m_expectingComma", "?", "\",\\\"\"", ":", "\"\\\"\"", ")", ";", "m_writer", ".", "write", "(", "aKey", ")", ";", "if", "(", "aValue", "==", "null", ")", "{", "m_writer", ".", "write", "(", "\"\\\":null\"", ")", ";", "}", "else", "{", "m_writer", ".", "write", "(", "\"\\\":\\\"\"", ")", ";", "m_writer", ".", "write", "(", "JSONObject", ".", "quotable", "(", "aValue", ")", ")", ";", "m_writer", ".", "write", "(", "'", "'", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "JSONException", "(", "e", ")", ";", "}", "m_expectingComma", "=", "true", ";", "return", "this", ";", "}" ]
Write a JSON key-value pair in one optimized step that assumes that the key is a symbol composed of normal characters requiring no escaping and asserts that keys are non-null and unique within an object ONLY if asserts are enabled. This method is most suitable in the common case where the caller is making a hard-coded series of calls with the same hard-coded strings for keys. Any sequencing errors can be detected in debug runs with asserts enabled. @param aKey @param aValue @return this @throws JSONException
[ "Write", "a", "JSON", "key", "-", "value", "pair", "in", "one", "optimized", "step", "that", "assumes", "that", "the", "key", "is", "a", "symbol", "composed", "of", "normal", "characters", "requiring", "no", "escaping", "and", "asserts", "that", "keys", "are", "non", "-", "null", "and", "unique", "within", "an", "object", "ONLY", "if", "asserts", "are", "enabled", ".", "This", "method", "is", "most", "suitable", "in", "the", "common", "case", "where", "the", "caller", "is", "making", "a", "hard", "-", "coded", "series", "of", "calls", "with", "the", "same", "hard", "-", "coded", "strings", "for", "keys", ".", "Any", "sequencing", "errors", "can", "be", "detected", "in", "debug", "runs", "with", "asserts", "enabled", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/json_voltpatches/JSONWriter.java#L475-L499
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java
TimeoutImpl.runSyncOnNewThread
public void runSyncOnNewThread(Thread newThread) { """ Restart the timer on a new thread in synchronous mode. <p> In this mode, a timeout only causes the thread to be interrupted, it does not directly set the result of the QueuedFuture. <p> This is needed when doing Retries or Fallback on an async thread. If the result is set directly, then we have no opportunity to handle the exception. """ lock.writeLock().lock(); try { if (this.timeoutTask == null) { throw new IllegalStateException(Tr.formatMessage(tc, "internal.error.CWMFT4999E")); } stop(); this.stopped = false; long remaining = check(); Runnable timeoutTask = () -> { newThread.interrupt(); }; start(timeoutTask, remaining); } finally { lock.writeLock().unlock(); } }
java
public void runSyncOnNewThread(Thread newThread) { lock.writeLock().lock(); try { if (this.timeoutTask == null) { throw new IllegalStateException(Tr.formatMessage(tc, "internal.error.CWMFT4999E")); } stop(); this.stopped = false; long remaining = check(); Runnable timeoutTask = () -> { newThread.interrupt(); }; start(timeoutTask, remaining); } finally { lock.writeLock().unlock(); } }
[ "public", "void", "runSyncOnNewThread", "(", "Thread", "newThread", ")", "{", "lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "this", ".", "timeoutTask", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"internal.error.CWMFT4999E\"", ")", ")", ";", "}", "stop", "(", ")", ";", "this", ".", "stopped", "=", "false", ";", "long", "remaining", "=", "check", "(", ")", ";", "Runnable", "timeoutTask", "=", "(", ")", "->", "{", "newThread", ".", "interrupt", "(", ")", ";", "}", ";", "start", "(", "timeoutTask", ",", "remaining", ")", ";", "}", "finally", "{", "lock", ".", "writeLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}" ]
Restart the timer on a new thread in synchronous mode. <p> In this mode, a timeout only causes the thread to be interrupted, it does not directly set the result of the QueuedFuture. <p> This is needed when doing Retries or Fallback on an async thread. If the result is set directly, then we have no opportunity to handle the exception.
[ "Restart", "the", "timer", "on", "a", "new", "thread", "in", "synchronous", "mode", ".", "<p", ">", "In", "this", "mode", "a", "timeout", "only", "causes", "the", "thread", "to", "be", "interrupted", "it", "does", "not", "directly", "set", "the", "result", "of", "the", "QueuedFuture", ".", "<p", ">", "This", "is", "needed", "when", "doing", "Retries", "or", "Fallback", "on", "an", "async", "thread", ".", "If", "the", "result", "is", "set", "directly", "then", "we", "have", "no", "opportunity", "to", "handle", "the", "exception", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java#L218-L236
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java
Director.installFeatures
public void installFeatures(Collection<String> featureNames, String toExtension, boolean acceptLicense, String userId, String password) throws InstallException { """ Installs the specified features @param featureNames collection of feature names to be installed @param toExtension location of a product extension @param acceptLicense if license is accepted @param userId userId for repository @param password password for repository @throws InstallException """ installFeatures(featureNames, toExtension, acceptLicense, userId, password, 1); }
java
public void installFeatures(Collection<String> featureNames, String toExtension, boolean acceptLicense, String userId, String password) throws InstallException { installFeatures(featureNames, toExtension, acceptLicense, userId, password, 1); }
[ "public", "void", "installFeatures", "(", "Collection", "<", "String", ">", "featureNames", ",", "String", "toExtension", ",", "boolean", "acceptLicense", ",", "String", "userId", ",", "String", "password", ")", "throws", "InstallException", "{", "installFeatures", "(", "featureNames", ",", "toExtension", ",", "acceptLicense", ",", "userId", ",", "password", ",", "1", ")", ";", "}" ]
Installs the specified features @param featureNames collection of feature names to be installed @param toExtension location of a product extension @param acceptLicense if license is accepted @param userId userId for repository @param password password for repository @throws InstallException
[ "Installs", "the", "specified", "features" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java#L258-L260
s1-platform/s1
s1-core/src/java/org/s1/ws/SOAPHelper.java
SOAPHelper.createSoapFromStream
public static SOAPMessage createSoapFromStream(Map<String,String> headers, InputStream is) { """ Create message from stream with headers @param headers @param is @return """ return createSoapFromStream(null,headers,is); }
java
public static SOAPMessage createSoapFromStream(Map<String,String> headers, InputStream is){ return createSoapFromStream(null,headers,is); }
[ "public", "static", "SOAPMessage", "createSoapFromStream", "(", "Map", "<", "String", ",", "String", ">", "headers", ",", "InputStream", "is", ")", "{", "return", "createSoapFromStream", "(", "null", ",", "headers", ",", "is", ")", ";", "}" ]
Create message from stream with headers @param headers @param is @return
[ "Create", "message", "from", "stream", "with", "headers" ]
train
https://github.com/s1-platform/s1/blob/370101c13fef01af524bc171bcc1a97e5acc76e8/s1-core/src/java/org/s1/ws/SOAPHelper.java#L100-L102
inferred/FreeBuilder
src/main/java/org/inferred/freebuilder/processor/source/AnnotationSource.java
AnnotationSource.addSource
public static void addSource(SourceBuilder code, AnnotationMirror annotation) { """ Adds a source-code representation of {@code annotation} to {@code}. """ new ValueSourceAdder(code).visitAnnotation(annotation, null); }
java
public static void addSource(SourceBuilder code, AnnotationMirror annotation) { new ValueSourceAdder(code).visitAnnotation(annotation, null); }
[ "public", "static", "void", "addSource", "(", "SourceBuilder", "code", ",", "AnnotationMirror", "annotation", ")", "{", "new", "ValueSourceAdder", "(", "code", ")", ".", "visitAnnotation", "(", "annotation", ",", "null", ")", ";", "}" ]
Adds a source-code representation of {@code annotation} to {@code}.
[ "Adds", "a", "source", "-", "code", "representation", "of", "{" ]
train
https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/source/AnnotationSource.java#L39-L41
ixa-ehu/kaflib
src/main/java/ixa/kaflib/KAFDocument.java
KAFDocument.newTimex3
public Timex3 newTimex3(String type) { """ Creates a new timeExpressions. It assigns an appropriate ID to it. The Coref is added to the document. @param references different mentions (list of targets) to the same entity. @return a new timex3. """ String newId = idManager.getNextId(AnnotationType.TIMEX3); Timex3 newTimex3 = new Timex3(newId, type); annotationContainer.add(newTimex3, Layer.TIME_EXPRESSIONS, AnnotationType.TIMEX3); return newTimex3; }
java
public Timex3 newTimex3(String type) { String newId = idManager.getNextId(AnnotationType.TIMEX3); Timex3 newTimex3 = new Timex3(newId, type); annotationContainer.add(newTimex3, Layer.TIME_EXPRESSIONS, AnnotationType.TIMEX3); return newTimex3; }
[ "public", "Timex3", "newTimex3", "(", "String", "type", ")", "{", "String", "newId", "=", "idManager", ".", "getNextId", "(", "AnnotationType", ".", "TIMEX3", ")", ";", "Timex3", "newTimex3", "=", "new", "Timex3", "(", "newId", ",", "type", ")", ";", "annotationContainer", ".", "add", "(", "newTimex3", ",", "Layer", ".", "TIME_EXPRESSIONS", ",", "AnnotationType", ".", "TIMEX3", ")", ";", "return", "newTimex3", ";", "}" ]
Creates a new timeExpressions. It assigns an appropriate ID to it. The Coref is added to the document. @param references different mentions (list of targets) to the same entity. @return a new timex3.
[ "Creates", "a", "new", "timeExpressions", ".", "It", "assigns", "an", "appropriate", "ID", "to", "it", ".", "The", "Coref", "is", "added", "to", "the", "document", "." ]
train
https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L790-L795
overturetool/overture
ide/plugins/poviewer/src/main/java/org/overture/ide/plugins/poviewer/view/PoOverviewTableView.java
PoOverviewTableView.createPartControl
@Override public void createPartControl(Composite parent) { """ This is a callback that will allow us to create the viewer and initialize it. """ viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); // test setup columns... TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(20, true)); layout.addColumnData(new ColumnWeightData(30, true)); layout.addColumnData(new ColumnWeightData(50, false)); viewer.getTable().setLayout(layout); viewer.getTable().setLinesVisible(true); viewer.getTable().setHeaderVisible(true); viewer.getTable().setSortDirection(SWT.NONE); viewer.setSorter(null); TableColumn column01 = new TableColumn(viewer.getTable(), SWT.LEFT); column01.setText("No."); column01.setToolTipText("No."); TableColumn column = new TableColumn(viewer.getTable(), SWT.LEFT); column.setText("PO Name"); column.setToolTipText("PO Name"); TableColumn column2 = new TableColumn(viewer.getTable(), SWT.LEFT); column2.setText("Type"); column2.setToolTipText("Show Type"); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); makeActions(); hookDoubleClickAction(); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { Object first = ((IStructuredSelection) event.getSelection()) .getFirstElement(); if (first instanceof ProofObligation) { try { IViewPart v = getSite().getPage().showView( IPoviewerConstants.PoTableViewId); if (v instanceof PoTableView) ((PoTableView) v).setDataList(project, (ProofObligation) first); } catch (PartInitException e) { e.printStackTrace(); } } } }); }
java
@Override public void createPartControl(Composite parent) { viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); // test setup columns... TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(20, true)); layout.addColumnData(new ColumnWeightData(30, true)); layout.addColumnData(new ColumnWeightData(50, false)); viewer.getTable().setLayout(layout); viewer.getTable().setLinesVisible(true); viewer.getTable().setHeaderVisible(true); viewer.getTable().setSortDirection(SWT.NONE); viewer.setSorter(null); TableColumn column01 = new TableColumn(viewer.getTable(), SWT.LEFT); column01.setText("No."); column01.setToolTipText("No."); TableColumn column = new TableColumn(viewer.getTable(), SWT.LEFT); column.setText("PO Name"); column.setToolTipText("PO Name"); TableColumn column2 = new TableColumn(viewer.getTable(), SWT.LEFT); column2.setText("Type"); column2.setToolTipText("Show Type"); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); makeActions(); hookDoubleClickAction(); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { Object first = ((IStructuredSelection) event.getSelection()) .getFirstElement(); if (first instanceof ProofObligation) { try { IViewPart v = getSite().getPage().showView( IPoviewerConstants.PoTableViewId); if (v instanceof PoTableView) ((PoTableView) v).setDataList(project, (ProofObligation) first); } catch (PartInitException e) { e.printStackTrace(); } } } }); }
[ "@", "Override", "public", "void", "createPartControl", "(", "Composite", "parent", ")", "{", "viewer", "=", "new", "TableViewer", "(", "parent", ",", "SWT", ".", "FULL_SELECTION", "|", "SWT", ".", "H_SCROLL", "|", "SWT", ".", "V_SCROLL", ")", ";", "// test setup columns...", "TableLayout", "layout", "=", "new", "TableLayout", "(", ")", ";", "layout", ".", "addColumnData", "(", "new", "ColumnWeightData", "(", "20", ",", "true", ")", ")", ";", "layout", ".", "addColumnData", "(", "new", "ColumnWeightData", "(", "30", ",", "true", ")", ")", ";", "layout", ".", "addColumnData", "(", "new", "ColumnWeightData", "(", "50", ",", "false", ")", ")", ";", "viewer", ".", "getTable", "(", ")", ".", "setLayout", "(", "layout", ")", ";", "viewer", ".", "getTable", "(", ")", ".", "setLinesVisible", "(", "true", ")", ";", "viewer", ".", "getTable", "(", ")", ".", "setHeaderVisible", "(", "true", ")", ";", "viewer", ".", "getTable", "(", ")", ".", "setSortDirection", "(", "SWT", ".", "NONE", ")", ";", "viewer", ".", "setSorter", "(", "null", ")", ";", "TableColumn", "column01", "=", "new", "TableColumn", "(", "viewer", ".", "getTable", "(", ")", ",", "SWT", ".", "LEFT", ")", ";", "column01", ".", "setText", "(", "\"No.\"", ")", ";", "column01", ".", "setToolTipText", "(", "\"No.\"", ")", ";", "TableColumn", "column", "=", "new", "TableColumn", "(", "viewer", ".", "getTable", "(", ")", ",", "SWT", ".", "LEFT", ")", ";", "column", ".", "setText", "(", "\"PO Name\"", ")", ";", "column", ".", "setToolTipText", "(", "\"PO Name\"", ")", ";", "TableColumn", "column2", "=", "new", "TableColumn", "(", "viewer", ".", "getTable", "(", ")", ",", "SWT", ".", "LEFT", ")", ";", "column2", ".", "setText", "(", "\"Type\"", ")", ";", "column2", ".", "setToolTipText", "(", "\"Show Type\"", ")", ";", "viewer", ".", "setContentProvider", "(", "new", "ViewContentProvider", "(", ")", ")", ";", "viewer", ".", "setLabelProvider", "(", "new", "ViewLabelProvider", "(", ")", ")", ";", "makeActions", "(", ")", ";", "hookDoubleClickAction", "(", ")", ";", "viewer", ".", "addSelectionChangedListener", "(", "new", "ISelectionChangedListener", "(", ")", "{", "public", "void", "selectionChanged", "(", "SelectionChangedEvent", "event", ")", "{", "Object", "first", "=", "(", "(", "IStructuredSelection", ")", "event", ".", "getSelection", "(", ")", ")", ".", "getFirstElement", "(", ")", ";", "if", "(", "first", "instanceof", "ProofObligation", ")", "{", "try", "{", "IViewPart", "v", "=", "getSite", "(", ")", ".", "getPage", "(", ")", ".", "showView", "(", "IPoviewerConstants", ".", "PoTableViewId", ")", ";", "if", "(", "v", "instanceof", "PoTableView", ")", "(", "(", "PoTableView", ")", "v", ")", ".", "setDataList", "(", "project", ",", "(", "ProofObligation", ")", "first", ")", ";", "}", "catch", "(", "PartInitException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "}", ")", ";", "}" ]
This is a callback that will allow us to create the viewer and initialize it.
[ "This", "is", "a", "callback", "that", "will", "allow", "us", "to", "create", "the", "viewer", "and", "initialize", "it", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/plugins/poviewer/src/main/java/org/overture/ide/plugins/poviewer/view/PoOverviewTableView.java#L225-L280
openbase/jul
exception/src/main/java/org/openbase/jul/exception/ExceptionProcessor.java
ExceptionProcessor.getInitialCause
public static Throwable getInitialCause(final Throwable throwable) { """ Method returns the initial cause of the given throwable. @param throwable the throwable to detect the message. @return the cause as throwable. """ if (throwable == null) { new FatalImplementationErrorException(ExceptionProcessor.class, new NotAvailableException("cause")); } Throwable cause = throwable; while (cause.getCause() != null) { cause = cause.getCause(); } return cause; }
java
public static Throwable getInitialCause(final Throwable throwable) { if (throwable == null) { new FatalImplementationErrorException(ExceptionProcessor.class, new NotAvailableException("cause")); } Throwable cause = throwable; while (cause.getCause() != null) { cause = cause.getCause(); } return cause; }
[ "public", "static", "Throwable", "getInitialCause", "(", "final", "Throwable", "throwable", ")", "{", "if", "(", "throwable", "==", "null", ")", "{", "new", "FatalImplementationErrorException", "(", "ExceptionProcessor", ".", "class", ",", "new", "NotAvailableException", "(", "\"cause\"", ")", ")", ";", "}", "Throwable", "cause", "=", "throwable", ";", "while", "(", "cause", ".", "getCause", "(", ")", "!=", "null", ")", "{", "cause", "=", "cause", ".", "getCause", "(", ")", ";", "}", "return", "cause", ";", "}" ]
Method returns the initial cause of the given throwable. @param throwable the throwable to detect the message. @return the cause as throwable.
[ "Method", "returns", "the", "initial", "cause", "of", "the", "given", "throwable", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/ExceptionProcessor.java#L59-L69
threerings/nenya
core/src/main/java/com/threerings/util/KeyTranslatorImpl.java
KeyTranslatorImpl.addPressCommand
public void addPressCommand (int keyCode, String command, int rate, long repeatDelay) { """ Adds a mapping from a key press to an action command string that will auto-repeat at the specified repeat rate after the specified auto-repeat delay has expired. Overwrites any existing mapping for the specified key code that may have already been registered. @param rate the number of times each second that the key press should be repeated while the key is down; passing <code>0</code> will result in no repeating. @param repeatDelay the delay in milliseconds before auto-repeating key press events will be generated for the key. """ KeyRecord krec = getKeyRecord(keyCode); krec.pressCommand = command; krec.repeatRate = rate; krec.repeatDelay = repeatDelay; }
java
public void addPressCommand (int keyCode, String command, int rate, long repeatDelay) { KeyRecord krec = getKeyRecord(keyCode); krec.pressCommand = command; krec.repeatRate = rate; krec.repeatDelay = repeatDelay; }
[ "public", "void", "addPressCommand", "(", "int", "keyCode", ",", "String", "command", ",", "int", "rate", ",", "long", "repeatDelay", ")", "{", "KeyRecord", "krec", "=", "getKeyRecord", "(", "keyCode", ")", ";", "krec", ".", "pressCommand", "=", "command", ";", "krec", ".", "repeatRate", "=", "rate", ";", "krec", ".", "repeatDelay", "=", "repeatDelay", ";", "}" ]
Adds a mapping from a key press to an action command string that will auto-repeat at the specified repeat rate after the specified auto-repeat delay has expired. Overwrites any existing mapping for the specified key code that may have already been registered. @param rate the number of times each second that the key press should be repeated while the key is down; passing <code>0</code> will result in no repeating. @param repeatDelay the delay in milliseconds before auto-repeating key press events will be generated for the key.
[ "Adds", "a", "mapping", "from", "a", "key", "press", "to", "an", "action", "command", "string", "that", "will", "auto", "-", "repeat", "at", "the", "specified", "repeat", "rate", "after", "the", "specified", "auto", "-", "repeat", "delay", "has", "expired", ".", "Overwrites", "any", "existing", "mapping", "for", "the", "specified", "key", "code", "that", "may", "have", "already", "been", "registered", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyTranslatorImpl.java#L70-L76
alkacon/opencms-core
src-gwt/org/opencms/ade/publish/client/CmsPublishSelectPanel.java
CmsPublishSelectPanel.setGroups
protected void setGroups(List<CmsPublishGroup> groups, boolean newData) { """ Sets the publish groups.<p> @param groups the list of publish groups @param newData true if the data is new """ m_model = new CmsPublishDataModel(groups, this); m_model.setSelectionChangeAction(new Runnable() { public void run() { onChangePublishSelection(); } }); m_currentGroupIndex = 0; m_currentGroupPanel = null; m_problemsPanel.clear(); if (newData) { m_showProblemsOnly = false; m_checkboxProblems.setChecked(false); m_checkboxProblems.setVisible(false); m_problemsPanel.setVisible(false); } m_groupPanels.clear(); m_groupPanelContainer.clear(); m_scrollPanel.onResizeDescendant(); enableActions(false); int numGroups = groups.size(); setResourcesVisible(numGroups > 0); if (numGroups == 0) { return; } enableActions(true); addMoreListItems(); showProblemCount(m_model.countProblems()); }
java
protected void setGroups(List<CmsPublishGroup> groups, boolean newData) { m_model = new CmsPublishDataModel(groups, this); m_model.setSelectionChangeAction(new Runnable() { public void run() { onChangePublishSelection(); } }); m_currentGroupIndex = 0; m_currentGroupPanel = null; m_problemsPanel.clear(); if (newData) { m_showProblemsOnly = false; m_checkboxProblems.setChecked(false); m_checkboxProblems.setVisible(false); m_problemsPanel.setVisible(false); } m_groupPanels.clear(); m_groupPanelContainer.clear(); m_scrollPanel.onResizeDescendant(); enableActions(false); int numGroups = groups.size(); setResourcesVisible(numGroups > 0); if (numGroups == 0) { return; } enableActions(true); addMoreListItems(); showProblemCount(m_model.countProblems()); }
[ "protected", "void", "setGroups", "(", "List", "<", "CmsPublishGroup", ">", "groups", ",", "boolean", "newData", ")", "{", "m_model", "=", "new", "CmsPublishDataModel", "(", "groups", ",", "this", ")", ";", "m_model", ".", "setSelectionChangeAction", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "onChangePublishSelection", "(", ")", ";", "}", "}", ")", ";", "m_currentGroupIndex", "=", "0", ";", "m_currentGroupPanel", "=", "null", ";", "m_problemsPanel", ".", "clear", "(", ")", ";", "if", "(", "newData", ")", "{", "m_showProblemsOnly", "=", "false", ";", "m_checkboxProblems", ".", "setChecked", "(", "false", ")", ";", "m_checkboxProblems", ".", "setVisible", "(", "false", ")", ";", "m_problemsPanel", ".", "setVisible", "(", "false", ")", ";", "}", "m_groupPanels", ".", "clear", "(", ")", ";", "m_groupPanelContainer", ".", "clear", "(", ")", ";", "m_scrollPanel", ".", "onResizeDescendant", "(", ")", ";", "enableActions", "(", "false", ")", ";", "int", "numGroups", "=", "groups", ".", "size", "(", ")", ";", "setResourcesVisible", "(", "numGroups", ">", "0", ")", ";", "if", "(", "numGroups", "==", "0", ")", "{", "return", ";", "}", "enableActions", "(", "true", ")", ";", "addMoreListItems", "(", ")", ";", "showProblemCount", "(", "m_model", ".", "countProblems", "(", ")", ")", ";", "}" ]
Sets the publish groups.<p> @param groups the list of publish groups @param newData true if the data is new
[ "Sets", "the", "publish", "groups", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/publish/client/CmsPublishSelectPanel.java#L926-L959
blueconic/browscap-java
src/main/java/com/blueconic/browscap/impl/SearchableString.java
Literal.matches
boolean matches(final char[] value, final int from) { """ Checks whether the value represents a complete substring from the from index. @param from The start index of the potential substring @return <code>true</code> If the arguments represent a valid substring, <code>false</code> otherwise. """ // Check the bounds final int len = myCharacters.length; if (len + from > value.length || from < 0) { return false; } // Bounds are ok, check all characters. // Allow question marks to match any character for (int i = 0; i < len; i++) { if (myCharacters[i] != value[i + from] && myCharacters[i] != '?') { return false; } } // All characters match return true; }
java
boolean matches(final char[] value, final int from) { // Check the bounds final int len = myCharacters.length; if (len + from > value.length || from < 0) { return false; } // Bounds are ok, check all characters. // Allow question marks to match any character for (int i = 0; i < len; i++) { if (myCharacters[i] != value[i + from] && myCharacters[i] != '?') { return false; } } // All characters match return true; }
[ "boolean", "matches", "(", "final", "char", "[", "]", "value", ",", "final", "int", "from", ")", "{", "// Check the bounds", "final", "int", "len", "=", "myCharacters", ".", "length", ";", "if", "(", "len", "+", "from", ">", "value", ".", "length", "||", "from", "<", "0", ")", "{", "return", "false", ";", "}", "// Bounds are ok, check all characters.", "// Allow question marks to match any character", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "if", "(", "myCharacters", "[", "i", "]", "!=", "value", "[", "i", "+", "from", "]", "&&", "myCharacters", "[", "i", "]", "!=", "'", "'", ")", "{", "return", "false", ";", "}", "}", "// All characters match", "return", "true", ";", "}" ]
Checks whether the value represents a complete substring from the from index. @param from The start index of the potential substring @return <code>true</code> If the arguments represent a valid substring, <code>false</code> otherwise.
[ "Checks", "whether", "the", "value", "represents", "a", "complete", "substring", "from", "the", "from", "index", "." ]
train
https://github.com/blueconic/browscap-java/blob/c0dbd1741d32628c560dcf6eb995bdeba0725cd9/src/main/java/com/blueconic/browscap/impl/SearchableString.java#L248-L266
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
HttpContext.executePostRequest
protected <T> Optional<T> executePostRequest(URI uri, Object obj, GenericType<T> returnType) { """ Execute a POST request with a return object. @param <T> The type parameter used for the return object @param uri The URI to call @param obj The object to use for the POST @param returnType The type to marshall the result back into @return The return type """ return executePostRequest(uri, obj, null, returnType); }
java
protected <T> Optional<T> executePostRequest(URI uri, Object obj, GenericType<T> returnType) { return executePostRequest(uri, obj, null, returnType); }
[ "protected", "<", "T", ">", "Optional", "<", "T", ">", "executePostRequest", "(", "URI", "uri", ",", "Object", "obj", ",", "GenericType", "<", "T", ">", "returnType", ")", "{", "return", "executePostRequest", "(", "uri", ",", "obj", ",", "null", ",", "returnType", ")", ";", "}" ]
Execute a POST request with a return object. @param <T> The type parameter used for the return object @param uri The URI to call @param obj The object to use for the POST @param returnType The type to marshall the result back into @return The return type
[ "Execute", "a", "POST", "request", "with", "a", "return", "object", "." ]
train
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L447-L450
terrestris/shogun-core
src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java
HttpUtil.forwardGet
public static Response forwardGet(URI uri, HttpServletRequest request, boolean forwardHeaders) throws URISyntaxException, HttpException { """ Forward GET request to uri based on given request @param uri uri The URI to forward to. @param request The original {@link HttpServletRequest} @param forwardHeaders Should headers of request should be forwarded @return The HTTP response as Response object. @throws URISyntaxException @throws HttpException """ Header[] headersToForward = null; if (request != null && forwardHeaders) { headersToForward = HttpUtil.getHeadersFromRequest(request); } return send(new HttpGet(uri), null, headersToForward); }
java
public static Response forwardGet(URI uri, HttpServletRequest request, boolean forwardHeaders) throws URISyntaxException, HttpException { Header[] headersToForward = null; if (request != null && forwardHeaders) { headersToForward = HttpUtil.getHeadersFromRequest(request); } return send(new HttpGet(uri), null, headersToForward); }
[ "public", "static", "Response", "forwardGet", "(", "URI", "uri", ",", "HttpServletRequest", "request", ",", "boolean", "forwardHeaders", ")", "throws", "URISyntaxException", ",", "HttpException", "{", "Header", "[", "]", "headersToForward", "=", "null", ";", "if", "(", "request", "!=", "null", "&&", "forwardHeaders", ")", "{", "headersToForward", "=", "HttpUtil", ".", "getHeadersFromRequest", "(", "request", ")", ";", "}", "return", "send", "(", "new", "HttpGet", "(", "uri", ")", ",", "null", ",", "headersToForward", ")", ";", "}" ]
Forward GET request to uri based on given request @param uri uri The URI to forward to. @param request The original {@link HttpServletRequest} @param forwardHeaders Should headers of request should be forwarded @return The HTTP response as Response object. @throws URISyntaxException @throws HttpException
[ "Forward", "GET", "request", "to", "uri", "based", "on", "given", "request" ]
train
https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L281-L291
gallandarakhneorg/afc
advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java
BusNetwork.getNearestBusStop
@Pure public final BusStop getNearestBusStop(Point2D<?, ?> point) { """ Replies the nearest bus stop to the given point. @param point the point. @return the nearest bus stop or <code>null</code> if none was found. """ return getNearestBusStop(point.getX(), point.getY()); }
java
@Pure public final BusStop getNearestBusStop(Point2D<?, ?> point) { return getNearestBusStop(point.getX(), point.getY()); }
[ "@", "Pure", "public", "final", "BusStop", "getNearestBusStop", "(", "Point2D", "<", "?", ",", "?", ">", "point", ")", "{", "return", "getNearestBusStop", "(", "point", ".", "getX", "(", ")", ",", "point", ".", "getY", "(", ")", ")", ";", "}" ]
Replies the nearest bus stop to the given point. @param point the point. @return the nearest bus stop or <code>null</code> if none was found.
[ "Replies", "the", "nearest", "bus", "stop", "to", "the", "given", "point", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L1005-L1008
eclipse/hawkbit
hawkbit-security-integration/src/main/java/org/eclipse/hawkbit/security/DmfTenantSecurityToken.java
DmfTenantSecurityToken.putHeader
public String putHeader(final String name, final String value) { """ Associates the specified header value with the specified name. @param name of the header @param value of the header @return the previous value associated with the <tt>name</tt>, or <tt>null</tt> if there was no mapping for <tt>name</tt>. """ if (headers == null) { headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); } return headers.put(name, value); }
java
public String putHeader(final String name, final String value) { if (headers == null) { headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); } return headers.put(name, value); }
[ "public", "String", "putHeader", "(", "final", "String", "name", ",", "final", "String", "value", ")", "{", "if", "(", "headers", "==", "null", ")", "{", "headers", "=", "new", "TreeMap", "<>", "(", "String", ".", "CASE_INSENSITIVE_ORDER", ")", ";", "}", "return", "headers", ".", "put", "(", "name", ",", "value", ")", ";", "}" ]
Associates the specified header value with the specified name. @param name of the header @param value of the header @return the previous value associated with the <tt>name</tt>, or <tt>null</tt> if there was no mapping for <tt>name</tt>.
[ "Associates", "the", "specified", "header", "value", "with", "the", "specified", "name", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-security-integration/src/main/java/org/eclipse/hawkbit/security/DmfTenantSecurityToken.java#L163-L168