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
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ddi_serviceName_PUT
public void billingAccount_ddi_serviceName_PUT(String billingAccount, String serviceName, OvhDdi body) throws IOException { """ Alter this object properties REST: PUT /telephony/{billingAccount}/ddi/{serviceName} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required] """ String qPath = "/telephony/{billingAccount}/ddi/{serviceName}"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_ddi_serviceName_PUT(String billingAccount, String serviceName, OvhDdi body) throws IOException { String qPath = "/telephony/{billingAccount}/ddi/{serviceName}"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_ddi_serviceName_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhDdi", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/ddi/{serviceName}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /telephony/{billingAccount}/ddi/{serviceName} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8501-L8505
googleads/googleads-java-lib
modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/utils/v201902/DateTimes.java
DateTimes.toCalendar
public static Calendar toCalendar(DateTime dateTime, Locale locale) { """ Gets a calendar for a {@code DateTime} in the supplied locale. """ return dateTimesHelper.toCalendar(dateTime, locale); }
java
public static Calendar toCalendar(DateTime dateTime, Locale locale) { return dateTimesHelper.toCalendar(dateTime, locale); }
[ "public", "static", "Calendar", "toCalendar", "(", "DateTime", "dateTime", ",", "Locale", "locale", ")", "{", "return", "dateTimesHelper", ".", "toCalendar", "(", "dateTime", ",", "locale", ")", ";", "}" ]
Gets a calendar for a {@code DateTime} in the supplied locale.
[ "Gets", "a", "calendar", "for", "a", "{" ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/utils/v201902/DateTimes.java#L75-L77
nextreports/nextreports-engine
src/ro/nextreports/engine/util/DateUtil.java
DateUtil.setHours
public static Date setHours(Date d, int hours) { """ Set hours to a date @param d date @param hours hours @return new date """ Calendar cal = Calendar.getInstance(); cal.setTime(d); cal.set(Calendar.HOUR_OF_DAY, hours); return cal.getTime(); }
java
public static Date setHours(Date d, int hours) { Calendar cal = Calendar.getInstance(); cal.setTime(d); cal.set(Calendar.HOUR_OF_DAY, hours); return cal.getTime(); }
[ "public", "static", "Date", "setHours", "(", "Date", "d", ",", "int", "hours", ")", "{", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setTime", "(", "d", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "hours", ")", ";", "return", "cal", ".", "getTime", "(", ")", ";", "}" ]
Set hours to a date @param d date @param hours hours @return new date
[ "Set", "hours", "to", "a", "date" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L470-L475
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.absoluteQuadraticToH
public static boolean absoluteQuadraticToH(DMatrix4x4 Q , DMatrixRMaj H ) { """ Decomposes the absolute quadratic to extract the rectifying homogrpahy H. This is used to go from a projective to metric (calibrated) geometry. See pg 464 in [1]. <p>Q = H*I*H<sup>T</sup></p> <p>where I = diag(1 1 1 0)</p> <ol> <li> R. Hartley, and A. Zisserman, "Multiple View Geometry in Computer Vision", 2nd Ed, Cambridge 2003 </li> </ol> @see DecomposeAbsoluteDualQuadratic @param Q (Input) Absolute quadratic. Typically found in auto calibration. Not modified. @param H (Output) 4x4 rectifying homography. """ DecomposeAbsoluteDualQuadratic alg = new DecomposeAbsoluteDualQuadratic(); if( !alg.decompose(Q) ) return false; return alg.computeRectifyingHomography(H); }
java
public static boolean absoluteQuadraticToH(DMatrix4x4 Q , DMatrixRMaj H ) { DecomposeAbsoluteDualQuadratic alg = new DecomposeAbsoluteDualQuadratic(); if( !alg.decompose(Q) ) return false; return alg.computeRectifyingHomography(H); }
[ "public", "static", "boolean", "absoluteQuadraticToH", "(", "DMatrix4x4", "Q", ",", "DMatrixRMaj", "H", ")", "{", "DecomposeAbsoluteDualQuadratic", "alg", "=", "new", "DecomposeAbsoluteDualQuadratic", "(", ")", ";", "if", "(", "!", "alg", ".", "decompose", "(", "Q", ")", ")", "return", "false", ";", "return", "alg", ".", "computeRectifyingHomography", "(", "H", ")", ";", "}" ]
Decomposes the absolute quadratic to extract the rectifying homogrpahy H. This is used to go from a projective to metric (calibrated) geometry. See pg 464 in [1]. <p>Q = H*I*H<sup>T</sup></p> <p>where I = diag(1 1 1 0)</p> <ol> <li> R. Hartley, and A. Zisserman, "Multiple View Geometry in Computer Vision", 2nd Ed, Cambridge 2003 </li> </ol> @see DecomposeAbsoluteDualQuadratic @param Q (Input) Absolute quadratic. Typically found in auto calibration. Not modified. @param H (Output) 4x4 rectifying homography.
[ "Decomposes", "the", "absolute", "quadratic", "to", "extract", "the", "rectifying", "homogrpahy", "H", ".", "This", "is", "used", "to", "go", "from", "a", "projective", "to", "metric", "(", "calibrated", ")", "geometry", ".", "See", "pg", "464", "in", "[", "1", "]", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L1472-L1478
Azure/azure-sdk-for-java
containerservice/resource-manager/v2017_08_31/src/main/java/com/microsoft/azure/management/containerservice/v2017_08_31/implementation/ManagedClustersInner.java
ManagedClustersInner.getUpgradeProfileAsync
public Observable<ManagedClusterUpgradeProfileInner> getUpgradeProfileAsync(String resourceGroupName, String resourceName) { """ Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. @param resourceGroupName The name of the resource group. @param resourceName The name of the managed cluster resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ManagedClusterUpgradeProfileInner object """ return getUpgradeProfileWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<ManagedClusterUpgradeProfileInner>, ManagedClusterUpgradeProfileInner>() { @Override public ManagedClusterUpgradeProfileInner call(ServiceResponse<ManagedClusterUpgradeProfileInner> response) { return response.body(); } }); }
java
public Observable<ManagedClusterUpgradeProfileInner> getUpgradeProfileAsync(String resourceGroupName, String resourceName) { return getUpgradeProfileWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<ManagedClusterUpgradeProfileInner>, ManagedClusterUpgradeProfileInner>() { @Override public ManagedClusterUpgradeProfileInner call(ServiceResponse<ManagedClusterUpgradeProfileInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ManagedClusterUpgradeProfileInner", ">", "getUpgradeProfileAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "getUpgradeProfileWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ManagedClusterUpgradeProfileInner", ">", ",", "ManagedClusterUpgradeProfileInner", ">", "(", ")", "{", "@", "Override", "public", "ManagedClusterUpgradeProfileInner", "call", "(", "ServiceResponse", "<", "ManagedClusterUpgradeProfileInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. @param resourceGroupName The name of the resource group. @param resourceName The name of the managed cluster resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ManagedClusterUpgradeProfileInner object
[ "Gets", "upgrade", "profile", "for", "a", "managed", "cluster", ".", "Gets", "the", "details", "of", "the", "upgrade", "profile", "for", "a", "managed", "cluster", "with", "a", "specified", "resource", "group", "and", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2017_08_31/src/main/java/com/microsoft/azure/management/containerservice/v2017_08_31/implementation/ManagedClustersInner.java#L383-L390
CloudSlang/cs-actions
cs-amazon/src/main/java/io/cloudslang/content/amazon/services/helpers/AwsSignatureHelper.java
AwsSignatureHelper.canonicalizedQueryString
public String canonicalizedQueryString(Map<String, String> queryParameters) { """ Canonicalized (standardized) query string is formed by first sorting all the query parameters, then URI encoding both the key and value and then joining them, in order, separating key value pairs with an '&'. @param queryParameters Query parameters to be canonicalized. @return A canonicalized form for the specified query parameters. """ List<Map.Entry<String, String>> sortedList = getSortedMapEntries(queryParameters); StringBuilder queryString = new StringBuilder(); for (Map.Entry<String, String> entry : sortedList) { queryString.append(entryToQuery(entry)); } if (queryString.length() > START_INDEX) { queryString.deleteCharAt(queryString.length() - ONE); //removing last '&' } return queryString.toString(); }
java
public String canonicalizedQueryString(Map<String, String> queryParameters) { List<Map.Entry<String, String>> sortedList = getSortedMapEntries(queryParameters); StringBuilder queryString = new StringBuilder(); for (Map.Entry<String, String> entry : sortedList) { queryString.append(entryToQuery(entry)); } if (queryString.length() > START_INDEX) { queryString.deleteCharAt(queryString.length() - ONE); //removing last '&' } return queryString.toString(); }
[ "public", "String", "canonicalizedQueryString", "(", "Map", "<", "String", ",", "String", ">", "queryParameters", ")", "{", "List", "<", "Map", ".", "Entry", "<", "String", ",", "String", ">", ">", "sortedList", "=", "getSortedMapEntries", "(", "queryParameters", ")", ";", "StringBuilder", "queryString", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "sortedList", ")", "{", "queryString", ".", "append", "(", "entryToQuery", "(", "entry", ")", ")", ";", "}", "if", "(", "queryString", ".", "length", "(", ")", ">", "START_INDEX", ")", "{", "queryString", ".", "deleteCharAt", "(", "queryString", ".", "length", "(", ")", "-", "ONE", ")", ";", "//removing last '&'", "}", "return", "queryString", ".", "toString", "(", ")", ";", "}" ]
Canonicalized (standardized) query string is formed by first sorting all the query parameters, then URI encoding both the key and value and then joining them, in order, separating key value pairs with an '&'. @param queryParameters Query parameters to be canonicalized. @return A canonicalized form for the specified query parameters.
[ "Canonicalized", "(", "standardized", ")", "query", "string", "is", "formed", "by", "first", "sorting", "all", "the", "query", "parameters", "then", "URI", "encoding", "both", "the", "key", "and", "value", "and", "then", "joining", "them", "in", "order", "separating", "key", "value", "pairs", "with", "an", "&", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-amazon/src/main/java/io/cloudslang/content/amazon/services/helpers/AwsSignatureHelper.java#L66-L79
LevelFourAB/commons
commons-types/src/main/java/se/l4/commons/types/matching/AbstractClassMatchingMap.java
AbstractClassMatchingMap.findMatching
protected void findMatching(Class<? extends T> type, BiPredicate<Class<? extends T>, D> predicate) { """ Perform matching against the given type. This will go through the hierarchy and interfaces of the type trying to find if this map has an entry for them. """ traverseType(type, predicate, new HashSet<>()); }
java
protected void findMatching(Class<? extends T> type, BiPredicate<Class<? extends T>, D> predicate) { traverseType(type, predicate, new HashSet<>()); }
[ "protected", "void", "findMatching", "(", "Class", "<", "?", "extends", "T", ">", "type", ",", "BiPredicate", "<", "Class", "<", "?", "extends", "T", ">", ",", "D", ">", "predicate", ")", "{", "traverseType", "(", "type", ",", "predicate", ",", "new", "HashSet", "<>", "(", ")", ")", ";", "}" ]
Perform matching against the given type. This will go through the hierarchy and interfaces of the type trying to find if this map has an entry for them.
[ "Perform", "matching", "against", "the", "given", "type", ".", "This", "will", "go", "through", "the", "hierarchy", "and", "interfaces", "of", "the", "type", "trying", "to", "find", "if", "this", "map", "has", "an", "entry", "for", "them", "." ]
train
https://github.com/LevelFourAB/commons/blob/aa121b3a5504b43d0c10450a1b984694fcd2b8ee/commons-types/src/main/java/se/l4/commons/types/matching/AbstractClassMatchingMap.java#L82-L85
javamelody/javamelody
javamelody-spring-boot-starter/src/main/java/net/bull/javamelody/JavaMelodyAutoConfiguration.java
JavaMelodyAutoConfiguration.monitoringSpringAsyncAdvisor
@Bean @ConditionalOnProperty(prefix = JavaMelodyConfigurationProperties.PREFIX, name = "spring-monitoring-enabled", matchIfMissing = true) public MonitoringSpringAdvisor monitoringSpringAsyncAdvisor() { """ Monitoring of beans or methods having the {@link Async} annotation. @return MonitoringSpringAdvisor """ return new MonitoringSpringAdvisor( Pointcuts.union(new AnnotationMatchingPointcut(Async.class), new AnnotationMatchingPointcut(null, Async.class))); }
java
@Bean @ConditionalOnProperty(prefix = JavaMelodyConfigurationProperties.PREFIX, name = "spring-monitoring-enabled", matchIfMissing = true) public MonitoringSpringAdvisor monitoringSpringAsyncAdvisor() { return new MonitoringSpringAdvisor( Pointcuts.union(new AnnotationMatchingPointcut(Async.class), new AnnotationMatchingPointcut(null, Async.class))); }
[ "@", "Bean", "@", "ConditionalOnProperty", "(", "prefix", "=", "JavaMelodyConfigurationProperties", ".", "PREFIX", ",", "name", "=", "\"spring-monitoring-enabled\"", ",", "matchIfMissing", "=", "true", ")", "public", "MonitoringSpringAdvisor", "monitoringSpringAsyncAdvisor", "(", ")", "{", "return", "new", "MonitoringSpringAdvisor", "(", "Pointcuts", ".", "union", "(", "new", "AnnotationMatchingPointcut", "(", "Async", ".", "class", ")", ",", "new", "AnnotationMatchingPointcut", "(", "null", ",", "Async", ".", "class", ")", ")", ")", ";", "}" ]
Monitoring of beans or methods having the {@link Async} annotation. @return MonitoringSpringAdvisor
[ "Monitoring", "of", "beans", "or", "methods", "having", "the", "{" ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-spring-boot-starter/src/main/java/net/bull/javamelody/JavaMelodyAutoConfiguration.java#L250-L256
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/core/EventHandler.java
EventHandler.triggerBasicEvent
void triggerBasicEvent(Event.EventType type, String message) { """ Triggers a new event of type @type with message @message and flushes the eventBuffer if full @param type event type @param message triggering message """ triggerBasicEvent(type, message, false); }
java
void triggerBasicEvent(Event.EventType type, String message) { triggerBasicEvent(type, message, false); }
[ "void", "triggerBasicEvent", "(", "Event", ".", "EventType", "type", ",", "String", "message", ")", "{", "triggerBasicEvent", "(", "type", ",", "message", ",", "false", ")", ";", "}" ]
Triggers a new event of type @type with message @message and flushes the eventBuffer if full @param type event type @param message triggering message
[ "Triggers", "a", "new", "event", "of", "type", "@type", "with", "message", "@message", "and", "flushes", "the", "eventBuffer", "if", "full" ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/EventHandler.java#L251-L254
rosette-api/java
model/src/main/java/com/basistech/rosette/apimodel/Response.java
Response.addExtendedInformation
public void addExtendedInformation(String key, Object value) { """ add more extended information to the response @param key @param value """ if (extendedInformation == null) { extendedInformation = new HashMap<>(); } extendedInformation.put(key, value); }
java
public void addExtendedInformation(String key, Object value) { if (extendedInformation == null) { extendedInformation = new HashMap<>(); } extendedInformation.put(key, value); }
[ "public", "void", "addExtendedInformation", "(", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "extendedInformation", "==", "null", ")", "{", "extendedInformation", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "extendedInformation", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
add more extended information to the response @param key @param value
[ "add", "more", "extended", "information", "to", "the", "response" ]
train
https://github.com/rosette-api/java/blob/35faf9fbb9c940eae47df004da7639a3b177b80b/model/src/main/java/com/basistech/rosette/apimodel/Response.java#L40-L45
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/AnchorBase.java
AnchorBase.createPageAnchor
private boolean createPageAnchor(ServletRequest req, TagRenderingBase trb) { """ This method will output an anchor with a fragment identifier. This should be a valid ID within the document. If the name begins with the "#" we will not qualify the set link name. If the name doesn't begin with #, then we will qualify it into the current scope container. @param req The servlet request. @param trb The TagRenderer that will output the link @return return a boolean indicating if an error occurred or not """ // create the fragment identifier. If the _linkName starts with // '#' then we treat it as if it was fully qualified. Otherwise we // need to qualify it before we add the '#'. _linkName = _linkName.trim(); if (_linkName.charAt(0) != '#') { _state.href = "#" + getIdForTagId(_linkName); } else { _state.href = _linkName; } // if the tagId was set then rewrite it and output it. if (_state.id != null) { //_state.id = getIdForTagId(_state.id); _state.name = _state.id; renderNameAndId((HttpServletRequest) req, _state,null); //renderDefaultNameAndId((HttpServletRequest) req, _state, _state.id, _state.id); } // write out the tag. WriteRenderAppender writer = new WriteRenderAppender(pageContext); trb = TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG, req); trb.doStartTag(writer, _state); return !hasErrors(); }
java
private boolean createPageAnchor(ServletRequest req, TagRenderingBase trb) { // create the fragment identifier. If the _linkName starts with // '#' then we treat it as if it was fully qualified. Otherwise we // need to qualify it before we add the '#'. _linkName = _linkName.trim(); if (_linkName.charAt(0) != '#') { _state.href = "#" + getIdForTagId(_linkName); } else { _state.href = _linkName; } // if the tagId was set then rewrite it and output it. if (_state.id != null) { //_state.id = getIdForTagId(_state.id); _state.name = _state.id; renderNameAndId((HttpServletRequest) req, _state,null); //renderDefaultNameAndId((HttpServletRequest) req, _state, _state.id, _state.id); } // write out the tag. WriteRenderAppender writer = new WriteRenderAppender(pageContext); trb = TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG, req); trb.doStartTag(writer, _state); return !hasErrors(); }
[ "private", "boolean", "createPageAnchor", "(", "ServletRequest", "req", ",", "TagRenderingBase", "trb", ")", "{", "// create the fragment identifier. If the _linkName starts with", "// '#' then we treat it as if it was fully qualified. Otherwise we", "// need to qualify it before we add the '#'.", "_linkName", "=", "_linkName", ".", "trim", "(", ")", ";", "if", "(", "_linkName", ".", "charAt", "(", "0", ")", "!=", "'", "'", ")", "{", "_state", ".", "href", "=", "\"#\"", "+", "getIdForTagId", "(", "_linkName", ")", ";", "}", "else", "{", "_state", ".", "href", "=", "_linkName", ";", "}", "// if the tagId was set then rewrite it and output it.", "if", "(", "_state", ".", "id", "!=", "null", ")", "{", "//_state.id = getIdForTagId(_state.id);", "_state", ".", "name", "=", "_state", ".", "id", ";", "renderNameAndId", "(", "(", "HttpServletRequest", ")", "req", ",", "_state", ",", "null", ")", ";", "//renderDefaultNameAndId((HttpServletRequest) req, _state, _state.id, _state.id);", "}", "// write out the tag.", "WriteRenderAppender", "writer", "=", "new", "WriteRenderAppender", "(", "pageContext", ")", ";", "trb", "=", "TagRenderingBase", ".", "Factory", ".", "getRendering", "(", "TagRenderingBase", ".", "ANCHOR_TAG", ",", "req", ")", ";", "trb", ".", "doStartTag", "(", "writer", ",", "_state", ")", ";", "return", "!", "hasErrors", "(", ")", ";", "}" ]
This method will output an anchor with a fragment identifier. This should be a valid ID within the document. If the name begins with the "#" we will not qualify the set link name. If the name doesn't begin with #, then we will qualify it into the current scope container. @param req The servlet request. @param trb The TagRenderer that will output the link @return return a boolean indicating if an error occurred or not
[ "This", "method", "will", "output", "an", "anchor", "with", "a", "fragment", "identifier", ".", "This", "should", "be", "a", "valid", "ID", "within", "the", "document", ".", "If", "the", "name", "begins", "with", "the", "#", "we", "will", "not", "qualify", "the", "set", "link", "name", ".", "If", "the", "name", "doesn", "t", "begin", "with", "#", "then", "we", "will", "qualify", "it", "into", "the", "current", "scope", "container", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/AnchorBase.java#L555-L581
UrielCh/ovh-java-sdk
ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java
ApiOvhVps.serviceName_disks_id_use_GET
public OvhUnitAndValue<Double> serviceName_disks_id_use_GET(String serviceName, Long id, OvhStatisticTypeEnum type) throws IOException { """ Return many statistics about the disk at that time REST: GET /vps/{serviceName}/disks/{id}/use @param type [required] The type of statistic to be fetched @param serviceName [required] The internal name of your VPS offer @param id [required] Id of the object """ String qPath = "/vps/{serviceName}/disks/{id}/use"; StringBuilder sb = path(qPath, serviceName, id); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
java
public OvhUnitAndValue<Double> serviceName_disks_id_use_GET(String serviceName, Long id, OvhStatisticTypeEnum type) throws IOException { String qPath = "/vps/{serviceName}/disks/{id}/use"; StringBuilder sb = path(qPath, serviceName, id); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
[ "public", "OvhUnitAndValue", "<", "Double", ">", "serviceName_disks_id_use_GET", "(", "String", "serviceName", ",", "Long", "id", ",", "OvhStatisticTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/vps/{serviceName}/disks/{id}/use\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "id", ")", ";", "query", "(", "sb", ",", "\"type\"", ",", "type", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t5", ")", ";", "}" ]
Return many statistics about the disk at that time REST: GET /vps/{serviceName}/disks/{id}/use @param type [required] The type of statistic to be fetched @param serviceName [required] The internal name of your VPS offer @param id [required] Id of the object
[ "Return", "many", "statistics", "about", "the", "disk", "at", "that", "time" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L908-L914
aws/aws-sdk-java
aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/JobExecutionStatusDetails.java
JobExecutionStatusDetails.withDetailsMap
public JobExecutionStatusDetails withDetailsMap(java.util.Map<String, String> detailsMap) { """ <p> The job execution status. </p> @param detailsMap The job execution status. @return Returns a reference to this object so that method calls can be chained together. """ setDetailsMap(detailsMap); return this; }
java
public JobExecutionStatusDetails withDetailsMap(java.util.Map<String, String> detailsMap) { setDetailsMap(detailsMap); return this; }
[ "public", "JobExecutionStatusDetails", "withDetailsMap", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "detailsMap", ")", "{", "setDetailsMap", "(", "detailsMap", ")", ";", "return", "this", ";", "}" ]
<p> The job execution status. </p> @param detailsMap The job execution status. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "job", "execution", "status", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/JobExecutionStatusDetails.java#L70-L73
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java
GVRScriptBehavior.invokeFunction
public boolean invokeFunction(String funcName, Object[] args) { """ Calls a function script associated with this component. The function is called even if the component is not enabled and not attached to a scene object. @param funcName name of script function to call. @param args function parameters as an array of objects. @return true if function was called, false if no such function @see org.gearvrf.script.GVRScriptFile#invokeFunction(String, Object[]) invokeFunction """ mLastError = null; if (mScriptFile != null) { if (mScriptFile.invokeFunction(funcName, args)) { return true; } } mLastError = mScriptFile.getLastError(); if ((mLastError != null) && !mLastError.contains("is not defined")) { getGVRContext().logError(mLastError, this); } return false; }
java
public boolean invokeFunction(String funcName, Object[] args) { mLastError = null; if (mScriptFile != null) { if (mScriptFile.invokeFunction(funcName, args)) { return true; } } mLastError = mScriptFile.getLastError(); if ((mLastError != null) && !mLastError.contains("is not defined")) { getGVRContext().logError(mLastError, this); } return false; }
[ "public", "boolean", "invokeFunction", "(", "String", "funcName", ",", "Object", "[", "]", "args", ")", "{", "mLastError", "=", "null", ";", "if", "(", "mScriptFile", "!=", "null", ")", "{", "if", "(", "mScriptFile", ".", "invokeFunction", "(", "funcName", ",", "args", ")", ")", "{", "return", "true", ";", "}", "}", "mLastError", "=", "mScriptFile", ".", "getLastError", "(", ")", ";", "if", "(", "(", "mLastError", "!=", "null", ")", "&&", "!", "mLastError", ".", "contains", "(", "\"is not defined\"", ")", ")", "{", "getGVRContext", "(", ")", ".", "logError", "(", "mLastError", ",", "this", ")", ";", "}", "return", "false", ";", "}" ]
Calls a function script associated with this component. The function is called even if the component is not enabled and not attached to a scene object. @param funcName name of script function to call. @param args function parameters as an array of objects. @return true if function was called, false if no such function @see org.gearvrf.script.GVRScriptFile#invokeFunction(String, Object[]) invokeFunction
[ "Calls", "a", "function", "script", "associated", "with", "this", "component", ".", "The", "function", "is", "called", "even", "if", "the", "component", "is", "not", "enabled", "and", "not", "attached", "to", "a", "scene", "object", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java#L316-L332
spring-projects/spring-boot
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/neo4j/Neo4jHealthIndicator.java
Neo4jHealthIndicator.extractResult
protected void extractResult(Session session, Health.Builder builder) throws Exception { """ Provide health details using the specified {@link Session} and {@link Builder Builder}. @param session the session to use to execute a cypher statement @param builder the builder to add details to @throws Exception if getting health details failed """ Result result = session.query(CYPHER, Collections.emptyMap()); builder.up().withDetail("nodes", result.queryResults().iterator().next().get("nodes")); }
java
protected void extractResult(Session session, Health.Builder builder) throws Exception { Result result = session.query(CYPHER, Collections.emptyMap()); builder.up().withDetail("nodes", result.queryResults().iterator().next().get("nodes")); }
[ "protected", "void", "extractResult", "(", "Session", "session", ",", "Health", ".", "Builder", "builder", ")", "throws", "Exception", "{", "Result", "result", "=", "session", ".", "query", "(", "CYPHER", ",", "Collections", ".", "emptyMap", "(", ")", ")", ";", "builder", ".", "up", "(", ")", ".", "withDetail", "(", "\"nodes\"", ",", "result", ".", "queryResults", "(", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ".", "get", "(", "\"nodes\"", ")", ")", ";", "}" ]
Provide health details using the specified {@link Session} and {@link Builder Builder}. @param session the session to use to execute a cypher statement @param builder the builder to add details to @throws Exception if getting health details failed
[ "Provide", "health", "details", "using", "the", "specified", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/neo4j/Neo4jHealthIndicator.java#L70-L75
akberc/ceylon-maven-plugin
src/main/java/com/dgwave/car/common/CeylonUtil.java
CeylonUtil.ceylonModuleName
public static String ceylonModuleName(final String groupId, final String artifactId, final String version, final String classifier, final String extension) { """ Comes up with a Ceylon module name based on Maven coordinates. @param groupId Maven group id @param artifactId Maven artifact id @param version Version @param classifier Sources, javadoc etc. @param extension The extension or packaging of the artifact @return String The module name """ if (version == null || "".equals(version) || version.contains("-")) { // TODO fix the '-' based on the new Herd rules throw new IllegalArgumentException(" Null, empty, or '-' is not allowed in version"); } StringBuilder name = new StringBuilder(STRING_BUILDER_SIZE); name.append(ceylonModuleBaseName(groupId, artifactId)) .append(ARTIFACT_SEPARATOR).append(version); if (extension != null) { name.append(GROUP_SEPARATOR).append(extension); } else { name.append(GROUP_SEPARATOR).append("car"); } return name.toString(); }
java
public static String ceylonModuleName(final String groupId, final String artifactId, final String version, final String classifier, final String extension) { if (version == null || "".equals(version) || version.contains("-")) { // TODO fix the '-' based on the new Herd rules throw new IllegalArgumentException(" Null, empty, or '-' is not allowed in version"); } StringBuilder name = new StringBuilder(STRING_BUILDER_SIZE); name.append(ceylonModuleBaseName(groupId, artifactId)) .append(ARTIFACT_SEPARATOR).append(version); if (extension != null) { name.append(GROUP_SEPARATOR).append(extension); } else { name.append(GROUP_SEPARATOR).append("car"); } return name.toString(); }
[ "public", "static", "String", "ceylonModuleName", "(", "final", "String", "groupId", ",", "final", "String", "artifactId", ",", "final", "String", "version", ",", "final", "String", "classifier", ",", "final", "String", "extension", ")", "{", "if", "(", "version", "==", "null", "||", "\"\"", ".", "equals", "(", "version", ")", "||", "version", ".", "contains", "(", "\"-\"", ")", ")", "{", "// TODO fix the '-' based on the new Herd rules\r", "throw", "new", "IllegalArgumentException", "(", "\" Null, empty, or '-' is not allowed in version\"", ")", ";", "}", "StringBuilder", "name", "=", "new", "StringBuilder", "(", "STRING_BUILDER_SIZE", ")", ";", "name", ".", "append", "(", "ceylonModuleBaseName", "(", "groupId", ",", "artifactId", ")", ")", ".", "append", "(", "ARTIFACT_SEPARATOR", ")", ".", "append", "(", "version", ")", ";", "if", "(", "extension", "!=", "null", ")", "{", "name", ".", "append", "(", "GROUP_SEPARATOR", ")", ".", "append", "(", "extension", ")", ";", "}", "else", "{", "name", ".", "append", "(", "GROUP_SEPARATOR", ")", ".", "append", "(", "\"car\"", ")", ";", "}", "return", "name", ".", "toString", "(", ")", ";", "}" ]
Comes up with a Ceylon module name based on Maven coordinates. @param groupId Maven group id @param artifactId Maven artifact id @param version Version @param classifier Sources, javadoc etc. @param extension The extension or packaging of the artifact @return String The module name
[ "Comes", "up", "with", "a", "Ceylon", "module", "name", "based", "on", "Maven", "coordinates", "." ]
train
https://github.com/akberc/ceylon-maven-plugin/blob/b7f6c4a2b24f2fa237350c9e715f4193e83415ef/src/main/java/com/dgwave/car/common/CeylonUtil.java#L141-L161
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.updateVnetRoute
public VnetRouteInner updateVnetRoute(String resourceGroupName, String name, String vnetName, String routeName, VnetRouteInner route) { """ Create or update a Virtual Network route in an App Service plan. Create or update a Virtual Network route in an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param vnetName Name of the Virtual Network. @param routeName Name of the Virtual Network route. @param route Definition of the Virtual Network route. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VnetRouteInner object if successful. """ return updateVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName, route).toBlocking().single().body(); }
java
public VnetRouteInner updateVnetRoute(String resourceGroupName, String name, String vnetName, String routeName, VnetRouteInner route) { return updateVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName, route).toBlocking().single().body(); }
[ "public", "VnetRouteInner", "updateVnetRoute", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "vnetName", ",", "String", "routeName", ",", "VnetRouteInner", "route", ")", "{", "return", "updateVnetRouteWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "vnetName", ",", "routeName", ",", "route", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Create or update a Virtual Network route in an App Service plan. Create or update a Virtual Network route in an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param vnetName Name of the Virtual Network. @param routeName Name of the Virtual Network route. @param route Definition of the Virtual Network route. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VnetRouteInner object if successful.
[ "Create", "or", "update", "a", "Virtual", "Network", "route", "in", "an", "App", "Service", "plan", ".", "Create", "or", "update", "a", "Virtual", "Network", "route", "in", "an", "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#L3811-L3813
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClientAsync.java
ManagementClientAsync.createRuleAsync
public CompletableFuture<RuleDescription> createRuleAsync(String topicName, String subscriptionName, RuleDescription ruleDescription) { """ Creates a new rule for a given topic - subscription. See {@link RuleDescription} for default values of subscription properties. @param topicName - Name of the topic. @param subscriptionName - Name of the subscription. @param ruleDescription - A {@link RuleDescription} object describing the attributes with which the new rule will be created. @return {@link RuleDescription} of the newly created rule. """ return putRuleAsync(topicName, subscriptionName, ruleDescription, false); }
java
public CompletableFuture<RuleDescription> createRuleAsync(String topicName, String subscriptionName, RuleDescription ruleDescription) { return putRuleAsync(topicName, subscriptionName, ruleDescription, false); }
[ "public", "CompletableFuture", "<", "RuleDescription", ">", "createRuleAsync", "(", "String", "topicName", ",", "String", "subscriptionName", ",", "RuleDescription", "ruleDescription", ")", "{", "return", "putRuleAsync", "(", "topicName", ",", "subscriptionName", ",", "ruleDescription", ",", "false", ")", ";", "}" ]
Creates a new rule for a given topic - subscription. See {@link RuleDescription} for default values of subscription properties. @param topicName - Name of the topic. @param subscriptionName - Name of the subscription. @param ruleDescription - A {@link RuleDescription} object describing the attributes with which the new rule will be created. @return {@link RuleDescription} of the newly created rule.
[ "Creates", "a", "new", "rule", "for", "a", "given", "topic", "-", "subscription", ".", "See", "{" ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClientAsync.java#L708-L710
Alluxio/alluxio
core/server/common/src/main/java/alluxio/RestUtils.java
RestUtils.createResponse
private static Response createResponse(Object object, AlluxioConfiguration alluxioConf, @Nullable Map<String, Object> headers) { """ Creates a response using the given object. @param object the object to respond with @return the response """ if (object instanceof Void) { return Response.ok().build(); } if (object instanceof String) { // Need to explicitly encode the string as JSON because Jackson will not do it automatically. ObjectMapper mapper = new ObjectMapper(); try { return Response.ok(mapper.writeValueAsString(object)).build(); } catch (JsonProcessingException e) { return createErrorResponse(e, alluxioConf); } } Response.ResponseBuilder rb = Response.ok(object); if (headers != null) { headers.forEach(rb::header); } if (alluxioConf.getBoolean(PropertyKey.WEBUI_CORS_ENABLED)) { return makeCORS(rb).build(); } return rb.build(); }
java
private static Response createResponse(Object object, AlluxioConfiguration alluxioConf, @Nullable Map<String, Object> headers) { if (object instanceof Void) { return Response.ok().build(); } if (object instanceof String) { // Need to explicitly encode the string as JSON because Jackson will not do it automatically. ObjectMapper mapper = new ObjectMapper(); try { return Response.ok(mapper.writeValueAsString(object)).build(); } catch (JsonProcessingException e) { return createErrorResponse(e, alluxioConf); } } Response.ResponseBuilder rb = Response.ok(object); if (headers != null) { headers.forEach(rb::header); } if (alluxioConf.getBoolean(PropertyKey.WEBUI_CORS_ENABLED)) { return makeCORS(rb).build(); } return rb.build(); }
[ "private", "static", "Response", "createResponse", "(", "Object", "object", ",", "AlluxioConfiguration", "alluxioConf", ",", "@", "Nullable", "Map", "<", "String", ",", "Object", ">", "headers", ")", "{", "if", "(", "object", "instanceof", "Void", ")", "{", "return", "Response", ".", "ok", "(", ")", ".", "build", "(", ")", ";", "}", "if", "(", "object", "instanceof", "String", ")", "{", "// Need to explicitly encode the string as JSON because Jackson will not do it automatically.", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", ")", ";", "try", "{", "return", "Response", ".", "ok", "(", "mapper", ".", "writeValueAsString", "(", "object", ")", ")", ".", "build", "(", ")", ";", "}", "catch", "(", "JsonProcessingException", "e", ")", "{", "return", "createErrorResponse", "(", "e", ",", "alluxioConf", ")", ";", "}", "}", "Response", ".", "ResponseBuilder", "rb", "=", "Response", ".", "ok", "(", "object", ")", ";", "if", "(", "headers", "!=", "null", ")", "{", "headers", ".", "forEach", "(", "rb", "::", "header", ")", ";", "}", "if", "(", "alluxioConf", ".", "getBoolean", "(", "PropertyKey", ".", "WEBUI_CORS_ENABLED", ")", ")", "{", "return", "makeCORS", "(", "rb", ")", ".", "build", "(", ")", ";", "}", "return", "rb", ".", "build", "(", ")", ";", "}" ]
Creates a response using the given object. @param object the object to respond with @return the response
[ "Creates", "a", "response", "using", "the", "given", "object", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/RestUtils.java#L103-L128
aws/aws-sdk-java
aws-java-sdk-devicefarm/src/main/java/com/amazonaws/services/devicefarm/model/GetOfferingStatusResult.java
GetOfferingStatusResult.withCurrent
public GetOfferingStatusResult withCurrent(java.util.Map<String, OfferingStatus> current) { """ <p> When specified, gets the offering status for the current period. </p> @param current When specified, gets the offering status for the current period. @return Returns a reference to this object so that method calls can be chained together. """ setCurrent(current); return this; }
java
public GetOfferingStatusResult withCurrent(java.util.Map<String, OfferingStatus> current) { setCurrent(current); return this; }
[ "public", "GetOfferingStatusResult", "withCurrent", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "OfferingStatus", ">", "current", ")", "{", "setCurrent", "(", "current", ")", ";", "return", "this", ";", "}" ]
<p> When specified, gets the offering status for the current period. </p> @param current When specified, gets the offering status for the current period. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "When", "specified", "gets", "the", "offering", "status", "for", "the", "current", "period", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-devicefarm/src/main/java/com/amazonaws/services/devicefarm/model/GetOfferingStatusResult.java#L84-L87
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.createProjectInfo_GET
public OvhNewProjectInfo createProjectInfo_GET(String voucher) throws IOException { """ Get information about a cloud project creation REST: GET /cloud/createProjectInfo @param voucher [required] Voucher code """ String qPath = "/cloud/createProjectInfo"; StringBuilder sb = path(qPath); query(sb, "voucher", voucher); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhNewProjectInfo.class); }
java
public OvhNewProjectInfo createProjectInfo_GET(String voucher) throws IOException { String qPath = "/cloud/createProjectInfo"; StringBuilder sb = path(qPath); query(sb, "voucher", voucher); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhNewProjectInfo.class); }
[ "public", "OvhNewProjectInfo", "createProjectInfo_GET", "(", "String", "voucher", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/createProjectInfo\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ",", "\"voucher\"", ",", "voucher", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhNewProjectInfo", ".", "class", ")", ";", "}" ]
Get information about a cloud project creation REST: GET /cloud/createProjectInfo @param voucher [required] Voucher code
[ "Get", "information", "about", "a", "cloud", "project", "creation" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2403-L2409
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.enableKeyVaultAsync
public Observable<Void> enableKeyVaultAsync(String resourceGroupName, String accountName) { """ Attempts to enable a user managed key vault for encryption of the specified Data Lake Store account. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account. @param accountName The name of the Data Lake Store account to attempt to enable the Key Vault for. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return enableKeyVaultWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> enableKeyVaultAsync(String resourceGroupName, String accountName) { return enableKeyVaultWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "enableKeyVaultAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ")", "{", "return", "enableKeyVaultWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Attempts to enable a user managed key vault for encryption of the specified Data Lake Store account. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account. @param accountName The name of the Data Lake Store account to attempt to enable the Key Vault for. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Attempts", "to", "enable", "a", "user", "managed", "key", "vault", "for", "encryption", "of", "the", "specified", "Data", "Lake", "Store", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java#L1169-L1176
stripe/stripe-android
stripe/src/main/java/com/stripe/android/PayWithGoogleUtils.java
PayWithGoogleUtils.getPriceString
@NonNull public static String getPriceString(@NonNull long price, @NonNull Currency currency) { """ Converts an integer price in the lowest currency denomination to a Google string value. For instance: (100L, USD) -> "1.00", but (100L, JPY) -> "100". @param price the price in the lowest available currency denomination @param currency the {@link Currency} used to determine how many digits after the decimal @return a String that can be used as a Pay with Google price string """ int fractionDigits = currency.getDefaultFractionDigits(); int totalLength = String.valueOf(price).length(); StringBuilder builder = new StringBuilder(); if (fractionDigits == 0) { for (int i = 0; i < totalLength; i++) { builder.append('#'); } DecimalFormat noDecimalCurrencyFormat = new DecimalFormat(builder.toString()); noDecimalCurrencyFormat.setCurrency(currency); noDecimalCurrencyFormat.setGroupingUsed(false); return noDecimalCurrencyFormat.format(price); } int beforeDecimal = totalLength - fractionDigits; for (int i = 0; i < beforeDecimal; i++) { builder.append('#'); } // So we display "0.55" instead of ".55" if (totalLength <= fractionDigits) { builder.append('0'); } builder.append('.'); for (int i = 0; i < fractionDigits; i++) { builder.append('0'); } double modBreak = Math.pow(10, fractionDigits); double decimalPrice = price / modBreak; // No matter the Locale, Android Pay requires a dot for the decimal separator. DecimalFormatSymbols symbolOverride = new DecimalFormatSymbols(); symbolOverride.setDecimalSeparator('.'); DecimalFormat decimalFormat = new DecimalFormat(builder.toString(), symbolOverride); decimalFormat.setCurrency(currency); decimalFormat.setGroupingUsed(false); return decimalFormat.format(decimalPrice); }
java
@NonNull public static String getPriceString(@NonNull long price, @NonNull Currency currency) { int fractionDigits = currency.getDefaultFractionDigits(); int totalLength = String.valueOf(price).length(); StringBuilder builder = new StringBuilder(); if (fractionDigits == 0) { for (int i = 0; i < totalLength; i++) { builder.append('#'); } DecimalFormat noDecimalCurrencyFormat = new DecimalFormat(builder.toString()); noDecimalCurrencyFormat.setCurrency(currency); noDecimalCurrencyFormat.setGroupingUsed(false); return noDecimalCurrencyFormat.format(price); } int beforeDecimal = totalLength - fractionDigits; for (int i = 0; i < beforeDecimal; i++) { builder.append('#'); } // So we display "0.55" instead of ".55" if (totalLength <= fractionDigits) { builder.append('0'); } builder.append('.'); for (int i = 0; i < fractionDigits; i++) { builder.append('0'); } double modBreak = Math.pow(10, fractionDigits); double decimalPrice = price / modBreak; // No matter the Locale, Android Pay requires a dot for the decimal separator. DecimalFormatSymbols symbolOverride = new DecimalFormatSymbols(); symbolOverride.setDecimalSeparator('.'); DecimalFormat decimalFormat = new DecimalFormat(builder.toString(), symbolOverride); decimalFormat.setCurrency(currency); decimalFormat.setGroupingUsed(false); return decimalFormat.format(decimalPrice); }
[ "@", "NonNull", "public", "static", "String", "getPriceString", "(", "@", "NonNull", "long", "price", ",", "@", "NonNull", "Currency", "currency", ")", "{", "int", "fractionDigits", "=", "currency", ".", "getDefaultFractionDigits", "(", ")", ";", "int", "totalLength", "=", "String", ".", "valueOf", "(", "price", ")", ".", "length", "(", ")", ";", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "fractionDigits", "==", "0", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "totalLength", ";", "i", "++", ")", "{", "builder", ".", "append", "(", "'", "'", ")", ";", "}", "DecimalFormat", "noDecimalCurrencyFormat", "=", "new", "DecimalFormat", "(", "builder", ".", "toString", "(", ")", ")", ";", "noDecimalCurrencyFormat", ".", "setCurrency", "(", "currency", ")", ";", "noDecimalCurrencyFormat", ".", "setGroupingUsed", "(", "false", ")", ";", "return", "noDecimalCurrencyFormat", ".", "format", "(", "price", ")", ";", "}", "int", "beforeDecimal", "=", "totalLength", "-", "fractionDigits", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "beforeDecimal", ";", "i", "++", ")", "{", "builder", ".", "append", "(", "'", "'", ")", ";", "}", "// So we display \"0.55\" instead of \".55\"", "if", "(", "totalLength", "<=", "fractionDigits", ")", "{", "builder", ".", "append", "(", "'", "'", ")", ";", "}", "builder", ".", "append", "(", "'", "'", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fractionDigits", ";", "i", "++", ")", "{", "builder", ".", "append", "(", "'", "'", ")", ";", "}", "double", "modBreak", "=", "Math", ".", "pow", "(", "10", ",", "fractionDigits", ")", ";", "double", "decimalPrice", "=", "price", "/", "modBreak", ";", "// No matter the Locale, Android Pay requires a dot for the decimal separator.", "DecimalFormatSymbols", "symbolOverride", "=", "new", "DecimalFormatSymbols", "(", ")", ";", "symbolOverride", ".", "setDecimalSeparator", "(", "'", "'", ")", ";", "DecimalFormat", "decimalFormat", "=", "new", "DecimalFormat", "(", "builder", ".", "toString", "(", ")", ",", "symbolOverride", ")", ";", "decimalFormat", ".", "setCurrency", "(", "currency", ")", ";", "decimalFormat", ".", "setGroupingUsed", "(", "false", ")", ";", "return", "decimalFormat", ".", "format", "(", "decimalPrice", ")", ";", "}" ]
Converts an integer price in the lowest currency denomination to a Google string value. For instance: (100L, USD) -> "1.00", but (100L, JPY) -> "100". @param price the price in the lowest available currency denomination @param currency the {@link Currency} used to determine how many digits after the decimal @return a String that can be used as a Pay with Google price string
[ "Converts", "an", "integer", "price", "in", "the", "lowest", "currency", "denomination", "to", "a", "Google", "string", "value", ".", "For", "instance", ":", "(", "100L", "USD", ")", "-", ">", "1", ".", "00", "but", "(", "100L", "JPY", ")", "-", ">", "100", "." ]
train
https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/PayWithGoogleUtils.java#L21-L61
lets-blade/blade
src/main/java/com/blade/kit/EncryptKit.java
EncryptKit.hmacSHA256
public static String hmacSHA256(String data, String key) { """ HmacSHA256加密 @param data 明文字符串 @param key 秘钥 @return 16进制密文 """ return hmacSHA256(data.getBytes(), key.getBytes()); }
java
public static String hmacSHA256(String data, String key) { return hmacSHA256(data.getBytes(), key.getBytes()); }
[ "public", "static", "String", "hmacSHA256", "(", "String", "data", ",", "String", "key", ")", "{", "return", "hmacSHA256", "(", "data", ".", "getBytes", "(", ")", ",", "key", ".", "getBytes", "(", ")", ")", ";", "}" ]
HmacSHA256加密 @param data 明文字符串 @param key 秘钥 @return 16进制密文
[ "HmacSHA256加密" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/EncryptKit.java#L360-L362
Coveros/selenified
src/main/java/com/coveros/selenified/Selenified.java
Selenified.addAdditionalDesiredCapabilities
protected static void addAdditionalDesiredCapabilities(Selenified clazz, ITestContext context, String capabilityName, Object capabilityValue) { """ Sets any additional capabilities desired for the browsers. Things like enabling javascript, accepting insecure certs. etc can all be added here on a per test class basis. @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 @param capabilityName - the capability name to be added @param capabilityValue - the capability value to be set """ DesiredCapabilities desiredCapabilities = new DesiredCapabilities(); if (context.getAttributeNames().contains(clazz.getClass().getName() + DESIRED_CAPABILITIES)) { desiredCapabilities = (DesiredCapabilities) context.getAttribute(clazz.getClass().getName() + DESIRED_CAPABILITIES); } desiredCapabilities.setCapability(capabilityName, capabilityValue); context.setAttribute(clazz.getClass().getName() + DESIRED_CAPABILITIES, desiredCapabilities); }
java
protected static void addAdditionalDesiredCapabilities(Selenified clazz, ITestContext context, String capabilityName, Object capabilityValue) { DesiredCapabilities desiredCapabilities = new DesiredCapabilities(); if (context.getAttributeNames().contains(clazz.getClass().getName() + DESIRED_CAPABILITIES)) { desiredCapabilities = (DesiredCapabilities) context.getAttribute(clazz.getClass().getName() + DESIRED_CAPABILITIES); } desiredCapabilities.setCapability(capabilityName, capabilityValue); context.setAttribute(clazz.getClass().getName() + DESIRED_CAPABILITIES, desiredCapabilities); }
[ "protected", "static", "void", "addAdditionalDesiredCapabilities", "(", "Selenified", "clazz", ",", "ITestContext", "context", ",", "String", "capabilityName", ",", "Object", "capabilityValue", ")", "{", "DesiredCapabilities", "desiredCapabilities", "=", "new", "DesiredCapabilities", "(", ")", ";", "if", "(", "context", ".", "getAttributeNames", "(", ")", ".", "contains", "(", "clazz", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "DESIRED_CAPABILITIES", ")", ")", "{", "desiredCapabilities", "=", "(", "DesiredCapabilities", ")", "context", ".", "getAttribute", "(", "clazz", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "DESIRED_CAPABILITIES", ")", ";", "}", "desiredCapabilities", ".", "setCapability", "(", "capabilityName", ",", "capabilityValue", ")", ";", "context", ".", "setAttribute", "(", "clazz", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "DESIRED_CAPABILITIES", ",", "desiredCapabilities", ")", ";", "}" ]
Sets any additional capabilities desired for the browsers. Things like enabling javascript, accepting insecure certs. etc can all be added here on a per test class basis. @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 @param capabilityName - the capability name to be added @param capabilityValue - the capability value to be set
[ "Sets", "any", "additional", "capabilities", "desired", "for", "the", "browsers", ".", "Things", "like", "enabling", "javascript", "accepting", "insecure", "certs", ".", "etc", "can", "all", "be", "added", "here", "on", "a", "per", "test", "class", "basis", "." ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/Selenified.java#L209-L216
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/SegmentMetadataUpdateTransaction.java
SegmentMetadataUpdateTransaction.updateStorageState
void updateStorageState(long storageLength, boolean storageSealed, boolean deleted, boolean storageDeleted) { """ Updates the transaction with the given state of the segment in storage. This method is only meant to be used during recovery mode when we need to restore the state of a segment. During normal operations, these values are set asynchronously by the Writer. @param storageLength The value to set as StorageLength. @param storageSealed The value to set as SealedInStorage. @param deleted The value to set as Deleted. @param storageDeleted The value to set as DeletedInStorage. """ this.storageLength = storageLength; this.sealedInStorage = storageSealed; this.deleted = deleted; this.deletedInStorage = storageDeleted; this.isChanged = true; }
java
void updateStorageState(long storageLength, boolean storageSealed, boolean deleted, boolean storageDeleted) { this.storageLength = storageLength; this.sealedInStorage = storageSealed; this.deleted = deleted; this.deletedInStorage = storageDeleted; this.isChanged = true; }
[ "void", "updateStorageState", "(", "long", "storageLength", ",", "boolean", "storageSealed", ",", "boolean", "deleted", ",", "boolean", "storageDeleted", ")", "{", "this", ".", "storageLength", "=", "storageLength", ";", "this", ".", "sealedInStorage", "=", "storageSealed", ";", "this", ".", "deleted", "=", "deleted", ";", "this", ".", "deletedInStorage", "=", "storageDeleted", ";", "this", ".", "isChanged", "=", "true", ";", "}" ]
Updates the transaction with the given state of the segment in storage. This method is only meant to be used during recovery mode when we need to restore the state of a segment. During normal operations, these values are set asynchronously by the Writer. @param storageLength The value to set as StorageLength. @param storageSealed The value to set as SealedInStorage. @param deleted The value to set as Deleted. @param storageDeleted The value to set as DeletedInStorage.
[ "Updates", "the", "transaction", "with", "the", "given", "state", "of", "the", "segment", "in", "storage", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/SegmentMetadataUpdateTransaction.java#L638-L644
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/color/Histogram_F64.java
Histogram_F64.getDimensionIndex
public int getDimensionIndex( int dimension , int value ) { """ Given a value it returns the corresponding bin index in this histogram for integer values. The discretion is taken in account and 1 is added to the range. @param dimension Which dimension the value belongs to @param value Floating point value between min and max, inclusive. @return The index/bin """ double min = valueMin[dimension]; double max = valueMax[dimension]; double fraction = ((value-min)/(max-min+1.0)); return (int)(fraction*length[dimension]); }
java
public int getDimensionIndex( int dimension , int value ) { double min = valueMin[dimension]; double max = valueMax[dimension]; double fraction = ((value-min)/(max-min+1.0)); return (int)(fraction*length[dimension]); }
[ "public", "int", "getDimensionIndex", "(", "int", "dimension", ",", "int", "value", ")", "{", "double", "min", "=", "valueMin", "[", "dimension", "]", ";", "double", "max", "=", "valueMax", "[", "dimension", "]", ";", "double", "fraction", "=", "(", "(", "value", "-", "min", ")", "/", "(", "max", "-", "min", "+", "1.0", ")", ")", ";", "return", "(", "int", ")", "(", "fraction", "*", "length", "[", "dimension", "]", ")", ";", "}" ]
Given a value it returns the corresponding bin index in this histogram for integer values. The discretion is taken in account and 1 is added to the range. @param dimension Which dimension the value belongs to @param value Floating point value between min and max, inclusive. @return The index/bin
[ "Given", "a", "value", "it", "returns", "the", "corresponding", "bin", "index", "in", "this", "histogram", "for", "integer", "values", ".", "The", "discretion", "is", "taken", "in", "account", "and", "1", "is", "added", "to", "the", "range", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/color/Histogram_F64.java#L184-L190
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryManagerImpl.java
LogRepositoryManagerImpl.addNewFileFromSubProcess
public synchronized String addNewFileFromSubProcess(long spTimeStamp, String spPid, String spLabel) { """ add information about a new file being created by a subProcess in order to maintain retention information. This is done for all files created by each subProcess. If IPC facility is not ready, subProcess may have to create first, then notify when IPC is up. @param spTimeStamp timestamp to associate with the file @param spPid ProcessId of the process that is creating the file (initiator of this action) @param spLabel Label to be used as part of the file name @return the full path of the file subprocess need to use for log records """ // TODO: It is theoretically possible that subProcess already created one of these (although it won't happen in our scenario. // Consider either pulling actual pid from the files on initFileList or looking for the file here before adding it. If found, // adjust the pid to this pid. checkSpaceConstrain(maxLogFileSize) ; if (debugLogger.isLoggable(Level.FINE) && LogRepositoryBaseImpl.isDebugEnabled()) { debugLogger.logp(Level.FINE, thisClass, "addNewFileFromSubProcess", "Tstamp: "+spTimeStamp+ " pid: "+spPid+" lbl: "+spLabel+" Max: "+maxLogFileSize); } if (ivSubDirectory == null) getControllingProcessDirectory(spTimeStamp, svPid) ; // Note: passing, pid of this region, not sending child region if (debugLogger.isLoggable(Level.FINE) && LogRepositoryBaseImpl.isDebugEnabled()) { debugLogger.logp(Level.FINE, thisClass, "addNewFileFromSubProcess", "Got ivSubDir: "+ivSubDirectory.getPath()); } File servantDirectory = new File(ivSubDirectory, getLogDirectoryName(-1, spPid, spLabel)) ; File servantFile = getLogFile(servantDirectory, spTimeStamp) ; FileDetails thisFile = new FileDetails(servantFile, spTimeStamp, maxLogFileSize, spPid) ; synchronized(fileList) { initFileList(false) ; fileList.add(thisFile) ; // Not active as new one was created incrementFileCount(servantFile); synchronized(activeFilesMap) { // In this block so that fileList always locked first activeFilesMap.put(spPid, thisFile) ; } } totalSize += maxLogFileSize ; if (debugLogger.isLoggable(Level.FINE) && LogRepositoryBaseImpl.isDebugEnabled()) { debugLogger.logp(Level.FINE, thisClass, "addNewFileFromSubProcess", "Added file: "+servantFile.getPath()+" sz:"+maxLogFileSize+" tstmp: "+spTimeStamp) ; debugListLL("postAddFromSP") ; debugListHM("postAddFromSP") ; } return servantFile.getPath() ; }
java
public synchronized String addNewFileFromSubProcess(long spTimeStamp, String spPid, String spLabel) { // TODO: It is theoretically possible that subProcess already created one of these (although it won't happen in our scenario. // Consider either pulling actual pid from the files on initFileList or looking for the file here before adding it. If found, // adjust the pid to this pid. checkSpaceConstrain(maxLogFileSize) ; if (debugLogger.isLoggable(Level.FINE) && LogRepositoryBaseImpl.isDebugEnabled()) { debugLogger.logp(Level.FINE, thisClass, "addNewFileFromSubProcess", "Tstamp: "+spTimeStamp+ " pid: "+spPid+" lbl: "+spLabel+" Max: "+maxLogFileSize); } if (ivSubDirectory == null) getControllingProcessDirectory(spTimeStamp, svPid) ; // Note: passing, pid of this region, not sending child region if (debugLogger.isLoggable(Level.FINE) && LogRepositoryBaseImpl.isDebugEnabled()) { debugLogger.logp(Level.FINE, thisClass, "addNewFileFromSubProcess", "Got ivSubDir: "+ivSubDirectory.getPath()); } File servantDirectory = new File(ivSubDirectory, getLogDirectoryName(-1, spPid, spLabel)) ; File servantFile = getLogFile(servantDirectory, spTimeStamp) ; FileDetails thisFile = new FileDetails(servantFile, spTimeStamp, maxLogFileSize, spPid) ; synchronized(fileList) { initFileList(false) ; fileList.add(thisFile) ; // Not active as new one was created incrementFileCount(servantFile); synchronized(activeFilesMap) { // In this block so that fileList always locked first activeFilesMap.put(spPid, thisFile) ; } } totalSize += maxLogFileSize ; if (debugLogger.isLoggable(Level.FINE) && LogRepositoryBaseImpl.isDebugEnabled()) { debugLogger.logp(Level.FINE, thisClass, "addNewFileFromSubProcess", "Added file: "+servantFile.getPath()+" sz:"+maxLogFileSize+" tstmp: "+spTimeStamp) ; debugListLL("postAddFromSP") ; debugListHM("postAddFromSP") ; } return servantFile.getPath() ; }
[ "public", "synchronized", "String", "addNewFileFromSubProcess", "(", "long", "spTimeStamp", ",", "String", "spPid", ",", "String", "spLabel", ")", "{", "// TODO: It is theoretically possible that subProcess already created one of these (although it won't happen in our scenario.", "// Consider either pulling actual pid from the files on initFileList or looking for the file here before adding it. If found,", "// adjust the pid to this pid.", "checkSpaceConstrain", "(", "maxLogFileSize", ")", ";", "if", "(", "debugLogger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "LogRepositoryBaseImpl", ".", "isDebugEnabled", "(", ")", ")", "{", "debugLogger", ".", "logp", "(", "Level", ".", "FINE", ",", "thisClass", ",", "\"addNewFileFromSubProcess\"", ",", "\"Tstamp: \"", "+", "spTimeStamp", "+", "\" pid: \"", "+", "spPid", "+", "\" lbl: \"", "+", "spLabel", "+", "\" Max: \"", "+", "maxLogFileSize", ")", ";", "}", "if", "(", "ivSubDirectory", "==", "null", ")", "getControllingProcessDirectory", "(", "spTimeStamp", ",", "svPid", ")", ";", "// Note: passing, pid of this region, not sending child region", "if", "(", "debugLogger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "LogRepositoryBaseImpl", ".", "isDebugEnabled", "(", ")", ")", "{", "debugLogger", ".", "logp", "(", "Level", ".", "FINE", ",", "thisClass", ",", "\"addNewFileFromSubProcess\"", ",", "\"Got ivSubDir: \"", "+", "ivSubDirectory", ".", "getPath", "(", ")", ")", ";", "}", "File", "servantDirectory", "=", "new", "File", "(", "ivSubDirectory", ",", "getLogDirectoryName", "(", "-", "1", ",", "spPid", ",", "spLabel", ")", ")", ";", "File", "servantFile", "=", "getLogFile", "(", "servantDirectory", ",", "spTimeStamp", ")", ";", "FileDetails", "thisFile", "=", "new", "FileDetails", "(", "servantFile", ",", "spTimeStamp", ",", "maxLogFileSize", ",", "spPid", ")", ";", "synchronized", "(", "fileList", ")", "{", "initFileList", "(", "false", ")", ";", "fileList", ".", "add", "(", "thisFile", ")", ";", "// Not active as new one was created", "incrementFileCount", "(", "servantFile", ")", ";", "synchronized", "(", "activeFilesMap", ")", "{", "// In this block so that fileList always locked first", "activeFilesMap", ".", "put", "(", "spPid", ",", "thisFile", ")", ";", "}", "}", "totalSize", "+=", "maxLogFileSize", ";", "if", "(", "debugLogger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "LogRepositoryBaseImpl", ".", "isDebugEnabled", "(", ")", ")", "{", "debugLogger", ".", "logp", "(", "Level", ".", "FINE", ",", "thisClass", ",", "\"addNewFileFromSubProcess\"", ",", "\"Added file: \"", "+", "servantFile", ".", "getPath", "(", ")", "+", "\" sz:\"", "+", "maxLogFileSize", "+", "\" tstmp: \"", "+", "spTimeStamp", ")", ";", "debugListLL", "(", "\"postAddFromSP\"", ")", ";", "debugListHM", "(", "\"postAddFromSP\"", ")", ";", "}", "return", "servantFile", ".", "getPath", "(", ")", ";", "}" ]
add information about a new file being created by a subProcess in order to maintain retention information. This is done for all files created by each subProcess. If IPC facility is not ready, subProcess may have to create first, then notify when IPC is up. @param spTimeStamp timestamp to associate with the file @param spPid ProcessId of the process that is creating the file (initiator of this action) @param spLabel Label to be used as part of the file name @return the full path of the file subprocess need to use for log records
[ "add", "information", "about", "a", "new", "file", "being", "created", "by", "a", "subProcess", "in", "order", "to", "maintain", "retention", "information", ".", "This", "is", "done", "for", "all", "files", "created", "by", "each", "subProcess", ".", "If", "IPC", "facility", "is", "not", "ready", "subProcess", "may", "have", "to", "create", "first", "then", "notify", "when", "IPC", "is", "up", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryManagerImpl.java#L462-L496
Hygieia/Hygieia
collectors/misc/score/src/main/java/com/capitalone/dashboard/ApplicationScoreService.java
ApplicationScoreService.addSettingsToMap
private void addSettingsToMap(Map<String, ScoreComponentSettings> scoreParamSettingsMap, String widgetType, ScoreComponentSettings scoreComponentSettings) { """ Add settings for widget in map if it exists This map is used to calculate score for team @param scoreParamSettingsMap Map to update the settings for a widget @param widgetType Type of widget @param scoreComponentSettings score settings for the widget """ LOGGER.info("addSettingsToMap with widgetType:" + widgetType + " scoreParamSettings:" + scoreComponentSettings); if (null != scoreComponentSettings) { scoreParamSettingsMap.put(widgetType, scoreComponentSettings); } }
java
private void addSettingsToMap(Map<String, ScoreComponentSettings> scoreParamSettingsMap, String widgetType, ScoreComponentSettings scoreComponentSettings) { LOGGER.info("addSettingsToMap with widgetType:" + widgetType + " scoreParamSettings:" + scoreComponentSettings); if (null != scoreComponentSettings) { scoreParamSettingsMap.put(widgetType, scoreComponentSettings); } }
[ "private", "void", "addSettingsToMap", "(", "Map", "<", "String", ",", "ScoreComponentSettings", ">", "scoreParamSettingsMap", ",", "String", "widgetType", ",", "ScoreComponentSettings", "scoreComponentSettings", ")", "{", "LOGGER", ".", "info", "(", "\"addSettingsToMap with widgetType:\"", "+", "widgetType", "+", "\" scoreParamSettings:\"", "+", "scoreComponentSettings", ")", ";", "if", "(", "null", "!=", "scoreComponentSettings", ")", "{", "scoreParamSettingsMap", ".", "put", "(", "widgetType", ",", "scoreComponentSettings", ")", ";", "}", "}" ]
Add settings for widget in map if it exists This map is used to calculate score for team @param scoreParamSettingsMap Map to update the settings for a widget @param widgetType Type of widget @param scoreComponentSettings score settings for the widget
[ "Add", "settings", "for", "widget", "in", "map", "if", "it", "exists", "This", "map", "is", "used", "to", "calculate", "score", "for", "team" ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/misc/score/src/main/java/com/capitalone/dashboard/ApplicationScoreService.java#L187-L192
dropbox/dropbox-sdk-java
src/main/java/com/dropbox/core/v2/DbxRawClientV2.java
DbxRawClientV2.executeRetriable
private static <T> T executeRetriable(int maxRetries, RetriableExecution<T> execution) throws DbxWrappedException, DbxException { """ Retries the execution at most a maximum number of times. <p> This method is an alternative implementation to {@code DbxRequestUtil.runAndRetry(..)} that does <b>not</b> retry 500 errors ({@link com.dropbox.core.ServerException}). To maintain behavior backwards compatibility in v1, we leave the old implementation in {@code DbxRequestUtil} unchanged. """ if (maxRetries == 0) { return execution.execute(); } int retries = 0; while (true) { try { return execution.execute(); } catch (RetryException ex) { if (retries < maxRetries) { ++retries; sleepQuietlyWithJitter(ex.getBackoffMillis()); } else { throw ex; } } } }
java
private static <T> T executeRetriable(int maxRetries, RetriableExecution<T> execution) throws DbxWrappedException, DbxException { if (maxRetries == 0) { return execution.execute(); } int retries = 0; while (true) { try { return execution.execute(); } catch (RetryException ex) { if (retries < maxRetries) { ++retries; sleepQuietlyWithJitter(ex.getBackoffMillis()); } else { throw ex; } } } }
[ "private", "static", "<", "T", ">", "T", "executeRetriable", "(", "int", "maxRetries", ",", "RetriableExecution", "<", "T", ">", "execution", ")", "throws", "DbxWrappedException", ",", "DbxException", "{", "if", "(", "maxRetries", "==", "0", ")", "{", "return", "execution", ".", "execute", "(", ")", ";", "}", "int", "retries", "=", "0", ";", "while", "(", "true", ")", "{", "try", "{", "return", "execution", ".", "execute", "(", ")", ";", "}", "catch", "(", "RetryException", "ex", ")", "{", "if", "(", "retries", "<", "maxRetries", ")", "{", "++", "retries", ";", "sleepQuietlyWithJitter", "(", "ex", ".", "getBackoffMillis", "(", ")", ")", ";", "}", "else", "{", "throw", "ex", ";", "}", "}", "}", "}" ]
Retries the execution at most a maximum number of times. <p> This method is an alternative implementation to {@code DbxRequestUtil.runAndRetry(..)} that does <b>not</b> retry 500 errors ({@link com.dropbox.core.ServerException}). To maintain behavior backwards compatibility in v1, we leave the old implementation in {@code DbxRequestUtil} unchanged.
[ "Retries", "the", "execution", "at", "most", "a", "maximum", "number", "of", "times", "." ]
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v2/DbxRawClientV2.java#L301-L319
getsentry/sentry-java
sentry/src/main/java/io/sentry/buffer/DiskBuffer.java
DiskBuffer.discard
@Override public void discard(Event event) { """ Deletes a buffered {@link Event} from disk. @param event Event to delete from the disk. """ File eventFile = new File(bufferDir, event.getId().toString() + FILE_SUFFIX); if (eventFile.exists()) { logger.debug("Discarding Event from offline storage: " + eventFile.getAbsolutePath()); if (!eventFile.delete()) { logger.warn("Failed to delete Event: " + eventFile.getAbsolutePath()); } } }
java
@Override public void discard(Event event) { File eventFile = new File(bufferDir, event.getId().toString() + FILE_SUFFIX); if (eventFile.exists()) { logger.debug("Discarding Event from offline storage: " + eventFile.getAbsolutePath()); if (!eventFile.delete()) { logger.warn("Failed to delete Event: " + eventFile.getAbsolutePath()); } } }
[ "@", "Override", "public", "void", "discard", "(", "Event", "event", ")", "{", "File", "eventFile", "=", "new", "File", "(", "bufferDir", ",", "event", ".", "getId", "(", ")", ".", "toString", "(", ")", "+", "FILE_SUFFIX", ")", ";", "if", "(", "eventFile", ".", "exists", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Discarding Event from offline storage: \"", "+", "eventFile", ".", "getAbsolutePath", "(", ")", ")", ";", "if", "(", "!", "eventFile", ".", "delete", "(", ")", ")", "{", "logger", ".", "warn", "(", "\"Failed to delete Event: \"", "+", "eventFile", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "}", "}" ]
Deletes a buffered {@link Event} from disk. @param event Event to delete from the disk.
[ "Deletes", "a", "buffered", "{", "@link", "Event", "}", "from", "disk", "." ]
train
https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/buffer/DiskBuffer.java#L94-L103
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.dedicated_server_serviceName_staticIP_duration_GET
public OvhOrder dedicated_server_serviceName_staticIP_duration_GET(String serviceName, String duration, OvhIpStaticCountryEnum country) throws IOException { """ Get prices and contracts information REST: GET /order/dedicated/server/{serviceName}/staticIP/{duration} @param country [required] Ip localization @param serviceName [required] The internal name of your dedicated server @param duration [required] Duration """ String qPath = "/order/dedicated/server/{serviceName}/staticIP/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "country", country); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder dedicated_server_serviceName_staticIP_duration_GET(String serviceName, String duration, OvhIpStaticCountryEnum country) throws IOException { String qPath = "/order/dedicated/server/{serviceName}/staticIP/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "country", country); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "dedicated_server_serviceName_staticIP_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhIpStaticCountryEnum", "country", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/dedicated/server/{serviceName}/staticIP/{duration}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "duration", ")", ";", "query", "(", "sb", ",", "\"country\"", ",", "country", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/dedicated/server/{serviceName}/staticIP/{duration} @param country [required] Ip localization @param serviceName [required] The internal name of your dedicated server @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2290-L2296
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintTabbedPaneTabAreaBackground
public void paintTabbedPaneTabAreaBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { """ Paints the background of the area behind the tabs of a tabbed pane. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to """ paintBackground(context, g, x, y, w, h, null); }
java
public void paintTabbedPaneTabAreaBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { paintBackground(context, g, x, y, w, h, null); }
[ "public", "void", "paintTabbedPaneTabAreaBackground", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "paintBackground", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "null", ")", ";", "}" ]
Paints the background of the area behind the tabs of a tabbed pane. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to
[ "Paints", "the", "background", "of", "the", "area", "behind", "the", "tabs", "of", "a", "tabbed", "pane", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1956-L1958
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/VoiceApi.java
VoiceApi.updateUserData
public ApiSuccessResponse updateUserData(String id, UserDataOperationId userData) throws ApiException { """ Update user data for a call Update call data with the provided key/value pairs. This replaces any existing key/value pairs with the same keys. @param id The connection ID of the call. (required) @param userData The data to update. This is an array of objects with the properties key, type, and value. (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<ApiSuccessResponse> resp = updateUserDataWithHttpInfo(id, userData); return resp.getData(); }
java
public ApiSuccessResponse updateUserData(String id, UserDataOperationId userData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = updateUserDataWithHttpInfo(id, userData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "updateUserData", "(", "String", "id", ",", "UserDataOperationId", "userData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "updateUserDataWithHttpInfo", "(", "id", ",", "userData", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Update user data for a call Update call data with the provided key/value pairs. This replaces any existing key/value pairs with the same keys. @param id The connection ID of the call. (required) @param userData The data to update. This is an array of objects with the properties key, type, and value. (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Update", "user", "data", "for", "a", "call", "Update", "call", "data", "with", "the", "provided", "key", "/", "value", "pairs", ".", "This", "replaces", "any", "existing", "key", "/", "value", "pairs", "with", "the", "same", "keys", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L5358-L5361
Cornutum/tcases
tcases-maven-plugin/src/main/java/org/cornutum/tcases/maven/TcasesMojo.java
TcasesMojo.getTargetDir
private File getTargetDir( File path) { """ If the given path is not absolute, returns it as an absolute path relative to the project target directory. Otherwise, returns the given absolute path. """ return path == null? targetDir_ : path.isAbsolute()? path : new File( targetDir_, path.getPath()); }
java
private File getTargetDir( File path) { return path == null? targetDir_ : path.isAbsolute()? path : new File( targetDir_, path.getPath()); }
[ "private", "File", "getTargetDir", "(", "File", "path", ")", "{", "return", "path", "==", "null", "?", "targetDir_", ":", "path", ".", "isAbsolute", "(", ")", "?", "path", ":", "new", "File", "(", "targetDir_", ",", "path", ".", "getPath", "(", ")", ")", ";", "}" ]
If the given path is not absolute, returns it as an absolute path relative to the project target directory. Otherwise, returns the given absolute path.
[ "If", "the", "given", "path", "is", "not", "absolute", "returns", "it", "as", "an", "absolute", "path", "relative", "to", "the", "project", "target", "directory", ".", "Otherwise", "returns", "the", "given", "absolute", "path", "." ]
train
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-maven-plugin/src/main/java/org/cornutum/tcases/maven/TcasesMojo.java#L197-L207
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deleteCompositeEntityChildAsync
public Observable<OperationStatus> deleteCompositeEntityChildAsync(UUID appId, String versionId, UUID cEntityId, UUID cChildId) { """ Deletes a composite entity extractor child from the application. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @param cChildId The hierarchical entity extractor child ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object """ return deleteCompositeEntityChildWithServiceResponseAsync(appId, versionId, cEntityId, cChildId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> deleteCompositeEntityChildAsync(UUID appId, String versionId, UUID cEntityId, UUID cChildId) { return deleteCompositeEntityChildWithServiceResponseAsync(appId, versionId, cEntityId, cChildId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "deleteCompositeEntityChildAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "cEntityId", ",", "UUID", "cChildId", ")", "{", "return", "deleteCompositeEntityChildWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "cEntityId", ",", "cChildId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "OperationStatus", ">", ",", "OperationStatus", ">", "(", ")", "{", "@", "Override", "public", "OperationStatus", "call", "(", "ServiceResponse", "<", "OperationStatus", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Deletes a composite entity extractor child from the application. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @param cChildId The hierarchical entity extractor child ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Deletes", "a", "composite", "entity", "extractor", "child", "from", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L7051-L7058
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/converters/MultiConverter.java
MultiConverter.addConverter
public void addConverter(int index, IConverter converter) { """ add converter at given index. The index can be changed during conversion if canReorder is true @param index @param converter """ converterList.add(index, converter); if (converter instanceof IContainerConverter) { IContainerConverter containerConverter = (IContainerConverter) converter; if (containerConverter.getElementConverter() == null) { containerConverter.setElementConverter(elementConverter); } } }
java
public void addConverter(int index, IConverter converter) { converterList.add(index, converter); if (converter instanceof IContainerConverter) { IContainerConverter containerConverter = (IContainerConverter) converter; if (containerConverter.getElementConverter() == null) { containerConverter.setElementConverter(elementConverter); } } }
[ "public", "void", "addConverter", "(", "int", "index", ",", "IConverter", "converter", ")", "{", "converterList", ".", "add", "(", "index", ",", "converter", ")", ";", "if", "(", "converter", "instanceof", "IContainerConverter", ")", "{", "IContainerConverter", "containerConverter", "=", "(", "IContainerConverter", ")", "converter", ";", "if", "(", "containerConverter", ".", "getElementConverter", "(", ")", "==", "null", ")", "{", "containerConverter", ".", "setElementConverter", "(", "elementConverter", ")", ";", "}", "}", "}" ]
add converter at given index. The index can be changed during conversion if canReorder is true @param index @param converter
[ "add", "converter", "at", "given", "index", ".", "The", "index", "can", "be", "changed", "during", "conversion", "if", "canReorder", "is", "true" ]
train
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/converters/MultiConverter.java#L60-L68
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/Mapper.java
Mapper.keyNotNull
@SuppressWarnings("unchecked") public Mapper<K, V> keyNotNull() { """ Add a constraint that verifies that the key is null. If is null, a {@link NullPointerException} is thrown. @return """ return addConstraint((MapConstraint<K, V>) KeyNotNullRestraint.INSTANCE); }
java
@SuppressWarnings("unchecked") public Mapper<K, V> keyNotNull() { return addConstraint((MapConstraint<K, V>) KeyNotNullRestraint.INSTANCE); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "Mapper", "<", "K", ",", "V", ">", "keyNotNull", "(", ")", "{", "return", "addConstraint", "(", "(", "MapConstraint", "<", "K", ",", "V", ">", ")", "KeyNotNullRestraint", ".", "INSTANCE", ")", ";", "}" ]
Add a constraint that verifies that the key is null. If is null, a {@link NullPointerException} is thrown. @return
[ "Add", "a", "constraint", "that", "verifies", "that", "the", "key", "is", "null", ".", "If", "is", "null", "a", "{", "@link", "NullPointerException", "}", "is", "thrown", "." ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/Mapper.java#L124-L127
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/HFClient.java
HFClient.newPeer
public Peer newPeer(String name, String grpcURL) throws InvalidArgumentException { """ newPeer create a new peer @param name @param grpcURL to the peer's location @return Peer @throws InvalidArgumentException """ clientCheck(); return Peer.createNewInstance(name, grpcURL, null); }
java
public Peer newPeer(String name, String grpcURL) throws InvalidArgumentException { clientCheck(); return Peer.createNewInstance(name, grpcURL, null); }
[ "public", "Peer", "newPeer", "(", "String", "name", ",", "String", "grpcURL", ")", "throws", "InvalidArgumentException", "{", "clientCheck", "(", ")", ";", "return", "Peer", ".", "createNewInstance", "(", "name", ",", "grpcURL", ",", "null", ")", ";", "}" ]
newPeer create a new peer @param name @param grpcURL to the peer's location @return Peer @throws InvalidArgumentException
[ "newPeer", "create", "a", "new", "peer" ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/HFClient.java#L406-L409
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java
AgentUtils.copyInstanceResources
public static void copyInstanceResources( Instance instance, Map<String,byte[]> fileNameToFileContent ) throws IOException { """ Copies the resources of an instance on the disk. @param instance an instance @param fileNameToFileContent the files to write down (key = relative file location, value = file's content) @throws IOException if the copy encountered a problem """ File dir = InstanceHelpers.findInstanceDirectoryOnAgent( instance ); Utils.createDirectory( dir ); if( fileNameToFileContent != null ) { for( Map.Entry<String,byte[]> entry : fileNameToFileContent.entrySet()) { File f = new File( dir, entry.getKey()); Utils.createDirectory( f.getParentFile()); ByteArrayInputStream in = new ByteArrayInputStream( entry.getValue()); Utils.copyStream( in, f ); } } }
java
public static void copyInstanceResources( Instance instance, Map<String,byte[]> fileNameToFileContent ) throws IOException { File dir = InstanceHelpers.findInstanceDirectoryOnAgent( instance ); Utils.createDirectory( dir ); if( fileNameToFileContent != null ) { for( Map.Entry<String,byte[]> entry : fileNameToFileContent.entrySet()) { File f = new File( dir, entry.getKey()); Utils.createDirectory( f.getParentFile()); ByteArrayInputStream in = new ByteArrayInputStream( entry.getValue()); Utils.copyStream( in, f ); } } }
[ "public", "static", "void", "copyInstanceResources", "(", "Instance", "instance", ",", "Map", "<", "String", ",", "byte", "[", "]", ">", "fileNameToFileContent", ")", "throws", "IOException", "{", "File", "dir", "=", "InstanceHelpers", ".", "findInstanceDirectoryOnAgent", "(", "instance", ")", ";", "Utils", ".", "createDirectory", "(", "dir", ")", ";", "if", "(", "fileNameToFileContent", "!=", "null", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "byte", "[", "]", ">", "entry", ":", "fileNameToFileContent", ".", "entrySet", "(", ")", ")", "{", "File", "f", "=", "new", "File", "(", "dir", ",", "entry", ".", "getKey", "(", ")", ")", ";", "Utils", ".", "createDirectory", "(", "f", ".", "getParentFile", "(", ")", ")", ";", "ByteArrayInputStream", "in", "=", "new", "ByteArrayInputStream", "(", "entry", ".", "getValue", "(", ")", ")", ";", "Utils", ".", "copyStream", "(", "in", ",", "f", ")", ";", "}", "}", "}" ]
Copies the resources of an instance on the disk. @param instance an instance @param fileNameToFileContent the files to write down (key = relative file location, value = file's content) @throws IOException if the copy encountered a problem
[ "Copies", "the", "resources", "of", "an", "instance", "on", "the", "disk", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java#L103-L119
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java
RulesProfile.getActiveRule
@CheckForNull public ActiveRule getActiveRule(String repositoryKey, String ruleKey) { """ Note: disabled rules are excluded. @return an active rule from a plugin key and a rule key if the rule is activated, null otherwise """ for (ActiveRule activeRule : activeRules) { if (StringUtils.equals(activeRule.getRepositoryKey(), repositoryKey) && StringUtils.equals(activeRule.getRuleKey(), ruleKey) && activeRule.isEnabled()) { return activeRule; } } return null; }
java
@CheckForNull public ActiveRule getActiveRule(String repositoryKey, String ruleKey) { for (ActiveRule activeRule : activeRules) { if (StringUtils.equals(activeRule.getRepositoryKey(), repositoryKey) && StringUtils.equals(activeRule.getRuleKey(), ruleKey) && activeRule.isEnabled()) { return activeRule; } } return null; }
[ "@", "CheckForNull", "public", "ActiveRule", "getActiveRule", "(", "String", "repositoryKey", ",", "String", "ruleKey", ")", "{", "for", "(", "ActiveRule", "activeRule", ":", "activeRules", ")", "{", "if", "(", "StringUtils", ".", "equals", "(", "activeRule", ".", "getRepositoryKey", "(", ")", ",", "repositoryKey", ")", "&&", "StringUtils", ".", "equals", "(", "activeRule", ".", "getRuleKey", "(", ")", ",", "ruleKey", ")", "&&", "activeRule", ".", "isEnabled", "(", ")", ")", "{", "return", "activeRule", ";", "}", "}", "return", "null", ";", "}" ]
Note: disabled rules are excluded. @return an active rule from a plugin key and a rule key if the rule is activated, null otherwise
[ "Note", ":", "disabled", "rules", "are", "excluded", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java#L271-L279
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/document/RtfDocumentSettings.java
RtfDocumentSettings.setProtection
public boolean setProtection(int level, String pwd) { """ Author: Howard Shank ([email protected]) @param level Document protecton level @param pwd Document password - clear text @since 2.1.1 """ boolean result = false; if(this.protectionHash == null) { if(!setProtectionLevel(level)) { result = false; } else { protectionHash = RtfProtection.generateHash(pwd); result = true; } } else { if(this.protectionHash.equals(RtfProtection.generateHash(pwd))) { if(!setProtectionLevel(level)) { result = false; } else { protectionHash = RtfProtection.generateHash(pwd); result = true; } } } return result; }
java
public boolean setProtection(int level, String pwd) { boolean result = false; if(this.protectionHash == null) { if(!setProtectionLevel(level)) { result = false; } else { protectionHash = RtfProtection.generateHash(pwd); result = true; } } else { if(this.protectionHash.equals(RtfProtection.generateHash(pwd))) { if(!setProtectionLevel(level)) { result = false; } else { protectionHash = RtfProtection.generateHash(pwd); result = true; } } } return result; }
[ "public", "boolean", "setProtection", "(", "int", "level", ",", "String", "pwd", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "this", ".", "protectionHash", "==", "null", ")", "{", "if", "(", "!", "setProtectionLevel", "(", "level", ")", ")", "{", "result", "=", "false", ";", "}", "else", "{", "protectionHash", "=", "RtfProtection", ".", "generateHash", "(", "pwd", ")", ";", "result", "=", "true", ";", "}", "}", "else", "{", "if", "(", "this", ".", "protectionHash", ".", "equals", "(", "RtfProtection", ".", "generateHash", "(", "pwd", ")", ")", ")", "{", "if", "(", "!", "setProtectionLevel", "(", "level", ")", ")", "{", "result", "=", "false", ";", "}", "else", "{", "protectionHash", "=", "RtfProtection", ".", "generateHash", "(", "pwd", ")", ";", "result", "=", "true", ";", "}", "}", "}", "return", "result", ";", "}" ]
Author: Howard Shank ([email protected]) @param level Document protecton level @param pwd Document password - clear text @since 2.1.1
[ "Author", ":", "Howard", "Shank", "(", "hgshank" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/document/RtfDocumentSettings.java#L353-L378
Whiley/WhileyCompiler
src/main/java/wyil/util/AbstractTypedVisitor.java
AbstractTypedVisitor.selectRecord
public Type.Record selectRecord(Type target, Expr expr, Environment environment) { """ <p> Given an arbitrary target type, filter out the target record types. For example, consider the following method: </p> <pre> method f(int x): {int f}|null xs = {f: x} ... </pre> <p> When type checking the expression <code>{f: x}</code> the flow type checker will attempt to determine an <i>expected</i> record type. In order to then determine the appropriate expected type for field initialiser expression <code>x</code> it filters <code>{int f}|null</code> down to just <code>{int f}</code>. </p> @param target Target type for this value @param expr Source expression for this value @author David J. Pearce """ Type.Record type = asType(expr.getType(), Type.Record.class); Type.Record[] records = TYPE_RECORD_FILTER.apply(target); return selectCandidate(records, type, environment); }
java
public Type.Record selectRecord(Type target, Expr expr, Environment environment) { Type.Record type = asType(expr.getType(), Type.Record.class); Type.Record[] records = TYPE_RECORD_FILTER.apply(target); return selectCandidate(records, type, environment); }
[ "public", "Type", ".", "Record", "selectRecord", "(", "Type", "target", ",", "Expr", "expr", ",", "Environment", "environment", ")", "{", "Type", ".", "Record", "type", "=", "asType", "(", "expr", ".", "getType", "(", ")", ",", "Type", ".", "Record", ".", "class", ")", ";", "Type", ".", "Record", "[", "]", "records", "=", "TYPE_RECORD_FILTER", ".", "apply", "(", "target", ")", ";", "return", "selectCandidate", "(", "records", ",", "type", ",", "environment", ")", ";", "}" ]
<p> Given an arbitrary target type, filter out the target record types. For example, consider the following method: </p> <pre> method f(int x): {int f}|null xs = {f: x} ... </pre> <p> When type checking the expression <code>{f: x}</code> the flow type checker will attempt to determine an <i>expected</i> record type. In order to then determine the appropriate expected type for field initialiser expression <code>x</code> it filters <code>{int f}|null</code> down to just <code>{int f}</code>. </p> @param target Target type for this value @param expr Source expression for this value @author David J. Pearce
[ "<p", ">", "Given", "an", "arbitrary", "target", "type", "filter", "out", "the", "target", "record", "types", ".", "For", "example", "consider", "the", "following", "method", ":", "<", "/", "p", ">" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/util/AbstractTypedVisitor.java#L1140-L1144
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSpellcheckDictionaryIndexer.java
CmsSpellcheckDictionaryIndexer.addDocuments
static void addDocuments(SolrClient client, List<SolrInputDocument> documents, boolean commit) throws IOException, SolrServerException { """ Add a list of documents to the Solr client.<p> @param client The SolrClient instance object. @param documents The documents that should be added. @param commit boolean flag indicating whether a "commit" call should be made after adding the documents @throws IOException in case something goes wrong @throws SolrServerException in case something goes wrong """ if ((null == client) || (null == documents)) { return; } if (!documents.isEmpty()) { client.add(documents); } if (commit) { client.commit(); } }
java
static void addDocuments(SolrClient client, List<SolrInputDocument> documents, boolean commit) throws IOException, SolrServerException { if ((null == client) || (null == documents)) { return; } if (!documents.isEmpty()) { client.add(documents); } if (commit) { client.commit(); } }
[ "static", "void", "addDocuments", "(", "SolrClient", "client", ",", "List", "<", "SolrInputDocument", ">", "documents", ",", "boolean", "commit", ")", "throws", "IOException", ",", "SolrServerException", "{", "if", "(", "(", "null", "==", "client", ")", "||", "(", "null", "==", "documents", ")", ")", "{", "return", ";", "}", "if", "(", "!", "documents", ".", "isEmpty", "(", ")", ")", "{", "client", ".", "add", "(", "documents", ")", ";", "}", "if", "(", "commit", ")", "{", "client", ".", "commit", "(", ")", ";", "}", "}" ]
Add a list of documents to the Solr client.<p> @param client The SolrClient instance object. @param documents The documents that should be added. @param commit boolean flag indicating whether a "commit" call should be made after adding the documents @throws IOException in case something goes wrong @throws SolrServerException in case something goes wrong
[ "Add", "a", "list", "of", "documents", "to", "the", "Solr", "client", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSpellcheckDictionaryIndexer.java#L265-L279
korpling/ANNIS
annis-service/src/main/java/annis/sqlgen/SaltAnnotateExtractor.java
SaltAnnotateExtractor.addMatchInformation
public static void addMatchInformation(SaltProject p, MatchGroup matchGroup) { """ Sets additional match (global) information about the matched nodes and annotations. This will add the {@link AnnisConstants#FEAT_MATCHEDIDS) to all {@link SDocument} elements of the salt project. @param p The salt project to add the features to. @param matchGroup A list of matches in the same order as the corpus graphs of the salt project. """ int matchIndex = 0; for (Match m : matchGroup.getMatches()) { // get the corresponding SDocument of the salt project SCorpusGraph corpusGraph = p.getCorpusGraphs().get(matchIndex); SDocument doc = corpusGraph.getDocuments().get(0); setMatchedIDs(doc.getDocumentGraph(), m); matchIndex++; } }
java
public static void addMatchInformation(SaltProject p, MatchGroup matchGroup) { int matchIndex = 0; for (Match m : matchGroup.getMatches()) { // get the corresponding SDocument of the salt project SCorpusGraph corpusGraph = p.getCorpusGraphs().get(matchIndex); SDocument doc = corpusGraph.getDocuments().get(0); setMatchedIDs(doc.getDocumentGraph(), m); matchIndex++; } }
[ "public", "static", "void", "addMatchInformation", "(", "SaltProject", "p", ",", "MatchGroup", "matchGroup", ")", "{", "int", "matchIndex", "=", "0", ";", "for", "(", "Match", "m", ":", "matchGroup", ".", "getMatches", "(", ")", ")", "{", "// get the corresponding SDocument of the salt project ", "SCorpusGraph", "corpusGraph", "=", "p", ".", "getCorpusGraphs", "(", ")", ".", "get", "(", "matchIndex", ")", ";", "SDocument", "doc", "=", "corpusGraph", ".", "getDocuments", "(", ")", ".", "get", "(", "0", ")", ";", "setMatchedIDs", "(", "doc", ".", "getDocumentGraph", "(", ")", ",", "m", ")", ";", "matchIndex", "++", ";", "}", "}" ]
Sets additional match (global) information about the matched nodes and annotations. This will add the {@link AnnisConstants#FEAT_MATCHEDIDS) to all {@link SDocument} elements of the salt project. @param p The salt project to add the features to. @param matchGroup A list of matches in the same order as the corpus graphs of the salt project.
[ "Sets", "additional", "match", "(", "global", ")", "information", "about", "the", "matched", "nodes", "and", "annotations", "." ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-service/src/main/java/annis/sqlgen/SaltAnnotateExtractor.java#L1116-L1129
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getDeletedStorageAccountAsync
public Observable<DeletedStorageBundle> getDeletedStorageAccountAsync(String vaultBaseUrl, String storageAccountName) { """ Gets the specified deleted storage account. The Get Deleted Storage Account operation returns the specified deleted storage account along with its attributes. This operation requires the storage/get permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DeletedStorageBundle object """ return getDeletedStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).map(new Func1<ServiceResponse<DeletedStorageBundle>, DeletedStorageBundle>() { @Override public DeletedStorageBundle call(ServiceResponse<DeletedStorageBundle> response) { return response.body(); } }); }
java
public Observable<DeletedStorageBundle> getDeletedStorageAccountAsync(String vaultBaseUrl, String storageAccountName) { return getDeletedStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).map(new Func1<ServiceResponse<DeletedStorageBundle>, DeletedStorageBundle>() { @Override public DeletedStorageBundle call(ServiceResponse<DeletedStorageBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DeletedStorageBundle", ">", "getDeletedStorageAccountAsync", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ")", "{", "return", "getDeletedStorageAccountWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "storageAccountName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DeletedStorageBundle", ">", ",", "DeletedStorageBundle", ">", "(", ")", "{", "@", "Override", "public", "DeletedStorageBundle", "call", "(", "ServiceResponse", "<", "DeletedStorageBundle", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the specified deleted storage account. The Get Deleted Storage Account operation returns the specified deleted storage account along with its attributes. This operation requires the storage/get permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DeletedStorageBundle object
[ "Gets", "the", "specified", "deleted", "storage", "account", ".", "The", "Get", "Deleted", "Storage", "Account", "operation", "returns", "the", "specified", "deleted", "storage", "account", "along", "with", "its", "attributes", ".", "This", "operation", "requires", "the", "storage", "/", "get", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L9284-L9291
sdaschner/jaxrs-analyzer
src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java
ProjectAnalyzer.addJarClasses
private void addJarClasses(final Path location) { """ Adds all classes in the given jar-file location to the set of known classes. @param location The location of the jar-file """ try (final JarFile jarFile = new JarFile(location.toFile())) { final Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { final JarEntry entry = entries.nextElement(); final String entryName = entry.getName(); if (entryName.endsWith(".class")) classes.add(toQualifiedClassName(entryName)); } } catch (IOException e) { throw new IllegalArgumentException("Could not read jar-file '" + location + "', reason: " + e.getMessage()); } }
java
private void addJarClasses(final Path location) { try (final JarFile jarFile = new JarFile(location.toFile())) { final Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { final JarEntry entry = entries.nextElement(); final String entryName = entry.getName(); if (entryName.endsWith(".class")) classes.add(toQualifiedClassName(entryName)); } } catch (IOException e) { throw new IllegalArgumentException("Could not read jar-file '" + location + "', reason: " + e.getMessage()); } }
[ "private", "void", "addJarClasses", "(", "final", "Path", "location", ")", "{", "try", "(", "final", "JarFile", "jarFile", "=", "new", "JarFile", "(", "location", ".", "toFile", "(", ")", ")", ")", "{", "final", "Enumeration", "<", "JarEntry", ">", "entries", "=", "jarFile", ".", "entries", "(", ")", ";", "while", "(", "entries", ".", "hasMoreElements", "(", ")", ")", "{", "final", "JarEntry", "entry", "=", "entries", ".", "nextElement", "(", ")", ";", "final", "String", "entryName", "=", "entry", ".", "getName", "(", ")", ";", "if", "(", "entryName", ".", "endsWith", "(", "\".class\"", ")", ")", "classes", ".", "add", "(", "toQualifiedClassName", "(", "entryName", ")", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Could not read jar-file '\"", "+", "location", "+", "\"', reason: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Adds all classes in the given jar-file location to the set of known classes. @param location The location of the jar-file
[ "Adds", "all", "classes", "in", "the", "given", "jar", "-", "file", "location", "to", "the", "set", "of", "known", "classes", "." ]
train
https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java#L169-L181
alibaba/ARouter
arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java
Postcard.withFloat
public Postcard withFloat(@Nullable String key, float value) { """ Inserts a float value into the mapping of this Bundle, replacing any existing value for the given key. @param key a String, or null @param value a float @return current """ mBundle.putFloat(key, value); return this; }
java
public Postcard withFloat(@Nullable String key, float value) { mBundle.putFloat(key, value); return this; }
[ "public", "Postcard", "withFloat", "(", "@", "Nullable", "String", "key", ",", "float", "value", ")", "{", "mBundle", ".", "putFloat", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a float value into the mapping of this Bundle, replacing any existing value for the given key. @param key a String, or null @param value a float @return current
[ "Inserts", "a", "float", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", "." ]
train
https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L348-L351
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/SecurityRulesInner.java
SecurityRulesInner.createOrUpdate
public SecurityRuleInner createOrUpdate(String resourceGroupName, String networkSecurityGroupName, String securityRuleName, SecurityRuleInner securityRuleParameters) { """ Creates or updates a security rule in the specified network security group. @param resourceGroupName The name of the resource group. @param networkSecurityGroupName The name of the network security group. @param securityRuleName The name of the security rule. @param securityRuleParameters Parameters supplied to the create or update network security rule operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SecurityRuleInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters).toBlocking().last().body(); }
java
public SecurityRuleInner createOrUpdate(String resourceGroupName, String networkSecurityGroupName, String securityRuleName, SecurityRuleInner securityRuleParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters).toBlocking().last().body(); }
[ "public", "SecurityRuleInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "networkSecurityGroupName", ",", "String", "securityRuleName", ",", "SecurityRuleInner", "securityRuleParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkSecurityGroupName", ",", "securityRuleName", ",", "securityRuleParameters", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates or updates a security rule in the specified network security group. @param resourceGroupName The name of the resource group. @param networkSecurityGroupName The name of the network security group. @param securityRuleName The name of the security rule. @param securityRuleParameters Parameters supplied to the create or update network security rule operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SecurityRuleInner object if successful.
[ "Creates", "or", "updates", "a", "security", "rule", "in", "the", "specified", "network", "security", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/SecurityRulesInner.java#L362-L364
alkacon/opencms-core
src/org/opencms/workplace/galleries/CmsOpenGallery.java
CmsOpenGallery.openGallery
public String openGallery() { """ Generates a javascript window open for the requested gallery type.<p> @return a javascript window open for the requested gallery type """ StringBuffer jsOpener = new StringBuffer(32); String galleryType = null; try { CmsResource res = getCms().readResource(getParamResource()); if (res != null) { // get gallery path String galleryPath = getParamResource(); if (!galleryPath.endsWith("/")) { galleryPath += "/"; } // get the matching gallery type name galleryType = OpenCms.getResourceManager().getResourceType(res.getTypeId()).getTypeName(); StringBuffer galleryUri = new StringBuffer(256); galleryUri.append(A_CmsAjaxGallery.PATH_GALLERIES); String width = "650"; String height = "700"; // path to the gallery dialog with the required request parameters galleryUri.append(galleryType); galleryUri.append("/index.jsp?"); galleryUri.append(A_CmsAjaxGallery.PARAM_DIALOGMODE); galleryUri.append("="); galleryUri.append(A_CmsAjaxGallery.MODE_VIEW); galleryUri.append("&"); galleryUri.append(A_CmsAjaxGallery.PARAM_PARAMS); galleryUri.append("="); JSONObject jsonObj = new JSONObject(); try { jsonObj.putOpt(A_CmsAjaxGallery.PARAM_STARTUPFOLDER, galleryPath); jsonObj.putOpt(A_CmsAjaxGallery.PARAM_STARTUPTYPE, A_CmsAjaxGallery.LISTMODE_GALLERY); } catch (JSONException e) { // ignore, because it should not happen! } galleryUri.append(jsonObj.toString()); // open new gallery dialog jsOpener.append("window.open('"); jsOpener.append(getJsp().link(galleryUri.toString())); jsOpener.append("', '"); jsOpener.append(galleryType); jsOpener.append("','width="); jsOpener.append(width); jsOpener.append(", height="); jsOpener.append(height); jsOpener.append(", resizable=yes, top=100, left=270, status=yes');"); } } catch (CmsException e) { // requested type is not configured CmsMessageContainer message = Messages.get().container(Messages.ERR_OPEN_GALLERY_1, galleryType); LOG.error(message.key(), e); throw new CmsRuntimeException(message, e); } return jsOpener.toString(); }
java
public String openGallery() { StringBuffer jsOpener = new StringBuffer(32); String galleryType = null; try { CmsResource res = getCms().readResource(getParamResource()); if (res != null) { // get gallery path String galleryPath = getParamResource(); if (!galleryPath.endsWith("/")) { galleryPath += "/"; } // get the matching gallery type name galleryType = OpenCms.getResourceManager().getResourceType(res.getTypeId()).getTypeName(); StringBuffer galleryUri = new StringBuffer(256); galleryUri.append(A_CmsAjaxGallery.PATH_GALLERIES); String width = "650"; String height = "700"; // path to the gallery dialog with the required request parameters galleryUri.append(galleryType); galleryUri.append("/index.jsp?"); galleryUri.append(A_CmsAjaxGallery.PARAM_DIALOGMODE); galleryUri.append("="); galleryUri.append(A_CmsAjaxGallery.MODE_VIEW); galleryUri.append("&"); galleryUri.append(A_CmsAjaxGallery.PARAM_PARAMS); galleryUri.append("="); JSONObject jsonObj = new JSONObject(); try { jsonObj.putOpt(A_CmsAjaxGallery.PARAM_STARTUPFOLDER, galleryPath); jsonObj.putOpt(A_CmsAjaxGallery.PARAM_STARTUPTYPE, A_CmsAjaxGallery.LISTMODE_GALLERY); } catch (JSONException e) { // ignore, because it should not happen! } galleryUri.append(jsonObj.toString()); // open new gallery dialog jsOpener.append("window.open('"); jsOpener.append(getJsp().link(galleryUri.toString())); jsOpener.append("', '"); jsOpener.append(galleryType); jsOpener.append("','width="); jsOpener.append(width); jsOpener.append(", height="); jsOpener.append(height); jsOpener.append(", resizable=yes, top=100, left=270, status=yes');"); } } catch (CmsException e) { // requested type is not configured CmsMessageContainer message = Messages.get().container(Messages.ERR_OPEN_GALLERY_1, galleryType); LOG.error(message.key(), e); throw new CmsRuntimeException(message, e); } return jsOpener.toString(); }
[ "public", "String", "openGallery", "(", ")", "{", "StringBuffer", "jsOpener", "=", "new", "StringBuffer", "(", "32", ")", ";", "String", "galleryType", "=", "null", ";", "try", "{", "CmsResource", "res", "=", "getCms", "(", ")", ".", "readResource", "(", "getParamResource", "(", ")", ")", ";", "if", "(", "res", "!=", "null", ")", "{", "// get gallery path", "String", "galleryPath", "=", "getParamResource", "(", ")", ";", "if", "(", "!", "galleryPath", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "galleryPath", "+=", "\"/\"", ";", "}", "// get the matching gallery type name", "galleryType", "=", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "res", ".", "getTypeId", "(", ")", ")", ".", "getTypeName", "(", ")", ";", "StringBuffer", "galleryUri", "=", "new", "StringBuffer", "(", "256", ")", ";", "galleryUri", ".", "append", "(", "A_CmsAjaxGallery", ".", "PATH_GALLERIES", ")", ";", "String", "width", "=", "\"650\"", ";", "String", "height", "=", "\"700\"", ";", "// path to the gallery dialog with the required request parameters", "galleryUri", ".", "append", "(", "galleryType", ")", ";", "galleryUri", ".", "append", "(", "\"/index.jsp?\"", ")", ";", "galleryUri", ".", "append", "(", "A_CmsAjaxGallery", ".", "PARAM_DIALOGMODE", ")", ";", "galleryUri", ".", "append", "(", "\"=\"", ")", ";", "galleryUri", ".", "append", "(", "A_CmsAjaxGallery", ".", "MODE_VIEW", ")", ";", "galleryUri", ".", "append", "(", "\"&\"", ")", ";", "galleryUri", ".", "append", "(", "A_CmsAjaxGallery", ".", "PARAM_PARAMS", ")", ";", "galleryUri", ".", "append", "(", "\"=\"", ")", ";", "JSONObject", "jsonObj", "=", "new", "JSONObject", "(", ")", ";", "try", "{", "jsonObj", ".", "putOpt", "(", "A_CmsAjaxGallery", ".", "PARAM_STARTUPFOLDER", ",", "galleryPath", ")", ";", "jsonObj", ".", "putOpt", "(", "A_CmsAjaxGallery", ".", "PARAM_STARTUPTYPE", ",", "A_CmsAjaxGallery", ".", "LISTMODE_GALLERY", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "// ignore, because it should not happen!", "}", "galleryUri", ".", "append", "(", "jsonObj", ".", "toString", "(", ")", ")", ";", "// open new gallery dialog", "jsOpener", ".", "append", "(", "\"window.open('\"", ")", ";", "jsOpener", ".", "append", "(", "getJsp", "(", ")", ".", "link", "(", "galleryUri", ".", "toString", "(", ")", ")", ")", ";", "jsOpener", ".", "append", "(", "\"', '\"", ")", ";", "jsOpener", ".", "append", "(", "galleryType", ")", ";", "jsOpener", ".", "append", "(", "\"','width=\"", ")", ";", "jsOpener", ".", "append", "(", "width", ")", ";", "jsOpener", ".", "append", "(", "\", height=\"", ")", ";", "jsOpener", ".", "append", "(", "height", ")", ";", "jsOpener", ".", "append", "(", "\", resizable=yes, top=100, left=270, status=yes');\"", ")", ";", "}", "}", "catch", "(", "CmsException", "e", ")", "{", "// requested type is not configured", "CmsMessageContainer", "message", "=", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_OPEN_GALLERY_1", ",", "galleryType", ")", ";", "LOG", ".", "error", "(", "message", ".", "key", "(", ")", ",", "e", ")", ";", "throw", "new", "CmsRuntimeException", "(", "message", ",", "e", ")", ";", "}", "return", "jsOpener", ".", "toString", "(", ")", ";", "}" ]
Generates a javascript window open for the requested gallery type.<p> @return a javascript window open for the requested gallery type
[ "Generates", "a", "javascript", "window", "open", "for", "the", "requested", "gallery", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/galleries/CmsOpenGallery.java#L94-L149
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerDriver.java
EmbeddedServerDriver.isProductExtensionInstalled
private boolean isProductExtensionInstalled(String inputString, String productExtension) { """ Determine if the input product extension exists in the input string. @param inputString string to search. @param productExtension product extension to search for. @return true if input product extension is found in the input string. """ if ((productExtension == null) || (inputString == null)) { return false; } int msgIndex = inputString.indexOf("CWWKF0012I: The server installed the following features:"); if (msgIndex == -1) { return false; } String msgString = inputString.substring(msgIndex); int leftBracketIndex = msgString.indexOf("["); int rightBracketIndex = msgString.indexOf("]"); if ((leftBracketIndex == -1) || (rightBracketIndex == -1) || (rightBracketIndex < leftBracketIndex)) { return false; } String features = msgString.substring(leftBracketIndex, rightBracketIndex); Log.info(c, "isProductExtensionInstalled", features); if (features.indexOf(productExtension) == -1) { return false; } return true; }
java
private boolean isProductExtensionInstalled(String inputString, String productExtension) { if ((productExtension == null) || (inputString == null)) { return false; } int msgIndex = inputString.indexOf("CWWKF0012I: The server installed the following features:"); if (msgIndex == -1) { return false; } String msgString = inputString.substring(msgIndex); int leftBracketIndex = msgString.indexOf("["); int rightBracketIndex = msgString.indexOf("]"); if ((leftBracketIndex == -1) || (rightBracketIndex == -1) || (rightBracketIndex < leftBracketIndex)) { return false; } String features = msgString.substring(leftBracketIndex, rightBracketIndex); Log.info(c, "isProductExtensionInstalled", features); if (features.indexOf(productExtension) == -1) { return false; } return true; }
[ "private", "boolean", "isProductExtensionInstalled", "(", "String", "inputString", ",", "String", "productExtension", ")", "{", "if", "(", "(", "productExtension", "==", "null", ")", "||", "(", "inputString", "==", "null", ")", ")", "{", "return", "false", ";", "}", "int", "msgIndex", "=", "inputString", ".", "indexOf", "(", "\"CWWKF0012I: The server installed the following features:\"", ")", ";", "if", "(", "msgIndex", "==", "-", "1", ")", "{", "return", "false", ";", "}", "String", "msgString", "=", "inputString", ".", "substring", "(", "msgIndex", ")", ";", "int", "leftBracketIndex", "=", "msgString", ".", "indexOf", "(", "\"[\"", ")", ";", "int", "rightBracketIndex", "=", "msgString", ".", "indexOf", "(", "\"]\"", ")", ";", "if", "(", "(", "leftBracketIndex", "==", "-", "1", ")", "||", "(", "rightBracketIndex", "==", "-", "1", ")", "||", "(", "rightBracketIndex", "<", "leftBracketIndex", ")", ")", "{", "return", "false", ";", "}", "String", "features", "=", "msgString", ".", "substring", "(", "leftBracketIndex", ",", "rightBracketIndex", ")", ";", "Log", ".", "info", "(", "c", ",", "\"isProductExtensionInstalled\"", ",", "features", ")", ";", "if", "(", "features", ".", "indexOf", "(", "productExtension", ")", "==", "-", "1", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Determine if the input product extension exists in the input string. @param inputString string to search. @param productExtension product extension to search for. @return true if input product extension is found in the input string.
[ "Determine", "if", "the", "input", "product", "extension", "exists", "in", "the", "input", "string", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerDriver.java#L239-L263
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java
MatrixFeatures_DDRM.isEquals
public static boolean isEquals(BMatrixRMaj a, BMatrixRMaj b ) { """ <p> Checks to see if each element in the two matrices are equal: a<sub>ij</sub> == b<sub>ij</sub> <p> <p> NOTE: If any of the elements are NaN then false is returned. If two corresponding elements are both positive or negative infinity then they are equal. </p> @param a A matrix. Not modified. @param b A matrix. Not modified. @return true if identical and false otherwise. """ if( a.numRows != b.numRows || a.numCols != b.numCols ) { return false; } final int length = a.getNumElements(); for( int i = 0; i < length; i++ ) { if( !(a.get(i) == b.get(i)) ) { return false; } } return true; }
java
public static boolean isEquals(BMatrixRMaj a, BMatrixRMaj b ) { if( a.numRows != b.numRows || a.numCols != b.numCols ) { return false; } final int length = a.getNumElements(); for( int i = 0; i < length; i++ ) { if( !(a.get(i) == b.get(i)) ) { return false; } } return true; }
[ "public", "static", "boolean", "isEquals", "(", "BMatrixRMaj", "a", ",", "BMatrixRMaj", "b", ")", "{", "if", "(", "a", ".", "numRows", "!=", "b", ".", "numRows", "||", "a", ".", "numCols", "!=", "b", ".", "numCols", ")", "{", "return", "false", ";", "}", "final", "int", "length", "=", "a", ".", "getNumElements", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "!", "(", "a", ".", "get", "(", "i", ")", "==", "b", ".", "get", "(", "i", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
<p> Checks to see if each element in the two matrices are equal: a<sub>ij</sub> == b<sub>ij</sub> <p> <p> NOTE: If any of the elements are NaN then false is returned. If two corresponding elements are both positive or negative infinity then they are equal. </p> @param a A matrix. Not modified. @param b A matrix. Not modified. @return true if identical and false otherwise.
[ "<p", ">", "Checks", "to", "see", "if", "each", "element", "in", "the", "two", "matrices", "are", "equal", ":", "a<sub", ">", "ij<", "/", "sub", ">", "==", "b<sub", ">", "ij<", "/", "sub", ">", "<p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java#L417-L430
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/EventHelper.java
EventHelper.renderHeader
private final void renderHeader(PdfWriter writer, Document document) throws DocumentException, VectorPrintException { """ prints a failure and / or a debug header when applicable. @see #getTemplateImage(com.itextpdf.text.pdf.PdfTemplate) @param writer @param document @throws DocumentException @throws VectorPrintException """ if ((!debugHereAfter && getSettings().getBooleanProperty(false, DEBUG)) || (!failuresHereAfter && !getSettings().getBooleanProperty(false, DEBUG))) { writer.getDirectContent().addImage(getTemplateImage(template)); if (getSettings().getBooleanProperty(false, DEBUG)) { ArrayList a = new ArrayList(2); a.add(PdfName.TOGGLE); a.add(elementProducer.initLayerGroup(DEBUG, writer.getDirectContent())); PdfAction act = PdfAction.setOCGstate(a, true); Chunk h = new Chunk("toggle debug info", DebugHelper.debugFontLink(writer.getDirectContent(), getSettings())).setAction(act); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_LEFT, new Phrase(h), 10, document.top() - 15, 0); Font f = DebugHelper.debugFontLink(writer.getDirectContent(), getSettings()); // act = PdfAction.gotoLocalPage("debugpage", true); elementProducer.startLayerInGroup(DEBUG, writer.getDirectContent()); h = new Chunk(getSettings().getProperty("go to debug legend", "debugheader"), f).setLocalGoto(BaseReportGenerator.DEBUGPAGE); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_LEFT, new Phrase(h), 10, document.top() - 3, 0); writer.getDirectContent().endLayer(); } } }
java
private final void renderHeader(PdfWriter writer, Document document) throws DocumentException, VectorPrintException { if ((!debugHereAfter && getSettings().getBooleanProperty(false, DEBUG)) || (!failuresHereAfter && !getSettings().getBooleanProperty(false, DEBUG))) { writer.getDirectContent().addImage(getTemplateImage(template)); if (getSettings().getBooleanProperty(false, DEBUG)) { ArrayList a = new ArrayList(2); a.add(PdfName.TOGGLE); a.add(elementProducer.initLayerGroup(DEBUG, writer.getDirectContent())); PdfAction act = PdfAction.setOCGstate(a, true); Chunk h = new Chunk("toggle debug info", DebugHelper.debugFontLink(writer.getDirectContent(), getSettings())).setAction(act); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_LEFT, new Phrase(h), 10, document.top() - 15, 0); Font f = DebugHelper.debugFontLink(writer.getDirectContent(), getSettings()); // act = PdfAction.gotoLocalPage("debugpage", true); elementProducer.startLayerInGroup(DEBUG, writer.getDirectContent()); h = new Chunk(getSettings().getProperty("go to debug legend", "debugheader"), f).setLocalGoto(BaseReportGenerator.DEBUGPAGE); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_LEFT, new Phrase(h), 10, document.top() - 3, 0); writer.getDirectContent().endLayer(); } } }
[ "private", "final", "void", "renderHeader", "(", "PdfWriter", "writer", ",", "Document", "document", ")", "throws", "DocumentException", ",", "VectorPrintException", "{", "if", "(", "(", "!", "debugHereAfter", "&&", "getSettings", "(", ")", ".", "getBooleanProperty", "(", "false", ",", "DEBUG", ")", ")", "||", "(", "!", "failuresHereAfter", "&&", "!", "getSettings", "(", ")", ".", "getBooleanProperty", "(", "false", ",", "DEBUG", ")", ")", ")", "{", "writer", ".", "getDirectContent", "(", ")", ".", "addImage", "(", "getTemplateImage", "(", "template", ")", ")", ";", "if", "(", "getSettings", "(", ")", ".", "getBooleanProperty", "(", "false", ",", "DEBUG", ")", ")", "{", "ArrayList", "a", "=", "new", "ArrayList", "(", "2", ")", ";", "a", ".", "add", "(", "PdfName", ".", "TOGGLE", ")", ";", "a", ".", "add", "(", "elementProducer", ".", "initLayerGroup", "(", "DEBUG", ",", "writer", ".", "getDirectContent", "(", ")", ")", ")", ";", "PdfAction", "act", "=", "PdfAction", ".", "setOCGstate", "(", "a", ",", "true", ")", ";", "Chunk", "h", "=", "new", "Chunk", "(", "\"toggle debug info\"", ",", "DebugHelper", ".", "debugFontLink", "(", "writer", ".", "getDirectContent", "(", ")", ",", "getSettings", "(", ")", ")", ")", ".", "setAction", "(", "act", ")", ";", "ColumnText", ".", "showTextAligned", "(", "writer", ".", "getDirectContent", "(", ")", ",", "Element", ".", "ALIGN_LEFT", ",", "new", "Phrase", "(", "h", ")", ",", "10", ",", "document", ".", "top", "(", ")", "-", "15", ",", "0", ")", ";", "Font", "f", "=", "DebugHelper", ".", "debugFontLink", "(", "writer", ".", "getDirectContent", "(", ")", ",", "getSettings", "(", ")", ")", ";", "// act = PdfAction.gotoLocalPage(\"debugpage\", true);", "elementProducer", ".", "startLayerInGroup", "(", "DEBUG", ",", "writer", ".", "getDirectContent", "(", ")", ")", ";", "h", "=", "new", "Chunk", "(", "getSettings", "(", ")", ".", "getProperty", "(", "\"go to debug legend\"", ",", "\"debugheader\"", ")", ",", "f", ")", ".", "setLocalGoto", "(", "BaseReportGenerator", ".", "DEBUGPAGE", ")", ";", "ColumnText", ".", "showTextAligned", "(", "writer", ".", "getDirectContent", "(", ")", ",", "Element", ".", "ALIGN_LEFT", ",", "new", "Phrase", "(", "h", ")", ",", "10", ",", "document", ".", "top", "(", ")", "-", "3", ",", "0", ")", ";", "writer", ".", "getDirectContent", "(", ")", ".", "endLayer", "(", ")", ";", "}", "}", "}" ]
prints a failure and / or a debug header when applicable. @see #getTemplateImage(com.itextpdf.text.pdf.PdfTemplate) @param writer @param document @throws DocumentException @throws VectorPrintException
[ "prints", "a", "failure", "and", "/", "or", "a", "debug", "header", "when", "applicable", "." ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/EventHelper.java#L273-L299
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/action/menu/EditFeatureAction.java
EditFeatureAction.execute
public boolean execute(Canvas target, Menu menu, MenuItem item) { """ Implementation of the <code>MenuItemIfFunction</code> interface. This will determine if the menu action should be enabled or not. In essence, this action will be enabled if a vector-layer is selected that allows the updating of existing features. """ int count = mapWidget.getMapModel().getNrSelectedFeatures(); if (count == 1) { for (VectorLayer layer : mapWidget.getMapModel().getVectorLayers()) { if (layer.getSelectedFeatures().size() == 1) { // It's already selected, so we assume the feature is fully loaded: feature = layer.getFeatureStore().getPartialFeature(layer.getSelectedFeatures().iterator().next()); return true; } } return true; } return false; }
java
public boolean execute(Canvas target, Menu menu, MenuItem item) { int count = mapWidget.getMapModel().getNrSelectedFeatures(); if (count == 1) { for (VectorLayer layer : mapWidget.getMapModel().getVectorLayers()) { if (layer.getSelectedFeatures().size() == 1) { // It's already selected, so we assume the feature is fully loaded: feature = layer.getFeatureStore().getPartialFeature(layer.getSelectedFeatures().iterator().next()); return true; } } return true; } return false; }
[ "public", "boolean", "execute", "(", "Canvas", "target", ",", "Menu", "menu", ",", "MenuItem", "item", ")", "{", "int", "count", "=", "mapWidget", ".", "getMapModel", "(", ")", ".", "getNrSelectedFeatures", "(", ")", ";", "if", "(", "count", "==", "1", ")", "{", "for", "(", "VectorLayer", "layer", ":", "mapWidget", ".", "getMapModel", "(", ")", ".", "getVectorLayers", "(", ")", ")", "{", "if", "(", "layer", ".", "getSelectedFeatures", "(", ")", ".", "size", "(", ")", "==", "1", ")", "{", "// It's already selected, so we assume the feature is fully loaded:", "feature", "=", "layer", ".", "getFeatureStore", "(", ")", ".", "getPartialFeature", "(", "layer", ".", "getSelectedFeatures", "(", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ")", ";", "return", "true", ";", "}", "}", "return", "true", ";", "}", "return", "false", ";", "}" ]
Implementation of the <code>MenuItemIfFunction</code> interface. This will determine if the menu action should be enabled or not. In essence, this action will be enabled if a vector-layer is selected that allows the updating of existing features.
[ "Implementation", "of", "the", "<code", ">", "MenuItemIfFunction<", "/", "code", ">", "interface", ".", "This", "will", "determine", "if", "the", "menu", "action", "should", "be", "enabled", "or", "not", ".", "In", "essence", "this", "action", "will", "be", "enabled", "if", "a", "vector", "-", "layer", "is", "selected", "that", "allows", "the", "updating", "of", "existing", "features", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/menu/EditFeatureAction.java#L102-L115
VoltDB/voltdb
src/frontend/org/voltdb/planner/ParsedUnionStmt.java
ParsedUnionStmt.parseOrderColumn
private void parseOrderColumn(VoltXMLElement orderByNode, ParsedSelectStmt leftmostSelectChild) { """ This is a stripped down version of the ParsedSelectStmt.parseOrderColumn. Since the SET ops are not allowed to have aggregate expressions (HAVING, GROUP BY) (except the individual SELECTS) all the logic handling the aggregates is omitted here @param orderByNode @param leftmostSelectChild """ ParsedColInfo.ExpressionAdjuster adjuster = new ParsedColInfo.ExpressionAdjuster() { @Override public AbstractExpression adjust(AbstractExpression expr) { // Union itself can't have aggregate expression return expr; } }; // Get the display columns from the first child List<ParsedColInfo> displayColumns = leftmostSelectChild.displayColumns(); ParsedColInfo order_col = ParsedColInfo.fromOrderByXml(leftmostSelectChild, orderByNode, adjuster); AbstractExpression order_exp = order_col.m_expression; assert(order_exp != null); // Mark the order by column if it is in displayColumns // The ORDER BY column MAY be identical to a simple display column, in which case, // tagging the actual display column as being also an order by column // helps later when trying to determine ORDER BY coverage (for determinism). for (ParsedColInfo col : displayColumns) { if (col.m_alias.equals(order_col.m_alias) || col.m_expression.equals(order_exp)) { col.m_orderBy = true; col.m_ascending = order_col.m_ascending; order_col.m_alias = col.m_alias; order_col.m_columnName = col.m_columnName; order_col.m_tableName = col.m_tableName; break; } } assert( ! (order_exp instanceof ConstantValueExpression)); assert( ! (order_exp instanceof ParameterValueExpression)); m_orderColumns.add(order_col); }
java
private void parseOrderColumn(VoltXMLElement orderByNode, ParsedSelectStmt leftmostSelectChild) { ParsedColInfo.ExpressionAdjuster adjuster = new ParsedColInfo.ExpressionAdjuster() { @Override public AbstractExpression adjust(AbstractExpression expr) { // Union itself can't have aggregate expression return expr; } }; // Get the display columns from the first child List<ParsedColInfo> displayColumns = leftmostSelectChild.displayColumns(); ParsedColInfo order_col = ParsedColInfo.fromOrderByXml(leftmostSelectChild, orderByNode, adjuster); AbstractExpression order_exp = order_col.m_expression; assert(order_exp != null); // Mark the order by column if it is in displayColumns // The ORDER BY column MAY be identical to a simple display column, in which case, // tagging the actual display column as being also an order by column // helps later when trying to determine ORDER BY coverage (for determinism). for (ParsedColInfo col : displayColumns) { if (col.m_alias.equals(order_col.m_alias) || col.m_expression.equals(order_exp)) { col.m_orderBy = true; col.m_ascending = order_col.m_ascending; order_col.m_alias = col.m_alias; order_col.m_columnName = col.m_columnName; order_col.m_tableName = col.m_tableName; break; } } assert( ! (order_exp instanceof ConstantValueExpression)); assert( ! (order_exp instanceof ParameterValueExpression)); m_orderColumns.add(order_col); }
[ "private", "void", "parseOrderColumn", "(", "VoltXMLElement", "orderByNode", ",", "ParsedSelectStmt", "leftmostSelectChild", ")", "{", "ParsedColInfo", ".", "ExpressionAdjuster", "adjuster", "=", "new", "ParsedColInfo", ".", "ExpressionAdjuster", "(", ")", "{", "@", "Override", "public", "AbstractExpression", "adjust", "(", "AbstractExpression", "expr", ")", "{", "// Union itself can't have aggregate expression", "return", "expr", ";", "}", "}", ";", "// Get the display columns from the first child", "List", "<", "ParsedColInfo", ">", "displayColumns", "=", "leftmostSelectChild", ".", "displayColumns", "(", ")", ";", "ParsedColInfo", "order_col", "=", "ParsedColInfo", ".", "fromOrderByXml", "(", "leftmostSelectChild", ",", "orderByNode", ",", "adjuster", ")", ";", "AbstractExpression", "order_exp", "=", "order_col", ".", "m_expression", ";", "assert", "(", "order_exp", "!=", "null", ")", ";", "// Mark the order by column if it is in displayColumns", "// The ORDER BY column MAY be identical to a simple display column, in which case,", "// tagging the actual display column as being also an order by column", "// helps later when trying to determine ORDER BY coverage (for determinism).", "for", "(", "ParsedColInfo", "col", ":", "displayColumns", ")", "{", "if", "(", "col", ".", "m_alias", ".", "equals", "(", "order_col", ".", "m_alias", ")", "||", "col", ".", "m_expression", ".", "equals", "(", "order_exp", ")", ")", "{", "col", ".", "m_orderBy", "=", "true", ";", "col", ".", "m_ascending", "=", "order_col", ".", "m_ascending", ";", "order_col", ".", "m_alias", "=", "col", ".", "m_alias", ";", "order_col", ".", "m_columnName", "=", "col", ".", "m_columnName", ";", "order_col", ".", "m_tableName", "=", "col", ".", "m_tableName", ";", "break", ";", "}", "}", "assert", "(", "!", "(", "order_exp", "instanceof", "ConstantValueExpression", ")", ")", ";", "assert", "(", "!", "(", "order_exp", "instanceof", "ParameterValueExpression", ")", ")", ";", "m_orderColumns", ".", "add", "(", "order_col", ")", ";", "}" ]
This is a stripped down version of the ParsedSelectStmt.parseOrderColumn. Since the SET ops are not allowed to have aggregate expressions (HAVING, GROUP BY) (except the individual SELECTS) all the logic handling the aggregates is omitted here @param orderByNode @param leftmostSelectChild
[ "This", "is", "a", "stripped", "down", "version", "of", "the", "ParsedSelectStmt", ".", "parseOrderColumn", ".", "Since", "the", "SET", "ops", "are", "not", "allowed", "to", "have", "aggregate", "expressions", "(", "HAVING", "GROUP", "BY", ")", "(", "except", "the", "individual", "SELECTS", ")", "all", "the", "logic", "handling", "the", "aggregates", "is", "omitted", "here" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/ParsedUnionStmt.java#L312-L347
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/document/DefinitionsDocument.java
DefinitionsDocument.apply
@Override public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, DefinitionsDocument.Parameters params) { """ Builds the definitions MarkupDocument. @return the definitions MarkupDocument """ Map<String, Model> definitions = params.definitions; if (MapUtils.isNotEmpty(definitions)) { applyDefinitionsDocumentExtension(new Context(Position.DOCUMENT_BEFORE, markupDocBuilder)); buildDefinitionsTitle(markupDocBuilder, labels.getLabel(Labels.DEFINITIONS)); applyDefinitionsDocumentExtension(new Context(Position.DOCUMENT_BEGIN, markupDocBuilder)); buildDefinitionsSection(markupDocBuilder, definitions); applyDefinitionsDocumentExtension(new Context(Position.DOCUMENT_END, markupDocBuilder)); applyDefinitionsDocumentExtension(new Context(Position.DOCUMENT_AFTER, markupDocBuilder)); } return markupDocBuilder; }
java
@Override public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, DefinitionsDocument.Parameters params) { Map<String, Model> definitions = params.definitions; if (MapUtils.isNotEmpty(definitions)) { applyDefinitionsDocumentExtension(new Context(Position.DOCUMENT_BEFORE, markupDocBuilder)); buildDefinitionsTitle(markupDocBuilder, labels.getLabel(Labels.DEFINITIONS)); applyDefinitionsDocumentExtension(new Context(Position.DOCUMENT_BEGIN, markupDocBuilder)); buildDefinitionsSection(markupDocBuilder, definitions); applyDefinitionsDocumentExtension(new Context(Position.DOCUMENT_END, markupDocBuilder)); applyDefinitionsDocumentExtension(new Context(Position.DOCUMENT_AFTER, markupDocBuilder)); } return markupDocBuilder; }
[ "@", "Override", "public", "MarkupDocBuilder", "apply", "(", "MarkupDocBuilder", "markupDocBuilder", ",", "DefinitionsDocument", ".", "Parameters", "params", ")", "{", "Map", "<", "String", ",", "Model", ">", "definitions", "=", "params", ".", "definitions", ";", "if", "(", "MapUtils", ".", "isNotEmpty", "(", "definitions", ")", ")", "{", "applyDefinitionsDocumentExtension", "(", "new", "Context", "(", "Position", ".", "DOCUMENT_BEFORE", ",", "markupDocBuilder", ")", ")", ";", "buildDefinitionsTitle", "(", "markupDocBuilder", ",", "labels", ".", "getLabel", "(", "Labels", ".", "DEFINITIONS", ")", ")", ";", "applyDefinitionsDocumentExtension", "(", "new", "Context", "(", "Position", ".", "DOCUMENT_BEGIN", ",", "markupDocBuilder", ")", ")", ";", "buildDefinitionsSection", "(", "markupDocBuilder", ",", "definitions", ")", ";", "applyDefinitionsDocumentExtension", "(", "new", "Context", "(", "Position", ".", "DOCUMENT_END", ",", "markupDocBuilder", ")", ")", ";", "applyDefinitionsDocumentExtension", "(", "new", "Context", "(", "Position", ".", "DOCUMENT_AFTER", ",", "markupDocBuilder", ")", ")", ";", "}", "return", "markupDocBuilder", ";", "}" ]
Builds the definitions MarkupDocument. @return the definitions MarkupDocument
[ "Builds", "the", "definitions", "MarkupDocument", "." ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/document/DefinitionsDocument.java#L79-L91
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/UsersApi.java
UsersApi.deleteUserProperties
public PropertiesEnvelope deleteUserProperties(String userId, String aid) throws ApiException { """ Delete User Application Properties Deletes a user&#39;s application properties @param userId User Id (required) @param aid Application ID (optional) @return PropertiesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<PropertiesEnvelope> resp = deleteUserPropertiesWithHttpInfo(userId, aid); return resp.getData(); }
java
public PropertiesEnvelope deleteUserProperties(String userId, String aid) throws ApiException { ApiResponse<PropertiesEnvelope> resp = deleteUserPropertiesWithHttpInfo(userId, aid); return resp.getData(); }
[ "public", "PropertiesEnvelope", "deleteUserProperties", "(", "String", "userId", ",", "String", "aid", ")", "throws", "ApiException", "{", "ApiResponse", "<", "PropertiesEnvelope", ">", "resp", "=", "deleteUserPropertiesWithHttpInfo", "(", "userId", ",", "aid", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Delete User Application Properties Deletes a user&#39;s application properties @param userId User Id (required) @param aid Application ID (optional) @return PropertiesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Delete", "User", "Application", "Properties", "Deletes", "a", "user&#39", ";", "s", "application", "properties" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/UsersApi.java#L265-L268
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/CounterMap.java
CounterMap.getCount
public double getCount(F first, S second) { """ This method returns counts for a given first/second pair @param first @param second @return """ Counter<S> counter = maps.get(first); if (counter == null) return 0.0; return counter.getCount(second); }
java
public double getCount(F first, S second) { Counter<S> counter = maps.get(first); if (counter == null) return 0.0; return counter.getCount(second); }
[ "public", "double", "getCount", "(", "F", "first", ",", "S", "second", ")", "{", "Counter", "<", "S", ">", "counter", "=", "maps", ".", "get", "(", "first", ")", ";", "if", "(", "counter", "==", "null", ")", "return", "0.0", ";", "return", "counter", ".", "getCount", "(", "second", ")", ";", "}" ]
This method returns counts for a given first/second pair @param first @param second @return
[ "This", "method", "returns", "counts", "for", "a", "given", "first", "/", "second", "pair" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/CounterMap.java#L107-L113
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeDecoderBits.java
QrCodeDecoderBits.decodeKanji
private int decodeKanji( QrCode qr , PackedBits8 data, int bitLocation ) { """ Decodes Kanji messages @param qr QR code @param data encoded data @return Location it has read up to in bits """ int lengthBits = QrCodeEncoder.getLengthBitsKanji(qr.version); int length = data.read(bitLocation,lengthBits,true); bitLocation += lengthBits; byte rawdata[] = new byte[ length*2 ]; for (int i = 0; i < length; i++) { if( data.size < bitLocation+13 ) { qr.failureCause = QrCode.Failure.MESSAGE_OVERFLOW; return -1; } int letter = data.read(bitLocation,13,true); bitLocation += 13; letter = ((letter/0x0C0) << 8) | (letter%0x0C0); if (letter < 0x01F00) { // In the 0x8140 to 0x9FFC range letter += 0x08140; } else { // In the 0xE040 to 0xEBBF range letter += 0x0C140; } rawdata[i*2] = (byte) (letter >> 8); rawdata[i*2 + 1] = (byte) letter; } // Shift_JIS may not be supported in some environments: try { workString.append( new String(rawdata, "Shift_JIS") ); } catch (UnsupportedEncodingException ignored) { qr.failureCause = KANJI_UNAVAILABLE; return -1; } return bitLocation; }
java
private int decodeKanji( QrCode qr , PackedBits8 data, int bitLocation ) { int lengthBits = QrCodeEncoder.getLengthBitsKanji(qr.version); int length = data.read(bitLocation,lengthBits,true); bitLocation += lengthBits; byte rawdata[] = new byte[ length*2 ]; for (int i = 0; i < length; i++) { if( data.size < bitLocation+13 ) { qr.failureCause = QrCode.Failure.MESSAGE_OVERFLOW; return -1; } int letter = data.read(bitLocation,13,true); bitLocation += 13; letter = ((letter/0x0C0) << 8) | (letter%0x0C0); if (letter < 0x01F00) { // In the 0x8140 to 0x9FFC range letter += 0x08140; } else { // In the 0xE040 to 0xEBBF range letter += 0x0C140; } rawdata[i*2] = (byte) (letter >> 8); rawdata[i*2 + 1] = (byte) letter; } // Shift_JIS may not be supported in some environments: try { workString.append( new String(rawdata, "Shift_JIS") ); } catch (UnsupportedEncodingException ignored) { qr.failureCause = KANJI_UNAVAILABLE; return -1; } return bitLocation; }
[ "private", "int", "decodeKanji", "(", "QrCode", "qr", ",", "PackedBits8", "data", ",", "int", "bitLocation", ")", "{", "int", "lengthBits", "=", "QrCodeEncoder", ".", "getLengthBitsKanji", "(", "qr", ".", "version", ")", ";", "int", "length", "=", "data", ".", "read", "(", "bitLocation", ",", "lengthBits", ",", "true", ")", ";", "bitLocation", "+=", "lengthBits", ";", "byte", "rawdata", "[", "]", "=", "new", "byte", "[", "length", "*", "2", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "data", ".", "size", "<", "bitLocation", "+", "13", ")", "{", "qr", ".", "failureCause", "=", "QrCode", ".", "Failure", ".", "MESSAGE_OVERFLOW", ";", "return", "-", "1", ";", "}", "int", "letter", "=", "data", ".", "read", "(", "bitLocation", ",", "13", ",", "true", ")", ";", "bitLocation", "+=", "13", ";", "letter", "=", "(", "(", "letter", "/", "0x0C0", ")", "<<", "8", ")", "|", "(", "letter", "%", "0x0C0", ")", ";", "if", "(", "letter", "<", "0x01F00", ")", "{", "// In the 0x8140 to 0x9FFC range", "letter", "+=", "0x08140", ";", "}", "else", "{", "// In the 0xE040 to 0xEBBF range", "letter", "+=", "0x0C140", ";", "}", "rawdata", "[", "i", "*", "2", "]", "=", "(", "byte", ")", "(", "letter", ">>", "8", ")", ";", "rawdata", "[", "i", "*", "2", "+", "1", "]", "=", "(", "byte", ")", "letter", ";", "}", "// Shift_JIS may not be supported in some environments:", "try", "{", "workString", ".", "append", "(", "new", "String", "(", "rawdata", ",", "\"Shift_JIS\"", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "ignored", ")", "{", "qr", ".", "failureCause", "=", "KANJI_UNAVAILABLE", ";", "return", "-", "1", ";", "}", "return", "bitLocation", ";", "}" ]
Decodes Kanji messages @param qr QR code @param data encoded data @return Location it has read up to in bits
[ "Decodes", "Kanji", "messages" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeDecoderBits.java#L376-L414
olavloite/spanner-jdbc
src/main/java/nl/topicus/jdbc/CloudSpannerConnection.java
CloudSpannerConnection.setDynamicConnectionProperty
public int setDynamicConnectionProperty(String propertyName, String propertyValue) throws SQLException { """ Set a dynamic connection property, such as AsyncDdlOperations @param propertyName The name of the dynamic connection property @param propertyValue The value to set @return 1 if the property was set, 0 if not (this complies with the normal behaviour of executeUpdate(...) methods) @throws SQLException Throws {@link SQLException} if a database error occurs """ return getPropertySetter(propertyName).apply(Boolean.valueOf(propertyValue)); }
java
public int setDynamicConnectionProperty(String propertyName, String propertyValue) throws SQLException { return getPropertySetter(propertyName).apply(Boolean.valueOf(propertyValue)); }
[ "public", "int", "setDynamicConnectionProperty", "(", "String", "propertyName", ",", "String", "propertyValue", ")", "throws", "SQLException", "{", "return", "getPropertySetter", "(", "propertyName", ")", ".", "apply", "(", "Boolean", ".", "valueOf", "(", "propertyValue", ")", ")", ";", "}" ]
Set a dynamic connection property, such as AsyncDdlOperations @param propertyName The name of the dynamic connection property @param propertyValue The value to set @return 1 if the property was set, 0 if not (this complies with the normal behaviour of executeUpdate(...) methods) @throws SQLException Throws {@link SQLException} if a database error occurs
[ "Set", "a", "dynamic", "connection", "property", "such", "as", "AsyncDdlOperations" ]
train
https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/CloudSpannerConnection.java#L746-L749
offbynull/coroutines
instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/DebugGenerators.java
DebugGenerators.debugMarker
public static InsnList debugMarker(MarkerType markerType, String text) { """ Generates instructions for generating marker instructions. These marker instructions are meant to be is useful for debugging instrumented code. For example, you can spot a specific portion of instrumented code by looking for specific markers in the assembly output. @param markerType marker type (determines what kind of instructions are generated) @param text text to print out @return instructions to call System.out.println with a string constant @throws NullPointerException if any argument is {@code null} """ Validate.notNull(markerType); Validate.notNull(text); InsnList ret = new InsnList(); switch (markerType) { case NONE: break; case CONSTANT: ret.add(new LdcInsnNode(text)); ret.add(new InsnNode(Opcodes.POP)); break; case STDOUT: ret.add(new FieldInsnNode(Opcodes.GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;")); ret.add(new LdcInsnNode(text)); ret.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false)); break; default: throw new IllegalStateException(); } return ret; }
java
public static InsnList debugMarker(MarkerType markerType, String text) { Validate.notNull(markerType); Validate.notNull(text); InsnList ret = new InsnList(); switch (markerType) { case NONE: break; case CONSTANT: ret.add(new LdcInsnNode(text)); ret.add(new InsnNode(Opcodes.POP)); break; case STDOUT: ret.add(new FieldInsnNode(Opcodes.GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;")); ret.add(new LdcInsnNode(text)); ret.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false)); break; default: throw new IllegalStateException(); } return ret; }
[ "public", "static", "InsnList", "debugMarker", "(", "MarkerType", "markerType", ",", "String", "text", ")", "{", "Validate", ".", "notNull", "(", "markerType", ")", ";", "Validate", ".", "notNull", "(", "text", ")", ";", "InsnList", "ret", "=", "new", "InsnList", "(", ")", ";", "switch", "(", "markerType", ")", "{", "case", "NONE", ":", "break", ";", "case", "CONSTANT", ":", "ret", ".", "add", "(", "new", "LdcInsnNode", "(", "text", ")", ")", ";", "ret", ".", "add", "(", "new", "InsnNode", "(", "Opcodes", ".", "POP", ")", ")", ";", "break", ";", "case", "STDOUT", ":", "ret", ".", "add", "(", "new", "FieldInsnNode", "(", "Opcodes", ".", "GETSTATIC", ",", "\"java/lang/System\"", ",", "\"out\"", ",", "\"Ljava/io/PrintStream;\"", ")", ")", ";", "ret", ".", "add", "(", "new", "LdcInsnNode", "(", "text", ")", ")", ";", "ret", ".", "add", "(", "new", "MethodInsnNode", "(", "Opcodes", ".", "INVOKEVIRTUAL", ",", "\"java/io/PrintStream\"", ",", "\"println\"", ",", "\"(Ljava/lang/String;)V\"", ",", "false", ")", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "return", "ret", ";", "}" ]
Generates instructions for generating marker instructions. These marker instructions are meant to be is useful for debugging instrumented code. For example, you can spot a specific portion of instrumented code by looking for specific markers in the assembly output. @param markerType marker type (determines what kind of instructions are generated) @param text text to print out @return instructions to call System.out.println with a string constant @throws NullPointerException if any argument is {@code null}
[ "Generates", "instructions", "for", "generating", "marker", "instructions", ".", "These", "marker", "instructions", "are", "meant", "to", "be", "is", "useful", "for", "debugging", "instrumented", "code", ".", "For", "example", "you", "can", "spot", "a", "specific", "portion", "of", "instrumented", "code", "by", "looking", "for", "specific", "markers", "in", "the", "assembly", "output", "." ]
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/DebugGenerators.java#L46-L69
xmlunit/xmlunit
xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java
XMLAssert.assertXMLEqual
public static void assertXMLEqual(String control, String test) throws SAXException, IOException { """ Assert that two XML documents are similar @param control XML to be compared against @param test XML to be tested @throws SAXException @throws IOException """ assertXMLEqual(null, control, test); }
java
public static void assertXMLEqual(String control, String test) throws SAXException, IOException { assertXMLEqual(null, control, test); }
[ "public", "static", "void", "assertXMLEqual", "(", "String", "control", ",", "String", "test", ")", "throws", "SAXException", ",", "IOException", "{", "assertXMLEqual", "(", "null", ",", "control", ",", "test", ")", ";", "}" ]
Assert that two XML documents are similar @param control XML to be compared against @param test XML to be tested @throws SAXException @throws IOException
[ "Assert", "that", "two", "XML", "documents", "are", "similar" ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java#L181-L184
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.setElementID
public static URI setElementID(final URI relativePath, final String id) { """ Set the element ID from the path @param relativePath path @param id element ID @return element ID, may be {@code null} """ String topic = getTopicID(relativePath); if (topic != null) { return setFragment(relativePath, topic + (id != null ? SLASH + id : "")); } else if (id == null) { return stripFragment(relativePath); } else { throw new IllegalArgumentException(relativePath.toString()); } }
java
public static URI setElementID(final URI relativePath, final String id) { String topic = getTopicID(relativePath); if (topic != null) { return setFragment(relativePath, topic + (id != null ? SLASH + id : "")); } else if (id == null) { return stripFragment(relativePath); } else { throw new IllegalArgumentException(relativePath.toString()); } }
[ "public", "static", "URI", "setElementID", "(", "final", "URI", "relativePath", ",", "final", "String", "id", ")", "{", "String", "topic", "=", "getTopicID", "(", "relativePath", ")", ";", "if", "(", "topic", "!=", "null", ")", "{", "return", "setFragment", "(", "relativePath", ",", "topic", "+", "(", "id", "!=", "null", "?", "SLASH", "+", "id", ":", "\"\"", ")", ")", ";", "}", "else", "if", "(", "id", "==", "null", ")", "{", "return", "stripFragment", "(", "relativePath", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "relativePath", ".", "toString", "(", ")", ")", ";", "}", "}" ]
Set the element ID from the path @param relativePath path @param id element ID @return element ID, may be {@code null}
[ "Set", "the", "element", "ID", "from", "the", "path" ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L722-L731
apache/spark
core/src/main/java/org/apache/spark/util/collection/TimSort.java
TimSort.countRunAndMakeAscending
private int countRunAndMakeAscending(Buffer a, int lo, int hi, Comparator<? super K> c) { """ Returns the length of the run beginning at the specified position in the specified array and reverses the run if it is descending (ensuring that the run will always be ascending when the method returns). A run is the longest ascending sequence with: a[lo] <= a[lo + 1] <= a[lo + 2] <= ... or the longest descending sequence with: a[lo] > a[lo + 1] > a[lo + 2] > ... For its intended use in a stable mergesort, the strictness of the definition of "descending" is needed so that the call can safely reverse a descending sequence without violating stability. @param a the array in which a run is to be counted and possibly reversed @param lo index of the first element in the run @param hi index after the last element that may be contained in the run. It is required that {@code lo < hi}. @param c the comparator to used for the sort @return the length of the run beginning at the specified position in the specified array """ assert lo < hi; int runHi = lo + 1; if (runHi == hi) return 1; K key0 = s.newKey(); K key1 = s.newKey(); // Find end of run, and reverse range if descending if (c.compare(s.getKey(a, runHi++, key0), s.getKey(a, lo, key1)) < 0) { // Descending while (runHi < hi && c.compare(s.getKey(a, runHi, key0), s.getKey(a, runHi - 1, key1)) < 0) runHi++; reverseRange(a, lo, runHi); } else { // Ascending while (runHi < hi && c.compare(s.getKey(a, runHi, key0), s.getKey(a, runHi - 1, key1)) >= 0) runHi++; } return runHi - lo; }
java
private int countRunAndMakeAscending(Buffer a, int lo, int hi, Comparator<? super K> c) { assert lo < hi; int runHi = lo + 1; if (runHi == hi) return 1; K key0 = s.newKey(); K key1 = s.newKey(); // Find end of run, and reverse range if descending if (c.compare(s.getKey(a, runHi++, key0), s.getKey(a, lo, key1)) < 0) { // Descending while (runHi < hi && c.compare(s.getKey(a, runHi, key0), s.getKey(a, runHi - 1, key1)) < 0) runHi++; reverseRange(a, lo, runHi); } else { // Ascending while (runHi < hi && c.compare(s.getKey(a, runHi, key0), s.getKey(a, runHi - 1, key1)) >= 0) runHi++; } return runHi - lo; }
[ "private", "int", "countRunAndMakeAscending", "(", "Buffer", "a", ",", "int", "lo", ",", "int", "hi", ",", "Comparator", "<", "?", "super", "K", ">", "c", ")", "{", "assert", "lo", "<", "hi", ";", "int", "runHi", "=", "lo", "+", "1", ";", "if", "(", "runHi", "==", "hi", ")", "return", "1", ";", "K", "key0", "=", "s", ".", "newKey", "(", ")", ";", "K", "key1", "=", "s", ".", "newKey", "(", ")", ";", "// Find end of run, and reverse range if descending", "if", "(", "c", ".", "compare", "(", "s", ".", "getKey", "(", "a", ",", "runHi", "++", ",", "key0", ")", ",", "s", ".", "getKey", "(", "a", ",", "lo", ",", "key1", ")", ")", "<", "0", ")", "{", "// Descending", "while", "(", "runHi", "<", "hi", "&&", "c", ".", "compare", "(", "s", ".", "getKey", "(", "a", ",", "runHi", ",", "key0", ")", ",", "s", ".", "getKey", "(", "a", ",", "runHi", "-", "1", ",", "key1", ")", ")", "<", "0", ")", "runHi", "++", ";", "reverseRange", "(", "a", ",", "lo", ",", "runHi", ")", ";", "}", "else", "{", "// Ascending", "while", "(", "runHi", "<", "hi", "&&", "c", ".", "compare", "(", "s", ".", "getKey", "(", "a", ",", "runHi", ",", "key0", ")", ",", "s", ".", "getKey", "(", "a", ",", "runHi", "-", "1", ",", "key1", ")", ")", ">=", "0", ")", "runHi", "++", ";", "}", "return", "runHi", "-", "lo", ";", "}" ]
Returns the length of the run beginning at the specified position in the specified array and reverses the run if it is descending (ensuring that the run will always be ascending when the method returns). A run is the longest ascending sequence with: a[lo] <= a[lo + 1] <= a[lo + 2] <= ... or the longest descending sequence with: a[lo] > a[lo + 1] > a[lo + 2] > ... For its intended use in a stable mergesort, the strictness of the definition of "descending" is needed so that the call can safely reverse a descending sequence without violating stability. @param a the array in which a run is to be counted and possibly reversed @param lo index of the first element in the run @param hi index after the last element that may be contained in the run. It is required that {@code lo < hi}. @param c the comparator to used for the sort @return the length of the run beginning at the specified position in the specified array
[ "Returns", "the", "length", "of", "the", "run", "beginning", "at", "the", "specified", "position", "in", "the", "specified", "array", "and", "reverses", "the", "run", "if", "it", "is", "descending", "(", "ensuring", "that", "the", "run", "will", "always", "be", "ascending", "when", "the", "method", "returns", ")", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/TimSort.java#L260-L280
jbundle/jbundle
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageHeader.java
BaseMessageHeader.init
public void init(String strQueueName, String strQueueType, Object source, Map<String,Object> properties) { """ Constructor. @param strQueueName Name of the queue. @param strQueueType Type of queue - remote or local. @param source usually the object sending or listening for the message, to reduce echos. """ if (strQueueName == null) if ((strQueueType == null) || (strQueueType.equals(MessageConstants.INTRANET_QUEUE))) { strQueueType = MessageConstants.INTRANET_QUEUE; strQueueName = MessageConstants.RECORD_QUEUE_NAME; } if (strQueueType == null) strQueueType = MessageConstants.INTERNET_QUEUE; m_strQueueName = strQueueName; m_strQueueType = strQueueType; m_source = source; m_mxProperties = this.createNameValueTree(null, properties); }
java
public void init(String strQueueName, String strQueueType, Object source, Map<String,Object> properties) { if (strQueueName == null) if ((strQueueType == null) || (strQueueType.equals(MessageConstants.INTRANET_QUEUE))) { strQueueType = MessageConstants.INTRANET_QUEUE; strQueueName = MessageConstants.RECORD_QUEUE_NAME; } if (strQueueType == null) strQueueType = MessageConstants.INTERNET_QUEUE; m_strQueueName = strQueueName; m_strQueueType = strQueueType; m_source = source; m_mxProperties = this.createNameValueTree(null, properties); }
[ "public", "void", "init", "(", "String", "strQueueName", ",", "String", "strQueueType", ",", "Object", "source", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "if", "(", "strQueueName", "==", "null", ")", "if", "(", "(", "strQueueType", "==", "null", ")", "||", "(", "strQueueType", ".", "equals", "(", "MessageConstants", ".", "INTRANET_QUEUE", ")", ")", ")", "{", "strQueueType", "=", "MessageConstants", ".", "INTRANET_QUEUE", ";", "strQueueName", "=", "MessageConstants", ".", "RECORD_QUEUE_NAME", ";", "}", "if", "(", "strQueueType", "==", "null", ")", "strQueueType", "=", "MessageConstants", ".", "INTERNET_QUEUE", ";", "m_strQueueName", "=", "strQueueName", ";", "m_strQueueType", "=", "strQueueType", ";", "m_source", "=", "source", ";", "m_mxProperties", "=", "this", ".", "createNameValueTree", "(", "null", ",", "properties", ")", ";", "}" ]
Constructor. @param strQueueName Name of the queue. @param strQueueType Type of queue - remote or local. @param source usually the object sending or listening for the message, to reduce echos.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageHeader.java#L96-L112
williamwebb/alogger
BillingHelper/src/main/java/com/jug6ernaut/billing/Security.java
Security.verifyPurchase
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) { """ Verifies that the data was signed with the given signature, and returns the verified purchase. The data is in JSON format and signed with a private key. The data also contains the {@link PurchaseState} and product ID of the purchase. @param base64PublicKey the base64-encoded public key to use for verifying. @param signedData the signed JSON string (signed, not encrypted) @param signature the signature for the data, signed with the private key """ if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) || TextUtils.isEmpty(signature)) { Log.e(TAG, "Purchase verification failed: missing data."); return false; } PublicKey key = Security.generatePublicKey(base64PublicKey); return Security.verify(key, signedData, signature); }
java
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) { if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) || TextUtils.isEmpty(signature)) { Log.e(TAG, "Purchase verification failed: missing data."); return false; } PublicKey key = Security.generatePublicKey(base64PublicKey); return Security.verify(key, signedData, signature); }
[ "public", "static", "boolean", "verifyPurchase", "(", "String", "base64PublicKey", ",", "String", "signedData", ",", "String", "signature", ")", "{", "if", "(", "TextUtils", ".", "isEmpty", "(", "signedData", ")", "||", "TextUtils", ".", "isEmpty", "(", "base64PublicKey", ")", "||", "TextUtils", ".", "isEmpty", "(", "signature", ")", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"Purchase verification failed: missing data.\"", ")", ";", "return", "false", ";", "}", "PublicKey", "key", "=", "Security", ".", "generatePublicKey", "(", "base64PublicKey", ")", ";", "return", "Security", ".", "verify", "(", "key", ",", "signedData", ",", "signature", ")", ";", "}" ]
Verifies that the data was signed with the given signature, and returns the verified purchase. The data is in JSON format and signed with a private key. The data also contains the {@link PurchaseState} and product ID of the purchase. @param base64PublicKey the base64-encoded public key to use for verifying. @param signedData the signed JSON string (signed, not encrypted) @param signature the signature for the data, signed with the private key
[ "Verifies", "that", "the", "data", "was", "signed", "with", "the", "given", "signature", "and", "returns", "the", "verified", "purchase", ".", "The", "data", "is", "in", "JSON", "format", "and", "signed", "with", "a", "private", "key", ".", "The", "data", "also", "contains", "the", "{" ]
train
https://github.com/williamwebb/alogger/blob/61fca49e0b8d9c3a76c40da8883ac354b240351e/BillingHelper/src/main/java/com/jug6ernaut/billing/Security.java#L49-L58
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.verifyNodeRegistration
private boolean verifyNodeRegistration(DatanodeRegistration nodeReg, String ipAddr) throws IOException { """ Checks if the node is not on the hosts list. If it is not, then it will be disallowed from registering. """ assert (hasWriteLock()); return inHostsList(nodeReg, ipAddr); }
java
private boolean verifyNodeRegistration(DatanodeRegistration nodeReg, String ipAddr) throws IOException { assert (hasWriteLock()); return inHostsList(nodeReg, ipAddr); }
[ "private", "boolean", "verifyNodeRegistration", "(", "DatanodeRegistration", "nodeReg", ",", "String", "ipAddr", ")", "throws", "IOException", "{", "assert", "(", "hasWriteLock", "(", ")", ")", ";", "return", "inHostsList", "(", "nodeReg", ",", "ipAddr", ")", ";", "}" ]
Checks if the node is not on the hosts list. If it is not, then it will be disallowed from registering.
[ "Checks", "if", "the", "node", "is", "not", "on", "the", "hosts", "list", ".", "If", "it", "is", "not", "then", "it", "will", "be", "disallowed", "from", "registering", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8393-L8397
OpenLiberty/open-liberty
dev/com.ibm.json4j/src/com/ibm/json/xml/internal/JSONObject.java
JSONObject.writeEmptyObject
private void writeEmptyObject(Writer writer, int indentDepth, boolean contentOnly, boolean compact) throws IOException { """ Method to write an 'empty' XML tag, like <F/> @param writer The writer object to render the XML to. @param indentDepth How far to indent. @param contentOnly Whether or not to write the object name as part of the output @param compact Flag to denote whether to output in a nice indented format, or in a compact format. @throws IOException Trhown if an error occurs on write. """ if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeEmptyObject(Writer, int, boolean, boolean)"); if (!contentOnly) { if (!compact) { writeIndention(writer, indentDepth); writer.write("\"" + this.objectName + "\""); writer.write(" : \"\""); } else { writer.write("\"" + this.objectName + "\""); writer.write(" : \"\""); } } else { if (!compact) { writeIndention(writer, indentDepth); writer.write("\"\""); } else { writer.write("\"\""); } } if (logger.isLoggable(Level.FINER)) logger.exiting(className, "writeEmptyObject(Writer, int, boolean, boolean)"); }
java
private void writeEmptyObject(Writer writer, int indentDepth, boolean contentOnly, boolean compact) throws IOException { if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeEmptyObject(Writer, int, boolean, boolean)"); if (!contentOnly) { if (!compact) { writeIndention(writer, indentDepth); writer.write("\"" + this.objectName + "\""); writer.write(" : \"\""); } else { writer.write("\"" + this.objectName + "\""); writer.write(" : \"\""); } } else { if (!compact) { writeIndention(writer, indentDepth); writer.write("\"\""); } else { writer.write("\"\""); } } if (logger.isLoggable(Level.FINER)) logger.exiting(className, "writeEmptyObject(Writer, int, boolean, boolean)"); }
[ "private", "void", "writeEmptyObject", "(", "Writer", "writer", ",", "int", "indentDepth", ",", "boolean", "contentOnly", ",", "boolean", "compact", ")", "throws", "IOException", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "logger", ".", "entering", "(", "className", ",", "\"writeEmptyObject(Writer, int, boolean, boolean)\"", ")", ";", "if", "(", "!", "contentOnly", ")", "{", "if", "(", "!", "compact", ")", "{", "writeIndention", "(", "writer", ",", "indentDepth", ")", ";", "writer", ".", "write", "(", "\"\\\"\"", "+", "this", ".", "objectName", "+", "\"\\\"\"", ")", ";", "writer", ".", "write", "(", "\" : \\\"\\\"\"", ")", ";", "}", "else", "{", "writer", ".", "write", "(", "\"\\\"\"", "+", "this", ".", "objectName", "+", "\"\\\"\"", ")", ";", "writer", ".", "write", "(", "\" : \\\"\\\"\"", ")", ";", "}", "}", "else", "{", "if", "(", "!", "compact", ")", "{", "writeIndention", "(", "writer", ",", "indentDepth", ")", ";", "writer", ".", "write", "(", "\"\\\"\\\"\"", ")", ";", "}", "else", "{", "writer", ".", "write", "(", "\"\\\"\\\"\"", ")", ";", "}", "}", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "logger", ".", "exiting", "(", "className", ",", "\"writeEmptyObject(Writer, int, boolean, boolean)\"", ")", ";", "}" ]
Method to write an 'empty' XML tag, like <F/> @param writer The writer object to render the XML to. @param indentDepth How far to indent. @param contentOnly Whether or not to write the object name as part of the output @param compact Flag to denote whether to output in a nice indented format, or in a compact format. @throws IOException Trhown if an error occurs on write.
[ "Method", "to", "write", "an", "empty", "XML", "tag", "like", "<F", "/", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.json4j/src/com/ibm/json/xml/internal/JSONObject.java#L587-L610
UrielCh/ovh-java-sdk
ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java
ApiOvhPackxdsl.packName_siteBuilderFull_services_POST
public OvhTask packName_siteBuilderFull_services_POST(String packName, String domain, String subdomain, Long templateId) throws IOException { """ Activate a sitebuilder full service REST: POST /pack/xdsl/{packName}/siteBuilderFull/services @param domain [required] Domain name @param templateId [required] Template ID @param subdomain [required] Subdomain @param packName [required] The internal name of your pack """ String qPath = "/pack/xdsl/{packName}/siteBuilderFull/services"; StringBuilder sb = path(qPath, packName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "domain", domain); addBody(o, "subdomain", subdomain); addBody(o, "templateId", templateId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask packName_siteBuilderFull_services_POST(String packName, String domain, String subdomain, Long templateId) throws IOException { String qPath = "/pack/xdsl/{packName}/siteBuilderFull/services"; StringBuilder sb = path(qPath, packName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "domain", domain); addBody(o, "subdomain", subdomain); addBody(o, "templateId", templateId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "packName_siteBuilderFull_services_POST", "(", "String", "packName", ",", "String", "domain", ",", "String", "subdomain", ",", "Long", "templateId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/pack/xdsl/{packName}/siteBuilderFull/services\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "packName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"domain\"", ",", "domain", ")", ";", "addBody", "(", "o", ",", "\"subdomain\"", ",", "subdomain", ")", ";", "addBody", "(", "o", ",", "\"templateId\"", ",", "templateId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTask", ".", "class", ")", ";", "}" ]
Activate a sitebuilder full service REST: POST /pack/xdsl/{packName}/siteBuilderFull/services @param domain [required] Domain name @param templateId [required] Template ID @param subdomain [required] Subdomain @param packName [required] The internal name of your pack
[ "Activate", "a", "sitebuilder", "full", "service" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L553-L562
operasoftware/operaprestodriver
src/com/opera/core/systems/scope/stp/StpConnection.java
StpConnection.parseServiceList
public void parseServiceList(String message) { """ Processes an incoming message and passes it to event handler if needed, the following events are to our interest: Runtime-Started: ecmascript runtime starts in Opera (that we can inject to) Runtime-Stopped: ecmascript runtime stops (not used, buggy) Message: fired from console log event Updated-Window: a window is updated OR created (opener-id=0) Active-Window: window focus changed Window-Closed: self explanatory If message matches none it is added to the response queue (probably response to command). """ // We expect the service list to be in this format: // *245 service-list window-manager,core,ecmascript-service List<String> services; try { services = ImmutableList.copyOf(Splitter.on(',').split(message.split(" ")[2])); } catch (ArrayIndexOutOfBoundsException e) { connectionHandler.onException( new IllegalStateException(String.format("Invalid service list received: %s", message))); return; } logger.fine(String.format("Available services: %s", services)); connectionHandler.onServiceList(services); if (!services.contains("stp-1")) { connectionHandler.onException(new IllegalStateException("STP/0 is not supported!")); return; } switchToStp1(); }
java
public void parseServiceList(String message) { // We expect the service list to be in this format: // *245 service-list window-manager,core,ecmascript-service List<String> services; try { services = ImmutableList.copyOf(Splitter.on(',').split(message.split(" ")[2])); } catch (ArrayIndexOutOfBoundsException e) { connectionHandler.onException( new IllegalStateException(String.format("Invalid service list received: %s", message))); return; } logger.fine(String.format("Available services: %s", services)); connectionHandler.onServiceList(services); if (!services.contains("stp-1")) { connectionHandler.onException(new IllegalStateException("STP/0 is not supported!")); return; } switchToStp1(); }
[ "public", "void", "parseServiceList", "(", "String", "message", ")", "{", "// We expect the service list to be in this format:", "// *245 service-list window-manager,core,ecmascript-service", "List", "<", "String", ">", "services", ";", "try", "{", "services", "=", "ImmutableList", ".", "copyOf", "(", "Splitter", ".", "on", "(", "'", "'", ")", ".", "split", "(", "message", ".", "split", "(", "\" \"", ")", "[", "2", "]", ")", ")", ";", "}", "catch", "(", "ArrayIndexOutOfBoundsException", "e", ")", "{", "connectionHandler", ".", "onException", "(", "new", "IllegalStateException", "(", "String", ".", "format", "(", "\"Invalid service list received: %s\"", ",", "message", ")", ")", ")", ";", "return", ";", "}", "logger", ".", "fine", "(", "String", ".", "format", "(", "\"Available services: %s\"", ",", "services", ")", ")", ";", "connectionHandler", ".", "onServiceList", "(", "services", ")", ";", "if", "(", "!", "services", ".", "contains", "(", "\"stp-1\"", ")", ")", "{", "connectionHandler", ".", "onException", "(", "new", "IllegalStateException", "(", "\"STP/0 is not supported!\"", ")", ")", ";", "return", ";", "}", "switchToStp1", "(", ")", ";", "}" ]
Processes an incoming message and passes it to event handler if needed, the following events are to our interest: Runtime-Started: ecmascript runtime starts in Opera (that we can inject to) Runtime-Stopped: ecmascript runtime stops (not used, buggy) Message: fired from console log event Updated-Window: a window is updated OR created (opener-id=0) Active-Window: window focus changed Window-Closed: self explanatory If message matches none it is added to the response queue (probably response to command).
[ "Processes", "an", "incoming", "message", "and", "passes", "it", "to", "event", "handler", "if", "needed", "the", "following", "events", "are", "to", "our", "interest", ":" ]
train
https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/scope/stp/StpConnection.java#L335-L357
webjars/webjars-locator
src/main/java/org/webjars/RequireJS.java
RequireJS.getBowerWebJarRequireJsConfig
public static ObjectNode getBowerWebJarRequireJsConfig(Map.Entry<String, String> webJar, List<Map.Entry<String, Boolean>> prefixes) { """ Returns the JSON RequireJS config for a given Bower WebJar @param webJar A tuple (artifactId -&gt; version) representing the WebJar. @param prefixes A list of the prefixes to use in the `paths` part of the RequireJS config. @return The JSON RequireJS config for the WebJar based on the meta-data in the WebJar's pom.xml file. """ String bowerJsonPath = WebJarAssetLocator.WEBJARS_PATH_PREFIX + "/" + webJar.getKey() + "/" + webJar.getValue() + "/" + "bower.json"; return getWebJarRequireJsConfigFromMainConfig(webJar, prefixes, bowerJsonPath); }
java
public static ObjectNode getBowerWebJarRequireJsConfig(Map.Entry<String, String> webJar, List<Map.Entry<String, Boolean>> prefixes) { String bowerJsonPath = WebJarAssetLocator.WEBJARS_PATH_PREFIX + "/" + webJar.getKey() + "/" + webJar.getValue() + "/" + "bower.json"; return getWebJarRequireJsConfigFromMainConfig(webJar, prefixes, bowerJsonPath); }
[ "public", "static", "ObjectNode", "getBowerWebJarRequireJsConfig", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "webJar", ",", "List", "<", "Map", ".", "Entry", "<", "String", ",", "Boolean", ">", ">", "prefixes", ")", "{", "String", "bowerJsonPath", "=", "WebJarAssetLocator", ".", "WEBJARS_PATH_PREFIX", "+", "\"/\"", "+", "webJar", ".", "getKey", "(", ")", "+", "\"/\"", "+", "webJar", ".", "getValue", "(", ")", "+", "\"/\"", "+", "\"bower.json\"", ";", "return", "getWebJarRequireJsConfigFromMainConfig", "(", "webJar", ",", "prefixes", ",", "bowerJsonPath", ")", ";", "}" ]
Returns the JSON RequireJS config for a given Bower WebJar @param webJar A tuple (artifactId -&gt; version) representing the WebJar. @param prefixes A list of the prefixes to use in the `paths` part of the RequireJS config. @return The JSON RequireJS config for the WebJar based on the meta-data in the WebJar's pom.xml file.
[ "Returns", "the", "JSON", "RequireJS", "config", "for", "a", "given", "Bower", "WebJar" ]
train
https://github.com/webjars/webjars-locator/blob/8796fb3ff1b9ad5c0d433ecf63a60520c715e3a0/src/main/java/org/webjars/RequireJS.java#L375-L380
omise/omise-java
src/main/java/co/omise/resources/Resource.java
Resource.httpOp
protected Operation httpOp(String method, HttpUrl url) { """ Starts an HTTP {@link Operation} with the given method and {@link HttpUrl}. @param method The uppercased HTTP method to use. @param url An {@link HttpUrl} target. @return An {@link Operation} builder. """ return new Operation(httpClient).method(method).httpUrl(url); }
java
protected Operation httpOp(String method, HttpUrl url) { return new Operation(httpClient).method(method).httpUrl(url); }
[ "protected", "Operation", "httpOp", "(", "String", "method", ",", "HttpUrl", "url", ")", "{", "return", "new", "Operation", "(", "httpClient", ")", ".", "method", "(", "method", ")", ".", "httpUrl", "(", "url", ")", ";", "}" ]
Starts an HTTP {@link Operation} with the given method and {@link HttpUrl}. @param method The uppercased HTTP method to use. @param url An {@link HttpUrl} target. @return An {@link Operation} builder.
[ "Starts", "an", "HTTP", "{", "@link", "Operation", "}", "with", "the", "given", "method", "and", "{", "@link", "HttpUrl", "}", "." ]
train
https://github.com/omise/omise-java/blob/95aafc5e8c21b44e6d00a5a9080b9e353fe98042/src/main/java/co/omise/resources/Resource.java#L91-L93
apache/flink
flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java
MemorySegment.putShort
public final void putShort(int index, short value) { """ Writes the given short value into this buffer at the given position, using the native byte order of the system. @param index The position at which the value will be written. @param value The short value to be written. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 2. """ final long pos = address + index; if (index >= 0 && pos <= addressLimit - 2) { UNSAFE.putShort(heapMemory, pos, value); } else if (address > addressLimit) { throw new IllegalStateException("segment has been freed"); } else { // index is in fact invalid throw new IndexOutOfBoundsException(); } }
java
public final void putShort(int index, short value) { final long pos = address + index; if (index >= 0 && pos <= addressLimit - 2) { UNSAFE.putShort(heapMemory, pos, value); } else if (address > addressLimit) { throw new IllegalStateException("segment has been freed"); } else { // index is in fact invalid throw new IndexOutOfBoundsException(); } }
[ "public", "final", "void", "putShort", "(", "int", "index", ",", "short", "value", ")", "{", "final", "long", "pos", "=", "address", "+", "index", ";", "if", "(", "index", ">=", "0", "&&", "pos", "<=", "addressLimit", "-", "2", ")", "{", "UNSAFE", ".", "putShort", "(", "heapMemory", ",", "pos", ",", "value", ")", ";", "}", "else", "if", "(", "address", ">", "addressLimit", ")", "{", "throw", "new", "IllegalStateException", "(", "\"segment has been freed\"", ")", ";", "}", "else", "{", "// index is in fact invalid", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "}" ]
Writes the given short value into this buffer at the given position, using the native byte order of the system. @param index The position at which the value will be written. @param value The short value to be written. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 2.
[ "Writes", "the", "given", "short", "value", "into", "this", "buffer", "at", "the", "given", "position", "using", "the", "native", "byte", "order", "of", "the", "system", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L620-L632
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/Organizer.java
Organizer.addAll
public static <T> void addAll(Collection<T> pagingResults, Collection<T> paging, BooleanExpression<T> filter) { """ Add all collections @param <T> the type class @param paging the paging output @param pagingResults the results to add to @param filter remove object where filter.getBoolean() == true """ if (pagingResults == null || paging == null) return; if (filter != null) { for (T obj : paging) { if (filter.apply(obj)) pagingResults.add(obj); } } else { // add independent of a filter for (T obj : paging) { pagingResults.add(obj); } } }
java
public static <T> void addAll(Collection<T> pagingResults, Collection<T> paging, BooleanExpression<T> filter) { if (pagingResults == null || paging == null) return; if (filter != null) { for (T obj : paging) { if (filter.apply(obj)) pagingResults.add(obj); } } else { // add independent of a filter for (T obj : paging) { pagingResults.add(obj); } } }
[ "public", "static", "<", "T", ">", "void", "addAll", "(", "Collection", "<", "T", ">", "pagingResults", ",", "Collection", "<", "T", ">", "paging", ",", "BooleanExpression", "<", "T", ">", "filter", ")", "{", "if", "(", "pagingResults", "==", "null", "||", "paging", "==", "null", ")", "return", ";", "if", "(", "filter", "!=", "null", ")", "{", "for", "(", "T", "obj", ":", "paging", ")", "{", "if", "(", "filter", ".", "apply", "(", "obj", ")", ")", "pagingResults", ".", "add", "(", "obj", ")", ";", "}", "}", "else", "{", "// add independent of a filter\r", "for", "(", "T", "obj", ":", "paging", ")", "{", "pagingResults", ".", "add", "(", "obj", ")", ";", "}", "}", "}" ]
Add all collections @param <T> the type class @param paging the paging output @param pagingResults the results to add to @param filter remove object where filter.getBoolean() == true
[ "Add", "all", "collections" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Organizer.java#L295-L316
Mthwate/DatLib
src/main/java/com/mthwate/datlib/PropertyUtils.java
PropertyUtils.getProperty
public static String getProperty(InputStream input, String key, String defaultValue) { """ Retrieves a value from a properties input stream. @since 1.2 @param input the properties input stream @param key the property key @param defaultValue the fallback value to use @return the value retrieved with the supplied key """ String property = null; try { property = PropertiesFactory.load(input).getProperty(key); } catch (IOException e) {} return property == null ? defaultValue : property; }
java
public static String getProperty(InputStream input, String key, String defaultValue) { String property = null; try { property = PropertiesFactory.load(input).getProperty(key); } catch (IOException e) {} return property == null ? defaultValue : property; }
[ "public", "static", "String", "getProperty", "(", "InputStream", "input", ",", "String", "key", ",", "String", "defaultValue", ")", "{", "String", "property", "=", "null", ";", "try", "{", "property", "=", "PropertiesFactory", ".", "load", "(", "input", ")", ".", "getProperty", "(", "key", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "return", "property", "==", "null", "?", "defaultValue", ":", "property", ";", "}" ]
Retrieves a value from a properties input stream. @since 1.2 @param input the properties input stream @param key the property key @param defaultValue the fallback value to use @return the value retrieved with the supplied key
[ "Retrieves", "a", "value", "from", "a", "properties", "input", "stream", "." ]
train
https://github.com/Mthwate/DatLib/blob/f0b3a9f9cf6fdc773d4f86234ebd95986c9b6077/src/main/java/com/mthwate/datlib/PropertyUtils.java#L46-L52
alkacon/opencms-core
src/org/opencms/i18n/CmsVfsBundleManager.java
CmsVfsBundleManager.getNameAndLocale
private NameAndLocale getNameAndLocale(CmsResource bundleRes) { """ Extracts the locale and base name from a resource's file name.<p> @param bundleRes the resource for which to get the base name and locale @return a bean containing the base name and locale """ String fileName = bundleRes.getName(); if (TYPE_PROPERTIES_BUNDLE.equals(OpenCms.getResourceManager().getResourceType(bundleRes).getTypeName())) { String localeSuffix = CmsStringUtil.getLocaleSuffixForName(fileName); if (localeSuffix == null) { return new NameAndLocale(fileName, null); } else { String base = fileName.substring( 0, fileName.lastIndexOf(localeSuffix) - (1 /* cut off trailing underscore, too*/)); Locale locale = CmsLocaleManager.getLocale(localeSuffix); return new NameAndLocale(base, locale); } } else { return new NameAndLocale(fileName, null); } }
java
private NameAndLocale getNameAndLocale(CmsResource bundleRes) { String fileName = bundleRes.getName(); if (TYPE_PROPERTIES_BUNDLE.equals(OpenCms.getResourceManager().getResourceType(bundleRes).getTypeName())) { String localeSuffix = CmsStringUtil.getLocaleSuffixForName(fileName); if (localeSuffix == null) { return new NameAndLocale(fileName, null); } else { String base = fileName.substring( 0, fileName.lastIndexOf(localeSuffix) - (1 /* cut off trailing underscore, too*/)); Locale locale = CmsLocaleManager.getLocale(localeSuffix); return new NameAndLocale(base, locale); } } else { return new NameAndLocale(fileName, null); } }
[ "private", "NameAndLocale", "getNameAndLocale", "(", "CmsResource", "bundleRes", ")", "{", "String", "fileName", "=", "bundleRes", ".", "getName", "(", ")", ";", "if", "(", "TYPE_PROPERTIES_BUNDLE", ".", "equals", "(", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "bundleRes", ")", ".", "getTypeName", "(", ")", ")", ")", "{", "String", "localeSuffix", "=", "CmsStringUtil", ".", "getLocaleSuffixForName", "(", "fileName", ")", ";", "if", "(", "localeSuffix", "==", "null", ")", "{", "return", "new", "NameAndLocale", "(", "fileName", ",", "null", ")", ";", "}", "else", "{", "String", "base", "=", "fileName", ".", "substring", "(", "0", ",", "fileName", ".", "lastIndexOf", "(", "localeSuffix", ")", "-", "(", "1", "/* cut off trailing underscore, too*/", ")", ")", ";", "Locale", "locale", "=", "CmsLocaleManager", ".", "getLocale", "(", "localeSuffix", ")", ";", "return", "new", "NameAndLocale", "(", "base", ",", "locale", ")", ";", "}", "}", "else", "{", "return", "new", "NameAndLocale", "(", "fileName", ",", "null", ")", ";", "}", "}" ]
Extracts the locale and base name from a resource's file name.<p> @param bundleRes the resource for which to get the base name and locale @return a bean containing the base name and locale
[ "Extracts", "the", "locale", "and", "base", "name", "from", "a", "resource", "s", "file", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsVfsBundleManager.java#L339-L356
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java
AppServiceCertificateOrdersInner.retrieveSiteSeal
public SiteSealInner retrieveSiteSeal(String resourceGroupName, String certificateOrderName, SiteSealRequest siteSealRequest) { """ Verify domain ownership for this certificate order. Verify domain ownership for this certificate order. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param siteSealRequest Site seal request. @throws IllegalArgumentException thrown if parameters fail the validation @throws DefaultErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SiteSealInner object if successful. """ return retrieveSiteSealWithServiceResponseAsync(resourceGroupName, certificateOrderName, siteSealRequest).toBlocking().single().body(); }
java
public SiteSealInner retrieveSiteSeal(String resourceGroupName, String certificateOrderName, SiteSealRequest siteSealRequest) { return retrieveSiteSealWithServiceResponseAsync(resourceGroupName, certificateOrderName, siteSealRequest).toBlocking().single().body(); }
[ "public", "SiteSealInner", "retrieveSiteSeal", "(", "String", "resourceGroupName", ",", "String", "certificateOrderName", ",", "SiteSealRequest", "siteSealRequest", ")", "{", "return", "retrieveSiteSealWithServiceResponseAsync", "(", "resourceGroupName", ",", "certificateOrderName", ",", "siteSealRequest", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Verify domain ownership for this certificate order. Verify domain ownership for this certificate order. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param siteSealRequest Site seal request. @throws IllegalArgumentException thrown if parameters fail the validation @throws DefaultErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SiteSealInner object if successful.
[ "Verify", "domain", "ownership", "for", "this", "certificate", "order", ".", "Verify", "domain", "ownership", "for", "this", "certificate", "order", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L2048-L2050
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java
XsdAsmInterfaces.getAttributeGroupInterfaces
private String[] getAttributeGroupInterfaces(XsdElement element) { """ Obtains the names of the attribute interfaces that the given {@link XsdElement} will implement. @param element The element that contains the attributes. @return The elements interfaces names. """ List<String> attributeGroups = new ArrayList<>(); XsdComplexType complexType = element.getXsdComplexType(); Stream<XsdAttributeGroup> extensionAttributeGroups = Stream.empty(); XsdExtension extension = getXsdExtension(element); if (complexType != null){ if (extension != null){ extensionAttributeGroups = extension.getXsdAttributeGroup(); } attributeGroups.addAll(getTypeAttributeGroups(complexType, extensionAttributeGroups)); } return listToArray(attributeGroups, CUSTOM_ATTRIBUTE_GROUP); }
java
private String[] getAttributeGroupInterfaces(XsdElement element){ List<String> attributeGroups = new ArrayList<>(); XsdComplexType complexType = element.getXsdComplexType(); Stream<XsdAttributeGroup> extensionAttributeGroups = Stream.empty(); XsdExtension extension = getXsdExtension(element); if (complexType != null){ if (extension != null){ extensionAttributeGroups = extension.getXsdAttributeGroup(); } attributeGroups.addAll(getTypeAttributeGroups(complexType, extensionAttributeGroups)); } return listToArray(attributeGroups, CUSTOM_ATTRIBUTE_GROUP); }
[ "private", "String", "[", "]", "getAttributeGroupInterfaces", "(", "XsdElement", "element", ")", "{", "List", "<", "String", ">", "attributeGroups", "=", "new", "ArrayList", "<>", "(", ")", ";", "XsdComplexType", "complexType", "=", "element", ".", "getXsdComplexType", "(", ")", ";", "Stream", "<", "XsdAttributeGroup", ">", "extensionAttributeGroups", "=", "Stream", ".", "empty", "(", ")", ";", "XsdExtension", "extension", "=", "getXsdExtension", "(", "element", ")", ";", "if", "(", "complexType", "!=", "null", ")", "{", "if", "(", "extension", "!=", "null", ")", "{", "extensionAttributeGroups", "=", "extension", ".", "getXsdAttributeGroup", "(", ")", ";", "}", "attributeGroups", ".", "addAll", "(", "getTypeAttributeGroups", "(", "complexType", ",", "extensionAttributeGroups", ")", ")", ";", "}", "return", "listToArray", "(", "attributeGroups", ",", "CUSTOM_ATTRIBUTE_GROUP", ")", ";", "}" ]
Obtains the names of the attribute interfaces that the given {@link XsdElement} will implement. @param element The element that contains the attributes. @return The elements interfaces names.
[ "Obtains", "the", "names", "of", "the", "attribute", "interfaces", "that", "the", "given", "{" ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L173-L188
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java
URLUtil.normalize
public static String normalize(String url, boolean isEncodeBody) { """ 标准化URL字符串,包括: <pre> 1. 多个/替换为一个 </pre> @param url URL字符串 @param isEncodeBody 是否对URL中body部分的中文和特殊字符做转义(不包括http:和/) @return 标准化后的URL字符串 @since 4.4.1 """ if (StrUtil.isBlank(url)) { return url; } final int sepIndex = url.indexOf("://"); String pre; String body; if (sepIndex > 0) { pre = StrUtil.subPre(url, sepIndex + 3); body = StrUtil.subSuf(url, sepIndex + 3); } else { pre = "http://"; body = url; } final int paramsSepIndex = StrUtil.indexOf(body, '?'); String params = null; if (paramsSepIndex > 0) { params = StrUtil.subSuf(body, paramsSepIndex); body = StrUtil.subPre(body, paramsSepIndex); } // 去除开头的\或者/ body = body.replaceAll("^[\\/]+", StrUtil.EMPTY); // 替换多个\或/为单个/ body = body.replace("\\", "/").replaceAll("//+", "/"); if (isEncodeBody) { body = encode(body); } return pre + body + StrUtil.nullToEmpty(params); }
java
public static String normalize(String url, boolean isEncodeBody) { if (StrUtil.isBlank(url)) { return url; } final int sepIndex = url.indexOf("://"); String pre; String body; if (sepIndex > 0) { pre = StrUtil.subPre(url, sepIndex + 3); body = StrUtil.subSuf(url, sepIndex + 3); } else { pre = "http://"; body = url; } final int paramsSepIndex = StrUtil.indexOf(body, '?'); String params = null; if (paramsSepIndex > 0) { params = StrUtil.subSuf(body, paramsSepIndex); body = StrUtil.subPre(body, paramsSepIndex); } // 去除开头的\或者/ body = body.replaceAll("^[\\/]+", StrUtil.EMPTY); // 替换多个\或/为单个/ body = body.replace("\\", "/").replaceAll("//+", "/"); if (isEncodeBody) { body = encode(body); } return pre + body + StrUtil.nullToEmpty(params); }
[ "public", "static", "String", "normalize", "(", "String", "url", ",", "boolean", "isEncodeBody", ")", "{", "if", "(", "StrUtil", ".", "isBlank", "(", "url", ")", ")", "{", "return", "url", ";", "}", "final", "int", "sepIndex", "=", "url", ".", "indexOf", "(", "\"://\"", ")", ";", "String", "pre", ";", "String", "body", ";", "if", "(", "sepIndex", ">", "0", ")", "{", "pre", "=", "StrUtil", ".", "subPre", "(", "url", ",", "sepIndex", "+", "3", ")", ";", "body", "=", "StrUtil", ".", "subSuf", "(", "url", ",", "sepIndex", "+", "3", ")", ";", "}", "else", "{", "pre", "=", "\"http://\"", ";", "body", "=", "url", ";", "}", "final", "int", "paramsSepIndex", "=", "StrUtil", ".", "indexOf", "(", "body", ",", "'", "'", ")", ";", "String", "params", "=", "null", ";", "if", "(", "paramsSepIndex", ">", "0", ")", "{", "params", "=", "StrUtil", ".", "subSuf", "(", "body", ",", "paramsSepIndex", ")", ";", "body", "=", "StrUtil", ".", "subPre", "(", "body", ",", "paramsSepIndex", ")", ";", "}", "// 去除开头的\\或者/\r", "body", "=", "body", ".", "replaceAll", "(", "\"^[\\\\/]+\"", ",", "StrUtil", ".", "EMPTY", ")", ";", "// 替换多个\\或/为单个/\r", "body", "=", "body", ".", "replace", "(", "\"\\\\\"", ",", "\"/\"", ")", ".", "replaceAll", "(", "\"//+\"", ",", "\"/\"", ")", ";", "if", "(", "isEncodeBody", ")", "{", "body", "=", "encode", "(", "body", ")", ";", "}", "return", "pre", "+", "body", "+", "StrUtil", ".", "nullToEmpty", "(", "params", ")", ";", "}" ]
标准化URL字符串,包括: <pre> 1. 多个/替换为一个 </pre> @param url URL字符串 @param isEncodeBody 是否对URL中body部分的中文和特殊字符做转义(不包括http:和/) @return 标准化后的URL字符串 @since 4.4.1
[ "标准化URL字符串,包括:" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L569-L599
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/swing/PercentLayout.java
PercentLayout.maximumLayoutSize
@Override public Dimension maximumLayoutSize(Container parent) { """ Returns the maximum size of this component. @param parent @return @see java.awt.Component#getMinimumSize() @see java.awt.Component#getPreferredSize() @see java.awt.LayoutManager """ return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); }
java
@Override public Dimension maximumLayoutSize(Container parent) { return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); }
[ "@", "Override", "public", "Dimension", "maximumLayoutSize", "(", "Container", "parent", ")", "{", "return", "new", "Dimension", "(", "Integer", ".", "MAX_VALUE", ",", "Integer", ".", "MAX_VALUE", ")", ";", "}" ]
Returns the maximum size of this component. @param parent @return @see java.awt.Component#getMinimumSize() @see java.awt.Component#getPreferredSize() @see java.awt.LayoutManager
[ "Returns", "the", "maximum", "size", "of", "this", "component", "." ]
train
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/PercentLayout.java#L261-L264
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java
TwitterEndpointServices.createParameterStringForSignature
public String createParameterStringForSignature(Map<String, String> parameters) { """ Per {@link https://dev.twitter.com/oauth/overview/creating-signatures}, the parameter string for signatures must be built the following way: 1. Percent encode every key and value that will be signed. 2. Sort the list of parameters alphabetically by encoded key. 3. For each key/value pair: 4. Append the encoded key to the output string. 5. Append the '=' character to the output string. 6. Append the encoded value to the output string. 7. If there are more key/value pairs remaining, append a '&' character to the output string. @param parameters @return """ if (parameters == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Null parameters object provided; returning empty string"); } return ""; } Map<String, String> encodedParams = new HashMap<String, String>(); // Step 1: Percent encode every key and value that will be signed for (Entry<String, String> entry : parameters.entrySet()) { String encodedKey = Utils.percentEncode(entry.getKey()); String encodedValue = Utils.percentEncode(entry.getValue()); encodedParams.put(encodedKey, encodedValue); } // Step 2: Sort the list of parameters alphabetically by encoded key List<String> encodedKeysList = new ArrayList<String>(); encodedKeysList.addAll(encodedParams.keySet()); Collections.sort(encodedKeysList); StringBuilder paramString = new StringBuilder(); // Step 3: Go through each key/value pair for (int i = 0; i < encodedKeysList.size(); i++) { String key = encodedKeysList.get(i); String value = encodedParams.get(key); // Steps 4-6: Append encoded key, "=" character, and encoded value to the output string paramString.append(key).append("=").append(value); if (i < (encodedKeysList.size() - 1)) { // Step 7: If more key/value pairs remain, append "&" character to the output string paramString.append("&"); } } return paramString.toString(); }
java
public String createParameterStringForSignature(Map<String, String> parameters) { if (parameters == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Null parameters object provided; returning empty string"); } return ""; } Map<String, String> encodedParams = new HashMap<String, String>(); // Step 1: Percent encode every key and value that will be signed for (Entry<String, String> entry : parameters.entrySet()) { String encodedKey = Utils.percentEncode(entry.getKey()); String encodedValue = Utils.percentEncode(entry.getValue()); encodedParams.put(encodedKey, encodedValue); } // Step 2: Sort the list of parameters alphabetically by encoded key List<String> encodedKeysList = new ArrayList<String>(); encodedKeysList.addAll(encodedParams.keySet()); Collections.sort(encodedKeysList); StringBuilder paramString = new StringBuilder(); // Step 3: Go through each key/value pair for (int i = 0; i < encodedKeysList.size(); i++) { String key = encodedKeysList.get(i); String value = encodedParams.get(key); // Steps 4-6: Append encoded key, "=" character, and encoded value to the output string paramString.append(key).append("=").append(value); if (i < (encodedKeysList.size() - 1)) { // Step 7: If more key/value pairs remain, append "&" character to the output string paramString.append("&"); } } return paramString.toString(); }
[ "public", "String", "createParameterStringForSignature", "(", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "if", "(", "parameters", "==", "null", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Null parameters object provided; returning empty string\"", ")", ";", "}", "return", "\"\"", ";", "}", "Map", "<", "String", ",", "String", ">", "encodedParams", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "// Step 1: Percent encode every key and value that will be signed", "for", "(", "Entry", "<", "String", ",", "String", ">", "entry", ":", "parameters", ".", "entrySet", "(", ")", ")", "{", "String", "encodedKey", "=", "Utils", ".", "percentEncode", "(", "entry", ".", "getKey", "(", ")", ")", ";", "String", "encodedValue", "=", "Utils", ".", "percentEncode", "(", "entry", ".", "getValue", "(", ")", ")", ";", "encodedParams", ".", "put", "(", "encodedKey", ",", "encodedValue", ")", ";", "}", "// Step 2: Sort the list of parameters alphabetically by encoded key", "List", "<", "String", ">", "encodedKeysList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "encodedKeysList", ".", "addAll", "(", "encodedParams", ".", "keySet", "(", ")", ")", ";", "Collections", ".", "sort", "(", "encodedKeysList", ")", ";", "StringBuilder", "paramString", "=", "new", "StringBuilder", "(", ")", ";", "// Step 3: Go through each key/value pair", "for", "(", "int", "i", "=", "0", ";", "i", "<", "encodedKeysList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "key", "=", "encodedKeysList", ".", "get", "(", "i", ")", ";", "String", "value", "=", "encodedParams", ".", "get", "(", "key", ")", ";", "// Steps 4-6: Append encoded key, \"=\" character, and encoded value to the output string", "paramString", ".", "append", "(", "key", ")", ".", "append", "(", "\"=\"", ")", ".", "append", "(", "value", ")", ";", "if", "(", "i", "<", "(", "encodedKeysList", ".", "size", "(", ")", "-", "1", ")", ")", "{", "// Step 7: If more key/value pairs remain, append \"&\" character to the output string", "paramString", ".", "append", "(", "\"&\"", ")", ";", "}", "}", "return", "paramString", ".", "toString", "(", ")", ";", "}" ]
Per {@link https://dev.twitter.com/oauth/overview/creating-signatures}, the parameter string for signatures must be built the following way: 1. Percent encode every key and value that will be signed. 2. Sort the list of parameters alphabetically by encoded key. 3. For each key/value pair: 4. Append the encoded key to the output string. 5. Append the '=' character to the output string. 6. Append the encoded value to the output string. 7. If there are more key/value pairs remaining, append a '&' character to the output string. @param parameters @return
[ "Per", "{", "@link", "https", ":", "//", "dev", ".", "twitter", ".", "com", "/", "oauth", "/", "overview", "/", "creating", "-", "signatures", "}", "the", "parameter", "string", "for", "signatures", "must", "be", "built", "the", "following", "way", ":", "1", ".", "Percent", "encode", "every", "key", "and", "value", "that", "will", "be", "signed", ".", "2", ".", "Sort", "the", "list", "of", "parameters", "alphabetically", "by", "encoded", "key", ".", "3", ".", "For", "each", "key", "/", "value", "pair", ":", "4", ".", "Append", "the", "encoded", "key", "to", "the", "output", "string", ".", "5", ".", "Append", "the", "=", "character", "to", "the", "output", "string", ".", "6", ".", "Append", "the", "encoded", "value", "to", "the", "output", "string", ".", "7", ".", "If", "there", "are", "more", "key", "/", "value", "pairs", "remaining", "append", "a", "&", "character", "to", "the", "output", "string", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java#L184-L223
astrapi69/mystic-crypt
crypt-data/src/main/java/de/alpharogroup/crypto/hex/HexExtensions.java
HexExtensions.toHexString
public static String toHexString(final byte[] data, final boolean lowerCase) { """ Transform the given {@code byte array} to a hexadecimal {@link String} value. @param data the byte array @param lowerCase the flag if the result shell be transform in lower case. If true the result is lowercase otherwise uppercase. @return the new hexadecimal {@link String} value. """ final StringBuilder sb = new StringBuilder(); sb.append(HexExtensions.encodeHex(data, lowerCase)); return sb.toString(); }
java
public static String toHexString(final byte[] data, final boolean lowerCase) { final StringBuilder sb = new StringBuilder(); sb.append(HexExtensions.encodeHex(data, lowerCase)); return sb.toString(); }
[ "public", "static", "String", "toHexString", "(", "final", "byte", "[", "]", "data", ",", "final", "boolean", "lowerCase", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "HexExtensions", ".", "encodeHex", "(", "data", ",", "lowerCase", ")", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Transform the given {@code byte array} to a hexadecimal {@link String} value. @param data the byte array @param lowerCase the flag if the result shell be transform in lower case. If true the result is lowercase otherwise uppercase. @return the new hexadecimal {@link String} value.
[ "Transform", "the", "given", "{", "@code", "byte", "array", "}", "to", "a", "hexadecimal", "{", "@link", "String", "}", "value", "." ]
train
https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/hex/HexExtensions.java#L210-L215
tiesebarrell/process-assertions
process-assertions-api/src/main/java/org/toxos/processassertions/api/ProcessAssert.java
ProcessAssert.assertProcessEndedAndInExclusiveEndEvent
public static void assertProcessEndedAndInExclusiveEndEvent(final String processInstanceId, final String endEventId) { """ Asserts the process instance with the provided id is ended and has reached <strong>only</strong> the end event with the provided id. <p> <strong>Note:</strong> this assertion should be used for processes that have exclusive end events and no intermediate end events. This generally only applies to simple processes. If the process definition branches into non-exclusive branches with distinct end events or the process potentially has multiple end events that are reached, this method should not be used. <p> To test that a process ended in an end event and that particular end event was the final event reached, use {@link #assertProcessEndedAndReachedEndStateLast(String, String)} instead. <p> To assert that a process ended in an exact set of end events, use {@link #assertProcessEndedAndInEndEvents(String, String...)} instead. @see #assertProcessEndedAndReachedEndStateLast(String, String) @see #assertProcessEndedAndInEndEvents(String, String...) @param processInstanceId the process instance's id to check for. May not be <code>null</code> @param endEventId the end event's id to check for. May not be <code>null</code> """ Validate.notNull(processInstanceId); Validate.notNull(endEventId); apiCallback.debug(LogMessage.PROCESS_9, processInstanceId, endEventId); try { getEndEventAssertable().processEndedAndInExclusiveEndEvent(processInstanceId, endEventId); } catch (final AssertionError ae) { apiCallback.fail(ae, LogMessage.ERROR_PROCESS_3, processInstanceId, endEventId); } }
java
public static void assertProcessEndedAndInExclusiveEndEvent(final String processInstanceId, final String endEventId) { Validate.notNull(processInstanceId); Validate.notNull(endEventId); apiCallback.debug(LogMessage.PROCESS_9, processInstanceId, endEventId); try { getEndEventAssertable().processEndedAndInExclusiveEndEvent(processInstanceId, endEventId); } catch (final AssertionError ae) { apiCallback.fail(ae, LogMessage.ERROR_PROCESS_3, processInstanceId, endEventId); } }
[ "public", "static", "void", "assertProcessEndedAndInExclusiveEndEvent", "(", "final", "String", "processInstanceId", ",", "final", "String", "endEventId", ")", "{", "Validate", ".", "notNull", "(", "processInstanceId", ")", ";", "Validate", ".", "notNull", "(", "endEventId", ")", ";", "apiCallback", ".", "debug", "(", "LogMessage", ".", "PROCESS_9", ",", "processInstanceId", ",", "endEventId", ")", ";", "try", "{", "getEndEventAssertable", "(", ")", ".", "processEndedAndInExclusiveEndEvent", "(", "processInstanceId", ",", "endEventId", ")", ";", "}", "catch", "(", "final", "AssertionError", "ae", ")", "{", "apiCallback", ".", "fail", "(", "ae", ",", "LogMessage", ".", "ERROR_PROCESS_3", ",", "processInstanceId", ",", "endEventId", ")", ";", "}", "}" ]
Asserts the process instance with the provided id is ended and has reached <strong>only</strong> the end event with the provided id. <p> <strong>Note:</strong> this assertion should be used for processes that have exclusive end events and no intermediate end events. This generally only applies to simple processes. If the process definition branches into non-exclusive branches with distinct end events or the process potentially has multiple end events that are reached, this method should not be used. <p> To test that a process ended in an end event and that particular end event was the final event reached, use {@link #assertProcessEndedAndReachedEndStateLast(String, String)} instead. <p> To assert that a process ended in an exact set of end events, use {@link #assertProcessEndedAndInEndEvents(String, String...)} instead. @see #assertProcessEndedAndReachedEndStateLast(String, String) @see #assertProcessEndedAndInEndEvents(String, String...) @param processInstanceId the process instance's id to check for. May not be <code>null</code> @param endEventId the end event's id to check for. May not be <code>null</code>
[ "Asserts", "the", "process", "instance", "with", "the", "provided", "id", "is", "ended", "and", "has", "reached", "<strong", ">", "only<", "/", "strong", ">", "the", "end", "event", "with", "the", "provided", "id", "." ]
train
https://github.com/tiesebarrell/process-assertions/blob/932a8443982e356cdf5a230165a35c725d9306ab/process-assertions-api/src/main/java/org/toxos/processassertions/api/ProcessAssert.java#L184-L194
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PluginAdapterUtility.java
PluginAdapterUtility.buildFieldProperties
public static void buildFieldProperties(final Class<?> aClass, final DescriptionBuilder builder) { """ Add properties based on introspection of a class @param aClass class @param builder builder """ for (final Field field : collectClassFields(aClass)) { final PluginProperty annotation = field.getAnnotation(PluginProperty.class); if (null == annotation) { continue; } final Property pbuild = propertyFromField(field, annotation); if (null == pbuild) { continue; } builder.property(pbuild); } }
java
public static void buildFieldProperties(final Class<?> aClass, final DescriptionBuilder builder) { for (final Field field : collectClassFields(aClass)) { final PluginProperty annotation = field.getAnnotation(PluginProperty.class); if (null == annotation) { continue; } final Property pbuild = propertyFromField(field, annotation); if (null == pbuild) { continue; } builder.property(pbuild); } }
[ "public", "static", "void", "buildFieldProperties", "(", "final", "Class", "<", "?", ">", "aClass", ",", "final", "DescriptionBuilder", "builder", ")", "{", "for", "(", "final", "Field", "field", ":", "collectClassFields", "(", "aClass", ")", ")", "{", "final", "PluginProperty", "annotation", "=", "field", ".", "getAnnotation", "(", "PluginProperty", ".", "class", ")", ";", "if", "(", "null", "==", "annotation", ")", "{", "continue", ";", "}", "final", "Property", "pbuild", "=", "propertyFromField", "(", "field", ",", "annotation", ")", ";", "if", "(", "null", "==", "pbuild", ")", "{", "continue", ";", "}", "builder", ".", "property", "(", "pbuild", ")", ";", "}", "}" ]
Add properties based on introspection of a class @param aClass class @param builder builder
[ "Add", "properties", "based", "on", "introspection", "of", "a", "class" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PluginAdapterUtility.java#L151-L163
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/extras/Poi.java
Poi.distanceTo
public double distanceTo(final double LAT, final double LON) { """ Returns the distance in meters of the poi to the coordinate defined by the given latitude and longitude. The calculation takes the earth radius into account. @param LAT @param LON @return the distance in meters to the given coordinate """ final double EARTH_RADIUS = 6371000.0; // m return Math.abs(Math.acos(Math.sin(Math.toRadians(LAT)) * Math.sin(Math.toRadians(this.lat)) + Math.cos(Math.toRadians(LAT)) * Math.cos(Math.toRadians(this.lat)) * Math.cos(Math.toRadians(LON - this.lon))) * EARTH_RADIUS); }
java
public double distanceTo(final double LAT, final double LON) { final double EARTH_RADIUS = 6371000.0; // m return Math.abs(Math.acos(Math.sin(Math.toRadians(LAT)) * Math.sin(Math.toRadians(this.lat)) + Math.cos(Math.toRadians(LAT)) * Math.cos(Math.toRadians(this.lat)) * Math.cos(Math.toRadians(LON - this.lon))) * EARTH_RADIUS); }
[ "public", "double", "distanceTo", "(", "final", "double", "LAT", ",", "final", "double", "LON", ")", "{", "final", "double", "EARTH_RADIUS", "=", "6371000.0", ";", "// m", "return", "Math", ".", "abs", "(", "Math", ".", "acos", "(", "Math", ".", "sin", "(", "Math", ".", "toRadians", "(", "LAT", ")", ")", "*", "Math", ".", "sin", "(", "Math", ".", "toRadians", "(", "this", ".", "lat", ")", ")", "+", "Math", ".", "cos", "(", "Math", ".", "toRadians", "(", "LAT", ")", ")", "*", "Math", ".", "cos", "(", "Math", ".", "toRadians", "(", "this", ".", "lat", ")", ")", "*", "Math", ".", "cos", "(", "Math", ".", "toRadians", "(", "LON", "-", "this", ".", "lon", ")", ")", ")", "*", "EARTH_RADIUS", ")", ";", "}" ]
Returns the distance in meters of the poi to the coordinate defined by the given latitude and longitude. The calculation takes the earth radius into account. @param LAT @param LON @return the distance in meters to the given coordinate
[ "Returns", "the", "distance", "in", "meters", "of", "the", "poi", "to", "the", "coordinate", "defined", "by", "the", "given", "latitude", "and", "longitude", ".", "The", "calculation", "takes", "the", "earth", "radius", "into", "account", "." ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/extras/Poi.java#L371-L374
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java
CassandraDataHandlerBase.setUdtValue
private Object setUdtValue(Object entity, Object thriftColumnValue, MetamodelImpl metaModel, Attribute attribute) { """ Sets the udt value. @param entity the entity @param thriftColumnValue the thrift column value @param metaModel the meta model @param attribute the attribute @return the object """ List<FieldIdentifier> fieldNames = new ArrayList<FieldIdentifier>(); List<AbstractType<?>> fieldTypes = new ArrayList<AbstractType<?>>(); String val = null; // get from cqlMetadata, details of types and names (for maintaining // order) Map<ByteBuffer, String> schemaTypes = this.clientBase.getCqlMetadata().getValue_types(); for (Map.Entry<ByteBuffer, String> schemaType : schemaTypes.entrySet()) { UTF8Serializer utf8Serializer = UTF8Serializer.instance; String key = utf8Serializer.deserialize((schemaType.getKey())); if (key.equals(((AbstractAttribute) attribute).getJavaMember().getName())) { val = schemaType.getValue(); break; } } UserType userType = null; try { userType = UserType.getInstance(new TypeParser(val.substring(val.indexOf("UserType(") + 8, val.length()))); } catch (ConfigurationException | SyntaxException e) { log.error(e.getMessage()); throw new KunderaException("Error while getting instance of UserType " + e); } fieldNames = userType.fieldNames(); fieldTypes = userType.allTypes(); Field field = (Field) ((AbstractAttribute) attribute).getJavaMember(); Class embeddedClass = ((AbstractAttribute) attribute).getBindableJavaType(); Object embeddedObject = KunderaCoreUtils.createNewInstance(embeddedClass); Object finalValue = populateEmbeddedRecursive((ByteBuffer.wrap((byte[]) thriftColumnValue)), fieldTypes, fieldNames, embeddedObject, metaModel); PropertyAccessorHelper.set(entity, field, finalValue); return entity; }
java
private Object setUdtValue(Object entity, Object thriftColumnValue, MetamodelImpl metaModel, Attribute attribute) { List<FieldIdentifier> fieldNames = new ArrayList<FieldIdentifier>(); List<AbstractType<?>> fieldTypes = new ArrayList<AbstractType<?>>(); String val = null; // get from cqlMetadata, details of types and names (for maintaining // order) Map<ByteBuffer, String> schemaTypes = this.clientBase.getCqlMetadata().getValue_types(); for (Map.Entry<ByteBuffer, String> schemaType : schemaTypes.entrySet()) { UTF8Serializer utf8Serializer = UTF8Serializer.instance; String key = utf8Serializer.deserialize((schemaType.getKey())); if (key.equals(((AbstractAttribute) attribute).getJavaMember().getName())) { val = schemaType.getValue(); break; } } UserType userType = null; try { userType = UserType.getInstance(new TypeParser(val.substring(val.indexOf("UserType(") + 8, val.length()))); } catch (ConfigurationException | SyntaxException e) { log.error(e.getMessage()); throw new KunderaException("Error while getting instance of UserType " + e); } fieldNames = userType.fieldNames(); fieldTypes = userType.allTypes(); Field field = (Field) ((AbstractAttribute) attribute).getJavaMember(); Class embeddedClass = ((AbstractAttribute) attribute).getBindableJavaType(); Object embeddedObject = KunderaCoreUtils.createNewInstance(embeddedClass); Object finalValue = populateEmbeddedRecursive((ByteBuffer.wrap((byte[]) thriftColumnValue)), fieldTypes, fieldNames, embeddedObject, metaModel); PropertyAccessorHelper.set(entity, field, finalValue); return entity; }
[ "private", "Object", "setUdtValue", "(", "Object", "entity", ",", "Object", "thriftColumnValue", ",", "MetamodelImpl", "metaModel", ",", "Attribute", "attribute", ")", "{", "List", "<", "FieldIdentifier", ">", "fieldNames", "=", "new", "ArrayList", "<", "FieldIdentifier", ">", "(", ")", ";", "List", "<", "AbstractType", "<", "?", ">", ">", "fieldTypes", "=", "new", "ArrayList", "<", "AbstractType", "<", "?", ">", ">", "(", ")", ";", "String", "val", "=", "null", ";", "// get from cqlMetadata, details of types and names (for maintaining", "// order)", "Map", "<", "ByteBuffer", ",", "String", ">", "schemaTypes", "=", "this", ".", "clientBase", ".", "getCqlMetadata", "(", ")", ".", "getValue_types", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "ByteBuffer", ",", "String", ">", "schemaType", ":", "schemaTypes", ".", "entrySet", "(", ")", ")", "{", "UTF8Serializer", "utf8Serializer", "=", "UTF8Serializer", ".", "instance", ";", "String", "key", "=", "utf8Serializer", ".", "deserialize", "(", "(", "schemaType", ".", "getKey", "(", ")", ")", ")", ";", "if", "(", "key", ".", "equals", "(", "(", "(", "AbstractAttribute", ")", "attribute", ")", ".", "getJavaMember", "(", ")", ".", "getName", "(", ")", ")", ")", "{", "val", "=", "schemaType", ".", "getValue", "(", ")", ";", "break", ";", "}", "}", "UserType", "userType", "=", "null", ";", "try", "{", "userType", "=", "UserType", ".", "getInstance", "(", "new", "TypeParser", "(", "val", ".", "substring", "(", "val", ".", "indexOf", "(", "\"UserType(\"", ")", "+", "8", ",", "val", ".", "length", "(", ")", ")", ")", ")", ";", "}", "catch", "(", "ConfigurationException", "|", "SyntaxException", "e", ")", "{", "log", ".", "error", "(", "e", ".", "getMessage", "(", ")", ")", ";", "throw", "new", "KunderaException", "(", "\"Error while getting instance of UserType \"", "+", "e", ")", ";", "}", "fieldNames", "=", "userType", ".", "fieldNames", "(", ")", ";", "fieldTypes", "=", "userType", ".", "allTypes", "(", ")", ";", "Field", "field", "=", "(", "Field", ")", "(", "(", "AbstractAttribute", ")", "attribute", ")", ".", "getJavaMember", "(", ")", ";", "Class", "embeddedClass", "=", "(", "(", "AbstractAttribute", ")", "attribute", ")", ".", "getBindableJavaType", "(", ")", ";", "Object", "embeddedObject", "=", "KunderaCoreUtils", ".", "createNewInstance", "(", "embeddedClass", ")", ";", "Object", "finalValue", "=", "populateEmbeddedRecursive", "(", "(", "ByteBuffer", ".", "wrap", "(", "(", "byte", "[", "]", ")", "thriftColumnValue", ")", ")", ",", "fieldTypes", ",", "fieldNames", ",", "embeddedObject", ",", "metaModel", ")", ";", "PropertyAccessorHelper", ".", "set", "(", "entity", ",", "field", ",", "finalValue", ")", ";", "return", "entity", ";", "}" ]
Sets the udt value. @param entity the entity @param thriftColumnValue the thrift column value @param metaModel the meta model @param attribute the attribute @return the object
[ "Sets", "the", "udt", "value", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java#L1327-L1374
apereo/cas
support/cas-server-support-generic-remote-webflow/src/main/java/org/apereo/cas/adaptors/generic/remote/RemoteAddressAuthenticationHandler.java
RemoteAddressAuthenticationHandler.containsAddress
private static boolean containsAddress(final InetAddress network, final InetAddress netmask, final InetAddress ip) { """ Checks if a subnet contains a specific IP address. @param network The network address. @param netmask The subnet mask. @param ip The IP address to check. @return A boolean value. """ LOGGER.debug("Checking IP address: [{}] in [{}] by [{}]", ip, network, netmask); val networkBytes = network.getAddress(); val netmaskBytes = netmask.getAddress(); val ipBytes = ip.getAddress(); /* check IPv4/v6-compatibility or parameters: */ if (networkBytes.length != netmaskBytes.length || netmaskBytes.length != ipBytes.length) { LOGGER.debug("Network address [{}], subnet mask [{}] and/or host address [{}]" + " have different sizes! (return false ...)", network, netmask, ip); return false; } /* Check if the masked network and ip addresses match: */ for (var i = 0; i < netmaskBytes.length; i++) { val mask = netmaskBytes[i] & HEX_RIGHT_SHIFT_COEFFICIENT; if ((networkBytes[i] & mask) != (ipBytes[i] & mask)) { LOGGER.debug("[{}] is not in [{}]/[{}]", ip, network, netmask); return false; } } LOGGER.debug("[{}] is in [{}]/[{}]", ip, network, netmask); return true; }
java
private static boolean containsAddress(final InetAddress network, final InetAddress netmask, final InetAddress ip) { LOGGER.debug("Checking IP address: [{}] in [{}] by [{}]", ip, network, netmask); val networkBytes = network.getAddress(); val netmaskBytes = netmask.getAddress(); val ipBytes = ip.getAddress(); /* check IPv4/v6-compatibility or parameters: */ if (networkBytes.length != netmaskBytes.length || netmaskBytes.length != ipBytes.length) { LOGGER.debug("Network address [{}], subnet mask [{}] and/or host address [{}]" + " have different sizes! (return false ...)", network, netmask, ip); return false; } /* Check if the masked network and ip addresses match: */ for (var i = 0; i < netmaskBytes.length; i++) { val mask = netmaskBytes[i] & HEX_RIGHT_SHIFT_COEFFICIENT; if ((networkBytes[i] & mask) != (ipBytes[i] & mask)) { LOGGER.debug("[{}] is not in [{}]/[{}]", ip, network, netmask); return false; } } LOGGER.debug("[{}] is in [{}]/[{}]", ip, network, netmask); return true; }
[ "private", "static", "boolean", "containsAddress", "(", "final", "InetAddress", "network", ",", "final", "InetAddress", "netmask", ",", "final", "InetAddress", "ip", ")", "{", "LOGGER", ".", "debug", "(", "\"Checking IP address: [{}] in [{}] by [{}]\"", ",", "ip", ",", "network", ",", "netmask", ")", ";", "val", "networkBytes", "=", "network", ".", "getAddress", "(", ")", ";", "val", "netmaskBytes", "=", "netmask", ".", "getAddress", "(", ")", ";", "val", "ipBytes", "=", "ip", ".", "getAddress", "(", ")", ";", "/* check IPv4/v6-compatibility or parameters: */", "if", "(", "networkBytes", ".", "length", "!=", "netmaskBytes", ".", "length", "||", "netmaskBytes", ".", "length", "!=", "ipBytes", ".", "length", ")", "{", "LOGGER", ".", "debug", "(", "\"Network address [{}], subnet mask [{}] and/or host address [{}]\"", "+", "\" have different sizes! (return false ...)\"", ",", "network", ",", "netmask", ",", "ip", ")", ";", "return", "false", ";", "}", "/* Check if the masked network and ip addresses match: */", "for", "(", "var", "i", "=", "0", ";", "i", "<", "netmaskBytes", ".", "length", ";", "i", "++", ")", "{", "val", "mask", "=", "netmaskBytes", "[", "i", "]", "&", "HEX_RIGHT_SHIFT_COEFFICIENT", ";", "if", "(", "(", "networkBytes", "[", "i", "]", "&", "mask", ")", "!=", "(", "ipBytes", "[", "i", "]", "&", "mask", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"[{}] is not in [{}]/[{}]\"", ",", "ip", ",", "network", ",", "netmask", ")", ";", "return", "false", ";", "}", "}", "LOGGER", ".", "debug", "(", "\"[{}] is in [{}]/[{}]\"", ",", "ip", ",", "network", ",", "netmask", ")", ";", "return", "true", ";", "}" ]
Checks if a subnet contains a specific IP address. @param network The network address. @param netmask The subnet mask. @param ip The IP address to check. @return A boolean value.
[ "Checks", "if", "a", "subnet", "contains", "a", "specific", "IP", "address", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-generic-remote-webflow/src/main/java/org/apereo/cas/adaptors/generic/remote/RemoteAddressAuthenticationHandler.java#L60-L80
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/config/ConfigurationReader.java
ConfigurationReader.parseDebugConfig
private void parseDebugConfig(final Node node, final ConfigSettings config) { """ Parses the debug parameter section. @param node Reference to the current used xml node @param config Reference to the ConfigSettings """ String name; Boolean value; Node nnode; NodeList list = node.getChildNodes(); int length = list.getLength(); for (int i = 0; i < length; i++) { nnode = list.item(i); name = nnode.getNodeName().toUpperCase(); if (name.equals(KEY_VERIFICATION_DIFF)) { value = Boolean.parseBoolean(nnode.getChildNodes().item(0) .getNodeValue()); config.setConfigParameter(ConfigurationKeys.VERIFICATION_DIFF, value); } else if (name.equals(KEY_VERIFICATION_ENCODING)) { value = Boolean.parseBoolean(nnode.getChildNodes().item(0) .getNodeValue()); config.setConfigParameter( ConfigurationKeys.VERIFICATION_ENCODING, value); } else if (name.equals(KEY_STATISTICAL_OUTPUT)) { value = Boolean.parseBoolean(nnode.getChildNodes().item(0) .getNodeValue()); config.setConfigParameter( ConfigurationKeys.MODE_STATISTICAL_OUTPUT, value); } else if (name.equals(SUBSECTION_DEBUG_OUTPUT)) { parseDebugOutputConfig(nnode, config); } } }
java
private void parseDebugConfig(final Node node, final ConfigSettings config) { String name; Boolean value; Node nnode; NodeList list = node.getChildNodes(); int length = list.getLength(); for (int i = 0; i < length; i++) { nnode = list.item(i); name = nnode.getNodeName().toUpperCase(); if (name.equals(KEY_VERIFICATION_DIFF)) { value = Boolean.parseBoolean(nnode.getChildNodes().item(0) .getNodeValue()); config.setConfigParameter(ConfigurationKeys.VERIFICATION_DIFF, value); } else if (name.equals(KEY_VERIFICATION_ENCODING)) { value = Boolean.parseBoolean(nnode.getChildNodes().item(0) .getNodeValue()); config.setConfigParameter( ConfigurationKeys.VERIFICATION_ENCODING, value); } else if (name.equals(KEY_STATISTICAL_OUTPUT)) { value = Boolean.parseBoolean(nnode.getChildNodes().item(0) .getNodeValue()); config.setConfigParameter( ConfigurationKeys.MODE_STATISTICAL_OUTPUT, value); } else if (name.equals(SUBSECTION_DEBUG_OUTPUT)) { parseDebugOutputConfig(nnode, config); } } }
[ "private", "void", "parseDebugConfig", "(", "final", "Node", "node", ",", "final", "ConfigSettings", "config", ")", "{", "String", "name", ";", "Boolean", "value", ";", "Node", "nnode", ";", "NodeList", "list", "=", "node", ".", "getChildNodes", "(", ")", ";", "int", "length", "=", "list", ".", "getLength", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "nnode", "=", "list", ".", "item", "(", "i", ")", ";", "name", "=", "nnode", ".", "getNodeName", "(", ")", ".", "toUpperCase", "(", ")", ";", "if", "(", "name", ".", "equals", "(", "KEY_VERIFICATION_DIFF", ")", ")", "{", "value", "=", "Boolean", ".", "parseBoolean", "(", "nnode", ".", "getChildNodes", "(", ")", ".", "item", "(", "0", ")", ".", "getNodeValue", "(", ")", ")", ";", "config", ".", "setConfigParameter", "(", "ConfigurationKeys", ".", "VERIFICATION_DIFF", ",", "value", ")", ";", "}", "else", "if", "(", "name", ".", "equals", "(", "KEY_VERIFICATION_ENCODING", ")", ")", "{", "value", "=", "Boolean", ".", "parseBoolean", "(", "nnode", ".", "getChildNodes", "(", ")", ".", "item", "(", "0", ")", ".", "getNodeValue", "(", ")", ")", ";", "config", ".", "setConfigParameter", "(", "ConfigurationKeys", ".", "VERIFICATION_ENCODING", ",", "value", ")", ";", "}", "else", "if", "(", "name", ".", "equals", "(", "KEY_STATISTICAL_OUTPUT", ")", ")", "{", "value", "=", "Boolean", ".", "parseBoolean", "(", "nnode", ".", "getChildNodes", "(", ")", ".", "item", "(", "0", ")", ".", "getNodeValue", "(", ")", ")", ";", "config", ".", "setConfigParameter", "(", "ConfigurationKeys", ".", "MODE_STATISTICAL_OUTPUT", ",", "value", ")", ";", "}", "else", "if", "(", "name", ".", "equals", "(", "SUBSECTION_DEBUG_OUTPUT", ")", ")", "{", "parseDebugOutputConfig", "(", "nnode", ",", "config", ")", ";", "}", "}", "}" ]
Parses the debug parameter section. @param node Reference to the current used xml node @param config Reference to the ConfigSettings
[ "Parses", "the", "debug", "parameter", "section", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/config/ConfigurationReader.java#L766-L809
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java
ContainerKeyCache.updateSegmentIndexOffset
void updateSegmentIndexOffset(long segmentId, long indexOffset) { """ Updates the Last Indexed Offset for a given Segment. This is used for cache eviction purposes - no cache entry with a segment offsets smaller than this value may be evicted. A Segment must be registered either via this method or via {@link #updateSegmentIndexOffsetIfMissing} in order to have backpointers recorded for the tail-end section of the index. @param segmentId The Id of the Segment to update the Last Indexed Offset for. @param indexOffset The Last Indexed Offset to set. If negative, this will clear up the value. """ boolean remove = indexOffset < 0; SegmentKeyCache cache; int generation; synchronized (this.segmentCaches) { generation = this.currentCacheGeneration; if (remove) { cache = this.segmentCaches.remove(segmentId); } else { cache = this.segmentCaches.computeIfAbsent(segmentId, s -> new SegmentKeyCache(s, this.cache)); } } if (cache != null) { if (remove) { evict(cache.evictAll()); } else { cache.setLastIndexedOffset(indexOffset, generation); } } }
java
void updateSegmentIndexOffset(long segmentId, long indexOffset) { boolean remove = indexOffset < 0; SegmentKeyCache cache; int generation; synchronized (this.segmentCaches) { generation = this.currentCacheGeneration; if (remove) { cache = this.segmentCaches.remove(segmentId); } else { cache = this.segmentCaches.computeIfAbsent(segmentId, s -> new SegmentKeyCache(s, this.cache)); } } if (cache != null) { if (remove) { evict(cache.evictAll()); } else { cache.setLastIndexedOffset(indexOffset, generation); } } }
[ "void", "updateSegmentIndexOffset", "(", "long", "segmentId", ",", "long", "indexOffset", ")", "{", "boolean", "remove", "=", "indexOffset", "<", "0", ";", "SegmentKeyCache", "cache", ";", "int", "generation", ";", "synchronized", "(", "this", ".", "segmentCaches", ")", "{", "generation", "=", "this", ".", "currentCacheGeneration", ";", "if", "(", "remove", ")", "{", "cache", "=", "this", ".", "segmentCaches", ".", "remove", "(", "segmentId", ")", ";", "}", "else", "{", "cache", "=", "this", ".", "segmentCaches", ".", "computeIfAbsent", "(", "segmentId", ",", "s", "->", "new", "SegmentKeyCache", "(", "s", ",", "this", ".", "cache", ")", ")", ";", "}", "}", "if", "(", "cache", "!=", "null", ")", "{", "if", "(", "remove", ")", "{", "evict", "(", "cache", ".", "evictAll", "(", ")", ")", ";", "}", "else", "{", "cache", ".", "setLastIndexedOffset", "(", "indexOffset", ",", "generation", ")", ";", "}", "}", "}" ]
Updates the Last Indexed Offset for a given Segment. This is used for cache eviction purposes - no cache entry with a segment offsets smaller than this value may be evicted. A Segment must be registered either via this method or via {@link #updateSegmentIndexOffsetIfMissing} in order to have backpointers recorded for the tail-end section of the index. @param segmentId The Id of the Segment to update the Last Indexed Offset for. @param indexOffset The Last Indexed Offset to set. If negative, this will clear up the value.
[ "Updates", "the", "Last", "Indexed", "Offset", "for", "a", "given", "Segment", ".", "This", "is", "used", "for", "cache", "eviction", "purposes", "-", "no", "cache", "entry", "with", "a", "segment", "offsets", "smaller", "than", "this", "value", "may", "be", "evicted", ".", "A", "Segment", "must", "be", "registered", "either", "via", "this", "method", "or", "via", "{", "@link", "#updateSegmentIndexOffsetIfMissing", "}", "in", "order", "to", "have", "backpointers", "recorded", "for", "the", "tail", "-", "end", "section", "of", "the", "index", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java#L192-L212
alkacon/opencms-core
src/org/opencms/ade/sitemap/shared/CmsClientSitemapEntry.java
CmsClientSitemapEntry.insertSubEntry
public void insertSubEntry(CmsClientSitemapEntry entry, int position, I_CmsSitemapController controller) { """ Inserts the given entry at the given position.<p> @param entry the entry to insert @param position the position @param controller a sitemap controller instance """ entry.updateSitePath(CmsStringUtil.joinPaths(m_sitePath, entry.getName()), controller); m_subEntries.add(position, entry); updatePositions(position); }
java
public void insertSubEntry(CmsClientSitemapEntry entry, int position, I_CmsSitemapController controller) { entry.updateSitePath(CmsStringUtil.joinPaths(m_sitePath, entry.getName()), controller); m_subEntries.add(position, entry); updatePositions(position); }
[ "public", "void", "insertSubEntry", "(", "CmsClientSitemapEntry", "entry", ",", "int", "position", ",", "I_CmsSitemapController", "controller", ")", "{", "entry", ".", "updateSitePath", "(", "CmsStringUtil", ".", "joinPaths", "(", "m_sitePath", ",", "entry", ".", "getName", "(", ")", ")", ",", "controller", ")", ";", "m_subEntries", ".", "add", "(", "position", ",", "entry", ")", ";", "updatePositions", "(", "position", ")", ";", "}" ]
Inserts the given entry at the given position.<p> @param entry the entry to insert @param position the position @param controller a sitemap controller instance
[ "Inserts", "the", "given", "entry", "at", "the", "given", "position", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/shared/CmsClientSitemapEntry.java#L551-L556
michel-kraemer/bson4jackson
src/main/java/de/undercouch/bson4jackson/BsonFactory.java
BsonFactory.configure
public final BsonFactory configure(BsonParser.Feature f, boolean state) { """ Method for enabling/disabling specified parser features (check {@link BsonParser.Feature} for list of features) @param f the feature to enable or disable @param state true if the feature should be enabled, false otherwise @return this BsonFactory """ if (state) { return enable(f); } return disable(f); }
java
public final BsonFactory configure(BsonParser.Feature f, boolean state) { if (state) { return enable(f); } return disable(f); }
[ "public", "final", "BsonFactory", "configure", "(", "BsonParser", ".", "Feature", "f", ",", "boolean", "state", ")", "{", "if", "(", "state", ")", "{", "return", "enable", "(", "f", ")", ";", "}", "return", "disable", "(", "f", ")", ";", "}" ]
Method for enabling/disabling specified parser features (check {@link BsonParser.Feature} for list of features) @param f the feature to enable or disable @param state true if the feature should be enabled, false otherwise @return this BsonFactory
[ "Method", "for", "enabling", "/", "disabling", "specified", "parser", "features", "(", "check", "{" ]
train
https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/BsonFactory.java#L161-L166
treasure-data/td-client-java
src/main/java/com/treasuredata/client/TDHttpClient.java
TDHttpClient.call
public <Result> Result call(TDApiRequest apiRequest, Optional<String> apiKeyCache, final Function<InputStream, Result> contentStreamHandler) { """ Submit an API request, and returns the byte InputStream. This stream is valid until exiting this function. @param apiRequest @param apiKeyCache @param contentStreamHandler @param <Result> @return """ return submitRequest(apiRequest, apiKeyCache, newByteStreamHandler(contentStreamHandler)); }
java
public <Result> Result call(TDApiRequest apiRequest, Optional<String> apiKeyCache, final Function<InputStream, Result> contentStreamHandler) { return submitRequest(apiRequest, apiKeyCache, newByteStreamHandler(contentStreamHandler)); }
[ "public", "<", "Result", ">", "Result", "call", "(", "TDApiRequest", "apiRequest", ",", "Optional", "<", "String", ">", "apiKeyCache", ",", "final", "Function", "<", "InputStream", ",", "Result", ">", "contentStreamHandler", ")", "{", "return", "submitRequest", "(", "apiRequest", ",", "apiKeyCache", ",", "newByteStreamHandler", "(", "contentStreamHandler", ")", ")", ";", "}" ]
Submit an API request, and returns the byte InputStream. This stream is valid until exiting this function. @param apiRequest @param apiKeyCache @param contentStreamHandler @param <Result> @return
[ "Submit", "an", "API", "request", "and", "returns", "the", "byte", "InputStream", ".", "This", "stream", "is", "valid", "until", "exiting", "this", "function", "." ]
train
https://github.com/treasure-data/td-client-java/blob/2769cbcf0e787d457344422cfcdde467399bd684/src/main/java/com/treasuredata/client/TDHttpClient.java#L499-L502
codescape/bitvunit
bitvunit-core/src/main/java/de/codescape/bitvunit/report/TextReportWriter.java
TextReportWriter.printViolations
private void printViolations(Violations violations, PrintWriter out) { """ Writes the part where all {@link Violations} that were found are listed. @param violations {@link Violations} that were found @param out target where the report is written to """ out.println("Violations found:"); if (violations.hasViolations()) { for (Violation violation : violations.asList()) { out.println(" - " + violation); } } else { out.println(" - No violations found."); } }
java
private void printViolations(Violations violations, PrintWriter out) { out.println("Violations found:"); if (violations.hasViolations()) { for (Violation violation : violations.asList()) { out.println(" - " + violation); } } else { out.println(" - No violations found."); } }
[ "private", "void", "printViolations", "(", "Violations", "violations", ",", "PrintWriter", "out", ")", "{", "out", ".", "println", "(", "\"Violations found:\"", ")", ";", "if", "(", "violations", ".", "hasViolations", "(", ")", ")", "{", "for", "(", "Violation", "violation", ":", "violations", ".", "asList", "(", ")", ")", "{", "out", ".", "println", "(", "\" - \"", "+", "violation", ")", ";", "}", "}", "else", "{", "out", ".", "println", "(", "\" - No violations found.\"", ")", ";", "}", "}" ]
Writes the part where all {@link Violations} that were found are listed. @param violations {@link Violations} that were found @param out target where the report is written to
[ "Writes", "the", "part", "where", "all", "{", "@link", "Violations", "}", "that", "were", "found", "are", "listed", "." ]
train
https://github.com/codescape/bitvunit/blob/cef6d9af60d684e41294981c10b6d92c8f063a4e/bitvunit-core/src/main/java/de/codescape/bitvunit/report/TextReportWriter.java#L72-L81
looly/hutool
hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java
DaoTemplate.del
public <T> int del(String field, T value) throws SQLException { """ 删除 @param <T> 主键类型 @param field 字段名 @param value 字段值 @return 删除行数 @throws SQLException SQL执行异常 """ if (StrUtil.isBlank(field)) { return 0; } return this.del(Entity.create(tableName).set(field, value)); }
java
public <T> int del(String field, T value) throws SQLException { if (StrUtil.isBlank(field)) { return 0; } return this.del(Entity.create(tableName).set(field, value)); }
[ "public", "<", "T", ">", "int", "del", "(", "String", "field", ",", "T", "value", ")", "throws", "SQLException", "{", "if", "(", "StrUtil", ".", "isBlank", "(", "field", ")", ")", "{", "return", "0", ";", "}", "return", "this", ".", "del", "(", "Entity", ".", "create", "(", "tableName", ")", ".", "set", "(", "field", ",", "value", ")", ")", ";", "}" ]
删除 @param <T> 主键类型 @param field 字段名 @param value 字段值 @return 删除行数 @throws SQLException SQL执行异常
[ "删除" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java#L136-L142
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/TransformationUtils.java
TransformationUtils.scaleToWidth
public static Envelope scaleToWidth( Envelope original, double newWidth ) { """ Scale an envelope to have a given width. @param original the envelope. @param newWidth the new width to use. @return the scaled envelope placed in the original lower left corner position. """ double width = original.getWidth(); double factor = newWidth / width; double newHeight = original.getHeight() * factor; return new Envelope(original.getMinX(), original.getMinX() + newWidth, original.getMinY(), original.getMinY() + newHeight); }
java
public static Envelope scaleToWidth( Envelope original, double newWidth ) { double width = original.getWidth(); double factor = newWidth / width; double newHeight = original.getHeight() * factor; return new Envelope(original.getMinX(), original.getMinX() + newWidth, original.getMinY(), original.getMinY() + newHeight); }
[ "public", "static", "Envelope", "scaleToWidth", "(", "Envelope", "original", ",", "double", "newWidth", ")", "{", "double", "width", "=", "original", ".", "getWidth", "(", ")", ";", "double", "factor", "=", "newWidth", "/", "width", ";", "double", "newHeight", "=", "original", ".", "getHeight", "(", ")", "*", "factor", ";", "return", "new", "Envelope", "(", "original", ".", "getMinX", "(", ")", ",", "original", ".", "getMinX", "(", ")", "+", "newWidth", ",", "original", ".", "getMinY", "(", ")", ",", "original", ".", "getMinY", "(", ")", "+", "newHeight", ")", ";", "}" ]
Scale an envelope to have a given width. @param original the envelope. @param newWidth the new width to use. @return the scaled envelope placed in the original lower left corner position.
[ "Scale", "an", "envelope", "to", "have", "a", "given", "width", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/TransformationUtils.java#L108-L116
graknlabs/grakn
server/src/server/kb/concept/ElementFactory.java
ElementFactory.buildRelation
RelationImpl buildRelation(EdgeElement edge, RelationType type, Role owner, Role value) { """ Used to build a RelationEdge by ThingImpl when it needs to connect itself with an attribute (implicit relation) """ return getOrBuildConcept(edge, (e) -> RelationImpl.create(RelationEdge.create(type, owner, value, edge))); }
java
RelationImpl buildRelation(EdgeElement edge, RelationType type, Role owner, Role value) { return getOrBuildConcept(edge, (e) -> RelationImpl.create(RelationEdge.create(type, owner, value, edge))); }
[ "RelationImpl", "buildRelation", "(", "EdgeElement", "edge", ",", "RelationType", "type", ",", "Role", "owner", ",", "Role", "value", ")", "{", "return", "getOrBuildConcept", "(", "edge", ",", "(", "e", ")", "-", ">", "RelationImpl", ".", "create", "(", "RelationEdge", ".", "create", "(", "type", ",", "owner", ",", "value", ",", "edge", ")", ")", ")", ";", "}" ]
Used to build a RelationEdge by ThingImpl when it needs to connect itself with an attribute (implicit relation)
[ "Used", "to", "build", "a", "RelationEdge", "by", "ThingImpl", "when", "it", "needs", "to", "connect", "itself", "with", "an", "attribute", "(", "implicit", "relation", ")" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ElementFactory.java#L106-L108
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CopyOnWriteArraySet.java
CopyOnWriteArraySet.compareSets
private static int compareSets(Object[] snapshot, Set<?> set) { """ Tells whether the objects in snapshot (regarded as a set) are a superset of the given set. @return -1 if snapshot is not a superset, 0 if the two sets contain precisely the same elements, and 1 if snapshot is a proper superset of the given set """ // Uses O(n^2) algorithm, that is only appropriate for small // sets, which CopyOnWriteArraySets should be. // // Optimize up to O(n) if the two sets share a long common prefix, // as might happen if one set was created as a copy of the other set. final int len = snapshot.length; // Mark matched elements to avoid re-checking final boolean[] matched = new boolean[len]; // j is the largest int with matched[i] true for { i | 0 <= i < j } int j = 0; outer: for (Object x : set) { for (int i = j; i < len; i++) { if (!matched[i] && Objects.equals(x, snapshot[i])) { matched[i] = true; if (i == j) do { j++; } while (j < len && matched[j]); continue outer; } } return -1; } return (j == len) ? 0 : 1; }
java
private static int compareSets(Object[] snapshot, Set<?> set) { // Uses O(n^2) algorithm, that is only appropriate for small // sets, which CopyOnWriteArraySets should be. // // Optimize up to O(n) if the two sets share a long common prefix, // as might happen if one set was created as a copy of the other set. final int len = snapshot.length; // Mark matched elements to avoid re-checking final boolean[] matched = new boolean[len]; // j is the largest int with matched[i] true for { i | 0 <= i < j } int j = 0; outer: for (Object x : set) { for (int i = j; i < len; i++) { if (!matched[i] && Objects.equals(x, snapshot[i])) { matched[i] = true; if (i == j) do { j++; } while (j < len && matched[j]); continue outer; } } return -1; } return (j == len) ? 0 : 1; }
[ "private", "static", "int", "compareSets", "(", "Object", "[", "]", "snapshot", ",", "Set", "<", "?", ">", "set", ")", "{", "// Uses O(n^2) algorithm, that is only appropriate for small", "// sets, which CopyOnWriteArraySets should be.", "//", "// Optimize up to O(n) if the two sets share a long common prefix,", "// as might happen if one set was created as a copy of the other set.", "final", "int", "len", "=", "snapshot", ".", "length", ";", "// Mark matched elements to avoid re-checking", "final", "boolean", "[", "]", "matched", "=", "new", "boolean", "[", "len", "]", ";", "// j is the largest int with matched[i] true for { i | 0 <= i < j }", "int", "j", "=", "0", ";", "outer", ":", "for", "(", "Object", "x", ":", "set", ")", "{", "for", "(", "int", "i", "=", "j", ";", "i", "<", "len", ";", "i", "++", ")", "{", "if", "(", "!", "matched", "[", "i", "]", "&&", "Objects", ".", "equals", "(", "x", ",", "snapshot", "[", "i", "]", ")", ")", "{", "matched", "[", "i", "]", "=", "true", ";", "if", "(", "i", "==", "j", ")", "do", "{", "j", "++", ";", "}", "while", "(", "j", "<", "len", "&&", "matched", "[", "j", "]", ")", ";", "continue", "outer", ";", "}", "}", "return", "-", "1", ";", "}", "return", "(", "j", "==", "len", ")", "?", "0", ":", "1", ";", "}" ]
Tells whether the objects in snapshot (regarded as a set) are a superset of the given set. @return -1 if snapshot is not a superset, 0 if the two sets contain precisely the same elements, and 1 if snapshot is a proper superset of the given set
[ "Tells", "whether", "the", "objects", "in", "snapshot", "(", "regarded", "as", "a", "set", ")", "are", "a", "superset", "of", "the", "given", "set", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CopyOnWriteArraySet.java#L290-L315
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getHierarchicalEntityChild
public HierarchicalChildEntity getHierarchicalEntityChild(UUID appId, String versionId, UUID hEntityId, UUID hChildId) { """ Gets information about the hierarchical entity child model. @param appId The application ID. @param versionId The version ID. @param hEntityId The hierarchical entity extractor ID. @param hChildId The hierarchical entity extractor child ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the HierarchicalChildEntity object if successful. """ return getHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEntityId, hChildId).toBlocking().single().body(); }
java
public HierarchicalChildEntity getHierarchicalEntityChild(UUID appId, String versionId, UUID hEntityId, UUID hChildId) { return getHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEntityId, hChildId).toBlocking().single().body(); }
[ "public", "HierarchicalChildEntity", "getHierarchicalEntityChild", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "hEntityId", ",", "UUID", "hChildId", ")", "{", "return", "getHierarchicalEntityChildWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "hEntityId", ",", "hChildId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets information about the hierarchical entity child model. @param appId The application ID. @param versionId The version ID. @param hEntityId The hierarchical entity extractor ID. @param hChildId The hierarchical entity extractor child ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the HierarchicalChildEntity object if successful.
[ "Gets", "information", "about", "the", "hierarchical", "entity", "child", "model", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L6241-L6243
shrinkwrap/resolver
api/src/main/java/org/jboss/shrinkwrap/resolver/api/Invokable.java
Invokable.loadClass
static Class<?> loadClass(ClassLoader cl, String classTypeName) throws InvocationException { """ Loads a class from classloader @param cl classloader to be used @param classTypeName fully qualified class name @return @throws InvocationException if class was not found in classloader """ try { return cl.loadClass(classTypeName); } catch (ClassNotFoundException e) { throw new InvocationException(e, "Unable to load class {0} with class loader {1}", classTypeName, cl); } }
java
static Class<?> loadClass(ClassLoader cl, String classTypeName) throws InvocationException { try { return cl.loadClass(classTypeName); } catch (ClassNotFoundException e) { throw new InvocationException(e, "Unable to load class {0} with class loader {1}", classTypeName, cl); } }
[ "static", "Class", "<", "?", ">", "loadClass", "(", "ClassLoader", "cl", ",", "String", "classTypeName", ")", "throws", "InvocationException", "{", "try", "{", "return", "cl", ".", "loadClass", "(", "classTypeName", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "throw", "new", "InvocationException", "(", "e", ",", "\"Unable to load class {0} with class loader {1}\"", ",", "classTypeName", ",", "cl", ")", ";", "}", "}" ]
Loads a class from classloader @param cl classloader to be used @param classTypeName fully qualified class name @return @throws InvocationException if class was not found in classloader
[ "Loads", "a", "class", "from", "classloader" ]
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/api/src/main/java/org/jboss/shrinkwrap/resolver/api/Invokable.java#L62-L68
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java
LambdaDslObject.eachLike
public LambdaDslObject eachLike(String name, Consumer<LambdaDslObject> nestedObject) { """ Attribute that is an array where each item must match the following example @param name field name """ final PactDslJsonBody arrayLike = object.eachLike(name); final LambdaDslObject dslObject = new LambdaDslObject(arrayLike); nestedObject.accept(dslObject); arrayLike.closeArray(); return this; }
java
public LambdaDslObject eachLike(String name, Consumer<LambdaDslObject> nestedObject) { final PactDslJsonBody arrayLike = object.eachLike(name); final LambdaDslObject dslObject = new LambdaDslObject(arrayLike); nestedObject.accept(dslObject); arrayLike.closeArray(); return this; }
[ "public", "LambdaDslObject", "eachLike", "(", "String", "name", ",", "Consumer", "<", "LambdaDslObject", ">", "nestedObject", ")", "{", "final", "PactDslJsonBody", "arrayLike", "=", "object", ".", "eachLike", "(", "name", ")", ";", "final", "LambdaDslObject", "dslObject", "=", "new", "LambdaDslObject", "(", "arrayLike", ")", ";", "nestedObject", ".", "accept", "(", "dslObject", ")", ";", "arrayLike", ".", "closeArray", "(", ")", ";", "return", "this", ";", "}" ]
Attribute that is an array where each item must match the following example @param name field name
[ "Attribute", "that", "is", "an", "array", "where", "each", "item", "must", "match", "the", "following", "example" ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L387-L393