repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
mapsforge/mapsforge
mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/Deserializer.java
Deserializer.getFiveBytesLong
static long getFiveBytesLong(byte[] buffer, int offset) { return (buffer[offset] & 0xffL) << 32 | (buffer[offset + 1] & 0xffL) << 24 | (buffer[offset + 2] & 0xffL) << 16 | (buffer[offset + 3] & 0xffL) << 8 | (buffer[offset + 4] & 0xffL); }
java
static long getFiveBytesLong(byte[] buffer, int offset) { return (buffer[offset] & 0xffL) << 32 | (buffer[offset + 1] & 0xffL) << 24 | (buffer[offset + 2] & 0xffL) << 16 | (buffer[offset + 3] & 0xffL) << 8 | (buffer[offset + 4] & 0xffL); }
[ "static", "long", "getFiveBytesLong", "(", "byte", "[", "]", "buffer", ",", "int", "offset", ")", "{", "return", "(", "buffer", "[", "offset", "]", "&", "0xff", "L", ")", "<<", "32", "|", "(", "buffer", "[", "offset", "+", "1", "]", "&", "0xff", ...
Converts five bytes of a byte array to an unsigned long. <p/> The byte order is big-endian. @param buffer the byte array. @param offset the offset in the array. @return the long value.
[ "Converts", "five", "bytes", "of", "a", "byte", "array", "to", "an", "unsigned", "long", ".", "<p", "/", ">", "The", "byte", "order", "is", "big", "-", "endian", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/Deserializer.java#L30-L33
finmath/finmath-lib
src/main/java/net/finmath/montecarlo/interestrate/products/SwaptionATM.java
SwaptionATM.getImpliedBachelierATMOptionVolatility
public RandomVariable getImpliedBachelierATMOptionVolatility(RandomVariable optionValue, double optionMaturity, double swapAnnuity){ return optionValue.average().mult(Math.sqrt(2.0 * Math.PI / optionMaturity) / swapAnnuity); }
java
public RandomVariable getImpliedBachelierATMOptionVolatility(RandomVariable optionValue, double optionMaturity, double swapAnnuity){ return optionValue.average().mult(Math.sqrt(2.0 * Math.PI / optionMaturity) / swapAnnuity); }
[ "public", "RandomVariable", "getImpliedBachelierATMOptionVolatility", "(", "RandomVariable", "optionValue", ",", "double", "optionMaturity", ",", "double", "swapAnnuity", ")", "{", "return", "optionValue", ".", "average", "(", ")", ".", "mult", "(", "Math", ".", "sq...
Calculates ATM Bachelier implied volatilities. @see net.finmath.functions.AnalyticFormulas#bachelierOptionImpliedVolatility(double, double, double, double, double) @param optionValue RandomVarable representing the value of the option @param optionMaturity Time to maturity. @param swapAnnuity The swap annuity as seen on valuation time. @return The Bachelier implied volatility.
[ "Calculates", "ATM", "Bachelier", "implied", "volatilities", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/SwaptionATM.java#L73-L75
alkacon/opencms-core
src/org/opencms/ade/publish/CmsPublish.java
CmsPublish.relationToBean
public CmsPublishResource relationToBean(CmsRelation relation) { CmsPermissionInfo permissionInfo = new CmsPermissionInfo(true, false, ""); CmsPublishResource bean = new CmsPublishResource( relation.getTargetId(), relation.getTargetPath(), relation.getTargetPath(), CmsResourceTypePlain.getStaticTypeName(), CmsResourceState.STATE_UNCHANGED, permissionInfo, 0, null, null, false, null, null); bean.setBigIconClasses(CmsIconUtil.getIconClasses(CmsResourceTypePlain.getStaticTypeName(), null, false)); return bean; }
java
public CmsPublishResource relationToBean(CmsRelation relation) { CmsPermissionInfo permissionInfo = new CmsPermissionInfo(true, false, ""); CmsPublishResource bean = new CmsPublishResource( relation.getTargetId(), relation.getTargetPath(), relation.getTargetPath(), CmsResourceTypePlain.getStaticTypeName(), CmsResourceState.STATE_UNCHANGED, permissionInfo, 0, null, null, false, null, null); bean.setBigIconClasses(CmsIconUtil.getIconClasses(CmsResourceTypePlain.getStaticTypeName(), null, false)); return bean; }
[ "public", "CmsPublishResource", "relationToBean", "(", "CmsRelation", "relation", ")", "{", "CmsPermissionInfo", "permissionInfo", "=", "new", "CmsPermissionInfo", "(", "true", ",", "false", ",", "\"\"", ")", ";", "CmsPublishResource", "bean", "=", "new", "CmsPublis...
Creates a publish resource bean from the target information of a relation object.<p> @param relation the relation to use @return the publish resource bean for the relation target
[ "Creates", "a", "publish", "resource", "bean", "from", "the", "target", "information", "of", "a", "relation", "object", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/publish/CmsPublish.java#L327-L345
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/AbstractMessage.java
AbstractMessage.toJSON
@Override public String toJSON() { final ObjectMapper mapper = buildObjectMapperForSerialization(); try { return mapper.writeValueAsString(this); } catch (JsonProcessingException e) { throw new IllegalStateException("Object cannot be parsed as JSON.", e); } }
java
@Override public String toJSON() { final ObjectMapper mapper = buildObjectMapperForSerialization(); try { return mapper.writeValueAsString(this); } catch (JsonProcessingException e) { throw new IllegalStateException("Object cannot be parsed as JSON.", e); } }
[ "@", "Override", "public", "String", "toJSON", "(", ")", "{", "final", "ObjectMapper", "mapper", "=", "buildObjectMapperForSerialization", "(", ")", ";", "try", "{", "return", "mapper", ".", "writeValueAsString", "(", "this", ")", ";", "}", "catch", "(", "Js...
Converts this message to its JSON string representation. @return JSON encoded data that represents this message.
[ "Converts", "this", "message", "to", "its", "JSON", "string", "representation", "." ]
train
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/AbstractMessage.java#L151-L159
dita-ot/dita-ot
src/main/plugins/org.dita.htmlhelp/src/main/java/org/dita/dost/ant/CheckLang.java
CheckLang.setActiveProjectProperty
private void setActiveProjectProperty(final String propertyName, final String propertyValue) { final Project activeProject = getProject(); if (activeProject != null) { activeProject.setProperty(propertyName, propertyValue); } }
java
private void setActiveProjectProperty(final String propertyName, final String propertyValue) { final Project activeProject = getProject(); if (activeProject != null) { activeProject.setProperty(propertyName, propertyValue); } }
[ "private", "void", "setActiveProjectProperty", "(", "final", "String", "propertyName", ",", "final", "String", "propertyValue", ")", "{", "final", "Project", "activeProject", "=", "getProject", "(", ")", ";", "if", "(", "activeProject", "!=", "null", ")", "{", ...
Sets property in active ant project with name specified inpropertyName, and value specified in propertyValue parameter
[ "Sets", "property", "in", "active", "ant", "project", "with", "name", "specified", "inpropertyName", "and", "value", "specified", "in", "propertyValue", "parameter" ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/plugins/org.dita.htmlhelp/src/main/java/org/dita/dost/ant/CheckLang.java#L123-L128
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndexUtil.java
ClassReflectionIndexUtil.findMethod
public static Method findMethod(final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> clazz, final MethodIdentifier methodIdentifier) { Class<?> c = clazz; List<Class<?>> interfaces = new ArrayList<>(); while (c != null) { final ClassReflectionIndex index = deploymentReflectionIndex.getClassIndex(c); final Method method = index.getMethod(methodIdentifier); if(method != null) { return method; } addInterfaces(c, interfaces); c = c.getSuperclass(); } for(Class<?> i : interfaces) { final ClassReflectionIndex index = deploymentReflectionIndex.getClassIndex(i); final Method method = index.getMethod(methodIdentifier); if(method != null) { return method; } } return null; }
java
public static Method findMethod(final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> clazz, final MethodIdentifier methodIdentifier) { Class<?> c = clazz; List<Class<?>> interfaces = new ArrayList<>(); while (c != null) { final ClassReflectionIndex index = deploymentReflectionIndex.getClassIndex(c); final Method method = index.getMethod(methodIdentifier); if(method != null) { return method; } addInterfaces(c, interfaces); c = c.getSuperclass(); } for(Class<?> i : interfaces) { final ClassReflectionIndex index = deploymentReflectionIndex.getClassIndex(i); final Method method = index.getMethod(methodIdentifier); if(method != null) { return method; } } return null; }
[ "public", "static", "Method", "findMethod", "(", "final", "DeploymentReflectionIndex", "deploymentReflectionIndex", ",", "final", "Class", "<", "?", ">", "clazz", ",", "final", "MethodIdentifier", "methodIdentifier", ")", "{", "Class", "<", "?", ">", "c", "=", "...
Finds and returns a method corresponding to the passed <code>methodIdentifier</code>. The passed <code>classReflectionIndex</code> will be used to traverse the class hierarchy while finding the method. <p/> Returns null if no such method is found @param deploymentReflectionIndex The deployment reflection index @param clazz The class reflection index which will be used to traverse the class hierarchy to find the method @param methodIdentifier The method identifier of the method being searched for @return
[ "Finds", "and", "returns", "a", "method", "corresponding", "to", "the", "passed", "<code", ">", "methodIdentifier<", "/", "code", ">", ".", "The", "passed", "<code", ">", "classReflectionIndex<", "/", "code", ">", "will", "be", "used", "to", "traverse", "the...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndexUtil.java#L53-L73
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java
ConfluenceGreenPepper.isSelected
public boolean isSelected(String selectedSystemUnderTestInfo, String key) { return selectedSystemUnderTestInfo != null ? selectedSystemUnderTestInfo.equals(key) : false; }
java
public boolean isSelected(String selectedSystemUnderTestInfo, String key) { return selectedSystemUnderTestInfo != null ? selectedSystemUnderTestInfo.equals(key) : false; }
[ "public", "boolean", "isSelected", "(", "String", "selectedSystemUnderTestInfo", ",", "String", "key", ")", "{", "return", "selectedSystemUnderTestInfo", "!=", "null", "?", "selectedSystemUnderTestInfo", ".", "equals", "(", "key", ")", ":", "false", ";", "}" ]
Verifies if the the selectedSystemUnderTestInfo matches the specified key </p> @param selectedSystemUnderTestInfo a {@link java.lang.String} object. @param key a {@link java.lang.String} object. @return true if the the selectedSystemUnderTestInfo matches the specified key.
[ "Verifies", "if", "the", "the", "selectedSystemUnderTestInfo", "matches", "the", "specified", "key", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L689-L691
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java
CommerceCountryPersistenceImpl.removeByG_A
@Override public void removeByG_A(long groupId, boolean active) { for (CommerceCountry commerceCountry : findByG_A(groupId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceCountry); } }
java
@Override public void removeByG_A(long groupId, boolean active) { for (CommerceCountry commerceCountry : findByG_A(groupId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceCountry); } }
[ "@", "Override", "public", "void", "removeByG_A", "(", "long", "groupId", ",", "boolean", "active", ")", "{", "for", "(", "CommerceCountry", "commerceCountry", ":", "findByG_A", "(", "groupId", ",", "active", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil",...
Removes all the commerce countries where groupId = &#63; and active = &#63; from the database. @param groupId the group ID @param active the active
[ "Removes", "all", "the", "commerce", "countries", "where", "groupId", "=", "&#63", ";", "and", "active", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L2934-L2940
threerings/narya
core/src/main/java/com/threerings/io/ObjectInputStream.java
ObjectInputStream.readBareObject
protected void readBareObject (Object object, Streamer streamer, boolean useReader) throws IOException, ClassNotFoundException { _current = object; _streamer = streamer; try { _streamer.readObject(object, this, useReader); } finally { // clear out our current object references _current = null; _streamer = null; } }
java
protected void readBareObject (Object object, Streamer streamer, boolean useReader) throws IOException, ClassNotFoundException { _current = object; _streamer = streamer; try { _streamer.readObject(object, this, useReader); } finally { // clear out our current object references _current = null; _streamer = null; } }
[ "protected", "void", "readBareObject", "(", "Object", "object", ",", "Streamer", "streamer", ",", "boolean", "useReader", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "_current", "=", "object", ";", "_streamer", "=", "streamer", ";", "try", ...
Reads an object from the input stream that was previously written with {@link ObjectOutputStream#writeBareObject(Object,Streamer,boolean)}.
[ "Reads", "an", "object", "from", "the", "input", "stream", "that", "was", "previously", "written", "with", "{" ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/io/ObjectInputStream.java#L277-L289
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.toMultiLineStringFromList
public MultiLineString toMultiLineStringFromList( List<List<LatLng>> polylineList) { return toMultiLineStringFromList(polylineList, false, false); }
java
public MultiLineString toMultiLineStringFromList( List<List<LatLng>> polylineList) { return toMultiLineStringFromList(polylineList, false, false); }
[ "public", "MultiLineString", "toMultiLineStringFromList", "(", "List", "<", "List", "<", "LatLng", ">", ">", "polylineList", ")", "{", "return", "toMultiLineStringFromList", "(", "polylineList", ",", "false", ",", "false", ")", ";", "}" ]
Convert a list of List<LatLng> to a {@link MultiLineString} @param polylineList polyline list @return multi line string
[ "Convert", "a", "list", "of", "List<LatLng", ">", "to", "a", "{", "@link", "MultiLineString", "}" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L859-L862
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java
CompatibilityMap.checkExtraFields
private static void checkExtraFields(JSTuple tuple, int startCol, int count) throws JMFSchemaViolationException { for (int i = startCol; i < count; i++) { JMFType field = tuple.getField(i); if (field instanceof JSVariant) { JMFType firstCase = ((JSVariant)field).getCase(0); if (firstCase instanceof JSTuple) if (((JSTuple)firstCase).getFieldCount() == 0) continue; } throw new JMFSchemaViolationException(field.getFeatureName() + " not defaulting variant"); } }
java
private static void checkExtraFields(JSTuple tuple, int startCol, int count) throws JMFSchemaViolationException { for (int i = startCol; i < count; i++) { JMFType field = tuple.getField(i); if (field instanceof JSVariant) { JMFType firstCase = ((JSVariant)field).getCase(0); if (firstCase instanceof JSTuple) if (((JSTuple)firstCase).getFieldCount() == 0) continue; } throw new JMFSchemaViolationException(field.getFeatureName() + " not defaulting variant"); } }
[ "private", "static", "void", "checkExtraFields", "(", "JSTuple", "tuple", ",", "int", "startCol", ",", "int", "count", ")", "throws", "JMFSchemaViolationException", "{", "for", "(", "int", "i", "=", "startCol", ";", "i", "<", "count", ";", "i", "++", ")", ...
Check the extra columns in a tuple to make sure they are all defaultable
[ "Check", "the", "extra", "columns", "in", "a", "tuple", "to", "make", "sure", "they", "are", "all", "defaultable" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/CompatibilityMap.java#L476-L487
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
MP3FileID3Controller.setUserDefinedText
public void setUserDefinedText(String desc, String text) { if (allow(ID3V2)) { id3v2.setUserDefinedTextFrame(desc, text); } }
java
public void setUserDefinedText(String desc, String text) { if (allow(ID3V2)) { id3v2.setUserDefinedTextFrame(desc, text); } }
[ "public", "void", "setUserDefinedText", "(", "String", "desc", ",", "String", "text", ")", "{", "if", "(", "allow", "(", "ID3V2", ")", ")", "{", "id3v2", ".", "setUserDefinedTextFrame", "(", "desc", ",", "text", ")", ";", "}", "}" ]
Add a field of miscellaneous text (id3v2 only). This includes a description of the text and the text itself. @param desc a description of the text @param text the text itself
[ "Add", "a", "field", "of", "miscellaneous", "text", "(", "id3v2", "only", ")", ".", "This", "includes", "a", "description", "of", "the", "text", "and", "the", "text", "itself", "." ]
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L334-L340
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/proxy/ProxyFactory.java
ProxyFactory.buildProxy
public static <T> T buildProxy(String proxyType, Class<T> clazz, Invoker proxyInvoker) throws Exception { try { ExtensionClass<Proxy> ext = ExtensionLoaderFactory.getExtensionLoader(Proxy.class) .getExtensionClass(proxyType); if (ext == null) { throw ExceptionUtils.buildRuntime("consumer.proxy", proxyType, "Unsupported proxy of client!"); } Proxy proxy = ext.getExtInstance(); return proxy.getProxy(clazz, proxyInvoker); } catch (SofaRpcRuntimeException e) { throw e; } catch (Throwable e) { throw new SofaRpcRuntimeException(e.getMessage(), e); } }
java
public static <T> T buildProxy(String proxyType, Class<T> clazz, Invoker proxyInvoker) throws Exception { try { ExtensionClass<Proxy> ext = ExtensionLoaderFactory.getExtensionLoader(Proxy.class) .getExtensionClass(proxyType); if (ext == null) { throw ExceptionUtils.buildRuntime("consumer.proxy", proxyType, "Unsupported proxy of client!"); } Proxy proxy = ext.getExtInstance(); return proxy.getProxy(clazz, proxyInvoker); } catch (SofaRpcRuntimeException e) { throw e; } catch (Throwable e) { throw new SofaRpcRuntimeException(e.getMessage(), e); } }
[ "public", "static", "<", "T", ">", "T", "buildProxy", "(", "String", "proxyType", ",", "Class", "<", "T", ">", "clazz", ",", "Invoker", "proxyInvoker", ")", "throws", "Exception", "{", "try", "{", "ExtensionClass", "<", "Proxy", ">", "ext", "=", "Extensi...
构建代理类实例 @param proxyType 代理类型 @param clazz 原始类 @param proxyInvoker 代码执行的Invoker @param <T> 类型 @return 代理类实例 @throws Exception
[ "构建代理类实例" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/proxy/ProxyFactory.java#L42-L57
SonarSource/sonarqube
sonar-core/src/main/java/org/sonar/core/i18n/RuleI18nManager.java
RuleI18nManager.lookUpDescriptionInFormerLocation
private String lookUpDescriptionInFormerLocation(String ruleKey, String relatedProperty) { return defaultI18n.messageFromFile(Locale.ENGLISH, ruleKey + ".html", relatedProperty); }
java
private String lookUpDescriptionInFormerLocation(String ruleKey, String relatedProperty) { return defaultI18n.messageFromFile(Locale.ENGLISH, ruleKey + ".html", relatedProperty); }
[ "private", "String", "lookUpDescriptionInFormerLocation", "(", "String", "ruleKey", ",", "String", "relatedProperty", ")", "{", "return", "defaultI18n", ".", "messageFromFile", "(", "Locale", ".", "ENGLISH", ",", "ruleKey", "+", "\".html\"", ",", "relatedProperty", ...
/* Method used to ensure backward compatibility for language plugins that store HTML rule description files in the former location (which was used prior to Sonar 3.0). See http://jira.sonarsource.com/browse/SONAR-3319
[ "/", "*", "Method", "used", "to", "ensure", "backward", "compatibility", "for", "language", "plugins", "that", "store", "HTML", "rule", "description", "files", "in", "the", "former", "location", "(", "which", "was", "used", "prior", "to", "Sonar", "3", ".", ...
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/i18n/RuleI18nManager.java#L115-L117
scalecube/scalecube-services
services-gateway-websocket/src/main/java/io/scalecube/services/gateway/ws/WebsocketSession.java
WebsocketSession.register
public boolean register(Long streamId, Disposable disposable) { boolean result = false; if (!disposable.isDisposed()) { result = subscriptions.putIfAbsent(streamId, disposable) == null; } if (result) { LOGGER.debug("Registered subscription with sid={}, session={}", streamId, id); } return result; }
java
public boolean register(Long streamId, Disposable disposable) { boolean result = false; if (!disposable.isDisposed()) { result = subscriptions.putIfAbsent(streamId, disposable) == null; } if (result) { LOGGER.debug("Registered subscription with sid={}, session={}", streamId, id); } return result; }
[ "public", "boolean", "register", "(", "Long", "streamId", ",", "Disposable", "disposable", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "!", "disposable", ".", "isDisposed", "(", ")", ")", "{", "result", "=", "subscriptions", ".", "putIfAbs...
Saves (if not already saved) by stream id a subscription of service call coming in form of {@link Disposable} reference. @param streamId stream id @param disposable service subscription @return true if disposable subscription was stored
[ "Saves", "(", "if", "not", "already", "saved", ")", "by", "stream", "id", "a", "subscription", "of", "service", "call", "coming", "in", "form", "of", "{", "@link", "Disposable", "}", "reference", "." ]
train
https://github.com/scalecube/scalecube-services/blob/76c8de6019e5480a1436d12b37acf163f70eea47/services-gateway-websocket/src/main/java/io/scalecube/services/gateway/ws/WebsocketSession.java#L158-L167
alibaba/canal
client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/support/ESTemplate.java
ESTemplate.update
public void update(ESMapping mapping, Object pkVal, Map<String, Object> esFieldData) { Map<String, Object> esFieldDataTmp = new LinkedHashMap<>(esFieldData.size()); esFieldData.forEach((k, v) -> esFieldDataTmp.put(Util.cleanColumn(k), v)); append4Update(mapping, pkVal, esFieldDataTmp); commitBulk(); }
java
public void update(ESMapping mapping, Object pkVal, Map<String, Object> esFieldData) { Map<String, Object> esFieldDataTmp = new LinkedHashMap<>(esFieldData.size()); esFieldData.forEach((k, v) -> esFieldDataTmp.put(Util.cleanColumn(k), v)); append4Update(mapping, pkVal, esFieldDataTmp); commitBulk(); }
[ "public", "void", "update", "(", "ESMapping", "mapping", ",", "Object", "pkVal", ",", "Map", "<", "String", ",", "Object", ">", "esFieldData", ")", "{", "Map", "<", "String", ",", "Object", ">", "esFieldDataTmp", "=", "new", "LinkedHashMap", "<>", "(", "...
根据主键更新数据 @param mapping 配置对象 @param pkVal 主键值 @param esFieldData 数据Map
[ "根据主键更新数据" ]
train
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/support/ESTemplate.java#L116-L121
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/AttributeConstraintRule.java
AttributeConstraintRule.validateDigits
private boolean validateDigits(Object validationObject, Annotation annotate) { if (checkNullObject(validationObject)) { return true; } if (checkvalidDigitTypes(validationObject.getClass())) { if (!NumberUtils.isDigits(toString(validationObject))) { throwValidationException(((Digits) annotate).message()); } } return true; }
java
private boolean validateDigits(Object validationObject, Annotation annotate) { if (checkNullObject(validationObject)) { return true; } if (checkvalidDigitTypes(validationObject.getClass())) { if (!NumberUtils.isDigits(toString(validationObject))) { throwValidationException(((Digits) annotate).message()); } } return true; }
[ "private", "boolean", "validateDigits", "(", "Object", "validationObject", ",", "Annotation", "annotate", ")", "{", "if", "(", "checkNullObject", "(", "validationObject", ")", ")", "{", "return", "true", ";", "}", "if", "(", "checkvalidDigitTypes", "(", "validat...
Checks whether a given value is is a number or not @param validationObject @param annotate @return
[ "Checks", "whether", "a", "given", "value", "is", "is", "a", "number", "or", "not" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/AttributeConstraintRule.java#L456-L473
datastax/java-driver
query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/QueryBuilder.java
QueryBuilder.divide
@NonNull public static Term divide(@NonNull Term left, @NonNull Term right) { return new BinaryArithmeticTerm(ArithmeticOperator.QUOTIENT, left, right); }
java
@NonNull public static Term divide(@NonNull Term left, @NonNull Term right) { return new BinaryArithmeticTerm(ArithmeticOperator.QUOTIENT, left, right); }
[ "@", "NonNull", "public", "static", "Term", "divide", "(", "@", "NonNull", "Term", "left", ",", "@", "NonNull", "Term", "right", ")", "{", "return", "new", "BinaryArithmeticTerm", "(", "ArithmeticOperator", ".", "QUOTIENT", ",", "left", ",", "right", ")", ...
The quotient of two terms, as in {@code WHERE k = left / right}.
[ "The", "quotient", "of", "two", "terms", "as", "in", "{" ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/QueryBuilder.java#L207-L210
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/FeatureTokens.java
FeatureTokens.setTokens
public void setTokens(int i, String v) { if (FeatureTokens_Type.featOkTst && ((FeatureTokens_Type)jcasType).casFeat_tokens == null) jcasType.jcas.throwFeatMissing("tokens", "ch.epfl.bbp.uima.types.FeatureTokens"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((FeatureTokens_Type)jcasType).casFeatCode_tokens), i); jcasType.ll_cas.ll_setStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((FeatureTokens_Type)jcasType).casFeatCode_tokens), i, v);}
java
public void setTokens(int i, String v) { if (FeatureTokens_Type.featOkTst && ((FeatureTokens_Type)jcasType).casFeat_tokens == null) jcasType.jcas.throwFeatMissing("tokens", "ch.epfl.bbp.uima.types.FeatureTokens"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((FeatureTokens_Type)jcasType).casFeatCode_tokens), i); jcasType.ll_cas.ll_setStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((FeatureTokens_Type)jcasType).casFeatCode_tokens), i, v);}
[ "public", "void", "setTokens", "(", "int", "i", ",", "String", "v", ")", "{", "if", "(", "FeatureTokens_Type", ".", "featOkTst", "&&", "(", "(", "FeatureTokens_Type", ")", "jcasType", ")", ".", "casFeat_tokens", "==", "null", ")", "jcasType", ".", "jcas", ...
indexed setter for tokens - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "tokens", "-", "sets", "an", "indexed", "value", "-" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/FeatureTokens.java#L118-L122
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ColumnList.java
ColumnList.getAlias
public String getAlias(SchemaTable st, String column, int stepDepth) { return getAlias(st.getSchema(), st.getTable(), column, stepDepth); }
java
public String getAlias(SchemaTable st, String column, int stepDepth) { return getAlias(st.getSchema(), st.getTable(), column, stepDepth); }
[ "public", "String", "getAlias", "(", "SchemaTable", "st", ",", "String", "column", ",", "int", "stepDepth", ")", "{", "return", "getAlias", "(", "st", ".", "getSchema", "(", ")", ",", "st", ".", "getTable", "(", ")", ",", "column", ",", "stepDepth", ")...
get an alias if the column is already in the list @param st @param column @param stepDepth @return
[ "get", "an", "alias", "if", "the", "column", "is", "already", "in", "the", "list" ]
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ColumnList.java#L177-L179
puniverse/capsule
capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java
Jar.addEntries
public Jar addEntries(Path path, Path dirOrZip) throws IOException { return addEntries(path, dirOrZip, null); }
java
public Jar addEntries(Path path, Path dirOrZip) throws IOException { return addEntries(path, dirOrZip, null); }
[ "public", "Jar", "addEntries", "(", "Path", "path", ",", "Path", "dirOrZip", ")", "throws", "IOException", "{", "return", "addEntries", "(", "path", ",", "dirOrZip", ",", "null", ")", ";", "}" ]
Adds a directory (with all its subdirectories) or the contents of a zip/JAR to this JAR. @param path the path within the JAR where the root of the directory will be placed, or {@code null} for the JAR's root @param dirOrZip the directory to add as an entry or a zip/JAR file whose contents will be extracted and added as entries @return {@code this}
[ "Adds", "a", "directory", "(", "with", "all", "its", "subdirectories", ")", "or", "the", "contents", "of", "a", "zip", "/", "JAR", "to", "this", "JAR", "." ]
train
https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L410-L412
mangstadt/biweekly
src/main/java/biweekly/util/com/google/ical/iter/Generators.java
Generators.serialYearGenerator
static ThrottledGenerator serialYearGenerator(final int interval, final DateValue dtStart) { return new ThrottledGenerator() { //the last year seen int year = dtStart.year() - interval; int throttle = MAX_YEARS_BETWEEN_INSTANCES; @Override boolean generate(DTBuilder builder) throws IteratorShortCircuitingException { /* * Make sure things halt even if the RRULE is bad. For example, * the following rules should halt: * * FREQ=YEARLY;BYMONTHDAY=30;BYMONTH=2 */ if (--throttle < 0) { throw IteratorShortCircuitingException.instance(); } year += interval; builder.year = year; return true; } @Override void workDone() { this.throttle = MAX_YEARS_BETWEEN_INSTANCES; } @Override public String toString() { return "serialYearGenerator:" + interval; } }; }
java
static ThrottledGenerator serialYearGenerator(final int interval, final DateValue dtStart) { return new ThrottledGenerator() { //the last year seen int year = dtStart.year() - interval; int throttle = MAX_YEARS_BETWEEN_INSTANCES; @Override boolean generate(DTBuilder builder) throws IteratorShortCircuitingException { /* * Make sure things halt even if the RRULE is bad. For example, * the following rules should halt: * * FREQ=YEARLY;BYMONTHDAY=30;BYMONTH=2 */ if (--throttle < 0) { throw IteratorShortCircuitingException.instance(); } year += interval; builder.year = year; return true; } @Override void workDone() { this.throttle = MAX_YEARS_BETWEEN_INSTANCES; } @Override public String toString() { return "serialYearGenerator:" + interval; } }; }
[ "static", "ThrottledGenerator", "serialYearGenerator", "(", "final", "int", "interval", ",", "final", "DateValue", "dtStart", ")", "{", "return", "new", "ThrottledGenerator", "(", ")", "{", "//the last year seen", "int", "year", "=", "dtStart", ".", "year", "(", ...
Constructs a generator that generates years successively counting from the first year passed in. @param interval number of years to advance each step @param dtStart the start date @return the year in dtStart the first time called and interval + last return value on subsequent calls
[ "Constructs", "a", "generator", "that", "generates", "years", "successively", "counting", "from", "the", "first", "year", "passed", "in", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/Generators.java#L80-L113
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java
TermOfUsePanel.newLiabilityPanel
protected Component newLiabilityPanel(final String id, final IModel<HeaderContentListModelBean> model) { return new LiabilityPanel(id, Model.of(model.getObject())); }
java
protected Component newLiabilityPanel(final String id, final IModel<HeaderContentListModelBean> model) { return new LiabilityPanel(id, Model.of(model.getObject())); }
[ "protected", "Component", "newLiabilityPanel", "(", "final", "String", "id", ",", "final", "IModel", "<", "HeaderContentListModelBean", ">", "model", ")", "{", "return", "new", "LiabilityPanel", "(", "id", ",", "Model", ".", "of", "(", "model", ".", "getObject...
Factory method for creating the new {@link Component} for the liability. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link Component} for the liability. @param id the id @param model the model @return the new {@link Component} for the liability
[ "Factory", "method", "for", "creating", "the", "new", "{", "@link", "Component", "}", "for", "the", "liability", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", ...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java#L312-L316
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.serviceName_phonebooks_bookKey_export_GET
public OvhPcsFile serviceName_phonebooks_bookKey_export_GET(String serviceName, String bookKey, OvhContactsExportFormatsEnum format) throws IOException { String qPath = "/sms/{serviceName}/phonebooks/{bookKey}/export"; StringBuilder sb = path(qPath, serviceName, bookKey); query(sb, "format", format); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPcsFile.class); }
java
public OvhPcsFile serviceName_phonebooks_bookKey_export_GET(String serviceName, String bookKey, OvhContactsExportFormatsEnum format) throws IOException { String qPath = "/sms/{serviceName}/phonebooks/{bookKey}/export"; StringBuilder sb = path(qPath, serviceName, bookKey); query(sb, "format", format); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPcsFile.class); }
[ "public", "OvhPcsFile", "serviceName_phonebooks_bookKey_export_GET", "(", "String", "serviceName", ",", "String", "bookKey", ",", "OvhContactsExportFormatsEnum", "format", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/sms/{serviceName}/phonebooks/{bookKey}/expo...
Export the phonebook's contacts REST: GET /sms/{serviceName}/phonebooks/{bookKey}/export @param format [required] Format of the file @param serviceName [required] The internal name of your SMS offer @param bookKey [required] Identifier of the phonebook
[ "Export", "the", "phonebook", "s", "contacts" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1071-L1077
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/PippoSettings.java
PippoSettings.getDouble
public double getDouble(String name, double defaultValue) { try { String value = getString(name, null); if (!StringUtils.isNullOrEmpty(value)) { return Double.parseDouble(value.trim()); } } catch (NumberFormatException e) { log.warn("Failed to parse double for " + name + USING_DEFAULT_OF + defaultValue); } return defaultValue; }
java
public double getDouble(String name, double defaultValue) { try { String value = getString(name, null); if (!StringUtils.isNullOrEmpty(value)) { return Double.parseDouble(value.trim()); } } catch (NumberFormatException e) { log.warn("Failed to parse double for " + name + USING_DEFAULT_OF + defaultValue); } return defaultValue; }
[ "public", "double", "getDouble", "(", "String", "name", ",", "double", "defaultValue", ")", "{", "try", "{", "String", "value", "=", "getString", "(", "name", ",", "null", ")", ";", "if", "(", "!", "StringUtils", ".", "isNullOrEmpty", "(", "value", ")", ...
Returns the double value for the specified name. If the name does not exist or the value for the name can not be interpreted as a double, the defaultValue is returned. @param name @param defaultValue @return name value or defaultValue
[ "Returns", "the", "double", "value", "for", "the", "specified", "name", ".", "If", "the", "name", "does", "not", "exist", "or", "the", "value", "for", "the", "name", "can", "not", "be", "interpreted", "as", "a", "double", "the", "defaultValue", "is", "re...
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L564-L576
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/compiler/CompiledTemplate.java
CompiledTemplate.exists
public static boolean exists(Compiler c, String name, CompilationUnit from) { String fqName = getFullyQualifiedName(resolveName(name, from)); try { c.loadClass(fqName); return true; } catch (ClassNotFoundException nx) { try { c.loadClass(resolveName(name, from)); // Try standard path as a last resort return true; } catch (ClassNotFoundException nx2) { return false; } } }
java
public static boolean exists(Compiler c, String name, CompilationUnit from) { String fqName = getFullyQualifiedName(resolveName(name, from)); try { c.loadClass(fqName); return true; } catch (ClassNotFoundException nx) { try { c.loadClass(resolveName(name, from)); // Try standard path as a last resort return true; } catch (ClassNotFoundException nx2) { return false; } } }
[ "public", "static", "boolean", "exists", "(", "Compiler", "c", ",", "String", "name", ",", "CompilationUnit", "from", ")", "{", "String", "fqName", "=", "getFullyQualifiedName", "(", "resolveName", "(", "name", ",", "from", ")", ")", ";", "try", "{", "c", ...
Test to see of the template can be loaded before CompiledTemplate can be constructed.
[ "Test", "to", "see", "of", "the", "template", "can", "be", "loaded", "before", "CompiledTemplate", "can", "be", "constructed", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/CompiledTemplate.java#L126-L141
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuPointerSetAttribute
public static int cuPointerSetAttribute(Pointer value, int attribute, CUdeviceptr ptr) { return checkResult(cuPointerSetAttributeNative(value, attribute, ptr)); }
java
public static int cuPointerSetAttribute(Pointer value, int attribute, CUdeviceptr ptr) { return checkResult(cuPointerSetAttributeNative(value, attribute, ptr)); }
[ "public", "static", "int", "cuPointerSetAttribute", "(", "Pointer", "value", ",", "int", "attribute", ",", "CUdeviceptr", "ptr", ")", "{", "return", "checkResult", "(", "cuPointerSetAttributeNative", "(", "value", ",", "attribute", ",", "ptr", ")", ")", ";", "...
Set attributes on a previously allocated memory region<br> <br> The supported attributes are: <br> <ul> <li>CU_POINTER_ATTRIBUTE_SYNC_MEMOPS: A boolean attribute that can either be set (1) or unset (0). When set, the region of memory that ptr points to is guaranteed to always synchronize memory operations that are synchronous. If there are some previously initiated synchronous memory operations that are pending when this attribute is set, the function does not return until those memory operations are complete. See further documentation in the section titled "API synchronization behavior" to learn more about cases when synchronous memory operations can exhibit asynchronous behavior. value will be considered as a pointer to an unsigned integer to which this attribute is to be set. </li> </ul> @param value Pointer to memory containing the value to be set @param attribute Pointer attribute to set @param ptr Pointer to a memory region allocated using CUDA memory allocation APIs @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_INVALID_DEVICE @see JCudaDriver#cuPointerGetAttribute, @see JCudaDriver#cuPointerGetAttributes, @see JCudaDriver#cuMemAlloc, @see JCudaDriver#cuMemFree, @see JCudaDriver#cuMemAllocHost, @see JCudaDriver#cuMemFreeHost, @see JCudaDriver#cuMemHostAlloc, @see JCudaDriver#cuMemHostRegister, @see JCudaDriver#cuMemHostUnregister
[ "Set", "attributes", "on", "a", "previously", "allocated", "memory", "region<br", ">", "<br", ">", "The", "supported", "attributes", "are", ":", "<br", ">", "<ul", ">", "<li", ">", "CU_POINTER_ATTRIBUTE_SYNC_MEMOPS", ":" ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L14293-L14296
openengsb/openengsb
components/util/src/main/java/org/openengsb/core/util/CipherUtils.java
CipherUtils.generateKey
public static SecretKey generateKey(String algorithm, int keySize) { KeyGenerator secretKeyGenerator; try { secretKeyGenerator = KeyGenerator.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } secretKeyGenerator.init(keySize); return secretKeyGenerator.generateKey(); }
java
public static SecretKey generateKey(String algorithm, int keySize) { KeyGenerator secretKeyGenerator; try { secretKeyGenerator = KeyGenerator.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } secretKeyGenerator.init(keySize); return secretKeyGenerator.generateKey(); }
[ "public", "static", "SecretKey", "generateKey", "(", "String", "algorithm", ",", "int", "keySize", ")", "{", "KeyGenerator", "secretKeyGenerator", ";", "try", "{", "secretKeyGenerator", "=", "KeyGenerator", ".", "getInstance", "(", "algorithm", ")", ";", "}", "c...
Generate a {@link SecretKey} for the given symmetric algorithm and keysize Example: CipherUtils.generateKeyPair("AES", 128)
[ "Generate", "a", "{", "@link", "SecretKey", "}", "for", "the", "given", "symmetric", "algorithm", "and", "keysize" ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/util/src/main/java/org/openengsb/core/util/CipherUtils.java#L189-L198
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/AbstractWisdomWatcherMojo.java
AbstractWisdomWatcherMojo.getOutputFile
public File getOutputFile(File input) { File source; File destination; if (input.getAbsolutePath().startsWith(getInternalAssetsDirectory().getAbsolutePath())) { source = getInternalAssetsDirectory(); destination = getInternalAssetOutputDirectory(); } else if (input.getAbsolutePath().startsWith(getExternalAssetsDirectory().getAbsolutePath())) { source = getExternalAssetsDirectory(); destination = getExternalAssetsOutputDirectory(); } else if (input.getAbsolutePath().startsWith(getInternalAssetOutputDirectory().getAbsolutePath())) { return input; } else if (input.getAbsolutePath().startsWith(getExternalAssetsOutputDirectory().getAbsolutePath())) { return input; } else { throw new IllegalArgumentException("Cannot determine the output file for " + input.getAbsolutePath() + "," + " the file is not in a resource directory"); } String path = input.getParentFile().getAbsolutePath().substring(source.getAbsolutePath().length()); return new File(destination, path + File.separator + input.getName()); }
java
public File getOutputFile(File input) { File source; File destination; if (input.getAbsolutePath().startsWith(getInternalAssetsDirectory().getAbsolutePath())) { source = getInternalAssetsDirectory(); destination = getInternalAssetOutputDirectory(); } else if (input.getAbsolutePath().startsWith(getExternalAssetsDirectory().getAbsolutePath())) { source = getExternalAssetsDirectory(); destination = getExternalAssetsOutputDirectory(); } else if (input.getAbsolutePath().startsWith(getInternalAssetOutputDirectory().getAbsolutePath())) { return input; } else if (input.getAbsolutePath().startsWith(getExternalAssetsOutputDirectory().getAbsolutePath())) { return input; } else { throw new IllegalArgumentException("Cannot determine the output file for " + input.getAbsolutePath() + "," + " the file is not in a resource directory"); } String path = input.getParentFile().getAbsolutePath().substring(source.getAbsolutePath().length()); return new File(destination, path + File.separator + input.getName()); }
[ "public", "File", "getOutputFile", "(", "File", "input", ")", "{", "File", "source", ";", "File", "destination", ";", "if", "(", "input", ".", "getAbsolutePath", "(", ")", ".", "startsWith", "(", "getInternalAssetsDirectory", "(", ")", ".", "getAbsolutePath", ...
Gets the output files for the given input file. Unlike {@link #getOutputFile(java.io.File, String)}, this method does not change the output file's extension. If the file is already in an output directory, the file is returned as it is. <p> This method does not check for the existence of the file, just computes its {@link java.io.File} object. @param input the input file @return the output file
[ "Gets", "the", "output", "files", "for", "the", "given", "input", "file", ".", "Unlike", "{", "@link", "#getOutputFile", "(", "java", ".", "io", ".", "File", "String", ")", "}", "this", "method", "does", "not", "change", "the", "output", "file", "s", "...
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/AbstractWisdomWatcherMojo.java#L140-L159
javagl/ND
nd-tuples/src/main/java/de/javagl/nd/tuples/j/LongTuples.java
LongTuples.createSubTuple
static MutableLongTuple createSubTuple( MutableLongTuple parent, int fromIndex, int toIndex) { return new MutableSubLongTuple(parent, fromIndex, toIndex); }
java
static MutableLongTuple createSubTuple( MutableLongTuple parent, int fromIndex, int toIndex) { return new MutableSubLongTuple(parent, fromIndex, toIndex); }
[ "static", "MutableLongTuple", "createSubTuple", "(", "MutableLongTuple", "parent", ",", "int", "fromIndex", ",", "int", "toIndex", ")", "{", "return", "new", "MutableSubLongTuple", "(", "parent", ",", "fromIndex", ",", "toIndex", ")", ";", "}" ]
Creates a new tuple that is a <i>view</i> on the specified portion of the given parent. Changes in the parent will be visible in the returned tuple, and vice versa. @param parent The parent tuple @param fromIndex The start index in the parent, inclusive @param toIndex The end index in the parent, exclusive @throws NullPointerException If the given parent is <code>null</code> @throws IllegalArgumentException If the given indices are invalid. This is the case when <code>fromIndex &lt; 0</code>, <code>fromIndex &gt; toIndex</code>, or <code>toIndex &gt; {@link Tuple#getSize() parent.getSize()}</code>, @return The new tuple
[ "Creates", "a", "new", "tuple", "that", "is", "a", "<i", ">", "view<", "/", "i", ">", "on", "the", "specified", "portion", "of", "the", "given", "parent", ".", "Changes", "in", "the", "parent", "will", "be", "visible", "in", "the", "returned", "tuple",...
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-tuples/src/main/java/de/javagl/nd/tuples/j/LongTuples.java#L250-L254
amlinv/registry-utils
src/main/java/com/amlinv/registry/util/listener/SimpleSynchronousNotificationExecutor.java
SimpleSynchronousNotificationExecutor.firePutNotification
public void firePutNotification(Iterator<RegistryListener<K, V>> listeners, K putKey, V putValue) { while (listeners.hasNext() ) { listeners.next().onPutEntry(putKey, putValue); } }
java
public void firePutNotification(Iterator<RegistryListener<K, V>> listeners, K putKey, V putValue) { while (listeners.hasNext() ) { listeners.next().onPutEntry(putKey, putValue); } }
[ "public", "void", "firePutNotification", "(", "Iterator", "<", "RegistryListener", "<", "K", ",", "V", ">", ">", "listeners", ",", "K", "putKey", ",", "V", "putValue", ")", "{", "while", "(", "listeners", ".", "hasNext", "(", ")", ")", "{", "listeners", ...
Fire notification of a new entry added to the registry. @param putKey key identifying the entry in the registry. @param putValue value of the entry in the registry.
[ "Fire", "notification", "of", "a", "new", "entry", "added", "to", "the", "registry", "." ]
train
https://github.com/amlinv/registry-utils/blob/784c455be38acb0df3a35c38afe60a516b8e4f32/src/main/java/com/amlinv/registry/util/listener/SimpleSynchronousNotificationExecutor.java#L39-L43
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/query/Criteria.java
Criteria.between
public Criteria between(@Nullable Object lowerBound, @Nullable Object upperBound) { return between(lowerBound, upperBound, true, true); }
java
public Criteria between(@Nullable Object lowerBound, @Nullable Object upperBound) { return between(lowerBound, upperBound, true, true); }
[ "public", "Criteria", "between", "(", "@", "Nullable", "Object", "lowerBound", ",", "@", "Nullable", "Object", "upperBound", ")", "{", "return", "between", "(", "lowerBound", ",", "upperBound", ",", "true", ",", "true", ")", ";", "}" ]
Crates new {@link Predicate} for {@code RANGE [lowerBound TO upperBound]} @param lowerBound @param upperBound @return
[ "Crates", "new", "{", "@link", "Predicate", "}", "for", "{", "@code", "RANGE", "[", "lowerBound", "TO", "upperBound", "]", "}" ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L401-L403
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java
BugInstance.addSourceLineRange
@Nonnull public BugInstance addSourceLineRange(BytecodeScanningDetector visitor, int startPC, int endPC) { SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.fromVisitedInstructionRange(visitor.getClassContext(), visitor, startPC, endPC); requireNonNull(sourceLineAnnotation); add(sourceLineAnnotation); return this; }
java
@Nonnull public BugInstance addSourceLineRange(BytecodeScanningDetector visitor, int startPC, int endPC) { SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.fromVisitedInstructionRange(visitor.getClassContext(), visitor, startPC, endPC); requireNonNull(sourceLineAnnotation); add(sourceLineAnnotation); return this; }
[ "@", "Nonnull", "public", "BugInstance", "addSourceLineRange", "(", "BytecodeScanningDetector", "visitor", ",", "int", "startPC", ",", "int", "endPC", ")", "{", "SourceLineAnnotation", "sourceLineAnnotation", "=", "SourceLineAnnotation", ".", "fromVisitedInstructionRange", ...
Add a source line annotation describing the source line numbers for a range of instructions in the method being visited by the given visitor. Note that if the method does not have line number information, then no source line annotation will be added. @param visitor a BetterVisitor which is visiting the method @param startPC the bytecode offset of the start instruction in the range @param endPC the bytecode offset of the end instruction in the range @return this object
[ "Add", "a", "source", "line", "annotation", "describing", "the", "source", "line", "numbers", "for", "a", "range", "of", "instructions", "in", "the", "method", "being", "visited", "by", "the", "given", "visitor", ".", "Note", "that", "if", "the", "method", ...
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L1771-L1778
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/validation/ValidationUtility.java
ValidationUtility.validateRELS
private static void validateRELS(PID pid, String dsId, InputStream content) throws ValidationException { logger.debug("Validating " + dsId + " datastream"); new RelsValidator().validate(pid, dsId, content); logger.debug(dsId + " datastream is valid"); }
java
private static void validateRELS(PID pid, String dsId, InputStream content) throws ValidationException { logger.debug("Validating " + dsId + " datastream"); new RelsValidator().validate(pid, dsId, content); logger.debug(dsId + " datastream is valid"); }
[ "private", "static", "void", "validateRELS", "(", "PID", "pid", ",", "String", "dsId", ",", "InputStream", "content", ")", "throws", "ValidationException", "{", "logger", ".", "debug", "(", "\"Validating \"", "+", "dsId", "+", "\" datastream\"", ")", ";", "new...
validate relationships datastream @param pid @param dsId @param content @throws ValidationException
[ "validate", "relationships", "datastream" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/validation/ValidationUtility.java#L181-L186
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java
Validator.expectMin
public void expectMin(String name, double minLength) { expectMin(name, minLength, messages.get(Validation.MIN_KEY.name(), name, minLength)); }
java
public void expectMin(String name, double minLength) { expectMin(name, minLength, messages.get(Validation.MIN_KEY.name(), name, minLength)); }
[ "public", "void", "expectMin", "(", "String", "name", ",", "double", "minLength", ")", "{", "expectMin", "(", "name", ",", "minLength", ",", "messages", ".", "get", "(", "Validation", ".", "MIN_KEY", ".", "name", "(", ")", ",", "name", ",", "minLength", ...
Validates a given field to have a minimum length @param name The field to check @param minLength The minimum length
[ "Validates", "a", "given", "field", "to", "have", "a", "minimum", "length" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L85-L87
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/ui/CmsGalleriesTab.java
CmsGalleriesTab.addChildren
protected void addChildren(CmsTreeItem parent, List<CmsGalleryTreeEntry> children, List<String> selectedGalleries) { if (children != null) { for (CmsGalleryTreeEntry child : children) { // set the category tree item and add to parent tree item CmsTreeItem treeItem = createTreeItem(child, selectedGalleries, true); if ((selectedGalleries != null) && selectedGalleries.contains(child.getPath())) { parent.setOpen(true); openParents(parent); } parent.addChild(treeItem); addChildren(treeItem, child.getChildren(), selectedGalleries); } } }
java
protected void addChildren(CmsTreeItem parent, List<CmsGalleryTreeEntry> children, List<String> selectedGalleries) { if (children != null) { for (CmsGalleryTreeEntry child : children) { // set the category tree item and add to parent tree item CmsTreeItem treeItem = createTreeItem(child, selectedGalleries, true); if ((selectedGalleries != null) && selectedGalleries.contains(child.getPath())) { parent.setOpen(true); openParents(parent); } parent.addChild(treeItem); addChildren(treeItem, child.getChildren(), selectedGalleries); } } }
[ "protected", "void", "addChildren", "(", "CmsTreeItem", "parent", ",", "List", "<", "CmsGalleryTreeEntry", ">", "children", ",", "List", "<", "String", ">", "selectedGalleries", ")", "{", "if", "(", "children", "!=", "null", ")", "{", "for", "(", "CmsGallery...
Adds children to the gallery tree and select the galleries.<p> @param parent the parent item @param children the list of children @param selectedGalleries the list of galleries to select
[ "Adds", "children", "to", "the", "gallery", "tree", "and", "select", "the", "galleries", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsGalleriesTab.java#L448-L462
finmath/finmath-lib
src/main/java/net/finmath/montecarlo/automaticdifferentiation/backward/alternative/RandomVariableUniqueVariable.java
RandomVariableUniqueVariable.constructRandomVariableUniqueVariable
private void constructRandomVariableUniqueVariable(RandomVariable randomVariable, boolean isConstant, ArrayList<RandomVariableUniqueVariable> parentVariables, OperatorType parentOperatorType){ /* * by calling the method in the factory it will produce a new object of RandomVariable and * the new item will be stored in its factory internal array list */ RandomVariable normalrandomvariable = factory.createRandomVariable(randomVariable, isConstant, parentVariables, parentOperatorType); /* by construction this object can be up-casted to RandomVariableUniqueVariable */ RandomVariableUniqueVariable newrandomvariableuniquevariable = (RandomVariableUniqueVariable)normalrandomvariable; /* now we have access to the internal variables of the new RandomVarialeUniqueVariable */ variableID = newrandomvariableuniquevariable.getVariableID(); this.isConstant = newrandomvariableuniquevariable.isConstant(); parentsVariables = newrandomvariableuniquevariable.getParentVariables(); this.parentOperatorType = newrandomvariableuniquevariable.getParentOperatorType(); }
java
private void constructRandomVariableUniqueVariable(RandomVariable randomVariable, boolean isConstant, ArrayList<RandomVariableUniqueVariable> parentVariables, OperatorType parentOperatorType){ /* * by calling the method in the factory it will produce a new object of RandomVariable and * the new item will be stored in its factory internal array list */ RandomVariable normalrandomvariable = factory.createRandomVariable(randomVariable, isConstant, parentVariables, parentOperatorType); /* by construction this object can be up-casted to RandomVariableUniqueVariable */ RandomVariableUniqueVariable newrandomvariableuniquevariable = (RandomVariableUniqueVariable)normalrandomvariable; /* now we have access to the internal variables of the new RandomVarialeUniqueVariable */ variableID = newrandomvariableuniquevariable.getVariableID(); this.isConstant = newrandomvariableuniquevariable.isConstant(); parentsVariables = newrandomvariableuniquevariable.getParentVariables(); this.parentOperatorType = newrandomvariableuniquevariable.getParentOperatorType(); }
[ "private", "void", "constructRandomVariableUniqueVariable", "(", "RandomVariable", "randomVariable", ",", "boolean", "isConstant", ",", "ArrayList", "<", "RandomVariableUniqueVariable", ">", "parentVariables", ",", "OperatorType", "parentOperatorType", ")", "{", "/*\r\n\t\t *...
Function calls {@link RandomVariableUniqueVariableFactory} to use the given {@link RandomVariableFromDoubleArray} and save it to its internal ArrayList. The index of the object will be give to the new {@link RandomVariableUniqueVariable} object. @param randomVariable @param isConstant
[ "Function", "calls", "{", "@link", "RandomVariableUniqueVariableFactory", "}", "to", "use", "the", "given", "{", "@link", "RandomVariableFromDoubleArray", "}", "and", "save", "it", "to", "its", "internal", "ArrayList", ".", "The", "index", "of", "the", "object", ...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/automaticdifferentiation/backward/alternative/RandomVariableUniqueVariable.java#L85-L100
msteiger/jxmapviewer2
jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java
JXMapViewer.zoomToBestFit
public void zoomToBestFit(Set<GeoPosition> positions, double maxFraction) { if (positions.isEmpty()) return; if (maxFraction <= 0 || maxFraction > 1) throw new IllegalArgumentException("maxFraction must be between 0 and 1"); TileFactory tileFactory = getTileFactory(); TileFactoryInfo info = tileFactory.getInfo(); if(info == null) return; // set to central position initially GeoPosition centre = computeGeoCenter(positions); setCenterPosition(centre); if (positions.size() == 1) return; // repeatedly zoom in until we find the first zoom level where either the width or height // of the points takes up more than the max fraction of the viewport // start with zoomed out at maximum int bestZoom = info.getMaximumZoomLevel(); Rectangle2D viewport = getViewportBounds(); Rectangle2D bounds = generateBoundingRect(positions, bestZoom); // is this zoom still OK? while (bestZoom >= info.getMinimumZoomLevel() && bounds.getWidth() < viewport.getWidth() * maxFraction && bounds.getHeight() < viewport.getHeight() * maxFraction) { bestZoom--; bounds = generateBoundingRect(positions, bestZoom); } setZoom(bestZoom + 1); }
java
public void zoomToBestFit(Set<GeoPosition> positions, double maxFraction) { if (positions.isEmpty()) return; if (maxFraction <= 0 || maxFraction > 1) throw new IllegalArgumentException("maxFraction must be between 0 and 1"); TileFactory tileFactory = getTileFactory(); TileFactoryInfo info = tileFactory.getInfo(); if(info == null) return; // set to central position initially GeoPosition centre = computeGeoCenter(positions); setCenterPosition(centre); if (positions.size() == 1) return; // repeatedly zoom in until we find the first zoom level where either the width or height // of the points takes up more than the max fraction of the viewport // start with zoomed out at maximum int bestZoom = info.getMaximumZoomLevel(); Rectangle2D viewport = getViewportBounds(); Rectangle2D bounds = generateBoundingRect(positions, bestZoom); // is this zoom still OK? while (bestZoom >= info.getMinimumZoomLevel() && bounds.getWidth() < viewport.getWidth() * maxFraction && bounds.getHeight() < viewport.getHeight() * maxFraction) { bestZoom--; bounds = generateBoundingRect(positions, bestZoom); } setZoom(bestZoom + 1); }
[ "public", "void", "zoomToBestFit", "(", "Set", "<", "GeoPosition", ">", "positions", ",", "double", "maxFraction", ")", "{", "if", "(", "positions", ".", "isEmpty", "(", ")", ")", "return", ";", "if", "(", "maxFraction", "<=", "0", "||", "maxFraction", "...
Zoom and center the map to a best fit around the input GeoPositions. Best fit is defined as the most zoomed-in possible view where both the width and height of a bounding box around the positions take up no more than maxFraction of the viewport width or height respectively. @param positions A set of GeoPositions to calculate the new zoom from @param maxFraction the maximum fraction of the viewport that should be covered
[ "Zoom", "and", "center", "the", "map", "to", "a", "best", "fit", "around", "the", "input", "GeoPositions", ".", "Best", "fit", "is", "defined", "as", "the", "most", "zoomed", "-", "in", "possible", "view", "where", "both", "the", "width", "and", "height"...
train
https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java#L686-L727
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/media/Graphics.java
Graphics.rotateImage
public static void rotateImage(File input, File output, String format, int degrees) throws IOException { BufferedImage inputImage = ImageIO.read(input); Graphics2D g = (Graphics2D) inputImage.getGraphics(); g.drawImage(inputImage, 0, 0, null); AffineTransform at = new AffineTransform(); // scale image //at.scale(2.0, 2.0); // rotate 45 degrees around image center at.rotate(degrees * Math.PI / 180.0, inputImage.getWidth() / 2.0, inputImage.getHeight() / 2.0); //at.rotate(Math.toRadians(degrees), inputImage.getWidth() / 2.0, inputImage.getHeight() / 2.0); /* * translate to make sure the rotation doesn't cut off any image data */ AffineTransform translationTransform; translationTransform = findTranslation(at, inputImage); at.preConcatenate(translationTransform); // instantiate and apply transformation filter BufferedImageOp bio = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR); BufferedImage destinationBI = bio.filter(inputImage, null); ImageIO.write(destinationBI, format, output); }
java
public static void rotateImage(File input, File output, String format, int degrees) throws IOException { BufferedImage inputImage = ImageIO.read(input); Graphics2D g = (Graphics2D) inputImage.getGraphics(); g.drawImage(inputImage, 0, 0, null); AffineTransform at = new AffineTransform(); // scale image //at.scale(2.0, 2.0); // rotate 45 degrees around image center at.rotate(degrees * Math.PI / 180.0, inputImage.getWidth() / 2.0, inputImage.getHeight() / 2.0); //at.rotate(Math.toRadians(degrees), inputImage.getWidth() / 2.0, inputImage.getHeight() / 2.0); /* * translate to make sure the rotation doesn't cut off any image data */ AffineTransform translationTransform; translationTransform = findTranslation(at, inputImage); at.preConcatenate(translationTransform); // instantiate and apply transformation filter BufferedImageOp bio = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR); BufferedImage destinationBI = bio.filter(inputImage, null); ImageIO.write(destinationBI, format, output); }
[ "public", "static", "void", "rotateImage", "(", "File", "input", ",", "File", "output", ",", "String", "format", ",", "int", "degrees", ")", "throws", "IOException", "{", "BufferedImage", "inputImage", "=", "ImageIO", ".", "read", "(", "input", ")", ";", "...
Rotate a file a given number of degrees @param input input image file @param output the output image fiel @param format the format (png, jpg, gif, etc.) @param degrees angle to rotote @throws IOException
[ "Rotate", "a", "file", "a", "given", "number", "of", "degrees" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/media/Graphics.java#L36-L70
talsma-ict/umldoclet
src/main/java/nl/talsmasoftware/umldoclet/util/UriUtils.java
UriUtils.addHttpParam
public static URI addHttpParam(URI uri, String name, String value) { if (uri != null && name != null && value != null && ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme()))) { final String base = uri.toASCIIString(); final int queryIdx = base.indexOf('?'); final int fragmentIdx = base.indexOf('#', queryIdx < 0 ? 0 : queryIdx); StringBuilder newUri = new StringBuilder(fragmentIdx >= 0 ? base.substring(0, fragmentIdx) : base); newUri.append(queryIdx < 0 ? '?' : '&'); appendEncoded(newUri, name); newUri.append('='); appendEncoded(newUri, value); if (fragmentIdx >= 0) newUri.append(base, fragmentIdx, base.length()); return URI.create(newUri.toString()); } return uri; }
java
public static URI addHttpParam(URI uri, String name, String value) { if (uri != null && name != null && value != null && ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme()))) { final String base = uri.toASCIIString(); final int queryIdx = base.indexOf('?'); final int fragmentIdx = base.indexOf('#', queryIdx < 0 ? 0 : queryIdx); StringBuilder newUri = new StringBuilder(fragmentIdx >= 0 ? base.substring(0, fragmentIdx) : base); newUri.append(queryIdx < 0 ? '?' : '&'); appendEncoded(newUri, name); newUri.append('='); appendEncoded(newUri, value); if (fragmentIdx >= 0) newUri.append(base, fragmentIdx, base.length()); return URI.create(newUri.toString()); } return uri; }
[ "public", "static", "URI", "addHttpParam", "(", "URI", "uri", ",", "String", "name", ",", "String", "value", ")", "{", "if", "(", "uri", "!=", "null", "&&", "name", "!=", "null", "&&", "value", "!=", "null", "&&", "(", "\"http\"", ".", "equals", "(",...
This method adds a query parameter to an existing URI and takes care of proper encoding etc. <p> Since query parameters are scheme-specific, this method only applies to URI's with the following schemes: <ol> <li>{@code "http"}</li> <li>{@code "https"}</li> </ol> @param uri The URI to add an HTTP parameter to @param name The name of the parameter to add @param value The value of the parameter to add @return The URI to which a parameter may have been added
[ "This", "method", "adds", "a", "query", "parameter", "to", "an", "existing", "URI", "and", "takes", "care", "of", "proper", "encoding", "etc", ".", "<p", ">", "Since", "query", "parameters", "are", "scheme", "-", "specific", "this", "method", "only", "appl...
train
https://github.com/talsma-ict/umldoclet/blob/373b23f2646603fddca4a495e9eccbb4a4491fdf/src/main/java/nl/talsmasoftware/umldoclet/util/UriUtils.java#L70-L84
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByUpdatedBy
public Iterable<DContact> queryByUpdatedBy(Object parent, java.lang.String updatedBy) { return queryByField(parent, DContactMapper.Field.UPDATEDBY.getFieldName(), updatedBy); }
java
public Iterable<DContact> queryByUpdatedBy(Object parent, java.lang.String updatedBy) { return queryByField(parent, DContactMapper.Field.UPDATEDBY.getFieldName(), updatedBy); }
[ "public", "Iterable", "<", "DContact", ">", "queryByUpdatedBy", "(", "Object", "parent", ",", "java", ".", "lang", ".", "String", "updatedBy", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "UPDATEDBY", ".", "get...
query-by method for field updatedBy @param updatedBy the specified attribute @return an Iterable of DContacts for the specified updatedBy
[ "query", "-", "by", "method", "for", "field", "updatedBy" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L295-L297
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/data/VSizeLongSerde.java
VSizeLongSerde.getNumValuesPerBlock
public static int getNumValuesPerBlock(int bitsPerValue, int blockSize) { int ret = 1; while (getSerializedSize(bitsPerValue, ret) <= blockSize) { ret *= 2; } return ret / 2; }
java
public static int getNumValuesPerBlock(int bitsPerValue, int blockSize) { int ret = 1; while (getSerializedSize(bitsPerValue, ret) <= blockSize) { ret *= 2; } return ret / 2; }
[ "public", "static", "int", "getNumValuesPerBlock", "(", "int", "bitsPerValue", ",", "int", "blockSize", ")", "{", "int", "ret", "=", "1", ";", "while", "(", "getSerializedSize", "(", "bitsPerValue", ",", "ret", ")", "<=", "blockSize", ")", "{", "ret", "*="...
Block size should be power of 2, so {@link ColumnarLongs#get(int)} can be optimized using bit operators.
[ "Block", "size", "should", "be", "power", "of", "2", "so", "{" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/data/VSizeLongSerde.java#L69-L76
hdbeukel/james-core
src/main/java/org/jamesframework/core/problems/objectives/evaluations/PenalizedEvaluation.java
PenalizedEvaluation.addPenalizingValidation
public void addPenalizingValidation(Object key, PenalizingValidation penalizingValidation){ initMapOnce(); penalties.put(key, penalizingValidation); // update penalized value if(!penalizingValidation.passed()){ assignedPenalties = true; double p = penalizingValidation.getPenalty(); penalizedValue += minimizing ? p : -p; } }
java
public void addPenalizingValidation(Object key, PenalizingValidation penalizingValidation){ initMapOnce(); penalties.put(key, penalizingValidation); // update penalized value if(!penalizingValidation.passed()){ assignedPenalties = true; double p = penalizingValidation.getPenalty(); penalizedValue += minimizing ? p : -p; } }
[ "public", "void", "addPenalizingValidation", "(", "Object", "key", ",", "PenalizingValidation", "penalizingValidation", ")", "{", "initMapOnce", "(", ")", ";", "penalties", ".", "put", "(", "key", ",", "penalizingValidation", ")", ";", "// update penalized value", "...
Add a penalty expressed by a penalizing validation object. A key is required that can be used to retrieve the validation object later. @param key key used to retrieve the validation object later @param penalizingValidation penalizing validation that indicates the assigned penalty
[ "Add", "a", "penalty", "expressed", "by", "a", "penalizing", "validation", "object", ".", "A", "key", "is", "required", "that", "can", "be", "used", "to", "retrieve", "the", "validation", "object", "later", "." ]
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/problems/objectives/evaluations/PenalizedEvaluation.java#L78-L87
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/map/geotools/FeaturesParser.java
FeaturesParser.autoTreat
public final SimpleFeatureCollection autoTreat(final Template template, final String features) throws IOException { SimpleFeatureCollection featuresCollection = treatStringAsURL(template, features); if (featuresCollection == null) { featuresCollection = treatStringAsGeoJson(features); } return featuresCollection; }
java
public final SimpleFeatureCollection autoTreat(final Template template, final String features) throws IOException { SimpleFeatureCollection featuresCollection = treatStringAsURL(template, features); if (featuresCollection == null) { featuresCollection = treatStringAsGeoJson(features); } return featuresCollection; }
[ "public", "final", "SimpleFeatureCollection", "autoTreat", "(", "final", "Template", "template", ",", "final", "String", "features", ")", "throws", "IOException", "{", "SimpleFeatureCollection", "featuresCollection", "=", "treatStringAsURL", "(", "template", ",", "featu...
Get the features collection from a GeoJson inline string or URL. @param template the template @param features what to parse @return the feature collection @throws IOException
[ "Get", "the", "features", "collection", "from", "a", "GeoJson", "inline", "string", "or", "URL", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/map/geotools/FeaturesParser.java#L151-L158
Netflix/spectator
spectator-ext-jvm/src/main/java/com/netflix/spectator/jvm/Jmx.java
Jmx.registerMappingsFromConfig
public static void registerMappingsFromConfig(Registry registry, Config cfg) { registry.register(new JmxMeter(registry, JmxConfig.from(cfg))); }
java
public static void registerMappingsFromConfig(Registry registry, Config cfg) { registry.register(new JmxMeter(registry, JmxConfig.from(cfg))); }
[ "public", "static", "void", "registerMappingsFromConfig", "(", "Registry", "registry", ",", "Config", "cfg", ")", "{", "registry", ".", "register", "(", "new", "JmxMeter", "(", "registry", ",", "JmxConfig", ".", "from", "(", "cfg", ")", ")", ")", ";", "}" ...
Add meters based on configured JMX queries. See the {@link JmxConfig} class for more details. @param registry Registry to use for reporting the data. @param cfg Config object with the mappings.
[ "Add", "meters", "based", "on", "configured", "JMX", "queries", ".", "See", "the", "{", "@link", "JmxConfig", "}", "class", "for", "more", "details", "." ]
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-jvm/src/main/java/com/netflix/spectator/jvm/Jmx.java#L57-L59
alkacon/opencms-core
src/org/opencms/ade/sitemap/CmsModelPageHelper.java
CmsModelPageHelper.createModelGroupPage
public CmsResource createModelGroupPage(String name, String description, CmsUUID copyId) throws CmsException { CmsResource newPage = null; CmsResourceTypeConfig config = m_adeConfig.getResourceType( CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME); if ((config != null) && !config.isDisabled()) { if (copyId == null) { newPage = config.createNewElement(m_cms, m_rootResource.getRootPath()); } else { CmsResource copyResource = m_cms.readResource(copyId); newPage = config.createNewElement(m_cms, copyResource, m_rootResource.getRootPath()); } m_cms.lockResource(newPage); CmsProperty titleProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, name, null); CmsProperty descriptionProp = new CmsProperty( CmsPropertyDefinition.PROPERTY_DESCRIPTION, description, null); m_cms.writePropertyObject(m_cms.getSitePath(newPage), titleProp); m_cms.writePropertyObject(m_cms.getSitePath(newPage), descriptionProp); tryUnlock(newPage); } return newPage; }
java
public CmsResource createModelGroupPage(String name, String description, CmsUUID copyId) throws CmsException { CmsResource newPage = null; CmsResourceTypeConfig config = m_adeConfig.getResourceType( CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME); if ((config != null) && !config.isDisabled()) { if (copyId == null) { newPage = config.createNewElement(m_cms, m_rootResource.getRootPath()); } else { CmsResource copyResource = m_cms.readResource(copyId); newPage = config.createNewElement(m_cms, copyResource, m_rootResource.getRootPath()); } m_cms.lockResource(newPage); CmsProperty titleProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, name, null); CmsProperty descriptionProp = new CmsProperty( CmsPropertyDefinition.PROPERTY_DESCRIPTION, description, null); m_cms.writePropertyObject(m_cms.getSitePath(newPage), titleProp); m_cms.writePropertyObject(m_cms.getSitePath(newPage), descriptionProp); tryUnlock(newPage); } return newPage; }
[ "public", "CmsResource", "createModelGroupPage", "(", "String", "name", ",", "String", "description", ",", "CmsUUID", "copyId", ")", "throws", "CmsException", "{", "CmsResource", "newPage", "=", "null", ";", "CmsResourceTypeConfig", "config", "=", "m_adeConfig", "."...
Creates a new model group page.<p> @param name the page name @param description the page description @param copyId structure id of the resource to use as a model for the model page, if any (may be null) @return the new resource @throws CmsException in case something goes wrong
[ "Creates", "a", "new", "model", "group", "page", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsModelPageHelper.java#L172-L195
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf_upgrade_history.java
ns_conf_upgrade_history.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_conf_upgrade_history_responses result = (ns_conf_upgrade_history_responses) service.get_payload_formatter().string_to_resource(ns_conf_upgrade_history_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_conf_upgrade_history_response_array); } ns_conf_upgrade_history[] result_ns_conf_upgrade_history = new ns_conf_upgrade_history[result.ns_conf_upgrade_history_response_array.length]; for(int i = 0; i < result.ns_conf_upgrade_history_response_array.length; i++) { result_ns_conf_upgrade_history[i] = result.ns_conf_upgrade_history_response_array[i].ns_conf_upgrade_history[0]; } return result_ns_conf_upgrade_history; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_conf_upgrade_history_responses result = (ns_conf_upgrade_history_responses) service.get_payload_formatter().string_to_resource(ns_conf_upgrade_history_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_conf_upgrade_history_response_array); } ns_conf_upgrade_history[] result_ns_conf_upgrade_history = new ns_conf_upgrade_history[result.ns_conf_upgrade_history_response_array.length]; for(int i = 0; i < result.ns_conf_upgrade_history_response_array.length; i++) { result_ns_conf_upgrade_history[i] = result.ns_conf_upgrade_history_response_array[i].ns_conf_upgrade_history[0]; } return result_ns_conf_upgrade_history; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "ns_conf_upgrade_history_responses", "result", "=", "(", "ns_conf_upgrade_history_responses", ")", "service", "....
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf_upgrade_history.java#L221-L238
brianwhu/xillium
data/src/main/java/org/xillium/data/validation/Validator.java
Validator.preValidate
public void preValidate(String text) throws DataValidationException { // size Trace.g.std.note(Validator.class, "preValidate: size = " + _size); if (_size > 0 && text.length() > _size) { throw new DataValidationException("SIZE", _name, text); } // pattern Trace.g.std.note(Validator.class, "preValidate: pattern = " + _pattern); if (_pattern != null && !_pattern.matcher(text).matches()) { throw new DataValidationException("PATTERN", _name, text); } }
java
public void preValidate(String text) throws DataValidationException { // size Trace.g.std.note(Validator.class, "preValidate: size = " + _size); if (_size > 0 && text.length() > _size) { throw new DataValidationException("SIZE", _name, text); } // pattern Trace.g.std.note(Validator.class, "preValidate: pattern = " + _pattern); if (_pattern != null && !_pattern.matcher(text).matches()) { throw new DataValidationException("PATTERN", _name, text); } }
[ "public", "void", "preValidate", "(", "String", "text", ")", "throws", "DataValidationException", "{", "// size\r", "Trace", ".", "g", ".", "std", ".", "note", "(", "Validator", ".", "class", ",", "\"preValidate: size = \"", "+", "_size", ")", ";", "if", "("...
Performs all data validation that is based on the string representation of the value before it is converted. @param text - the string representation of the data value @throws DataValidationException if any of the data constraints are violated
[ "Performs", "all", "data", "validation", "that", "is", "based", "on", "the", "string", "representation", "of", "the", "value", "before", "it", "is", "converted", "." ]
train
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/data/src/main/java/org/xillium/data/validation/Validator.java#L117-L129
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/sequences/SequenceGibbsSampler.java
SequenceGibbsSampler.sampleSequenceRepeatedly
public void sampleSequenceRepeatedly(SequenceModel model, int[] sequence, int numSamples) { sequence = copy(sequence); // so we don't change the initial, or the one we just stored listener.setInitialSequence(sequence); for (int iter=0; iter<numSamples; iter++) { sampleSequenceForward(model, sequence); } }
java
public void sampleSequenceRepeatedly(SequenceModel model, int[] sequence, int numSamples) { sequence = copy(sequence); // so we don't change the initial, or the one we just stored listener.setInitialSequence(sequence); for (int iter=0; iter<numSamples; iter++) { sampleSequenceForward(model, sequence); } }
[ "public", "void", "sampleSequenceRepeatedly", "(", "SequenceModel", "model", ",", "int", "[", "]", "sequence", ",", "int", "numSamples", ")", "{", "sequence", "=", "copy", "(", "sequence", ")", ";", "// so we don't change the initial, or the one we just stored\r", "li...
Samples the sequence repeatedly, making numSamples passes over the entire sequence.
[ "Samples", "the", "sequence", "repeatedly", "making", "numSamples", "passes", "over", "the", "entire", "sequence", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/sequences/SequenceGibbsSampler.java#L167-L173
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/io/Files.java
Files.readLines
public static List<String> readLines(File file, Charset charset) throws IOException { // don't use asCharSource(file, charset).readLines() because that returns // an immutable list, which would change the behavior of this method return readLines( file, charset, new LineProcessor<List<String>>() { final List<String> result = Lists.newArrayList(); @Override public boolean processLine(String line) { result.add(line); return true; } @Override public List<String> getResult() { return result; } }); }
java
public static List<String> readLines(File file, Charset charset) throws IOException { // don't use asCharSource(file, charset).readLines() because that returns // an immutable list, which would change the behavior of this method return readLines( file, charset, new LineProcessor<List<String>>() { final List<String> result = Lists.newArrayList(); @Override public boolean processLine(String line) { result.add(line); return true; } @Override public List<String> getResult() { return result; } }); }
[ "public", "static", "List", "<", "String", ">", "readLines", "(", "File", "file", ",", "Charset", "charset", ")", "throws", "IOException", "{", "// don't use asCharSource(file, charset).readLines() because that returns", "// an immutable list, which would change the behavior of t...
Reads all of the lines from a file. The lines do not include line-termination characters, but do include other leading and trailing whitespace. <p>This method returns a mutable {@code List}. For an {@code ImmutableList}, use {@code Files.asCharSource(file, charset).readLines()}. @param file the file to read from @param charset the charset used to decode the input stream; see {@link StandardCharsets} for helpful predefined constants @return a mutable {@link List} containing all the lines @throws IOException if an I/O error occurs
[ "Reads", "all", "of", "the", "lines", "from", "a", "file", ".", "The", "lines", "do", "not", "include", "line", "-", "termination", "characters", "but", "do", "include", "other", "leading", "and", "trailing", "whitespace", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/io/Files.java#L517-L537
Azure/azure-sdk-for-java
datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java
ServicesInner.checkChildrenNameAvailability
public NameAvailabilityResponseInner checkChildrenNameAvailability(String groupName, String serviceName, NameAvailabilityRequest parameters) { return checkChildrenNameAvailabilityWithServiceResponseAsync(groupName, serviceName, parameters).toBlocking().single().body(); }
java
public NameAvailabilityResponseInner checkChildrenNameAvailability(String groupName, String serviceName, NameAvailabilityRequest parameters) { return checkChildrenNameAvailabilityWithServiceResponseAsync(groupName, serviceName, parameters).toBlocking().single().body(); }
[ "public", "NameAvailabilityResponseInner", "checkChildrenNameAvailability", "(", "String", "groupName", ",", "String", "serviceName", ",", "NameAvailabilityRequest", "parameters", ")", "{", "return", "checkChildrenNameAvailabilityWithServiceResponseAsync", "(", "groupName", ",", ...
Check nested resource name validity and availability. This method checks whether a proposed nested resource name is valid and available. @param groupName Name of the resource group @param serviceName Name of the service @param parameters Requested name to validate @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the NameAvailabilityResponseInner object if successful.
[ "Check", "nested", "resource", "name", "validity", "and", "availability", ".", "This", "method", "checks", "whether", "a", "proposed", "nested", "resource", "name", "is", "valid", "and", "available", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L1483-L1485
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/ContainerReadIndex.java
ContainerReadIndex.getOrCreateIndex
private StreamSegmentReadIndex getOrCreateIndex(long streamSegmentId) throws StreamSegmentNotExistsException { StreamSegmentReadIndex index; synchronized (this.lock) { // Try to see if we have the index already in memory. index = getIndex(streamSegmentId); if (index == null) { // We don't have it, create one. SegmentMetadata segmentMetadata = this.metadata.getStreamSegmentMetadata(streamSegmentId); Exceptions.checkArgument(segmentMetadata != null, "streamSegmentId", "StreamSegmentId %s does not exist in the metadata.", streamSegmentId); if (segmentMetadata.isDeleted()) { throw new StreamSegmentNotExistsException(segmentMetadata.getName()); } index = new StreamSegmentReadIndex(this.config, segmentMetadata, this.cache, this.storage, this.executor, isRecoveryMode()); this.cacheManager.register(index); this.readIndices.put(streamSegmentId, index); } } return index; }
java
private StreamSegmentReadIndex getOrCreateIndex(long streamSegmentId) throws StreamSegmentNotExistsException { StreamSegmentReadIndex index; synchronized (this.lock) { // Try to see if we have the index already in memory. index = getIndex(streamSegmentId); if (index == null) { // We don't have it, create one. SegmentMetadata segmentMetadata = this.metadata.getStreamSegmentMetadata(streamSegmentId); Exceptions.checkArgument(segmentMetadata != null, "streamSegmentId", "StreamSegmentId %s does not exist in the metadata.", streamSegmentId); if (segmentMetadata.isDeleted()) { throw new StreamSegmentNotExistsException(segmentMetadata.getName()); } index = new StreamSegmentReadIndex(this.config, segmentMetadata, this.cache, this.storage, this.executor, isRecoveryMode()); this.cacheManager.register(index); this.readIndices.put(streamSegmentId, index); } } return index; }
[ "private", "StreamSegmentReadIndex", "getOrCreateIndex", "(", "long", "streamSegmentId", ")", "throws", "StreamSegmentNotExistsException", "{", "StreamSegmentReadIndex", "index", ";", "synchronized", "(", "this", ".", "lock", ")", "{", "// Try to see if we have the index alre...
Gets a reference to the existing StreamSegmentRead index for the given StreamSegment Id. Creates a new one if necessary. @param streamSegmentId The Id of the StreamSegment whose ReadIndex to get.
[ "Gets", "a", "reference", "to", "the", "existing", "StreamSegmentRead", "index", "for", "the", "given", "StreamSegment", "Id", ".", "Creates", "a", "new", "one", "if", "necessary", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/ContainerReadIndex.java#L356-L377
actframework/actframework
src/main/java/act/util/ClassNode.java
ClassNode.visitAnnotatedClasses
public ClassNode visitAnnotatedClasses($.Visitor<ClassNode> visitor, boolean publicOnly, boolean noAbstract) { return visitAnnotatedClasses($.guardedVisitor(classNodeFilter(publicOnly, noAbstract), visitor)); }
java
public ClassNode visitAnnotatedClasses($.Visitor<ClassNode> visitor, boolean publicOnly, boolean noAbstract) { return visitAnnotatedClasses($.guardedVisitor(classNodeFilter(publicOnly, noAbstract), visitor)); }
[ "public", "ClassNode", "visitAnnotatedClasses", "(", "$", ".", "Visitor", "<", "ClassNode", ">", "visitor", ",", "boolean", "publicOnly", ",", "boolean", "noAbstract", ")", "{", "return", "visitAnnotatedClasses", "(", "$", ".", "guardedVisitor", "(", "classNodeFil...
Accept a visitor that visit all class node that has been annotated by the class represented by this `ClassNode` @param visitor the function that take `ClassNode` as argument @param publicOnly specify whether non-public class shall be scanned @param noAbstract specify whether abstract class shall be scanned @return this `ClassNode` instance
[ "Accept", "a", "visitor", "that", "visit", "all", "class", "node", "that", "has", "been", "annotated", "by", "the", "class", "represented", "by", "this", "ClassNode" ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/util/ClassNode.java#L335-L337
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java
IndexChangeAdapters.forNodeDepth
public static IndexChangeAdapter forNodeDepth( ExecutionContext context, NodeTypePredicate matcher, String workspaceName, ProvidedIndex<?> index ) { return new NodeDepthChangeAdapter(context, matcher, workspaceName, index); }
java
public static IndexChangeAdapter forNodeDepth( ExecutionContext context, NodeTypePredicate matcher, String workspaceName, ProvidedIndex<?> index ) { return new NodeDepthChangeAdapter(context, matcher, workspaceName, index); }
[ "public", "static", "IndexChangeAdapter", "forNodeDepth", "(", "ExecutionContext", "context", ",", "NodeTypePredicate", "matcher", ",", "String", "workspaceName", ",", "ProvidedIndex", "<", "?", ">", "index", ")", "{", "return", "new", "NodeDepthChangeAdapter", "(", ...
Create an {@link IndexChangeAdapter} implementation that handles the "mode:nodeDepth" property. @param context the execution context; may not be null @param matcher the node type matcher used to determine which nodes should be included in the index; may not be null @param workspaceName the name of the workspace; may not be null @param index the index that should be used; may not be null @return the new {@link IndexChangeAdapter}; never null
[ "Create", "an", "{", "@link", "IndexChangeAdapter", "}", "implementation", "that", "handles", "the", "mode", ":", "nodeDepth", "property", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java#L80-L85
minio/minio-java
api/src/main/java/io/minio/MinioClient.java
MinioClient.listObjects
public Iterable<Result<Item>> listObjects(final String bucketName, final String prefix, final boolean recursive, final boolean useVersion1) { if (useVersion1) { return listObjectsV1(bucketName, prefix, recursive); } return listObjectsV2(bucketName, prefix, recursive); }
java
public Iterable<Result<Item>> listObjects(final String bucketName, final String prefix, final boolean recursive, final boolean useVersion1) { if (useVersion1) { return listObjectsV1(bucketName, prefix, recursive); } return listObjectsV2(bucketName, prefix, recursive); }
[ "public", "Iterable", "<", "Result", "<", "Item", ">", ">", "listObjects", "(", "final", "String", "bucketName", ",", "final", "String", "prefix", ",", "final", "boolean", "recursive", ",", "final", "boolean", "useVersion1", ")", "{", "if", "(", "useVersion1...
Lists object information as {@code Iterable<Result><Item>} in given bucket, prefix, recursive flag and S3 API version to use. </p><b>Example:</b><br> <pre>{@code Iterable<Result<Item>> myObjects = minioClient.listObjects("my-bucketname", "my-object-prefix", true, false); for (Result<Item> result : myObjects) { Item item = result.get(); System.out.println(item.lastModified() + ", " + item.size() + ", " + item.objectName()); } }</pre> @param bucketName Bucket name. @param prefix Prefix string. List objects whose name starts with `prefix`. @param recursive when false, emulates a directory structure where each listing returned is either a full object or part of the object's key up to the first '/'. All objects wit the same prefix up to the first '/' will be merged into one entry. @param useVersion1 If set, Amazon AWS S3 List Object V1 is used, else List Object V2 is used as default. @return an iterator of Result Items. @see #listObjects(String bucketName) @see #listObjects(String bucketName, String prefix) @see #listObjects(String bucketName, String prefix, boolean recursive)
[ "Lists", "object", "information", "as", "{", "@code", "Iterable<Result", ">", "<Item", ">", "}", "in", "given", "bucket", "prefix", "recursive", "flag", "and", "S3", "API", "version", "to", "use", "." ]
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L2871-L2878
JOML-CI/JOML
src/org/joml/Intersectionf.java
Intersectionf.intersectRayAar
public static int intersectRayAar(Vector2fc origin, Vector2fc dir, Vector2fc min, Vector2fc max, Vector2f result) { return intersectRayAar(origin.x(), origin.y(), dir.x(), dir.y(), min.x(), min.y(), max.x(), max.y(), result); }
java
public static int intersectRayAar(Vector2fc origin, Vector2fc dir, Vector2fc min, Vector2fc max, Vector2f result) { return intersectRayAar(origin.x(), origin.y(), dir.x(), dir.y(), min.x(), min.y(), max.x(), max.y(), result); }
[ "public", "static", "int", "intersectRayAar", "(", "Vector2fc", "origin", ",", "Vector2fc", "dir", ",", "Vector2fc", "min", ",", "Vector2fc", "max", ",", "Vector2f", "result", ")", "{", "return", "intersectRayAar", "(", "origin", ".", "x", "(", ")", ",", "...
Determine whether the given ray with the given <code>origin</code> and direction <code>dir</code> intersects the axis-aligned rectangle given as its minimum corner <code>min</code> and maximum corner <code>max</code>, and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the near and far point of intersection as well as the side of the axis-aligned rectangle the ray intersects. <p> This method also detects an intersection for a ray whose origin lies inside the axis-aligned rectangle. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a> @see #intersectRayAar(float, float, float, float, float, float, float, float, Vector2f) @param origin the ray's origin @param dir the ray's direction @param min the minimum corner of the axis-aligned rectangle @param max the maximum corner of the axis-aligned rectangle @param result a vector which will hold the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the near and far point of intersection @return the side on which the near intersection occurred as one of {@link #AAR_SIDE_MINX}, {@link #AAR_SIDE_MINY}, {@link #AAR_SIDE_MAXX} or {@link #AAR_SIDE_MAXY}; or <code>-1</code> if the ray does not intersect the axis-aligned rectangle;
[ "Determine", "whether", "the", "given", "ray", "with", "the", "given", "<code", ">", "origin<", "/", "code", ">", "and", "direction", "<code", ">", "dir<", "/", "code", ">", "intersects", "the", "axis", "-", "aligned", "rectangle", "given", "as", "its", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L4441-L4443
Waxolunist/bittwiddling
src/main/java/com/vcollaborate/bitwise/BinaryUtils.java
BinaryUtils.toBitSet
public static final BitSet toBitSet(final int size, final long value) { BitSet bits = new BitSet(size); int idx = 0; long tmp = value; while (tmp != 0L) { if (tmp % 2L != 0L) { bits.set(idx); } ++idx; tmp = tmp >>> 1; } return bits; }
java
public static final BitSet toBitSet(final int size, final long value) { BitSet bits = new BitSet(size); int idx = 0; long tmp = value; while (tmp != 0L) { if (tmp % 2L != 0L) { bits.set(idx); } ++idx; tmp = tmp >>> 1; } return bits; }
[ "public", "static", "final", "BitSet", "toBitSet", "(", "final", "int", "size", ",", "final", "long", "value", ")", "{", "BitSet", "bits", "=", "new", "BitSet", "(", "size", ")", ";", "int", "idx", "=", "0", ";", "long", "tmp", "=", "value", ";", "...
Converts {@code value} into a {@link BitSet} of size {@code size}.
[ "Converts", "{" ]
train
https://github.com/Waxolunist/bittwiddling/blob/2c36342add73aab1223292d12fcff453aa3c07cd/src/main/java/com/vcollaborate/bitwise/BinaryUtils.java#L34-L46
softlayer/softlayer-java
gen/src/main/java/com/softlayer/api/gen/Meta.java
Meta.fromUrl
public static Meta fromUrl(URL url) { InputStream stream = null; try { stream = url.openStream(); Gson gson = new GsonBuilder().registerTypeAdapter(PropertyForm.class, new TypeAdapter<PropertyForm>() { @Override public void write(JsonWriter out, PropertyForm value) throws IOException { out.value(value.name().toLowerCase()); } @Override public PropertyForm read(JsonReader in) throws IOException { return PropertyForm.valueOf(in.nextString().toUpperCase()); } }).create(); Map<String, Type> types = gson.fromJson( new InputStreamReader(stream), new TypeToken<Map<String, Type>>(){ }.getType() ); return new Meta(types); } catch (IOException e) { throw new RuntimeException(e); } finally { if (stream != null) { try { stream.close(); } catch (Exception e) { } } } }
java
public static Meta fromUrl(URL url) { InputStream stream = null; try { stream = url.openStream(); Gson gson = new GsonBuilder().registerTypeAdapter(PropertyForm.class, new TypeAdapter<PropertyForm>() { @Override public void write(JsonWriter out, PropertyForm value) throws IOException { out.value(value.name().toLowerCase()); } @Override public PropertyForm read(JsonReader in) throws IOException { return PropertyForm.valueOf(in.nextString().toUpperCase()); } }).create(); Map<String, Type> types = gson.fromJson( new InputStreamReader(stream), new TypeToken<Map<String, Type>>(){ }.getType() ); return new Meta(types); } catch (IOException e) { throw new RuntimeException(e); } finally { if (stream != null) { try { stream.close(); } catch (Exception e) { } } } }
[ "public", "static", "Meta", "fromUrl", "(", "URL", "url", ")", "{", "InputStream", "stream", "=", "null", ";", "try", "{", "stream", "=", "url", ".", "openStream", "(", ")", ";", "Gson", "gson", "=", "new", "GsonBuilder", "(", ")", ".", "registerTypeAd...
Reads a JSON object from the given metadata URL and generates a new Meta object containing all types. @param url The API metadata URL. @return Meta
[ "Reads", "a", "JSON", "object", "from", "the", "given", "metadata", "URL", "and", "generates", "a", "new", "Meta", "object", "containing", "all", "types", "." ]
train
https://github.com/softlayer/softlayer-java/blob/0bb17f4b520aae0d0878f3dcaad0d9ee96472363/gen/src/main/java/com/softlayer/api/gen/Meta.java#L30-L57
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Table.java
Table.waitForDelete
public void waitForDelete() throws InterruptedException { Waiter waiter = client.waiters().tableNotExists(); try { waiter.run(new WaiterParameters<DescribeTableRequest>(new DescribeTableRequest(tableName)) .withPollingStrategy(new PollingStrategy(new MaxAttemptsRetryStrategy(25), new FixedDelayStrategy(5)))); } catch (Exception exception) { throw new IllegalArgumentException("Table " + tableName + " is not deleted.", exception); } }
java
public void waitForDelete() throws InterruptedException { Waiter waiter = client.waiters().tableNotExists(); try { waiter.run(new WaiterParameters<DescribeTableRequest>(new DescribeTableRequest(tableName)) .withPollingStrategy(new PollingStrategy(new MaxAttemptsRetryStrategy(25), new FixedDelayStrategy(5)))); } catch (Exception exception) { throw new IllegalArgumentException("Table " + tableName + " is not deleted.", exception); } }
[ "public", "void", "waitForDelete", "(", ")", "throws", "InterruptedException", "{", "Waiter", "waiter", "=", "client", ".", "waiters", "(", ")", ".", "tableNotExists", "(", ")", ";", "try", "{", "waiter", ".", "run", "(", "new", "WaiterParameters", "<", "D...
A convenient blocking call that can be used, typically during table deletion, to wait for the table to become deleted. This method uses {@link com.amazonaws.services.dynamodbv2.waiters.AmazonDynamoDBWaiters} to poll the status of the table every 5 seconds.
[ "A", "convenient", "blocking", "call", "that", "can", "be", "used", "typically", "during", "table", "deletion", "to", "wait", "for", "the", "table", "to", "become", "deleted", ".", "This", "method", "uses", "{" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Table.java#L499-L507
jmxtrans/jmxtrans
jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/naming/KeyUtils.java
KeyUtils.getKeyString
public static String getKeyString(Query query, Result result, List<String> typeNames) { StringBuilder sb = new StringBuilder(); addMBeanIdentifier(query, result, sb); addSeparator(sb); addTypeName(query, result, typeNames, sb); addKeyString(query, result, sb); return sb.toString(); }
java
public static String getKeyString(Query query, Result result, List<String> typeNames) { StringBuilder sb = new StringBuilder(); addMBeanIdentifier(query, result, sb); addSeparator(sb); addTypeName(query, result, typeNames, sb); addKeyString(query, result, sb); return sb.toString(); }
[ "public", "static", "String", "getKeyString", "(", "Query", "query", ",", "Result", "result", ",", "List", "<", "String", ">", "typeNames", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "addMBeanIdentifier", "(", "query", ",", ...
Gets the key string, without rootPrefix nor Alias @param query the query @param result the result @param typeNames the type names @return the key string
[ "Gets", "the", "key", "string", "without", "rootPrefix", "nor", "Alias" ]
train
https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/naming/KeyUtils.java#L66-L73
taskadapter/redmine-java-api
src/main/java/com/taskadapter/redmineapi/internal/RedmineJSONBuilder.java
RedmineJSONBuilder.writeProject
public static void writeProject(JSONWriter writer, Project project) throws IllegalArgumentException, JSONException { /* Validate project */ if (project.getName() == null) throw new IllegalArgumentException( "Project name must be set to create a new project"); if (project.getIdentifier() == null) throw new IllegalArgumentException( "Project identifier must be set to create a new project"); writeProject(project, writer); }
java
public static void writeProject(JSONWriter writer, Project project) throws IllegalArgumentException, JSONException { /* Validate project */ if (project.getName() == null) throw new IllegalArgumentException( "Project name must be set to create a new project"); if (project.getIdentifier() == null) throw new IllegalArgumentException( "Project identifier must be set to create a new project"); writeProject(project, writer); }
[ "public", "static", "void", "writeProject", "(", "JSONWriter", "writer", ",", "Project", "project", ")", "throws", "IllegalArgumentException", ",", "JSONException", "{", "/* Validate project */", "if", "(", "project", ".", "getName", "(", ")", "==", "null", ")", ...
Writes a "create project" request. @param writer project writer. @param project project to create. @throws IllegalArgumentException if some project fields are not configured. @throws JSONException if IO error occurs.
[ "Writes", "a", "create", "project", "request", "." ]
train
https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/internal/RedmineJSONBuilder.java#L53-L64
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_RingSideBuffer.java
ST_RingSideBuffer.ringSideBuffer
public static Geometry ringSideBuffer(Geometry geom, double bufferSize, int numBuffer) throws SQLException { return ringSideBuffer(geom, bufferSize, numBuffer, "endcap=flat"); }
java
public static Geometry ringSideBuffer(Geometry geom, double bufferSize, int numBuffer) throws SQLException { return ringSideBuffer(geom, bufferSize, numBuffer, "endcap=flat"); }
[ "public", "static", "Geometry", "ringSideBuffer", "(", "Geometry", "geom", ",", "double", "bufferSize", ",", "int", "numBuffer", ")", "throws", "SQLException", "{", "return", "ringSideBuffer", "(", "geom", ",", "bufferSize", ",", "numBuffer", ",", "\"endcap=flat\"...
Compute a ring buffer on one side of the geometry @param geom @param bufferSize @param numBuffer @return @throws java.sql.SQLException
[ "Compute", "a", "ring", "buffer", "on", "one", "side", "of", "the", "geometry" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_RingSideBuffer.java#L65-L67
yatechorg/jedis-utils
src/main/java/org/yatech/jedis/collections/JedisCollections.java
JedisCollections.getSortedSet
public static JedisSortedSet getSortedSet(Jedis jedis, String key, ScoreProvider scoreProvider) { return new JedisSortedSet(jedis, key, scoreProvider); }
java
public static JedisSortedSet getSortedSet(Jedis jedis, String key, ScoreProvider scoreProvider) { return new JedisSortedSet(jedis, key, scoreProvider); }
[ "public", "static", "JedisSortedSet", "getSortedSet", "(", "Jedis", "jedis", ",", "String", "key", ",", "ScoreProvider", "scoreProvider", ")", "{", "return", "new", "JedisSortedSet", "(", "jedis", ",", "key", ",", "scoreProvider", ")", ";", "}" ]
Get a {@link java.util.Set} abstraction of a sorted set redis value in the specified key, using the given {@link Jedis}. @param jedis the {@link Jedis} connection to use for the sorted set operations. @param key the key of the sorted set value in redis @param scoreProvider the provider to use for assigning scores when none is given explicitly. @return the {@link JedisSortedSet} instance
[ "Get", "a", "{" ]
train
https://github.com/yatechorg/jedis-utils/blob/1951609fa6697df4f69be76e7d66b9284924bd97/src/main/java/org/yatech/jedis/collections/JedisCollections.java#L109-L111
structr/structr
structr-rest/src/main/java/org/structr/rest/auth/AuthHelper.java
AuthHelper.isConfirmationKeyValid
public static boolean isConfirmationKeyValid(final String confirmationKey, final Integer validityPeriod) { final String[] parts = confirmationKey.split("!"); if (parts.length == 2) { final long confirmationKeyCreated = Long.parseLong(parts[1]); final long maxValidity = confirmationKeyCreated + validityPeriod * 60 * 1000; return (maxValidity >= new Date().getTime()); } return Settings.ConfirmationKeyValidWithoutTimestamp.getValue(); }
java
public static boolean isConfirmationKeyValid(final String confirmationKey, final Integer validityPeriod) { final String[] parts = confirmationKey.split("!"); if (parts.length == 2) { final long confirmationKeyCreated = Long.parseLong(parts[1]); final long maxValidity = confirmationKeyCreated + validityPeriod * 60 * 1000; return (maxValidity >= new Date().getTime()); } return Settings.ConfirmationKeyValidWithoutTimestamp.getValue(); }
[ "public", "static", "boolean", "isConfirmationKeyValid", "(", "final", "String", "confirmationKey", ",", "final", "Integer", "validityPeriod", ")", "{", "final", "String", "[", "]", "parts", "=", "confirmationKey", ".", "split", "(", "\"!\"", ")", ";", "if", "...
Determines if the key is valid or not. If the key has no timestamp the configuration setting for keys without timestamp is used @param confirmationKey The confirmation key to check @param validityPeriod The validity period for the key (in minutes) @return
[ "Determines", "if", "the", "key", "is", "valid", "or", "not", ".", "If", "the", "key", "has", "no", "timestamp", "the", "configuration", "setting", "for", "keys", "without", "timestamp", "is", "used" ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-rest/src/main/java/org/structr/rest/auth/AuthHelper.java#L268-L281
esigate/esigate
esigate-core/src/main/java/org/esigate/http/MoveResponseHeader.java
MoveResponseHeader.moveHeader
public static void moveHeader(HttpResponse response, String srcName, String targetName) { if (response.containsHeader(srcName)) { LOG.info("Moving header {} to {}", srcName, targetName); Header[] headers = response.getHeaders(srcName); response.removeHeaders(targetName); for (Header h : headers) { response.addHeader(targetName, h.getValue()); } response.removeHeaders(srcName); } }
java
public static void moveHeader(HttpResponse response, String srcName, String targetName) { if (response.containsHeader(srcName)) { LOG.info("Moving header {} to {}", srcName, targetName); Header[] headers = response.getHeaders(srcName); response.removeHeaders(targetName); for (Header h : headers) { response.addHeader(targetName, h.getValue()); } response.removeHeaders(srcName); } }
[ "public", "static", "void", "moveHeader", "(", "HttpResponse", "response", ",", "String", "srcName", ",", "String", "targetName", ")", "{", "if", "(", "response", ".", "containsHeader", "(", "srcName", ")", ")", "{", "LOG", ".", "info", "(", "\"Moving header...
This method can be used directly to move an header. @param response HTTP response @param srcName source header name @param targetName target header name
[ "This", "method", "can", "be", "used", "directly", "to", "move", "an", "header", "." ]
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/MoveResponseHeader.java#L73-L84
zaproxy/zaproxy
src/org/parosproxy/paros/network/HttpHeader.java
HttpHeader.addInternalHeaderFields
private void addInternalHeaderFields(String name, String value) { String key = normalisedHeaderName(name); Vector<String> v = getHeaders(key); if (v == null) { v = new Vector<>(); mHeaderFields.put(key, v); } if (value != null) { v.add(value); } else { mHeaderFields.remove(key); } }
java
private void addInternalHeaderFields(String name, String value) { String key = normalisedHeaderName(name); Vector<String> v = getHeaders(key); if (v == null) { v = new Vector<>(); mHeaderFields.put(key, v); } if (value != null) { v.add(value); } else { mHeaderFields.remove(key); } }
[ "private", "void", "addInternalHeaderFields", "(", "String", "name", ",", "String", "value", ")", "{", "String", "key", "=", "normalisedHeaderName", "(", "name", ")", ";", "Vector", "<", "String", ">", "v", "=", "getHeaders", "(", "key", ")", ";", "if", ...
Add the header stored in internal hashtable @param name @param value
[ "Add", "the", "header", "stored", "in", "internal", "hashtable" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/network/HttpHeader.java#L483-L496
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Retryer.java
Retryer.stopAfterDelay
public Retryer<R> stopAfterDelay(final long delayInMillis) { checkArgument(delayInMillis >= 0L, "delayInMillis must be >= 0 but is %d", delayInMillis); return withStopStrategy(new StopStrategy() { @Override public boolean shouldStop(int previousAttemptNumber, long delaySinceFirstAttemptInMillis) { return delaySinceFirstAttemptInMillis >= delayInMillis; } }); }
java
public Retryer<R> stopAfterDelay(final long delayInMillis) { checkArgument(delayInMillis >= 0L, "delayInMillis must be >= 0 but is %d", delayInMillis); return withStopStrategy(new StopStrategy() { @Override public boolean shouldStop(int previousAttemptNumber, long delaySinceFirstAttemptInMillis) { return delaySinceFirstAttemptInMillis >= delayInMillis; } }); }
[ "public", "Retryer", "<", "R", ">", "stopAfterDelay", "(", "final", "long", "delayInMillis", ")", "{", "checkArgument", "(", "delayInMillis", ">=", "0L", ",", "\"delayInMillis must be >= 0 but is %d\"", ",", "delayInMillis", ")", ";", "return", "withStopStrategy", "...
Sets the stop strategy which stops after a given delay milliseconds @param delayInMillis @return
[ "Sets", "the", "stop", "strategy", "which", "stops", "after", "a", "given", "delay", "milliseconds" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Retryer.java#L325-L333
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java
TransformerIdentityImpl.setResult
public void setResult(Result result) throws IllegalArgumentException { if(null == result) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_NULL, null)); //"Result should not be null"); m_result = result; }
java
public void setResult(Result result) throws IllegalArgumentException { if(null == result) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_NULL, null)); //"Result should not be null"); m_result = result; }
[ "public", "void", "setResult", "(", "Result", "result", ")", "throws", "IllegalArgumentException", "{", "if", "(", "null", "==", "result", ")", "throw", "new", "IllegalArgumentException", "(", "XSLMessages", ".", "createMessage", "(", "XSLTErrorResources", ".", "E...
Enables the user of the TransformerHandler to set the to set the Result for the transformation. @param result A Result instance, should not be null. @throws IllegalArgumentException if result is invalid for some reason.
[ "Enables", "the", "user", "of", "the", "TransformerHandler", "to", "set", "the", "to", "set", "the", "Result", "for", "the", "transformation", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java#L109-L114
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/locking/InMemoryLockMapImpl.java
InMemoryLockMapImpl.removeReader
public void removeReader(TransactionImpl tx, Object obj) { checkTimedOutLocks(); Identity oid = new Identity(obj, getBroker()); String oidString = oid.toString(); String txGuid = tx.getGUID(); removeReaderInternal(oidString, txGuid); }
java
public void removeReader(TransactionImpl tx, Object obj) { checkTimedOutLocks(); Identity oid = new Identity(obj, getBroker()); String oidString = oid.toString(); String txGuid = tx.getGUID(); removeReaderInternal(oidString, txGuid); }
[ "public", "void", "removeReader", "(", "TransactionImpl", "tx", ",", "Object", "obj", ")", "{", "checkTimedOutLocks", "(", ")", ";", "Identity", "oid", "=", "new", "Identity", "(", "obj", ",", "getBroker", "(", ")", ")", ";", "String", "oidString", "=", ...
remove a reader lock entry for transaction tx on object obj from the persistent storage.
[ "remove", "a", "reader", "lock", "entry", "for", "transaction", "tx", "on", "object", "obj", "from", "the", "persistent", "storage", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/InMemoryLockMapImpl.java#L171-L179
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/Util.java
Util.addToPath
public static String addToPath(String basePath, String fileName) { return Util.addToPath(basePath, fileName, '\0'); }
java
public static String addToPath(String basePath, String fileName) { return Util.addToPath(basePath, fileName, '\0'); }
[ "public", "static", "String", "addToPath", "(", "String", "basePath", ",", "String", "fileName", ")", "{", "return", "Util", ".", "addToPath", "(", "basePath", ",", "fileName", ",", "'", "'", ")", ";", "}" ]
Add this param to this path. @param strOldURL The original URL to add this param to. @param strParam The parameter to add. @param strData The data this parameter is set to. @param bAddIfNull Add an empty param if the data is null? @return The new URL string.
[ "Add", "this", "param", "to", "this", "path", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L57-L60
shrinkwrap/descriptors
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java
Metadata.addGroupElement
public void addGroupElement(final String groupName, final MetadataElement groupElement) { for (MetadataItem item : groupList) { if (item.getName().equals(groupName) && item.getNamespace().equals(getCurrentNamespace())) { item.getElements().add(groupElement); return; } } final MetadataItem newItem = new MetadataItem(groupName); newItem.getElements().add(groupElement); newItem.setNamespace(getCurrentNamespace()); newItem.setSchemaName(getCurrentSchmema()); newItem.setPackageApi(getCurrentPackageApi()); newItem.setPackageImpl(getCurrentPackageImpl()); groupList.add(newItem); }
java
public void addGroupElement(final String groupName, final MetadataElement groupElement) { for (MetadataItem item : groupList) { if (item.getName().equals(groupName) && item.getNamespace().equals(getCurrentNamespace())) { item.getElements().add(groupElement); return; } } final MetadataItem newItem = new MetadataItem(groupName); newItem.getElements().add(groupElement); newItem.setNamespace(getCurrentNamespace()); newItem.setSchemaName(getCurrentSchmema()); newItem.setPackageApi(getCurrentPackageApi()); newItem.setPackageImpl(getCurrentPackageImpl()); groupList.add(newItem); }
[ "public", "void", "addGroupElement", "(", "final", "String", "groupName", ",", "final", "MetadataElement", "groupElement", ")", "{", "for", "(", "MetadataItem", "item", ":", "groupList", ")", "{", "if", "(", "item", ".", "getName", "(", ")", ".", "equals", ...
Adds a new element to the specific group element class. If no group element class is found, then a new group element class. will be created. @param groupName the group class name of @param groupElement the new element to be added.
[ "Adds", "a", "new", "element", "to", "the", "specific", "group", "element", "class", ".", "If", "no", "group", "element", "class", "is", "found", "then", "a", "new", "group", "element", "class", ".", "will", "be", "created", "." ]
train
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java#L143-L158
pierre/serialization
hadoop/src/main/java/com/ning/metrics/serialization/hadoop/pig/ThriftStorage.java
ThriftStorage.prepareToRead
@Override public void prepareToRead(RecordReader reader, PigSplit split) throws IOException { this.reader = reader; this.split = split; setIOSerializations(split.getConf()); }
java
@Override public void prepareToRead(RecordReader reader, PigSplit split) throws IOException { this.reader = reader; this.split = split; setIOSerializations(split.getConf()); }
[ "@", "Override", "public", "void", "prepareToRead", "(", "RecordReader", "reader", ",", "PigSplit", "split", ")", "throws", "IOException", "{", "this", ".", "reader", "=", "reader", ";", "this", ".", "split", "=", "split", ";", "setIOSerializations", "(", "s...
Initializes LoadFunc for reading data. This will be called during execution before any calls to getNext. The RecordReader needs to be passed here because it has been instantiated for a particular InputSplit. @param reader {@link org.apache.hadoop.mapreduce.RecordReader} to be used by this instance of the LoadFunc @param split The input {@link org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit} to process @throws java.io.IOException if there is an exception during initialization
[ "Initializes", "LoadFunc", "for", "reading", "data", ".", "This", "will", "be", "called", "during", "execution", "before", "any", "calls", "to", "getNext", ".", "The", "RecordReader", "needs", "to", "be", "passed", "here", "because", "it", "has", "been", "in...
train
https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/hadoop/src/main/java/com/ning/metrics/serialization/hadoop/pig/ThriftStorage.java#L133-L139
google/error-prone
check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessAnalysis.java
NullnessAnalysis.getNullness
public Nullness getNullness(TreePath exprPath, Context context) { try { nullnessPropagation.setContext(context).setCompilationUnit(exprPath.getCompilationUnit()); return DataFlow.expressionDataflow(exprPath, context, nullnessPropagation); } finally { nullnessPropagation.setContext(null).setCompilationUnit(null); } }
java
public Nullness getNullness(TreePath exprPath, Context context) { try { nullnessPropagation.setContext(context).setCompilationUnit(exprPath.getCompilationUnit()); return DataFlow.expressionDataflow(exprPath, context, nullnessPropagation); } finally { nullnessPropagation.setContext(null).setCompilationUnit(null); } }
[ "public", "Nullness", "getNullness", "(", "TreePath", "exprPath", ",", "Context", "context", ")", "{", "try", "{", "nullnessPropagation", ".", "setContext", "(", "context", ")", ".", "setCompilationUnit", "(", "exprPath", ".", "getCompilationUnit", "(", ")", ")"...
Returns the {@link Nullness} of the leaf of {@code exprPath}. <p>If the leaf required the compiler to generate autoboxing or autounboxing calls, {@code getNullness} returns the {@code Nullness} <i>after</i> the boxing/unboxing. This implies that, in those cases, it will always return {@code NONNULL}.
[ "Returns", "the", "{", "@link", "Nullness", "}", "of", "the", "leaf", "of", "{", "@code", "exprPath", "}", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessAnalysis.java#L56-L63
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/protocol/MultipleSyntaxElements.java
MultipleSyntaxElements.containsOnly
private boolean containsOnly(String s, char c) { for (char c2 : s.toCharArray()) { if (c != c2) return false; } return true; }
java
private boolean containsOnly(String s, char c) { for (char c2 : s.toCharArray()) { if (c != c2) return false; } return true; }
[ "private", "boolean", "containsOnly", "(", "String", "s", ",", "char", "c", ")", "{", "for", "(", "char", "c2", ":", "s", ".", "toCharArray", "(", ")", ")", "{", "if", "(", "c", "!=", "c2", ")", "return", "false", ";", "}", "return", "true", ";",...
Prueft, ob der Text s nur aus dem Zeichen c besteht. @param s der Text. @param c das Zeichen. @return true, wenn der Text nur dieses Zeichen enthaelt.
[ "Prueft", "ob", "der", "Text", "s", "nur", "aus", "dem", "Zeichen", "c", "besteht", "." ]
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/protocol/MultipleSyntaxElements.java#L533-L540
otto-de/edison-hal
src/main/java/de/otto/edison/hal/traverson/Traverson.java
Traverson.followLink
public Traverson followLink(final String rel, final Predicate<Link> predicate, final Map<String, Object> vars) { checkState(); hops.add(new Hop(rel, predicate, vars, true)); return this; }
java
public Traverson followLink(final String rel, final Predicate<Link> predicate, final Map<String, Object> vars) { checkState(); hops.add(new Hop(rel, predicate, vars, true)); return this; }
[ "public", "Traverson", "followLink", "(", "final", "String", "rel", ",", "final", "Predicate", "<", "Link", ">", "predicate", ",", "final", "Map", "<", "String", ",", "Object", ">", "vars", ")", "{", "checkState", "(", ")", ";", "hops", ".", "add", "("...
Follow the first {@link Link} of the current resource, selected by its link-relation type. The {@link LinkPredicates predicate} is used to select the matching link, if multiple links are available for the specified link-relation type. <p> Templated links are expanded to URIs using the specified template variables. </p> <p> Other than {@link #follow(String, Predicate, Map)}, this method will ignore possibly embedded resources with the same link-relation type. Only if the link is missing, the embedded resource is used. </p> @param rel the link-relation type of the followed link @param predicate the predicate used to select the link to follow. @param vars uri-template variables used to build links. @return this @since 2.0.0
[ "Follow", "the", "first", "{", "@link", "Link", "}", "of", "the", "current", "resource", "selected", "by", "its", "link", "-", "relation", "type", ".", "The", "{", "@link", "LinkPredicates", "predicate", "}", "is", "used", "to", "select", "the", "matching"...
train
https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/traverson/Traverson.java#L581-L587
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/utility/Convert.java
Convert.twoBytesToInt
public static int twoBytesToInt(byte[] bytes, ByteOrder order) { if (order == ByteOrder.BIG_ENDIAN) { return bytesToInt(bytes[0], bytes[1]); } else if (order == ByteOrder.LITTLE_ENDIAN) { return bytesToInt(bytes[1], bytes[0]); } else { throw new IllegalArgumentException("ByteOrder must be BIG_ENDIAN or LITTLE_ENDIAN"); } }
java
public static int twoBytesToInt(byte[] bytes, ByteOrder order) { if (order == ByteOrder.BIG_ENDIAN) { return bytesToInt(bytes[0], bytes[1]); } else if (order == ByteOrder.LITTLE_ENDIAN) { return bytesToInt(bytes[1], bytes[0]); } else { throw new IllegalArgumentException("ByteOrder must be BIG_ENDIAN or LITTLE_ENDIAN"); } }
[ "public", "static", "int", "twoBytesToInt", "(", "byte", "[", "]", "bytes", ",", "ByteOrder", "order", ")", "{", "if", "(", "order", "==", "ByteOrder", ".", "BIG_ENDIAN", ")", "{", "return", "bytesToInt", "(", "bytes", "[", "0", "]", ",", "bytes", "[",...
Convert an array of two unsigned bytes with the given byte order to one signed int. @param bytes The bytes to be parsed @param order The byte order to be used @return An int representing the bytes in the given order
[ "Convert", "an", "array", "of", "two", "unsigned", "bytes", "with", "the", "given", "byte", "order", "to", "one", "signed", "int", "." ]
train
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/utility/Convert.java#L61-L73
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/UIContextImpl.java
UIContextImpl.setModel
@Override public void setModel(final WebComponent component, final WebModel model) { map.put(component, model); }
java
@Override public void setModel(final WebComponent component, final WebModel model) { map.put(component, model); }
[ "@", "Override", "public", "void", "setModel", "(", "final", "WebComponent", "component", ",", "final", "WebModel", "model", ")", "{", "map", ".", "put", "(", "component", ",", "model", ")", ";", "}" ]
Stores the extrinsic state information for the given component. @param component the component to set the model for. @param model the model to set.
[ "Stores", "the", "extrinsic", "state", "information", "for", "the", "given", "component", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/UIContextImpl.java#L123-L126
voldemort/voldemort
src/java/voldemort/rest/coordinator/DynamicTimeoutStoreClient.java
DynamicTimeoutStoreClient.putVersionedWithCustomTimeout
public Version putVersionedWithCustomTimeout(CompositeVoldemortRequest<K, V> requestWrapper) throws ObsoleteVersionException { validateTimeout(requestWrapper.getRoutingTimeoutInMs()); for(int attempts = 0; attempts < this.metadataRefreshAttempts; attempts++) { try { String keyHexString = ""; long startTimeInMs = System.currentTimeMillis(); if(logger.isDebugEnabled()) { ByteArray key = (ByteArray) requestWrapper.getKey(); keyHexString = RestUtils.getKeyHexString(key); debugLogStart("PUT_VERSION", requestWrapper.getRequestOriginTimeInMs(), startTimeInMs, keyHexString); } store.put(requestWrapper); if(logger.isDebugEnabled()) { debugLogEnd("PUT_VERSION", requestWrapper.getRequestOriginTimeInMs(), startTimeInMs, System.currentTimeMillis(), keyHexString, 0); } return requestWrapper.getValue().getVersion(); } catch(InvalidMetadataException e) { logger.info("Received invalid metadata exception during put [ " + e.getMessage() + " ] on store '" + storeName + "'. Rebootstrapping"); bootStrap(); } } throw new VoldemortException(this.metadataRefreshAttempts + " metadata refresh attempts failed."); }
java
public Version putVersionedWithCustomTimeout(CompositeVoldemortRequest<K, V> requestWrapper) throws ObsoleteVersionException { validateTimeout(requestWrapper.getRoutingTimeoutInMs()); for(int attempts = 0; attempts < this.metadataRefreshAttempts; attempts++) { try { String keyHexString = ""; long startTimeInMs = System.currentTimeMillis(); if(logger.isDebugEnabled()) { ByteArray key = (ByteArray) requestWrapper.getKey(); keyHexString = RestUtils.getKeyHexString(key); debugLogStart("PUT_VERSION", requestWrapper.getRequestOriginTimeInMs(), startTimeInMs, keyHexString); } store.put(requestWrapper); if(logger.isDebugEnabled()) { debugLogEnd("PUT_VERSION", requestWrapper.getRequestOriginTimeInMs(), startTimeInMs, System.currentTimeMillis(), keyHexString, 0); } return requestWrapper.getValue().getVersion(); } catch(InvalidMetadataException e) { logger.info("Received invalid metadata exception during put [ " + e.getMessage() + " ] on store '" + storeName + "'. Rebootstrapping"); bootStrap(); } } throw new VoldemortException(this.metadataRefreshAttempts + " metadata refresh attempts failed."); }
[ "public", "Version", "putVersionedWithCustomTimeout", "(", "CompositeVoldemortRequest", "<", "K", ",", "V", ">", "requestWrapper", ")", "throws", "ObsoleteVersionException", "{", "validateTimeout", "(", "requestWrapper", ".", "getRoutingTimeoutInMs", "(", ")", ")", ";",...
Performs a Versioned put operation with the specified composite request object @param requestWrapper Composite request object containing the key and the versioned object @return Version of the value for the successful put @throws ObsoleteVersionException
[ "Performs", "a", "Versioned", "put", "operation", "with", "the", "specified", "composite", "request", "object" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/coordinator/DynamicTimeoutStoreClient.java#L198-L231
sporniket/core
sporniket-core-ml/src/main/java/com/sporniket/libre/lang/sgml/SgmlUtils.java
SgmlUtils.generateAttribute
public static String generateAttribute(String attributeName, String value) { Object[] _args = { attributeName, SGML_VALUE_ENCODER.apply(value) }; return MESSAGE_FORMAT__ATTRIBUT.format(_args); }
java
public static String generateAttribute(String attributeName, String value) { Object[] _args = { attributeName, SGML_VALUE_ENCODER.apply(value) }; return MESSAGE_FORMAT__ATTRIBUT.format(_args); }
[ "public", "static", "String", "generateAttribute", "(", "String", "attributeName", ",", "String", "value", ")", "{", "Object", "[", "]", "_args", "=", "{", "attributeName", ",", "SGML_VALUE_ENCODER", ".", "apply", "(", "value", ")", "}", ";", "return", "MESS...
Generate an attribute of the specified name and value. @param attributeName name of the attribute. @param value value of the attribute. @return the SGML code for an attribute.
[ "Generate", "an", "attribute", "of", "the", "specified", "name", "and", "value", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/sgml/SgmlUtils.java#L77-L84
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/InmemQueue.java
InmemQueue.putToQueue
protected void putToQueue(IQueueMessage<ID, DATA> msg) throws QueueException.QueueIsFull { if (!queue.offer(msg)) { throw new QueueException.QueueIsFull(getBoundary()); } }
java
protected void putToQueue(IQueueMessage<ID, DATA> msg) throws QueueException.QueueIsFull { if (!queue.offer(msg)) { throw new QueueException.QueueIsFull(getBoundary()); } }
[ "protected", "void", "putToQueue", "(", "IQueueMessage", "<", "ID", ",", "DATA", ">", "msg", ")", "throws", "QueueException", ".", "QueueIsFull", "{", "if", "(", "!", "queue", ".", "offer", "(", "msg", ")", ")", "{", "throw", "new", "QueueException", "."...
Puts a message to the queue buffer. @param msg @throws QueueException.QueueIsFull if the ring buffer is full
[ "Puts", "a", "message", "to", "the", "queue", "buffer", "." ]
train
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/InmemQueue.java#L123-L127
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/WorkbenchVirtualizer.java
WorkbenchVirtualizer.enqueueURL
public void enqueueURL(VisitState visitState, final ByteArrayList url) throws IOException { final byte[] urlBuffer = url.elements(); final int pathQueryStart = BURL.startOfpathAndQuery(urlBuffer); byteArrayDiskQueues.enqueue(visitState, urlBuffer, pathQueryStart, url.size() - pathQueryStart); }
java
public void enqueueURL(VisitState visitState, final ByteArrayList url) throws IOException { final byte[] urlBuffer = url.elements(); final int pathQueryStart = BURL.startOfpathAndQuery(urlBuffer); byteArrayDiskQueues.enqueue(visitState, urlBuffer, pathQueryStart, url.size() - pathQueryStart); }
[ "public", "void", "enqueueURL", "(", "VisitState", "visitState", ",", "final", "ByteArrayList", "url", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "urlBuffer", "=", "url", ".", "elements", "(", ")", ";", "final", "int", "pathQueryStart", "=...
Enqueues the given URL as a path+query associated to the scheme+authority of the given visit state. @param visitState the visitState to which the URL must be added. @param url a {@link BURL BUbiNG URL}. @throws IOException
[ "Enqueues", "the", "given", "URL", "as", "a", "path", "+", "query", "associated", "to", "the", "scheme", "+", "authority", "of", "the", "given", "visit", "state", "." ]
train
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/WorkbenchVirtualizer.java#L126-L130
tvesalainen/util
util/src/main/java/org/vesalainen/ui/ScanlineFiller.java
ScanlineFiller.floodFill
public void floodFill(int xx, int yy, IntPredicate target, int replacement) { floodFill(xx, yy, 0, 0, width, height, target, replacement); }
java
public void floodFill(int xx, int yy, IntPredicate target, int replacement) { floodFill(xx, yy, 0, 0, width, height, target, replacement); }
[ "public", "void", "floodFill", "(", "int", "xx", ",", "int", "yy", ",", "IntPredicate", "target", ",", "int", "replacement", ")", "{", "floodFill", "(", "xx", ",", "yy", ",", "0", ",", "0", ",", "width", ",", "height", ",", "target", ",", "replacemen...
Fills area starting at xx,yy. Pixels fullfilling target are replaced with replacement color. @param xx @param yy @param target @param replacement
[ "Fills", "area", "starting", "at", "xx", "yy", ".", "Pixels", "fullfilling", "target", "are", "replaced", "with", "replacement", "color", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/ScanlineFiller.java#L87-L90
akquinet/androlog
androlog/src/main/java/de/akquinet/android/androlog/Log.java
Log.wtf
public static int wtf(String tag, Throwable tr) { collectLogEntry(Constants.VERBOSE, tag, "", tr); if (isLoggable(tag, Constants.ASSERT)) { if (useWTF) { try { return (Integer) wtfTagErrorMethod.invoke(null, new Object[] { tag, tr }); } catch (Exception e) { return LogHelper.println(Constants.ASSERT, tag, LogHelper.getStackTraceString(tr)); } } else { return LogHelper.println(Constants.ASSERT, tag, LogHelper.getStackTraceString(tr)); } } return 0; }
java
public static int wtf(String tag, Throwable tr) { collectLogEntry(Constants.VERBOSE, tag, "", tr); if (isLoggable(tag, Constants.ASSERT)) { if (useWTF) { try { return (Integer) wtfTagErrorMethod.invoke(null, new Object[] { tag, tr }); } catch (Exception e) { return LogHelper.println(Constants.ASSERT, tag, LogHelper.getStackTraceString(tr)); } } else { return LogHelper.println(Constants.ASSERT, tag, LogHelper.getStackTraceString(tr)); } } return 0; }
[ "public", "static", "int", "wtf", "(", "String", "tag", ",", "Throwable", "tr", ")", "{", "collectLogEntry", "(", "Constants", ".", "VERBOSE", ",", "tag", ",", "\"\"", ",", "tr", ")", ";", "if", "(", "isLoggable", "(", "tag", ",", "Constants", ".", "...
What a Terrible Failure: Report a condition that should never happen. The error will always be logged at level Constants.ASSERT despite the logging is disabled. Depending on system configuration, and on Android 2.2+, a report may be added to the DropBoxManager and/or the process may be terminated immediately with an error dialog. On older Android version (before 2.2), the message is logged with the Assert level. Those log messages will always be logged. @param tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. @param tr The exception to log
[ "What", "a", "Terrible", "Failure", ":", "Report", "a", "condition", "that", "should", "never", "happen", ".", "The", "error", "will", "always", "be", "logged", "at", "level", "Constants", ".", "ASSERT", "despite", "the", "logging", "is", "disabled", ".", ...
train
https://github.com/akquinet/androlog/blob/82fa81354c01c9b1d1928062b634ba21f14be560/androlog/src/main/java/de/akquinet/android/androlog/Log.java#L1009-L1024
interedition/collatex
collatex-core/src/main/java/eu/interedition/collatex/suffixarray/DivSufSort.java
DivSufSort.ssCompare
private int ssCompare(int pa, int pb, int p2, int depth) { int U1, U2, U1n, U2n;// pointers to T for (U1 = depth + pa, U2 = depth + SA[p2], U1n = pb + 2, U2n = SA[p2 + 1] + 2; (U1 < U1n) && (U2 < U2n) && (T[start + U1] == T[start + U2]); ++U1, ++U2) { } return U1 < U1n ? (U2 < U2n ? T[start + U1] - T[start + U2] : 1) : (U2 < U2n ? -1 : 0); }
java
private int ssCompare(int pa, int pb, int p2, int depth) { int U1, U2, U1n, U2n;// pointers to T for (U1 = depth + pa, U2 = depth + SA[p2], U1n = pb + 2, U2n = SA[p2 + 1] + 2; (U1 < U1n) && (U2 < U2n) && (T[start + U1] == T[start + U2]); ++U1, ++U2) { } return U1 < U1n ? (U2 < U2n ? T[start + U1] - T[start + U2] : 1) : (U2 < U2n ? -1 : 0); }
[ "private", "int", "ssCompare", "(", "int", "pa", ",", "int", "pb", ",", "int", "p2", ",", "int", "depth", ")", "{", "int", "U1", ",", "U2", ",", "U1n", ",", "U2n", ";", "// pointers to T", "for", "(", "U1", "=", "depth", "+", "pa", ",", "U2", "...
special version of ss_compare for handling <code>ss_compare(T, &(PAi[0]), PA + *a, depth)</code> situation.
[ "special", "version", "of", "ss_compare", "for", "handling", "<code", ">", "ss_compare", "(", "T", "&", "(", "PAi", "[", "0", "]", ")", "PA", "+", "*", "a", "depth", ")", "<", "/", "code", ">", "situation", "." ]
train
https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/suffixarray/DivSufSort.java#L453-L462
alkacon/opencms-core
src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleExecutor.java
CmsSqlConsoleExecutor.writeError
private void writeError(I_CmsReport report, Throwable e) { report.println(e); if (LOG.isWarnEnabled()) { LOG.warn("SQLConsole", e); } }
java
private void writeError(I_CmsReport report, Throwable e) { report.println(e); if (LOG.isWarnEnabled()) { LOG.warn("SQLConsole", e); } }
[ "private", "void", "writeError", "(", "I_CmsReport", "report", ",", "Throwable", "e", ")", "{", "report", ".", "println", "(", "e", ")", ";", "if", "(", "LOG", ".", "isWarnEnabled", "(", ")", ")", "{", "LOG", ".", "warn", "(", "\"SQLConsole\"", ",", ...
Writes the given error to the report, and, if enabled, to the opencms log file.<p> @param report the report to write to @param e the exception
[ "Writes", "the", "given", "error", "to", "the", "report", "and", "if", "enabled", "to", "the", "opencms", "log", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleExecutor.java#L295-L301
aws/aws-sdk-java
aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateRobotApplicationResult.java
CreateRobotApplicationResult.withTags
public CreateRobotApplicationResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public CreateRobotApplicationResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateRobotApplicationResult", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The list of all tags added to the robot application. </p> @param tags The list of all tags added to the robot application. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "list", "of", "all", "tags", "added", "to", "the", "robot", "application", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateRobotApplicationResult.java#L420-L423
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/core/util/RequestUtil.java
RequestUtil.getIntSelector
public static int getIntSelector(SlingHttpServletRequest request, Pattern groupPattern, int defaultValue) { String[] selectors = request.getRequestPathInfo().getSelectors(); for (String selector : selectors) { Matcher matcher = groupPattern.matcher(selector); if (matcher.matches()) { try { return Integer.parseInt(matcher.group(1)); } catch (NumberFormatException nfex) { // ok, try next } } } return defaultValue; }
java
public static int getIntSelector(SlingHttpServletRequest request, Pattern groupPattern, int defaultValue) { String[] selectors = request.getRequestPathInfo().getSelectors(); for (String selector : selectors) { Matcher matcher = groupPattern.matcher(selector); if (matcher.matches()) { try { return Integer.parseInt(matcher.group(1)); } catch (NumberFormatException nfex) { // ok, try next } } } return defaultValue; }
[ "public", "static", "int", "getIntSelector", "(", "SlingHttpServletRequest", "request", ",", "Pattern", "groupPattern", ",", "int", "defaultValue", ")", "{", "String", "[", "]", "selectors", "=", "request", ".", "getRequestPathInfo", "(", ")", ".", "getSelectors",...
Retrieves a number in the selectors and returns it if present otherwise the default value. @param request the request object with the selector info @param groupPattern the regex to extract the value - as group '1'; e.g. 'key([\d]+)' @param defaultValue the default number value
[ "Retrieves", "a", "number", "in", "the", "selectors", "and", "returns", "it", "if", "present", "otherwise", "the", "default", "value", "." ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/RequestUtil.java#L108-L121
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/DirectoryClient.java
DirectoryClient.getSubsystemManifest
protected Manifest getSubsystemManifest(String assetId) throws IOException { ZipFile zip = null; try { zip = DirectoryUtils.createZipFile(new File(_root, assetId)); Enumeration<? extends ZipEntry> zipEntries = zip.entries(); ZipEntry subsystemEntry = null; while (zipEntries.hasMoreElements()) { ZipEntry nextEntry = zipEntries.nextElement(); if ("OSGI-INF/SUBSYSTEM.MF".equalsIgnoreCase(nextEntry.getName())) { subsystemEntry = nextEntry; break; } } if (subsystemEntry == null) { return null; } else { return ManifestProcessor.parseManifest(zip.getInputStream(subsystemEntry)); } } finally { if (zip != null) { zip.close(); } } }
java
protected Manifest getSubsystemManifest(String assetId) throws IOException { ZipFile zip = null; try { zip = DirectoryUtils.createZipFile(new File(_root, assetId)); Enumeration<? extends ZipEntry> zipEntries = zip.entries(); ZipEntry subsystemEntry = null; while (zipEntries.hasMoreElements()) { ZipEntry nextEntry = zipEntries.nextElement(); if ("OSGI-INF/SUBSYSTEM.MF".equalsIgnoreCase(nextEntry.getName())) { subsystemEntry = nextEntry; break; } } if (subsystemEntry == null) { return null; } else { return ManifestProcessor.parseManifest(zip.getInputStream(subsystemEntry)); } } finally { if (zip != null) { zip.close(); } } }
[ "protected", "Manifest", "getSubsystemManifest", "(", "String", "assetId", ")", "throws", "IOException", "{", "ZipFile", "zip", "=", "null", ";", "try", "{", "zip", "=", "DirectoryUtils", ".", "createZipFile", "(", "new", "File", "(", "_root", ",", "assetId", ...
Gets the manifest file from an ESA @param assetId @return @throws IOException
[ "Gets", "the", "manifest", "file", "from", "an", "ESA" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/DirectoryClient.java#L236-L259
osiam/connector4java
src/main/java/org/osiam/client/OsiamConnector.java
OsiamConnector.replaceUser
public User replaceUser(String id, User user, AccessToken accessToken) { return getUserService().replaceUser(id, user, accessToken); }
java
public User replaceUser(String id, User user, AccessToken accessToken) { return getUserService().replaceUser(id, user, accessToken); }
[ "public", "User", "replaceUser", "(", "String", "id", ",", "User", "user", ",", "AccessToken", "accessToken", ")", "{", "return", "getUserService", "(", ")", ".", "replaceUser", "(", "id", ",", "user", ",", "accessToken", ")", ";", "}" ]
replaces the {@link User} with the given id with the given {@link User} @param id The id of the User to be replaced @param user The {@link User} who will repleace the old {@link User} @param accessToken the OSIAM access token from for the current session @return the replaced User @throws InvalidAttributeException in case the id or the User is null or empty @throws UnauthorizedException if the request could not be authorized. @throws ConflictException if the User could not be replaced @throws NoResultException if no user with the given id can be found @throws ForbiddenException if the scope doesn't allow this request @throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized @throws IllegalStateException if OSIAM's endpoint(s) are not properly configured
[ "replaces", "the", "{", "@link", "User", "}", "with", "the", "given", "id", "with", "the", "given", "{", "@link", "User", "}" ]
train
https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L544-L546
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AsyncLibrary.java
AsyncLibrary.getIOException
public static IOException getIOException(String desc, int code) { return new IOException(desc + ErrorMessageCache.get(code)); }
java
public static IOException getIOException(String desc, int code) { return new IOException(desc + ErrorMessageCache.get(code)); }
[ "public", "static", "IOException", "getIOException", "(", "String", "desc", ",", "int", "code", ")", "{", "return", "new", "IOException", "(", "desc", "+", "ErrorMessageCache", ".", "get", "(", "code", ")", ")", ";", "}" ]
Get an IOException instance for the input description and native AIO return coded. @param desc @param code @return IOException
[ "Get", "an", "IOException", "instance", "for", "the", "input", "description", "and", "native", "AIO", "return", "coded", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AsyncLibrary.java#L816-L818
mbrade/prefixedproperties
pp-spring/src/main/java/net/sf/prefixedproperties/spring/PrefixedPropertiesPersister.java
PrefixedPropertiesPersister.storeToYAML
public void storeToYAML(final Properties props, final OutputStream os, final String header, final String encoding) throws IOException { try { ((PrefixedProperties) props).storeToYAML(os, header, encoding); } catch (final ClassCastException err) { throw new IOException( "Cannot store properties JSON file - not using PrefixedProperties: " + err.getMessage()); } }
java
public void storeToYAML(final Properties props, final OutputStream os, final String header, final String encoding) throws IOException { try { ((PrefixedProperties) props).storeToYAML(os, header, encoding); } catch (final ClassCastException err) { throw new IOException( "Cannot store properties JSON file - not using PrefixedProperties: " + err.getMessage()); } }
[ "public", "void", "storeToYAML", "(", "final", "Properties", "props", ",", "final", "OutputStream", "os", ",", "final", "String", "header", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "try", "{", "(", "(", "PrefixedProperties", ")", ...
Store to json. @param props the props @param os the os @param header the header @param encoding the encoding @throws IOException Signals that an I/O exception has occurred.
[ "Store", "to", "json", "." ]
train
https://github.com/mbrade/prefixedproperties/blob/ac430409ea37e244158002b3cf1504417835a0b2/pp-spring/src/main/java/net/sf/prefixedproperties/spring/PrefixedPropertiesPersister.java#L235-L243
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/ArrayLabelSetterFactory.java
ArrayLabelSetterFactory.createField
private Optional<ArrayLabelSetter> createField(final Class<?> beanClass, final String fieldName) { final String labelFieldName = fieldName + "Label"; final Field labelField; try { labelField = beanClass.getDeclaredField(labelFieldName); labelField.setAccessible(true); } catch (NoSuchFieldException | SecurityException e) { return Optional.empty(); } if(!List.class.isAssignableFrom(labelField.getType())) { return Optional.empty(); } final ParameterizedType type = (ParameterizedType) labelField.getGenericType(); final Class<?> valueType = (Class<?>) type.getActualTypeArguments()[0]; if(valueType.equals(String.class)) { return Optional.of(new ArrayLabelSetter() { @SuppressWarnings("unchecked") @Override public void set(final Object beanObj, final String label, final int index) { ArgUtils.notNull(beanObj, "beanObj"); ArgUtils.notEmpty(label, "label"); try { List<String> labelListObj = (List<String>) labelField.get(beanObj); if(labelListObj == null) { labelListObj = new ArrayList<>(); labelField.set(beanObj, labelListObj); } Utils.addListWithIndex(labelListObj, label, index); } catch (IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("fail access label field.", e); } } }); } return Optional.empty(); }
java
private Optional<ArrayLabelSetter> createField(final Class<?> beanClass, final String fieldName) { final String labelFieldName = fieldName + "Label"; final Field labelField; try { labelField = beanClass.getDeclaredField(labelFieldName); labelField.setAccessible(true); } catch (NoSuchFieldException | SecurityException e) { return Optional.empty(); } if(!List.class.isAssignableFrom(labelField.getType())) { return Optional.empty(); } final ParameterizedType type = (ParameterizedType) labelField.getGenericType(); final Class<?> valueType = (Class<?>) type.getActualTypeArguments()[0]; if(valueType.equals(String.class)) { return Optional.of(new ArrayLabelSetter() { @SuppressWarnings("unchecked") @Override public void set(final Object beanObj, final String label, final int index) { ArgUtils.notNull(beanObj, "beanObj"); ArgUtils.notEmpty(label, "label"); try { List<String> labelListObj = (List<String>) labelField.get(beanObj); if(labelListObj == null) { labelListObj = new ArrayList<>(); labelField.set(beanObj, labelListObj); } Utils.addListWithIndex(labelListObj, label, index); } catch (IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("fail access label field.", e); } } }); } return Optional.empty(); }
[ "private", "Optional", "<", "ArrayLabelSetter", ">", "createField", "(", "final", "Class", "<", "?", ">", "beanClass", ",", "final", "String", "fieldName", ")", "{", "final", "String", "labelFieldName", "=", "fieldName", "+", "\"Label\"", ";", "final", "Field"...
フィールドによるラベル情報を格納する場合。 <p>{@code <フィールド名> + Label}のメソッド名</p> @param beanClass フィールドが定義してあるクラスのインスタンス @param fieldName フィールド名 @return ラベル情報の設定用クラス
[ "フィールドによるラベル情報を格納する場合。", "<p", ">", "{", "@code", "<フィールド名", ">", "+", "Label", "}", "のメソッド名<", "/", "p", ">" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/ArrayLabelSetterFactory.java#L181-L229
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/snmp_alarm_config.java
snmp_alarm_config.update
public static snmp_alarm_config update(nitro_service client, snmp_alarm_config resource) throws Exception { resource.validate("modify"); return ((snmp_alarm_config[]) resource.update_resource(client))[0]; }
java
public static snmp_alarm_config update(nitro_service client, snmp_alarm_config resource) throws Exception { resource.validate("modify"); return ((snmp_alarm_config[]) resource.update_resource(client))[0]; }
[ "public", "static", "snmp_alarm_config", "update", "(", "nitro_service", "client", ",", "snmp_alarm_config", "resource", ")", "throws", "Exception", "{", "resource", ".", "validate", "(", "\"modify\"", ")", ";", "return", "(", "(", "snmp_alarm_config", "[", "]", ...
<pre> Use this operation to modify snmp alarm configuration. </pre>
[ "<pre", ">", "Use", "this", "operation", "to", "modify", "snmp", "alarm", "configuration", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/snmp_alarm_config.java#L154-L158
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/HashUtil.java
HashUtil.MurmurHash3_x86_32
public static int MurmurHash3_x86_32(byte[] data, int offset, int len) { final long endIndex = (long) offset + len - 1; assert endIndex >= Integer.MIN_VALUE && endIndex <= Integer.MAX_VALUE : String.format("offset %,d len %,d would cause int overflow", offset, len); return MurmurHash3_x86_32(BYTE_ARRAY_LOADER, data, offset, len, DEFAULT_MURMUR_SEED); }
java
public static int MurmurHash3_x86_32(byte[] data, int offset, int len) { final long endIndex = (long) offset + len - 1; assert endIndex >= Integer.MIN_VALUE && endIndex <= Integer.MAX_VALUE : String.format("offset %,d len %,d would cause int overflow", offset, len); return MurmurHash3_x86_32(BYTE_ARRAY_LOADER, data, offset, len, DEFAULT_MURMUR_SEED); }
[ "public", "static", "int", "MurmurHash3_x86_32", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "len", ")", "{", "final", "long", "endIndex", "=", "(", "long", ")", "offset", "+", "len", "-", "1", ";", "assert", "endIndex", ">=", "I...
Returns the MurmurHash3_x86_32 hash of a block inside a byte array.
[ "Returns", "the", "MurmurHash3_x86_32", "hash", "of", "a", "block", "inside", "a", "byte", "array", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/HashUtil.java#L65-L70
aws/aws-sdk-java
aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/ContainerDefinition.java
ContainerDefinition.getSecrets
public java.util.List<Secret> getSecrets() { if (secrets == null) { secrets = new com.amazonaws.internal.SdkInternalList<Secret>(); } return secrets; }
java
public java.util.List<Secret> getSecrets() { if (secrets == null) { secrets = new com.amazonaws.internal.SdkInternalList<Secret>(); } return secrets; }
[ "public", "java", ".", "util", ".", "List", "<", "Secret", ">", "getSecrets", "(", ")", "{", "if", "(", "secrets", "==", "null", ")", "{", "secrets", "=", "new", "com", ".", "amazonaws", ".", "internal", ".", "SdkInternalList", "<", "Secret", ">", "(...
<p> The secrets to pass to the container. For more information, see <a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html">Specifying Sensitive Data</a> in the <i>Amazon Elastic Container Service Developer Guide</i>. </p> @return The secrets to pass to the container. For more information, see <a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html" >Specifying Sensitive Data</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
[ "<p", ">", "The", "secrets", "to", "pass", "to", "the", "container", ".", "For", "more", "information", "see", "<a", "href", "=", "http", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "AmazonECS", "/", "latest", "/", "developerguide", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/ContainerDefinition.java#L3351-L3356
vdmeer/asciitable
src/main/java/de/vandermeer/asciitable/AsciiTable.java
AsciiTable.addRow
public final AT_Row addRow(Object ...columns) throws NullPointerException, AsciiTableException { AT_Row ret = AT_Row.createContentRow(columns, TableRowStyle.NORMAL); if(this.colNumber==0){ this.colNumber = columns.length; } else{ if(columns.length!=this.colNumber){ throw new AsciiTableException("wrong columns argument", "wrong number of columns, expected " + this.colNumber + " received " + columns.length); } } this.rows.add(ret); return ret; }
java
public final AT_Row addRow(Object ...columns) throws NullPointerException, AsciiTableException { AT_Row ret = AT_Row.createContentRow(columns, TableRowStyle.NORMAL); if(this.colNumber==0){ this.colNumber = columns.length; } else{ if(columns.length!=this.colNumber){ throw new AsciiTableException("wrong columns argument", "wrong number of columns, expected " + this.colNumber + " received " + columns.length); } } this.rows.add(ret); return ret; }
[ "public", "final", "AT_Row", "addRow", "(", "Object", "...", "columns", ")", "throws", "NullPointerException", ",", "AsciiTableException", "{", "AT_Row", "ret", "=", "AT_Row", ".", "createContentRow", "(", "columns", ",", "TableRowStyle", ".", "NORMAL", ")", ";"...
Adds a content row to the table. For the first content row added, the number of objects given here determines the number of columns in the table. For every subsequent content row, the array must have an entry for each column, i.e. the size of the array must be the same as the result of {@link #getColNumber()}. @param columns content of the columns for the row, must not be null @return the created row for further customization @throws {@link NullPointerException} if columns was null @throws {@link AsciiTableException} if columns does not have the correct size (more or less entries than columns defined for the table)
[ "Adds", "a", "content", "row", "to", "the", "table", ".", "For", "the", "first", "content", "row", "added", "the", "number", "of", "objects", "given", "here", "determines", "the", "number", "of", "columns", "in", "the", "table", ".", "For", "every", "sub...
train
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L101-L115
sdaschner/jaxrs-analyzer
src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java
ResultInterpreter.interpretResourceMethod
private ResourceMethod interpretResourceMethod(final MethodResult methodResult, final ClassResult classResult) { final MethodComment methodDoc = methodResult.getMethodDoc(); final String description = methodDoc != null ? methodDoc.getComment() : null; final ResourceMethod resourceMethod = new ResourceMethod(methodResult.getHttpMethod(), description); updateMethodParameters(resourceMethod.getMethodParameters(), classResult.getClassFields()); updateMethodParameters(resourceMethod.getMethodParameters(), methodResult.getMethodParameters()); addParameterDescriptions(resourceMethod.getMethodParameters(), methodDoc); stringParameterResolver.replaceParametersTypes(resourceMethod.getMethodParameters()); if (methodResult.getRequestBodyType() != null) { resourceMethod.setRequestBody(javaTypeAnalyzer.analyze(methodResult.getRequestBodyType())); resourceMethod.setRequestBodyDescription(findRequestBodyDescription(methodDoc)); } // add default status code due to JSR 339 addDefaultResponses(methodResult); methodResult.getResponses().forEach(r -> interpretResponse(r, resourceMethod)); addResponseComments(methodResult, resourceMethod); addMediaTypes(methodResult, classResult, resourceMethod); if (methodResult.isDeprecated() || classResult.isDeprecated() || hasDeprecationTag(methodDoc)) resourceMethod.setDeprecated(true); return resourceMethod; }
java
private ResourceMethod interpretResourceMethod(final MethodResult methodResult, final ClassResult classResult) { final MethodComment methodDoc = methodResult.getMethodDoc(); final String description = methodDoc != null ? methodDoc.getComment() : null; final ResourceMethod resourceMethod = new ResourceMethod(methodResult.getHttpMethod(), description); updateMethodParameters(resourceMethod.getMethodParameters(), classResult.getClassFields()); updateMethodParameters(resourceMethod.getMethodParameters(), methodResult.getMethodParameters()); addParameterDescriptions(resourceMethod.getMethodParameters(), methodDoc); stringParameterResolver.replaceParametersTypes(resourceMethod.getMethodParameters()); if (methodResult.getRequestBodyType() != null) { resourceMethod.setRequestBody(javaTypeAnalyzer.analyze(methodResult.getRequestBodyType())); resourceMethod.setRequestBodyDescription(findRequestBodyDescription(methodDoc)); } // add default status code due to JSR 339 addDefaultResponses(methodResult); methodResult.getResponses().forEach(r -> interpretResponse(r, resourceMethod)); addResponseComments(methodResult, resourceMethod); addMediaTypes(methodResult, classResult, resourceMethod); if (methodResult.isDeprecated() || classResult.isDeprecated() || hasDeprecationTag(methodDoc)) resourceMethod.setDeprecated(true); return resourceMethod; }
[ "private", "ResourceMethod", "interpretResourceMethod", "(", "final", "MethodResult", "methodResult", ",", "final", "ClassResult", "classResult", ")", "{", "final", "MethodComment", "methodDoc", "=", "methodResult", ".", "getMethodDoc", "(", ")", ";", "final", "String...
Interprets the result of a resource method. @param methodResult The method result @param classResult The result of the containing class @return The resource method which this method represents
[ "Interprets", "the", "result", "of", "a", "resource", "method", "." ]
train
https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java#L104-L133
apache/reef
lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java
ContextRepresenters.onContextReady
private synchronized void onContextReady(final ContextStatusPOJO contextStatus, final boolean notifyClientOnNewActiveContext) { assert ContextState.READY == contextStatus.getContextState(); final String contextID = contextStatus.getContextId(); // This could be the first message we get from that context if (this.isUnknownContextId(contextID)) { this.onNewContext(contextStatus, notifyClientOnNewActiveContext); } // Dispatch the messages to the application, if there are any. for (final ContextMessagePOJO contextMessage : contextStatus.getContextMessageList()) { final byte[] theMessage = contextMessage.getMessage(); final String sourceID = contextMessage.getSourceId(); final long sequenceNumber = contextMessage.getSequenceNumber(); this.messageDispatcher.onContextMessage(new ContextMessageImpl(theMessage, contextID, sourceID, sequenceNumber)); } }
java
private synchronized void onContextReady(final ContextStatusPOJO contextStatus, final boolean notifyClientOnNewActiveContext) { assert ContextState.READY == contextStatus.getContextState(); final String contextID = contextStatus.getContextId(); // This could be the first message we get from that context if (this.isUnknownContextId(contextID)) { this.onNewContext(contextStatus, notifyClientOnNewActiveContext); } // Dispatch the messages to the application, if there are any. for (final ContextMessagePOJO contextMessage : contextStatus.getContextMessageList()) { final byte[] theMessage = contextMessage.getMessage(); final String sourceID = contextMessage.getSourceId(); final long sequenceNumber = contextMessage.getSequenceNumber(); this.messageDispatcher.onContextMessage(new ContextMessageImpl(theMessage, contextID, sourceID, sequenceNumber)); } }
[ "private", "synchronized", "void", "onContextReady", "(", "final", "ContextStatusPOJO", "contextStatus", ",", "final", "boolean", "notifyClientOnNewActiveContext", ")", "{", "assert", "ContextState", ".", "READY", "==", "contextStatus", ".", "getContextState", "(", ")",...
Process a message with status READY from a context. @param contextStatus @param notifyClientOnNewActiveContext whether or not to inform the application when this in fact refers to a new context.
[ "Process", "a", "message", "with", "status", "READY", "from", "a", "context", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java#L187-L205
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java
ReflectionUtils.getField
public static Field getField(Class<?> clazz, String fieldName) { final String internedName = fieldName.intern(); return traverseHierarchy(clazz, new TraverseTask<Field>() { @Override public Field run(Class<?> clazz) { Field[] fields = clazz.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { if (fields[i].getName() == internedName) { return fields[i]; } } return null; } }); }
java
public static Field getField(Class<?> clazz, String fieldName) { final String internedName = fieldName.intern(); return traverseHierarchy(clazz, new TraverseTask<Field>() { @Override public Field run(Class<?> clazz) { Field[] fields = clazz.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { if (fields[i].getName() == internedName) { return fields[i]; } } return null; } }); }
[ "public", "static", "Field", "getField", "(", "Class", "<", "?", ">", "clazz", ",", "String", "fieldName", ")", "{", "final", "String", "internedName", "=", "fieldName", ".", "intern", "(", ")", ";", "return", "traverseHierarchy", "(", "clazz", ",", "new",...
Returns the field object found for the given field name in the given class. This method traverses through the super classes of the given class and tries to find the field as declared field within these classes. When the object class is reached the traversing stops. If the field can not be found, null is returned. @param clazz The class within to look for the field with the given field name @param fieldName The name of the field to be returned @return The field object with the given field name if the field can be found, otherwise null
[ "Returns", "the", "field", "object", "found", "for", "the", "given", "field", "name", "in", "the", "given", "class", ".", "This", "method", "traverses", "through", "the", "super", "classes", "of", "the", "given", "class", "and", "tries", "to", "find", "the...
train
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java#L631-L646
seedstack/business
core/src/main/java/org/seedstack/business/internal/utils/FieldUtils.java
FieldUtils.resolveField
public static Optional<Field> resolveField(Class<?> someClass, String fieldName) { return fieldCache.get(new FieldReference(someClass, fieldName)); }
java
public static Optional<Field> resolveField(Class<?> someClass, String fieldName) { return fieldCache.get(new FieldReference(someClass, fieldName)); }
[ "public", "static", "Optional", "<", "Field", ">", "resolveField", "(", "Class", "<", "?", ">", "someClass", ",", "String", "fieldName", ")", "{", "return", "fieldCache", ".", "get", "(", "new", "FieldReference", "(", "someClass", ",", "fieldName", ")", ")...
Returns the specified field found on the specified class and its ancestors. @param someClass the class to search the field on. @param fieldName the field name. @return the corresponding field object wrapped in an optional.
[ "Returns", "the", "specified", "field", "found", "on", "the", "specified", "class", "and", "its", "ancestors", "." ]
train
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/FieldUtils.java#L60-L62