repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.orNotEqual
public ZealotKhala orNotEqual(String field, Object value) { return this.doNormal(ZealotConst.OR_PREFIX, field, value, ZealotConst.NOT_EQUAL_SUFFIX, true); }
java
public ZealotKhala orNotEqual(String field, Object value) { return this.doNormal(ZealotConst.OR_PREFIX, field, value, ZealotConst.NOT_EQUAL_SUFFIX, true); }
[ "public", "ZealotKhala", "orNotEqual", "(", "String", "field", ",", "Object", "value", ")", "{", "return", "this", ".", "doNormal", "(", "ZealotConst", ".", "OR_PREFIX", ",", "field", ",", "value", ",", "ZealotConst", ".", "NOT_EQUAL_SUFFIX", ",", "true", ")...
生成带" OR "前缀不等查询的SQL片段. @param field 数据库字段 @param value 值 @return ZealotKhala实例
[ "生成带", "OR", "前缀不等查询的SQL片段", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L627-L629
samskivert/samskivert
src/main/java/com/samskivert/util/PrefsConfig.java
PrefsConfig.setValue
public void setValue (String name, long value) { Long oldValue = null; if (_prefs.get(name, null) != null || _props.getProperty(name) != null) { oldValue = Long.valueOf(_prefs.getLong(name, super.getValue(name, 0L))); } _prefs.putLong(name, value); _propsup.firePropertyChange(name, oldValue, Long.valueOf(value)); }
java
public void setValue (String name, long value) { Long oldValue = null; if (_prefs.get(name, null) != null || _props.getProperty(name) != null) { oldValue = Long.valueOf(_prefs.getLong(name, super.getValue(name, 0L))); } _prefs.putLong(name, value); _propsup.firePropertyChange(name, oldValue, Long.valueOf(value)); }
[ "public", "void", "setValue", "(", "String", "name", ",", "long", "value", ")", "{", "Long", "oldValue", "=", "null", ";", "if", "(", "_prefs", ".", "get", "(", "name", ",", "null", ")", "!=", "null", "||", "_props", ".", "getProperty", "(", "name", ...
Sets the value of the specified preference, overriding the value defined in the configuration files shipped with the application.
[ "Sets", "the", "value", "of", "the", "specified", "preference", "overriding", "the", "value", "defined", "in", "the", "configuration", "files", "shipped", "with", "the", "application", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/PrefsConfig.java#L84-L93
networknt/light-4j
client/src/main/java/com/networknt/client/oauth/cache/LongestExpireCacheStrategy.java
LongestExpireCacheStrategy.cacheJwt
@Override public synchronized void cacheJwt(Jwt.Key cachedKey, Jwt jwt) { //update the expire time LongestExpireCacheKey leCachKey = new LongestExpireCacheKey(cachedKey); leCachKey.setExpiry(jwt.getExpire()); if(cachedJwts.size() >= capacity) { if(expiryQueue.contains(leCachKey)) { expiryQueue.remove(leCachKey); } else { cachedJwts.remove(expiryQueue.peek().getCacheKey()); expiryQueue.poll(); } } else { if(expiryQueue.contains(leCachKey)) { expiryQueue.remove(leCachKey); } } expiryQueue.add(leCachKey); cachedJwts.put(cachedKey, jwt); }
java
@Override public synchronized void cacheJwt(Jwt.Key cachedKey, Jwt jwt) { //update the expire time LongestExpireCacheKey leCachKey = new LongestExpireCacheKey(cachedKey); leCachKey.setExpiry(jwt.getExpire()); if(cachedJwts.size() >= capacity) { if(expiryQueue.contains(leCachKey)) { expiryQueue.remove(leCachKey); } else { cachedJwts.remove(expiryQueue.peek().getCacheKey()); expiryQueue.poll(); } } else { if(expiryQueue.contains(leCachKey)) { expiryQueue.remove(leCachKey); } } expiryQueue.add(leCachKey); cachedJwts.put(cachedKey, jwt); }
[ "@", "Override", "public", "synchronized", "void", "cacheJwt", "(", "Jwt", ".", "Key", "cachedKey", ",", "Jwt", "jwt", ")", "{", "//update the expire time", "LongestExpireCacheKey", "leCachKey", "=", "new", "LongestExpireCacheKey", "(", "cachedKey", ")", ";", "leC...
This method is to cache a jwt LongestExpireCacheStrategy based on a given Jwt.Key and a Jwt. Every time it updates the expiry time of a jwt, and shift it up to a proper position. Since the PriorityQueue is implemented by heap, the average O(n) should be O(log n). @param cachedKey Jwt.Key the key to be used to cache @param jwt Jwt the jwt to be cached
[ "This", "method", "is", "to", "cache", "a", "jwt", "LongestExpireCacheStrategy", "based", "on", "a", "given", "Jwt", ".", "Key", "and", "a", "Jwt", ".", "Every", "time", "it", "updates", "the", "expiry", "time", "of", "a", "jwt", "and", "shift", "it", ...
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/cache/LongestExpireCacheStrategy.java#L45-L64
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectIntersectionOfImpl_CustomFieldSerializer.java
OWLObjectIntersectionOfImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectIntersectionOfImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectIntersectionOfImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLObjectIntersectionOfImpl", "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/OWLObjectIntersectionOfImpl_CustomFieldSerializer.java#L70-L73
jakenjarvis/Android-OrmLiteContentProvider
ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherPattern.java
MatcherPattern.setContentMimeTypeVnd
public MatcherPattern setContentMimeTypeVnd(String name, String type) { return this.setContentMimeTypeVnd(new ContentMimeTypeVndInfo(name, type)); }
java
public MatcherPattern setContentMimeTypeVnd(String name, String type) { return this.setContentMimeTypeVnd(new ContentMimeTypeVndInfo(name, type)); }
[ "public", "MatcherPattern", "setContentMimeTypeVnd", "(", "String", "name", ",", "String", "type", ")", "{", "return", "this", ".", "setContentMimeTypeVnd", "(", "new", "ContentMimeTypeVndInfo", "(", "name", ",", "type", ")", ")", ";", "}" ]
Set the MIME types. This is used when you are not using the DefaultContentMimeTypeVnd annotation, or want to override the setting of the DefaultContentMimeTypeVnd annotation. This method can not be called after MatcherController#hasPreinitialized(). @see com.tojc.ormlite.android.annotation.AdditionalAnnotation.DefaultContentMimeTypeVnd @see com.tojc.ormlite.android.framework.MatcherController#hasPreinitialized() @param name @param type @return Instance of the MatcherPattern class.
[ "Set", "the", "MIME", "types", ".", "This", "is", "used", "when", "you", "are", "not", "using", "the", "DefaultContentMimeTypeVnd", "annotation", "or", "want", "to", "override", "the", "setting", "of", "the", "DefaultContentMimeTypeVnd", "annotation", ".", "This...
train
https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherPattern.java#L189-L191
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionRendererModel.java
MapTileCollisionRendererModel.renderY
private static void renderY(Graphic g, CollisionFunction function, CollisionRange range, int th, int x) { if (UtilMath.isBetween(x, range.getMinX(), range.getMaxX())) { g.drawRect(x, th - function.getRenderY(x) - 1, 0, 0, false); } }
java
private static void renderY(Graphic g, CollisionFunction function, CollisionRange range, int th, int x) { if (UtilMath.isBetween(x, range.getMinX(), range.getMaxX())) { g.drawRect(x, th - function.getRenderY(x) - 1, 0, 0, false); } }
[ "private", "static", "void", "renderY", "(", "Graphic", "g", ",", "CollisionFunction", "function", ",", "CollisionRange", "range", ",", "int", "th", ",", "int", "x", ")", "{", "if", "(", "UtilMath", ".", "isBetween", "(", "x", ",", "range", ".", "getMinX...
Render vertical collision from current vector. @param g The graphic buffer. @param function The collision function. @param range The collision range. @param th The tile height. @param x The current horizontal location.
[ "Render", "vertical", "collision", "from", "current", "vector", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionRendererModel.java#L131-L137
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/JsonRpcUtils.java
JsonRpcUtils.buildResponse
public static JsonNode buildResponse(int status, String message, Object data) { return SerializationUtils.toJson(MapUtils.removeNulls(MapUtils.createMap(FIELD_STATUS, status, FIELD_MESSAGE, message, FIELD_DATA, data))); }
java
public static JsonNode buildResponse(int status, String message, Object data) { return SerializationUtils.toJson(MapUtils.removeNulls(MapUtils.createMap(FIELD_STATUS, status, FIELD_MESSAGE, message, FIELD_DATA, data))); }
[ "public", "static", "JsonNode", "buildResponse", "(", "int", "status", ",", "String", "message", ",", "Object", "data", ")", "{", "return", "SerializationUtils", ".", "toJson", "(", "MapUtils", ".", "removeNulls", "(", "MapUtils", ".", "createMap", "(", "FIELD...
Build Json-RPC's response in JSON format. <p> Json-RPC response as the following format: </p> <pre> { "status" : (int) response status/error code, "message": (string) response message, "data" : (object) response data } </pre> @param status @param message @param data @return
[ "Build", "Json", "-", "RPC", "s", "response", "in", "JSON", "format", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/JsonRpcUtils.java#L42-L45
Stratio/stratio-cassandra
src/java/org/apache/cassandra/hadoop/ConfigHelper.java
ConfigHelper.setInputColumnFamily
public static void setInputColumnFamily(Configuration conf, String keyspace, String columnFamily, boolean widerows) { if (keyspace == null) throw new UnsupportedOperationException("keyspace may not be null"); if (columnFamily == null) throw new UnsupportedOperationException("columnfamily may not be null"); conf.set(INPUT_KEYSPACE_CONFIG, keyspace); conf.set(INPUT_COLUMNFAMILY_CONFIG, columnFamily); conf.set(INPUT_WIDEROWS_CONFIG, String.valueOf(widerows)); }
java
public static void setInputColumnFamily(Configuration conf, String keyspace, String columnFamily, boolean widerows) { if (keyspace == null) throw new UnsupportedOperationException("keyspace may not be null"); if (columnFamily == null) throw new UnsupportedOperationException("columnfamily may not be null"); conf.set(INPUT_KEYSPACE_CONFIG, keyspace); conf.set(INPUT_COLUMNFAMILY_CONFIG, columnFamily); conf.set(INPUT_WIDEROWS_CONFIG, String.valueOf(widerows)); }
[ "public", "static", "void", "setInputColumnFamily", "(", "Configuration", "conf", ",", "String", "keyspace", ",", "String", "columnFamily", ",", "boolean", "widerows", ")", "{", "if", "(", "keyspace", "==", "null", ")", "throw", "new", "UnsupportedOperationExcepti...
Set the keyspace and column family for the input of this job. @param conf Job configuration you are about to run @param keyspace @param columnFamily @param widerows
[ "Set", "the", "keyspace", "and", "column", "family", "for", "the", "input", "of", "this", "job", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/ConfigHelper.java#L83-L94
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/BucketTimer.java
BucketTimer.get
public static BucketTimer get(Registry registry, Id id, BucketFunction f) { return new BucketTimer( com.netflix.spectator.api.histogram.BucketTimer.get(registry, id, f)); }
java
public static BucketTimer get(Registry registry, Id id, BucketFunction f) { return new BucketTimer( com.netflix.spectator.api.histogram.BucketTimer.get(registry, id, f)); }
[ "public", "static", "BucketTimer", "get", "(", "Registry", "registry", ",", "Id", "id", ",", "BucketFunction", "f", ")", "{", "return", "new", "BucketTimer", "(", "com", ".", "netflix", ".", "spectator", ".", "api", ".", "histogram", ".", "BucketTimer", "....
Creates a timer object that manages a set of timers based on the bucket function supplied. Calling record will be mapped to the record on the appropriate timer. @param registry Registry to use. @param id Identifier for the metric being registered. @param f Function to map values to buckets. @return Timer that manages sub-timers based on the bucket function.
[ "Creates", "a", "timer", "object", "that", "manages", "a", "set", "of", "timers", "based", "on", "the", "bucket", "function", "supplied", ".", "Calling", "record", "will", "be", "mapped", "to", "the", "record", "on", "the", "appropriate", "timer", "." ]
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/BucketTimer.java#L63-L66
redkale/redkale
src/org/redkale/net/http/WebSocket.java
WebSocket.sendMap
public final CompletableFuture<Integer> sendMap(boolean last, Object... messages) { return send(true, messages, last); }
java
public final CompletableFuture<Integer> sendMap(boolean last, Object... messages) { return send(true, messages, last); }
[ "public", "final", "CompletableFuture", "<", "Integer", ">", "sendMap", "(", "boolean", "last", ",", "Object", "...", "messages", ")", "{", "return", "send", "(", "true", ",", "messages", ",", "last", ")", ";", "}" ]
给自身发送消息, 消息类型是key-value键值对 @param last 是否最后一条 @param messages key-value键值对 @return 0表示成功, 非0表示错误码
[ "给自身发送消息", "消息类型是key", "-", "value键值对" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/WebSocket.java#L174-L176
jmeetsma/Iglu-Http
src/main/java/org/ijsberg/iglu/util/http/ServletSupport.java
ServletSupport.getCookieValue
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; }
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...
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
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 { 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
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) { 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", "(", "vaultBa...
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
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.NTFLambdaPhi_NTFLambert
@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); }
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", "lamb...
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
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) { 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", ...
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
quattor/pan
panc/src/main/java/org/quattor/pan/dml/DML.java
DML.getUnoptimizedInstance
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); }
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", "<", "Ope...
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
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) { 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", ")", "...
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
alexxiyang/jdbctemplatetool
src/main/java/org/crazycake/jdbcTemplateTool/utils/ModelSqlUtils.java
ModelSqlUtils.getColumnNameFromGetter
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; }
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"...
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
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/NodeAuditAnalyzer.java
NodeAuditAnalyzer.prepareFileTypeAnalyzer
@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); } }
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", "N...
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
openbase/jul
exception/src/main/java/org/openbase/jul/exception/ExceptionProcessor.java
ExceptionProcessor.getInitialCause
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; }
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", "NotAvailableExcept...
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
fuinorg/utils4j
src/main/java/org/fuin/utils4j/Utils4J.java
Utils4J.decryptPasswordBased
public static byte[] decryptPasswordBased(final String algorithm, final byte[] encryptedData, final char[] password, final byte[] salt, final int count) { checkNotNull("algorithm", algorithm); checkNotNull("encryptedData", encryptedData); checkNotNull("password", password); checkNotNull("salt", salt); try { final Cipher cipher = createCipher(algorithm, Cipher.DECRYPT_MODE, password, salt, count); return cipher.doFinal(encryptedData); } catch (final Exception ex) { throw new RuntimeException("Error decrypting the password!", ex); } }
java
public static byte[] decryptPasswordBased(final String algorithm, final byte[] encryptedData, final char[] password, final byte[] salt, final int count) { checkNotNull("algorithm", algorithm); checkNotNull("encryptedData", encryptedData); checkNotNull("password", password); checkNotNull("salt", salt); try { final Cipher cipher = createCipher(algorithm, Cipher.DECRYPT_MODE, password, salt, count); return cipher.doFinal(encryptedData); } catch (final Exception ex) { throw new RuntimeException("Error decrypting the password!", ex); } }
[ "public", "static", "byte", "[", "]", "decryptPasswordBased", "(", "final", "String", "algorithm", ",", "final", "byte", "[", "]", "encryptedData", ",", "final", "char", "[", "]", "password", ",", "final", "byte", "[", "]", "salt", ",", "final", "int", "...
Decrypts some data based on a password. @param algorithm PBE algorithm like "PBEWithMD5AndDES" or "PBEWithMD5AndTripleDES" - Cannot be <code>null</code>. @param encryptedData Data to decrypt - Cannot be <code>null</code>. @param password Password - Cannot be <code>null</code>. @param salt Salt usable with algorithm - Cannot be <code>null</code>. @param count Iterations. @return Encrypted data.
[ "Decrypts", "some", "data", "based", "on", "a", "password", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L444-L458
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/variant/css/CssSkinGenerator.java
CssSkinGenerator.getSkinRootDir
public String getSkinRootDir(String path, Set<String> skinRootDirs) { String skinRootDir = null; for (String skinDir : skinRootDirs) { if (path.startsWith(skinDir)) { skinRootDir = skinDir; } } return skinRootDir; }
java
public String getSkinRootDir(String path, Set<String> skinRootDirs) { String skinRootDir = null; for (String skinDir : skinRootDirs) { if (path.startsWith(skinDir)) { skinRootDir = skinDir; } } return skinRootDir; }
[ "public", "String", "getSkinRootDir", "(", "String", "path", ",", "Set", "<", "String", ">", "skinRootDirs", ")", "{", "String", "skinRootDir", "=", "null", ";", "for", "(", "String", "skinDir", ":", "skinRootDirs", ")", "{", "if", "(", "path", ".", "sta...
Returns the skin root dir of the path given in parameter @param path the resource path @param skinRootDirs the set of skin root directories @return the skin root dir
[ "Returns", "the", "skin", "root", "dir", "of", "the", "path", "given", "in", "parameter" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/variant/css/CssSkinGenerator.java#L482-L490
ReactiveX/RxJavaFX
src/main/java/io/reactivex/rxjavafx/transformers/FxObservableTransformers.java
FxObservableTransformers.doOnErrorCount
public static <T> ObservableTransformer<T,T> doOnErrorCount(Consumer<Integer> onError) { return obs -> obs.lift(new OperatorEmissionCounter<>(new CountObserver(null,null,onError))); }
java
public static <T> ObservableTransformer<T,T> doOnErrorCount(Consumer<Integer> onError) { return obs -> obs.lift(new OperatorEmissionCounter<>(new CountObserver(null,null,onError))); }
[ "public", "static", "<", "T", ">", "ObservableTransformer", "<", "T", ",", "T", ">", "doOnErrorCount", "(", "Consumer", "<", "Integer", ">", "onError", ")", "{", "return", "obs", "->", "obs", ".", "lift", "(", "new", "OperatorEmissionCounter", "<>", "(", ...
Performs an action on onError with the provided emission count @param onError @param <T>
[ "Performs", "an", "action", "on", "onError", "with", "the", "provided", "emission", "count" ]
train
https://github.com/ReactiveX/RxJavaFX/blob/8f44d4cc1caba9a8919f01cb1897aaea5514c7e5/src/main/java/io/reactivex/rxjavafx/transformers/FxObservableTransformers.java#L131-L133
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toXML
public static Node toXML(Object value, Node defaultValue) { try { return toXML(value); } catch (PageException e) { return defaultValue; } }
java
public static Node toXML(Object value, Node defaultValue) { try { return toXML(value); } catch (PageException e) { return defaultValue; } }
[ "public", "static", "Node", "toXML", "(", "Object", "value", ",", "Node", "defaultValue", ")", "{", "try", "{", "return", "toXML", "(", "value", ")", ";", "}", "catch", "(", "PageException", "e", ")", "{", "return", "defaultValue", ";", "}", "}" ]
cast Object to a XML Node @param value @param defaultValue @return XML Node
[ "cast", "Object", "to", "a", "XML", "Node" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L4442-L4449
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/cpptasks/apple/PropertyListSerialization.java
PropertyListSerialization.serializeBoolean
private static void serializeBoolean(final Boolean val, final ContentHandler handler) throws SAXException { String tag = "false"; if (val.booleanValue()) { tag = "true"; } final AttributesImpl attributes = new AttributesImpl(); handler.startElement(null, tag, tag, attributes); handler.endElement(null, tag, tag); }
java
private static void serializeBoolean(final Boolean val, final ContentHandler handler) throws SAXException { String tag = "false"; if (val.booleanValue()) { tag = "true"; } final AttributesImpl attributes = new AttributesImpl(); handler.startElement(null, tag, tag, attributes); handler.endElement(null, tag, tag); }
[ "private", "static", "void", "serializeBoolean", "(", "final", "Boolean", "val", ",", "final", "ContentHandler", "handler", ")", "throws", "SAXException", "{", "String", "tag", "=", "\"false\"", ";", "if", "(", "val", ".", "booleanValue", "(", ")", ")", "{",...
Serialize a Boolean as a true or false element. @param val boolean to serialize. @param handler destination of serialization events. @throws SAXException if exception during serialization.
[ "Serialize", "a", "Boolean", "as", "a", "true", "or", "false", "element", "." ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/apple/PropertyListSerialization.java#L91-L99
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java
DeploymentOperations.addDeployOperationStep
static void addDeployOperationStep(final CompositeOperationBuilder builder, final DeploymentDescription deployment) { final String name = deployment.getName(); final Set<String> serverGroups = deployment.getServerGroups(); // If the server groups are empty this is a standalone deployment if (serverGroups.isEmpty()) { final ModelNode address = createAddress(DEPLOYMENT, name); builder.addStep(createOperation(DEPLOYMENT_DEPLOY_OPERATION, address)); } else { for (String serverGroup : serverGroups) { final ModelNode address = createAddress(SERVER_GROUP, serverGroup, DEPLOYMENT, name); builder.addStep(createOperation(DEPLOYMENT_DEPLOY_OPERATION, address)); } } }
java
static void addDeployOperationStep(final CompositeOperationBuilder builder, final DeploymentDescription deployment) { final String name = deployment.getName(); final Set<String> serverGroups = deployment.getServerGroups(); // If the server groups are empty this is a standalone deployment if (serverGroups.isEmpty()) { final ModelNode address = createAddress(DEPLOYMENT, name); builder.addStep(createOperation(DEPLOYMENT_DEPLOY_OPERATION, address)); } else { for (String serverGroup : serverGroups) { final ModelNode address = createAddress(SERVER_GROUP, serverGroup, DEPLOYMENT, name); builder.addStep(createOperation(DEPLOYMENT_DEPLOY_OPERATION, address)); } } }
[ "static", "void", "addDeployOperationStep", "(", "final", "CompositeOperationBuilder", "builder", ",", "final", "DeploymentDescription", "deployment", ")", "{", "final", "String", "name", "=", "deployment", ".", "getName", "(", ")", ";", "final", "Set", "<", "Stri...
Adds the deploy operation as a step to the composite operation. @param builder the builder to add the step to @param deployment the deployment to deploy
[ "Adds", "the", "deploy", "operation", "as", "a", "step", "to", "the", "composite", "operation", "." ]
train
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java#L336-L350
restfb/restfb
src/main/java/com/restfb/util/ReflectionUtils.java
ReflectionUtils.getAccessors
public static List<Method> getAccessors(Class<?> clazz) { if (clazz == null) { throw new IllegalArgumentException("The 'clazz' parameter cannot be null."); } List<Method> methods = new ArrayList<>(); for (Method method : clazz.getMethods()) { String methodName = method.getName(); if (!"getClass".equals(methodName) && !"hashCode".equals(methodName) && method.getReturnType() != null && !Void.class.equals(method.getReturnType()) && method.getParameterTypes().length == 0 && ((methodName.startsWith("get") && methodName.length() > 3) || (methodName.startsWith("is") && methodName.length() > 2) || (methodName.startsWith("has") && methodName.length() > 3))) { methods.add(method); } } // Order the methods alphabetically by name sort(methods, new Comparator<Method>() { /** * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ @Override public int compare(Method method1, Method method2) { return method1.getName().compareTo(method2.getName()); } }); return unmodifiableList(methods); }
java
public static List<Method> getAccessors(Class<?> clazz) { if (clazz == null) { throw new IllegalArgumentException("The 'clazz' parameter cannot be null."); } List<Method> methods = new ArrayList<>(); for (Method method : clazz.getMethods()) { String methodName = method.getName(); if (!"getClass".equals(methodName) && !"hashCode".equals(methodName) && method.getReturnType() != null && !Void.class.equals(method.getReturnType()) && method.getParameterTypes().length == 0 && ((methodName.startsWith("get") && methodName.length() > 3) || (methodName.startsWith("is") && methodName.length() > 2) || (methodName.startsWith("has") && methodName.length() > 3))) { methods.add(method); } } // Order the methods alphabetically by name sort(methods, new Comparator<Method>() { /** * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ @Override public int compare(Method method1, Method method2) { return method1.getName().compareTo(method2.getName()); } }); return unmodifiableList(methods); }
[ "public", "static", "List", "<", "Method", ">", "getAccessors", "(", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "clazz", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The 'clazz' parameter cannot be null.\"", ")", ";", ...
Gets all accessor methods for the given {@code clazz}. @param clazz The class for which accessors are extracted. @return All accessor methods for the given {@code clazz}.
[ "Gets", "all", "accessor", "methods", "for", "the", "given", "{", "@code", "clazz", "}", "." ]
train
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/ReflectionUtils.java#L217-L246
grandstaish/paperparcel
paperparcel-compiler/src/main/java/paperparcel/Utils.java
Utils.getAnnotationWithSimpleName
@Nullable static AnnotationMirror getAnnotationWithSimpleName(Element element, String name) { for (AnnotationMirror mirror : element.getAnnotationMirrors()) { String annotationName = mirror.getAnnotationType().asElement().getSimpleName().toString(); if (name.equals(annotationName)) { return mirror; } } return null; }
java
@Nullable static AnnotationMirror getAnnotationWithSimpleName(Element element, String name) { for (AnnotationMirror mirror : element.getAnnotationMirrors()) { String annotationName = mirror.getAnnotationType().asElement().getSimpleName().toString(); if (name.equals(annotationName)) { return mirror; } } return null; }
[ "@", "Nullable", "static", "AnnotationMirror", "getAnnotationWithSimpleName", "(", "Element", "element", ",", "String", "name", ")", "{", "for", "(", "AnnotationMirror", "mirror", ":", "element", ".", "getAnnotationMirrors", "(", ")", ")", "{", "String", "annotati...
Finds an annotation with the given name on the given element, or null if not found.
[ "Finds", "an", "annotation", "with", "the", "given", "name", "on", "the", "given", "element", "or", "null", "if", "not", "found", "." ]
train
https://github.com/grandstaish/paperparcel/blob/917686ced81b335b6708d81d6cc0e3e496f7280d/paperparcel-compiler/src/main/java/paperparcel/Utils.java#L684-L692
zamrokk/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/shim/ChaincodeStub.java
ChaincodeStub.putState
public void putState(String key, String value) { handler.handlePutState(key, ByteString.copyFromUtf8(value), uuid); }
java
public void putState(String key, String value) { handler.handlePutState(key, ByteString.copyFromUtf8(value), uuid); }
[ "public", "void", "putState", "(", "String", "key", ",", "String", "value", ")", "{", "handler", ".", "handlePutState", "(", "key", ",", "ByteString", ".", "copyFromUtf8", "(", "value", ")", ",", "uuid", ")", ";", "}" ]
Puts the given state into a ledger, automatically wrapping it in a ByteString @param key reference key @param value value to be put
[ "Puts", "the", "given", "state", "into", "a", "ledger", "automatically", "wrapping", "it", "in", "a", "ByteString" ]
train
https://github.com/zamrokk/fabric-sdk-java/blob/d4993ca602f72d412cd682e1b92e805e48b27afa/src/main/java/org/hyperledger/fabric/sdk/shim/ChaincodeStub.java#L72-L74
motown-io/motown
utils/rest/src/main/java/io/motown/utils/rest/response/ResponseBuilder.java
ResponseBuilder.getPreviousPageOffset
private static int getPreviousPageOffset(final int offset, final int limit) { return hasFullPreviousPage(offset, limit) ? getPreviousFullPageOffset(offset, limit) : getFirstPageOffset(); }
java
private static int getPreviousPageOffset(final int offset, final int limit) { return hasFullPreviousPage(offset, limit) ? getPreviousFullPageOffset(offset, limit) : getFirstPageOffset(); }
[ "private", "static", "int", "getPreviousPageOffset", "(", "final", "int", "offset", ",", "final", "int", "limit", ")", "{", "return", "hasFullPreviousPage", "(", "offset", ",", "limit", ")", "?", "getPreviousFullPageOffset", "(", "offset", ",", "limit", ")", "...
Gets the previous page offset. @param offset the current offset. @param limit the limit. @return the previous page offset.
[ "Gets", "the", "previous", "page", "offset", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/utils/rest/src/main/java/io/motown/utils/rest/response/ResponseBuilder.java#L92-L94
jayantk/jklol
src/com/jayantkrish/jklol/ccg/lambda2/TypeReplacement.java
TypeReplacement.add
public void add(int var, Type t) { Set<Integer> tVars = t.getTypeVariables(); Set<Integer> intersection = Sets.intersection(tVars, bindings.keySet()); Preconditions.checkArgument(intersection.size() == 0, "Tried to replace %s with %s, but already have bindings for %s", var, t, intersection); Preconditions.checkArgument(!tVars.contains(var), "Recursive replacement: tried to replace %s with %s", var, t); Map<Integer, Type> newBinding = Maps.newHashMap(); newBinding.put(var, t); for (int boundVar : bindings.keySet()) { bindings.put(boundVar, bindings.get(boundVar).substitute(newBinding)); } bindings.put(var, t); }
java
public void add(int var, Type t) { Set<Integer> tVars = t.getTypeVariables(); Set<Integer> intersection = Sets.intersection(tVars, bindings.keySet()); Preconditions.checkArgument(intersection.size() == 0, "Tried to replace %s with %s, but already have bindings for %s", var, t, intersection); Preconditions.checkArgument(!tVars.contains(var), "Recursive replacement: tried to replace %s with %s", var, t); Map<Integer, Type> newBinding = Maps.newHashMap(); newBinding.put(var, t); for (int boundVar : bindings.keySet()) { bindings.put(boundVar, bindings.get(boundVar).substitute(newBinding)); } bindings.put(var, t); }
[ "public", "void", "add", "(", "int", "var", ",", "Type", "t", ")", "{", "Set", "<", "Integer", ">", "tVars", "=", "t", ".", "getTypeVariables", "(", ")", ";", "Set", "<", "Integer", ">", "intersection", "=", "Sets", ".", "intersection", "(", "tVars",...
Compose (var -> t) with this replacement. Any occurrences of var in this replacement are substituted with t. @param var @param t
[ "Compose", "(", "var", "-", ">", "t", ")", "with", "this", "replacement", ".", "Any", "occurrences", "of", "var", "in", "this", "replacement", "are", "substituted", "with", "t", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/lambda2/TypeReplacement.java#L36-L50
sniffy/sniffy
sniffy-core/src/main/java/io/sniffy/LegacySpy.java
LegacySpy.verifyBetween
@Deprecated public C verifyBetween(int minAllowedStatements, int maxAllowedStatements) throws WrongNumberOfQueriesError { return verify(SqlQueries.queriesBetween(minAllowedStatements, maxAllowedStatements)); }
java
@Deprecated public C verifyBetween(int minAllowedStatements, int maxAllowedStatements) throws WrongNumberOfQueriesError { return verify(SqlQueries.queriesBetween(minAllowedStatements, maxAllowedStatements)); }
[ "@", "Deprecated", "public", "C", "verifyBetween", "(", "int", "minAllowedStatements", ",", "int", "maxAllowedStatements", ")", "throws", "WrongNumberOfQueriesError", "{", "return", "verify", "(", "SqlQueries", ".", "queriesBetween", "(", "minAllowedStatements", ",", ...
Alias for {@link #verifyBetween(int, int, Threads)} with arguments {@code minAllowedStatements}, {@link Threads#CURRENT}, {@link Query#ANY} @since 2.0
[ "Alias", "for", "{" ]
train
https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/LegacySpy.java#L639-L642
zaproxy/zaproxy
src/org/zaproxy/zap/utils/PausableScheduledThreadPoolExecutor.java
PausableScheduledThreadPoolExecutor.setDefaultDelay
public void setDefaultDelay(long delay, TimeUnit unit) { if (delay < 0) { throw new IllegalArgumentException("Parameter delay must be greater or equal to zero."); } if (unit == null) { throw new IllegalArgumentException("Parameter unit must not be null."); } this.defaultDelayInMs = unit.toMillis(delay); }
java
public void setDefaultDelay(long delay, TimeUnit unit) { if (delay < 0) { throw new IllegalArgumentException("Parameter delay must be greater or equal to zero."); } if (unit == null) { throw new IllegalArgumentException("Parameter unit must not be null."); } this.defaultDelayInMs = unit.toMillis(delay); }
[ "public", "void", "setDefaultDelay", "(", "long", "delay", ",", "TimeUnit", "unit", ")", "{", "if", "(", "delay", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter delay must be greater or equal to zero.\"", ")", ";", "}", "if", "...
Sets the default required delay when executing/submitting tasks. <p> Default value is zero, no required delay. @param delay the value delay @param unit the time unit of delay @throws IllegalArgumentException if {@code defaultDelayInMs} is negative. @see #execute(Runnable) @see #submit(Callable) @see #submit(Runnable) @see #submit(Runnable, Object) @see #setIncrementalDefaultDelay(boolean)
[ "Sets", "the", "default", "required", "delay", "when", "executing", "/", "submitting", "tasks", ".", "<p", ">", "Default", "value", "is", "zero", "no", "required", "delay", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/PausableScheduledThreadPoolExecutor.java#L127-L135
unic/neba
core/src/main/java/io/neba/core/util/ReflectionUtil.java
ReflectionUtil.findField
public static Field findField(Class<?> type, String name) { if (type == null) { throw new IllegalArgumentException("Method argument type must not be null"); } if (name == null) { throw new IllegalArgumentException("Method argument name must not be null"); } Class<?> c = type; do { for (Field f : c.getDeclaredFields()) { if (name.equals(f.getName())) { return f; } } c = c.getSuperclass(); } while (c != null); return null; }
java
public static Field findField(Class<?> type, String name) { if (type == null) { throw new IllegalArgumentException("Method argument type must not be null"); } if (name == null) { throw new IllegalArgumentException("Method argument name must not be null"); } Class<?> c = type; do { for (Field f : c.getDeclaredFields()) { if (name.equals(f.getName())) { return f; } } c = c.getSuperclass(); } while (c != null); return null; }
[ "public", "static", "Field", "findField", "(", "Class", "<", "?", ">", "type", ",", "String", "name", ")", "{", "if", "(", "type", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Method argument type must not be null\"", ")", ";", ...
Rerturns the {@link Class#getDeclaredFields() declared field} with the given name. @param type must not be <code>null</code>. @param name must not be <code>null</code>. @return the field, or <code>null</code>
[ "Rerturns", "the", "{", "@link", "Class#getDeclaredFields", "()", "declared", "field", "}", "with", "the", "given", "name", "." ]
train
https://github.com/unic/neba/blob/4d762e60112a1fcb850926a56a9843d5aa424c4b/core/src/main/java/io/neba/core/util/ReflectionUtil.java#L196-L216
OpenTSDB/opentsdb
src/tsd/QueryRpc.java
QueryRpc.handleExpressionQuery
private void handleExpressionQuery(final TSDB tsdb, final HttpQuery query) { final net.opentsdb.query.pojo.Query v2_query = JSON.parseToObject(query.getContent(), net.opentsdb.query.pojo.Query.class); v2_query.validate(); checkAuthorization(tsdb, query.channel(), v2_query); final QueryExecutor executor = new QueryExecutor(tsdb, v2_query); executor.execute(query); }
java
private void handleExpressionQuery(final TSDB tsdb, final HttpQuery query) { final net.opentsdb.query.pojo.Query v2_query = JSON.parseToObject(query.getContent(), net.opentsdb.query.pojo.Query.class); v2_query.validate(); checkAuthorization(tsdb, query.channel(), v2_query); final QueryExecutor executor = new QueryExecutor(tsdb, v2_query); executor.execute(query); }
[ "private", "void", "handleExpressionQuery", "(", "final", "TSDB", "tsdb", ",", "final", "HttpQuery", "query", ")", "{", "final", "net", ".", "opentsdb", ".", "query", ".", "pojo", ".", "Query", "v2_query", "=", "JSON", ".", "parseToObject", "(", "query", "...
Handles an expression query @param tsdb The TSDB to which we belong @param query The HTTP query to parse/respond @since 2.3
[ "Handles", "an", "expression", "query" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/QueryRpc.java#L330-L339
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.getLock
public CmsLock getLock(CmsDbContext dbc, CmsResource resource) throws CmsException { return m_lockManager.getLock(dbc, resource); }
java
public CmsLock getLock(CmsDbContext dbc, CmsResource resource) throws CmsException { return m_lockManager.getLock(dbc, resource); }
[ "public", "CmsLock", "getLock", "(", "CmsDbContext", "dbc", ",", "CmsResource", "resource", ")", "throws", "CmsException", "{", "return", "m_lockManager", ".", "getLock", "(", "dbc", ",", "resource", ")", ";", "}" ]
Returns the lock state of a resource.<p> @param dbc the current database context @param resource the resource to return the lock state for @return the lock state of the resource @throws CmsException if something goes wrong
[ "Returns", "the", "lock", "state", "of", "a", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L4083-L4086
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_sqr.java
Dcs_sqr.cs_sqr
public static Dcss cs_sqr(int order, Dcs A, boolean qr) { int n, k, post[]; Dcss S; boolean ok = true; if (!Dcs_util.CS_CSC(A)) return (null); /* check inputs */ n = A.n; S = new Dcss(); /* allocate result S */ S.q = Dcs_amd.cs_amd(order, A); /* fill-reducing ordering */ if (order > 0 && S.q == null) return (null); if (qr) /* QR symbolic analysis */ { Dcs C = order > 0 ? Dcs_permute.cs_permute(A, null, S.q, false) : A; S.parent = Dcs_etree.cs_etree(C, true); /* etree of C'*C, where C=A(:,q) */ post = Dcs_post.cs_post(S.parent, n); S.cp = Dcs_counts.cs_counts(C, S.parent, post, true); /* col counts chol(C'*C) */ ok = C != null && S.parent != null && S.cp != null && cs_vcount(C, S); if (ok) for (S.unz = 0, k = 0; k < n; k++) S.unz += S.cp[k]; ok = ok && S.lnz >= 0 && S.unz >= 0; /* int overflow guard */ } else { S.unz = 4 * (A.p[n]) + n; /* for LU factorization only, */ S.lnz = S.unz; /* guess nnz(L) and nnz(U) */ } return (ok ? S : null); /* return result S */ }
java
public static Dcss cs_sqr(int order, Dcs A, boolean qr) { int n, k, post[]; Dcss S; boolean ok = true; if (!Dcs_util.CS_CSC(A)) return (null); /* check inputs */ n = A.n; S = new Dcss(); /* allocate result S */ S.q = Dcs_amd.cs_amd(order, A); /* fill-reducing ordering */ if (order > 0 && S.q == null) return (null); if (qr) /* QR symbolic analysis */ { Dcs C = order > 0 ? Dcs_permute.cs_permute(A, null, S.q, false) : A; S.parent = Dcs_etree.cs_etree(C, true); /* etree of C'*C, where C=A(:,q) */ post = Dcs_post.cs_post(S.parent, n); S.cp = Dcs_counts.cs_counts(C, S.parent, post, true); /* col counts chol(C'*C) */ ok = C != null && S.parent != null && S.cp != null && cs_vcount(C, S); if (ok) for (S.unz = 0, k = 0; k < n; k++) S.unz += S.cp[k]; ok = ok && S.lnz >= 0 && S.unz >= 0; /* int overflow guard */ } else { S.unz = 4 * (A.p[n]) + n; /* for LU factorization only, */ S.lnz = S.unz; /* guess nnz(L) and nnz(U) */ } return (ok ? S : null); /* return result S */ }
[ "public", "static", "Dcss", "cs_sqr", "(", "int", "order", ",", "Dcs", "A", ",", "boolean", "qr", ")", "{", "int", "n", ",", "k", ",", "post", "[", "]", ";", "Dcss", "S", ";", "boolean", "ok", "=", "true", ";", "if", "(", "!", "Dcs_util", ".", ...
Symbolic QR or LU ordering and analysis. @param order ordering method to use (0 to 3) @param A column-compressed matrix @param qr analyze for QR if true or LU if false @return symbolic analysis for QR or LU, null on error
[ "Symbolic", "QR", "or", "LU", "ordering", "and", "analysis", "." ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_sqr.java#L113-L140
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/DojoHttpTransport.java
DojoHttpTransport.beginModules
protected String beginModules(HttpServletRequest request, Object arg) { StringBuffer sb = new StringBuffer(); if (RequestUtil.isServerExpandedLayers(request) && request.getParameter(REQUESTEDMODULESCOUNT_REQPARAM) != null) { // it's a loader generated request @SuppressWarnings("unchecked") Set<String> modules = (Set<String>)arg; sb.append("require.combo.defineModules(["); //$NON-NLS-1$ int i = 0; for (String module : modules) { sb.append(i++ > 0 ? "," : "").append("'").append(module).append("'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } sb.append("], function(){\r\n"); //$NON-NLS-1$ } return sb.toString(); }
java
protected String beginModules(HttpServletRequest request, Object arg) { StringBuffer sb = new StringBuffer(); if (RequestUtil.isServerExpandedLayers(request) && request.getParameter(REQUESTEDMODULESCOUNT_REQPARAM) != null) { // it's a loader generated request @SuppressWarnings("unchecked") Set<String> modules = (Set<String>)arg; sb.append("require.combo.defineModules(["); //$NON-NLS-1$ int i = 0; for (String module : modules) { sb.append(i++ > 0 ? "," : "").append("'").append(module).append("'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } sb.append("], function(){\r\n"); //$NON-NLS-1$ } return sb.toString(); }
[ "protected", "String", "beginModules", "(", "HttpServletRequest", "request", ",", "Object", "arg", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "RequestUtil", ".", "isServerExpandedLayers", "(", "request", ")", "&&", "r...
Handles the {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#BEGIN_MODULES} layer listener event. <p> When doing server expanded layers, the loader extension JavaScript needs to be in control of determining when explicitly requested modules are defined so that it can ensure the modules are defined in request order. This prevents the loader from issuing unnecessary, additional, requests for unresolved modules when responses arrive out-of-order. <p> The markup emitted by this method, together with the {@link #endModules(HttpServletRequest, Object)} method, wraps the module definitions within the <code>require.combo.defineModules</code> function call as follows: <pre> require.combo.defineModules(['mid1', 'mid2', ...], function() { define([...], function(...) { ... }); define([...], function(...) { ... }); ... }); </pre> @param request the http request object @param arg the set of module names. The iteration order of the set is guaranteed to be the same as the order of the subsequent {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#BEFORE_FIRST_MODULE}, {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#BEFORE_SUBSEQUENT_MODULE}, and {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#AFTER_MODULE} events. @return the layer contribution
[ "Handles", "the", "{", "@link", "com", ".", "ibm", ".", "jaggr", ".", "core", ".", "transport", ".", "IHttpTransport", ".", "LayerContributionType#BEGIN_MODULES", "}", "layer", "listener", "event", ".", "<p", ">", "When", "doing", "server", "expanded", "layers...
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/DojoHttpTransport.java#L355-L369
alkacon/opencms-core
src/org/opencms/file/CmsLinkRewriter.java
CmsLinkRewriter.rewriteOtherRelations
protected void rewriteOtherRelations(CmsResource res, Collection<CmsRelation> relations) throws CmsException { LOG.info("Rewriting non-content links for " + res.getRootPath()); for (CmsRelation rel : relations) { CmsUUID targetId = rel.getTargetId(); CmsResource newTargetResource = m_translationsById.get(targetId); CmsRelationType relType = rel.getType(); if (!relType.isDefinedInContent()) { if (newTargetResource != null) { m_cms.deleteRelationsFromResource( rel.getSourcePath(), CmsRelationFilter.TARGETS.filterStructureId(rel.getTargetId()).filterType(relType)); m_cms.addRelationToResource( rel.getSourcePath(), newTargetResource.getRootPath(), relType.getName()); } } } }
java
protected void rewriteOtherRelations(CmsResource res, Collection<CmsRelation> relations) throws CmsException { LOG.info("Rewriting non-content links for " + res.getRootPath()); for (CmsRelation rel : relations) { CmsUUID targetId = rel.getTargetId(); CmsResource newTargetResource = m_translationsById.get(targetId); CmsRelationType relType = rel.getType(); if (!relType.isDefinedInContent()) { if (newTargetResource != null) { m_cms.deleteRelationsFromResource( rel.getSourcePath(), CmsRelationFilter.TARGETS.filterStructureId(rel.getTargetId()).filterType(relType)); m_cms.addRelationToResource( rel.getSourcePath(), newTargetResource.getRootPath(), relType.getName()); } } } }
[ "protected", "void", "rewriteOtherRelations", "(", "CmsResource", "res", ",", "Collection", "<", "CmsRelation", ">", "relations", ")", "throws", "CmsException", "{", "LOG", ".", "info", "(", "\"Rewriting non-content links for \"", "+", "res", ".", "getRootPath", "("...
Rewrites relations which are not derived from links in the content itself.<p> @param res the resource for which to rewrite the relations @param relations the original relations @throws CmsException if something goes wrong
[ "Rewrites", "relations", "which", "are", "not", "derived", "from", "links", "in", "the", "content", "itself", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsLinkRewriter.java#L722-L741
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.copyAttributes
private void copyAttributes(ElementBase src, LayoutElement dest) { for (PropertyInfo propInfo : src.getDefinition().getProperties()) { Object value = propInfo.isSerializable() ? propInfo.getPropertyValue(src) : null; String val = value == null ? null : propInfo.getPropertyType().getSerializer().serialize(value); if (!ObjectUtils.equals(value, propInfo.getDefault())) { dest.getAttributes().put(propInfo.getId(), val); } } }
java
private void copyAttributes(ElementBase src, LayoutElement dest) { for (PropertyInfo propInfo : src.getDefinition().getProperties()) { Object value = propInfo.isSerializable() ? propInfo.getPropertyValue(src) : null; String val = value == null ? null : propInfo.getPropertyType().getSerializer().serialize(value); if (!ObjectUtils.equals(value, propInfo.getDefault())) { dest.getAttributes().put(propInfo.getId(), val); } } }
[ "private", "void", "copyAttributes", "(", "ElementBase", "src", ",", "LayoutElement", "dest", ")", "{", "for", "(", "PropertyInfo", "propInfo", ":", "src", ".", "getDefinition", "(", ")", ".", "getProperties", "(", ")", ")", "{", "Object", "value", "=", "p...
Copy attributes from a UI element to layout element. @param src UI element. @param dest Layout element.
[ "Copy", "attributes", "from", "a", "UI", "element", "to", "layout", "element", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L407-L416
CenturyLinkCloud/clc-java-sdk
sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/ServerService.java
ServerService.importServer
public OperationFuture<ServerMetadata> importServer(ImportServerConfig config) { BaseServerResponse response = client.importServer( serverConverter.buildImportServerRequest( config, config.getCustomFields().isEmpty() ? null : client.getCustomFields() ) ); return postProcessBuildServerResponse(response, config); }
java
public OperationFuture<ServerMetadata> importServer(ImportServerConfig config) { BaseServerResponse response = client.importServer( serverConverter.buildImportServerRequest( config, config.getCustomFields().isEmpty() ? null : client.getCustomFields() ) ); return postProcessBuildServerResponse(response, config); }
[ "public", "OperationFuture", "<", "ServerMetadata", ">", "importServer", "(", "ImportServerConfig", "config", ")", "{", "BaseServerResponse", "response", "=", "client", ".", "importServer", "(", "serverConverter", ".", "buildImportServerRequest", "(", "config", ",", "...
Import server from ovf image @param config server config @return OperationFuture wrapper for ServerMetadata
[ "Import", "server", "from", "ovf", "image" ]
train
https://github.com/CenturyLinkCloud/clc-java-sdk/blob/c026322f077dea71b1acf9f2d665253d79d9bf85/sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/ServerService.java#L156-L167
netty/netty
handler/src/main/java/io/netty/handler/ssl/SslHandler.java
SslHandler.allocate
private ByteBuf allocate(ChannelHandlerContext ctx, int capacity) { ByteBufAllocator alloc = ctx.alloc(); if (engineType.wantsDirectBuffer) { return alloc.directBuffer(capacity); } else { return alloc.buffer(capacity); } }
java
private ByteBuf allocate(ChannelHandlerContext ctx, int capacity) { ByteBufAllocator alloc = ctx.alloc(); if (engineType.wantsDirectBuffer) { return alloc.directBuffer(capacity); } else { return alloc.buffer(capacity); } }
[ "private", "ByteBuf", "allocate", "(", "ChannelHandlerContext", "ctx", ",", "int", "capacity", ")", "{", "ByteBufAllocator", "alloc", "=", "ctx", ".", "alloc", "(", ")", ";", "if", "(", "engineType", ".", "wantsDirectBuffer", ")", "{", "return", "alloc", "."...
Always prefer a direct buffer when it's pooled, so that we reduce the number of memory copies in {@link OpenSslEngine}.
[ "Always", "prefer", "a", "direct", "buffer", "when", "it", "s", "pooled", "so", "that", "we", "reduce", "the", "number", "of", "memory", "copies", "in", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslHandler.java#L2120-L2127
bazaarvoice/emodb
sor/src/main/java/com/bazaarvoice/emodb/sor/db/astyanax/AstyanaxBlockedDataReaderDAO.java
AstyanaxBlockedDataReaderDAO.rowScan
private Iterator<Row<ByteBuffer, DeltaKey>> rowScan(final DeltaPlacement placement, final ByteBufferRange rowRange, final ByteBufferRange columnRange, final LimitCounter limit, final ReadConsistency consistency) { return rowScan(placement, placement.getBlockedDeltaColumnFamily(), rowRange, columnRange, limit, consistency); }
java
private Iterator<Row<ByteBuffer, DeltaKey>> rowScan(final DeltaPlacement placement, final ByteBufferRange rowRange, final ByteBufferRange columnRange, final LimitCounter limit, final ReadConsistency consistency) { return rowScan(placement, placement.getBlockedDeltaColumnFamily(), rowRange, columnRange, limit, consistency); }
[ "private", "Iterator", "<", "Row", "<", "ByteBuffer", ",", "DeltaKey", ">", ">", "rowScan", "(", "final", "DeltaPlacement", "placement", ",", "final", "ByteBufferRange", "rowRange", ",", "final", "ByteBufferRange", "columnRange", ",", "final", "LimitCounter", "lim...
Scans for rows within the specified range, exclusive on start and inclusive on end.
[ "Scans", "for", "rows", "within", "the", "specified", "range", "exclusive", "on", "start", "and", "inclusive", "on", "end", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/sor/src/main/java/com/bazaarvoice/emodb/sor/db/astyanax/AstyanaxBlockedDataReaderDAO.java#L809-L815
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.truncatedCompareTo
public static int truncatedCompareTo(final Calendar cal1, final Calendar cal2, final int field) { final Calendar truncatedCal1 = truncate(cal1, field); final Calendar truncatedCal2 = truncate(cal2, field); return truncatedCal1.compareTo(truncatedCal2); }
java
public static int truncatedCompareTo(final Calendar cal1, final Calendar cal2, final int field) { final Calendar truncatedCal1 = truncate(cal1, field); final Calendar truncatedCal2 = truncate(cal2, field); return truncatedCal1.compareTo(truncatedCal2); }
[ "public", "static", "int", "truncatedCompareTo", "(", "final", "Calendar", "cal1", ",", "final", "Calendar", "cal2", ",", "final", "int", "field", ")", "{", "final", "Calendar", "truncatedCal1", "=", "truncate", "(", "cal1", ",", "field", ")", ";", "final", ...
Determines how two calendars compare up to no more than the specified most significant field. @param cal1 the first calendar, not <code>null</code> @param cal2 the second calendar, not <code>null</code> @param field the field from {@code Calendar} @return a negative integer, zero, or a positive integer as the first calendar is less than, equal to, or greater than the second. @throws IllegalArgumentException if any argument is <code>null</code> @see #truncate(Calendar, int) @see #truncatedCompareTo(Date, Date, int) @since 3.0
[ "Determines", "how", "two", "calendars", "compare", "up", "to", "no", "more", "than", "the", "specified", "most", "significant", "field", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L1778-L1782
netty/netty
common/src/main/java/io/netty/util/internal/PlatformDependent.java
PlatformDependent.hashCodeAscii
public static int hashCodeAscii(byte[] bytes, int startPos, int length) { return !hasUnsafe() || !unalignedAccess() ? hashCodeAsciiSafe(bytes, startPos, length) : PlatformDependent0.hashCodeAscii(bytes, startPos, length); }
java
public static int hashCodeAscii(byte[] bytes, int startPos, int length) { return !hasUnsafe() || !unalignedAccess() ? hashCodeAsciiSafe(bytes, startPos, length) : PlatformDependent0.hashCodeAscii(bytes, startPos, length); }
[ "public", "static", "int", "hashCodeAscii", "(", "byte", "[", "]", "bytes", ",", "int", "startPos", ",", "int", "length", ")", "{", "return", "!", "hasUnsafe", "(", ")", "||", "!", "unalignedAccess", "(", ")", "?", "hashCodeAsciiSafe", "(", "bytes", ",",...
Calculate a hash code of a byte array assuming ASCII character encoding. The resulting hash code will be case insensitive. @param bytes The array which contains the data to hash. @param startPos What index to start generating a hash code in {@code bytes} @param length The amount of bytes that should be accounted for in the computation. @return The hash code of {@code bytes} assuming ASCII character encoding. The resulting hash code will be case insensitive.
[ "Calculate", "a", "hash", "code", "of", "a", "byte", "array", "assuming", "ASCII", "character", "encoding", ".", "The", "resulting", "hash", "code", "will", "be", "case", "insensitive", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L751-L755
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java
StyleUtil.cloneCellStyle
public static CellStyle cloneCellStyle(Cell cell, CellStyle cellStyle) { return cloneCellStyle(cell.getSheet().getWorkbook(), cellStyle); }
java
public static CellStyle cloneCellStyle(Cell cell, CellStyle cellStyle) { return cloneCellStyle(cell.getSheet().getWorkbook(), cellStyle); }
[ "public", "static", "CellStyle", "cloneCellStyle", "(", "Cell", "cell", ",", "CellStyle", "cellStyle", ")", "{", "return", "cloneCellStyle", "(", "cell", ".", "getSheet", "(", ")", ".", "getWorkbook", "(", ")", ",", "cellStyle", ")", ";", "}" ]
克隆新的{@link CellStyle} @param cell 单元格 @param cellStyle 被复制的样式 @return {@link CellStyle}
[ "克隆新的", "{", "@link", "CellStyle", "}" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java#L30-L32
VoltDB/voltdb
src/frontend/org/voltdb/NonVoltDBBackend.java
NonVoltDBBackend.isInteger
private boolean isInteger(String columnOrConstant, List<String> tableNames, boolean debugPrint) { return isIntegerConstant(columnOrConstant) || isIntegerColumn(columnOrConstant, tableNames, debugPrint); }
java
private boolean isInteger(String columnOrConstant, List<String> tableNames, boolean debugPrint) { return isIntegerConstant(columnOrConstant) || isIntegerColumn(columnOrConstant, tableNames, debugPrint); }
[ "private", "boolean", "isInteger", "(", "String", "columnOrConstant", ",", "List", "<", "String", ">", "tableNames", ",", "boolean", "debugPrint", ")", "{", "return", "isIntegerConstant", "(", "columnOrConstant", ")", "||", "isIntegerColumn", "(", "columnOrConstant"...
Returns true if the <i>columnOrConstant</i> is either an integer constant or an integer column (including types TINYINT, SMALLINT, INTEGER, BIGINT, or equivalents in a comparison, non-VoltDB database); false otherwise.
[ "Returns", "true", "if", "the", "<i", ">", "columnOrConstant<", "/", "i", ">", "is", "either", "an", "integer", "constant", "or", "an", "integer", "column", "(", "including", "types", "TINYINT", "SMALLINT", "INTEGER", "BIGINT", "or", "equivalents", "in", "a"...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/NonVoltDBBackend.java#L598-L600
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/query/LiteralMapList.java
LiteralMapList.select
public LiteralMapList select(JcPrimitive key, Object value) { LiteralMapList ret = new LiteralMapList(); for (LiteralMap lm : this) { if (isEqual(value, lm.get(ValueAccess.getName(key)))) ret.add(lm); } return ret; }
java
public LiteralMapList select(JcPrimitive key, Object value) { LiteralMapList ret = new LiteralMapList(); for (LiteralMap lm : this) { if (isEqual(value, lm.get(ValueAccess.getName(key)))) ret.add(lm); } return ret; }
[ "public", "LiteralMapList", "select", "(", "JcPrimitive", "key", ",", "Object", "value", ")", "{", "LiteralMapList", "ret", "=", "new", "LiteralMapList", "(", ")", ";", "for", "(", "LiteralMap", "lm", ":", "this", ")", "{", "if", "(", "isEqual", "(", "va...
Answer a LiteralMapList containing only literal maps with the given key and value @param key @param value @return
[ "Answer", "a", "LiteralMapList", "containing", "only", "literal", "maps", "with", "the", "given", "key", "and", "value" ]
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/LiteralMapList.java#L47-L54
rhuss/jolokia
agent/core/src/main/java/org/jolokia/backend/MBeanServers.java
MBeanServers.handleNotification
public synchronized void handleNotification(Notification notification, Object handback) { String type = notification.getType(); if (REGISTRATION_NOTIFICATION.equals(type)) { jolokiaMBeanServer = lookupJolokiaMBeanServer(); // We need to add the listener provided during construction time to add the Jolokia MBeanServer // so that it is kept updated, too. if (jolokiaMBeanServerListener != null) { JmxUtil.addMBeanRegistrationListener(jolokiaMBeanServer, jolokiaMBeanServerListener, null); } } else if (UNREGISTRATION_NOTIFICATION.equals(type)) { jolokiaMBeanServer = null; } allMBeanServers.clear(); if (jolokiaMBeanServer != null) { allMBeanServers.add(jolokiaMBeanServer); } allMBeanServers.addAll(detectedMBeanServers); }
java
public synchronized void handleNotification(Notification notification, Object handback) { String type = notification.getType(); if (REGISTRATION_NOTIFICATION.equals(type)) { jolokiaMBeanServer = lookupJolokiaMBeanServer(); // We need to add the listener provided during construction time to add the Jolokia MBeanServer // so that it is kept updated, too. if (jolokiaMBeanServerListener != null) { JmxUtil.addMBeanRegistrationListener(jolokiaMBeanServer, jolokiaMBeanServerListener, null); } } else if (UNREGISTRATION_NOTIFICATION.equals(type)) { jolokiaMBeanServer = null; } allMBeanServers.clear(); if (jolokiaMBeanServer != null) { allMBeanServers.add(jolokiaMBeanServer); } allMBeanServers.addAll(detectedMBeanServers); }
[ "public", "synchronized", "void", "handleNotification", "(", "Notification", "notification", ",", "Object", "handback", ")", "{", "String", "type", "=", "notification", ".", "getType", "(", ")", ";", "if", "(", "REGISTRATION_NOTIFICATION", ".", "equals", "(", "t...
Fetch Jolokia MBeanServer when it gets registered, remove it if being unregistered @param notification notification emitted @param handback not used here
[ "Fetch", "Jolokia", "MBeanServer", "when", "it", "gets", "registered", "remove", "it", "if", "being", "unregistered" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/backend/MBeanServers.java#L77-L95
bartprokop/rxtx
src/main/java/gnu/io/CommPortIdentifier.java
CommPortIdentifier.addPortName
public static void addPortName(String s, int type, CommDriver c) { LOGGER.fine("CommPortIdentifier:addPortName(" + s + ")"); // TODO (by Alexander Graf) the usage of the constructor with a null // value for the port is a major design problem. Rxtx currently creates // the port objects on a per-open basis. This clashes with the design // idea of the comm API where a port object is created by the driver // once and given to the CommPortIdentifier constructor. // This problem is again introduced by the poor design of the comm APIs // SPI. AddIdentifierToList(new CommPortIdentifier(s, null, type, c)); }
java
public static void addPortName(String s, int type, CommDriver c) { LOGGER.fine("CommPortIdentifier:addPortName(" + s + ")"); // TODO (by Alexander Graf) the usage of the constructor with a null // value for the port is a major design problem. Rxtx currently creates // the port objects on a per-open basis. This clashes with the design // idea of the comm API where a port object is created by the driver // once and given to the CommPortIdentifier constructor. // This problem is again introduced by the poor design of the comm APIs // SPI. AddIdentifierToList(new CommPortIdentifier(s, null, type, c)); }
[ "public", "static", "void", "addPortName", "(", "String", "s", ",", "int", "type", ",", "CommDriver", "c", ")", "{", "LOGGER", ".", "fine", "(", "\"CommPortIdentifier:addPortName(\"", "+", "s", "+", "\")\"", ")", ";", "// TODO (by Alexander Graf) the usage of the ...
addPortName accept: Name of the port s, Port type, reverence to RXTXCommDriver. perform: place a new CommPortIdentifier in the linked list return: none. exceptions: none. comments: @param s - port name @param type - port type @param c - reference for ComDriver
[ "addPortName", "accept", ":", "Name", "of", "the", "port", "s", "Port", "type", "reverence", "to", "RXTXCommDriver", ".", "perform", ":", "place", "a", "new", "CommPortIdentifier", "in", "the", "linked", "list", "return", ":", "none", ".", "exceptions", ":",...
train
https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/gnu/io/CommPortIdentifier.java#L183-L193
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/JobOperationResultsInner.java
JobOperationResultsInner.getAsync
public Observable<Void> getAsync(String vaultName, String resourceGroupName, String jobName, String operationId) { return getWithServiceResponseAsync(vaultName, resourceGroupName, jobName, operationId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> getAsync(String vaultName, String resourceGroupName, String jobName, String operationId) { return getWithServiceResponseAsync(vaultName, resourceGroupName, jobName, operationId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "getAsync", "(", "String", "vaultName", ",", "String", "resourceGroupName", ",", "String", "jobName", ",", "String", "operationId", ")", "{", "return", "getWithServiceResponseAsync", "(", "vaultName", ",", "resourceGroupName...
Gets the result of the operation. @param vaultName The name of the Recovery Services vault. @param resourceGroupName The name of the resource group associated with the Recovery Services vault. @param jobName Job name associated with this GET operation. @param operationId OperationID associated with this GET operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Gets", "the", "result", "of", "the", "operation", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/JobOperationResultsInner.java#L100-L107
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/SpringLoaded.java
SpringLoaded.loadNewVersionOfType
public static int loadNewVersionOfType(ClassLoader classLoader, String dottedClassname, byte[] newbytes) { try { // Obtain the type registry of interest TypeRegistry typeRegistry = TypeRegistry.getTypeRegistryFor(classLoader); if (typeRegistry == null) { return 1; } // Find the reloadable type ReloadableType reloadableType = typeRegistry.getReloadableType(dottedClassname.replace('.', '/')); if (reloadableType == null) { return 2; } // Create a unique version tag for this reload attempt String tag = Utils.encode(System.currentTimeMillis()); boolean reloaded = reloadableType.loadNewVersion(tag, newbytes); return reloaded ? 0 : 3; } catch (Exception e) { e.printStackTrace(); return 4; } }
java
public static int loadNewVersionOfType(ClassLoader classLoader, String dottedClassname, byte[] newbytes) { try { // Obtain the type registry of interest TypeRegistry typeRegistry = TypeRegistry.getTypeRegistryFor(classLoader); if (typeRegistry == null) { return 1; } // Find the reloadable type ReloadableType reloadableType = typeRegistry.getReloadableType(dottedClassname.replace('.', '/')); if (reloadableType == null) { return 2; } // Create a unique version tag for this reload attempt String tag = Utils.encode(System.currentTimeMillis()); boolean reloaded = reloadableType.loadNewVersion(tag, newbytes); return reloaded ? 0 : 3; } catch (Exception e) { e.printStackTrace(); return 4; } }
[ "public", "static", "int", "loadNewVersionOfType", "(", "ClassLoader", "classLoader", ",", "String", "dottedClassname", ",", "byte", "[", "]", "newbytes", ")", "{", "try", "{", "// Obtain the type registry of interest", "TypeRegistry", "typeRegistry", "=", "TypeRegistry...
Force a reload of an existing type. @param classLoader the classloader that was used to load the original form of the type @param dottedClassname the dotted name of the type being reloaded, e.g. com.foo.Bar @param newbytes the data bytecode data to reload as the new version @return int return code: 0 is success. 1 is unknown classloader, 2 is unknown type (possibly not yet loaded). 3 is reload event failed. 4 is exception occurred.
[ "Force", "a", "reload", "of", "an", "existing", "type", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/SpringLoaded.java#L48-L69
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java
UTF16.delete
public static StringBuffer delete(StringBuffer target, int offset16) { int count = 1; switch (bounds(target, offset16)) { case LEAD_SURROGATE_BOUNDARY: count++; break; case TRAIL_SURROGATE_BOUNDARY: count++; offset16--; break; } target.delete(offset16, offset16 + count); return target; }
java
public static StringBuffer delete(StringBuffer target, int offset16) { int count = 1; switch (bounds(target, offset16)) { case LEAD_SURROGATE_BOUNDARY: count++; break; case TRAIL_SURROGATE_BOUNDARY: count++; offset16--; break; } target.delete(offset16, offset16 + count); return target; }
[ "public", "static", "StringBuffer", "delete", "(", "StringBuffer", "target", ",", "int", "offset16", ")", "{", "int", "count", "=", "1", ";", "switch", "(", "bounds", "(", "target", ",", "offset16", ")", ")", "{", "case", "LEAD_SURROGATE_BOUNDARY", ":", "c...
Removes the codepoint at the specified position in this target (shortening target by 1 character if the codepoint is a non-supplementary, 2 otherwise). @param target String buffer to remove codepoint from @param offset16 Offset which the codepoint will be removed @return a reference to target @exception IndexOutOfBoundsException Thrown if offset16 is invalid.
[ "Removes", "the", "codepoint", "at", "the", "specified", "position", "in", "this", "target", "(", "shortening", "target", "by", "1", "character", "if", "the", "codepoint", "is", "a", "non", "-", "supplementary", "2", "otherwise", ")", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java#L1413-L1426
molgenis/molgenis
molgenis-r/src/main/java/org/molgenis/r/RScriptExecutor.java
RScriptExecutor.executeScript
String executeScript(String script, String outputPathname) { // Workaround: script contains the absolute output pathname in case outputPathname is not null // Replace the absolute output pathname with a relative filename such that OpenCPU can handle // the script. String scriptOutputFilename; if (outputPathname != null) { scriptOutputFilename = generateRandomString(); script = script.replace(outputPathname, scriptOutputFilename); } else { scriptOutputFilename = null; } try { // execute script and use session key to retrieve script response String openCpuSessionKey = executeScriptExecuteRequest(script); return executeScriptGetResponseRequest( openCpuSessionKey, scriptOutputFilename, outputPathname); } catch (IOException e) { throw new UncheckedIOException(e); } }
java
String executeScript(String script, String outputPathname) { // Workaround: script contains the absolute output pathname in case outputPathname is not null // Replace the absolute output pathname with a relative filename such that OpenCPU can handle // the script. String scriptOutputFilename; if (outputPathname != null) { scriptOutputFilename = generateRandomString(); script = script.replace(outputPathname, scriptOutputFilename); } else { scriptOutputFilename = null; } try { // execute script and use session key to retrieve script response String openCpuSessionKey = executeScriptExecuteRequest(script); return executeScriptGetResponseRequest( openCpuSessionKey, scriptOutputFilename, outputPathname); } catch (IOException e) { throw new UncheckedIOException(e); } }
[ "String", "executeScript", "(", "String", "script", ",", "String", "outputPathname", ")", "{", "// Workaround: script contains the absolute output pathname in case outputPathname is not null", "// Replace the absolute output pathname with a relative filename such that OpenCPU can handle", "/...
Execute R script and parse response: - write the response to outputPathname if outputPathname is not null - else return the response @param script R script to execute @param outputPathname optional output pathname for output file @return response value or null in outputPathname is not null
[ "Execute", "R", "script", "and", "parse", "response", ":", "-", "write", "the", "response", "to", "outputPathname", "if", "outputPathname", "is", "not", "null", "-", "else", "return", "the", "response" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-r/src/main/java/org/molgenis/r/RScriptExecutor.java#L50-L70
Hygieia/Hygieia
api/src/main/java/com/capitalone/dashboard/service/DashboardServiceImpl.java
DashboardServiceImpl.setAppAndComponentNameToDashboard
private void setAppAndComponentNameToDashboard(Dashboard dashboard, String appName, String compName) { if(appName != null && !"".equals(appName)){ Cmdb cmdb = cmdbService.configurationItemByConfigurationItem(appName); if(cmdb !=null) { dashboard.setConfigurationItemBusServName(cmdb.getConfigurationItem()); dashboard.setValidServiceName(cmdb.isValidConfigItem()); } } if(compName != null && !"".equals(compName)){ Cmdb cmdb = cmdbService.configurationItemByConfigurationItem(compName); if(cmdb !=null) { dashboard.setConfigurationItemBusAppName(cmdb.getConfigurationItem()); dashboard.setValidAppName(cmdb.isValidConfigItem()); } } }
java
private void setAppAndComponentNameToDashboard(Dashboard dashboard, String appName, String compName) { if(appName != null && !"".equals(appName)){ Cmdb cmdb = cmdbService.configurationItemByConfigurationItem(appName); if(cmdb !=null) { dashboard.setConfigurationItemBusServName(cmdb.getConfigurationItem()); dashboard.setValidServiceName(cmdb.isValidConfigItem()); } } if(compName != null && !"".equals(compName)){ Cmdb cmdb = cmdbService.configurationItemByConfigurationItem(compName); if(cmdb !=null) { dashboard.setConfigurationItemBusAppName(cmdb.getConfigurationItem()); dashboard.setValidAppName(cmdb.isValidConfigItem()); } } }
[ "private", "void", "setAppAndComponentNameToDashboard", "(", "Dashboard", "dashboard", ",", "String", "appName", ",", "String", "compName", ")", "{", "if", "(", "appName", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "appName", ")", ")", "{", "Cmdb",...
Sets business service, business application and valid flag for each to the give Dashboard @param dashboard @param appName @param compName
[ "Sets", "business", "service", "business", "application", "and", "valid", "flag", "for", "each", "to", "the", "give", "Dashboard" ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/api/src/main/java/com/capitalone/dashboard/service/DashboardServiceImpl.java#L666-L682
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/syslog_aaa.java
syslog_aaa.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { syslog_aaa_responses result = (syslog_aaa_responses) service.get_payload_formatter().string_to_resource(syslog_aaa_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.syslog_aaa_response_array); } syslog_aaa[] result_syslog_aaa = new syslog_aaa[result.syslog_aaa_response_array.length]; for(int i = 0; i < result.syslog_aaa_response_array.length; i++) { result_syslog_aaa[i] = result.syslog_aaa_response_array[i].syslog_aaa[0]; } return result_syslog_aaa; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { syslog_aaa_responses result = (syslog_aaa_responses) service.get_payload_formatter().string_to_resource(syslog_aaa_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.syslog_aaa_response_array); } syslog_aaa[] result_syslog_aaa = new syslog_aaa[result.syslog_aaa_response_array.length]; for(int i = 0; i < result.syslog_aaa_response_array.length; i++) { result_syslog_aaa[i] = result.syslog_aaa_response_array[i].syslog_aaa[0]; } return result_syslog_aaa; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "syslog_aaa_responses", "result", "=", "(", "syslog_aaa_responses", ")", "service", ".", "get_payload_formatte...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/syslog_aaa.java#L541-L558
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java
WebConfigParamUtils.getStringInitParameter
public static String getStringInitParameter(ExternalContext context, String name) { return getStringInitParameter(context,name,null); }
java
public static String getStringInitParameter(ExternalContext context, String name) { return getStringInitParameter(context,name,null); }
[ "public", "static", "String", "getStringInitParameter", "(", "ExternalContext", "context", ",", "String", "name", ")", "{", "return", "getStringInitParameter", "(", "context", ",", "name", ",", "null", ")", ";", "}" ]
Gets the String init parameter value from the specified context. If the parameter is an empty String or a String containing only white space, this method returns <code>null</code> @param context the application's external context @param name the init parameter's name @return the parameter if it was specified and was not empty, <code>null</code> otherwise @throws NullPointerException if context or name is <code>null</code>
[ "Gets", "the", "String", "init", "parameter", "value", "from", "the", "specified", "context", ".", "If", "the", "parameter", "is", "an", "empty", "String", "or", "a", "String", "containing", "only", "white", "space", "this", "method", "returns", "<code", ">"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java#L48-L51
messagebird/java-rest-api
api/src/main/java/com/messagebird/RequestSigner.java
RequestSigner.isMatch
public boolean isMatch(String expectedSignature, Request request) { try { return isMatch(Base64.decode(expectedSignature), request); } catch (IOException e) { throw new RequestSigningException(e); } }
java
public boolean isMatch(String expectedSignature, Request request) { try { return isMatch(Base64.decode(expectedSignature), request); } catch (IOException e) { throw new RequestSigningException(e); } }
[ "public", "boolean", "isMatch", "(", "String", "expectedSignature", ",", "Request", "request", ")", "{", "try", "{", "return", "isMatch", "(", "Base64", ".", "decode", "(", "expectedSignature", ")", ",", "request", ")", ";", "}", "catch", "(", "IOException",...
Computes the signature for the provided request and determines whether it matches the expected signature (from the raw MessageBird-Signature header). @param expectedSignature Signature from the MessageBird-Signature header in its original base64 encoded state. @param request Request containing the values from the incoming webhook. @return True if the computed signature matches the expected signature.
[ "Computes", "the", "signature", "for", "the", "provided", "request", "and", "determines", "whether", "it", "matches", "the", "expected", "signature", "(", "from", "the", "raw", "MessageBird", "-", "Signature", "header", ")", "." ]
train
https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/RequestSigner.java#L48-L54
wizzardo/tools
modules/tools-security/src/main/java/com/wizzardo/tools/security/Base64.java
Base64.encodeToString
public final static String encodeToString(byte[] sArr, boolean lineSep, boolean urlSafe) { // Reuse char[] since we can't create a String incrementally anyway and StringBuffer/Builder would be slower. return new String(encodeToChar(sArr, lineSep, urlSafe)); }
java
public final static String encodeToString(byte[] sArr, boolean lineSep, boolean urlSafe) { // Reuse char[] since we can't create a String incrementally anyway and StringBuffer/Builder would be slower. return new String(encodeToChar(sArr, lineSep, urlSafe)); }
[ "public", "final", "static", "String", "encodeToString", "(", "byte", "[", "]", "sArr", ",", "boolean", "lineSep", ",", "boolean", "urlSafe", ")", "{", "// Reuse char[] since we can't create a String incrementally anyway and StringBuffer/Builder would be slower.", "return", "...
Encodes a raw byte array into a BASE64 <code>String</code> representation i accordance with RFC 2045. @param sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned. @param lineSep Optional "\r\n" after 76 characters, unless end of file.<br> No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a little faster. @return A BASE64 encoded array. Never <code>null</code>.
[ "Encodes", "a", "raw", "byte", "array", "into", "a", "BASE64", "<code", ">", "String<", "/", "code", ">", "representation", "i", "accordance", "with", "RFC", "2045", "." ]
train
https://github.com/wizzardo/tools/blob/d14a3c5706408ff47973d630f039a7ad00953c24/modules/tools-security/src/main/java/com/wizzardo/tools/security/Base64.java#L608-L611
mikepenz/FastAdapter
library-core/src/main/java/com/mikepenz/fastadapter/select/SelectExtension.java
SelectExtension.selectByIdentifier
public void selectByIdentifier(final long identifier, final boolean fireEvent, final boolean considerSelectableFlag) { mFastAdapter.recursive(new AdapterPredicate<Item>() { @Override public boolean apply(@NonNull IAdapter<Item> lastParentAdapter, int lastParentPosition, Item item, int position) { if (item.getIdentifier() == identifier) { select(lastParentAdapter, item, position, fireEvent, considerSelectableFlag); return true; } return false; } }, true); }
java
public void selectByIdentifier(final long identifier, final boolean fireEvent, final boolean considerSelectableFlag) { mFastAdapter.recursive(new AdapterPredicate<Item>() { @Override public boolean apply(@NonNull IAdapter<Item> lastParentAdapter, int lastParentPosition, Item item, int position) { if (item.getIdentifier() == identifier) { select(lastParentAdapter, item, position, fireEvent, considerSelectableFlag); return true; } return false; } }, true); }
[ "public", "void", "selectByIdentifier", "(", "final", "long", "identifier", ",", "final", "boolean", "fireEvent", ",", "final", "boolean", "considerSelectableFlag", ")", "{", "mFastAdapter", ".", "recursive", "(", "new", "AdapterPredicate", "<", "Item", ">", "(", ...
selects an item by it's identifier @param identifier the identifier of the item to select @param fireEvent true if the onClick listener should be called @param considerSelectableFlag true if the select method should not select an item if its not selectable
[ "selects", "an", "item", "by", "it", "s", "identifier" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/select/SelectExtension.java#L430-L441
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/ParserAdapter.java
ParserAdapter.makeException
private SAXParseException makeException (String message) { if (locator != null) { return new SAXParseException(message, locator); } else { return new SAXParseException(message, null, null, -1, -1); } }
java
private SAXParseException makeException (String message) { if (locator != null) { return new SAXParseException(message, locator); } else { return new SAXParseException(message, null, null, -1, -1); } }
[ "private", "SAXParseException", "makeException", "(", "String", "message", ")", "{", "if", "(", "locator", "!=", "null", ")", "{", "return", "new", "SAXParseException", "(", "message", ",", "locator", ")", ";", "}", "else", "{", "return", "new", "SAXParseExc...
Construct an exception for the current context. @param message The error message.
[ "Construct", "an", "exception", "for", "the", "current", "context", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/ParserAdapter.java#L776-L783
apereo/cas
core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/DefaultResponse.java
DefaultResponse.getPostResponse
public static Response getPostResponse(final String url, final Map<String, String> attributes) { return new DefaultResponse(ResponseType.POST, url, attributes); }
java
public static Response getPostResponse(final String url, final Map<String, String> attributes) { return new DefaultResponse(ResponseType.POST, url, attributes); }
[ "public", "static", "Response", "getPostResponse", "(", "final", "String", "url", ",", "final", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "return", "new", "DefaultResponse", "(", "ResponseType", ".", "POST", ",", "url", ",", "attribut...
Gets the post response. @param url the url @param attributes the attributes @return the post response
[ "Gets", "the", "post", "response", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/DefaultResponse.java#L49-L51
soi-toolkit/soi-toolkit-mule
tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/util/FileUtil.java
FileUtil.copyFile
public static void copyFile(File srcFile, File destFile) { OutputStream out = null; InputStream in = null; try { if (!destFile.getParentFile().exists()) destFile.getParentFile().mkdirs(); in = new FileInputStream(srcFile); out = new FileOutputStream(destFile); // Transfer bytes from in to out byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } in.close(); out.close(); } catch (IOException e) { throw new RuntimeException(e); } }
java
public static void copyFile(File srcFile, File destFile) { OutputStream out = null; InputStream in = null; try { if (!destFile.getParentFile().exists()) destFile.getParentFile().mkdirs(); in = new FileInputStream(srcFile); out = new FileOutputStream(destFile); // Transfer bytes from in to out byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } in.close(); out.close(); } catch (IOException e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "copyFile", "(", "File", "srcFile", ",", "File", "destFile", ")", "{", "OutputStream", "out", "=", "null", ";", "InputStream", "in", "=", "null", ";", "try", "{", "if", "(", "!", "destFile", ".", "getParentFile", "(", ")", "...
Copy a file to new destination. @param srcFile @param destFile
[ "Copy", "a", "file", "to", "new", "destination", "." ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/util/FileUtil.java#L79-L100
google/closure-templates
java/src/com/google/template/soy/jbcsrc/PrintDirectives.java
PrintDirectives.applyStreamingPrintDirectives
static AppendableAndOptions applyStreamingPrintDirectives( List<PrintDirectiveNode> directives, Expression appendable, BasicExpressionCompiler basic, JbcSrcPluginContext renderContext, TemplateVariableManager variables) { List<DirectiveWithArgs> directivesToApply = new ArrayList<>(); for (PrintDirectiveNode directive : directives) { directivesToApply.add( DirectiveWithArgs.create( (SoyJbcSrcPrintDirective.Streamable) directive.getPrintDirective(), basic.compileToList(directive.getArgs()))); } return applyStreamingPrintDirectivesTo(directivesToApply, appendable, renderContext, variables); }
java
static AppendableAndOptions applyStreamingPrintDirectives( List<PrintDirectiveNode> directives, Expression appendable, BasicExpressionCompiler basic, JbcSrcPluginContext renderContext, TemplateVariableManager variables) { List<DirectiveWithArgs> directivesToApply = new ArrayList<>(); for (PrintDirectiveNode directive : directives) { directivesToApply.add( DirectiveWithArgs.create( (SoyJbcSrcPrintDirective.Streamable) directive.getPrintDirective(), basic.compileToList(directive.getArgs()))); } return applyStreamingPrintDirectivesTo(directivesToApply, appendable, renderContext, variables); }
[ "static", "AppendableAndOptions", "applyStreamingPrintDirectives", "(", "List", "<", "PrintDirectiveNode", ">", "directives", ",", "Expression", "appendable", ",", "BasicExpressionCompiler", "basic", ",", "JbcSrcPluginContext", "renderContext", ",", "TemplateVariableManager", ...
Applies all the streaming print directives to the appendable. @param directives The directives. All are required to be {@link com.google.template.soy.jbcsrc.restricted.SoyJbcSrcPrintDirective.Streamable streamable} @param appendable The appendable to wrap @param basic The expression compiler to use for compiling the arguments @param renderContext The render context for the plugins @param variables The local variable manager @return The wrapped appendable
[ "Applies", "all", "the", "streaming", "print", "directives", "to", "the", "appendable", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/PrintDirectives.java#L116-L130
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java
GeneFeatureHelper.outputFastaSequenceLengthGFF3
static public void outputFastaSequenceLengthGFF3(File fastaSequenceFile, File gffFile) throws Exception { LinkedHashMap<String, DNASequence> dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile); String fileName = fastaSequenceFile.getName(); FileWriter fw = new FileWriter(gffFile); String newLine = System.getProperty("line.separator"); fw.write("##gff-version 3" + newLine); for (DNASequence dnaSequence : dnaSequenceList.values()) { String gff3line = dnaSequence.getAccession().getID() + "\t" + fileName + "\t" + "contig" + "\t" + "1" + "\t" + dnaSequence.getBioEnd() + "\t.\t.\t.\tName=" + dnaSequence.getAccession().getID() + newLine; fw.write(gff3line); } fw.close(); }
java
static public void outputFastaSequenceLengthGFF3(File fastaSequenceFile, File gffFile) throws Exception { LinkedHashMap<String, DNASequence> dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile); String fileName = fastaSequenceFile.getName(); FileWriter fw = new FileWriter(gffFile); String newLine = System.getProperty("line.separator"); fw.write("##gff-version 3" + newLine); for (DNASequence dnaSequence : dnaSequenceList.values()) { String gff3line = dnaSequence.getAccession().getID() + "\t" + fileName + "\t" + "contig" + "\t" + "1" + "\t" + dnaSequence.getBioEnd() + "\t.\t.\t.\tName=" + dnaSequence.getAccession().getID() + newLine; fw.write(gff3line); } fw.close(); }
[ "static", "public", "void", "outputFastaSequenceLengthGFF3", "(", "File", "fastaSequenceFile", ",", "File", "gffFile", ")", "throws", "Exception", "{", "LinkedHashMap", "<", "String", ",", "DNASequence", ">", "dnaSequenceList", "=", "FastaReaderHelper", ".", "readFast...
Output a gff3 feature file that will give the length of each scaffold/chromosome in the fasta file. Used for gbrowse so it knows length. @param fastaSequenceFile @param gffFile @throws Exception
[ "Output", "a", "gff3", "feature", "file", "that", "will", "give", "the", "length", "of", "each", "scaffold", "/", "chromosome", "in", "the", "fasta", "file", ".", "Used", "for", "gbrowse", "so", "it", "knows", "length", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java#L164-L175
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java
ICUResourceBundle.getFullLocaleNameSet
public static Set<String> getFullLocaleNameSet(String bundlePrefix, ClassLoader loader) { return getAvailEntry(bundlePrefix, loader).getFullLocaleNameSet(); }
java
public static Set<String> getFullLocaleNameSet(String bundlePrefix, ClassLoader loader) { return getAvailEntry(bundlePrefix, loader).getFullLocaleNameSet(); }
[ "public", "static", "Set", "<", "String", ">", "getFullLocaleNameSet", "(", "String", "bundlePrefix", ",", "ClassLoader", "loader", ")", "{", "return", "getAvailEntry", "(", "bundlePrefix", ",", "loader", ")", ".", "getFullLocaleNameSet", "(", ")", ";", "}" ]
Return a set of all the locale names supported by a collection of resource bundles. @param bundlePrefix the prefix of the resource bundles to use.
[ "Return", "a", "set", "of", "all", "the", "locale", "names", "supported", "by", "a", "collection", "of", "resource", "bundles", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L459-L461
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/locking/ReadCommittedStrategy.java
ReadCommittedStrategy.checkRead
public boolean checkRead(TransactionImpl tx, Object obj) { if (hasReadLock(tx, obj)) { return true; } LockEntry writer = getWriter(obj); if (writer.isOwnedBy(tx)) { return true; } return false; }
java
public boolean checkRead(TransactionImpl tx, Object obj) { if (hasReadLock(tx, obj)) { return true; } LockEntry writer = getWriter(obj); if (writer.isOwnedBy(tx)) { return true; } return false; }
[ "public", "boolean", "checkRead", "(", "TransactionImpl", "tx", ",", "Object", "obj", ")", "{", "if", "(", "hasReadLock", "(", "tx", ",", "obj", ")", ")", "{", "return", "true", ";", "}", "LockEntry", "writer", "=", "getWriter", "(", "obj", ")", ";", ...
checks whether the specified Object obj is read-locked by Transaction tx. @param tx the transaction @param obj the Object to be checked @return true if lock exists, else false
[ "checks", "whether", "the", "specified", "Object", "obj", "is", "read", "-", "locked", "by", "Transaction", "tx", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/ReadCommittedStrategy.java#L156-L168
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java
AlignedBox3f.setX
@Override public void setX(double min, double max) { if (min <= max) { this.minx = min; this.maxx = max; } else { this.minx = max; this.maxx = min; } }
java
@Override public void setX(double min, double max) { if (min <= max) { this.minx = min; this.maxx = max; } else { this.minx = max; this.maxx = min; } }
[ "@", "Override", "public", "void", "setX", "(", "double", "min", ",", "double", "max", ")", "{", "if", "(", "min", "<=", "max", ")", "{", "this", ".", "minx", "=", "min", ";", "this", ".", "maxx", "=", "max", ";", "}", "else", "{", "this", ".",...
Set the x bounds of the box. @param min the min value for the x axis. @param max the max value for the x axis.
[ "Set", "the", "x", "bounds", "of", "the", "box", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java#L603-L612
javagl/CommonUI
src/main/java/de/javagl/common/ui/text/JTextComponents.java
JTextComponents.findPrevious
static Point findPrevious( String text, String query, int startIndex, boolean ignoreCase) { int offset = StringUtils.lastIndexOf( text, query, startIndex, ignoreCase); int length = query.length(); while (offset != -1) { return new Point(offset, offset + length); } return null; }
java
static Point findPrevious( String text, String query, int startIndex, boolean ignoreCase) { int offset = StringUtils.lastIndexOf( text, query, startIndex, ignoreCase); int length = query.length(); while (offset != -1) { return new Point(offset, offset + length); } return null; }
[ "static", "Point", "findPrevious", "(", "String", "text", ",", "String", "query", ",", "int", "startIndex", ",", "boolean", "ignoreCase", ")", "{", "int", "offset", "=", "StringUtils", ".", "lastIndexOf", "(", "text", ",", "query", ",", "startIndex", ",", ...
Find the previous appearance of the given query in the given text, starting at the given index. The result will be a point <code>(startIndex, endIndex)</code> indicating the appearance, or <code>null</code> if none is found. @param text The text @param query The query @param startIndex The start index @param ignoreCase Whether the case should be ignored @return The previous appearance
[ "Find", "the", "previous", "appearance", "of", "the", "given", "query", "in", "the", "given", "text", "starting", "at", "the", "given", "index", ".", "The", "result", "will", "be", "a", "point", "<code", ">", "(", "startIndex", "endIndex", ")", "<", "/",...
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/text/JTextComponents.java#L90-L101
grpc/grpc-java
okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/OptionalMethod.java
OptionalMethod.invokeOptional
public Object invokeOptional(T target, Object... args) throws InvocationTargetException { Method m = getMethod(target.getClass()); if (m == null) { return null; } try { return m.invoke(target, args); } catch (IllegalAccessException e) { return null; } }
java
public Object invokeOptional(T target, Object... args) throws InvocationTargetException { Method m = getMethod(target.getClass()); if (m == null) { return null; } try { return m.invoke(target, args); } catch (IllegalAccessException e) { return null; } }
[ "public", "Object", "invokeOptional", "(", "T", "target", ",", "Object", "...", "args", ")", "throws", "InvocationTargetException", "{", "Method", "m", "=", "getMethod", "(", "target", ".", "getClass", "(", ")", ")", ";", "if", "(", "m", "==", "null", ")...
Invokes the method on {@code target} with {@code args}. If the method does not exist or is not public then {@code null} is returned. See also {@link #invokeOptionalWithoutCheckedException(Object, Object...)}. @throws IllegalArgumentException if the arguments are invalid @throws InvocationTargetException if the invocation throws an exception
[ "Invokes", "the", "method", "on", "{", "@code", "target", "}", "with", "{", "@code", "args", "}", ".", "If", "the", "method", "does", "not", "exist", "or", "is", "not", "public", "then", "{", "@code", "null", "}", "is", "returned", ".", "See", "also"...
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/OptionalMethod.java#L71-L81
spotify/helios
helios-tools/src/main/java/com/spotify/helios/cli/CliConfig.java
CliConfig.fromUserConfig
public static CliConfig fromUserConfig(final Map<String, String> environmentVariables) throws IOException, URISyntaxException { final String userHome = System.getProperty("user.home"); final String defaults = userHome + File.separator + CONFIG_PATH; final File defaultsFile = new File(defaults); return fromFile(defaultsFile, environmentVariables); }
java
public static CliConfig fromUserConfig(final Map<String, String> environmentVariables) throws IOException, URISyntaxException { final String userHome = System.getProperty("user.home"); final String defaults = userHome + File.separator + CONFIG_PATH; final File defaultsFile = new File(defaults); return fromFile(defaultsFile, environmentVariables); }
[ "public", "static", "CliConfig", "fromUserConfig", "(", "final", "Map", "<", "String", ",", "String", ">", "environmentVariables", ")", "throws", "IOException", ",", "URISyntaxException", "{", "final", "String", "userHome", "=", "System", ".", "getProperty", "(", ...
Returns a CliConfig instance with values from a config file from under the users home directory: <p>&lt;user.home&gt;/.helios/config <p>If the file is not found, a CliConfig with pre-defined values will be returned. @return The configuration @throws IOException If the file exists but could not be read @throws URISyntaxException If a HELIOS_MASTER env var is present and doesn't parse as a URI
[ "Returns", "a", "CliConfig", "instance", "with", "values", "from", "a", "config", "file", "from", "under", "the", "users", "home", "directory", ":" ]
train
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-tools/src/main/java/com/spotify/helios/cli/CliConfig.java#L107-L113
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java
SARLJvmModelInferrer.appendSerialNumberIfSerializable
protected void appendSerialNumberIfSerializable(GenerationContext context, XtendTypeDeclaration source, JvmGenericType target) { if (!target.isInterface() && this.inheritanceHelper.isSubTypeOf(target, Serializable.class, null)) { appendSerialNumber(context, source, target); } }
java
protected void appendSerialNumberIfSerializable(GenerationContext context, XtendTypeDeclaration source, JvmGenericType target) { if (!target.isInterface() && this.inheritanceHelper.isSubTypeOf(target, Serializable.class, null)) { appendSerialNumber(context, source, target); } }
[ "protected", "void", "appendSerialNumberIfSerializable", "(", "GenerationContext", "context", ",", "XtendTypeDeclaration", "source", ",", "JvmGenericType", "target", ")", "{", "if", "(", "!", "target", ".", "isInterface", "(", ")", "&&", "this", ".", "inheritanceHel...
Append the serial number field if and only if the container type is serializable. <p>The serial number field is computed from the given context and from the generated fields. @param context the current generation context. @param source the source object. @param target the inferred JVM object. @see #appendSerialNumber(GenerationContext, XtendTypeDeclaration, JvmGenericType)
[ "Append", "the", "serial", "number", "field", "if", "and", "only", "if", "the", "container", "type", "is", "serializable", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java#L2801-L2805
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/alerts/AbstractAlertCondition.java
AbstractAlertCondition.buildQueryFilter
protected String buildQueryFilter(String streamId, String query) { checkArgument(streamId != null, "streamId parameter cannot be null"); final String trimmedStreamId = streamId.trim(); checkArgument(!trimmedStreamId.isEmpty(), "streamId parameter cannot be empty"); final StringBuilder builder = new StringBuilder().append("streams:").append(trimmedStreamId); if (query != null) { final String trimmedQuery = query.trim(); if (!trimmedQuery.isEmpty() && !"*".equals(trimmedQuery)) { builder.append(" AND (").append(trimmedQuery).append(")"); } } return builder.toString(); }
java
protected String buildQueryFilter(String streamId, String query) { checkArgument(streamId != null, "streamId parameter cannot be null"); final String trimmedStreamId = streamId.trim(); checkArgument(!trimmedStreamId.isEmpty(), "streamId parameter cannot be empty"); final StringBuilder builder = new StringBuilder().append("streams:").append(trimmedStreamId); if (query != null) { final String trimmedQuery = query.trim(); if (!trimmedQuery.isEmpty() && !"*".equals(trimmedQuery)) { builder.append(" AND (").append(trimmedQuery).append(")"); } } return builder.toString(); }
[ "protected", "String", "buildQueryFilter", "(", "String", "streamId", ",", "String", "query", ")", "{", "checkArgument", "(", "streamId", "!=", "null", ",", "\"streamId parameter cannot be null\"", ")", ";", "final", "String", "trimmedStreamId", "=", "streamId", "."...
Combines the given stream ID and query string into a single filter string. @param streamId the stream ID @param query the query string (might be null or empty) @return the combined filter string
[ "Combines", "the", "given", "stream", "ID", "and", "query", "string", "into", "a", "single", "filter", "string", "." ]
train
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/alerts/AbstractAlertCondition.java#L170-L187
actorapp/actor-platform
actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/markdown/MarkdownParser.java
MarkdownParser.handleSpan
private boolean handleSpan(TextCursor cursor, int blockEnd, ArrayList<MDText> elements) { if (mode != MODE_ONLY_LINKS) { int spanStart = findSpanStart(cursor, blockEnd); if (spanStart >= 0) { char span = cursor.text.charAt(spanStart); int spanEnd = findSpanEnd(cursor, spanStart, blockEnd, span); if (spanEnd >= 0) { // Handling next elements before span handleUrls(cursor, spanStart, elements); // Increment offset before processing internal spans cursor.currentOffset++; // Building child spans MDText[] spanElements = handleSpans(cursor, spanEnd - 1); // End of search: move cursor after span cursor.currentOffset = spanEnd; MDSpan spanElement = new MDSpan( span == '*' ? MDSpan.TYPE_BOLD : MDSpan.TYPE_ITALIC, spanElements); elements.add(spanElement); return true; } } } handleUrls(cursor, blockEnd, elements); return false; }
java
private boolean handleSpan(TextCursor cursor, int blockEnd, ArrayList<MDText> elements) { if (mode != MODE_ONLY_LINKS) { int spanStart = findSpanStart(cursor, blockEnd); if (spanStart >= 0) { char span = cursor.text.charAt(spanStart); int spanEnd = findSpanEnd(cursor, spanStart, blockEnd, span); if (spanEnd >= 0) { // Handling next elements before span handleUrls(cursor, spanStart, elements); // Increment offset before processing internal spans cursor.currentOffset++; // Building child spans MDText[] spanElements = handleSpans(cursor, spanEnd - 1); // End of search: move cursor after span cursor.currentOffset = spanEnd; MDSpan spanElement = new MDSpan( span == '*' ? MDSpan.TYPE_BOLD : MDSpan.TYPE_ITALIC, spanElements); elements.add(spanElement); return true; } } } handleUrls(cursor, blockEnd, elements); return false; }
[ "private", "boolean", "handleSpan", "(", "TextCursor", "cursor", ",", "int", "blockEnd", ",", "ArrayList", "<", "MDText", ">", "elements", ")", "{", "if", "(", "mode", "!=", "MODE_ONLY_LINKS", ")", "{", "int", "spanStart", "=", "findSpanStart", "(", "cursor"...
Handling span @param cursor text cursor @param blockEnd span search limit @param elements current elements @return is
[ "Handling", "span" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/markdown/MarkdownParser.java#L112-L146
classgraph/classgraph
src/main/java/io/github/classgraph/ClassInfo.java
ClassInfo.getOrCreateClassInfo
static ClassInfo getOrCreateClassInfo(final String className, final int classModifiers, final Map<String, ClassInfo> classNameToClassInfo) { ClassInfo classInfo = classNameToClassInfo.get(className); if (classInfo == null) { classNameToClassInfo.put(className, classInfo = new ClassInfo(className, classModifiers, /* classfileResource = */ null)); } classInfo.setModifiers(classModifiers); return classInfo; }
java
static ClassInfo getOrCreateClassInfo(final String className, final int classModifiers, final Map<String, ClassInfo> classNameToClassInfo) { ClassInfo classInfo = classNameToClassInfo.get(className); if (classInfo == null) { classNameToClassInfo.put(className, classInfo = new ClassInfo(className, classModifiers, /* classfileResource = */ null)); } classInfo.setModifiers(classModifiers); return classInfo; }
[ "static", "ClassInfo", "getOrCreateClassInfo", "(", "final", "String", "className", ",", "final", "int", "classModifiers", ",", "final", "Map", "<", "String", ",", "ClassInfo", ">", "classNameToClassInfo", ")", "{", "ClassInfo", "classInfo", "=", "classNameToClassIn...
Get a ClassInfo object, or create it if it doesn't exist. N.B. not threadsafe, so ClassInfo objects should only ever be constructed by a single thread. @param className the class name @param classModifiers the class modifiers @param classNameToClassInfo the map from class name to class info @return the or create class info
[ "Get", "a", "ClassInfo", "object", "or", "create", "it", "if", "it", "doesn", "t", "exist", ".", "N", ".", "B", ".", "not", "threadsafe", "so", "ClassInfo", "objects", "should", "only", "ever", "be", "constructed", "by", "a", "single", "thread", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ClassInfo.java#L309-L318
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/util/GAEUtils.java
GAEUtils.wildcardMatch
static boolean wildcardMatch(String filename, String wildcardMatcher) { return wildcardMatch(filename, wildcardMatcher, IOCase.SENSITIVE); }
java
static boolean wildcardMatch(String filename, String wildcardMatcher) { return wildcardMatch(filename, wildcardMatcher, IOCase.SENSITIVE); }
[ "static", "boolean", "wildcardMatch", "(", "String", "filename", ",", "String", "wildcardMatcher", ")", "{", "return", "wildcardMatch", "(", "filename", ",", "wildcardMatcher", ",", "IOCase", ".", "SENSITIVE", ")", ";", "}" ]
Checks a filename to see if it matches the specified wildcard matcher, always testing case-sensitive. <p> The wildcard matcher uses the characters '?' and '*' to represent a single or multiple (zero or more) wildcard characters. This is the same as often found on Dos/Unix command lines. The check is case-sensitive always. <pre> wildcardMatch("c.txt", "*.txt") --> true wildcardMatch("c.txt", "*.jpg") --> false wildcardMatch("a/b/c.txt", "a/b/*") --> true wildcardMatch("c.txt", "*.???") --> true wildcardMatch("c.txt", "*.????") --> false </pre> N.B. the sequence "*?" does not work properly at present in match strings. @param filename the filename to match on @param wildcardMatcher the wildcard string to match against @return true if the filename matches the wilcard string @see IOCase#SENSITIVE
[ "Checks", "a", "filename", "to", "see", "if", "it", "matches", "the", "specified", "wildcard", "matcher", "always", "testing", "case", "-", "sensitive", ".", "<p", ">", "The", "wildcard", "matcher", "uses", "the", "characters", "?", "and", "*", "to", "repr...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/util/GAEUtils.java#L150-L153
openbase/jul
processing/xml/src/main/java/org/openbase/jul/processing/xml/processing/XMLProcessor.java
XMLProcessor.normalizeFormatting
public static Node normalizeFormatting(final Node doc) throws CouldNotProcessException { try { return createDocumentFromString(normalizeFormattingAsString(doc)); } catch (XMLParsingException ex) { throw new CouldNotProcessException("Couldn't normalize formatting. Returning old document.", ex); } }
java
public static Node normalizeFormatting(final Node doc) throws CouldNotProcessException { try { return createDocumentFromString(normalizeFormattingAsString(doc)); } catch (XMLParsingException ex) { throw new CouldNotProcessException("Couldn't normalize formatting. Returning old document.", ex); } }
[ "public", "static", "Node", "normalizeFormatting", "(", "final", "Node", "doc", ")", "throws", "CouldNotProcessException", "{", "try", "{", "return", "createDocumentFromString", "(", "normalizeFormattingAsString", "(", "doc", ")", ")", ";", "}", "catch", "(", "XML...
Creates a pretty formatted version of doc. Note: does not remove line breaks! @param doc @return
[ "Creates", "a", "pretty", "formatted", "version", "of", "doc", ".", "Note", ":", "does", "not", "remove", "line", "breaks!" ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/processing/xml/src/main/java/org/openbase/jul/processing/xml/processing/XMLProcessor.java#L385-L391
alkacon/opencms-core
src/org/opencms/staticexport/CmsLinkManager.java
CmsLinkManager.getRootPath
public String getRootPath(CmsObject cms, String targetUri) { return getRootPath(cms, targetUri, null); }
java
public String getRootPath(CmsObject cms, String targetUri) { return getRootPath(cms, targetUri, null); }
[ "public", "String", "getRootPath", "(", "CmsObject", "cms", ",", "String", "targetUri", ")", "{", "return", "getRootPath", "(", "cms", ",", "targetUri", ",", "null", ")", ";", "}" ]
Returns the resource root path in the OpenCms VFS for the given target URI link, or <code>null</code> in case the link points to an external site.<p> This methods does not support relative target URI links, so the given URI must be an absolute link.<p> See {@link #getRootPath(CmsObject, String)} for a full explanation of this method.<p> @param cms the current users OpenCms context @param targetUri the target URI link @return the resource root path in the OpenCms VFS for the given target URI link, or <code>null</code> in case the link points to an external site @see #getRootPath(CmsObject, String, String) @since 7.0.2
[ "Returns", "the", "resource", "root", "path", "in", "the", "OpenCms", "VFS", "for", "the", "given", "target", "URI", "link", "or", "<code", ">", "null<", "/", "code", ">", "in", "case", "the", "link", "points", "to", "an", "external", "site", ".", "<p"...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsLinkManager.java#L503-L506
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optLongArray
@Nullable public static long[] optLongArray(@Nullable Bundle bundle, @Nullable String key) { return optLongArray(bundle, key, new long[0]); }
java
@Nullable public static long[] optLongArray(@Nullable Bundle bundle, @Nullable String key) { return optLongArray(bundle, key, new long[0]); }
[ "@", "Nullable", "public", "static", "long", "[", "]", "optLongArray", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ")", "{", "return", "optLongArray", "(", "bundle", ",", "key", ",", "new", "long", "[", "0", "]", ")...
Returns a optional long array value. In other words, returns the value mapped by key if it exists and is a long array. The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null. @param bundle a bundle. If the bundle is null, this method will return null. @param key a key for the value. @return a long array value if exists, null otherwise. @see android.os.Bundle#getInt(String, int)
[ "Returns", "a", "optional", "long", "array", "value", ".", "In", "other", "words", "returns", "the", "value", "mapped", "by", "key", "if", "it", "exists", "and", "is", "a", "long", "array", ".", "The", "bundle", "argument", "is", "allowed", "to", "be", ...
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L659-L662
linkedin/PalDB
paldb/src/main/java/com/linkedin/paldb/api/Configuration.java
Configuration.getFloat
public float getFloat(String key, float defaultValue) { if (containsKey(key)) { return Float.parseFloat(get(key)); } else { return defaultValue; } }
java
public float getFloat(String key, float defaultValue) { if (containsKey(key)) { return Float.parseFloat(get(key)); } else { return defaultValue; } }
[ "public", "float", "getFloat", "(", "String", "key", ",", "float", "defaultValue", ")", "{", "if", "(", "containsKey", "(", "key", ")", ")", "{", "return", "Float", ".", "parseFloat", "(", "get", "(", "key", ")", ")", ";", "}", "else", "{", "return",...
Gets the float value for <code>key</code> or <code>defaultValue</code> if not found. @param key key to get value for @param defaultValue default value if key not found @return value or <code>defaultValue</code> if not found
[ "Gets", "the", "float", "value", "for", "<code", ">", "key<", "/", "code", ">", "or", "<code", ">", "defaultValue<", "/", "code", ">", "if", "not", "found", "." ]
train
https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/api/Configuration.java#L318-L324
francisdb/serviceloader-maven-plugin
src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java
ServiceloaderMojo.generateClassPathUrls
private URL[] generateClassPathUrls() throws MojoExecutionException { List<URL> urls = new ArrayList<URL>(); URL url; try { for (Object element : getCompileClasspath()) { String path = (String) element; if (path.endsWith(".jar")) { url = new URL("jar:" + new File(path).toURI().toString() + "!/"); } else { url = new File(path).toURI().toURL(); } urls.add(url); } } catch (MalformedURLException e) { throw new MojoExecutionException("Could not set up classpath", e); } return urls.toArray(new URL[urls.size()]); }
java
private URL[] generateClassPathUrls() throws MojoExecutionException { List<URL> urls = new ArrayList<URL>(); URL url; try { for (Object element : getCompileClasspath()) { String path = (String) element; if (path.endsWith(".jar")) { url = new URL("jar:" + new File(path).toURI().toString() + "!/"); } else { url = new File(path).toURI().toURL(); } urls.add(url); } } catch (MalformedURLException e) { throw new MojoExecutionException("Could not set up classpath", e); } return urls.toArray(new URL[urls.size()]); }
[ "private", "URL", "[", "]", "generateClassPathUrls", "(", ")", "throws", "MojoExecutionException", "{", "List", "<", "URL", ">", "urls", "=", "new", "ArrayList", "<", "URL", ">", "(", ")", ";", "URL", "url", ";", "try", "{", "for", "(", "Object", "elem...
Generates a URL[] with the project class path (can be used by a URLClassLoader) @return the array of classpath URL's @throws MojoExecutionException
[ "Generates", "a", "URL", "[]", "with", "the", "project", "class", "path", "(", "can", "be", "used", "by", "a", "URLClassLoader", ")" ]
train
https://github.com/francisdb/serviceloader-maven-plugin/blob/521a467ed5c00636749f6c6531be85ddf296565e/src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java#L342-L359
alkacon/opencms-core
src/org/opencms/ui/apps/search/CmsSearchReplaceThread.java
CmsSearchReplaceThread.searchAndReplace
protected void searchAndReplace(List<CmsResource> resources) { // the file counter int counter = 0; int resCount = resources.size(); I_CmsReport report = getReport(); // iterate over the files in the selected path for (CmsResource resource : resources) { try { // get the content CmsFile file = getCms().readFile(resource); byte[] contents = file.getContents(); // report the current resource ++counter; report(report, counter, resCount, resource); // search and replace byte[] result = null; boolean xpath = false; if ((CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_settings.getXpath()) || m_settings.isOnlyContentValues()) && CmsResourceTypeXmlContent.isXmlContent(resource)) { xpath = true; } if (!xpath) { result = replaceInContent(file, contents); } else { result = replaceInXml(file); } if ((result != null) && (contents != null) && !contents.equals(result)) { // rewrite the content writeContent(file, result); } else { getReport().println(); } } catch (Exception e) { report.print( org.opencms.report.Messages.get().container(Messages.RPT_SOURCESEARCH_COULD_NOT_READ_FILE_0), I_CmsReport.FORMAT_ERROR); report.addError(e); report.println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0), I_CmsReport.FORMAT_ERROR); m_errorSearch += 1; LOG.error( org.opencms.report.Messages.get().container(Messages.RPT_SOURCESEARCH_COULD_NOT_READ_FILE_0), e); continue; } } // report results reportResults(resources.size()); }
java
protected void searchAndReplace(List<CmsResource> resources) { // the file counter int counter = 0; int resCount = resources.size(); I_CmsReport report = getReport(); // iterate over the files in the selected path for (CmsResource resource : resources) { try { // get the content CmsFile file = getCms().readFile(resource); byte[] contents = file.getContents(); // report the current resource ++counter; report(report, counter, resCount, resource); // search and replace byte[] result = null; boolean xpath = false; if ((CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_settings.getXpath()) || m_settings.isOnlyContentValues()) && CmsResourceTypeXmlContent.isXmlContent(resource)) { xpath = true; } if (!xpath) { result = replaceInContent(file, contents); } else { result = replaceInXml(file); } if ((result != null) && (contents != null) && !contents.equals(result)) { // rewrite the content writeContent(file, result); } else { getReport().println(); } } catch (Exception e) { report.print( org.opencms.report.Messages.get().container(Messages.RPT_SOURCESEARCH_COULD_NOT_READ_FILE_0), I_CmsReport.FORMAT_ERROR); report.addError(e); report.println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0), I_CmsReport.FORMAT_ERROR); m_errorSearch += 1; LOG.error( org.opencms.report.Messages.get().container(Messages.RPT_SOURCESEARCH_COULD_NOT_READ_FILE_0), e); continue; } } // report results reportResults(resources.size()); }
[ "protected", "void", "searchAndReplace", "(", "List", "<", "CmsResource", ">", "resources", ")", "{", "// the file counter", "int", "counter", "=", "0", ";", "int", "resCount", "=", "resources", ".", "size", "(", ")", ";", "I_CmsReport", "report", "=", "getR...
Search the resources.<p> @param resources the relevant resources
[ "Search", "the", "resources", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/search/CmsSearchReplaceThread.java#L308-L365
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryLookupService.java
DirectoryLookupService.addNotificationHandler
public void addNotificationHandler(String serviceName, NotificationHandler handler){ if(handler == null || serviceName == null || serviceName.isEmpty()){ throw new IllegalArgumentException(); } synchronized(notificationHandlers){ if(! notificationHandlers.containsKey(serviceName)){ notificationHandlers.put(serviceName, new ArrayList<NotificationHandler>()); } notificationHandlers.get(serviceName).add(handler); } }
java
public void addNotificationHandler(String serviceName, NotificationHandler handler){ if(handler == null || serviceName == null || serviceName.isEmpty()){ throw new IllegalArgumentException(); } synchronized(notificationHandlers){ if(! notificationHandlers.containsKey(serviceName)){ notificationHandlers.put(serviceName, new ArrayList<NotificationHandler>()); } notificationHandlers.get(serviceName).add(handler); } }
[ "public", "void", "addNotificationHandler", "(", "String", "serviceName", ",", "NotificationHandler", "handler", ")", "{", "if", "(", "handler", "==", "null", "||", "serviceName", "==", "null", "||", "serviceName", ".", "isEmpty", "(", ")", ")", "{", "throw", ...
Add a NotificationHandler to the Service. This method can check the duplicate NotificationHandler for the serviceName, if the NotificationHandler already exists in the serviceName, do nothing. Throw IllegalArgumentException if serviceName or handler is null. @param serviceName the service name. @param handler the NotificationHandler for the service.
[ "Add", "a", "NotificationHandler", "to", "the", "Service", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryLookupService.java#L220-L233
Azure/azure-sdk-for-java
batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/WorkspacesInner.java
WorkspacesInner.getByResourceGroup
public WorkspaceInner getByResourceGroup(String resourceGroupName, String workspaceName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); }
java
public WorkspaceInner getByResourceGroup(String resourceGroupName, String workspaceName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); }
[ "public", "WorkspaceInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "workspaceName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "workspaceName", ")", ".", "toBlocking", "(", ")", ".", ...
Gets information about a Workspace. @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. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the WorkspaceInner object if successful.
[ "Gets", "information", "about", "a", "Workspace", "." ]
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/WorkspacesInner.java#L899-L901
nemerosa/ontrack
ontrack-extension-svn/src/main/java/net/nemerosa/ontrack/extension/svn/property/SVNSyncPropertyType.java
SVNSyncPropertyType.canEdit
@Override public boolean canEdit(ProjectEntity entity, SecurityService securityService) { return securityService.isProjectFunctionGranted(entity, ProjectConfig.class) && propertyService.hasProperty( entity, SVNBranchConfigurationPropertyType.class); }
java
@Override public boolean canEdit(ProjectEntity entity, SecurityService securityService) { return securityService.isProjectFunctionGranted(entity, ProjectConfig.class) && propertyService.hasProperty( entity, SVNBranchConfigurationPropertyType.class); }
[ "@", "Override", "public", "boolean", "canEdit", "(", "ProjectEntity", "entity", ",", "SecurityService", "securityService", ")", "{", "return", "securityService", ".", "isProjectFunctionGranted", "(", "entity", ",", "ProjectConfig", ".", "class", ")", "&&", "propert...
One can edit the SVN synchronisation only if he can configure the project and if the branch is configured for SVN.
[ "One", "can", "edit", "the", "SVN", "synchronisation", "only", "if", "he", "can", "configure", "the", "project", "and", "if", "the", "branch", "is", "configured", "for", "SVN", "." ]
train
https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-extension-svn/src/main/java/net/nemerosa/ontrack/extension/svn/property/SVNSyncPropertyType.java#L55-L61
atomix/atomix
core/src/main/java/io/atomix/core/impl/CoreTransactionService.java
CoreTransactionService.recoverTransactions
private void recoverTransactions(AsyncIterator<Map.Entry<TransactionId, Versioned<TransactionInfo>>> iterator, MemberId memberId) { iterator.next().thenAccept(entry -> { if (entry.getValue().value().coordinator.equals(memberId)) { recoverTransaction(entry.getKey(), entry.getValue().value()); } recoverTransactions(iterator, memberId); }); }
java
private void recoverTransactions(AsyncIterator<Map.Entry<TransactionId, Versioned<TransactionInfo>>> iterator, MemberId memberId) { iterator.next().thenAccept(entry -> { if (entry.getValue().value().coordinator.equals(memberId)) { recoverTransaction(entry.getKey(), entry.getValue().value()); } recoverTransactions(iterator, memberId); }); }
[ "private", "void", "recoverTransactions", "(", "AsyncIterator", "<", "Map", ".", "Entry", "<", "TransactionId", ",", "Versioned", "<", "TransactionInfo", ">", ">", ">", "iterator", ",", "MemberId", "memberId", ")", "{", "iterator", ".", "next", "(", ")", "."...
Recursively recovers transactions using the given iterator. @param iterator the asynchronous iterator from which to recover transactions @param memberId the transaction member ID
[ "Recursively", "recovers", "transactions", "using", "the", "given", "iterator", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/core/src/main/java/io/atomix/core/impl/CoreTransactionService.java#L197-L204
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLReflexiveObjectPropertyAxiomImpl_CustomFieldSerializer.java
OWLReflexiveObjectPropertyAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLReflexiveObjectPropertyAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLReflexiveObjectPropertyAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLReflexiveObjectPropertyAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", ...
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLReflexiveObjectPropertyAxiomImpl_CustomFieldSerializer.java#L95-L98
strator-dev/greenpepper
greenpepper/core/src/main/java/com/greenpepper/util/ExceptionUtils.java
ExceptionUtils.stackTrace
public static String stackTrace( Throwable t, String separator, int depth ) { if (GreenPepper.isDebugEnabled()) depth = FULL; StringWriter sw = new StringWriter(); sw.append( t.toString() ); for (int i = 0; i < t.getStackTrace().length && i <= depth; i++) { StackTraceElement element = t.getStackTrace()[i]; sw.append( separator ).append( element.toString() ); } return sw.toString(); }
java
public static String stackTrace( Throwable t, String separator, int depth ) { if (GreenPepper.isDebugEnabled()) depth = FULL; StringWriter sw = new StringWriter(); sw.append( t.toString() ); for (int i = 0; i < t.getStackTrace().length && i <= depth; i++) { StackTraceElement element = t.getStackTrace()[i]; sw.append( separator ).append( element.toString() ); } return sw.toString(); }
[ "public", "static", "String", "stackTrace", "(", "Throwable", "t", ",", "String", "separator", ",", "int", "depth", ")", "{", "if", "(", "GreenPepper", ".", "isDebugEnabled", "(", ")", ")", "depth", "=", "FULL", ";", "StringWriter", "sw", "=", "new", "St...
<p>stackTrace.</p> @param t a {@link java.lang.Throwable} object. @param separator a {@link java.lang.String} object. @param depth a int. @return a {@link java.lang.String} object.
[ "<p", ">", "stackTrace", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/util/ExceptionUtils.java#L60-L72
segmentio/analytics-android
analytics/src/main/java/com/segment/analytics/SegmentIntegration.java
SegmentIntegration.createQueueFile
static QueueFile createQueueFile(File folder, String name) throws IOException { createDirectory(folder); File file = new File(folder, name); try { return new QueueFile(file); } catch (IOException e) { //noinspection ResultOfMethodCallIgnored if (file.delete()) { return new QueueFile(file); } else { throw new IOException("Could not create queue file (" + name + ") in " + folder + "."); } } }
java
static QueueFile createQueueFile(File folder, String name) throws IOException { createDirectory(folder); File file = new File(folder, name); try { return new QueueFile(file); } catch (IOException e) { //noinspection ResultOfMethodCallIgnored if (file.delete()) { return new QueueFile(file); } else { throw new IOException("Could not create queue file (" + name + ") in " + folder + "."); } } }
[ "static", "QueueFile", "createQueueFile", "(", "File", "folder", ",", "String", "name", ")", "throws", "IOException", "{", "createDirectory", "(", "folder", ")", ";", "File", "file", "=", "new", "File", "(", "folder", ",", "name", ")", ";", "try", "{", "...
Create a {@link QueueFile} in the given folder with the given name. If the underlying file is somehow corrupted, we'll delete it, and try to recreate the file. This method will throw an {@link IOException} if the directory doesn't exist and could not be created.
[ "Create", "a", "{" ]
train
https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/SegmentIntegration.java#L153-L166
wisdom-framework/wisdom
core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/Server.java
Server.defaultHttp
public static Server defaultHttp(ServiceAccessor accessor, Vertx vertx) { return new Server( accessor, vertx, "default-http", accessor.getConfiguration().getIntegerWithDefault("http.port", 9000), false, false, null, Collections.<String>emptyList(), Collections.<String>emptyList(), null); }
java
public static Server defaultHttp(ServiceAccessor accessor, Vertx vertx) { return new Server( accessor, vertx, "default-http", accessor.getConfiguration().getIntegerWithDefault("http.port", 9000), false, false, null, Collections.<String>emptyList(), Collections.<String>emptyList(), null); }
[ "public", "static", "Server", "defaultHttp", "(", "ServiceAccessor", "accessor", ",", "Vertx", "vertx", ")", "{", "return", "new", "Server", "(", "accessor", ",", "vertx", ",", "\"default-http\"", ",", "accessor", ".", "getConfiguration", "(", ")", ".", "getIn...
Creates the default HTTP server (listening on port 9000 / `http.port`), no SSL, no mutual authentication, accept all requests. @param accessor the service accessor @param vertx the vertx singleton @return the configured server (not bound, not started)
[ "Creates", "the", "default", "HTTP", "server", "(", "listening", "on", "port", "9000", "/", "http", ".", "port", ")", "no", "SSL", "no", "mutual", "authentication", "accept", "all", "requests", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/Server.java#L130-L139
TNG/JGiven
jgiven-core/src/main/java/com/tngtech/jgiven/attachment/Attachment.java
Attachment.fromTextInputStream
public static Attachment fromTextInputStream( InputStream inputStream, MediaType mediaType ) throws IOException { return fromText( CharStreams.toString( new InputStreamReader( inputStream, mediaType.getCharset() ) ), mediaType ); }
java
public static Attachment fromTextInputStream( InputStream inputStream, MediaType mediaType ) throws IOException { return fromText( CharStreams.toString( new InputStreamReader( inputStream, mediaType.getCharset() ) ), mediaType ); }
[ "public", "static", "Attachment", "fromTextInputStream", "(", "InputStream", "inputStream", ",", "MediaType", "mediaType", ")", "throws", "IOException", "{", "return", "fromText", "(", "CharStreams", ".", "toString", "(", "new", "InputStreamReader", "(", "inputStream"...
Creates a non-binary attachment from the given file. @throws IOException if an I/O error occurs @throws java.lang.IllegalArgumentException if mediaType is either binary or has no specified charset
[ "Creates", "a", "non", "-", "binary", "attachment", "from", "the", "given", "file", "." ]
train
https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/attachment/Attachment.java#L231-L233
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.readUser
public CmsUser readUser(CmsDbContext dbc, String username, String password) throws CmsException { // don't read user from cache here because password may have changed CmsUser user = getUserDriver(dbc).readUser(dbc, username, password, null); m_monitor.cacheUser(user); return user; }
java
public CmsUser readUser(CmsDbContext dbc, String username, String password) throws CmsException { // don't read user from cache here because password may have changed CmsUser user = getUserDriver(dbc).readUser(dbc, username, password, null); m_monitor.cacheUser(user); return user; }
[ "public", "CmsUser", "readUser", "(", "CmsDbContext", "dbc", ",", "String", "username", ",", "String", "password", ")", "throws", "CmsException", "{", "// don't read user from cache here because password may have changed", "CmsUser", "user", "=", "getUserDriver", "(", "db...
Returns a user object if the password for the user is correct.<p> If the user/pwd pair is not valid a <code>{@link CmsException}</code> is thrown.<p> @param dbc the current database context @param username the username of the user that is to be read @param password the password of the user that is to be read @return user read @throws CmsException if operation was not successful
[ "Returns", "a", "user", "object", "if", "the", "password", "for", "the", "user", "is", "correct", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L8142-L8148
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.license_sqlserver_serviceName_upgrade_GET
public ArrayList<String> license_sqlserver_serviceName_upgrade_GET(String serviceName, OvhSqlServerVersionEnum version) throws IOException { String qPath = "/order/license/sqlserver/{serviceName}/upgrade"; StringBuilder sb = path(qPath, serviceName); query(sb, "version", version); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> license_sqlserver_serviceName_upgrade_GET(String serviceName, OvhSqlServerVersionEnum version) throws IOException { String qPath = "/order/license/sqlserver/{serviceName}/upgrade"; StringBuilder sb = path(qPath, serviceName); query(sb, "version", version); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "license_sqlserver_serviceName_upgrade_GET", "(", "String", "serviceName", ",", "OvhSqlServerVersionEnum", "version", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/license/sqlserver/{serviceName}/upgrade\"", ";...
Get allowed durations for 'upgrade' option REST: GET /order/license/sqlserver/{serviceName}/upgrade @param version [required] This license version @param serviceName [required] The name of your SQL Server license
[ "Get", "allowed", "durations", "for", "upgrade", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L1395-L1401
dbracewell/mango
src/main/java/com/davidbracewell/logging/LogManager.java
LogManager.addFileHandler
public synchronized static void addFileHandler(String basename) throws IOException { String dir = Config.get("com.davidbracewell.logging.dir").asString(SystemInfo.USER_HOME + "/logs/"); Resources.from(dir).mkdirs(); FileHandler fh = new FileHandler(dir + "/" + basename + "%g.log", 100000000, 50, false); fh.setFormatter(new LogFormatter()); addHandler(fh); }
java
public synchronized static void addFileHandler(String basename) throws IOException { String dir = Config.get("com.davidbracewell.logging.dir").asString(SystemInfo.USER_HOME + "/logs/"); Resources.from(dir).mkdirs(); FileHandler fh = new FileHandler(dir + "/" + basename + "%g.log", 100000000, 50, false); fh.setFormatter(new LogFormatter()); addHandler(fh); }
[ "public", "synchronized", "static", "void", "addFileHandler", "(", "String", "basename", ")", "throws", "IOException", "{", "String", "dir", "=", "Config", ".", "get", "(", "\"com.davidbracewell.logging.dir\"", ")", ".", "asString", "(", "SystemInfo", ".", "USER_H...
Adds a file handler that writes to the location specified in <code>com.davidbracewell.logging.dir</code> or if not set <code>USER_HOME/logs/</code>. The filenames are in the form of <code>basename%g</code> where %g is the rotated file number. Max file size is 100MB and 50 files will be used.
[ "Adds", "a", "file", "handler", "that", "writes", "to", "the", "location", "specified", "in", "<code", ">", "com", ".", "davidbracewell", ".", "logging", ".", "dir<", "/", "code", ">", "or", "if", "not", "set", "<code", ">", "USER_HOME", "/", "logs", "...
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/logging/LogManager.java#L100-L106
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/BrokerHelper.java
BrokerHelper.assertValidPksForStore
public boolean assertValidPksForStore(FieldDescriptor[] fieldDescriptors, Object[] pkValues) { int fieldDescriptorSize = fieldDescriptors.length; for(int i = 0; i < fieldDescriptorSize; i++) { FieldDescriptor fld = fieldDescriptors[i]; /** * a pk field is valid if it is either managed by OJB * (autoincrement or locking) or if it does contain a * valid non-null value. */ if(!(fld.isAutoIncrement() || fld.isLocking() || !representsNull(fld, pkValues[i]))) { return false; } } return true; }
java
public boolean assertValidPksForStore(FieldDescriptor[] fieldDescriptors, Object[] pkValues) { int fieldDescriptorSize = fieldDescriptors.length; for(int i = 0; i < fieldDescriptorSize; i++) { FieldDescriptor fld = fieldDescriptors[i]; /** * a pk field is valid if it is either managed by OJB * (autoincrement or locking) or if it does contain a * valid non-null value. */ if(!(fld.isAutoIncrement() || fld.isLocking() || !representsNull(fld, pkValues[i]))) { return false; } } return true; }
[ "public", "boolean", "assertValidPksForStore", "(", "FieldDescriptor", "[", "]", "fieldDescriptors", ",", "Object", "[", "]", "pkValues", ")", "{", "int", "fieldDescriptorSize", "=", "fieldDescriptors", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";"...
returns true if the primary key fields are valid for store, else false. PK fields are valid if each of them is either an OJB managed attribute (autoincrement or locking) or if it contains a valid non-null value @param fieldDescriptors the array of PK fielddescriptors @param pkValues the array of PK values @return boolean
[ "returns", "true", "if", "the", "primary", "key", "fields", "are", "valid", "for", "store", "else", "false", ".", "PK", "fields", "are", "valid", "if", "each", "of", "them", "is", "either", "an", "OJB", "managed", "attribute", "(", "autoincrement", "or", ...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/BrokerHelper.java#L447-L466
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.serializePI
protected void serializePI(ProcessingInstruction node) throws SAXException { ProcessingInstruction pi = node; String name = pi.getNodeName(); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isPIWellFormed(node); } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_PROCESSING_INSTRUCTION)) { return; } // String data = pi.getData(); if (name.equals("xslt-next-is-raw")) { fNextIsRaw = true; } else { this.fSerializer.processingInstruction(name, pi.getData()); } }
java
protected void serializePI(ProcessingInstruction node) throws SAXException { ProcessingInstruction pi = node; String name = pi.getNodeName(); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isPIWellFormed(node); } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_PROCESSING_INSTRUCTION)) { return; } // String data = pi.getData(); if (name.equals("xslt-next-is-raw")) { fNextIsRaw = true; } else { this.fSerializer.processingInstruction(name, pi.getData()); } }
[ "protected", "void", "serializePI", "(", "ProcessingInstruction", "node", ")", "throws", "SAXException", "{", "ProcessingInstruction", "pi", "=", "node", ";", "String", "name", "=", "pi", ".", "getNodeName", "(", ")", ";", "// well-formed=true", "if", "(", "(", ...
Serializes an ProcessingInstruction Node. @param node The ProcessingInstruction Node to serialize
[ "Serializes", "an", "ProcessingInstruction", "Node", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L887-L908
liferay/com-liferay-commerce
commerce-notification-api/src/main/java/com/liferay/commerce/notification/model/CommerceNotificationTemplateWrapper.java
CommerceNotificationTemplateWrapper.setSubjectMap
@Override public void setSubjectMap(Map<java.util.Locale, String> subjectMap) { _commerceNotificationTemplate.setSubjectMap(subjectMap); }
java
@Override public void setSubjectMap(Map<java.util.Locale, String> subjectMap) { _commerceNotificationTemplate.setSubjectMap(subjectMap); }
[ "@", "Override", "public", "void", "setSubjectMap", "(", "Map", "<", "java", ".", "util", ".", "Locale", ",", "String", ">", "subjectMap", ")", "{", "_commerceNotificationTemplate", ".", "setSubjectMap", "(", "subjectMap", ")", ";", "}" ]
Sets the localized subjects of this commerce notification template from the map of locales and localized subjects. @param subjectMap the locales and localized subjects of this commerce notification template
[ "Sets", "the", "localized", "subjects", "of", "this", "commerce", "notification", "template", "from", "the", "map", "of", "locales", "and", "localized", "subjects", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-api/src/main/java/com/liferay/commerce/notification/model/CommerceNotificationTemplateWrapper.java#L996-L999
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.downto
public static void downto(Float self, Number to, @ClosureParams(FirstParam.class) Closure closure) { float to1 = to.floatValue(); if (self >= to1) { for (float i = self; i >= to1; i--) { closure.call(i); } } else throw new GroovyRuntimeException("The argument (" + to + ") to downto() cannot be greater than the value (" + self + ") it's called on."); }
java
public static void downto(Float self, Number to, @ClosureParams(FirstParam.class) Closure closure) { float to1 = to.floatValue(); if (self >= to1) { for (float i = self; i >= to1; i--) { closure.call(i); } } else throw new GroovyRuntimeException("The argument (" + to + ") to downto() cannot be greater than the value (" + self + ") it's called on."); }
[ "public", "static", "void", "downto", "(", "Float", "self", ",", "Number", "to", ",", "@", "ClosureParams", "(", "FirstParam", ".", "class", ")", "Closure", "closure", ")", "{", "float", "to1", "=", "to", ".", "floatValue", "(", ")", ";", "if", "(", ...
Iterates from this number down to the given number, inclusive, decrementing by one each time. @param self a Float @param to the end number @param closure the code to execute for each number @since 1.0
[ "Iterates", "from", "this", "number", "down", "to", "the", "given", "number", "inclusive", "decrementing", "by", "one", "each", "time", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15928-L15936
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/DateTimeUtil.java
DateTimeUtil.floorToMinutePeriod
public static DateTime floorToMinutePeriod(DateTime value, int periodInMinutes) { if (value == null) { return null; } if (periodInMinutes <= 0 || periodInMinutes > 59) { throw new IllegalArgumentException("period in minutes must be > 0 and <= 59"); } int min = value.getMinuteOfHour(); min = (min / periodInMinutes) * periodInMinutes; return new DateTime(value.getYear(), value.getMonthOfYear(), value.getDayOfMonth(), value.getHourOfDay(), min, 0, 0, value.getZone()); }
java
public static DateTime floorToMinutePeriod(DateTime value, int periodInMinutes) { if (value == null) { return null; } if (periodInMinutes <= 0 || periodInMinutes > 59) { throw new IllegalArgumentException("period in minutes must be > 0 and <= 59"); } int min = value.getMinuteOfHour(); min = (min / periodInMinutes) * periodInMinutes; return new DateTime(value.getYear(), value.getMonthOfYear(), value.getDayOfMonth(), value.getHourOfDay(), min, 0, 0, value.getZone()); }
[ "public", "static", "DateTime", "floorToMinutePeriod", "(", "DateTime", "value", ",", "int", "periodInMinutes", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "periodInMinutes", "<=", "0", "||", "periodInMinutes"...
Null-safe method that returns a new instance of a DateTime object rounded downwards to the nearest specified period in minutes. For example, if a period of 5 minutes is requested, a time of "2009-06-24 13:24:51.476 -8:00" would return a datetime of "2009-06-24 13:20:00.000 -8:00". The time zone of the returned DateTime instance will be the same as the argument. Similar to a floor() function on a float.<br> NOTE: While any period in minutes between 1 and 59 can be passed into this method, its only useful if the value can be evenly divided into 60 to make it as useful as possible.<br> Examples: <ul> <li>null -> null <li>5: "2009-06-24 13:39:51.476 -8:00" -> "2009-06-24 13:35:00.000 -8:00" <li>10: "2009-06-24 13:39:51.476 -8:00" -> "2009-06-24 13:30:00.000 -8:00" <li>15: "2009-06-24 13:39:51.476 -8:00" -> "2009-06-24 13:30:00.000 -8:00" <li>20: "2009-06-24 13:39:51.476 UTC" -> "2009-06-24 13:20:00.000 UTC" </ul> @param value The DateTime value to round downward @return Null if the argument is null or a new instance of the DateTime value rounded downwards to the nearest period in minutes.
[ "Null", "-", "safe", "method", "that", "returns", "a", "new", "instance", "of", "a", "DateTime", "object", "rounded", "downwards", "to", "the", "nearest", "specified", "period", "in", "minutes", ".", "For", "example", "if", "a", "period", "of", "5", "minut...
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/DateTimeUtil.java#L335-L345
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java
ValueEnforcer.notNullNoNullValue
@CodingStyleguideUnaware public static <T extends Map <?, ?>> T notNullNoNullValue (final T aValue, final String sName) { if (isEnabled ()) return notNullNoNullValue (aValue, () -> sName); return aValue; }
java
@CodingStyleguideUnaware public static <T extends Map <?, ?>> T notNullNoNullValue (final T aValue, final String sName) { if (isEnabled ()) return notNullNoNullValue (aValue, () -> sName); return aValue; }
[ "@", "CodingStyleguideUnaware", "public", "static", "<", "T", "extends", "Map", "<", "?", ",", "?", ">", ">", "T", "notNullNoNullValue", "(", "final", "T", "aValue", ",", "final", "String", "sName", ")", "{", "if", "(", "isEnabled", "(", ")", ")", "ret...
Check that the passed map is not <code>null</code> and that no <code>null</code> value is contained. @param <T> Type to be checked and returned @param aValue The map to check. @param sName The name of the value (e.g. the parameter name) @return The passed value. @throws IllegalArgumentException if the passed value is <code>null</code> or a <code>null</code> value is contained
[ "Check", "that", "the", "passed", "map", "is", "not", "<code", ">", "null<", "/", "code", ">", "and", "that", "no", "<code", ">", "null<", "/", "code", ">", "value", "is", "contained", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L1133-L1139