repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java
IntTrieBuilder.setValue
public boolean setValue(int ch, int value) { """ Sets a 32 bit data in the table data @param ch codepoint which data is to be set @param value to set @return true if the set is successful, otherwise if the table has been compacted return false """ // valid, uncompacted trie and valid c? if (m_isCompacted_ || ch > UCharacter.MAX_VALUE || ch < 0) { return false; } int block = getDataBlock(ch); if (block < 0) { return false; } m_data_[block + (ch & MASK_)] = value; return true; }
java
public boolean setValue(int ch, int value) { // valid, uncompacted trie and valid c? if (m_isCompacted_ || ch > UCharacter.MAX_VALUE || ch < 0) { return false; } int block = getDataBlock(ch); if (block < 0) { return false; } m_data_[block + (ch & MASK_)] = value; return true; }
[ "public", "boolean", "setValue", "(", "int", "ch", ",", "int", "value", ")", "{", "// valid, uncompacted trie and valid c? ", "if", "(", "m_isCompacted_", "||", "ch", ">", "UCharacter", ".", "MAX_VALUE", "||", "ch", "<", "0", ")", "{", "return", "false", ";", "}", "int", "block", "=", "getDataBlock", "(", "ch", ")", ";", "if", "(", "block", "<", "0", ")", "{", "return", "false", ";", "}", "m_data_", "[", "block", "+", "(", "ch", "&", "MASK_", ")", "]", "=", "value", ";", "return", "true", ";", "}" ]
Sets a 32 bit data in the table data @param ch codepoint which data is to be set @param value to set @return true if the set is successful, otherwise if the table has been compacted return false
[ "Sets", "a", "32", "bit", "data", "in", "the", "table", "data" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java#L215-L229
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/mesh/ST_ConstrainedDelaunay.java
ST_ConstrainedDelaunay.createCDT
public static GeometryCollection createCDT(Geometry geometry, int flag) throws SQLException { """ Build a constrained delaunay triangulation based on a geometry (point, line, polygon) @param geometry @param flag @return a set of polygons (triangles) @throws SQLException """ if (geometry != null) { DelaunayData delaunayData = new DelaunayData(); delaunayData.put(geometry, DelaunayData.MODE.CONSTRAINED); delaunayData.triangulate(); if (flag == 0) { return delaunayData.getTriangles(); } else if (flag == 1) { return delaunayData.getTrianglesSides(); } else { throw new SQLException("Only flag 0 or 1 is supported."); } } return null; }
java
public static GeometryCollection createCDT(Geometry geometry, int flag) throws SQLException { if (geometry != null) { DelaunayData delaunayData = new DelaunayData(); delaunayData.put(geometry, DelaunayData.MODE.CONSTRAINED); delaunayData.triangulate(); if (flag == 0) { return delaunayData.getTriangles(); } else if (flag == 1) { return delaunayData.getTrianglesSides(); } else { throw new SQLException("Only flag 0 or 1 is supported."); } } return null; }
[ "public", "static", "GeometryCollection", "createCDT", "(", "Geometry", "geometry", ",", "int", "flag", ")", "throws", "SQLException", "{", "if", "(", "geometry", "!=", "null", ")", "{", "DelaunayData", "delaunayData", "=", "new", "DelaunayData", "(", ")", ";", "delaunayData", ".", "put", "(", "geometry", ",", "DelaunayData", ".", "MODE", ".", "CONSTRAINED", ")", ";", "delaunayData", ".", "triangulate", "(", ")", ";", "if", "(", "flag", "==", "0", ")", "{", "return", "delaunayData", ".", "getTriangles", "(", ")", ";", "}", "else", "if", "(", "flag", "==", "1", ")", "{", "return", "delaunayData", ".", "getTrianglesSides", "(", ")", ";", "}", "else", "{", "throw", "new", "SQLException", "(", "\"Only flag 0 or 1 is supported.\"", ")", ";", "}", "}", "return", "null", ";", "}" ]
Build a constrained delaunay triangulation based on a geometry (point, line, polygon) @param geometry @param flag @return a set of polygons (triangles) @throws SQLException
[ "Build", "a", "constrained", "delaunay", "triangulation", "based", "on", "a", "geometry", "(", "point", "line", "polygon", ")" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/mesh/ST_ConstrainedDelaunay.java#L71-L85
belaban/JGroups
src/org/jgroups/jmx/ResourceDMBean.java
ResourceDMBean.findGetter
protected static Accessor findGetter(Object target, String attr_name) { """ Finds an accessor for an attribute. Tries to find getAttrName(), isAttrName(), attrName() methods. If not found, tries to use reflection to get the value of attr_name. If still not found, creates a NullAccessor. """ final String name=Util.attributeNameToMethodName(attr_name); Class<?> clazz=target.getClass(); Method method=Util.findMethod(target, Arrays.asList("get" + name, "is" + name, toLowerCase(name))); if(method != null && (isGetMethod(method) || isIsMethod(method))) return new MethodAccessor(method, target); // 4. Find a field last_name Field field=Util.getField(clazz, attr_name); if(field != null) return new FieldAccessor(field, target); return new NoopAccessor(); }
java
protected static Accessor findGetter(Object target, String attr_name) { final String name=Util.attributeNameToMethodName(attr_name); Class<?> clazz=target.getClass(); Method method=Util.findMethod(target, Arrays.asList("get" + name, "is" + name, toLowerCase(name))); if(method != null && (isGetMethod(method) || isIsMethod(method))) return new MethodAccessor(method, target); // 4. Find a field last_name Field field=Util.getField(clazz, attr_name); if(field != null) return new FieldAccessor(field, target); return new NoopAccessor(); }
[ "protected", "static", "Accessor", "findGetter", "(", "Object", "target", ",", "String", "attr_name", ")", "{", "final", "String", "name", "=", "Util", ".", "attributeNameToMethodName", "(", "attr_name", ")", ";", "Class", "<", "?", ">", "clazz", "=", "target", ".", "getClass", "(", ")", ";", "Method", "method", "=", "Util", ".", "findMethod", "(", "target", ",", "Arrays", ".", "asList", "(", "\"get\"", "+", "name", ",", "\"is\"", "+", "name", ",", "toLowerCase", "(", "name", ")", ")", ")", ";", "if", "(", "method", "!=", "null", "&&", "(", "isGetMethod", "(", "method", ")", "||", "isIsMethod", "(", "method", ")", ")", ")", "return", "new", "MethodAccessor", "(", "method", ",", "target", ")", ";", "// 4. Find a field last_name", "Field", "field", "=", "Util", ".", "getField", "(", "clazz", ",", "attr_name", ")", ";", "if", "(", "field", "!=", "null", ")", "return", "new", "FieldAccessor", "(", "field", ",", "target", ")", ";", "return", "new", "NoopAccessor", "(", ")", ";", "}" ]
Finds an accessor for an attribute. Tries to find getAttrName(), isAttrName(), attrName() methods. If not found, tries to use reflection to get the value of attr_name. If still not found, creates a NullAccessor.
[ "Finds", "an", "accessor", "for", "an", "attribute", ".", "Tries", "to", "find", "getAttrName", "()", "isAttrName", "()", "attrName", "()", "methods", ".", "If", "not", "found", "tries", "to", "use", "reflection", "to", "get", "the", "value", "of", "attr_name", ".", "If", "still", "not", "found", "creates", "a", "NullAccessor", "." ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/jmx/ResourceDMBean.java#L334-L349
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/Validate.java
Validate.notNull
public static <T> T notNull(final T object, final String message, final Object... values) { """ <p>Validate that the specified argument is not {@code null}; otherwise throwing an exception with the specified message. <pre>Validate.notNull(myObject, "The object must not be null");</pre> @param <T> the object type @param object the object to check @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message @return the validated object (never {@code null} for method chaining) @throws NullPointerException if the object is {@code null} @see #notNull(Object) """ if (object == null) { throw new NullPointerException(StringUtils.simpleFormat(message, values)); } return object; }
java
public static <T> T notNull(final T object, final String message, final Object... values) { if (object == null) { throw new NullPointerException(StringUtils.simpleFormat(message, values)); } return object; }
[ "public", "static", "<", "T", ">", "T", "notNull", "(", "final", "T", "object", ",", "final", "String", "message", ",", "final", "Object", "...", "values", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "StringUtils", ".", "simpleFormat", "(", "message", ",", "values", ")", ")", ";", "}", "return", "object", ";", "}" ]
<p>Validate that the specified argument is not {@code null}; otherwise throwing an exception with the specified message. <pre>Validate.notNull(myObject, "The object must not be null");</pre> @param <T> the object type @param object the object to check @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message @return the validated object (never {@code null} for method chaining) @throws NullPointerException if the object is {@code null} @see #notNull(Object)
[ "<p", ">", "Validate", "that", "the", "specified", "argument", "is", "not", "{", "@code", "null", "}", ";", "otherwise", "throwing", "an", "exception", "with", "the", "specified", "message", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L225-L230
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetDetector.java
CharsetDetector.getReader
public Reader getReader(InputStream in, String declaredEncoding) { """ Autodetect the charset of an inputStream, and return a Java Reader to access the converted input data. <p> This is a convenience method that is equivalent to <code>this.setDeclaredEncoding(declaredEncoding).setText(in).detect().getReader();</code> <p> For the input stream that supplies the character data, markSupported() must be true; the charset detection will read a small amount of data, then return the stream to its original position via the InputStream.reset() operation. The exact amount that will be read depends on the characteristics of the data itself. <p> Raise an exception if no charsets appear to match the input data. @param in The source of the byte data in the unknown charset. @param declaredEncoding A declared encoding for the data, if available, or null or an empty string if none is available. """ fDeclaredEncoding = declaredEncoding; try { setText(in); CharsetMatch match = detect(); if (match == null) { return null; } return match.getReader(); } catch (IOException e) { return null; } }
java
public Reader getReader(InputStream in, String declaredEncoding) { fDeclaredEncoding = declaredEncoding; try { setText(in); CharsetMatch match = detect(); if (match == null) { return null; } return match.getReader(); } catch (IOException e) { return null; } }
[ "public", "Reader", "getReader", "(", "InputStream", "in", ",", "String", "declaredEncoding", ")", "{", "fDeclaredEncoding", "=", "declaredEncoding", ";", "try", "{", "setText", "(", "in", ")", ";", "CharsetMatch", "match", "=", "detect", "(", ")", ";", "if", "(", "match", "==", "null", ")", "{", "return", "null", ";", "}", "return", "match", ".", "getReader", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "null", ";", "}", "}" ]
Autodetect the charset of an inputStream, and return a Java Reader to access the converted input data. <p> This is a convenience method that is equivalent to <code>this.setDeclaredEncoding(declaredEncoding).setText(in).detect().getReader();</code> <p> For the input stream that supplies the character data, markSupported() must be true; the charset detection will read a small amount of data, then return the stream to its original position via the InputStream.reset() operation. The exact amount that will be read depends on the characteristics of the data itself. <p> Raise an exception if no charsets appear to match the input data. @param in The source of the byte data in the unknown charset. @param declaredEncoding A declared encoding for the data, if available, or null or an empty string if none is available.
[ "Autodetect", "the", "charset", "of", "an", "inputStream", "and", "return", "a", "Java", "Reader", "to", "access", "the", "converted", "input", "data", ".", "<p", ">", "This", "is", "a", "convenience", "method", "that", "is", "equivalent", "to", "<code", ">", "this", ".", "setDeclaredEncoding", "(", "declaredEncoding", ")", ".", "setText", "(", "in", ")", ".", "detect", "()", ".", "getReader", "()", ";", "<", "/", "code", ">", "<p", ">", "For", "the", "input", "stream", "that", "supplies", "the", "character", "data", "markSupported", "()", "must", "be", "true", ";", "the", "charset", "detection", "will", "read", "a", "small", "amount", "of", "data", "then", "return", "the", "stream", "to", "its", "original", "position", "via", "the", "InputStream", ".", "reset", "()", "operation", ".", "The", "exact", "amount", "that", "will", "be", "read", "depends", "on", "the", "characteristics", "of", "the", "data", "itself", ".", "<p", ">", "Raise", "an", "exception", "if", "no", "charsets", "appear", "to", "match", "the", "input", "data", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetDetector.java#L220-L236
spring-projects/spring-security-oauth
spring-security-oauth/src/main/java/org/springframework/security/oauth/common/OAuthCodec.java
OAuthCodec.oauthEncode
public static String oauthEncode(String value) { """ Encode the specified value. @param value The value to encode. @return The encoded value. """ if (value == null) { return ""; } try { return new String(URLCodec.encodeUrl(SAFE_CHARACTERS, value.getBytes("UTF-8")), "US-ASCII"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
java
public static String oauthEncode(String value) { if (value == null) { return ""; } try { return new String(URLCodec.encodeUrl(SAFE_CHARACTERS, value.getBytes("UTF-8")), "US-ASCII"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
[ "public", "static", "String", "oauthEncode", "(", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "\"\"", ";", "}", "try", "{", "return", "new", "String", "(", "URLCodec", ".", "encodeUrl", "(", "SAFE_CHARACTERS", ",", "value", ".", "getBytes", "(", "\"UTF-8\"", ")", ")", ",", "\"US-ASCII\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Encode the specified value. @param value The value to encode. @return The encoded value.
[ "Encode", "the", "specified", "value", "." ]
train
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth/src/main/java/org/springframework/security/oauth/common/OAuthCodec.java#L52-L63
auth0/Auth0.Android
auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java
AuthenticationAPIClient.delegationWithIdToken
@SuppressWarnings("WeakerAccess") public DelegationRequest<Delegation> delegationWithIdToken(@NonNull String idToken) { """ Performs a <a href="https://auth0.com/docs/api/authentication#delegation">delegation</a> request that will yield a new Auth0 'id_token' Example usage: <pre> {@code client.delegationWithIdToken("{id token}") .start(new BaseCallback<Delegation>() { {@literal}Override public void onSuccess(Delegation payload) {} {@literal}Override public void onFailure(AuthenticationException error) {} }); } </pre> @param idToken issued by Auth0 for the user. The token must not be expired. @return a request to configure and start """ ParameterizableRequest<Delegation, AuthenticationException> request = delegation(Delegation.class) .addParameter(ParameterBuilder.ID_TOKEN_KEY, idToken); return new DelegationRequest<>(request) .setApiType(DelegationRequest.DEFAULT_API_TYPE); }
java
@SuppressWarnings("WeakerAccess") public DelegationRequest<Delegation> delegationWithIdToken(@NonNull String idToken) { ParameterizableRequest<Delegation, AuthenticationException> request = delegation(Delegation.class) .addParameter(ParameterBuilder.ID_TOKEN_KEY, idToken); return new DelegationRequest<>(request) .setApiType(DelegationRequest.DEFAULT_API_TYPE); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "DelegationRequest", "<", "Delegation", ">", "delegationWithIdToken", "(", "@", "NonNull", "String", "idToken", ")", "{", "ParameterizableRequest", "<", "Delegation", ",", "AuthenticationException", ">", "request", "=", "delegation", "(", "Delegation", ".", "class", ")", ".", "addParameter", "(", "ParameterBuilder", ".", "ID_TOKEN_KEY", ",", "idToken", ")", ";", "return", "new", "DelegationRequest", "<>", "(", "request", ")", ".", "setApiType", "(", "DelegationRequest", ".", "DEFAULT_API_TYPE", ")", ";", "}" ]
Performs a <a href="https://auth0.com/docs/api/authentication#delegation">delegation</a> request that will yield a new Auth0 'id_token' Example usage: <pre> {@code client.delegationWithIdToken("{id token}") .start(new BaseCallback<Delegation>() { {@literal}Override public void onSuccess(Delegation payload) {} {@literal}Override public void onFailure(AuthenticationException error) {} }); } </pre> @param idToken issued by Auth0 for the user. The token must not be expired. @return a request to configure and start
[ "Performs", "a", "<a", "href", "=", "https", ":", "//", "auth0", ".", "com", "/", "docs", "/", "api", "/", "authentication#delegation", ">", "delegation<", "/", "a", ">", "request", "that", "will", "yield", "a", "new", "Auth0", "id_token", "Example", "usage", ":", "<pre", ">", "{", "@code", "client", ".", "delegationWithIdToken", "(", "{", "id", "token", "}", ")", ".", "start", "(", "new", "BaseCallback<Delegation", ">", "()", "{", "{", "@literal", "}", "Override", "public", "void", "onSuccess", "(", "Delegation", "payload", ")", "{}" ]
train
https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java#L763-L770
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.setScale
public void setScale(float x, float y, float z) { """ Set [X, Y, Z] current scale @param x Scaling factor on the 'X' axis. @param y Scaling factor on the 'Y' axis. @param z Scaling factor on the 'Z' axis. """ getTransform().setScale(x, y, z); if (mTransformCache.setScale(x, y, z)) { onTransformChanged(); } }
java
public void setScale(float x, float y, float z) { getTransform().setScale(x, y, z); if (mTransformCache.setScale(x, y, z)) { onTransformChanged(); } }
[ "public", "void", "setScale", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "getTransform", "(", ")", ".", "setScale", "(", "x", ",", "y", ",", "z", ")", ";", "if", "(", "mTransformCache", ".", "setScale", "(", "x", ",", "y", ",", "z", ")", ")", "{", "onTransformChanged", "(", ")", ";", "}", "}" ]
Set [X, Y, Z] current scale @param x Scaling factor on the 'X' axis. @param y Scaling factor on the 'Y' axis. @param z Scaling factor on the 'Z' axis.
[ "Set", "[", "X", "Y", "Z", "]", "current", "scale" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1437-L1442
apache/groovy
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
SwingGroovyMethods.leftShift
public static DefaultListModel leftShift(DefaultListModel self, Object e) { """ Overloads the left shift operator to provide an easy way to add elements to a DefaultListModel. @param self a DefaultListModel @param e an element to be added to the listModel. @return same listModel, after the value was added to it. @since 1.6.4 """ self.addElement(e); return self; }
java
public static DefaultListModel leftShift(DefaultListModel self, Object e) { self.addElement(e); return self; }
[ "public", "static", "DefaultListModel", "leftShift", "(", "DefaultListModel", "self", ",", "Object", "e", ")", "{", "self", ".", "addElement", "(", "e", ")", ";", "return", "self", ";", "}" ]
Overloads the left shift operator to provide an easy way to add elements to a DefaultListModel. @param self a DefaultListModel @param e an element to be added to the listModel. @return same listModel, after the value was added to it. @since 1.6.4
[ "Overloads", "the", "left", "shift", "operator", "to", "provide", "an", "easy", "way", "to", "add", "elements", "to", "a", "DefaultListModel", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L214-L217
groupon/robo-remote
RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/QueryBuilder.java
QueryBuilder.map
public QueryBuilder map(String query, String method_name, Object... items) throws Exception { """ Used to get the return from a method call @param query @param method_name @param items @return @throws Exception """ JSONObject op = new JSONObject(); if (query != null) op.put(Constants.REQUEST_QUERY, query); java.util.Map<String, Object> operation = new LinkedHashMap<String, Object>(); operation.put(Constants.REQUEST_METHOD_NAME, method_name); if (query != null) queryStringRepresentation += query; queryStringRepresentation += "." + method_name; operation.put(Constants.REQUEST_ARGUMENTS, buildArgsArray(items)); op.put(Constants.REQUEST_OPERATION, operation); JSONArray operations = (JSONArray) request.get(Constants.REQUEST_OPERATIONS); operations.put(op); request.remove(Constants.REQUEST_OPERATIONS); request.put(Constants.REQUEST_OPERATIONS, operations); return this; }
java
public QueryBuilder map(String query, String method_name, Object... items) throws Exception { JSONObject op = new JSONObject(); if (query != null) op.put(Constants.REQUEST_QUERY, query); java.util.Map<String, Object> operation = new LinkedHashMap<String, Object>(); operation.put(Constants.REQUEST_METHOD_NAME, method_name); if (query != null) queryStringRepresentation += query; queryStringRepresentation += "." + method_name; operation.put(Constants.REQUEST_ARGUMENTS, buildArgsArray(items)); op.put(Constants.REQUEST_OPERATION, operation); JSONArray operations = (JSONArray) request.get(Constants.REQUEST_OPERATIONS); operations.put(op); request.remove(Constants.REQUEST_OPERATIONS); request.put(Constants.REQUEST_OPERATIONS, operations); return this; }
[ "public", "QueryBuilder", "map", "(", "String", "query", ",", "String", "method_name", ",", "Object", "...", "items", ")", "throws", "Exception", "{", "JSONObject", "op", "=", "new", "JSONObject", "(", ")", ";", "if", "(", "query", "!=", "null", ")", "op", ".", "put", "(", "Constants", ".", "REQUEST_QUERY", ",", "query", ")", ";", "java", ".", "util", ".", "Map", "<", "String", ",", "Object", ">", "operation", "=", "new", "LinkedHashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "operation", ".", "put", "(", "Constants", ".", "REQUEST_METHOD_NAME", ",", "method_name", ")", ";", "if", "(", "query", "!=", "null", ")", "queryStringRepresentation", "+=", "query", ";", "queryStringRepresentation", "+=", "\".\"", "+", "method_name", ";", "operation", ".", "put", "(", "Constants", ".", "REQUEST_ARGUMENTS", ",", "buildArgsArray", "(", "items", ")", ")", ";", "op", ".", "put", "(", "Constants", ".", "REQUEST_OPERATION", ",", "operation", ")", ";", "JSONArray", "operations", "=", "(", "JSONArray", ")", "request", ".", "get", "(", "Constants", ".", "REQUEST_OPERATIONS", ")", ";", "operations", ".", "put", "(", "op", ")", ";", "request", ".", "remove", "(", "Constants", ".", "REQUEST_OPERATIONS", ")", ";", "request", ".", "put", "(", "Constants", ".", "REQUEST_OPERATIONS", ",", "operations", ")", ";", "return", "this", ";", "}" ]
Used to get the return from a method call @param query @param method_name @param items @return @throws Exception
[ "Used", "to", "get", "the", "return", "from", "a", "method", "call" ]
train
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/QueryBuilder.java#L82-L104
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/RaCodeGen.java
RaCodeGen.writeXAResource
private void writeXAResource(Definition def, Writer out, int indent) throws IOException { """ Output getXAResources method @param def definition @param out Writer @param indent space number @throws IOException ioException """ writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * This method is called by the application server during crash recovery.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param specs An array of ActivationSpec JavaBeans \n"); writeWithIndent(out, indent, " * @throws ResourceException generic exception \n"); writeWithIndent(out, indent, " * @return An array of XAResource objects\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public XAResource[] getXAResources(ActivationSpec[] specs)\n"); writeWithIndent(out, indent + 1, "throws ResourceException"); writeLeftCurlyBracket(out, indent); writeLogging(def, out, indent + 1, "trace", "getXAResources", "specs.toString()"); writeWithIndent(out, indent + 1, "return null;"); writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeXAResource(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * This method is called by the application server during crash recovery.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param specs An array of ActivationSpec JavaBeans \n"); writeWithIndent(out, indent, " * @throws ResourceException generic exception \n"); writeWithIndent(out, indent, " * @return An array of XAResource objects\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public XAResource[] getXAResources(ActivationSpec[] specs)\n"); writeWithIndent(out, indent + 1, "throws ResourceException"); writeLeftCurlyBracket(out, indent); writeLogging(def, out, indent + 1, "trace", "getXAResources", "specs.toString()"); writeWithIndent(out, indent + 1, "return null;"); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeXAResource", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * This method is called by the application server during crash recovery.\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" *\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * @param specs An array of ActivationSpec JavaBeans \\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * @throws ResourceException generic exception \\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * @return An array of XAResource objects\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" */\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"public XAResource[] getXAResources(ActivationSpec[] specs)\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", "+", "1", ",", "\"throws ResourceException\"", ")", ";", "writeLeftCurlyBracket", "(", "out", ",", "indent", ")", ";", "writeLogging", "(", "def", ",", "out", ",", "indent", "+", "1", ",", "\"trace\"", ",", "\"getXAResources\"", ",", "\"specs.toString()\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", "+", "1", ",", "\"return null;\"", ")", ";", "writeRightCurlyBracket", "(", "out", ",", "indent", ")", ";", "writeEol", "(", "out", ")", ";", "}" ]
Output getXAResources method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "getXAResources", "method" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/RaCodeGen.java#L223-L240
google/closure-compiler
src/com/google/javascript/jscomp/RemoveUnusedCode.java
RemoveUnusedCode.createPolyfillInfo
private PolyfillInfo createPolyfillInfo(Node call, Scope scope, String name) { """ Makes a new PolyfillInfo, including the correct Removable. Parses the name to determine whether this is a global, static, or prototype polyfill. """ checkState(scope.isGlobal()); checkState(call.getParent().isExprResult()); // Make the removable and polyfill info. Add continuations for all arguments. RemovableBuilder builder = new RemovableBuilder(); for (Node n = call.getFirstChild().getNext(); n != null; n = n.getNext()) { builder.addContinuation(new Continuation(n, scope)); } Polyfill removable = builder.buildPolyfill(call.getParent()); int lastDot = name.lastIndexOf("."); if (lastDot < 0) { return new GlobalPolyfillInfo(removable, name); } String owner = name.substring(0, lastDot); String prop = name.substring(lastDot + 1); boolean typed = call.getJSType() != null; if (owner.endsWith(DOT_PROTOTYPE)) { owner = owner.substring(0, owner.length() - DOT_PROTOTYPE.length()); return new PrototypePropertyPolyfillInfo( removable, prop, typed ? compiler.getTypeRegistry().getType(scope, owner) : null); } ObjectType ownerInstanceType = typed ? ObjectType.cast(compiler.getTypeRegistry().getType(scope, owner)) : null; JSType ownerCtorType = ownerInstanceType != null ? ownerInstanceType.getConstructor() : null; return new StaticPropertyPolyfillInfo(removable, prop, ownerCtorType, owner); }
java
private PolyfillInfo createPolyfillInfo(Node call, Scope scope, String name) { checkState(scope.isGlobal()); checkState(call.getParent().isExprResult()); // Make the removable and polyfill info. Add continuations for all arguments. RemovableBuilder builder = new RemovableBuilder(); for (Node n = call.getFirstChild().getNext(); n != null; n = n.getNext()) { builder.addContinuation(new Continuation(n, scope)); } Polyfill removable = builder.buildPolyfill(call.getParent()); int lastDot = name.lastIndexOf("."); if (lastDot < 0) { return new GlobalPolyfillInfo(removable, name); } String owner = name.substring(0, lastDot); String prop = name.substring(lastDot + 1); boolean typed = call.getJSType() != null; if (owner.endsWith(DOT_PROTOTYPE)) { owner = owner.substring(0, owner.length() - DOT_PROTOTYPE.length()); return new PrototypePropertyPolyfillInfo( removable, prop, typed ? compiler.getTypeRegistry().getType(scope, owner) : null); } ObjectType ownerInstanceType = typed ? ObjectType.cast(compiler.getTypeRegistry().getType(scope, owner)) : null; JSType ownerCtorType = ownerInstanceType != null ? ownerInstanceType.getConstructor() : null; return new StaticPropertyPolyfillInfo(removable, prop, ownerCtorType, owner); }
[ "private", "PolyfillInfo", "createPolyfillInfo", "(", "Node", "call", ",", "Scope", "scope", ",", "String", "name", ")", "{", "checkState", "(", "scope", ".", "isGlobal", "(", ")", ")", ";", "checkState", "(", "call", ".", "getParent", "(", ")", ".", "isExprResult", "(", ")", ")", ";", "// Make the removable and polyfill info. Add continuations for all arguments.", "RemovableBuilder", "builder", "=", "new", "RemovableBuilder", "(", ")", ";", "for", "(", "Node", "n", "=", "call", ".", "getFirstChild", "(", ")", ".", "getNext", "(", ")", ";", "n", "!=", "null", ";", "n", "=", "n", ".", "getNext", "(", ")", ")", "{", "builder", ".", "addContinuation", "(", "new", "Continuation", "(", "n", ",", "scope", ")", ")", ";", "}", "Polyfill", "removable", "=", "builder", ".", "buildPolyfill", "(", "call", ".", "getParent", "(", ")", ")", ";", "int", "lastDot", "=", "name", ".", "lastIndexOf", "(", "\".\"", ")", ";", "if", "(", "lastDot", "<", "0", ")", "{", "return", "new", "GlobalPolyfillInfo", "(", "removable", ",", "name", ")", ";", "}", "String", "owner", "=", "name", ".", "substring", "(", "0", ",", "lastDot", ")", ";", "String", "prop", "=", "name", ".", "substring", "(", "lastDot", "+", "1", ")", ";", "boolean", "typed", "=", "call", ".", "getJSType", "(", ")", "!=", "null", ";", "if", "(", "owner", ".", "endsWith", "(", "DOT_PROTOTYPE", ")", ")", "{", "owner", "=", "owner", ".", "substring", "(", "0", ",", "owner", ".", "length", "(", ")", "-", "DOT_PROTOTYPE", ".", "length", "(", ")", ")", ";", "return", "new", "PrototypePropertyPolyfillInfo", "(", "removable", ",", "prop", ",", "typed", "?", "compiler", ".", "getTypeRegistry", "(", ")", ".", "getType", "(", "scope", ",", "owner", ")", ":", "null", ")", ";", "}", "ObjectType", "ownerInstanceType", "=", "typed", "?", "ObjectType", ".", "cast", "(", "compiler", ".", "getTypeRegistry", "(", ")", ".", "getType", "(", "scope", ",", "owner", ")", ")", ":", "null", ";", "JSType", "ownerCtorType", "=", "ownerInstanceType", "!=", "null", "?", "ownerInstanceType", ".", "getConstructor", "(", ")", ":", "null", ";", "return", "new", "StaticPropertyPolyfillInfo", "(", "removable", ",", "prop", ",", "ownerCtorType", ",", "owner", ")", ";", "}" ]
Makes a new PolyfillInfo, including the correct Removable. Parses the name to determine whether this is a global, static, or prototype polyfill.
[ "Makes", "a", "new", "PolyfillInfo", "including", "the", "correct", "Removable", ".", "Parses", "the", "name", "to", "determine", "whether", "this", "is", "a", "global", "static", "or", "prototype", "polyfill", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RemoveUnusedCode.java#L2625-L2650
HubSpot/Singularity
SingularityExecutor/src/main/java/com/hubspot/singularity/executor/SingularityExecutor.java
SingularityExecutor.launchTask
@Override public void launchTask(final ExecutorDriver executorDriver, final Protos.TaskInfo taskInfo) { """ Invoked when a task has been launched on this executor (initiated via Scheduler::launchTasks). Note that this task can be realized with a thread, a process, or some simple computation, however, no other callbacks will be invoked on this executor until this callback has returned. """ final String taskId = taskInfo.getTaskId().getValue(); LOG.info("Asked to launch task {}", taskId); try { final ch.qos.logback.classic.Logger taskLog = taskBuilder.buildTaskLogger(taskId, taskInfo.getExecutor().getExecutorId().getValue()); final SingularityExecutorTask task = taskBuilder.buildTask(taskId, executorDriver, taskInfo, taskLog); SubmitState submitState = monitor.submit(task); switch (submitState) { case REJECTED: LOG.warn("Can't launch task {}, it was rejected (probably due to shutdown)", taskInfo); break; case TASK_ALREADY_EXISTED: LOG.error("Can't launch task {}, already had a task with that ID", taskInfo); break; case SUBMITTED: task.getLog().info("Launched task {} with data {}", taskId, task.getExecutorData()); break; } } catch (Throwable t) { LOG.error("Unexpected exception starting task {}", taskId, t); executorUtils.sendStatusUpdate(executorDriver, taskInfo.getTaskId(), TaskState.TASK_LOST, String.format("Unexpected exception while launching task %s - %s", taskId, t.getMessage()), LOG); } }
java
@Override public void launchTask(final ExecutorDriver executorDriver, final Protos.TaskInfo taskInfo) { final String taskId = taskInfo.getTaskId().getValue(); LOG.info("Asked to launch task {}", taskId); try { final ch.qos.logback.classic.Logger taskLog = taskBuilder.buildTaskLogger(taskId, taskInfo.getExecutor().getExecutorId().getValue()); final SingularityExecutorTask task = taskBuilder.buildTask(taskId, executorDriver, taskInfo, taskLog); SubmitState submitState = monitor.submit(task); switch (submitState) { case REJECTED: LOG.warn("Can't launch task {}, it was rejected (probably due to shutdown)", taskInfo); break; case TASK_ALREADY_EXISTED: LOG.error("Can't launch task {}, already had a task with that ID", taskInfo); break; case SUBMITTED: task.getLog().info("Launched task {} with data {}", taskId, task.getExecutorData()); break; } } catch (Throwable t) { LOG.error("Unexpected exception starting task {}", taskId, t); executorUtils.sendStatusUpdate(executorDriver, taskInfo.getTaskId(), TaskState.TASK_LOST, String.format("Unexpected exception while launching task %s - %s", taskId, t.getMessage()), LOG); } }
[ "@", "Override", "public", "void", "launchTask", "(", "final", "ExecutorDriver", "executorDriver", ",", "final", "Protos", ".", "TaskInfo", "taskInfo", ")", "{", "final", "String", "taskId", "=", "taskInfo", ".", "getTaskId", "(", ")", ".", "getValue", "(", ")", ";", "LOG", ".", "info", "(", "\"Asked to launch task {}\"", ",", "taskId", ")", ";", "try", "{", "final", "ch", ".", "qos", ".", "logback", ".", "classic", ".", "Logger", "taskLog", "=", "taskBuilder", ".", "buildTaskLogger", "(", "taskId", ",", "taskInfo", ".", "getExecutor", "(", ")", ".", "getExecutorId", "(", ")", ".", "getValue", "(", ")", ")", ";", "final", "SingularityExecutorTask", "task", "=", "taskBuilder", ".", "buildTask", "(", "taskId", ",", "executorDriver", ",", "taskInfo", ",", "taskLog", ")", ";", "SubmitState", "submitState", "=", "monitor", ".", "submit", "(", "task", ")", ";", "switch", "(", "submitState", ")", "{", "case", "REJECTED", ":", "LOG", ".", "warn", "(", "\"Can't launch task {}, it was rejected (probably due to shutdown)\"", ",", "taskInfo", ")", ";", "break", ";", "case", "TASK_ALREADY_EXISTED", ":", "LOG", ".", "error", "(", "\"Can't launch task {}, already had a task with that ID\"", ",", "taskInfo", ")", ";", "break", ";", "case", "SUBMITTED", ":", "task", ".", "getLog", "(", ")", ".", "info", "(", "\"Launched task {} with data {}\"", ",", "taskId", ",", "task", ".", "getExecutorData", "(", ")", ")", ";", "break", ";", "}", "}", "catch", "(", "Throwable", "t", ")", "{", "LOG", ".", "error", "(", "\"Unexpected exception starting task {}\"", ",", "taskId", ",", "t", ")", ";", "executorUtils", ".", "sendStatusUpdate", "(", "executorDriver", ",", "taskInfo", ".", "getTaskId", "(", ")", ",", "TaskState", ".", "TASK_LOST", ",", "String", ".", "format", "(", "\"Unexpected exception while launching task %s - %s\"", ",", "taskId", ",", "t", ".", "getMessage", "(", ")", ")", ",", "LOG", ")", ";", "}", "}" ]
Invoked when a task has been launched on this executor (initiated via Scheduler::launchTasks). Note that this task can be realized with a thread, a process, or some simple computation, however, no other callbacks will be invoked on this executor until this callback has returned.
[ "Invoked", "when", "a", "task", "has", "been", "launched", "on", "this", "executor", "(", "initiated", "via", "Scheduler", "::", "launchTasks", ")", ".", "Note", "that", "this", "task", "can", "be", "realized", "with", "a", "thread", "a", "process", "or", "some", "simple", "computation", "however", "no", "other", "callbacks", "will", "be", "invoked", "on", "this", "executor", "until", "this", "callback", "has", "returned", "." ]
train
https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityExecutor/src/main/java/com/hubspot/singularity/executor/SingularityExecutor.java#L73-L102
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/i2c/I2CFactory.java
I2CFactory.getInstance
public static I2CBus getInstance(int busNumber, long lockAquireTimeout, TimeUnit lockAquireTimeoutUnit) throws UnsupportedBusNumberException, IOException { """ Create new I2CBus instance. @param busNumber The bus number @param lockAquireTimeout The timeout for locking the bus for exclusive communication @param lockAquireTimeoutUnit The units of lockAquireTimeout @return Return a new I2CBus instance @throws UnsupportedBusNumberException If the given bus-number is not supported by the underlying system @throws IOException If communication to i2c-bus fails """ return provider.getBus(busNumber, lockAquireTimeout, lockAquireTimeoutUnit); }
java
public static I2CBus getInstance(int busNumber, long lockAquireTimeout, TimeUnit lockAquireTimeoutUnit) throws UnsupportedBusNumberException, IOException { return provider.getBus(busNumber, lockAquireTimeout, lockAquireTimeoutUnit); }
[ "public", "static", "I2CBus", "getInstance", "(", "int", "busNumber", ",", "long", "lockAquireTimeout", ",", "TimeUnit", "lockAquireTimeoutUnit", ")", "throws", "UnsupportedBusNumberException", ",", "IOException", "{", "return", "provider", ".", "getBus", "(", "busNumber", ",", "lockAquireTimeout", ",", "lockAquireTimeoutUnit", ")", ";", "}" ]
Create new I2CBus instance. @param busNumber The bus number @param lockAquireTimeout The timeout for locking the bus for exclusive communication @param lockAquireTimeoutUnit The units of lockAquireTimeout @return Return a new I2CBus instance @throws UnsupportedBusNumberException If the given bus-number is not supported by the underlying system @throws IOException If communication to i2c-bus fails
[ "Create", "new", "I2CBus", "instance", "." ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/i2c/I2CFactory.java#L94-L96
finmath/finmath-lib
src/main/java/net/finmath/modelling/descriptor/xmlparser/FPMLParser.java
FPMLParser.getSwapProductDescriptor
private ProductDescriptor getSwapProductDescriptor(Element trade) { """ Construct an InterestRateSwapProductDescriptor from a node in a FpML file. @param trade The node containing the swap. @return Descriptor of the swap. """ InterestRateSwapLegProductDescriptor legReceiver = null; InterestRateSwapLegProductDescriptor legPayer = null; NodeList legs = trade.getElementsByTagName("swapStream"); for(int legIndex = 0; legIndex < legs.getLength(); legIndex++) { Element leg = (Element) legs.item(legIndex); boolean isPayer = leg.getElementsByTagName("payerPartyReference").item(0).getAttributes().getNamedItem("href").getNodeValue().equals(homePartyId); if(isPayer) { legPayer = getSwapLegProductDescriptor(leg); } else { legReceiver = getSwapLegProductDescriptor(leg); } } return new InterestRateSwapProductDescriptor(legReceiver, legPayer); }
java
private ProductDescriptor getSwapProductDescriptor(Element trade) { InterestRateSwapLegProductDescriptor legReceiver = null; InterestRateSwapLegProductDescriptor legPayer = null; NodeList legs = trade.getElementsByTagName("swapStream"); for(int legIndex = 0; legIndex < legs.getLength(); legIndex++) { Element leg = (Element) legs.item(legIndex); boolean isPayer = leg.getElementsByTagName("payerPartyReference").item(0).getAttributes().getNamedItem("href").getNodeValue().equals(homePartyId); if(isPayer) { legPayer = getSwapLegProductDescriptor(leg); } else { legReceiver = getSwapLegProductDescriptor(leg); } } return new InterestRateSwapProductDescriptor(legReceiver, legPayer); }
[ "private", "ProductDescriptor", "getSwapProductDescriptor", "(", "Element", "trade", ")", "{", "InterestRateSwapLegProductDescriptor", "legReceiver", "=", "null", ";", "InterestRateSwapLegProductDescriptor", "legPayer", "=", "null", ";", "NodeList", "legs", "=", "trade", ".", "getElementsByTagName", "(", "\"swapStream\"", ")", ";", "for", "(", "int", "legIndex", "=", "0", ";", "legIndex", "<", "legs", ".", "getLength", "(", ")", ";", "legIndex", "++", ")", "{", "Element", "leg", "=", "(", "Element", ")", "legs", ".", "item", "(", "legIndex", ")", ";", "boolean", "isPayer", "=", "leg", ".", "getElementsByTagName", "(", "\"payerPartyReference\"", ")", ".", "item", "(", "0", ")", ".", "getAttributes", "(", ")", ".", "getNamedItem", "(", "\"href\"", ")", ".", "getNodeValue", "(", ")", ".", "equals", "(", "homePartyId", ")", ";", "if", "(", "isPayer", ")", "{", "legPayer", "=", "getSwapLegProductDescriptor", "(", "leg", ")", ";", "}", "else", "{", "legReceiver", "=", "getSwapLegProductDescriptor", "(", "leg", ")", ";", "}", "}", "return", "new", "InterestRateSwapProductDescriptor", "(", "legReceiver", ",", "legPayer", ")", ";", "}" ]
Construct an InterestRateSwapProductDescriptor from a node in a FpML file. @param trade The node containing the swap. @return Descriptor of the swap.
[ "Construct", "an", "InterestRateSwapProductDescriptor", "from", "a", "node", "in", "a", "FpML", "file", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/modelling/descriptor/xmlparser/FPMLParser.java#L101-L120
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassPathTraversal.java
ClassPathTraversal.traverseJar
protected void traverseJar(File file, TraversalState state) { """ Fills the class cache with classes from the specified jar. @param file the jar to inspect @param state the traversal state """ JarFile jar; JarEntry entry; Enumeration enm; if (isLoggingEnabled()) getLogger().log(Level.INFO, "Analyzing jar: " + file); if (!file.exists()) { getLogger().log(Level.WARNING, "Jar does not exist: " + file); return; } try { jar = new JarFile(file); enm = jar.entries(); while (enm.hasMoreElements()) { entry = (JarEntry) enm.nextElement(); if (entry.getName().endsWith(".class")) traverse(entry.getName(), state); } traverseManifest(jar.getManifest(), state); } catch (Exception e) { getLogger().log(Level.SEVERE, "Failed to inspect: " + file, e); } }
java
protected void traverseJar(File file, TraversalState state) { JarFile jar; JarEntry entry; Enumeration enm; if (isLoggingEnabled()) getLogger().log(Level.INFO, "Analyzing jar: " + file); if (!file.exists()) { getLogger().log(Level.WARNING, "Jar does not exist: " + file); return; } try { jar = new JarFile(file); enm = jar.entries(); while (enm.hasMoreElements()) { entry = (JarEntry) enm.nextElement(); if (entry.getName().endsWith(".class")) traverse(entry.getName(), state); } traverseManifest(jar.getManifest(), state); } catch (Exception e) { getLogger().log(Level.SEVERE, "Failed to inspect: " + file, e); } }
[ "protected", "void", "traverseJar", "(", "File", "file", ",", "TraversalState", "state", ")", "{", "JarFile", "jar", ";", "JarEntry", "entry", ";", "Enumeration", "enm", ";", "if", "(", "isLoggingEnabled", "(", ")", ")", "getLogger", "(", ")", ".", "log", "(", "Level", ".", "INFO", ",", "\"Analyzing jar: \"", "+", "file", ")", ";", "if", "(", "!", "file", ".", "exists", "(", ")", ")", "{", "getLogger", "(", ")", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Jar does not exist: \"", "+", "file", ")", ";", "return", ";", "}", "try", "{", "jar", "=", "new", "JarFile", "(", "file", ")", ";", "enm", "=", "jar", ".", "entries", "(", ")", ";", "while", "(", "enm", ".", "hasMoreElements", "(", ")", ")", "{", "entry", "=", "(", "JarEntry", ")", "enm", ".", "nextElement", "(", ")", ";", "if", "(", "entry", ".", "getName", "(", ")", ".", "endsWith", "(", "\".class\"", ")", ")", "traverse", "(", "entry", ".", "getName", "(", ")", ",", "state", ")", ";", "}", "traverseManifest", "(", "jar", ".", "getManifest", "(", ")", ",", "state", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "getLogger", "(", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Failed to inspect: \"", "+", "file", ",", "e", ")", ";", "}", "}" ]
Fills the class cache with classes from the specified jar. @param file the jar to inspect @param state the traversal state
[ "Fills", "the", "class", "cache", "with", "classes", "from", "the", "specified", "jar", "." ]
train
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassPathTraversal.java#L233-L259
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/json/JobResultDeserializer.java
JobResultDeserializer.assertNextToken
private static void assertNextToken( final JsonParser p, final JsonToken requiredJsonToken) throws IOException { """ Advances the token and asserts that it matches the required {@link JsonToken}. """ final JsonToken jsonToken = p.nextToken(); if (jsonToken != requiredJsonToken) { throw new JsonMappingException(p, String.format("Expected token %s (was %s)", requiredJsonToken, jsonToken)); } }
java
private static void assertNextToken( final JsonParser p, final JsonToken requiredJsonToken) throws IOException { final JsonToken jsonToken = p.nextToken(); if (jsonToken != requiredJsonToken) { throw new JsonMappingException(p, String.format("Expected token %s (was %s)", requiredJsonToken, jsonToken)); } }
[ "private", "static", "void", "assertNextToken", "(", "final", "JsonParser", "p", ",", "final", "JsonToken", "requiredJsonToken", ")", "throws", "IOException", "{", "final", "JsonToken", "jsonToken", "=", "p", ".", "nextToken", "(", ")", ";", "if", "(", "jsonToken", "!=", "requiredJsonToken", ")", "{", "throw", "new", "JsonMappingException", "(", "p", ",", "String", ".", "format", "(", "\"Expected token %s (was %s)\"", ",", "requiredJsonToken", ",", "jsonToken", ")", ")", ";", "}", "}" ]
Advances the token and asserts that it matches the required {@link JsonToken}.
[ "Advances", "the", "token", "and", "asserts", "that", "it", "matches", "the", "required", "{" ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/json/JobResultDeserializer.java#L160-L167
deephacks/confit
provider-yaml/src/main/java/org/deephacks/confit/internal/core/yaml/YamlBeanManager.java
YamlBeanManager.hasReferences
private static boolean hasReferences(Bean target, BeanId reference) { """ Returns the a list of property names of the target bean that have references to the bean id. """ for (String name : target.getReferenceNames()) { for (BeanId ref : target.getReference(name)) { if (ref.equals(reference)) { return true; } } } return false; }
java
private static boolean hasReferences(Bean target, BeanId reference) { for (String name : target.getReferenceNames()) { for (BeanId ref : target.getReference(name)) { if (ref.equals(reference)) { return true; } } } return false; }
[ "private", "static", "boolean", "hasReferences", "(", "Bean", "target", ",", "BeanId", "reference", ")", "{", "for", "(", "String", "name", ":", "target", ".", "getReferenceNames", "(", ")", ")", "{", "for", "(", "BeanId", "ref", ":", "target", ".", "getReference", "(", "name", ")", ")", "{", "if", "(", "ref", ".", "equals", "(", "reference", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Returns the a list of property names of the target bean that have references to the bean id.
[ "Returns", "the", "a", "list", "of", "property", "names", "of", "the", "target", "bean", "that", "have", "references", "to", "the", "bean", "id", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/provider-yaml/src/main/java/org/deephacks/confit/internal/core/yaml/YamlBeanManager.java#L443-L452
lightblueseas/net-extensions
src/main/java/de/alpharogroup/net/socket/SocketExtensions.java
SocketExtensions.readObject
public static Object readObject(final InetAddress inetAddress, final int port) throws IOException, ClassNotFoundException { """ Reads an object from the given socket InetAddress. @param inetAddress the InetAddress to read. @param port The port to read. @return the object @throws IOException Signals that an I/O exception has occurred. @throws ClassNotFoundException the class not found exception """ return readObject(new Socket(inetAddress, port)); }
java
public static Object readObject(final InetAddress inetAddress, final int port) throws IOException, ClassNotFoundException { return readObject(new Socket(inetAddress, port)); }
[ "public", "static", "Object", "readObject", "(", "final", "InetAddress", "inetAddress", ",", "final", "int", "port", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "return", "readObject", "(", "new", "Socket", "(", "inetAddress", ",", "port", ")", ")", ";", "}" ]
Reads an object from the given socket InetAddress. @param inetAddress the InetAddress to read. @param port The port to read. @return the object @throws IOException Signals that an I/O exception has occurred. @throws ClassNotFoundException the class not found exception
[ "Reads", "an", "object", "from", "the", "given", "socket", "InetAddress", "." ]
train
https://github.com/lightblueseas/net-extensions/blob/771757a93fa9ad13ce0fe061c158e5cba43344cb/src/main/java/de/alpharogroup/net/socket/SocketExtensions.java#L213-L217
languagetool-org/languagetool
languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java
Tools.openFileDialog
static File openFileDialog(Frame frame, FileFilter fileFilter, File initialDir) { """ Show a file chooser dialog in a specified directory @param frame Owner frame @param fileFilter The pattern of files to choose from @param initialDir The initial directory @return the selected file @since 2.6 """ return openFileDialog(frame, fileFilter, initialDir, JFileChooser.FILES_ONLY); }
java
static File openFileDialog(Frame frame, FileFilter fileFilter, File initialDir) { return openFileDialog(frame, fileFilter, initialDir, JFileChooser.FILES_ONLY); }
[ "static", "File", "openFileDialog", "(", "Frame", "frame", ",", "FileFilter", "fileFilter", ",", "File", "initialDir", ")", "{", "return", "openFileDialog", "(", "frame", ",", "fileFilter", ",", "initialDir", ",", "JFileChooser", ".", "FILES_ONLY", ")", ";", "}" ]
Show a file chooser dialog in a specified directory @param frame Owner frame @param fileFilter The pattern of files to choose from @param initialDir The initial directory @return the selected file @since 2.6
[ "Show", "a", "file", "chooser", "dialog", "in", "a", "specified", "directory" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java#L69-L71
ludovicianul/selenium-on-steroids
src/main/java/com/insidecoding/sos/io/FileUtils.java
FileUtils.getPropertyAsDouble
public double getPropertyAsDouble(final String bundleName, final String key) { """ Gets the value as double from the resource bundles corresponding to the supplied key. <br/> @param bundleName the name of the bundle to search in @param key the key to search for @return {@code -1} if the property is not found or the value is not a number; the corresponding value otherwise """ LOG.info("Getting value for key: " + key + " from bundle: " + bundleName); ResourceBundle bundle = bundles.get(bundleName); try { return Double.parseDouble(bundle.getString(key)); } catch (MissingResourceException e) { LOG.info("Resource: " + key + " not found!"); } catch (NumberFormatException e) { return -1d; } return -1d; }
java
public double getPropertyAsDouble(final String bundleName, final String key) { LOG.info("Getting value for key: " + key + " from bundle: " + bundleName); ResourceBundle bundle = bundles.get(bundleName); try { return Double.parseDouble(bundle.getString(key)); } catch (MissingResourceException e) { LOG.info("Resource: " + key + " not found!"); } catch (NumberFormatException e) { return -1d; } return -1d; }
[ "public", "double", "getPropertyAsDouble", "(", "final", "String", "bundleName", ",", "final", "String", "key", ")", "{", "LOG", ".", "info", "(", "\"Getting value for key: \"", "+", "key", "+", "\" from bundle: \"", "+", "bundleName", ")", ";", "ResourceBundle", "bundle", "=", "bundles", ".", "get", "(", "bundleName", ")", ";", "try", "{", "return", "Double", ".", "parseDouble", "(", "bundle", ".", "getString", "(", "key", ")", ")", ";", "}", "catch", "(", "MissingResourceException", "e", ")", "{", "LOG", ".", "info", "(", "\"Resource: \"", "+", "key", "+", "\" not found!\"", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "return", "-", "1d", ";", "}", "return", "-", "1d", ";", "}" ]
Gets the value as double from the resource bundles corresponding to the supplied key. <br/> @param bundleName the name of the bundle to search in @param key the key to search for @return {@code -1} if the property is not found or the value is not a number; the corresponding value otherwise
[ "Gets", "the", "value", "as", "double", "from", "the", "resource", "bundles", "corresponding", "to", "the", "supplied", "key", ".", "<br", "/", ">" ]
train
https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/io/FileUtils.java#L386-L398
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.delegatedAccount_email_filter_name_changePriority_POST
public OvhTaskFilter delegatedAccount_email_filter_name_changePriority_POST(String email, String name, Long priority) throws IOException { """ Change filter priority REST: POST /email/domain/delegatedAccount/{email}/filter/{name}/changePriority @param priority [required] New priority @param email [required] Email @param name [required] Filter name """ String qPath = "/email/domain/delegatedAccount/{email}/filter/{name}/changePriority"; StringBuilder sb = path(qPath, email, name); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "priority", priority); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskFilter.class); }
java
public OvhTaskFilter delegatedAccount_email_filter_name_changePriority_POST(String email, String name, Long priority) throws IOException { String qPath = "/email/domain/delegatedAccount/{email}/filter/{name}/changePriority"; StringBuilder sb = path(qPath, email, name); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "priority", priority); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskFilter.class); }
[ "public", "OvhTaskFilter", "delegatedAccount_email_filter_name_changePriority_POST", "(", "String", "email", ",", "String", "name", ",", "Long", "priority", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/delegatedAccount/{email}/filter/{name}/changePriority\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "email", ",", "name", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"priority\"", ",", "priority", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTaskFilter", ".", "class", ")", ";", "}" ]
Change filter priority REST: POST /email/domain/delegatedAccount/{email}/filter/{name}/changePriority @param priority [required] New priority @param email [required] Email @param name [required] Filter name
[ "Change", "filter", "priority" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L144-L151
jmeetsma/Iglu-Common
src/main/java/org/ijsberg/iglu/caching/module/StandardCache.java
StandardCache.cleanup
public long cleanup() { """ Removes all expired objects. @return the number of removed objects. """ int garbageSize = 0; if (isCachingEnabled()) { System.out.println(new LogEntry(Level.VERBOSE, "Identifying expired objects")); ArrayList<K> garbage = getExpiredObjects(); garbageSize = garbage.size(); System.out.println(new LogEntry("cache cleanup: expired objects: " + garbageSize)); for (K key : garbage) { clear(key); } } return garbageSize; }
java
public long cleanup() { int garbageSize = 0; if (isCachingEnabled()) { System.out.println(new LogEntry(Level.VERBOSE, "Identifying expired objects")); ArrayList<K> garbage = getExpiredObjects(); garbageSize = garbage.size(); System.out.println(new LogEntry("cache cleanup: expired objects: " + garbageSize)); for (K key : garbage) { clear(key); } } return garbageSize; }
[ "public", "long", "cleanup", "(", ")", "{", "int", "garbageSize", "=", "0", ";", "if", "(", "isCachingEnabled", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "new", "LogEntry", "(", "Level", ".", "VERBOSE", ",", "\"Identifying expired objects\"", ")", ")", ";", "ArrayList", "<", "K", ">", "garbage", "=", "getExpiredObjects", "(", ")", ";", "garbageSize", "=", "garbage", ".", "size", "(", ")", ";", "System", ".", "out", ".", "println", "(", "new", "LogEntry", "(", "\"cache cleanup: expired objects: \"", "+", "garbageSize", ")", ")", ";", "for", "(", "K", "key", ":", "garbage", ")", "{", "clear", "(", "key", ")", ";", "}", "}", "return", "garbageSize", ";", "}" ]
Removes all expired objects. @return the number of removed objects.
[ "Removes", "all", "expired", "objects", "." ]
train
https://github.com/jmeetsma/Iglu-Common/blob/0fb0885775b576209ff1b5a0f67e3c25a99a6420/src/main/java/org/ijsberg/iglu/caching/module/StandardCache.java#L320-L332
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/lang/QuotedStringTokenizer.java
QuotedStringTokenizer.quoteOnly
public static void quoteOnly(Appendable buffer, String input) { """ Quote a string into an Appendable. Only quotes and backslash are escaped. @param buffer The Appendable @param input The String to quote. """ if (input == null) return; try { buffer.append('"'); for (int i = 0; i < input.length(); ++i) { char c = input.charAt(i); if (c == '"' || c == '\\') buffer.append('\\'); buffer.append(c); } buffer.append('"'); } catch (IOException x) { throw new RuntimeException(x); } }
java
public static void quoteOnly(Appendable buffer, String input) { if (input == null) return; try { buffer.append('"'); for (int i = 0; i < input.length(); ++i) { char c = input.charAt(i); if (c == '"' || c == '\\') buffer.append('\\'); buffer.append(c); } buffer.append('"'); } catch (IOException x) { throw new RuntimeException(x); } }
[ "public", "static", "void", "quoteOnly", "(", "Appendable", "buffer", ",", "String", "input", ")", "{", "if", "(", "input", "==", "null", ")", "return", ";", "try", "{", "buffer", ".", "append", "(", "'", "'", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "input", ".", "length", "(", ")", ";", "++", "i", ")", "{", "char", "c", "=", "input", ".", "charAt", "(", "i", ")", ";", "if", "(", "c", "==", "'", "'", "||", "c", "==", "'", "'", ")", "buffer", ".", "append", "(", "'", "'", ")", ";", "buffer", ".", "append", "(", "c", ")", ";", "}", "buffer", ".", "append", "(", "'", "'", ")", ";", "}", "catch", "(", "IOException", "x", ")", "{", "throw", "new", "RuntimeException", "(", "x", ")", ";", "}", "}" ]
Quote a string into an Appendable. Only quotes and backslash are escaped. @param buffer The Appendable @param input The String to quote.
[ "Quote", "a", "string", "into", "an", "Appendable", ".", "Only", "quotes", "and", "backslash", "are", "escaped", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/QuotedStringTokenizer.java#L251-L267
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/painter/RasterLayerPainter.java
RasterLayerPainter.deleteShape
public void deleteShape(Paintable paintable, Object group, MapContext context) { """ Delete a {@link Paintable} object from the given {@link MapContext}. It the object does not exist, nothing will be done. @param paintable The raster layer @param group The group where the object resides in (optional). @param graphics The context to paint on. """ context.getRasterContext().deleteGroup(paintable); }
java
public void deleteShape(Paintable paintable, Object group, MapContext context) { context.getRasterContext().deleteGroup(paintable); }
[ "public", "void", "deleteShape", "(", "Paintable", "paintable", ",", "Object", "group", ",", "MapContext", "context", ")", "{", "context", ".", "getRasterContext", "(", ")", ".", "deleteGroup", "(", "paintable", ")", ";", "}" ]
Delete a {@link Paintable} object from the given {@link MapContext}. It the object does not exist, nothing will be done. @param paintable The raster layer @param group The group where the object resides in (optional). @param graphics The context to paint on.
[ "Delete", "a", "{", "@link", "Paintable", "}", "object", "from", "the", "given", "{", "@link", "MapContext", "}", ".", "It", "the", "object", "does", "not", "exist", "nothing", "will", "be", "done", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/painter/RasterLayerPainter.java#L75-L77
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java
MLEDependencyGrammar.getStopProb
protected double getStopProb(IntDependency dependency) { """ Return the probability (as a real number between 0 and 1) of stopping rather than generating another argument at this position. @param dependency The dependency used as the basis for stopping on. Tags are assumed to be in the TagProjection space. @return The probability of generating this stop probability """ short binDistance = distanceBin(dependency.distance); IntTaggedWord unknownHead = new IntTaggedWord(-1, dependency.head.tag); IntTaggedWord anyHead = new IntTaggedWord(ANY_WORD_INT, dependency.head.tag); IntDependency temp = new IntDependency(dependency.head, stopTW, dependency.leftHeaded, binDistance); double c_stop_hTWds = stopCounter.getCount(temp); temp = new IntDependency(unknownHead, stopTW, dependency.leftHeaded, binDistance); double c_stop_hTds = stopCounter.getCount(temp); temp = new IntDependency(dependency.head, wildTW, dependency.leftHeaded, binDistance); double c_hTWds = stopCounter.getCount(temp); temp = new IntDependency(anyHead, wildTW, dependency.leftHeaded, binDistance); double c_hTds = stopCounter.getCount(temp); double p_stop_hTds = (c_hTds > 0.0 ? c_stop_hTds / c_hTds : 1.0); double pb_stop_hTWds = (c_stop_hTWds + smooth_stop * p_stop_hTds) / (c_hTWds + smooth_stop); if (verbose) { System.out.println(" c_stop_hTWds: " + c_stop_hTWds + "; c_hTWds: " + c_hTWds + "; c_stop_hTds: " + c_stop_hTds + "; c_hTds: " + c_hTds); System.out.println(" Generate STOP prob: " + pb_stop_hTWds); } return pb_stop_hTWds; }
java
protected double getStopProb(IntDependency dependency) { short binDistance = distanceBin(dependency.distance); IntTaggedWord unknownHead = new IntTaggedWord(-1, dependency.head.tag); IntTaggedWord anyHead = new IntTaggedWord(ANY_WORD_INT, dependency.head.tag); IntDependency temp = new IntDependency(dependency.head, stopTW, dependency.leftHeaded, binDistance); double c_stop_hTWds = stopCounter.getCount(temp); temp = new IntDependency(unknownHead, stopTW, dependency.leftHeaded, binDistance); double c_stop_hTds = stopCounter.getCount(temp); temp = new IntDependency(dependency.head, wildTW, dependency.leftHeaded, binDistance); double c_hTWds = stopCounter.getCount(temp); temp = new IntDependency(anyHead, wildTW, dependency.leftHeaded, binDistance); double c_hTds = stopCounter.getCount(temp); double p_stop_hTds = (c_hTds > 0.0 ? c_stop_hTds / c_hTds : 1.0); double pb_stop_hTWds = (c_stop_hTWds + smooth_stop * p_stop_hTds) / (c_hTWds + smooth_stop); if (verbose) { System.out.println(" c_stop_hTWds: " + c_stop_hTWds + "; c_hTWds: " + c_hTWds + "; c_stop_hTds: " + c_stop_hTds + "; c_hTds: " + c_hTds); System.out.println(" Generate STOP prob: " + pb_stop_hTWds); } return pb_stop_hTWds; }
[ "protected", "double", "getStopProb", "(", "IntDependency", "dependency", ")", "{", "short", "binDistance", "=", "distanceBin", "(", "dependency", ".", "distance", ")", ";", "IntTaggedWord", "unknownHead", "=", "new", "IntTaggedWord", "(", "-", "1", ",", "dependency", ".", "head", ".", "tag", ")", ";", "IntTaggedWord", "anyHead", "=", "new", "IntTaggedWord", "(", "ANY_WORD_INT", ",", "dependency", ".", "head", ".", "tag", ")", ";", "IntDependency", "temp", "=", "new", "IntDependency", "(", "dependency", ".", "head", ",", "stopTW", ",", "dependency", ".", "leftHeaded", ",", "binDistance", ")", ";", "double", "c_stop_hTWds", "=", "stopCounter", ".", "getCount", "(", "temp", ")", ";", "temp", "=", "new", "IntDependency", "(", "unknownHead", ",", "stopTW", ",", "dependency", ".", "leftHeaded", ",", "binDistance", ")", ";", "double", "c_stop_hTds", "=", "stopCounter", ".", "getCount", "(", "temp", ")", ";", "temp", "=", "new", "IntDependency", "(", "dependency", ".", "head", ",", "wildTW", ",", "dependency", ".", "leftHeaded", ",", "binDistance", ")", ";", "double", "c_hTWds", "=", "stopCounter", ".", "getCount", "(", "temp", ")", ";", "temp", "=", "new", "IntDependency", "(", "anyHead", ",", "wildTW", ",", "dependency", ".", "leftHeaded", ",", "binDistance", ")", ";", "double", "c_hTds", "=", "stopCounter", ".", "getCount", "(", "temp", ")", ";", "double", "p_stop_hTds", "=", "(", "c_hTds", ">", "0.0", "?", "c_stop_hTds", "/", "c_hTds", ":", "1.0", ")", ";", "double", "pb_stop_hTWds", "=", "(", "c_stop_hTWds", "+", "smooth_stop", "*", "p_stop_hTds", ")", "/", "(", "c_hTWds", "+", "smooth_stop", ")", ";", "if", "(", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\" c_stop_hTWds: \"", "+", "c_stop_hTWds", "+", "\"; c_hTWds: \"", "+", "c_hTWds", "+", "\"; c_stop_hTds: \"", "+", "c_stop_hTds", "+", "\"; c_hTds: \"", "+", "c_hTds", ")", ";", "System", ".", "out", ".", "println", "(", "\" Generate STOP prob: \"", "+", "pb_stop_hTWds", ")", ";", "}", "return", "pb_stop_hTWds", ";", "}" ]
Return the probability (as a real number between 0 and 1) of stopping rather than generating another argument at this position. @param dependency The dependency used as the basis for stopping on. Tags are assumed to be in the TagProjection space. @return The probability of generating this stop probability
[ "Return", "the", "probability", "(", "as", "a", "real", "number", "between", "0", "and", "1", ")", "of", "stopping", "rather", "than", "generating", "another", "argument", "at", "this", "position", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java#L716-L739
FasterXML/woodstox
src/main/java/com/ctc/wstx/sw/SimpleOutputElement.java
SimpleOutputElement.createChild
protected SimpleOutputElement createChild(String prefix, String localName, String uri) { """ Full factory method, used for 'normal' namespace qualified output methods. """ /* At this point we can also discard attribute Map; it is assumed * that when a child element has been opened, no more attributes * can be output. */ mAttrSet = null; return new SimpleOutputElement(this, prefix, localName, uri, mNsMapping); }
java
protected SimpleOutputElement createChild(String prefix, String localName, String uri) { /* At this point we can also discard attribute Map; it is assumed * that when a child element has been opened, no more attributes * can be output. */ mAttrSet = null; return new SimpleOutputElement(this, prefix, localName, uri, mNsMapping); }
[ "protected", "SimpleOutputElement", "createChild", "(", "String", "prefix", ",", "String", "localName", ",", "String", "uri", ")", "{", "/* At this point we can also discard attribute Map; it is assumed\n * that when a child element has been opened, no more attributes\n * can be output.\n */", "mAttrSet", "=", "null", ";", "return", "new", "SimpleOutputElement", "(", "this", ",", "prefix", ",", "localName", ",", "uri", ",", "mNsMapping", ")", ";", "}" ]
Full factory method, used for 'normal' namespace qualified output methods.
[ "Full", "factory", "method", "used", "for", "normal", "namespace", "qualified", "output", "methods", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/SimpleOutputElement.java#L184-L193
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
Props.getLong
public long getLong(final String name, final long defaultValue) { """ Returns the long representation of the value. If the value is null, then the default value is returned. If the value isn't a long, then a parse exception will be thrown. """ if (containsKey(name)) { return Long.parseLong(get(name)); } else { return defaultValue; } }
java
public long getLong(final String name, final long defaultValue) { if (containsKey(name)) { return Long.parseLong(get(name)); } else { return defaultValue; } }
[ "public", "long", "getLong", "(", "final", "String", "name", ",", "final", "long", "defaultValue", ")", "{", "if", "(", "containsKey", "(", "name", ")", ")", "{", "return", "Long", ".", "parseLong", "(", "get", "(", "name", ")", ")", ";", "}", "else", "{", "return", "defaultValue", ";", "}", "}" ]
Returns the long representation of the value. If the value is null, then the default value is returned. If the value isn't a long, then a parse exception will be thrown.
[ "Returns", "the", "long", "representation", "of", "the", "value", ".", "If", "the", "value", "is", "null", "then", "the", "default", "value", "is", "returned", ".", "If", "the", "value", "isn", "t", "a", "long", "then", "a", "parse", "exception", "will", "be", "thrown", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-core/src/main/java/azkaban/utils/Props.java#L534-L540
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/persister/impl/OgmEntityPersister.java
OgmEntityPersister.getInverseOneToOneProperty
private String getInverseOneToOneProperty(String property, OgmEntityPersister otherSidePersister) { """ Returns the name from the inverse side if the given property de-notes a one-to-one association. """ for ( String candidate : otherSidePersister.getPropertyNames() ) { Type candidateType = otherSidePersister.getPropertyType( candidate ); if ( candidateType.isEntityType() && ( ( (EntityType) candidateType ).isOneToOne() && isOneToOneMatching( this, property, (OneToOneType) candidateType ) ) ) { return candidate; } } return null; }
java
private String getInverseOneToOneProperty(String property, OgmEntityPersister otherSidePersister) { for ( String candidate : otherSidePersister.getPropertyNames() ) { Type candidateType = otherSidePersister.getPropertyType( candidate ); if ( candidateType.isEntityType() && ( ( (EntityType) candidateType ).isOneToOne() && isOneToOneMatching( this, property, (OneToOneType) candidateType ) ) ) { return candidate; } } return null; }
[ "private", "String", "getInverseOneToOneProperty", "(", "String", "property", ",", "OgmEntityPersister", "otherSidePersister", ")", "{", "for", "(", "String", "candidate", ":", "otherSidePersister", ".", "getPropertyNames", "(", ")", ")", "{", "Type", "candidateType", "=", "otherSidePersister", ".", "getPropertyType", "(", "candidate", ")", ";", "if", "(", "candidateType", ".", "isEntityType", "(", ")", "&&", "(", "(", "(", "EntityType", ")", "candidateType", ")", ".", "isOneToOne", "(", ")", "&&", "isOneToOneMatching", "(", "this", ",", "property", ",", "(", "OneToOneType", ")", "candidateType", ")", ")", ")", "{", "return", "candidate", ";", "}", "}", "return", "null", ";", "}" ]
Returns the name from the inverse side if the given property de-notes a one-to-one association.
[ "Returns", "the", "name", "from", "the", "inverse", "side", "if", "the", "given", "property", "de", "-", "notes", "a", "one", "-", "to", "-", "one", "association", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/persister/impl/OgmEntityPersister.java#L415-L426
GerdHolz/TOVAL
src/de/invation/code/toval/misc/ArrayUtils.java
ArrayUtils.divideObjectArray
public static <T> List<T[]> divideObjectArray(T[] arr, Integer... cuts) { """ Divides the given object-array using the boundaries in <code>cuts</code>. <br> Cuts are interpreted in an inclusive way, which means that a single cut at position i divides the given array in 0...i-1 + i...n<br> This method deals with both cut positions including and excluding start and end-indexes<br> @param <T> Object array type. @param arr Array to divide @param cuts Cut positions for divide operations @return A list of subarrays of <code>arr</code> according to the given cut positions @see #divideArray(Object[], Integer[]) """ return divideArray(arr, cuts); }
java
public static <T> List<T[]> divideObjectArray(T[] arr, Integer... cuts) { return divideArray(arr, cuts); }
[ "public", "static", "<", "T", ">", "List", "<", "T", "[", "]", ">", "divideObjectArray", "(", "T", "[", "]", "arr", ",", "Integer", "...", "cuts", ")", "{", "return", "divideArray", "(", "arr", ",", "cuts", ")", ";", "}" ]
Divides the given object-array using the boundaries in <code>cuts</code>. <br> Cuts are interpreted in an inclusive way, which means that a single cut at position i divides the given array in 0...i-1 + i...n<br> This method deals with both cut positions including and excluding start and end-indexes<br> @param <T> Object array type. @param arr Array to divide @param cuts Cut positions for divide operations @return A list of subarrays of <code>arr</code> according to the given cut positions @see #divideArray(Object[], Integer[])
[ "Divides", "the", "given", "object", "-", "array", "using", "the", "boundaries", "in", "<code", ">", "cuts<", "/", "code", ">", ".", "<br", ">", "Cuts", "are", "interpreted", "in", "an", "inclusive", "way", "which", "means", "that", "a", "single", "cut", "at", "position", "i", "divides", "the", "given", "array", "in", "0", "...", "i", "-", "1", "+", "i", "...", "n<br", ">", "This", "method", "deals", "with", "both", "cut", "positions", "including", "and", "excluding", "start", "and", "end", "-", "indexes<br", ">" ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/ArrayUtils.java#L320-L322
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
Enter.topLevelEnv
Env<AttrContext> topLevelEnv(JCCompilationUnit tree) { """ Create a fresh environment for toplevels. @param tree The toplevel tree. """ Env<AttrContext> localEnv = new Env<>(tree, new AttrContext()); localEnv.toplevel = tree; localEnv.enclClass = predefClassDef; tree.toplevelScope = WriteableScope.create(tree.packge); tree.namedImportScope = new NamedImportScope(tree.packge, tree.toplevelScope); tree.starImportScope = new StarImportScope(tree.packge); localEnv.info.scope = tree.toplevelScope; localEnv.info.lint = lint; return localEnv; }
java
Env<AttrContext> topLevelEnv(JCCompilationUnit tree) { Env<AttrContext> localEnv = new Env<>(tree, new AttrContext()); localEnv.toplevel = tree; localEnv.enclClass = predefClassDef; tree.toplevelScope = WriteableScope.create(tree.packge); tree.namedImportScope = new NamedImportScope(tree.packge, tree.toplevelScope); tree.starImportScope = new StarImportScope(tree.packge); localEnv.info.scope = tree.toplevelScope; localEnv.info.lint = lint; return localEnv; }
[ "Env", "<", "AttrContext", ">", "topLevelEnv", "(", "JCCompilationUnit", "tree", ")", "{", "Env", "<", "AttrContext", ">", "localEnv", "=", "new", "Env", "<>", "(", "tree", ",", "new", "AttrContext", "(", ")", ")", ";", "localEnv", ".", "toplevel", "=", "tree", ";", "localEnv", ".", "enclClass", "=", "predefClassDef", ";", "tree", ".", "toplevelScope", "=", "WriteableScope", ".", "create", "(", "tree", ".", "packge", ")", ";", "tree", ".", "namedImportScope", "=", "new", "NamedImportScope", "(", "tree", ".", "packge", ",", "tree", ".", "toplevelScope", ")", ";", "tree", ".", "starImportScope", "=", "new", "StarImportScope", "(", "tree", ".", "packge", ")", ";", "localEnv", ".", "info", ".", "scope", "=", "tree", ".", "toplevelScope", ";", "localEnv", ".", "info", ".", "lint", "=", "lint", ";", "return", "localEnv", ";", "}" ]
Create a fresh environment for toplevels. @param tree The toplevel tree.
[ "Create", "a", "fresh", "environment", "for", "toplevels", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java#L212-L222
landawn/AbacusUtil
src/com/landawn/abacus/util/PropertiesUtil.java
PropertiesUtil.xml2Java
public static void xml2Java(File file, String srcPath, String packageName, String className, boolean isPublicField) { """ Generate java code by the specified xml. @param file @param srcPath @param packageName @param className @param isPublicField """ InputStream is = null; try { is = new FileInputStream(file); xml2Java(is, srcPath, packageName, className, isPublicField); } catch (FileNotFoundException e) { throw new UncheckedIOException(e); } finally { IOUtil.close(is); } }
java
public static void xml2Java(File file, String srcPath, String packageName, String className, boolean isPublicField) { InputStream is = null; try { is = new FileInputStream(file); xml2Java(is, srcPath, packageName, className, isPublicField); } catch (FileNotFoundException e) { throw new UncheckedIOException(e); } finally { IOUtil.close(is); } }
[ "public", "static", "void", "xml2Java", "(", "File", "file", ",", "String", "srcPath", ",", "String", "packageName", ",", "String", "className", ",", "boolean", "isPublicField", ")", "{", "InputStream", "is", "=", "null", ";", "try", "{", "is", "=", "new", "FileInputStream", "(", "file", ")", ";", "xml2Java", "(", "is", ",", "srcPath", ",", "packageName", ",", "className", ",", "isPublicField", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "throw", "new", "UncheckedIOException", "(", "e", ")", ";", "}", "finally", "{", "IOUtil", ".", "close", "(", "is", ")", ";", "}", "}" ]
Generate java code by the specified xml. @param file @param srcPath @param packageName @param className @param isPublicField
[ "Generate", "java", "code", "by", "the", "specified", "xml", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/PropertiesUtil.java#L837-L849
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/samediff/SDLayerParams.java
SDLayerParams.addBiasParam
public void addBiasParam(@NonNull String paramKey, @NonNull long... paramShape) { """ Add a bias parameter to the layer, with the specified shape. For example, a standard fully connected layer could have bias parameters with shape [1, layerSize] @param paramKey The parameter key (name) for the bias parameter @param paramShape Shape of the bias parameter array """ Preconditions.checkArgument(paramShape.length > 0, "Provided mia- parameter shape is" + " invalid: length 0 provided for shape. Parameter: " + paramKey); biasParams.put(paramKey, paramShape); paramsList = null; weightParamsList = null; biasParamsList = null; }
java
public void addBiasParam(@NonNull String paramKey, @NonNull long... paramShape) { Preconditions.checkArgument(paramShape.length > 0, "Provided mia- parameter shape is" + " invalid: length 0 provided for shape. Parameter: " + paramKey); biasParams.put(paramKey, paramShape); paramsList = null; weightParamsList = null; biasParamsList = null; }
[ "public", "void", "addBiasParam", "(", "@", "NonNull", "String", "paramKey", ",", "@", "NonNull", "long", "...", "paramShape", ")", "{", "Preconditions", ".", "checkArgument", "(", "paramShape", ".", "length", ">", "0", ",", "\"Provided mia- parameter shape is\"", "+", "\" invalid: length 0 provided for shape. Parameter: \"", "+", "paramKey", ")", ";", "biasParams", ".", "put", "(", "paramKey", ",", "paramShape", ")", ";", "paramsList", "=", "null", ";", "weightParamsList", "=", "null", ";", "biasParamsList", "=", "null", ";", "}" ]
Add a bias parameter to the layer, with the specified shape. For example, a standard fully connected layer could have bias parameters with shape [1, layerSize] @param paramKey The parameter key (name) for the bias parameter @param paramShape Shape of the bias parameter array
[ "Add", "a", "bias", "parameter", "to", "the", "layer", "with", "the", "specified", "shape", ".", "For", "example", "a", "standard", "fully", "connected", "layer", "could", "have", "bias", "parameters", "with", "shape", "[", "1", "layerSize", "]" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/samediff/SDLayerParams.java#L81-L88
Netflix/servo
servo-core/src/main/java/com/netflix/servo/jmx/ObjectNameBuilder.java
ObjectNameBuilder.addProperty
public ObjectNameBuilder addProperty(String key, String value) { """ Adds the key/value as a {@link ObjectName} property. @param key the key to add @param value the value to add @return This builder """ nameStrBuilder.append(sanitizeValue(key)) .append('=') .append(sanitizeValue(value)).append(","); return this; }
java
public ObjectNameBuilder addProperty(String key, String value) { nameStrBuilder.append(sanitizeValue(key)) .append('=') .append(sanitizeValue(value)).append(","); return this; }
[ "public", "ObjectNameBuilder", "addProperty", "(", "String", "key", ",", "String", "value", ")", "{", "nameStrBuilder", ".", "append", "(", "sanitizeValue", "(", "key", ")", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "sanitizeValue", "(", "value", ")", ")", ".", "append", "(", "\",\"", ")", ";", "return", "this", ";", "}" ]
Adds the key/value as a {@link ObjectName} property. @param key the key to add @param value the value to add @return This builder
[ "Adds", "the", "key", "/", "value", "as", "a", "{", "@link", "ObjectName", "}", "property", "." ]
train
https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/jmx/ObjectNameBuilder.java#L100-L105
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.getServerFarmSkusAsync
public Observable<Object> getServerFarmSkusAsync(String resourceGroupName, String name) { """ Gets all selectable sku's for a given App Service Plan. Gets all selectable sku's for a given App Service Plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of App Service Plan @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Object object """ return getServerFarmSkusWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<Object>, Object>() { @Override public Object call(ServiceResponse<Object> response) { return response.body(); } }); }
java
public Observable<Object> getServerFarmSkusAsync(String resourceGroupName, String name) { return getServerFarmSkusWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<Object>, Object>() { @Override public Object call(ServiceResponse<Object> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Object", ">", "getServerFarmSkusAsync", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "getServerFarmSkusWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Object", ">", ",", "Object", ">", "(", ")", "{", "@", "Override", "public", "Object", "call", "(", "ServiceResponse", "<", "Object", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets all selectable sku's for a given App Service Plan. Gets all selectable sku's for a given App Service Plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of App Service Plan @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Object object
[ "Gets", "all", "selectable", "sku", "s", "for", "a", "given", "App", "Service", "Plan", ".", "Gets", "all", "selectable", "sku", "s", "for", "a", "given", "App", "Service", "Plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L2666-L2673
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/Branch.java
Branch.enableCookieBasedMatching
public static void enableCookieBasedMatching(String cookieMatchDomain, int delay) { """ <p> Enabled Strong matching check using chrome cookies. This method should be called before Branch#getAutoInstance(Context).</p> @param cookieMatchDomain The domain for the url used to match the cookie (eg. example.app.link) @param delay Time in millisecond to wait for the strong match to check to finish before Branch init session is called. Default time is 750 msec. """ cookieBasedMatchDomain_ = cookieMatchDomain; BranchStrongMatchHelper.getInstance().setStrongMatchUrlHitDelay(delay); }
java
public static void enableCookieBasedMatching(String cookieMatchDomain, int delay) { cookieBasedMatchDomain_ = cookieMatchDomain; BranchStrongMatchHelper.getInstance().setStrongMatchUrlHitDelay(delay); }
[ "public", "static", "void", "enableCookieBasedMatching", "(", "String", "cookieMatchDomain", ",", "int", "delay", ")", "{", "cookieBasedMatchDomain_", "=", "cookieMatchDomain", ";", "BranchStrongMatchHelper", ".", "getInstance", "(", ")", ".", "setStrongMatchUrlHitDelay", "(", "delay", ")", ";", "}" ]
<p> Enabled Strong matching check using chrome cookies. This method should be called before Branch#getAutoInstance(Context).</p> @param cookieMatchDomain The domain for the url used to match the cookie (eg. example.app.link) @param delay Time in millisecond to wait for the strong match to check to finish before Branch init session is called. Default time is 750 msec.
[ "<p", ">", "Enabled", "Strong", "matching", "check", "using", "chrome", "cookies", ".", "This", "method", "should", "be", "called", "before", "Branch#getAutoInstance", "(", "Context", ")", ".", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/Branch.java#L1458-L1461
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java
LogViewer.createOutputStream
private PrintStream createOutputStream() { """ The createOutputSteam method. <p> Creates or sets up (in the case of the console) the output steam that LogViewer will use to write to. @return PrintStream representing the output file or the System.out or console. """ if (outputLogFilename != null) { try { FileOutputStream fout = new FileOutputStream(outputLogFilename, false); BufferedOutputStream bos = new BufferedOutputStream(fout, 4096); // We are using a PrintStream for output to match System.out if (encoding != null) { return new PrintStream(bos, false, encoding); } else { return new PrintStream(bos, false); } } catch (IOException e) { throw new IllegalArgumentException(getLocalizedString("CWTRA0005E")); } } // No output filename specified. isSystemOut = true; if (encoding != null) { try { // Encode output before directing it into System.out return new PrintStream(System.out, false, encoding); } catch (UnsupportedEncodingException e) { // We already checked that encoding is supported } } return System.out; }
java
private PrintStream createOutputStream() { if (outputLogFilename != null) { try { FileOutputStream fout = new FileOutputStream(outputLogFilename, false); BufferedOutputStream bos = new BufferedOutputStream(fout, 4096); // We are using a PrintStream for output to match System.out if (encoding != null) { return new PrintStream(bos, false, encoding); } else { return new PrintStream(bos, false); } } catch (IOException e) { throw new IllegalArgumentException(getLocalizedString("CWTRA0005E")); } } // No output filename specified. isSystemOut = true; if (encoding != null) { try { // Encode output before directing it into System.out return new PrintStream(System.out, false, encoding); } catch (UnsupportedEncodingException e) { // We already checked that encoding is supported } } return System.out; }
[ "private", "PrintStream", "createOutputStream", "(", ")", "{", "if", "(", "outputLogFilename", "!=", "null", ")", "{", "try", "{", "FileOutputStream", "fout", "=", "new", "FileOutputStream", "(", "outputLogFilename", ",", "false", ")", ";", "BufferedOutputStream", "bos", "=", "new", "BufferedOutputStream", "(", "fout", ",", "4096", ")", ";", "// We are using a PrintStream for output to match System.out", "if", "(", "encoding", "!=", "null", ")", "{", "return", "new", "PrintStream", "(", "bos", ",", "false", ",", "encoding", ")", ";", "}", "else", "{", "return", "new", "PrintStream", "(", "bos", ",", "false", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "getLocalizedString", "(", "\"CWTRA0005E\"", ")", ")", ";", "}", "}", "// No output filename specified.", "isSystemOut", "=", "true", ";", "if", "(", "encoding", "!=", "null", ")", "{", "try", "{", "// Encode output before directing it into System.out", "return", "new", "PrintStream", "(", "System", ".", "out", ",", "false", ",", "encoding", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "// We already checked that encoding is supported", "}", "}", "return", "System", ".", "out", ";", "}" ]
The createOutputSteam method. <p> Creates or sets up (in the case of the console) the output steam that LogViewer will use to write to. @return PrintStream representing the output file or the System.out or console.
[ "The", "createOutputSteam", "method", ".", "<p", ">", "Creates", "or", "sets", "up", "(", "in", "the", "case", "of", "the", "console", ")", "the", "output", "steam", "that", "LogViewer", "will", "use", "to", "write", "to", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java#L1924-L1951
google/gson
gson/src/main/java/com/google/gson/Gson.java
Gson.toJsonTree
public JsonElement toJsonTree(Object src, Type typeOfSrc) { """ This method serializes the specified object, including those of generic types, into its equivalent representation as a tree of {@link JsonElement}s. This method must be used if the specified object is a generic type. For non-generic objects, use {@link #toJsonTree(Object)} instead. @param src the object for which JSON representation is to be created @param typeOfSrc The specific genericized type of src. You can obtain this type by using the {@link com.google.gson.reflect.TypeToken} class. For example, to get the type for {@code Collection<Foo>}, you should use: <pre> Type typeOfSrc = new TypeToken&lt;Collection&lt;Foo&gt;&gt;(){}.getType(); </pre> @return Json representation of {@code src} @since 1.4 """ JsonTreeWriter writer = new JsonTreeWriter(); toJson(src, typeOfSrc, writer); return writer.get(); }
java
public JsonElement toJsonTree(Object src, Type typeOfSrc) { JsonTreeWriter writer = new JsonTreeWriter(); toJson(src, typeOfSrc, writer); return writer.get(); }
[ "public", "JsonElement", "toJsonTree", "(", "Object", "src", ",", "Type", "typeOfSrc", ")", "{", "JsonTreeWriter", "writer", "=", "new", "JsonTreeWriter", "(", ")", ";", "toJson", "(", "src", ",", "typeOfSrc", ",", "writer", ")", ";", "return", "writer", ".", "get", "(", ")", ";", "}" ]
This method serializes the specified object, including those of generic types, into its equivalent representation as a tree of {@link JsonElement}s. This method must be used if the specified object is a generic type. For non-generic objects, use {@link #toJsonTree(Object)} instead. @param src the object for which JSON representation is to be created @param typeOfSrc The specific genericized type of src. You can obtain this type by using the {@link com.google.gson.reflect.TypeToken} class. For example, to get the type for {@code Collection<Foo>}, you should use: <pre> Type typeOfSrc = new TypeToken&lt;Collection&lt;Foo&gt;&gt;(){}.getType(); </pre> @return Json representation of {@code src} @since 1.4
[ "This", "method", "serializes", "the", "specified", "object", "including", "those", "of", "generic", "types", "into", "its", "equivalent", "representation", "as", "a", "tree", "of", "{", "@link", "JsonElement", "}", "s", ".", "This", "method", "must", "be", "used", "if", "the", "specified", "object", "is", "a", "generic", "type", ".", "For", "non", "-", "generic", "objects", "use", "{", "@link", "#toJsonTree", "(", "Object", ")", "}", "instead", "." ]
train
https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/gson/src/main/java/com/google/gson/Gson.java#L595-L599
jaxio/celerio
celerio-engine/src/main/java/com/jaxio/celerio/util/MiscUtil.java
MiscUtil.equalsIgnoreCase
public static boolean equalsIgnoreCase(String name, Iterable<String> patterns) { """ Does the given column name equals ignore case with one of pattern given in parameter @param name the column @param patterns table of patterns as strings @return true if the column name equals ignore case with one of the given patterns, false otherwise """ for (String pattern : patterns) { if (name.equalsIgnoreCase(pattern)) { return true; } } return false; }
java
public static boolean equalsIgnoreCase(String name, Iterable<String> patterns) { for (String pattern : patterns) { if (name.equalsIgnoreCase(pattern)) { return true; } } return false; }
[ "public", "static", "boolean", "equalsIgnoreCase", "(", "String", "name", ",", "Iterable", "<", "String", ">", "patterns", ")", "{", "for", "(", "String", "pattern", ":", "patterns", ")", "{", "if", "(", "name", ".", "equalsIgnoreCase", "(", "pattern", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Does the given column name equals ignore case with one of pattern given in parameter @param name the column @param patterns table of patterns as strings @return true if the column name equals ignore case with one of the given patterns, false otherwise
[ "Does", "the", "given", "column", "name", "equals", "ignore", "case", "with", "one", "of", "pattern", "given", "in", "parameter" ]
train
https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/util/MiscUtil.java#L211-L219
kikinteractive/ice
ice/src/main/java/com/kik/config/ice/source/DebugDynamicConfigSource.java
DebugDynamicConfigSource.fireEvent
@Override public void fireEvent(String configName, Optional<String> valueOpt) throws ConfigException { """ A raw handle to cause this ConfigSource to be updated to the new value, emitting an event if it is different than the previous value. It is recommended to instead use {@link #set(Object)} to provide a type-safe value rather than using this method directly in tests. @param configName the string name of the configuration value to be fired @param valueOpt an Optional String value of the config value to provide to the system. Optional.empty() implies that the value has been "unset" for the purposes of this config source. """ if (!subjectMap.containsKey(configName)) { throw new ConfigException("Unknown configName {}", configName); } emitEvent(configName, valueOpt); }
java
@Override public void fireEvent(String configName, Optional<String> valueOpt) throws ConfigException { if (!subjectMap.containsKey(configName)) { throw new ConfigException("Unknown configName {}", configName); } emitEvent(configName, valueOpt); }
[ "@", "Override", "public", "void", "fireEvent", "(", "String", "configName", ",", "Optional", "<", "String", ">", "valueOpt", ")", "throws", "ConfigException", "{", "if", "(", "!", "subjectMap", ".", "containsKey", "(", "configName", ")", ")", "{", "throw", "new", "ConfigException", "(", "\"Unknown configName {}\"", ",", "configName", ")", ";", "}", "emitEvent", "(", "configName", ",", "valueOpt", ")", ";", "}" ]
A raw handle to cause this ConfigSource to be updated to the new value, emitting an event if it is different than the previous value. It is recommended to instead use {@link #set(Object)} to provide a type-safe value rather than using this method directly in tests. @param configName the string name of the configuration value to be fired @param valueOpt an Optional String value of the config value to provide to the system. Optional.empty() implies that the value has been "unset" for the purposes of this config source.
[ "A", "raw", "handle", "to", "cause", "this", "ConfigSource", "to", "be", "updated", "to", "the", "new", "value", "emitting", "an", "event", "if", "it", "is", "different", "than", "the", "previous", "value", ".", "It", "is", "recommended", "to", "instead", "use", "{", "@link", "#set", "(", "Object", ")", "}", "to", "provide", "a", "type", "-", "safe", "value", "rather", "than", "using", "this", "method", "directly", "in", "tests", "." ]
train
https://github.com/kikinteractive/ice/blob/0c58d7bf2d9f6504892d0768d6022fcfa6df7514/ice/src/main/java/com/kik/config/ice/source/DebugDynamicConfigSource.java#L156-L163
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.credit_code_POST
public OvhMovement credit_code_POST(String inputCode) throws IOException { """ Validate a code to generate associated credit movement REST: POST /me/credit/code @param inputCode [required] Code to validate """ String qPath = "/me/credit/code"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "inputCode", inputCode); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhMovement.class); }
java
public OvhMovement credit_code_POST(String inputCode) throws IOException { String qPath = "/me/credit/code"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "inputCode", inputCode); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhMovement.class); }
[ "public", "OvhMovement", "credit_code_POST", "(", "String", "inputCode", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/credit/code\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"inputCode\"", ",", "inputCode", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhMovement", ".", "class", ")", ";", "}" ]
Validate a code to generate associated credit movement REST: POST /me/credit/code @param inputCode [required] Code to validate
[ "Validate", "a", "code", "to", "generate", "associated", "credit", "movement" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L868-L875
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java
ContentSpecParser.processSpecContents
protected ParserResults processSpecContents(ParserData parserData, final boolean processProcesses) { """ Process the contents of a content specification and parse it into a ContentSpec object. @param parserData @param processProcesses If processes should be processed to populate the relationships. @return True if the contents were processed successfully otherwise false. """ parserData.setCurrentLevel(parserData.getContentSpec().getBaseLevel()); boolean error = false; while (parserData.getLines().peek() != null) { parserData.setLineCount(parserData.getLineCount() + 1); // Process the content specification and print an error message if an error occurs try { if (!parseLine(parserData, parserData.getLines().poll(), parserData.getLineCount())) { error = true; } } catch (IndentationException e) { log.error(e.getMessage()); return new ParserResults(false, null); } } // Before validating the content specification, processes should be loaded first so that the // relationships and targets are created if (processProcesses) { for (final Process process : parserData.getProcesses()) { process.processTopics(parserData.getSpecTopics(), parserData.getTargetTopics(), topicProvider, serverSettingsProvider); } } // Setup the relationships processRelationships(parserData); return new ParserResults(!error, parserData.getContentSpec()); }
java
protected ParserResults processSpecContents(ParserData parserData, final boolean processProcesses) { parserData.setCurrentLevel(parserData.getContentSpec().getBaseLevel()); boolean error = false; while (parserData.getLines().peek() != null) { parserData.setLineCount(parserData.getLineCount() + 1); // Process the content specification and print an error message if an error occurs try { if (!parseLine(parserData, parserData.getLines().poll(), parserData.getLineCount())) { error = true; } } catch (IndentationException e) { log.error(e.getMessage()); return new ParserResults(false, null); } } // Before validating the content specification, processes should be loaded first so that the // relationships and targets are created if (processProcesses) { for (final Process process : parserData.getProcesses()) { process.processTopics(parserData.getSpecTopics(), parserData.getTargetTopics(), topicProvider, serverSettingsProvider); } } // Setup the relationships processRelationships(parserData); return new ParserResults(!error, parserData.getContentSpec()); }
[ "protected", "ParserResults", "processSpecContents", "(", "ParserData", "parserData", ",", "final", "boolean", "processProcesses", ")", "{", "parserData", ".", "setCurrentLevel", "(", "parserData", ".", "getContentSpec", "(", ")", ".", "getBaseLevel", "(", ")", ")", ";", "boolean", "error", "=", "false", ";", "while", "(", "parserData", ".", "getLines", "(", ")", ".", "peek", "(", ")", "!=", "null", ")", "{", "parserData", ".", "setLineCount", "(", "parserData", ".", "getLineCount", "(", ")", "+", "1", ")", ";", "// Process the content specification and print an error message if an error occurs", "try", "{", "if", "(", "!", "parseLine", "(", "parserData", ",", "parserData", ".", "getLines", "(", ")", ".", "poll", "(", ")", ",", "parserData", ".", "getLineCount", "(", ")", ")", ")", "{", "error", "=", "true", ";", "}", "}", "catch", "(", "IndentationException", "e", ")", "{", "log", ".", "error", "(", "e", ".", "getMessage", "(", ")", ")", ";", "return", "new", "ParserResults", "(", "false", ",", "null", ")", ";", "}", "}", "// Before validating the content specification, processes should be loaded first so that the", "// relationships and targets are created", "if", "(", "processProcesses", ")", "{", "for", "(", "final", "Process", "process", ":", "parserData", ".", "getProcesses", "(", ")", ")", "{", "process", ".", "processTopics", "(", "parserData", ".", "getSpecTopics", "(", ")", ",", "parserData", ".", "getTargetTopics", "(", ")", ",", "topicProvider", ",", "serverSettingsProvider", ")", ";", "}", "}", "// Setup the relationships", "processRelationships", "(", "parserData", ")", ";", "return", "new", "ParserResults", "(", "!", "error", ",", "parserData", ".", "getContentSpec", "(", ")", ")", ";", "}" ]
Process the contents of a content specification and parse it into a ContentSpec object. @param parserData @param processProcesses If processes should be processed to populate the relationships. @return True if the contents were processed successfully otherwise false.
[ "Process", "the", "contents", "of", "a", "content", "specification", "and", "parse", "it", "into", "a", "ContentSpec", "object", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L375-L403
elki-project/elki
addons/3dpc/src/main/java/de/lmu/ifi/dbs/elki/visualization/parallel3d/layout/AbstractLayout3DPC.java
AbstractLayout3DPC.buildSpanningTree
protected N buildSpanningTree(int dim, double[] mat, Layout layout) { """ Build the minimum spanning tree. @param mat Similarity matrix @param layout Layout to write to @return Root node id """ assert (layout.edges == null || layout.edges.size() == 0); int[] iedges = PrimsMinimumSpanningTree.processDense(mat, new LowerTriangularAdapter(dim)); int root = findOptimalRoot(iedges); // Convert edges: ArrayList<Edge> edges = new ArrayList<>(iedges.length >> 1); for(int i = 1; i < iedges.length; i += 2) { edges.add(new Edge(iedges[i - 1], iedges[i])); } layout.edges = edges; // Prefill nodes array with nulls. ArrayList<N> nodes = new ArrayList<>(dim); for(int i = 0; i < dim; i++) { nodes.add(null); } layout.nodes = nodes; N rootnode = buildTree(iedges, root, -1, nodes); return rootnode; }
java
protected N buildSpanningTree(int dim, double[] mat, Layout layout) { assert (layout.edges == null || layout.edges.size() == 0); int[] iedges = PrimsMinimumSpanningTree.processDense(mat, new LowerTriangularAdapter(dim)); int root = findOptimalRoot(iedges); // Convert edges: ArrayList<Edge> edges = new ArrayList<>(iedges.length >> 1); for(int i = 1; i < iedges.length; i += 2) { edges.add(new Edge(iedges[i - 1], iedges[i])); } layout.edges = edges; // Prefill nodes array with nulls. ArrayList<N> nodes = new ArrayList<>(dim); for(int i = 0; i < dim; i++) { nodes.add(null); } layout.nodes = nodes; N rootnode = buildTree(iedges, root, -1, nodes); return rootnode; }
[ "protected", "N", "buildSpanningTree", "(", "int", "dim", ",", "double", "[", "]", "mat", ",", "Layout", "layout", ")", "{", "assert", "(", "layout", ".", "edges", "==", "null", "||", "layout", ".", "edges", ".", "size", "(", ")", "==", "0", ")", ";", "int", "[", "]", "iedges", "=", "PrimsMinimumSpanningTree", ".", "processDense", "(", "mat", ",", "new", "LowerTriangularAdapter", "(", "dim", ")", ")", ";", "int", "root", "=", "findOptimalRoot", "(", "iedges", ")", ";", "// Convert edges:", "ArrayList", "<", "Edge", ">", "edges", "=", "new", "ArrayList", "<>", "(", "iedges", ".", "length", ">>", "1", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "iedges", ".", "length", ";", "i", "+=", "2", ")", "{", "edges", ".", "add", "(", "new", "Edge", "(", "iedges", "[", "i", "-", "1", "]", ",", "iedges", "[", "i", "]", ")", ")", ";", "}", "layout", ".", "edges", "=", "edges", ";", "// Prefill nodes array with nulls.", "ArrayList", "<", "N", ">", "nodes", "=", "new", "ArrayList", "<>", "(", "dim", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dim", ";", "i", "++", ")", "{", "nodes", ".", "add", "(", "null", ")", ";", "}", "layout", ".", "nodes", "=", "nodes", ";", "N", "rootnode", "=", "buildTree", "(", "iedges", ",", "root", ",", "-", "1", ",", "nodes", ")", ";", "return", "rootnode", ";", "}" ]
Build the minimum spanning tree. @param mat Similarity matrix @param layout Layout to write to @return Root node id
[ "Build", "the", "minimum", "spanning", "tree", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/3dpc/src/main/java/de/lmu/ifi/dbs/elki/visualization/parallel3d/layout/AbstractLayout3DPC.java#L133-L154
pac4j/pac4j
pac4j-saml/src/main/java/org/pac4j/saml/config/SAML2Configuration.java
SAML2Configuration.createSelfSignedCert
private X509Certificate createSelfSignedCert(X500Name dn, String sigName, AlgorithmIdentifier sigAlgID, KeyPair keyPair) throws Exception { """ Generate a self-signed certificate for dn using the provided signature algorithm and key pair. @param dn X.500 name to associate with certificate issuer/subject. @param sigName name of the signature algorithm to use. @param sigAlgID algorithm ID associated with the signature algorithm name. @param keyPair the key pair to associate with the certificate. @return an X509Certificate containing the public key in keyPair. @throws Exception """ final V3TBSCertificateGenerator certGen = new V3TBSCertificateGenerator(); certGen.setSerialNumber(new ASN1Integer(BigInteger.valueOf(1))); certGen.setIssuer(dn); certGen.setSubject(dn); certGen.setStartDate(new Time(new Date(System.currentTimeMillis() - 1000L))); final Calendar c = Calendar.getInstance(); c.setTime(new Date()); c.add(Calendar.YEAR, 1); certGen.setEndDate(new Time(c.getTime())); certGen.setSignature(sigAlgID); certGen.setSubjectPublicKeyInfo(SubjectPublicKeyInfo.getInstance(keyPair.getPublic().getEncoded())); Signature sig = Signature.getInstance(sigName); sig.initSign(keyPair.getPrivate()); sig.update(certGen.generateTBSCertificate().getEncoded(ASN1Encoding.DER)); TBSCertificate tbsCert = certGen.generateTBSCertificate(); ASN1EncodableVector v = new ASN1EncodableVector(); v.add(tbsCert); v.add(sigAlgID); v.add(new DERBitString(sig.sign())); final X509Certificate cert = (X509Certificate) CertificateFactory.getInstance("X.509") .generateCertificate(new ByteArrayInputStream(new DERSequence(v).getEncoded(ASN1Encoding.DER))); // check the certificate - this will confirm the encoded sig algorithm ID is correct. cert.verify(keyPair.getPublic()); return cert; }
java
private X509Certificate createSelfSignedCert(X500Name dn, String sigName, AlgorithmIdentifier sigAlgID, KeyPair keyPair) throws Exception { final V3TBSCertificateGenerator certGen = new V3TBSCertificateGenerator(); certGen.setSerialNumber(new ASN1Integer(BigInteger.valueOf(1))); certGen.setIssuer(dn); certGen.setSubject(dn); certGen.setStartDate(new Time(new Date(System.currentTimeMillis() - 1000L))); final Calendar c = Calendar.getInstance(); c.setTime(new Date()); c.add(Calendar.YEAR, 1); certGen.setEndDate(new Time(c.getTime())); certGen.setSignature(sigAlgID); certGen.setSubjectPublicKeyInfo(SubjectPublicKeyInfo.getInstance(keyPair.getPublic().getEncoded())); Signature sig = Signature.getInstance(sigName); sig.initSign(keyPair.getPrivate()); sig.update(certGen.generateTBSCertificate().getEncoded(ASN1Encoding.DER)); TBSCertificate tbsCert = certGen.generateTBSCertificate(); ASN1EncodableVector v = new ASN1EncodableVector(); v.add(tbsCert); v.add(sigAlgID); v.add(new DERBitString(sig.sign())); final X509Certificate cert = (X509Certificate) CertificateFactory.getInstance("X.509") .generateCertificate(new ByteArrayInputStream(new DERSequence(v).getEncoded(ASN1Encoding.DER))); // check the certificate - this will confirm the encoded sig algorithm ID is correct. cert.verify(keyPair.getPublic()); return cert; }
[ "private", "X509Certificate", "createSelfSignedCert", "(", "X500Name", "dn", ",", "String", "sigName", ",", "AlgorithmIdentifier", "sigAlgID", ",", "KeyPair", "keyPair", ")", "throws", "Exception", "{", "final", "V3TBSCertificateGenerator", "certGen", "=", "new", "V3TBSCertificateGenerator", "(", ")", ";", "certGen", ".", "setSerialNumber", "(", "new", "ASN1Integer", "(", "BigInteger", ".", "valueOf", "(", "1", ")", ")", ")", ";", "certGen", ".", "setIssuer", "(", "dn", ")", ";", "certGen", ".", "setSubject", "(", "dn", ")", ";", "certGen", ".", "setStartDate", "(", "new", "Time", "(", "new", "Date", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "1000L", ")", ")", ")", ";", "final", "Calendar", "c", "=", "Calendar", ".", "getInstance", "(", ")", ";", "c", ".", "setTime", "(", "new", "Date", "(", ")", ")", ";", "c", ".", "add", "(", "Calendar", ".", "YEAR", ",", "1", ")", ";", "certGen", ".", "setEndDate", "(", "new", "Time", "(", "c", ".", "getTime", "(", ")", ")", ")", ";", "certGen", ".", "setSignature", "(", "sigAlgID", ")", ";", "certGen", ".", "setSubjectPublicKeyInfo", "(", "SubjectPublicKeyInfo", ".", "getInstance", "(", "keyPair", ".", "getPublic", "(", ")", ".", "getEncoded", "(", ")", ")", ")", ";", "Signature", "sig", "=", "Signature", ".", "getInstance", "(", "sigName", ")", ";", "sig", ".", "initSign", "(", "keyPair", ".", "getPrivate", "(", ")", ")", ";", "sig", ".", "update", "(", "certGen", ".", "generateTBSCertificate", "(", ")", ".", "getEncoded", "(", "ASN1Encoding", ".", "DER", ")", ")", ";", "TBSCertificate", "tbsCert", "=", "certGen", ".", "generateTBSCertificate", "(", ")", ";", "ASN1EncodableVector", "v", "=", "new", "ASN1EncodableVector", "(", ")", ";", "v", ".", "add", "(", "tbsCert", ")", ";", "v", ".", "add", "(", "sigAlgID", ")", ";", "v", ".", "add", "(", "new", "DERBitString", "(", "sig", ".", "sign", "(", ")", ")", ")", ";", "final", "X509Certificate", "cert", "=", "(", "X509Certificate", ")", "CertificateFactory", ".", "getInstance", "(", "\"X.509\"", ")", ".", "generateCertificate", "(", "new", "ByteArrayInputStream", "(", "new", "DERSequence", "(", "v", ")", ".", "getEncoded", "(", "ASN1Encoding", ".", "DER", ")", ")", ")", ";", "// check the certificate - this will confirm the encoded sig algorithm ID is correct.", "cert", ".", "verify", "(", "keyPair", ".", "getPublic", "(", ")", ")", ";", "return", "cert", ";", "}" ]
Generate a self-signed certificate for dn using the provided signature algorithm and key pair. @param dn X.500 name to associate with certificate issuer/subject. @param sigName name of the signature algorithm to use. @param sigAlgID algorithm ID associated with the signature algorithm name. @param keyPair the key pair to associate with the certificate. @return an X509Certificate containing the public key in keyPair. @throws Exception
[ "Generate", "a", "self", "-", "signed", "certificate", "for", "dn", "using", "the", "provided", "signature", "algorithm", "and", "key", "pair", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-saml/src/main/java/org/pac4j/saml/config/SAML2Configuration.java#L621-L660
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
HttpContext.logResponse
private void logResponse(URI uri, Response response) { """ Log a HTTP error response. @param uri The URI used for the HTTP call @param response The HTTP call response """ if(logger.isLoggable(Level.FINE)) logger.fine(uri.toString()+" => "+response.getStatus()); if(response.getStatus() > 300) logger.warning(response.toString()); }
java
private void logResponse(URI uri, Response response) { if(logger.isLoggable(Level.FINE)) logger.fine(uri.toString()+" => "+response.getStatus()); if(response.getStatus() > 300) logger.warning(response.toString()); }
[ "private", "void", "logResponse", "(", "URI", "uri", ",", "Response", "response", ")", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "logger", ".", "fine", "(", "uri", ".", "toString", "(", ")", "+", "\" => \"", "+", "response", ".", "getStatus", "(", ")", ")", ";", "if", "(", "response", ".", "getStatus", "(", ")", ">", "300", ")", "logger", ".", "warning", "(", "response", ".", "toString", "(", ")", ")", ";", "}" ]
Log a HTTP error response. @param uri The URI used for the HTTP call @param response The HTTP call response
[ "Log", "a", "HTTP", "error", "response", "." ]
train
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L608-L614
Coveros/selenified
src/main/java/com/coveros/selenified/application/Assert.java
Assert.cookieEquals
@Override public void cookieEquals(String cookieName, String expectedCookieValue) { """ Asserts that a cookies with the provided name has a value equal to the expected value. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param cookieName the name of the cookie @param expectedCookieValue the expected value of the cookie """ assertEquals("Cookie Value Mismatch", expectedCookieValue, checkCookieEquals(cookieName, expectedCookieValue, 0, 0)); }
java
@Override public void cookieEquals(String cookieName, String expectedCookieValue) { assertEquals("Cookie Value Mismatch", expectedCookieValue, checkCookieEquals(cookieName, expectedCookieValue, 0, 0)); }
[ "@", "Override", "public", "void", "cookieEquals", "(", "String", "cookieName", ",", "String", "expectedCookieValue", ")", "{", "assertEquals", "(", "\"Cookie Value Mismatch\"", ",", "expectedCookieValue", ",", "checkCookieEquals", "(", "cookieName", ",", "expectedCookieValue", ",", "0", ",", "0", ")", ")", ";", "}" ]
Asserts that a cookies with the provided name has a value equal to the expected value. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param cookieName the name of the cookie @param expectedCookieValue the expected value of the cookie
[ "Asserts", "that", "a", "cookies", "with", "the", "provided", "name", "has", "a", "value", "equal", "to", "the", "expected", "value", ".", "This", "information", "will", "be", "logged", "and", "recorded", "with", "a", "screenshot", "for", "traceability", "and", "added", "debugging", "support", "." ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/Assert.java#L315-L318
lucee/Lucee
core/src/main/java/lucee/runtime/ext/tag/TagImpl.java
TagImpl.required
public void required(String tagName, String actionName, String attributeName, Object attribute) throws ApplicationException { """ check if value is not empty @param tagName @param attributeName @param attribute @throws ApplicationException """ if (attribute == null) throw new ApplicationException("Attribute [" + attributeName + "] for tag [" + tagName + "] is required if attribute action has the value [" + actionName + "]"); }
java
public void required(String tagName, String actionName, String attributeName, Object attribute) throws ApplicationException { if (attribute == null) throw new ApplicationException("Attribute [" + attributeName + "] for tag [" + tagName + "] is required if attribute action has the value [" + actionName + "]"); }
[ "public", "void", "required", "(", "String", "tagName", ",", "String", "actionName", ",", "String", "attributeName", ",", "Object", "attribute", ")", "throws", "ApplicationException", "{", "if", "(", "attribute", "==", "null", ")", "throw", "new", "ApplicationException", "(", "\"Attribute [\"", "+", "attributeName", "+", "\"] for tag [\"", "+", "tagName", "+", "\"] is required if attribute action has the value [\"", "+", "actionName", "+", "\"]\"", ")", ";", "}" ]
check if value is not empty @param tagName @param attributeName @param attribute @throws ApplicationException
[ "check", "if", "value", "is", "not", "empty" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ext/tag/TagImpl.java#L89-L93
flow/commons
src/main/java/com/flowpowered/commons/store/block/impl/AtomicShortIntArray.java
AtomicShortIntArray.compareAndSet
public boolean compareAndSet(int i, int expect, int update) { """ Sets the element at the given index, but only if the previous value was the expected value. @param i the index @param expect the expected value @param update the new value @return true on success """ while (true) { try { updateLock.lock(); try { return store.get().compareAndSet(i, expect, update); } finally { updateLock.unlock(); } } catch (PaletteFullException pfe) { resizeLock.lock(); try { if (store.get().isPaletteMaxSize()) { store.set(new AtomicShortIntDirectBackingArray(store.get())); } else { store.set(new AtomicShortIntPaletteBackingArray(store.get(), true)); } } finally { resizeLock.unlock(); } } } }
java
public boolean compareAndSet(int i, int expect, int update) { while (true) { try { updateLock.lock(); try { return store.get().compareAndSet(i, expect, update); } finally { updateLock.unlock(); } } catch (PaletteFullException pfe) { resizeLock.lock(); try { if (store.get().isPaletteMaxSize()) { store.set(new AtomicShortIntDirectBackingArray(store.get())); } else { store.set(new AtomicShortIntPaletteBackingArray(store.get(), true)); } } finally { resizeLock.unlock(); } } } }
[ "public", "boolean", "compareAndSet", "(", "int", "i", ",", "int", "expect", ",", "int", "update", ")", "{", "while", "(", "true", ")", "{", "try", "{", "updateLock", ".", "lock", "(", ")", ";", "try", "{", "return", "store", ".", "get", "(", ")", ".", "compareAndSet", "(", "i", ",", "expect", ",", "update", ")", ";", "}", "finally", "{", "updateLock", ".", "unlock", "(", ")", ";", "}", "}", "catch", "(", "PaletteFullException", "pfe", ")", "{", "resizeLock", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "store", ".", "get", "(", ")", ".", "isPaletteMaxSize", "(", ")", ")", "{", "store", ".", "set", "(", "new", "AtomicShortIntDirectBackingArray", "(", "store", ".", "get", "(", ")", ")", ")", ";", "}", "else", "{", "store", ".", "set", "(", "new", "AtomicShortIntPaletteBackingArray", "(", "store", ".", "get", "(", ")", ",", "true", ")", ")", ";", "}", "}", "finally", "{", "resizeLock", ".", "unlock", "(", ")", ";", "}", "}", "}", "}" ]
Sets the element at the given index, but only if the previous value was the expected value. @param i the index @param expect the expected value @param update the new value @return true on success
[ "Sets", "the", "element", "at", "the", "given", "index", "but", "only", "if", "the", "previous", "value", "was", "the", "expected", "value", "." ]
train
https://github.com/flow/commons/blob/0690efdac06fd728fcd7e9cf10f2b1319379c45b/src/main/java/com/flowpowered/commons/store/block/impl/AtomicShortIntArray.java#L211-L233
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectCalendar.java
ProjectCalendar.getTime
private long getTime(Date start1, Date end1, Date start2, Date end2) { """ This method returns the length of overlapping time between two time ranges. @param start1 start of first range @param end1 end of first range @param start2 start start of second range @param end2 end of second range @return overlapping time in milliseconds """ long total = 0; if (start1 != null && end1 != null && start2 != null && end2 != null) { long start; long end; if (start1.getTime() < start2.getTime()) { start = start2.getTime(); } else { start = start1.getTime(); } if (end1.getTime() < end2.getTime()) { end = end1.getTime(); } else { end = end2.getTime(); } if (start < end) { total = end - start; } } return (total); }
java
private long getTime(Date start1, Date end1, Date start2, Date end2) { long total = 0; if (start1 != null && end1 != null && start2 != null && end2 != null) { long start; long end; if (start1.getTime() < start2.getTime()) { start = start2.getTime(); } else { start = start1.getTime(); } if (end1.getTime() < end2.getTime()) { end = end1.getTime(); } else { end = end2.getTime(); } if (start < end) { total = end - start; } } return (total); }
[ "private", "long", "getTime", "(", "Date", "start1", ",", "Date", "end1", ",", "Date", "start2", ",", "Date", "end2", ")", "{", "long", "total", "=", "0", ";", "if", "(", "start1", "!=", "null", "&&", "end1", "!=", "null", "&&", "start2", "!=", "null", "&&", "end2", "!=", "null", ")", "{", "long", "start", ";", "long", "end", ";", "if", "(", "start1", ".", "getTime", "(", ")", "<", "start2", ".", "getTime", "(", ")", ")", "{", "start", "=", "start2", ".", "getTime", "(", ")", ";", "}", "else", "{", "start", "=", "start1", ".", "getTime", "(", ")", ";", "}", "if", "(", "end1", ".", "getTime", "(", ")", "<", "end2", ".", "getTime", "(", ")", ")", "{", "end", "=", "end1", ".", "getTime", "(", ")", ";", "}", "else", "{", "end", "=", "end2", ".", "getTime", "(", ")", ";", "}", "if", "(", "start", "<", "end", ")", "{", "total", "=", "end", "-", "start", ";", "}", "}", "return", "(", "total", ")", ";", "}" ]
This method returns the length of overlapping time between two time ranges. @param start1 start of first range @param end1 end of first range @param start2 start start of second range @param end2 end of second range @return overlapping time in milliseconds
[ "This", "method", "returns", "the", "length", "of", "overlapping", "time", "between", "two", "time", "ranges", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L1601-L1635
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/RTMPHandler.java
RTMPHandler.sendSOCreationFailed
private void sendSOCreationFailed(RTMPConnection conn, SharedObjectMessage message) { """ Create and send SO message stating that a SO could not be created. @param conn @param message Shared object message that incurred the failure """ log.debug("sendSOCreationFailed - message: {} conn: {}", message, conn); // reset the object so we can re-use it message.reset(); // add the error event message.addEvent(new SharedObjectEvent(ISharedObjectEvent.Type.CLIENT_STATUS, "error", SO_CREATION_FAILED)); if (conn.isChannelUsed(3)) { // XXX Paul: I dont like this direct write stuff, need to move to event-based conn.getChannel(3).write(message); } else { log.warn("Channel is not in-use and cannot handle SO event: {}", message, new Exception("SO event handling failure")); // XXX Paul: I dont like this direct write stuff, need to move to event-based conn.getChannel(3).write(message); } }
java
private void sendSOCreationFailed(RTMPConnection conn, SharedObjectMessage message) { log.debug("sendSOCreationFailed - message: {} conn: {}", message, conn); // reset the object so we can re-use it message.reset(); // add the error event message.addEvent(new SharedObjectEvent(ISharedObjectEvent.Type.CLIENT_STATUS, "error", SO_CREATION_FAILED)); if (conn.isChannelUsed(3)) { // XXX Paul: I dont like this direct write stuff, need to move to event-based conn.getChannel(3).write(message); } else { log.warn("Channel is not in-use and cannot handle SO event: {}", message, new Exception("SO event handling failure")); // XXX Paul: I dont like this direct write stuff, need to move to event-based conn.getChannel(3).write(message); } }
[ "private", "void", "sendSOCreationFailed", "(", "RTMPConnection", "conn", ",", "SharedObjectMessage", "message", ")", "{", "log", ".", "debug", "(", "\"sendSOCreationFailed - message: {} conn: {}\"", ",", "message", ",", "conn", ")", ";", "// reset the object so we can re-use it\r", "message", ".", "reset", "(", ")", ";", "// add the error event\r", "message", ".", "addEvent", "(", "new", "SharedObjectEvent", "(", "ISharedObjectEvent", ".", "Type", ".", "CLIENT_STATUS", ",", "\"error\"", ",", "SO_CREATION_FAILED", ")", ")", ";", "if", "(", "conn", ".", "isChannelUsed", "(", "3", ")", ")", "{", "// XXX Paul: I dont like this direct write stuff, need to move to event-based\r", "conn", ".", "getChannel", "(", "3", ")", ".", "write", "(", "message", ")", ";", "}", "else", "{", "log", ".", "warn", "(", "\"Channel is not in-use and cannot handle SO event: {}\"", ",", "message", ",", "new", "Exception", "(", "\"SO event handling failure\"", ")", ")", ";", "// XXX Paul: I dont like this direct write stuff, need to move to event-based\r", "conn", ".", "getChannel", "(", "3", ")", ".", "write", "(", "message", ")", ";", "}", "}" ]
Create and send SO message stating that a SO could not be created. @param conn @param message Shared object message that incurred the failure
[ "Create", "and", "send", "SO", "message", "stating", "that", "a", "SO", "could", "not", "be", "created", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandler.java#L547-L561
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/ServiceManagementRecord.java
ServiceManagementRecord.isServiceEnabled
public static boolean isServiceEnabled(EntityManager em, Service service) { """ Determine a given service's enability. @param em The EntityManager to use. @param service The service for which to determine enability. @return True or false depending on whether the service is enabled or disabled. """ ServiceManagementRecord record = findServiceManagementRecord(em, service); return record == null ? true : record.isEnabled(); }
java
public static boolean isServiceEnabled(EntityManager em, Service service) { ServiceManagementRecord record = findServiceManagementRecord(em, service); return record == null ? true : record.isEnabled(); }
[ "public", "static", "boolean", "isServiceEnabled", "(", "EntityManager", "em", ",", "Service", "service", ")", "{", "ServiceManagementRecord", "record", "=", "findServiceManagementRecord", "(", "em", ",", "service", ")", ";", "return", "record", "==", "null", "?", "true", ":", "record", ".", "isEnabled", "(", ")", ";", "}" ]
Determine a given service's enability. @param em The EntityManager to use. @param service The service for which to determine enability. @return True or false depending on whether the service is enabled or disabled.
[ "Determine", "a", "given", "service", "s", "enability", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/ServiceManagementRecord.java#L139-L143
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java
AbstractJsonDeserializer.getStringParam
protected String getStringParam(String paramName, String errorMessage) throws IOException { """ Convenience method for subclasses. Uses the default map for parameterinput @param paramName the name of the parameter @param errorMessage the errormessage to add to the exception if the param does not exist. @return a stringparameter with given name. If it does not exist and the errormessage is provided, an IOException is thrown with that message. if the errormessage is not provided, null is returned. @throws IOException Exception if the paramname does not exist and an errormessage is provided. """ return getStringParam(paramName, errorMessage, (Map<String, Object>) inputParams.get()); }
java
protected String getStringParam(String paramName, String errorMessage) throws IOException { return getStringParam(paramName, errorMessage, (Map<String, Object>) inputParams.get()); }
[ "protected", "String", "getStringParam", "(", "String", "paramName", ",", "String", "errorMessage", ")", "throws", "IOException", "{", "return", "getStringParam", "(", "paramName", ",", "errorMessage", ",", "(", "Map", "<", "String", ",", "Object", ">", ")", "inputParams", ".", "get", "(", ")", ")", ";", "}" ]
Convenience method for subclasses. Uses the default map for parameterinput @param paramName the name of the parameter @param errorMessage the errormessage to add to the exception if the param does not exist. @return a stringparameter with given name. If it does not exist and the errormessage is provided, an IOException is thrown with that message. if the errormessage is not provided, null is returned. @throws IOException Exception if the paramname does not exist and an errormessage is provided.
[ "Convenience", "method", "for", "subclasses", ".", "Uses", "the", "default", "map", "for", "parameterinput" ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java#L110-L113
alkacon/opencms-core
src/org/opencms/xml/A_CmsXmlDocument.java
A_CmsXmlDocument.getBookmarkName
protected static final String getBookmarkName(String name, Locale locale) { """ Creates the bookmark name for a localized element to be used in the bookmark lookup table.<p> @param name the element name @param locale the element locale @return the bookmark name for a localized element """ StringBuffer result = new StringBuffer(64); result.append('/'); result.append(locale.toString()); result.append('/'); result.append(name); return result.toString(); }
java
protected static final String getBookmarkName(String name, Locale locale) { StringBuffer result = new StringBuffer(64); result.append('/'); result.append(locale.toString()); result.append('/'); result.append(name); return result.toString(); }
[ "protected", "static", "final", "String", "getBookmarkName", "(", "String", "name", ",", "Locale", "locale", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "64", ")", ";", "result", ".", "append", "(", "'", "'", ")", ";", "result", ".", "append", "(", "locale", ".", "toString", "(", ")", ")", ";", "result", ".", "append", "(", "'", "'", ")", ";", "result", ".", "append", "(", "name", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Creates the bookmark name for a localized element to be used in the bookmark lookup table.<p> @param name the element name @param locale the element locale @return the bookmark name for a localized element
[ "Creates", "the", "bookmark", "name", "for", "a", "localized", "element", "to", "be", "used", "in", "the", "bookmark", "lookup", "table", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/A_CmsXmlDocument.java#L108-L116
Stratio/stratio-cassandra
src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
SelectStatement.addEOC
private static Composite addEOC(Composite composite, Bound eocBound) { """ Adds an EOC to the specified Composite. @param composite the composite @param eocBound the EOC bound @return a new <code>Composite</code> with the EOC corresponding to the eocBound """ return eocBound == Bound.END ? composite.end() : composite.start(); }
java
private static Composite addEOC(Composite composite, Bound eocBound) { return eocBound == Bound.END ? composite.end() : composite.start(); }
[ "private", "static", "Composite", "addEOC", "(", "Composite", "composite", ",", "Bound", "eocBound", ")", "{", "return", "eocBound", "==", "Bound", ".", "END", "?", "composite", ".", "end", "(", ")", ":", "composite", ".", "start", "(", ")", ";", "}" ]
Adds an EOC to the specified Composite. @param composite the composite @param eocBound the EOC bound @return a new <code>Composite</code> with the EOC corresponding to the eocBound
[ "Adds", "an", "EOC", "to", "the", "specified", "Composite", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java#L979-L982
Coveros/selenified
src/main/java/com/coveros/selenified/Selenified.java
Selenified.getAuthor
private String getAuthor(String clazz, ITestContext context) { """ Obtains the author of the current test suite being executed. If no author was set, null will be returned @param clazz - the test suite class, used for making threadsafe storage of application, allowing suites to have independent applications under test, run at the same time @param context - the TestNG context associated with the test suite, used for storing app url information @return String: the author of the current test being executed """ return (String) context.getAttribute(clazz + "Author"); }
java
private String getAuthor(String clazz, ITestContext context) { return (String) context.getAttribute(clazz + "Author"); }
[ "private", "String", "getAuthor", "(", "String", "clazz", ",", "ITestContext", "context", ")", "{", "return", "(", "String", ")", "context", ".", "getAttribute", "(", "clazz", "+", "\"Author\"", ")", ";", "}" ]
Obtains the author of the current test suite being executed. If no author was set, null will be returned @param clazz - the test suite class, used for making threadsafe storage of application, allowing suites to have independent applications under test, run at the same time @param context - the TestNG context associated with the test suite, used for storing app url information @return String: the author of the current test being executed
[ "Obtains", "the", "author", "of", "the", "current", "test", "suite", "being", "executed", ".", "If", "no", "author", "was", "set", "null", "will", "be", "returned" ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/Selenified.java#L150-L152
strator-dev/greenpepper
greenpepper/core/src/main/java/com/greenpepper/interpreter/collection/CollectionInterpreter.java
CollectionInterpreter.addSurplusRow
protected void addSurplusRow( Example example, Example headers, Fixture rowFixtureAdapter) { """ <p>addSurplusRow.</p> @param example a {@link com.greenpepper.Example} object. @param headers a {@link com.greenpepper.Example} object. @param rowFixtureAdapter a {@link com.greenpepper.reflect.Fixture} object. """ Example row = example.addSibling(); for (int i = 0; i < headers.remainings(); i++) { ExpectedColumn column = (ExpectedColumn) columns[i]; Example cell = row.addChild(); try { Call call = new Call( rowFixtureAdapter.check( column.header() ) ); Object actual = call.execute(); cell.setContent( TypeConversion.toString(actual)); cell.annotate( Annotations.surplus() ); if (i == 0) // Notify test listener on first cell only { stats.wrong(); } } catch (Exception e) { // TODO: STATS count stats? cell.annotate( ignored( e ) ); } } }
java
protected void addSurplusRow( Example example, Example headers, Fixture rowFixtureAdapter) { Example row = example.addSibling(); for (int i = 0; i < headers.remainings(); i++) { ExpectedColumn column = (ExpectedColumn) columns[i]; Example cell = row.addChild(); try { Call call = new Call( rowFixtureAdapter.check( column.header() ) ); Object actual = call.execute(); cell.setContent( TypeConversion.toString(actual)); cell.annotate( Annotations.surplus() ); if (i == 0) // Notify test listener on first cell only { stats.wrong(); } } catch (Exception e) { // TODO: STATS count stats? cell.annotate( ignored( e ) ); } } }
[ "protected", "void", "addSurplusRow", "(", "Example", "example", ",", "Example", "headers", ",", "Fixture", "rowFixtureAdapter", ")", "{", "Example", "row", "=", "example", ".", "addSibling", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "headers", ".", "remainings", "(", ")", ";", "i", "++", ")", "{", "ExpectedColumn", "column", "=", "(", "ExpectedColumn", ")", "columns", "[", "i", "]", ";", "Example", "cell", "=", "row", ".", "addChild", "(", ")", ";", "try", "{", "Call", "call", "=", "new", "Call", "(", "rowFixtureAdapter", ".", "check", "(", "column", ".", "header", "(", ")", ")", ")", ";", "Object", "actual", "=", "call", ".", "execute", "(", ")", ";", "cell", ".", "setContent", "(", "TypeConversion", ".", "toString", "(", "actual", ")", ")", ";", "cell", ".", "annotate", "(", "Annotations", ".", "surplus", "(", ")", ")", ";", "if", "(", "i", "==", "0", ")", "// Notify test listener on first cell only", "{", "stats", ".", "wrong", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "// TODO: STATS count stats?", "cell", ".", "annotate", "(", "ignored", "(", "e", ")", ")", ";", "}", "}", "}" ]
<p>addSurplusRow.</p> @param example a {@link com.greenpepper.Example} object. @param headers a {@link com.greenpepper.Example} object. @param rowFixtureAdapter a {@link com.greenpepper.reflect.Fixture} object.
[ "<p", ">", "addSurplusRow", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/interpreter/collection/CollectionInterpreter.java#L158-L185
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.updateSubscriptionPreview
public Subscription updateSubscriptionPreview(final String uuid, final SubscriptionUpdate subscriptionUpdate) { """ Preview an update to a particular {@link Subscription} by it's UUID <p> Returns information about a single subscription. @param uuid UUID of the subscription to preview an update for @return Subscription the updated subscription preview """ return doPOST(Subscriptions.SUBSCRIPTIONS_RESOURCE + "/" + uuid + "/preview", subscriptionUpdate, Subscription.class); }
java
public Subscription updateSubscriptionPreview(final String uuid, final SubscriptionUpdate subscriptionUpdate) { return doPOST(Subscriptions.SUBSCRIPTIONS_RESOURCE + "/" + uuid + "/preview", subscriptionUpdate, Subscription.class); }
[ "public", "Subscription", "updateSubscriptionPreview", "(", "final", "String", "uuid", ",", "final", "SubscriptionUpdate", "subscriptionUpdate", ")", "{", "return", "doPOST", "(", "Subscriptions", ".", "SUBSCRIPTIONS_RESOURCE", "+", "\"/\"", "+", "uuid", "+", "\"/preview\"", ",", "subscriptionUpdate", ",", "Subscription", ".", "class", ")", ";", "}" ]
Preview an update to a particular {@link Subscription} by it's UUID <p> Returns information about a single subscription. @param uuid UUID of the subscription to preview an update for @return Subscription the updated subscription preview
[ "Preview", "an", "update", "to", "a", "particular", "{", "@link", "Subscription", "}", "by", "it", "s", "UUID", "<p", ">", "Returns", "information", "about", "a", "single", "subscription", "." ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L603-L608
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/normalization/KerasBatchNormalization.java
KerasBatchNormalization.getMomentumFromConfig
private double getMomentumFromConfig(Map<String, Object> layerConfig) throws InvalidKerasConfigurationException { """ Get BatchNormalization momentum parameter from Keras layer configuration. @param layerConfig dictionary containing Keras layer configuration @return momentum @throws InvalidKerasConfigurationException Invalid Keras config """ Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf); if (!innerConfig.containsKey(LAYER_FIELD_MOMENTUM)) throw new InvalidKerasConfigurationException( "Keras BatchNorm layer config missing " + LAYER_FIELD_MOMENTUM + " field"); return (double) innerConfig.get(LAYER_FIELD_MOMENTUM); }
java
private double getMomentumFromConfig(Map<String, Object> layerConfig) throws InvalidKerasConfigurationException { Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf); if (!innerConfig.containsKey(LAYER_FIELD_MOMENTUM)) throw new InvalidKerasConfigurationException( "Keras BatchNorm layer config missing " + LAYER_FIELD_MOMENTUM + " field"); return (double) innerConfig.get(LAYER_FIELD_MOMENTUM); }
[ "private", "double", "getMomentumFromConfig", "(", "Map", "<", "String", ",", "Object", ">", "layerConfig", ")", "throws", "InvalidKerasConfigurationException", "{", "Map", "<", "String", ",", "Object", ">", "innerConfig", "=", "KerasLayerUtils", ".", "getInnerLayerConfigFromConfig", "(", "layerConfig", ",", "conf", ")", ";", "if", "(", "!", "innerConfig", ".", "containsKey", "(", "LAYER_FIELD_MOMENTUM", ")", ")", "throw", "new", "InvalidKerasConfigurationException", "(", "\"Keras BatchNorm layer config missing \"", "+", "LAYER_FIELD_MOMENTUM", "+", "\" field\"", ")", ";", "return", "(", "double", ")", "innerConfig", ".", "get", "(", "LAYER_FIELD_MOMENTUM", ")", ";", "}" ]
Get BatchNormalization momentum parameter from Keras layer configuration. @param layerConfig dictionary containing Keras layer configuration @return momentum @throws InvalidKerasConfigurationException Invalid Keras config
[ "Get", "BatchNormalization", "momentum", "parameter", "from", "Keras", "layer", "configuration", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/normalization/KerasBatchNormalization.java#L251-L257
loldevs/riotapi
rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java
ThrottledApiHandler.getLeagueEntries
public Future<Map<String, List<LeagueItem>>> getLeagueEntries(String... teamIds) { """ Get a listing of all league entries in the teams' leagues @param teamIds The ids of the teams @return A mapping of teamIds to lists of league entries @see <a href=https://developer.riotgames.com/api/methods#!/593/1861>Official API documentation</a> """ return new ApiFuture<>(() -> handler.getLeagueEntries(teamIds)); }
java
public Future<Map<String, List<LeagueItem>>> getLeagueEntries(String... teamIds) { return new ApiFuture<>(() -> handler.getLeagueEntries(teamIds)); }
[ "public", "Future", "<", "Map", "<", "String", ",", "List", "<", "LeagueItem", ">", ">", ">", "getLeagueEntries", "(", "String", "...", "teamIds", ")", "{", "return", "new", "ApiFuture", "<>", "(", "(", ")", "->", "handler", ".", "getLeagueEntries", "(", "teamIds", ")", ")", ";", "}" ]
Get a listing of all league entries in the teams' leagues @param teamIds The ids of the teams @return A mapping of teamIds to lists of league entries @see <a href=https://developer.riotgames.com/api/methods#!/593/1861>Official API documentation</a>
[ "Get", "a", "listing", "of", "all", "league", "entries", "in", "the", "teams", "leagues" ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L295-L297
samskivert/samskivert
src/main/java/com/samskivert/util/Queue.java
Queue.append0
protected void append0 (T item, boolean notify) { """ Internal append method. If subclassing queue, be sure to call this method from inside a synchronized block. """ if (_count == _size) { makeMoreRoom(); } _items[_end] = item; _end = (_end + 1) % _size; _count++; if (notify) { notify(); } }
java
protected void append0 (T item, boolean notify) { if (_count == _size) { makeMoreRoom(); } _items[_end] = item; _end = (_end + 1) % _size; _count++; if (notify) { notify(); } }
[ "protected", "void", "append0", "(", "T", "item", ",", "boolean", "notify", ")", "{", "if", "(", "_count", "==", "_size", ")", "{", "makeMoreRoom", "(", ")", ";", "}", "_items", "[", "_end", "]", "=", "item", ";", "_end", "=", "(", "_end", "+", "1", ")", "%", "_size", ";", "_count", "++", ";", "if", "(", "notify", ")", "{", "notify", "(", ")", ";", "}", "}" ]
Internal append method. If subclassing queue, be sure to call this method from inside a synchronized block.
[ "Internal", "append", "method", ".", "If", "subclassing", "queue", "be", "sure", "to", "call", "this", "method", "from", "inside", "a", "synchronized", "block", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Queue.java#L107-L119
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/route/RouteDispatcher.java
RouteDispatcher.onPreDispatch
protected void onPreDispatch(Request request, Response response) { """ Executes onPreDispatch of registered route pre-dispatch listeners. @param request @param response """ application.getRoutePreDispatchListeners().onPreDispatch(request, response); }
java
protected void onPreDispatch(Request request, Response response) { application.getRoutePreDispatchListeners().onPreDispatch(request, response); }
[ "protected", "void", "onPreDispatch", "(", "Request", "request", ",", "Response", "response", ")", "{", "application", ".", "getRoutePreDispatchListeners", "(", ")", ".", "onPreDispatch", "(", "request", ",", "response", ")", ";", "}" ]
Executes onPreDispatch of registered route pre-dispatch listeners. @param request @param response
[ "Executes", "onPreDispatch", "of", "registered", "route", "pre", "-", "dispatch", "listeners", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/RouteDispatcher.java#L111-L113
lucmoreau/ProvToolbox
prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java
ProvFactory.newWasInvalidatedBy
public WasInvalidatedBy newWasInvalidatedBy(QualifiedName id, QualifiedName entity, QualifiedName activity, XMLGregorianCalendar time, Collection<Attribute> attributes) { """ /* (non-Javadoc) @see org.openprovenance.prov.model.ModelConstructor#newWasInvalidatedBy(org.openprovenance.model.QualifiedName, org.openprovenance.model.QualifiedName, org.openprovenance.model.QualifiedName, javax.xml.datatype.XMLGregorianCalendar, java.util.Collection) """ WasInvalidatedBy res=newWasInvalidatedBy(id,entity,activity); res.setTime(time); setAttributes(res, attributes); return res; }
java
public WasInvalidatedBy newWasInvalidatedBy(QualifiedName id, QualifiedName entity, QualifiedName activity, XMLGregorianCalendar time, Collection<Attribute> attributes) { WasInvalidatedBy res=newWasInvalidatedBy(id,entity,activity); res.setTime(time); setAttributes(res, attributes); return res; }
[ "public", "WasInvalidatedBy", "newWasInvalidatedBy", "(", "QualifiedName", "id", ",", "QualifiedName", "entity", ",", "QualifiedName", "activity", ",", "XMLGregorianCalendar", "time", ",", "Collection", "<", "Attribute", ">", "attributes", ")", "{", "WasInvalidatedBy", "res", "=", "newWasInvalidatedBy", "(", "id", ",", "entity", ",", "activity", ")", ";", "res", ".", "setTime", "(", "time", ")", ";", "setAttributes", "(", "res", ",", "attributes", ")", ";", "return", "res", ";", "}" ]
/* (non-Javadoc) @see org.openprovenance.prov.model.ModelConstructor#newWasInvalidatedBy(org.openprovenance.model.QualifiedName, org.openprovenance.model.QualifiedName, org.openprovenance.model.QualifiedName, javax.xml.datatype.XMLGregorianCalendar, java.util.Collection)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L1470-L1475
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/cache/ObjectCacheJCSPerClassImpl.java
ObjectCacheJCSPerClassImpl.getCachePerClass
private ObjectCache getCachePerClass(Class objectClass, int methodCall) { """ Gets the cache for the given class @param objectClass The class to look up the cache for @return The cache """ ObjectCache cache = (ObjectCache) cachesByClass.get(objectClass.getName()); if (cache == null && methodCall == AbstractMetaCache.METHOD_CACHE) { /** * the cache wasn't found, and the cachesByClass didn't contain the key with a * null value, so create a new cache for this classtype */ cache = new ObjectCacheJCSImpl(objectClass.getName()); cachesByClass.put(objectClass.getName(), cache); } return cache; }
java
private ObjectCache getCachePerClass(Class objectClass, int methodCall) { ObjectCache cache = (ObjectCache) cachesByClass.get(objectClass.getName()); if (cache == null && methodCall == AbstractMetaCache.METHOD_CACHE) { /** * the cache wasn't found, and the cachesByClass didn't contain the key with a * null value, so create a new cache for this classtype */ cache = new ObjectCacheJCSImpl(objectClass.getName()); cachesByClass.put(objectClass.getName(), cache); } return cache; }
[ "private", "ObjectCache", "getCachePerClass", "(", "Class", "objectClass", ",", "int", "methodCall", ")", "{", "ObjectCache", "cache", "=", "(", "ObjectCache", ")", "cachesByClass", ".", "get", "(", "objectClass", ".", "getName", "(", ")", ")", ";", "if", "(", "cache", "==", "null", "&&", "methodCall", "==", "AbstractMetaCache", ".", "METHOD_CACHE", ")", "{", "/**\r\n * the cache wasn't found, and the cachesByClass didn't contain the key with a\r\n * null value, so create a new cache for this classtype\r\n */", "cache", "=", "new", "ObjectCacheJCSImpl", "(", "objectClass", ".", "getName", "(", ")", ")", ";", "cachesByClass", ".", "put", "(", "objectClass", ".", "getName", "(", ")", ",", "cache", ")", ";", "}", "return", "cache", ";", "}" ]
Gets the cache for the given class @param objectClass The class to look up the cache for @return The cache
[ "Gets", "the", "cache", "for", "the", "given", "class" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/cache/ObjectCacheJCSPerClassImpl.java#L108-L121
awslabs/amazon-sqs-java-messaging-lib
src/main/java/com/amazon/sqs/javamessaging/message/SQSMessage.java
SQSMessage.getPrimitiveProperty
<T> T getPrimitiveProperty(String property, Class<T> type) throws JMSException { """ Get the value for a property that represents a java primitive(e.g. int or long). @param property The name of the property to get. @param type The type of the property. @return the converted value for the property. @throws JMSException On internal error. @throws MessageFormatException If the property cannot be converted to the specified type. @throws NullPointerException and NumberFormatException when property name or value is null. Method throws same exception as primitives corresponding valueOf(String) method. """ if (property == null) { throw new NullPointerException("Property name is null"); } Object value = getObjectProperty(property); if (value == null) { return handleNullPropertyValue(property, type); } T convertedValue = TypeConversionSupport.convert(value, type); if (convertedValue == null) { throw new MessageFormatException("Property " + property + " was " + value.getClass().getName() + " and cannot be read as " + type.getName()); } return convertedValue; }
java
<T> T getPrimitiveProperty(String property, Class<T> type) throws JMSException { if (property == null) { throw new NullPointerException("Property name is null"); } Object value = getObjectProperty(property); if (value == null) { return handleNullPropertyValue(property, type); } T convertedValue = TypeConversionSupport.convert(value, type); if (convertedValue == null) { throw new MessageFormatException("Property " + property + " was " + value.getClass().getName() + " and cannot be read as " + type.getName()); } return convertedValue; }
[ "<", "T", ">", "T", "getPrimitiveProperty", "(", "String", "property", ",", "Class", "<", "T", ">", "type", ")", "throws", "JMSException", "{", "if", "(", "property", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Property name is null\"", ")", ";", "}", "Object", "value", "=", "getObjectProperty", "(", "property", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "handleNullPropertyValue", "(", "property", ",", "type", ")", ";", "}", "T", "convertedValue", "=", "TypeConversionSupport", ".", "convert", "(", "value", ",", "type", ")", ";", "if", "(", "convertedValue", "==", "null", ")", "{", "throw", "new", "MessageFormatException", "(", "\"Property \"", "+", "property", "+", "\" was \"", "+", "value", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" and cannot be read as \"", "+", "type", ".", "getName", "(", ")", ")", ";", "}", "return", "convertedValue", ";", "}" ]
Get the value for a property that represents a java primitive(e.g. int or long). @param property The name of the property to get. @param type The type of the property. @return the converted value for the property. @throws JMSException On internal error. @throws MessageFormatException If the property cannot be converted to the specified type. @throws NullPointerException and NumberFormatException when property name or value is null. Method throws same exception as primitives corresponding valueOf(String) method.
[ "Get", "the", "value", "for", "a", "property", "that", "represents", "a", "java", "primitive", "(", "e", ".", "g", ".", "int", "or", "long", ")", "." ]
train
https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/message/SQSMessage.java#L457-L471
bwkimmel/jdcp
jdcp-console/src/main/java/ca/eandb/jdcp/client/ScriptCommand.java
ScriptCommand.getScriptEngine
private ScriptEngine getScriptEngine(ScriptEngineManager factory, Options options) { """ Gets the <code>ScriptEngine</code> to use for interpreting the script. @param factory The <code>ScriptEngineManager</code> to use to create the <code>ScriptEngine</code>. @param options The command line options for this <code>ScriptCommand</code>. @return The <code>ScriptEngine</code> to use. """ if (options.language != null) { return factory.getEngineByName(options.language); } if (options.file != null) { String fileName = options.file.getName(); int separator = fileName.lastIndexOf('.'); if (separator < 0) { String extension = fileName.substring(separator + 1); return factory.getEngineByExtension(extension); } } return factory.getEngineByName(DEFAULT_LANGUAGE); }
java
private ScriptEngine getScriptEngine(ScriptEngineManager factory, Options options) { if (options.language != null) { return factory.getEngineByName(options.language); } if (options.file != null) { String fileName = options.file.getName(); int separator = fileName.lastIndexOf('.'); if (separator < 0) { String extension = fileName.substring(separator + 1); return factory.getEngineByExtension(extension); } } return factory.getEngineByName(DEFAULT_LANGUAGE); }
[ "private", "ScriptEngine", "getScriptEngine", "(", "ScriptEngineManager", "factory", ",", "Options", "options", ")", "{", "if", "(", "options", ".", "language", "!=", "null", ")", "{", "return", "factory", ".", "getEngineByName", "(", "options", ".", "language", ")", ";", "}", "if", "(", "options", ".", "file", "!=", "null", ")", "{", "String", "fileName", "=", "options", ".", "file", ".", "getName", "(", ")", ";", "int", "separator", "=", "fileName", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "separator", "<", "0", ")", "{", "String", "extension", "=", "fileName", ".", "substring", "(", "separator", "+", "1", ")", ";", "return", "factory", ".", "getEngineByExtension", "(", "extension", ")", ";", "}", "}", "return", "factory", ".", "getEngineByName", "(", "DEFAULT_LANGUAGE", ")", ";", "}" ]
Gets the <code>ScriptEngine</code> to use for interpreting the script. @param factory The <code>ScriptEngineManager</code> to use to create the <code>ScriptEngine</code>. @param options The command line options for this <code>ScriptCommand</code>. @return The <code>ScriptEngine</code> to use.
[ "Gets", "the", "<code", ">", "ScriptEngine<", "/", "code", ">", "to", "use", "for", "interpreting", "the", "script", "." ]
train
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-console/src/main/java/ca/eandb/jdcp/client/ScriptCommand.java#L121-L134
fuinorg/utils4j
src/main/java/org/fuin/utils4j/Utils4J.java
Utils4J.createUrl
public static URL createUrl(final URL baseUrl, final String path, final String filename) { """ Creates an URL based on a directory a relative path and a filename. @param baseUrl Directory URL with or without slash ("/") at the end of the string - Cannot be <code>null</code>. @param path Relative path inside the base URL (with or without slash ("/") at the end of the string) - Can be <code>null</code> or an empty string. @param filename Filename without path - Cannot be <code>null</code>. @return URL. """ checkNotNull("baseUrl", baseUrl); checkNotNull("filename", filename); try { String baseUrlStr = baseUrl.toString(); if (!baseUrlStr.endsWith(SLASH)) { baseUrlStr = baseUrlStr + SLASH; } final String pathStr; if ((path == null) || (path.length() == 0)) { pathStr = ""; } else { if (path.endsWith(SLASH)) { pathStr = path; } else { pathStr = path + SLASH; } } return new URL(baseUrlStr + pathStr + filename); } catch (final IOException ex) { throw new RuntimeException(ex); } }
java
public static URL createUrl(final URL baseUrl, final String path, final String filename) { checkNotNull("baseUrl", baseUrl); checkNotNull("filename", filename); try { String baseUrlStr = baseUrl.toString(); if (!baseUrlStr.endsWith(SLASH)) { baseUrlStr = baseUrlStr + SLASH; } final String pathStr; if ((path == null) || (path.length() == 0)) { pathStr = ""; } else { if (path.endsWith(SLASH)) { pathStr = path; } else { pathStr = path + SLASH; } } return new URL(baseUrlStr + pathStr + filename); } catch (final IOException ex) { throw new RuntimeException(ex); } }
[ "public", "static", "URL", "createUrl", "(", "final", "URL", "baseUrl", ",", "final", "String", "path", ",", "final", "String", "filename", ")", "{", "checkNotNull", "(", "\"baseUrl\"", ",", "baseUrl", ")", ";", "checkNotNull", "(", "\"filename\"", ",", "filename", ")", ";", "try", "{", "String", "baseUrlStr", "=", "baseUrl", ".", "toString", "(", ")", ";", "if", "(", "!", "baseUrlStr", ".", "endsWith", "(", "SLASH", ")", ")", "{", "baseUrlStr", "=", "baseUrlStr", "+", "SLASH", ";", "}", "final", "String", "pathStr", ";", "if", "(", "(", "path", "==", "null", ")", "||", "(", "path", ".", "length", "(", ")", "==", "0", ")", ")", "{", "pathStr", "=", "\"\"", ";", "}", "else", "{", "if", "(", "path", ".", "endsWith", "(", "SLASH", ")", ")", "{", "pathStr", "=", "path", ";", "}", "else", "{", "pathStr", "=", "path", "+", "SLASH", ";", "}", "}", "return", "new", "URL", "(", "baseUrlStr", "+", "pathStr", "+", "filename", ")", ";", "}", "catch", "(", "final", "IOException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "ex", ")", ";", "}", "}" ]
Creates an URL based on a directory a relative path and a filename. @param baseUrl Directory URL with or without slash ("/") at the end of the string - Cannot be <code>null</code>. @param path Relative path inside the base URL (with or without slash ("/") at the end of the string) - Can be <code>null</code> or an empty string. @param filename Filename without path - Cannot be <code>null</code>. @return URL.
[ "Creates", "an", "URL", "based", "on", "a", "directory", "a", "relative", "path", "and", "a", "filename", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L473-L495
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/Conversions.java
Conversions.checkComponentType
private static Object checkComponentType(Object array, Class<?> expectedComponentType) { """ Checks the component type of the given array against the expected component type. @param array the array to be checked. May not be <code>null</code>. @param expectedComponentType the expected component type of the array. May not be <code>null</code>. @return the unchanged array. @throws ArrayStoreException if the expected runtime {@code componentType} does not match the actual runtime component type. """ Class<?> actualComponentType = array.getClass().getComponentType(); if (!expectedComponentType.isAssignableFrom(actualComponentType)) { throw new ArrayStoreException( String.format("The expected component type %s is not assignable from the actual type %s", expectedComponentType.getCanonicalName(), actualComponentType.getCanonicalName())); } return array; }
java
private static Object checkComponentType(Object array, Class<?> expectedComponentType) { Class<?> actualComponentType = array.getClass().getComponentType(); if (!expectedComponentType.isAssignableFrom(actualComponentType)) { throw new ArrayStoreException( String.format("The expected component type %s is not assignable from the actual type %s", expectedComponentType.getCanonicalName(), actualComponentType.getCanonicalName())); } return array; }
[ "private", "static", "Object", "checkComponentType", "(", "Object", "array", ",", "Class", "<", "?", ">", "expectedComponentType", ")", "{", "Class", "<", "?", ">", "actualComponentType", "=", "array", ".", "getClass", "(", ")", ".", "getComponentType", "(", ")", ";", "if", "(", "!", "expectedComponentType", ".", "isAssignableFrom", "(", "actualComponentType", ")", ")", "{", "throw", "new", "ArrayStoreException", "(", "String", ".", "format", "(", "\"The expected component type %s is not assignable from the actual type %s\"", ",", "expectedComponentType", ".", "getCanonicalName", "(", ")", ",", "actualComponentType", ".", "getCanonicalName", "(", ")", ")", ")", ";", "}", "return", "array", ";", "}" ]
Checks the component type of the given array against the expected component type. @param array the array to be checked. May not be <code>null</code>. @param expectedComponentType the expected component type of the array. May not be <code>null</code>. @return the unchanged array. @throws ArrayStoreException if the expected runtime {@code componentType} does not match the actual runtime component type.
[ "Checks", "the", "component", "type", "of", "the", "given", "array", "against", "the", "expected", "component", "type", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/Conversions.java#L226-L234
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/ByteArrayUtil.java
ByteArrayUtil.getIntLE
public static int getIntLE(final byte[] array, final int offset) { """ Get a <i>int</i> from the given byte array starting at the given offset in little endian order. There is no bounds checking. @param array source byte array @param offset source offset @return the <i>int</i> """ return ( array[offset ] & 0XFF ) | ((array[offset + 1] & 0XFF) << 8) | ((array[offset + 2] & 0XFF) << 16) | ((array[offset + 3] & 0XFF) << 24); }
java
public static int getIntLE(final byte[] array, final int offset) { return ( array[offset ] & 0XFF ) | ((array[offset + 1] & 0XFF) << 8) | ((array[offset + 2] & 0XFF) << 16) | ((array[offset + 3] & 0XFF) << 24); }
[ "public", "static", "int", "getIntLE", "(", "final", "byte", "[", "]", "array", ",", "final", "int", "offset", ")", "{", "return", "(", "array", "[", "offset", "]", "&", "0XFF", ")", "|", "(", "(", "array", "[", "offset", "+", "1", "]", "&", "0XFF", ")", "<<", "8", ")", "|", "(", "(", "array", "[", "offset", "+", "2", "]", "&", "0XFF", ")", "<<", "16", ")", "|", "(", "(", "array", "[", "offset", "+", "3", "]", "&", "0XFF", ")", "<<", "24", ")", ";", "}" ]
Get a <i>int</i> from the given byte array starting at the given offset in little endian order. There is no bounds checking. @param array source byte array @param offset source offset @return the <i>int</i>
[ "Get", "a", "<i", ">", "int<", "/", "i", ">", "from", "the", "given", "byte", "array", "starting", "at", "the", "given", "offset", "in", "little", "endian", "order", ".", "There", "is", "no", "bounds", "checking", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/ByteArrayUtil.java#L65-L70
sahan/RoboZombie
robozombie/src/main/java/com/lonepulse/robozombie/util/Assert.java
Assert.assertNotNull
public static <T extends Object> T assertNotNull(T arg, String message) { """ <p>Asserts that the given argument is <b>{@code not null}</b>. If the argument is {@code null} a {@link NullPointerException} will be thrown with the provided message.</p> @param arg the argument to be asserted as being {@code not null} <br><br> @param arg the message to be provided with the {@link NullPointerException} if the assertion fails <br><br> @return the argument which was asserted to be {@code not null} <br><br> @throws NullPointerException if the supplied argument was found to be {@code null} <br><br> @since 1.3.0 """ if(arg == null) { throw new NullPointerException(message); } return arg; }
java
public static <T extends Object> T assertNotNull(T arg, String message) { if(arg == null) { throw new NullPointerException(message); } return arg; }
[ "public", "static", "<", "T", "extends", "Object", ">", "T", "assertNotNull", "(", "T", "arg", ",", "String", "message", ")", "{", "if", "(", "arg", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "message", ")", ";", "}", "return", "arg", ";", "}" ]
<p>Asserts that the given argument is <b>{@code not null}</b>. If the argument is {@code null} a {@link NullPointerException} will be thrown with the provided message.</p> @param arg the argument to be asserted as being {@code not null} <br><br> @param arg the message to be provided with the {@link NullPointerException} if the assertion fails <br><br> @return the argument which was asserted to be {@code not null} <br><br> @throws NullPointerException if the supplied argument was found to be {@code null} <br><br> @since 1.3.0
[ "<p", ">", "Asserts", "that", "the", "given", "argument", "is", "<b", ">", "{", "@code", "not", "null", "}", "<", "/", "b", ">", ".", "If", "the", "argument", "is", "{", "@code", "null", "}", "a", "{", "@link", "NullPointerException", "}", "will", "be", "thrown", "with", "the", "provided", "message", ".", "<", "/", "p", ">" ]
train
https://github.com/sahan/RoboZombie/blob/2e02f0d41647612e9d89360c5c48811ea86b33c8/robozombie/src/main/java/com/lonepulse/robozombie/util/Assert.java#L126-L134
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/Integration.java
Integration.withRequestParameters
public Integration withRequestParameters(java.util.Map<String, String> requestParameters) { """ <p> A key-value map specifying request parameters that are passed from the method request to the backend. The key is an integration request parameter name and the associated value is a method request parameter value or static value that must be enclosed within single quotes and pre-encoded as required by the backend. The method request parameter value must match the pattern of method.request.{location}.{name} , where {location} is querystring, path, or header; and {name} must be a valid and unique method request parameter name. </p> @param requestParameters A key-value map specifying request parameters that are passed from the method request to the backend. The key is an integration request parameter name and the associated value is a method request parameter value or static value that must be enclosed within single quotes and pre-encoded as required by the backend. The method request parameter value must match the pattern of method.request.{location}.{name} , where {location} is querystring, path, or header; and {name} must be a valid and unique method request parameter name. @return Returns a reference to this object so that method calls can be chained together. """ setRequestParameters(requestParameters); return this; }
java
public Integration withRequestParameters(java.util.Map<String, String> requestParameters) { setRequestParameters(requestParameters); return this; }
[ "public", "Integration", "withRequestParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "requestParameters", ")", "{", "setRequestParameters", "(", "requestParameters", ")", ";", "return", "this", ";", "}" ]
<p> A key-value map specifying request parameters that are passed from the method request to the backend. The key is an integration request parameter name and the associated value is a method request parameter value or static value that must be enclosed within single quotes and pre-encoded as required by the backend. The method request parameter value must match the pattern of method.request.{location}.{name} , where {location} is querystring, path, or header; and {name} must be a valid and unique method request parameter name. </p> @param requestParameters A key-value map specifying request parameters that are passed from the method request to the backend. The key is an integration request parameter name and the associated value is a method request parameter value or static value that must be enclosed within single quotes and pre-encoded as required by the backend. The method request parameter value must match the pattern of method.request.{location}.{name} , where {location} is querystring, path, or header; and {name} must be a valid and unique method request parameter name. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "key", "-", "value", "map", "specifying", "request", "parameters", "that", "are", "passed", "from", "the", "method", "request", "to", "the", "backend", ".", "The", "key", "is", "an", "integration", "request", "parameter", "name", "and", "the", "associated", "value", "is", "a", "method", "request", "parameter", "value", "or", "static", "value", "that", "must", "be", "enclosed", "within", "single", "quotes", "and", "pre", "-", "encoded", "as", "required", "by", "the", "backend", ".", "The", "method", "request", "parameter", "value", "must", "match", "the", "pattern", "of", "method", ".", "request", ".", "{", "location", "}", ".", "{", "name", "}", "where", "{", "location", "}", "is", "querystring", "path", "or", "header", ";", "and", "{", "name", "}", "must", "be", "a", "valid", "and", "unique", "method", "request", "parameter", "name", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/Integration.java#L1153-L1156
CenturyLinkCloud/mdw
mdw-services/src/com/centurylink/mdw/services/task/factory/TaskInstanceStrategyFactory.java
TaskInstanceStrategyFactory.getRoutingStrategy
public static RoutingStrategy getRoutingStrategy(String attributeValue, Long processInstanceId) throws StrategyException { """ Returns a workgroup routing strategy instance based on an attribute value and bundle spec which can consist of either the routing strategy logical name, or an xml document. @param attributeValue @param processInstanceId @return @throws StrategyException """ Package packageVO = processInstanceId == null ? null : getPackage(processInstanceId); TaskInstanceStrategyFactory factory = getInstance(); String className = factory.getStrategyClassName(attributeValue, StrategyType.RoutingStrategy); RoutingStrategy strategy = (RoutingStrategy) factory.getStrategyInstance(RoutingStrategy.class, className, packageVO); return strategy; }
java
public static RoutingStrategy getRoutingStrategy(String attributeValue, Long processInstanceId) throws StrategyException { Package packageVO = processInstanceId == null ? null : getPackage(processInstanceId); TaskInstanceStrategyFactory factory = getInstance(); String className = factory.getStrategyClassName(attributeValue, StrategyType.RoutingStrategy); RoutingStrategy strategy = (RoutingStrategy) factory.getStrategyInstance(RoutingStrategy.class, className, packageVO); return strategy; }
[ "public", "static", "RoutingStrategy", "getRoutingStrategy", "(", "String", "attributeValue", ",", "Long", "processInstanceId", ")", "throws", "StrategyException", "{", "Package", "packageVO", "=", "processInstanceId", "==", "null", "?", "null", ":", "getPackage", "(", "processInstanceId", ")", ";", "TaskInstanceStrategyFactory", "factory", "=", "getInstance", "(", ")", ";", "String", "className", "=", "factory", ".", "getStrategyClassName", "(", "attributeValue", ",", "StrategyType", ".", "RoutingStrategy", ")", ";", "RoutingStrategy", "strategy", "=", "(", "RoutingStrategy", ")", "factory", ".", "getStrategyInstance", "(", "RoutingStrategy", ".", "class", ",", "className", ",", "packageVO", ")", ";", "return", "strategy", ";", "}" ]
Returns a workgroup routing strategy instance based on an attribute value and bundle spec which can consist of either the routing strategy logical name, or an xml document. @param attributeValue @param processInstanceId @return @throws StrategyException
[ "Returns", "a", "workgroup", "routing", "strategy", "instance", "based", "on", "an", "attribute", "value", "and", "bundle", "spec", "which", "can", "consist", "of", "either", "the", "routing", "strategy", "logical", "name", "or", "an", "xml", "document", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/task/factory/TaskInstanceStrategyFactory.java#L71-L77
EdwardRaff/JSAT
JSAT/src/jsat/math/optimization/ModifiedOWLQN.java
ModifiedOWLQN.setBeta
public void setBeta(double beta) { """ Sets the shrinkage term used for the line search. @param beta the line search shrinkage term """ if(beta <= 0 || beta >= 1 || Double.isNaN(beta)) throw new IllegalArgumentException("shrinkage term must be in (0, 1), not " + beta); this.beta = beta; }
java
public void setBeta(double beta) { if(beta <= 0 || beta >= 1 || Double.isNaN(beta)) throw new IllegalArgumentException("shrinkage term must be in (0, 1), not " + beta); this.beta = beta; }
[ "public", "void", "setBeta", "(", "double", "beta", ")", "{", "if", "(", "beta", "<=", "0", "||", "beta", ">=", "1", "||", "Double", ".", "isNaN", "(", "beta", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"shrinkage term must be in (0, 1), not \"", "+", "beta", ")", ";", "this", ".", "beta", "=", "beta", ";", "}" ]
Sets the shrinkage term used for the line search. @param beta the line search shrinkage term
[ "Sets", "the", "shrinkage", "term", "used", "for", "the", "line", "search", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/optimization/ModifiedOWLQN.java#L176-L181
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/exception/ContextedException.java
ContextedException.setContextValue
@Override public ContextedException setContextValue(final String label, final Object value) { """ Sets information helpful to a developer in diagnosing and correcting the problem. For the information to be meaningful, the value passed should have a reasonable toString() implementation. Any existing values with the same labels are removed before the new one is added. <p> Note: This exception is only serializable if the object added as value is serializable. </p> @param label a textual label associated with information, {@code null} not recommended @param value information needed to understand exception, may be {@code null} @return {@code this}, for method chaining, not {@code null} """ exceptionContext.setContextValue(label, value); return this; }
java
@Override public ContextedException setContextValue(final String label, final Object value) { exceptionContext.setContextValue(label, value); return this; }
[ "@", "Override", "public", "ContextedException", "setContextValue", "(", "final", "String", "label", ",", "final", "Object", "value", ")", "{", "exceptionContext", ".", "setContextValue", "(", "label", ",", "value", ")", ";", "return", "this", ";", "}" ]
Sets information helpful to a developer in diagnosing and correcting the problem. For the information to be meaningful, the value passed should have a reasonable toString() implementation. Any existing values with the same labels are removed before the new one is added. <p> Note: This exception is only serializable if the object added as value is serializable. </p> @param label a textual label associated with information, {@code null} not recommended @param value information needed to understand exception, may be {@code null} @return {@code this}, for method chaining, not {@code null}
[ "Sets", "information", "helpful", "to", "a", "developer", "in", "diagnosing", "and", "correcting", "the", "problem", ".", "For", "the", "information", "to", "be", "meaningful", "the", "value", "passed", "should", "have", "a", "reasonable", "toString", "()", "implementation", ".", "Any", "existing", "values", "with", "the", "same", "labels", "are", "removed", "before", "the", "new", "one", "is", "added", ".", "<p", ">", "Note", ":", "This", "exception", "is", "only", "serializable", "if", "the", "object", "added", "as", "value", "is", "serializable", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/exception/ContextedException.java#L191-L195
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java
DecodedBitStreamParser.decodeBase900toBase10
private static String decodeBase900toBase10(int[] codewords, int count) throws FormatException { """ /* EXAMPLE Encode the fifteen digit numeric string 000213298174000 Prefix the numeric string with a 1 and set the initial value of t = 1 000 213 298 174 000 Calculate codeword 0 d0 = 1 000 213 298 174 000 mod 900 = 200 t = 1 000 213 298 174 000 div 900 = 1 111 348 109 082 Calculate codeword 1 d1 = 1 111 348 109 082 mod 900 = 282 t = 1 111 348 109 082 div 900 = 1 234 831 232 Calculate codeword 2 d2 = 1 234 831 232 mod 900 = 632 t = 1 234 831 232 div 900 = 1 372 034 Calculate codeword 3 d3 = 1 372 034 mod 900 = 434 t = 1 372 034 div 900 = 1 524 Calculate codeword 4 d4 = 1 524 mod 900 = 624 t = 1 524 div 900 = 1 Calculate codeword 5 d5 = 1 mod 900 = 1 t = 1 div 900 = 0 Codeword sequence is: 1, 624, 434, 632, 282, 200 Decode the above codewords involves 1 x 900 power of 5 + 624 x 900 power of 4 + 434 x 900 power of 3 + 632 x 900 power of 2 + 282 x 900 power of 1 + 200 x 900 power of 0 = 1000213298174000 Remove leading 1 => Result is 000213298174000 """ BigInteger result = BigInteger.ZERO; for (int i = 0; i < count; i++) { result = result.add(EXP900[count - i - 1].multiply(BigInteger.valueOf(codewords[i]))); } String resultString = result.toString(); if (resultString.charAt(0) != '1') { throw FormatException.getFormatInstance(); } return resultString.substring(1); }
java
private static String decodeBase900toBase10(int[] codewords, int count) throws FormatException { BigInteger result = BigInteger.ZERO; for (int i = 0; i < count; i++) { result = result.add(EXP900[count - i - 1].multiply(BigInteger.valueOf(codewords[i]))); } String resultString = result.toString(); if (resultString.charAt(0) != '1') { throw FormatException.getFormatInstance(); } return resultString.substring(1); }
[ "private", "static", "String", "decodeBase900toBase10", "(", "int", "[", "]", "codewords", ",", "int", "count", ")", "throws", "FormatException", "{", "BigInteger", "result", "=", "BigInteger", ".", "ZERO", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "result", "=", "result", ".", "add", "(", "EXP900", "[", "count", "-", "i", "-", "1", "]", ".", "multiply", "(", "BigInteger", ".", "valueOf", "(", "codewords", "[", "i", "]", ")", ")", ")", ";", "}", "String", "resultString", "=", "result", ".", "toString", "(", ")", ";", "if", "(", "resultString", ".", "charAt", "(", "0", ")", "!=", "'", "'", ")", "{", "throw", "FormatException", ".", "getFormatInstance", "(", ")", ";", "}", "return", "resultString", ".", "substring", "(", "1", ")", ";", "}" ]
/* EXAMPLE Encode the fifteen digit numeric string 000213298174000 Prefix the numeric string with a 1 and set the initial value of t = 1 000 213 298 174 000 Calculate codeword 0 d0 = 1 000 213 298 174 000 mod 900 = 200 t = 1 000 213 298 174 000 div 900 = 1 111 348 109 082 Calculate codeword 1 d1 = 1 111 348 109 082 mod 900 = 282 t = 1 111 348 109 082 div 900 = 1 234 831 232 Calculate codeword 2 d2 = 1 234 831 232 mod 900 = 632 t = 1 234 831 232 div 900 = 1 372 034 Calculate codeword 3 d3 = 1 372 034 mod 900 = 434 t = 1 372 034 div 900 = 1 524 Calculate codeword 4 d4 = 1 524 mod 900 = 624 t = 1 524 div 900 = 1 Calculate codeword 5 d5 = 1 mod 900 = 1 t = 1 div 900 = 0 Codeword sequence is: 1, 624, 434, 632, 282, 200 Decode the above codewords involves 1 x 900 power of 5 + 624 x 900 power of 4 + 434 x 900 power of 3 + 632 x 900 power of 2 + 282 x 900 power of 1 + 200 x 900 power of 0 = 1000213298174000 Remove leading 1 => Result is 000213298174000
[ "/", "*", "EXAMPLE", "Encode", "the", "fifteen", "digit", "numeric", "string", "000213298174000", "Prefix", "the", "numeric", "string", "with", "a", "1", "and", "set", "the", "initial", "value", "of", "t", "=", "1", "000", "213", "298", "174", "000", "Calculate", "codeword", "0", "d0", "=", "1", "000", "213", "298", "174", "000", "mod", "900", "=", "200" ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java#L705-L715
kiegroup/jbpm
jbpm-services/jbpm-kie-services/src/main/java/org/jbpm/kie/services/impl/CommonUtils.java
CommonUtils.getCallbackUserRoles
public static List<String> getCallbackUserRoles(UserGroupCallback userGroupCallback, String userId) { """ to compensate https://hibernate.atlassian.net/browse/HHH-8091 add empty element to the roles in case it's empty """ List<String> roles = userGroupCallback != null ? userGroupCallback.getGroupsForUser(userId) : new ArrayList<>(); if (roles == null || roles.isEmpty()) { roles = new ArrayList<>(); roles.add(""); } return roles; }
java
public static List<String> getCallbackUserRoles(UserGroupCallback userGroupCallback, String userId) { List<String> roles = userGroupCallback != null ? userGroupCallback.getGroupsForUser(userId) : new ArrayList<>(); if (roles == null || roles.isEmpty()) { roles = new ArrayList<>(); roles.add(""); } return roles; }
[ "public", "static", "List", "<", "String", ">", "getCallbackUserRoles", "(", "UserGroupCallback", "userGroupCallback", ",", "String", "userId", ")", "{", "List", "<", "String", ">", "roles", "=", "userGroupCallback", "!=", "null", "?", "userGroupCallback", ".", "getGroupsForUser", "(", "userId", ")", ":", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "roles", "==", "null", "||", "roles", ".", "isEmpty", "(", ")", ")", "{", "roles", "=", "new", "ArrayList", "<>", "(", ")", ";", "roles", ".", "add", "(", "\"\"", ")", ";", "}", "return", "roles", ";", "}" ]
to compensate https://hibernate.atlassian.net/browse/HHH-8091 add empty element to the roles in case it's empty
[ "to", "compensate", "https", ":", "//", "hibernate", ".", "atlassian", ".", "net", "/", "browse", "/", "HHH", "-", "8091", "add", "empty", "element", "to", "the", "roles", "in", "case", "it", "s", "empty" ]
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-services/jbpm-kie-services/src/main/java/org/jbpm/kie/services/impl/CommonUtils.java#L60-L68
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/print/OneSelect.java
OneSelect.addLinkToSelectPart
public void addLinkToSelectPart(final String _linkTo) throws EFapsException { """ Add the name of the attribute the link must go to, evaluated from an <code>linkTo[ATTRIBUTENAME]</code> part of an select statement. @param _linkTo name of the attribute the link must go to @throws EFapsException the e faps exception """ final Type type; // if a previous select exists it is based on the previous select, // else it is based on the basic table if (this.selectParts.size() > 0) { type = this.selectParts.get(this.selectParts.size() - 1).getType(); } else { type = this.query.getMainType(); } final LinkToSelectPart linkto = new LinkToSelectPart(_linkTo, type); this.selectParts.add(linkto); }
java
public void addLinkToSelectPart(final String _linkTo) throws EFapsException { final Type type; // if a previous select exists it is based on the previous select, // else it is based on the basic table if (this.selectParts.size() > 0) { type = this.selectParts.get(this.selectParts.size() - 1).getType(); } else { type = this.query.getMainType(); } final LinkToSelectPart linkto = new LinkToSelectPart(_linkTo, type); this.selectParts.add(linkto); }
[ "public", "void", "addLinkToSelectPart", "(", "final", "String", "_linkTo", ")", "throws", "EFapsException", "{", "final", "Type", "type", ";", "// if a previous select exists it is based on the previous select,", "// else it is based on the basic table", "if", "(", "this", ".", "selectParts", ".", "size", "(", ")", ">", "0", ")", "{", "type", "=", "this", ".", "selectParts", ".", "get", "(", "this", ".", "selectParts", ".", "size", "(", ")", "-", "1", ")", ".", "getType", "(", ")", ";", "}", "else", "{", "type", "=", "this", ".", "query", ".", "getMainType", "(", ")", ";", "}", "final", "LinkToSelectPart", "linkto", "=", "new", "LinkToSelectPart", "(", "_linkTo", ",", "type", ")", ";", "this", ".", "selectParts", ".", "add", "(", "linkto", ")", ";", "}" ]
Add the name of the attribute the link must go to, evaluated from an <code>linkTo[ATTRIBUTENAME]</code> part of an select statement. @param _linkTo name of the attribute the link must go to @throws EFapsException the e faps exception
[ "Add", "the", "name", "of", "the", "attribute", "the", "link", "must", "go", "to", "evaluated", "from", "an", "<code", ">", "linkTo", "[", "ATTRIBUTENAME", "]", "<", "/", "code", ">", "part", "of", "an", "select", "statement", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/print/OneSelect.java#L284-L297
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java
ValueEnforcer.notNullNotEquals
public static <T> T notNullNotEquals (final T aValue, final String sName, @Nonnull final T aUnexpectedValue) { """ Check that the passed value is not <code>null</code> and not equal to the provided value. @param <T> Type to be checked and returned @param aValue The value to check. May not be <code>null</code>. @param sName The name of the value (e.g. the parameter name) @param aUnexpectedValue The value that may not be equal to aValue. May not be <code>null</code>. @return The passed value. """ if (isEnabled ()) return notNullNotEquals (aValue, () -> sName, aUnexpectedValue); return aValue; }
java
public static <T> T notNullNotEquals (final T aValue, final String sName, @Nonnull final T aUnexpectedValue) { if (isEnabled ()) return notNullNotEquals (aValue, () -> sName, aUnexpectedValue); return aValue; }
[ "public", "static", "<", "T", ">", "T", "notNullNotEquals", "(", "final", "T", "aValue", ",", "final", "String", "sName", ",", "@", "Nonnull", "final", "T", "aUnexpectedValue", ")", "{", "if", "(", "isEnabled", "(", ")", ")", "return", "notNullNotEquals", "(", "aValue", ",", "(", ")", "->", "sName", ",", "aUnexpectedValue", ")", ";", "return", "aValue", ";", "}" ]
Check that the passed value is not <code>null</code> and not equal to the provided value. @param <T> Type to be checked and returned @param aValue The value to check. May not be <code>null</code>. @param sName The name of the value (e.g. the parameter name) @param aUnexpectedValue The value that may not be equal to aValue. May not be <code>null</code>. @return The passed value.
[ "Check", "that", "the", "passed", "value", "is", "not", "<code", ">", "null<", "/", "code", ">", "and", "not", "equal", "to", "the", "provided", "value", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L1316-L1321
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java
Index.unlink
final boolean unlink(Index<K,V> succ) { """ Tries to CAS right field to skip over apparent successor succ. Fails (forcing a retraversal by caller) if this node is known to be deleted. @param succ the expected current successor @return true if successful """ return node.value != null && casRight(succ, succ.right); }
java
final boolean unlink(Index<K,V> succ) { return node.value != null && casRight(succ, succ.right); }
[ "final", "boolean", "unlink", "(", "Index", "<", "K", ",", "V", ">", "succ", ")", "{", "return", "node", ".", "value", "!=", "null", "&&", "casRight", "(", "succ", ",", "succ", ".", "right", ")", ";", "}" ]
Tries to CAS right field to skip over apparent successor succ. Fails (forcing a retraversal by caller) if this node is known to be deleted. @param succ the expected current successor @return true if successful
[ "Tries", "to", "CAS", "right", "field", "to", "skip", "over", "apparent", "successor", "succ", ".", "Fails", "(", "forcing", "a", "retraversal", "by", "caller", ")", "if", "this", "node", "is", "known", "to", "be", "deleted", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java#L617-L619
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernel.java
FactoryKernel.random1D_F32
public static Kernel1D_F32 random1D_F32(int width , int offset, float min, float max, Random rand) { """ Creates a random 1D kernel drawn from a uniform distribution. @param width Kernel's width. @param offset Offset for element zero in the kernel @param min minimum value. @param max maximum value. @param rand Random number generator. @return Randomized kernel. """ Kernel1D_F32 ret = new Kernel1D_F32(width,offset); float range = max - min; for (int i = 0; i < ret.data.length; i++) { ret.data[i] = rand.nextFloat() * range + min; } return ret; }
java
public static Kernel1D_F32 random1D_F32(int width , int offset, float min, float max, Random rand) { Kernel1D_F32 ret = new Kernel1D_F32(width,offset); float range = max - min; for (int i = 0; i < ret.data.length; i++) { ret.data[i] = rand.nextFloat() * range + min; } return ret; }
[ "public", "static", "Kernel1D_F32", "random1D_F32", "(", "int", "width", ",", "int", "offset", ",", "float", "min", ",", "float", "max", ",", "Random", "rand", ")", "{", "Kernel1D_F32", "ret", "=", "new", "Kernel1D_F32", "(", "width", ",", "offset", ")", ";", "float", "range", "=", "max", "-", "min", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ret", ".", "data", ".", "length", ";", "i", "++", ")", "{", "ret", ".", "data", "[", "i", "]", "=", "rand", ".", "nextFloat", "(", ")", "*", "range", "+", "min", ";", "}", "return", "ret", ";", "}" ]
Creates a random 1D kernel drawn from a uniform distribution. @param width Kernel's width. @param offset Offset for element zero in the kernel @param min minimum value. @param max maximum value. @param rand Random number generator. @return Randomized kernel.
[ "Creates", "a", "random", "1D", "kernel", "drawn", "from", "a", "uniform", "distribution", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernel.java#L244-L253
wcm-io/wcm-io-sling
commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java
RequestParam.get
public static @Nullable String get(@NotNull Map<String, String[]> requestMap, @NotNull String param) { """ Returns a request parameter.<br> In addition the method fixes problems with incorrect UTF-8 characters returned by the servlet engine. All character data is converted from ISO-8859-1 to UTF-8. @param requestMap Request Parameter map. @param param Parameter name. @return Parameter value or null if it is not set. """ String value = null; String[] valueArray = requestMap.get(param); if (valueArray != null && valueArray.length > 0) { value = valueArray[0]; } // convert encoding to UTF-8 if not form encoding parameter is set if (value != null && !hasFormEncodingParam(requestMap)) { value = convertISO88591toUTF8(value); } return value; }
java
public static @Nullable String get(@NotNull Map<String, String[]> requestMap, @NotNull String param) { String value = null; String[] valueArray = requestMap.get(param); if (valueArray != null && valueArray.length > 0) { value = valueArray[0]; } // convert encoding to UTF-8 if not form encoding parameter is set if (value != null && !hasFormEncodingParam(requestMap)) { value = convertISO88591toUTF8(value); } return value; }
[ "public", "static", "@", "Nullable", "String", "get", "(", "@", "NotNull", "Map", "<", "String", ",", "String", "[", "]", ">", "requestMap", ",", "@", "NotNull", "String", "param", ")", "{", "String", "value", "=", "null", ";", "String", "[", "]", "valueArray", "=", "requestMap", ".", "get", "(", "param", ")", ";", "if", "(", "valueArray", "!=", "null", "&&", "valueArray", ".", "length", ">", "0", ")", "{", "value", "=", "valueArray", "[", "0", "]", ";", "}", "// convert encoding to UTF-8 if not form encoding parameter is set", "if", "(", "value", "!=", "null", "&&", "!", "hasFormEncodingParam", "(", "requestMap", ")", ")", "{", "value", "=", "convertISO88591toUTF8", "(", "value", ")", ";", "}", "return", "value", ";", "}" ]
Returns a request parameter.<br> In addition the method fixes problems with incorrect UTF-8 characters returned by the servlet engine. All character data is converted from ISO-8859-1 to UTF-8. @param requestMap Request Parameter map. @param param Parameter name. @return Parameter value or null if it is not set.
[ "Returns", "a", "request", "parameter", ".", "<br", ">", "In", "addition", "the", "method", "fixes", "problems", "with", "incorrect", "UTF", "-", "8", "characters", "returned", "by", "the", "servlet", "engine", ".", "All", "character", "data", "is", "converted", "from", "ISO", "-", "8859", "-", "1", "to", "UTF", "-", "8", "." ]
train
https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java#L126-L137
mgm-tp/jfunk
jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java
WebDriverTool.openNewWindow
public String openNewWindow(final By openClickBy, final long timeoutSeconds) { """ Opens a new window and switches to it. The window to switch to is determined by diffing the given {@code existingWindowHandles} with the current ones. The difference must be exactly one window handle which is then used to switch to. @param openClickBy identifies the element to click on in order to open the new window @param timeoutSeconds the timeout in seconds to wait for the new window to open @return the handle of the window that opened the new window """ checkTopmostElement(openClickBy); return openNewWindow(() -> sendKeys(openClickBy, Keys.chord(Keys.CONTROL, Keys.RETURN)), timeoutSeconds); }
java
public String openNewWindow(final By openClickBy, final long timeoutSeconds) { checkTopmostElement(openClickBy); return openNewWindow(() -> sendKeys(openClickBy, Keys.chord(Keys.CONTROL, Keys.RETURN)), timeoutSeconds); }
[ "public", "String", "openNewWindow", "(", "final", "By", "openClickBy", ",", "final", "long", "timeoutSeconds", ")", "{", "checkTopmostElement", "(", "openClickBy", ")", ";", "return", "openNewWindow", "(", "(", ")", "->", "sendKeys", "(", "openClickBy", ",", "Keys", ".", "chord", "(", "Keys", ".", "CONTROL", ",", "Keys", ".", "RETURN", ")", ")", ",", "timeoutSeconds", ")", ";", "}" ]
Opens a new window and switches to it. The window to switch to is determined by diffing the given {@code existingWindowHandles} with the current ones. The difference must be exactly one window handle which is then used to switch to. @param openClickBy identifies the element to click on in order to open the new window @param timeoutSeconds the timeout in seconds to wait for the new window to open @return the handle of the window that opened the new window
[ "Opens", "a", "new", "window", "and", "switches", "to", "it", ".", "The", "window", "to", "switch", "to", "is", "determined", "by", "diffing", "the", "given", "{", "@code", "existingWindowHandles", "}", "with", "the", "current", "ones", ".", "The", "difference", "must", "be", "exactly", "one", "window", "handle", "which", "is", "then", "used", "to", "switch", "to", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L765-L768
FXMisc/WellBehavedFX
src/main/java/org/fxmisc/wellbehaved/event/Nodes.java
Nodes.pushInputMap
public static void pushInputMap(Node node, InputMap<?> im) { """ Removes the currently installed {@link InputMap} (InputMap1) on the given node and installs the {@code im} (InputMap2) in its place. When finished, InputMap2 can be uninstalled and InputMap1 reinstalled via {@link #popInputMap(Node)}. Multiple InputMaps can be installed so that InputMap(n) will be installed over InputMap(n-1) """ // store currently installed im; getInputMap calls init InputMap<?> previousInputMap = getInputMap(node); getStack(node).push(previousInputMap); // completely override the previous one with the given one setInputMapUnsafe(node, im); }
java
public static void pushInputMap(Node node, InputMap<?> im) { // store currently installed im; getInputMap calls init InputMap<?> previousInputMap = getInputMap(node); getStack(node).push(previousInputMap); // completely override the previous one with the given one setInputMapUnsafe(node, im); }
[ "public", "static", "void", "pushInputMap", "(", "Node", "node", ",", "InputMap", "<", "?", ">", "im", ")", "{", "// store currently installed im; getInputMap calls init", "InputMap", "<", "?", ">", "previousInputMap", "=", "getInputMap", "(", "node", ")", ";", "getStack", "(", "node", ")", ".", "push", "(", "previousInputMap", ")", ";", "// completely override the previous one with the given one", "setInputMapUnsafe", "(", "node", ",", "im", ")", ";", "}" ]
Removes the currently installed {@link InputMap} (InputMap1) on the given node and installs the {@code im} (InputMap2) in its place. When finished, InputMap2 can be uninstalled and InputMap1 reinstalled via {@link #popInputMap(Node)}. Multiple InputMaps can be installed so that InputMap(n) will be installed over InputMap(n-1)
[ "Removes", "the", "currently", "installed", "{" ]
train
https://github.com/FXMisc/WellBehavedFX/blob/ca889734481f5439655ca8deb6f742964b5654b0/src/main/java/org/fxmisc/wellbehaved/event/Nodes.java#L88-L95
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/query/Criteria.java
Criteria.sloppy
public Criteria sloppy(String phrase, int distance) { """ Crates new {@link Predicate} with trailing {@code ~} followed by distance @param phrase @param distance @return """ if (distance <= 0) { throw new InvalidDataAccessApiUsageException("Slop distance has to be greater than 0."); } if (!StringUtils.contains(phrase, CRITERIA_VALUE_SEPERATOR)) { throw new InvalidDataAccessApiUsageException("Phrase must consist of multiple terms, separated with spaces."); } predicates.add(new Predicate(OperationKey.SLOPPY, new Object[] { phrase, Integer.valueOf(distance) })); return this; }
java
public Criteria sloppy(String phrase, int distance) { if (distance <= 0) { throw new InvalidDataAccessApiUsageException("Slop distance has to be greater than 0."); } if (!StringUtils.contains(phrase, CRITERIA_VALUE_SEPERATOR)) { throw new InvalidDataAccessApiUsageException("Phrase must consist of multiple terms, separated with spaces."); } predicates.add(new Predicate(OperationKey.SLOPPY, new Object[] { phrase, Integer.valueOf(distance) })); return this; }
[ "public", "Criteria", "sloppy", "(", "String", "phrase", ",", "int", "distance", ")", "{", "if", "(", "distance", "<=", "0", ")", "{", "throw", "new", "InvalidDataAccessApiUsageException", "(", "\"Slop distance has to be greater than 0.\"", ")", ";", "}", "if", "(", "!", "StringUtils", ".", "contains", "(", "phrase", ",", "CRITERIA_VALUE_SEPERATOR", ")", ")", "{", "throw", "new", "InvalidDataAccessApiUsageException", "(", "\"Phrase must consist of multiple terms, separated with spaces.\"", ")", ";", "}", "predicates", ".", "add", "(", "new", "Predicate", "(", "OperationKey", ".", "SLOPPY", ",", "new", "Object", "[", "]", "{", "phrase", ",", "Integer", ".", "valueOf", "(", "distance", ")", "}", ")", ")", ";", "return", "this", ";", "}" ]
Crates new {@link Predicate} with trailing {@code ~} followed by distance @param phrase @param distance @return
[ "Crates", "new", "{", "@link", "Predicate", "}", "with", "trailing", "{", "@code", "~", "}", "followed", "by", "distance" ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L356-L367
alkacon/opencms-core
src/org/opencms/site/xmlsitemap/CmsXmlSitemapCache.java
CmsXmlSitemapCache.put
public void put(String key, String value) { """ Stores an XML sitemap in the cache.<p> @param key the XML sitemap key (usually the root path of the sitemap.xml) @param value the XML sitemap content """ LOG.info("Caching sitemap for key " + key + ", size = " + value.length()); m_cache.put(key, value); }
java
public void put(String key, String value) { LOG.info("Caching sitemap for key " + key + ", size = " + value.length()); m_cache.put(key, value); }
[ "public", "void", "put", "(", "String", "key", ",", "String", "value", ")", "{", "LOG", ".", "info", "(", "\"Caching sitemap for key \"", "+", "key", "+", "\", size = \"", "+", "value", ".", "length", "(", ")", ")", ";", "m_cache", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Stores an XML sitemap in the cache.<p> @param key the XML sitemap key (usually the root path of the sitemap.xml) @param value the XML sitemap content
[ "Stores", "an", "XML", "sitemap", "in", "the", "cache", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/xmlsitemap/CmsXmlSitemapCache.java#L75-L79
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Long.java
Long.getLong
public static Long getLong(String nm, long val) { """ Determines the {@code long} value of the system property with the specified name. <p>The first argument is treated as the name of a system property. System properties are accessible through the {@link java.lang.System#getProperty(java.lang.String)} method. The string value of this property is then interpreted as a {@code long} value using the grammar supported by {@link Long#decode decode} and a {@code Long} object representing this value is returned. <p>The second argument is the default value. A {@code Long} object that represents the value of the second argument is returned if there is no property of the specified name, if the property does not have the correct numeric format, or if the specified name is empty or null. <p>In other words, this method returns a {@code Long} object equal to the value of: <blockquote> {@code getLong(nm, new Long(val))} </blockquote> but in practice it may be implemented in a manner such as: <blockquote><pre> Long result = getLong(nm, null); return (result == null) ? new Long(val) : result; </pre></blockquote> to avoid the unnecessary allocation of a {@code Long} object when the default value is not needed. @param nm property name. @param val default value. @return the {@code Long} value of the property. @throws SecurityException for the same reasons as {@link System#getProperty(String) System.getProperty} @see java.lang.System#getProperty(java.lang.String) @see java.lang.System#getProperty(java.lang.String, java.lang.String) """ Long result = Long.getLong(nm, null); return (result == null) ? Long.valueOf(val) : result; }
java
public static Long getLong(String nm, long val) { Long result = Long.getLong(nm, null); return (result == null) ? Long.valueOf(val) : result; }
[ "public", "static", "Long", "getLong", "(", "String", "nm", ",", "long", "val", ")", "{", "Long", "result", "=", "Long", ".", "getLong", "(", "nm", ",", "null", ")", ";", "return", "(", "result", "==", "null", ")", "?", "Long", ".", "valueOf", "(", "val", ")", ":", "result", ";", "}" ]
Determines the {@code long} value of the system property with the specified name. <p>The first argument is treated as the name of a system property. System properties are accessible through the {@link java.lang.System#getProperty(java.lang.String)} method. The string value of this property is then interpreted as a {@code long} value using the grammar supported by {@link Long#decode decode} and a {@code Long} object representing this value is returned. <p>The second argument is the default value. A {@code Long} object that represents the value of the second argument is returned if there is no property of the specified name, if the property does not have the correct numeric format, or if the specified name is empty or null. <p>In other words, this method returns a {@code Long} object equal to the value of: <blockquote> {@code getLong(nm, new Long(val))} </blockquote> but in practice it may be implemented in a manner such as: <blockquote><pre> Long result = getLong(nm, null); return (result == null) ? new Long(val) : result; </pre></blockquote> to avoid the unnecessary allocation of a {@code Long} object when the default value is not needed. @param nm property name. @param val default value. @return the {@code Long} value of the property. @throws SecurityException for the same reasons as {@link System#getProperty(String) System.getProperty} @see java.lang.System#getProperty(java.lang.String) @see java.lang.System#getProperty(java.lang.String, java.lang.String)
[ "Determines", "the", "{", "@code", "long", "}", "value", "of", "the", "system", "property", "with", "the", "specified", "name", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Long.java#L1004-L1007
ibm-bluemix-mobile-services/bms-clientsdk-android-core
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/core/internal/BaseRequest.java
BaseRequest.setHeaders
public void setHeaders(Map<String, List<String>> headerMap) { """ Sets headers for this resource request. Overrides all headers previously added. @param headerMap A multimap containing the header names and corresponding values """ headers = new Headers.Builder(); for (Map.Entry<String, List<String>> e : headerMap.entrySet()) { for (String headerValue : e.getValue()) { addHeader(e.getKey(), headerValue); } } }
java
public void setHeaders(Map<String, List<String>> headerMap) { headers = new Headers.Builder(); for (Map.Entry<String, List<String>> e : headerMap.entrySet()) { for (String headerValue : e.getValue()) { addHeader(e.getKey(), headerValue); } } }
[ "public", "void", "setHeaders", "(", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "headerMap", ")", "{", "headers", "=", "new", "Headers", ".", "Builder", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "List", "<", "String", ">", ">", "e", ":", "headerMap", ".", "entrySet", "(", ")", ")", "{", "for", "(", "String", "headerValue", ":", "e", ".", "getValue", "(", ")", ")", "{", "addHeader", "(", "e", ".", "getKey", "(", ")", ",", "headerValue", ")", ";", "}", "}", "}" ]
Sets headers for this resource request. Overrides all headers previously added. @param headerMap A multimap containing the header names and corresponding values
[ "Sets", "headers", "for", "this", "resource", "request", ".", "Overrides", "all", "headers", "previously", "added", "." ]
train
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/core/internal/BaseRequest.java#L296-L304
Red5/red5-server-common
src/main/java/org/red5/server/util/ScopeUtils.java
ScopeUtils.getScopeService
public static Object getScopeService(IScope scope, Class<?> intf, Class<?> defaultClass) { """ Returns scope service that implements a given interface. @param scope The scope service belongs to @param intf The interface the service must implement @param defaultClass Class that should be used to create a new service if no service was found. @return Service object """ return getScopeService(scope, intf, defaultClass, true); }
java
public static Object getScopeService(IScope scope, Class<?> intf, Class<?> defaultClass) { return getScopeService(scope, intf, defaultClass, true); }
[ "public", "static", "Object", "getScopeService", "(", "IScope", "scope", ",", "Class", "<", "?", ">", "intf", ",", "Class", "<", "?", ">", "defaultClass", ")", "{", "return", "getScopeService", "(", "scope", ",", "intf", ",", "defaultClass", ",", "true", ")", ";", "}" ]
Returns scope service that implements a given interface. @param scope The scope service belongs to @param intf The interface the service must implement @param defaultClass Class that should be used to create a new service if no service was found. @return Service object
[ "Returns", "scope", "service", "that", "implements", "a", "given", "interface", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/util/ScopeUtils.java#L323-L325
ontop/ontop
engine/reformulation/sql/src/main/java/it/unibz/inf/ontop/answering/reformulation/generation/impl/OneShotSQLGeneratorEngine.java
OneShotSQLGeneratorEngine.collectVariableReferencesWithLeftJoin
private void collectVariableReferencesWithLeftJoin(Set<Variable> vars, Function atom) { """ Collects (recursively) the set of variables that participate in data atoms (either in this atom directly or in nested ones, excluding those on the right-hand side of left joins. @param vars @param atom @return """ if (atom.isDataFunction()) { TermUtils.addReferencedVariablesTo(vars, atom); } else if (atom.isAlgebraFunction()) { Predicate functionSymbol = atom.getFunctionSymbol(); if (functionSymbol.equals(datalogFactory.getSparqlJoinPredicate())) { // if it's a join, we need to collect all the variables of each nested atom convert(atom.getTerms()).stream() .filter(f -> !f.isOperation()) .forEach(f -> collectVariableReferencesWithLeftJoin(vars, f)); } else if (functionSymbol.equals(datalogFactory.getSparqlLeftJoinPredicate())) { // if it's a left join, only of the first data/algebra atom (the left atom) collectVariableReferencesWithLeftJoin(vars, (Function) atom.getTerm(0)); } } }
java
private void collectVariableReferencesWithLeftJoin(Set<Variable> vars, Function atom) { if (atom.isDataFunction()) { TermUtils.addReferencedVariablesTo(vars, atom); } else if (atom.isAlgebraFunction()) { Predicate functionSymbol = atom.getFunctionSymbol(); if (functionSymbol.equals(datalogFactory.getSparqlJoinPredicate())) { // if it's a join, we need to collect all the variables of each nested atom convert(atom.getTerms()).stream() .filter(f -> !f.isOperation()) .forEach(f -> collectVariableReferencesWithLeftJoin(vars, f)); } else if (functionSymbol.equals(datalogFactory.getSparqlLeftJoinPredicate())) { // if it's a left join, only of the first data/algebra atom (the left atom) collectVariableReferencesWithLeftJoin(vars, (Function) atom.getTerm(0)); } } }
[ "private", "void", "collectVariableReferencesWithLeftJoin", "(", "Set", "<", "Variable", ">", "vars", ",", "Function", "atom", ")", "{", "if", "(", "atom", ".", "isDataFunction", "(", ")", ")", "{", "TermUtils", ".", "addReferencedVariablesTo", "(", "vars", ",", "atom", ")", ";", "}", "else", "if", "(", "atom", ".", "isAlgebraFunction", "(", ")", ")", "{", "Predicate", "functionSymbol", "=", "atom", ".", "getFunctionSymbol", "(", ")", ";", "if", "(", "functionSymbol", ".", "equals", "(", "datalogFactory", ".", "getSparqlJoinPredicate", "(", ")", ")", ")", "{", "// if it's a join, we need to collect all the variables of each nested atom", "convert", "(", "atom", ".", "getTerms", "(", ")", ")", ".", "stream", "(", ")", ".", "filter", "(", "f", "->", "!", "f", ".", "isOperation", "(", ")", ")", ".", "forEach", "(", "f", "->", "collectVariableReferencesWithLeftJoin", "(", "vars", ",", "f", ")", ")", ";", "}", "else", "if", "(", "functionSymbol", ".", "equals", "(", "datalogFactory", ".", "getSparqlLeftJoinPredicate", "(", ")", ")", ")", "{", "// if it's a left join, only of the first data/algebra atom (the left atom)", "collectVariableReferencesWithLeftJoin", "(", "vars", ",", "(", "Function", ")", "atom", ".", "getTerm", "(", "0", ")", ")", ";", "}", "}", "}" ]
Collects (recursively) the set of variables that participate in data atoms (either in this atom directly or in nested ones, excluding those on the right-hand side of left joins. @param vars @param atom @return
[ "Collects", "(", "recursively", ")", "the", "set", "of", "variables", "that", "participate", "in", "data", "atoms", "(", "either", "in", "this", "atom", "directly", "or", "in", "nested", "ones", "excluding", "those", "on", "the", "right", "-", "hand", "side", "of", "left", "joins", "." ]
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/engine/reformulation/sql/src/main/java/it/unibz/inf/ontop/answering/reformulation/generation/impl/OneShotSQLGeneratorEngine.java#L815-L832
apache/incubator-gobblin
gobblin-modules/gobblin-crypto-provider/src/main/java/org/apache/gobblin/crypto/GobblinEncryptionProvider.java
GobblinEncryptionProvider.buildStreamCryptoProvider
public StreamCodec buildStreamCryptoProvider(String algorithm, Map<String, Object> parameters) { """ Return a StreamEncryptor for the given algorithm and with appropriate parameters. @param algorithm Algorithm to build @param parameters Parameters for algorithm @return A StreamEncoder for that algorithm @throws IllegalArgumentException If the given algorithm/parameter pair cannot be built """ switch (algorithm) { case EncryptionConfigParser.ENCRYPTION_TYPE_ANY: case "aes_rotating": CredentialStore cs = CredentialStoreFactory.buildCredentialStore(parameters); if (cs == null) { throw new IllegalArgumentException("Failed to build credential store; can't instantiate AES"); } return new RotatingAESCodec(cs); case GPGCodec.TAG: String password = EncryptionConfigParser.getKeystorePassword(parameters); String keystorePathStr = EncryptionConfigParser.getKeystorePath(parameters); String keyName = EncryptionConfigParser.getKeyName(parameters); String cipherName = EncryptionConfigParser.getCipher(parameters); // if not using a keystore then use password based encryption if (keystorePathStr == null) { Preconditions.checkNotNull(password, "Must specify an en/decryption password for GPGCodec!"); return new GPGCodec(password, cipherName); } // if a key name is not present then use a key id of 0. A GPGCodec may be configured without a key name // when used only for decryption where the key name is retrieved from the encrypted file return new GPGCodec(new Path(keystorePathStr), password, keyName == null ? 0 : Long.parseUnsignedLong(keyName, 16), cipherName); default: log.debug("Do not support encryption type {}", algorithm); return null; } }
java
public StreamCodec buildStreamCryptoProvider(String algorithm, Map<String, Object> parameters) { switch (algorithm) { case EncryptionConfigParser.ENCRYPTION_TYPE_ANY: case "aes_rotating": CredentialStore cs = CredentialStoreFactory.buildCredentialStore(parameters); if (cs == null) { throw new IllegalArgumentException("Failed to build credential store; can't instantiate AES"); } return new RotatingAESCodec(cs); case GPGCodec.TAG: String password = EncryptionConfigParser.getKeystorePassword(parameters); String keystorePathStr = EncryptionConfigParser.getKeystorePath(parameters); String keyName = EncryptionConfigParser.getKeyName(parameters); String cipherName = EncryptionConfigParser.getCipher(parameters); // if not using a keystore then use password based encryption if (keystorePathStr == null) { Preconditions.checkNotNull(password, "Must specify an en/decryption password for GPGCodec!"); return new GPGCodec(password, cipherName); } // if a key name is not present then use a key id of 0. A GPGCodec may be configured without a key name // when used only for decryption where the key name is retrieved from the encrypted file return new GPGCodec(new Path(keystorePathStr), password, keyName == null ? 0 : Long.parseUnsignedLong(keyName, 16), cipherName); default: log.debug("Do not support encryption type {}", algorithm); return null; } }
[ "public", "StreamCodec", "buildStreamCryptoProvider", "(", "String", "algorithm", ",", "Map", "<", "String", ",", "Object", ">", "parameters", ")", "{", "switch", "(", "algorithm", ")", "{", "case", "EncryptionConfigParser", ".", "ENCRYPTION_TYPE_ANY", ":", "case", "\"aes_rotating\"", ":", "CredentialStore", "cs", "=", "CredentialStoreFactory", ".", "buildCredentialStore", "(", "parameters", ")", ";", "if", "(", "cs", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Failed to build credential store; can't instantiate AES\"", ")", ";", "}", "return", "new", "RotatingAESCodec", "(", "cs", ")", ";", "case", "GPGCodec", ".", "TAG", ":", "String", "password", "=", "EncryptionConfigParser", ".", "getKeystorePassword", "(", "parameters", ")", ";", "String", "keystorePathStr", "=", "EncryptionConfigParser", ".", "getKeystorePath", "(", "parameters", ")", ";", "String", "keyName", "=", "EncryptionConfigParser", ".", "getKeyName", "(", "parameters", ")", ";", "String", "cipherName", "=", "EncryptionConfigParser", ".", "getCipher", "(", "parameters", ")", ";", "// if not using a keystore then use password based encryption", "if", "(", "keystorePathStr", "==", "null", ")", "{", "Preconditions", ".", "checkNotNull", "(", "password", ",", "\"Must specify an en/decryption password for GPGCodec!\"", ")", ";", "return", "new", "GPGCodec", "(", "password", ",", "cipherName", ")", ";", "}", "// if a key name is not present then use a key id of 0. A GPGCodec may be configured without a key name", "// when used only for decryption where the key name is retrieved from the encrypted file", "return", "new", "GPGCodec", "(", "new", "Path", "(", "keystorePathStr", ")", ",", "password", ",", "keyName", "==", "null", "?", "0", ":", "Long", ".", "parseUnsignedLong", "(", "keyName", ",", "16", ")", ",", "cipherName", ")", ";", "default", ":", "log", ".", "debug", "(", "\"Do not support encryption type {}\"", ",", "algorithm", ")", ";", "return", "null", ";", "}", "}" ]
Return a StreamEncryptor for the given algorithm and with appropriate parameters. @param algorithm Algorithm to build @param parameters Parameters for algorithm @return A StreamEncoder for that algorithm @throws IllegalArgumentException If the given algorithm/parameter pair cannot be built
[ "Return", "a", "StreamEncryptor", "for", "the", "given", "algorithm", "and", "with", "appropriate", "parameters", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-crypto-provider/src/main/java/org/apache/gobblin/crypto/GobblinEncryptionProvider.java#L76-L106
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java
ConfluenceGreenPepper.getPageContent
public String getPageContent(Page page) { """ Retrieves the body of a page in HTML rendering. @param page a {@link com.atlassian.confluence.pages.Page} object. @return the body of a page in HTML rendering. """ try { return getPageContent(page, false); } catch (GreenPepperServerException e) { return e.getMessage(); } }
java
public String getPageContent(Page page) { try { return getPageContent(page, false); } catch (GreenPepperServerException e) { return e.getMessage(); } }
[ "public", "String", "getPageContent", "(", "Page", "page", ")", "{", "try", "{", "return", "getPageContent", "(", "page", ",", "false", ")", ";", "}", "catch", "(", "GreenPepperServerException", "e", ")", "{", "return", "e", ".", "getMessage", "(", ")", ";", "}", "}" ]
Retrieves the body of a page in HTML rendering. @param page a {@link com.atlassian.confluence.pages.Page} object. @return the body of a page in HTML rendering.
[ "Retrieves", "the", "body", "of", "a", "page", "in", "HTML", "rendering", "." ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L467-L473
feedzai/pdb
src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java
AbstractDatabaseEngine.executePSUpdate
@Override public synchronized Integer executePSUpdate(final String name) throws DatabaseEngineException, ConnectionResetException { """ Executes update on the specified prepared statement. @param name The prepared statement name. @throws DatabaseEngineException If the prepared statement does not exist or something goes wrong while executing. @throws ConnectionResetException If the connection is down and reestablishment occurs. If this happens, the user must reset the parameters and re-execute the query. """ final PreparedStatementCapsule ps = stmts.get(name); if (ps == null) { throw new DatabaseEngineRuntimeException(String.format("PreparedStatement named '%s' does not exist", name)); } try { return ps.ps.executeUpdate(); } catch (final SQLException e) { if (checkConnection(conn) || !properties.isReconnectOnLost()) { throw new DatabaseEngineException(String.format("Something went wrong executing the prepared statement '%s'", name), e); } // At this point maybe it is an error with the connection, so we try to re-establish it. try { getConnection(); } catch (final Exception e2) { throw new DatabaseEngineException("Connection is down", e2); } throw new ConnectionResetException("Connection was lost, you must reset the prepared statement parameters and re-execute the statement"); } }
java
@Override public synchronized Integer executePSUpdate(final String name) throws DatabaseEngineException, ConnectionResetException { final PreparedStatementCapsule ps = stmts.get(name); if (ps == null) { throw new DatabaseEngineRuntimeException(String.format("PreparedStatement named '%s' does not exist", name)); } try { return ps.ps.executeUpdate(); } catch (final SQLException e) { if (checkConnection(conn) || !properties.isReconnectOnLost()) { throw new DatabaseEngineException(String.format("Something went wrong executing the prepared statement '%s'", name), e); } // At this point maybe it is an error with the connection, so we try to re-establish it. try { getConnection(); } catch (final Exception e2) { throw new DatabaseEngineException("Connection is down", e2); } throw new ConnectionResetException("Connection was lost, you must reset the prepared statement parameters and re-execute the statement"); } }
[ "@", "Override", "public", "synchronized", "Integer", "executePSUpdate", "(", "final", "String", "name", ")", "throws", "DatabaseEngineException", ",", "ConnectionResetException", "{", "final", "PreparedStatementCapsule", "ps", "=", "stmts", ".", "get", "(", "name", ")", ";", "if", "(", "ps", "==", "null", ")", "{", "throw", "new", "DatabaseEngineRuntimeException", "(", "String", ".", "format", "(", "\"PreparedStatement named '%s' does not exist\"", ",", "name", ")", ")", ";", "}", "try", "{", "return", "ps", ".", "ps", ".", "executeUpdate", "(", ")", ";", "}", "catch", "(", "final", "SQLException", "e", ")", "{", "if", "(", "checkConnection", "(", "conn", ")", "||", "!", "properties", ".", "isReconnectOnLost", "(", ")", ")", "{", "throw", "new", "DatabaseEngineException", "(", "String", ".", "format", "(", "\"Something went wrong executing the prepared statement '%s'\"", ",", "name", ")", ",", "e", ")", ";", "}", "// At this point maybe it is an error with the connection, so we try to re-establish it.", "try", "{", "getConnection", "(", ")", ";", "}", "catch", "(", "final", "Exception", "e2", ")", "{", "throw", "new", "DatabaseEngineException", "(", "\"Connection is down\"", ",", "e2", ")", ";", "}", "throw", "new", "ConnectionResetException", "(", "\"Connection was lost, you must reset the prepared statement parameters and re-execute the statement\"", ")", ";", "}", "}" ]
Executes update on the specified prepared statement. @param name The prepared statement name. @throws DatabaseEngineException If the prepared statement does not exist or something goes wrong while executing. @throws ConnectionResetException If the connection is down and reestablishment occurs. If this happens, the user must reset the parameters and re-execute the query.
[ "Executes", "update", "on", "the", "specified", "prepared", "statement", "." ]
train
https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1801-L1825
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.sumCols
public static DMatrixRMaj sumCols(DMatrixRMaj input , DMatrixRMaj output ) { """ <p> Computes the sum of each column in the input matrix and returns the results in a vector:<br> <br> b<sub>j</sub> = min(i=1:m ; a<sub>ij</sub>) </p> @param input Input matrix @param output Optional storage for output. Reshaped into a row vector. Modified. @return Vector containing the sum of each column """ if( output == null ) { output = new DMatrixRMaj(1,input.numCols); } else { output.reshape(1,input.numCols); } for( int cols = 0; cols < input.numCols; cols++ ) { double total = 0; int index = cols; int end = index + input.numCols*input.numRows; for( ; index < end; index += input.numCols ) { total += input.data[index]; } output.set(cols, total); } return output; }
java
public static DMatrixRMaj sumCols(DMatrixRMaj input , DMatrixRMaj output ) { if( output == null ) { output = new DMatrixRMaj(1,input.numCols); } else { output.reshape(1,input.numCols); } for( int cols = 0; cols < input.numCols; cols++ ) { double total = 0; int index = cols; int end = index + input.numCols*input.numRows; for( ; index < end; index += input.numCols ) { total += input.data[index]; } output.set(cols, total); } return output; }
[ "public", "static", "DMatrixRMaj", "sumCols", "(", "DMatrixRMaj", "input", ",", "DMatrixRMaj", "output", ")", "{", "if", "(", "output", "==", "null", ")", "{", "output", "=", "new", "DMatrixRMaj", "(", "1", ",", "input", ".", "numCols", ")", ";", "}", "else", "{", "output", ".", "reshape", "(", "1", ",", "input", ".", "numCols", ")", ";", "}", "for", "(", "int", "cols", "=", "0", ";", "cols", "<", "input", ".", "numCols", ";", "cols", "++", ")", "{", "double", "total", "=", "0", ";", "int", "index", "=", "cols", ";", "int", "end", "=", "index", "+", "input", ".", "numCols", "*", "input", ".", "numRows", ";", "for", "(", ";", "index", "<", "end", ";", "index", "+=", "input", ".", "numCols", ")", "{", "total", "+=", "input", ".", "data", "[", "index", "]", ";", "}", "output", ".", "set", "(", "cols", ",", "total", ")", ";", "}", "return", "output", ";", "}" ]
<p> Computes the sum of each column in the input matrix and returns the results in a vector:<br> <br> b<sub>j</sub> = min(i=1:m ; a<sub>ij</sub>) </p> @param input Input matrix @param output Optional storage for output. Reshaped into a row vector. Modified. @return Vector containing the sum of each column
[ "<p", ">", "Computes", "the", "sum", "of", "each", "column", "in", "the", "input", "matrix", "and", "returns", "the", "results", "in", "a", "vector", ":", "<br", ">", "<br", ">", "b<sub", ">", "j<", "/", "sub", ">", "=", "min", "(", "i", "=", "1", ":", "m", ";", "a<sub", ">", "ij<", "/", "sub", ">", ")", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1959-L1978
before/uadetector
modules/uadetector-core/src/main/java/net/sf/uadetector/parser/AbstractUserAgentStringParser.java
AbstractUserAgentStringParser.examineAsBrowser
private static void examineAsBrowser(final UserAgent.Builder builder, final Data data) { """ Examines the user agent string whether it is a browser. @param userAgent String of an user agent @param builder Builder for an user agent information """ Matcher matcher; VersionNumber version = VersionNumber.UNKNOWN; for (final Entry<BrowserPattern, Browser> entry : data.getPatternToBrowserMap().entrySet()) { matcher = entry.getKey().getPattern().matcher(builder.getUserAgentString()); if (matcher.find()) { entry.getValue().copyTo(builder); // try to get the browser version from the first subgroup if (matcher.groupCount() > ZERO_MATCHING_GROUPS) { version = VersionNumber.parseVersion(matcher.group(1) != null ? matcher.group(1) : ""); } builder.setVersionNumber(version); break; } } }
java
private static void examineAsBrowser(final UserAgent.Builder builder, final Data data) { Matcher matcher; VersionNumber version = VersionNumber.UNKNOWN; for (final Entry<BrowserPattern, Browser> entry : data.getPatternToBrowserMap().entrySet()) { matcher = entry.getKey().getPattern().matcher(builder.getUserAgentString()); if (matcher.find()) { entry.getValue().copyTo(builder); // try to get the browser version from the first subgroup if (matcher.groupCount() > ZERO_MATCHING_GROUPS) { version = VersionNumber.parseVersion(matcher.group(1) != null ? matcher.group(1) : ""); } builder.setVersionNumber(version); break; } } }
[ "private", "static", "void", "examineAsBrowser", "(", "final", "UserAgent", ".", "Builder", "builder", ",", "final", "Data", "data", ")", "{", "Matcher", "matcher", ";", "VersionNumber", "version", "=", "VersionNumber", ".", "UNKNOWN", ";", "for", "(", "final", "Entry", "<", "BrowserPattern", ",", "Browser", ">", "entry", ":", "data", ".", "getPatternToBrowserMap", "(", ")", ".", "entrySet", "(", ")", ")", "{", "matcher", "=", "entry", ".", "getKey", "(", ")", ".", "getPattern", "(", ")", ".", "matcher", "(", "builder", ".", "getUserAgentString", "(", ")", ")", ";", "if", "(", "matcher", ".", "find", "(", ")", ")", "{", "entry", ".", "getValue", "(", ")", ".", "copyTo", "(", "builder", ")", ";", "// try to get the browser version from the first subgroup", "if", "(", "matcher", ".", "groupCount", "(", ")", ">", "ZERO_MATCHING_GROUPS", ")", "{", "version", "=", "VersionNumber", ".", "parseVersion", "(", "matcher", ".", "group", "(", "1", ")", "!=", "null", "?", "matcher", ".", "group", "(", "1", ")", ":", "\"\"", ")", ";", "}", "builder", ".", "setVersionNumber", "(", "version", ")", ";", "break", ";", "}", "}", "}" ]
Examines the user agent string whether it is a browser. @param userAgent String of an user agent @param builder Builder for an user agent information
[ "Examines", "the", "user", "agent", "string", "whether", "it", "is", "a", "browser", "." ]
train
https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/parser/AbstractUserAgentStringParser.java#L54-L72
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java
CPDefinitionLinkPersistenceImpl.removeByCPD_T
@Override public void removeByCPD_T(long CPDefinitionId, String type) { """ Removes all the cp definition links where CPDefinitionId = &#63; and type = &#63; from the database. @param CPDefinitionId the cp definition ID @param type the type """ for (CPDefinitionLink cpDefinitionLink : findByCPD_T(CPDefinitionId, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpDefinitionLink); } }
java
@Override public void removeByCPD_T(long CPDefinitionId, String type) { for (CPDefinitionLink cpDefinitionLink : findByCPD_T(CPDefinitionId, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpDefinitionLink); } }
[ "@", "Override", "public", "void", "removeByCPD_T", "(", "long", "CPDefinitionId", ",", "String", "type", ")", "{", "for", "(", "CPDefinitionLink", "cpDefinitionLink", ":", "findByCPD_T", "(", "CPDefinitionId", ",", "type", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ")", "{", "remove", "(", "cpDefinitionLink", ")", ";", "}", "}" ]
Removes all the cp definition links where CPDefinitionId = &#63; and type = &#63; from the database. @param CPDefinitionId the cp definition ID @param type the type
[ "Removes", "all", "the", "cp", "definition", "links", "where", "CPDefinitionId", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java#L3022-L3028
alipay/sofa-rpc
core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AllConnectConnectionHolder.java
AllConnectConnectionHolder.addAlive
protected void addAlive(ProviderInfo providerInfo, ClientTransport transport) { """ Add alive. @param providerInfo the provider @param transport the transport """ if (checkState(providerInfo, transport)) { aliveConnections.put(providerInfo, transport); } }
java
protected void addAlive(ProviderInfo providerInfo, ClientTransport transport) { if (checkState(providerInfo, transport)) { aliveConnections.put(providerInfo, transport); } }
[ "protected", "void", "addAlive", "(", "ProviderInfo", "providerInfo", ",", "ClientTransport", "transport", ")", "{", "if", "(", "checkState", "(", "providerInfo", ",", "transport", ")", ")", "{", "aliveConnections", ".", "put", "(", "providerInfo", ",", "transport", ")", ";", "}", "}" ]
Add alive. @param providerInfo the provider @param transport the transport
[ "Add", "alive", "." ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AllConnectConnectionHolder.java#L123-L127
apereo/cas
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/enc/SamlIdPObjectEncrypter.java
SamlIdPObjectEncrypter.getEncrypter
protected Encrypter getEncrypter(final Object samlObject, final SamlRegisteredService service, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor, final KeyEncryptionParameters keyEncParams, final DataEncryptionParameters dataEncParams) { """ Gets encrypter. @param samlObject the saml object @param service the service @param adaptor the adaptor @param keyEncParams the key enc params @param dataEncParams the data enc params @return the encrypter """ val encrypter = new Encrypter(dataEncParams, keyEncParams); encrypter.setKeyPlacement(Encrypter.KeyPlacement.PEER); return encrypter; }
java
protected Encrypter getEncrypter(final Object samlObject, final SamlRegisteredService service, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor, final KeyEncryptionParameters keyEncParams, final DataEncryptionParameters dataEncParams) { val encrypter = new Encrypter(dataEncParams, keyEncParams); encrypter.setKeyPlacement(Encrypter.KeyPlacement.PEER); return encrypter; }
[ "protected", "Encrypter", "getEncrypter", "(", "final", "Object", "samlObject", ",", "final", "SamlRegisteredService", "service", ",", "final", "SamlRegisteredServiceServiceProviderMetadataFacade", "adaptor", ",", "final", "KeyEncryptionParameters", "keyEncParams", ",", "final", "DataEncryptionParameters", "dataEncParams", ")", "{", "val", "encrypter", "=", "new", "Encrypter", "(", "dataEncParams", ",", "keyEncParams", ")", ";", "encrypter", ".", "setKeyPlacement", "(", "Encrypter", ".", "KeyPlacement", ".", "PEER", ")", ";", "return", "encrypter", ";", "}" ]
Gets encrypter. @param samlObject the saml object @param service the service @param adaptor the adaptor @param keyEncParams the key enc params @param dataEncParams the data enc params @return the encrypter
[ "Gets", "encrypter", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/enc/SamlIdPObjectEncrypter.java#L143-L151
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
BpmnParse.parseProcess
public ProcessDefinitionEntity parseProcess(Element processElement) { """ Parses one process (ie anything inside a &lt;process&gt; element). @param processElement The 'process' element. @return The parsed version of the XML: a {@link ProcessDefinitionImpl} object. """ // reset all mappings that are related to one process definition sequenceFlows = new HashMap<String, TransitionImpl>(); ProcessDefinitionEntity processDefinition = new ProcessDefinitionEntity(); /* * Mapping object model - bpmn xml: processDefinition.id -> generated by * processDefinition.key -> bpmn id (required) processDefinition.name -> * bpmn name (optional) */ processDefinition.setKey(processElement.attribute("id")); processDefinition.setName(processElement.attribute("name")); processDefinition.setCategory(rootElement.attribute("targetNamespace")); processDefinition.setProperty(PROPERTYNAME_DOCUMENTATION, parseDocumentation(processElement)); processDefinition.setTaskDefinitions(new HashMap<String, TaskDefinition>()); processDefinition.setDeploymentId(deployment.getId()); processDefinition.setProperty(PROPERTYNAME_JOB_PRIORITY, parsePriority(processElement, PROPERTYNAME_JOB_PRIORITY)); processDefinition.setProperty(PROPERTYNAME_TASK_PRIORITY, parsePriority(processElement, PROPERTYNAME_TASK_PRIORITY)); processDefinition.setVersionTag(processElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "versionTag")); try { String historyTimeToLive = processElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "historyTimeToLive", Context.getProcessEngineConfiguration().getHistoryTimeToLive()); processDefinition.setHistoryTimeToLive(ParseUtil.parseHistoryTimeToLive(historyTimeToLive)); } catch (Exception e) { addError(new BpmnParseException(e.getMessage(), processElement, e)); } boolean isStartableInTasklist = isStartable(processElement); processDefinition.setStartableInTasklist(isStartableInTasklist); LOG.parsingElement("process", processDefinition.getKey()); parseScope(processElement, processDefinition); // Parse any laneSets defined for this process parseLaneSets(processElement, processDefinition); for (BpmnParseListener parseListener : parseListeners) { parseListener.parseProcess(processElement, processDefinition); } // now we have parsed anything we can validate some stuff validateActivities(processDefinition.getActivities()); //unregister delegates for (ActivityImpl activity : processDefinition.getActivities()) { activity.setDelegateAsyncAfterUpdate(null); activity.setDelegateAsyncBeforeUpdate(null); } return processDefinition; }
java
public ProcessDefinitionEntity parseProcess(Element processElement) { // reset all mappings that are related to one process definition sequenceFlows = new HashMap<String, TransitionImpl>(); ProcessDefinitionEntity processDefinition = new ProcessDefinitionEntity(); /* * Mapping object model - bpmn xml: processDefinition.id -> generated by * processDefinition.key -> bpmn id (required) processDefinition.name -> * bpmn name (optional) */ processDefinition.setKey(processElement.attribute("id")); processDefinition.setName(processElement.attribute("name")); processDefinition.setCategory(rootElement.attribute("targetNamespace")); processDefinition.setProperty(PROPERTYNAME_DOCUMENTATION, parseDocumentation(processElement)); processDefinition.setTaskDefinitions(new HashMap<String, TaskDefinition>()); processDefinition.setDeploymentId(deployment.getId()); processDefinition.setProperty(PROPERTYNAME_JOB_PRIORITY, parsePriority(processElement, PROPERTYNAME_JOB_PRIORITY)); processDefinition.setProperty(PROPERTYNAME_TASK_PRIORITY, parsePriority(processElement, PROPERTYNAME_TASK_PRIORITY)); processDefinition.setVersionTag(processElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "versionTag")); try { String historyTimeToLive = processElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "historyTimeToLive", Context.getProcessEngineConfiguration().getHistoryTimeToLive()); processDefinition.setHistoryTimeToLive(ParseUtil.parseHistoryTimeToLive(historyTimeToLive)); } catch (Exception e) { addError(new BpmnParseException(e.getMessage(), processElement, e)); } boolean isStartableInTasklist = isStartable(processElement); processDefinition.setStartableInTasklist(isStartableInTasklist); LOG.parsingElement("process", processDefinition.getKey()); parseScope(processElement, processDefinition); // Parse any laneSets defined for this process parseLaneSets(processElement, processDefinition); for (BpmnParseListener parseListener : parseListeners) { parseListener.parseProcess(processElement, processDefinition); } // now we have parsed anything we can validate some stuff validateActivities(processDefinition.getActivities()); //unregister delegates for (ActivityImpl activity : processDefinition.getActivities()) { activity.setDelegateAsyncAfterUpdate(null); activity.setDelegateAsyncBeforeUpdate(null); } return processDefinition; }
[ "public", "ProcessDefinitionEntity", "parseProcess", "(", "Element", "processElement", ")", "{", "// reset all mappings that are related to one process definition", "sequenceFlows", "=", "new", "HashMap", "<", "String", ",", "TransitionImpl", ">", "(", ")", ";", "ProcessDefinitionEntity", "processDefinition", "=", "new", "ProcessDefinitionEntity", "(", ")", ";", "/*\n * Mapping object model - bpmn xml: processDefinition.id -> generated by\n * processDefinition.key -> bpmn id (required) processDefinition.name ->\n * bpmn name (optional)\n */", "processDefinition", ".", "setKey", "(", "processElement", ".", "attribute", "(", "\"id\"", ")", ")", ";", "processDefinition", ".", "setName", "(", "processElement", ".", "attribute", "(", "\"name\"", ")", ")", ";", "processDefinition", ".", "setCategory", "(", "rootElement", ".", "attribute", "(", "\"targetNamespace\"", ")", ")", ";", "processDefinition", ".", "setProperty", "(", "PROPERTYNAME_DOCUMENTATION", ",", "parseDocumentation", "(", "processElement", ")", ")", ";", "processDefinition", ".", "setTaskDefinitions", "(", "new", "HashMap", "<", "String", ",", "TaskDefinition", ">", "(", ")", ")", ";", "processDefinition", ".", "setDeploymentId", "(", "deployment", ".", "getId", "(", ")", ")", ";", "processDefinition", ".", "setProperty", "(", "PROPERTYNAME_JOB_PRIORITY", ",", "parsePriority", "(", "processElement", ",", "PROPERTYNAME_JOB_PRIORITY", ")", ")", ";", "processDefinition", ".", "setProperty", "(", "PROPERTYNAME_TASK_PRIORITY", ",", "parsePriority", "(", "processElement", ",", "PROPERTYNAME_TASK_PRIORITY", ")", ")", ";", "processDefinition", ".", "setVersionTag", "(", "processElement", ".", "attributeNS", "(", "CAMUNDA_BPMN_EXTENSIONS_NS", ",", "\"versionTag\"", ")", ")", ";", "try", "{", "String", "historyTimeToLive", "=", "processElement", ".", "attributeNS", "(", "CAMUNDA_BPMN_EXTENSIONS_NS", ",", "\"historyTimeToLive\"", ",", "Context", ".", "getProcessEngineConfiguration", "(", ")", ".", "getHistoryTimeToLive", "(", ")", ")", ";", "processDefinition", ".", "setHistoryTimeToLive", "(", "ParseUtil", ".", "parseHistoryTimeToLive", "(", "historyTimeToLive", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "addError", "(", "new", "BpmnParseException", "(", "e", ".", "getMessage", "(", ")", ",", "processElement", ",", "e", ")", ")", ";", "}", "boolean", "isStartableInTasklist", "=", "isStartable", "(", "processElement", ")", ";", "processDefinition", ".", "setStartableInTasklist", "(", "isStartableInTasklist", ")", ";", "LOG", ".", "parsingElement", "(", "\"process\"", ",", "processDefinition", ".", "getKey", "(", ")", ")", ";", "parseScope", "(", "processElement", ",", "processDefinition", ")", ";", "// Parse any laneSets defined for this process", "parseLaneSets", "(", "processElement", ",", "processDefinition", ")", ";", "for", "(", "BpmnParseListener", "parseListener", ":", "parseListeners", ")", "{", "parseListener", ".", "parseProcess", "(", "processElement", ",", "processDefinition", ")", ";", "}", "// now we have parsed anything we can validate some stuff", "validateActivities", "(", "processDefinition", ".", "getActivities", "(", ")", ")", ";", "//unregister delegates", "for", "(", "ActivityImpl", "activity", ":", "processDefinition", ".", "getActivities", "(", ")", ")", "{", "activity", ".", "setDelegateAsyncAfterUpdate", "(", "null", ")", ";", "activity", ".", "setDelegateAsyncBeforeUpdate", "(", "null", ")", ";", "}", "return", "processDefinition", ";", "}" ]
Parses one process (ie anything inside a &lt;process&gt; element). @param processElement The 'process' element. @return The parsed version of the XML: a {@link ProcessDefinitionImpl} object.
[ "Parses", "one", "process", "(", "ie", "anything", "inside", "a", "&lt", ";", "process&gt", ";", "element", ")", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L526-L579
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java
SkbShellFactory.newArgument
public static SkbShellArgument newArgument(String argument, boolean isOptional, SkbShellArgumentType type, Object[] valueSet, String description, String addedHelp) { """ Returns a new shell argument, use the factory to create one. @param argument the actual argument, cannot be blank @param isOptional flag for optional (true if optional, false if not) @param type the argument's type, cannot be null @param valueSet the argument's value set if specified, can be null @param description the command's description, cannot be null @param addedHelp a string additional to the description for help @return new shell argument @throws IllegalArgumentException if argument, type, or description was null """ return new AbstractShellArgument(argument, isOptional, type, valueSet, description, addedHelp); }
java
public static SkbShellArgument newArgument(String argument, boolean isOptional, SkbShellArgumentType type, Object[] valueSet, String description, String addedHelp){ return new AbstractShellArgument(argument, isOptional, type, valueSet, description, addedHelp); }
[ "public", "static", "SkbShellArgument", "newArgument", "(", "String", "argument", ",", "boolean", "isOptional", ",", "SkbShellArgumentType", "type", ",", "Object", "[", "]", "valueSet", ",", "String", "description", ",", "String", "addedHelp", ")", "{", "return", "new", "AbstractShellArgument", "(", "argument", ",", "isOptional", ",", "type", ",", "valueSet", ",", "description", ",", "addedHelp", ")", ";", "}" ]
Returns a new shell argument, use the factory to create one. @param argument the actual argument, cannot be blank @param isOptional flag for optional (true if optional, false if not) @param type the argument's type, cannot be null @param valueSet the argument's value set if specified, can be null @param description the command's description, cannot be null @param addedHelp a string additional to the description for help @return new shell argument @throws IllegalArgumentException if argument, type, or description was null
[ "Returns", "a", "new", "shell", "argument", "use", "the", "factory", "to", "create", "one", "." ]
train
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java#L155-L157
erlang/otp
lib/jinterface/java_src/com/ericsson/otp/erlang/OtpCookedConnection.java
OtpCookedConnection.breakLinks
synchronized void breakLinks() { """ /* When the connection fails - send exit to all local pids with links through this connection """ if (links != null) { final Link[] l = links.clearLinks(); if (l != null) { final int len = l.length; for (int i = 0; i < len; i++) { // send exit "from" remote pids to local ones self.deliver(new OtpMsg(OtpMsg.exitTag, l[i].remote(), l[i] .local(), new OtpErlangAtom("noconnection"))); } } } }
java
synchronized void breakLinks() { if (links != null) { final Link[] l = links.clearLinks(); if (l != null) { final int len = l.length; for (int i = 0; i < len; i++) { // send exit "from" remote pids to local ones self.deliver(new OtpMsg(OtpMsg.exitTag, l[i].remote(), l[i] .local(), new OtpErlangAtom("noconnection"))); } } } }
[ "synchronized", "void", "breakLinks", "(", ")", "{", "if", "(", "links", "!=", "null", ")", "{", "final", "Link", "[", "]", "l", "=", "links", ".", "clearLinks", "(", ")", ";", "if", "(", "l", "!=", "null", ")", "{", "final", "int", "len", "=", "l", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "// send exit \"from\" remote pids to local ones", "self", ".", "deliver", "(", "new", "OtpMsg", "(", "OtpMsg", ".", "exitTag", ",", "l", "[", "i", "]", ".", "remote", "(", ")", ",", "l", "[", "i", "]", ".", "local", "(", ")", ",", "new", "OtpErlangAtom", "(", "\"noconnection\"", ")", ")", ")", ";", "}", "}", "}", "}" ]
/* When the connection fails - send exit to all local pids with links through this connection
[ "/", "*", "When", "the", "connection", "fails", "-", "send", "exit", "to", "all", "local", "pids", "with", "links", "through", "this", "connection" ]
train
https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpCookedConnection.java#L231-L245
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/util/StringHelper.java
StringHelper.makeFormattedString
public static String makeFormattedString( String aAttrName, Object[] anObjArray, boolean aPrependSeparator) { """ Utility method that formats array of <code>Object</code>. <p> Example: aAttrName[]="[LENGTH=anObjArray.length(anObjArray{i}, ... ]", where the "," is controlled using the aPrependSeparator set to true. @param aAttrName A String attribute name value. @param anObjArray An Object array of values @param aPrependSeparator A boolean value used in PreFormatString(String, boolean) to append a "," before the aAttrName value. @return A formatted String. @see #PreFormatString(String, boolean) @see #makeFormattedString(String, boolean) """ StringBuffer mStrBuff = new StringBuffer(PreFormatString(aAttrName + "[]", aPrependSeparator)); if (anObjArray == null) mStrBuff.append("null"); else { mStrBuff.append("["); mStrBuff.append("LENGTH=" + anObjArray.length); if (anObjArray.length > 0) { for (int i = 0; i < anObjArray.length; i++) { mStrBuff.append(makeFormattedString("(" + i + ")", anObjArray[i])); } } mStrBuff.append("]"); } return mStrBuff.toString(); }
java
public static String makeFormattedString( String aAttrName, Object[] anObjArray, boolean aPrependSeparator) { StringBuffer mStrBuff = new StringBuffer(PreFormatString(aAttrName + "[]", aPrependSeparator)); if (anObjArray == null) mStrBuff.append("null"); else { mStrBuff.append("["); mStrBuff.append("LENGTH=" + anObjArray.length); if (anObjArray.length > 0) { for (int i = 0; i < anObjArray.length; i++) { mStrBuff.append(makeFormattedString("(" + i + ")", anObjArray[i])); } } mStrBuff.append("]"); } return mStrBuff.toString(); }
[ "public", "static", "String", "makeFormattedString", "(", "String", "aAttrName", ",", "Object", "[", "]", "anObjArray", ",", "boolean", "aPrependSeparator", ")", "{", "StringBuffer", "mStrBuff", "=", "new", "StringBuffer", "(", "PreFormatString", "(", "aAttrName", "+", "\"[]\"", ",", "aPrependSeparator", ")", ")", ";", "if", "(", "anObjArray", "==", "null", ")", "mStrBuff", ".", "append", "(", "\"null\"", ")", ";", "else", "{", "mStrBuff", ".", "append", "(", "\"[\"", ")", ";", "mStrBuff", ".", "append", "(", "\"LENGTH=\"", "+", "anObjArray", ".", "length", ")", ";", "if", "(", "anObjArray", ".", "length", ">", "0", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "anObjArray", ".", "length", ";", "i", "++", ")", "{", "mStrBuff", ".", "append", "(", "makeFormattedString", "(", "\"(\"", "+", "i", "+", "\")\"", ",", "anObjArray", "[", "i", "]", ")", ")", ";", "}", "}", "mStrBuff", ".", "append", "(", "\"]\"", ")", ";", "}", "return", "mStrBuff", ".", "toString", "(", ")", ";", "}" ]
Utility method that formats array of <code>Object</code>. <p> Example: aAttrName[]="[LENGTH=anObjArray.length(anObjArray{i}, ... ]", where the "," is controlled using the aPrependSeparator set to true. @param aAttrName A String attribute name value. @param anObjArray An Object array of values @param aPrependSeparator A boolean value used in PreFormatString(String, boolean) to append a "," before the aAttrName value. @return A formatted String. @see #PreFormatString(String, boolean) @see #makeFormattedString(String, boolean)
[ "Utility", "method", "that", "formats", "array", "of", "<code", ">", "Object<", "/", "code", ">", ".", "<p", ">", "Example", ":", "aAttrName", "[]", "=", "[", "LENGTH", "=", "anObjArray", ".", "length", "(", "anObjArray", "{", "i", "}", "...", "]", "where", "the", "is", "controlled", "using", "the", "aPrependSeparator", "set", "to", "true", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/StringHelper.java#L259-L278