repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
FlyingHe/UtilsMaven
src/main/java/com/github/flyinghe/tools/XLSXReader.java
XLSXReader.readExcel
public static void readExcel(File file, Integer scale, int limit, ExcelHandler callback) throws ReadExcelException { OPCPackage p = null; XLSXReader reader = null; try { p = OPCPackage.open(file, PackageAccess.READ); reader = new XLSXReader(p, scale, limit, callback); reader.process(); } catch (Exception e) { throw new ReadExcelException(e.getMessage()); } finally { if (p != null) { try { p.close(); } catch (IOException e) { throw new ReadExcelException(e.getMessage()); } } } }
java
public static void readExcel(File file, Integer scale, int limit, ExcelHandler callback) throws ReadExcelException { OPCPackage p = null; XLSXReader reader = null; try { p = OPCPackage.open(file, PackageAccess.READ); reader = new XLSXReader(p, scale, limit, callback); reader.process(); } catch (Exception e) { throw new ReadExcelException(e.getMessage()); } finally { if (p != null) { try { p.close(); } catch (IOException e) { throw new ReadExcelException(e.getMessage()); } } } }
[ "public", "static", "void", "readExcel", "(", "File", "file", ",", "Integer", "scale", ",", "int", "limit", ",", "ExcelHandler", "callback", ")", "throws", "ReadExcelException", "{", "OPCPackage", "p", "=", "null", ";", "XLSXReader", "reader", "=", "null", "...
用于读取limit行之后处理读取的数据(通过回调函数处理) @param file Excel文件 @param scale 指定若数值中含有小数则保留几位小数,四舍五入,null或者<=0表示不四舍五入 @param limit 指定最多读取多少数据行,<= 0表示不限制,若指定了limit则在达到限制后会移除旧元素再放入新的元素 @param callback 指定{@link #datas}达到{@link #limit}限制时执行的回调函数, 若为null则表示不执行回调函数。 注意:在{@link #datas}未达到指定限制而文件数据已经完全读取完毕的情况下也会调用回调函数(若有回调函数), 回调函数在datas被清空之前调用(若需要回调则必须启用限制,即{@link #limit} >0)。 @throws ReadExcelException
[ "用于读取limit行之后处理读取的数据", "(", "通过回调函数处理", ")" ]
train
https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/XLSXReader.java#L494-L513
apache/groovy
src/main/groovy/groovy/lang/MetaClassImpl.java
MetaClassImpl.getProperty
public Object getProperty(Object object, String property) { return getProperty(theClass, object, property, false, false); }
java
public Object getProperty(Object object, String property) { return getProperty(theClass, object, property, false, false); }
[ "public", "Object", "getProperty", "(", "Object", "object", ",", "String", "property", ")", "{", "return", "getProperty", "(", "theClass", ",", "object", ",", "property", ",", "false", ",", "false", ")", ";", "}" ]
<p>Retrieves a property on the given object for the specified arguments. @param object The Object which the property is being retrieved from @param property The name of the property @return The properties value
[ "<p", ">", "Retrieves", "a", "property", "on", "the", "given", "object", "for", "the", "specified", "arguments", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaClassImpl.java#L3857-L3859
tzaeschke/zoodb
src/org/zoodb/internal/server/index/LLIndexPage.java
LLIndexPage.locatePageForKey
public LLIndexPage locatePageForKey(long key, long value, boolean allowCreate) { if (isLeaf) { return this; } if (nEntries == -1 && !allowCreate) { return null; } //The stored value[i] is the min-values of the according page[i+1} int pos = binarySearch(0, nEntries, key, value); if (pos >= 0) { //pos of matching key pos++; } else { pos = -(pos+1); } //TODO use weak refs //read page before that value LLIndexPage page = (LLIndexPage) readOrCreatePage(pos, allowCreate); return page.locatePageForKey(key, value, allowCreate); }
java
public LLIndexPage locatePageForKey(long key, long value, boolean allowCreate) { if (isLeaf) { return this; } if (nEntries == -1 && !allowCreate) { return null; } //The stored value[i] is the min-values of the according page[i+1} int pos = binarySearch(0, nEntries, key, value); if (pos >= 0) { //pos of matching key pos++; } else { pos = -(pos+1); } //TODO use weak refs //read page before that value LLIndexPage page = (LLIndexPage) readOrCreatePage(pos, allowCreate); return page.locatePageForKey(key, value, allowCreate); }
[ "public", "LLIndexPage", "locatePageForKey", "(", "long", "key", ",", "long", "value", ",", "boolean", "allowCreate", ")", "{", "if", "(", "isLeaf", ")", "{", "return", "this", ";", "}", "if", "(", "nEntries", "==", "-", "1", "&&", "!", "allowCreate", ...
Locate the (first) page that could contain the given key. In the inner pages, the keys are the minimum values of the sub-page. The value is the according minimum value of the first key of the sub-page. @param key @return Page for that key
[ "Locate", "the", "(", "first", ")", "page", "that", "could", "contain", "the", "given", "key", ".", "In", "the", "inner", "pages", "the", "keys", "are", "the", "minimum", "values", "of", "the", "sub", "-", "page", ".", "The", "value", "is", "the", "a...
train
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/index/LLIndexPage.java#L177-L197
janus-project/guava.janusproject.io
guava/src/com/google/common/util/concurrent/MoreExecutors.java
MoreExecutors.newThread
static Thread newThread(String name, Runnable runnable) { checkNotNull(name); checkNotNull(runnable); Thread result = platformThreadFactory().newThread(runnable); try { result.setName(name); } catch (SecurityException e) { // OK if we can't set the name in this environment. } return result; }
java
static Thread newThread(String name, Runnable runnable) { checkNotNull(name); checkNotNull(runnable); Thread result = platformThreadFactory().newThread(runnable); try { result.setName(name); } catch (SecurityException e) { // OK if we can't set the name in this environment. } return result; }
[ "static", "Thread", "newThread", "(", "String", "name", ",", "Runnable", "runnable", ")", "{", "checkNotNull", "(", "name", ")", ";", "checkNotNull", "(", "runnable", ")", ";", "Thread", "result", "=", "platformThreadFactory", "(", ")", ".", "newThread", "("...
Creates a thread using {@link #platformThreadFactory}, and sets its name to {@code name} unless changing the name is forbidden by the security manager.
[ "Creates", "a", "thread", "using", "{" ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/util/concurrent/MoreExecutors.java#L813-L823
infinispan/infinispan
server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/AddAliasCommand.java
AddAliasCommand.addNewAliasToList
private ModelNode addNewAliasToList(ModelNode list, String alias) { // check for empty string if (alias == null || alias.equals("")) return list ; // check for undefined list (AS7-3476) if (!list.isDefined()) { list.setEmptyList(); } ModelNode newList = list.clone() ; List<ModelNode> listElements = list.asList(); boolean found = false; for (ModelNode listElement : listElements) { if (listElement.asString().equals(alias)) { found = true; } } if (!found) { newList.add().set(alias); } return newList ; }
java
private ModelNode addNewAliasToList(ModelNode list, String alias) { // check for empty string if (alias == null || alias.equals("")) return list ; // check for undefined list (AS7-3476) if (!list.isDefined()) { list.setEmptyList(); } ModelNode newList = list.clone() ; List<ModelNode> listElements = list.asList(); boolean found = false; for (ModelNode listElement : listElements) { if (listElement.asString().equals(alias)) { found = true; } } if (!found) { newList.add().set(alias); } return newList ; }
[ "private", "ModelNode", "addNewAliasToList", "(", "ModelNode", "list", ",", "String", "alias", ")", "{", "// check for empty string", "if", "(", "alias", "==", "null", "||", "alias", ".", "equals", "(", "\"\"", ")", ")", "return", "list", ";", "// check for un...
Adds new alias to a LIST ModelNode of existing aliases. @param list LIST ModelNode of aliases @param alias @return LIST ModelNode with the added aliases
[ "Adds", "new", "alias", "to", "a", "LIST", "ModelNode", "of", "existing", "aliases", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/AddAliasCommand.java#L97-L121
imsweb/naaccr-xml
src/main/java/com/imsweb/naaccrxml/PatientXmlReader.java
PatientXmlReader.convertSyntaxException
private NaaccrIOException convertSyntaxException(ConversionException ex) { String msg = ex.get("message"); // reading a file that has bad tags is very common, so let's try to get a better error message in that case: if (CannotResolveClassException.class.getName().equals(ex.get("cause-exception"))) msg = "invalid tag: " + ex.get("cause-message"); else if (StreamException.class.getName().equals(ex.get("cause-exception"))) msg = "invalid XML syntax"; if (msg == null) msg = ex.getMessage(); NaaccrIOException e = new NaaccrIOException(msg, ex); if (ex.get("line number") != null) e.setLineNumber(Integer.valueOf(ex.get("line number"))); e.setPath(ex.get("path")); return e; }
java
private NaaccrIOException convertSyntaxException(ConversionException ex) { String msg = ex.get("message"); // reading a file that has bad tags is very common, so let's try to get a better error message in that case: if (CannotResolveClassException.class.getName().equals(ex.get("cause-exception"))) msg = "invalid tag: " + ex.get("cause-message"); else if (StreamException.class.getName().equals(ex.get("cause-exception"))) msg = "invalid XML syntax"; if (msg == null) msg = ex.getMessage(); NaaccrIOException e = new NaaccrIOException(msg, ex); if (ex.get("line number") != null) e.setLineNumber(Integer.valueOf(ex.get("line number"))); e.setPath(ex.get("path")); return e; }
[ "private", "NaaccrIOException", "convertSyntaxException", "(", "ConversionException", "ex", ")", "{", "String", "msg", "=", "ex", ".", "get", "(", "\"message\"", ")", ";", "// reading a file that has bad tags is very common, so let's try to get a better error message in that case...
We don't want to expose the conversion exceptions, so let's translate them into our own exception...
[ "We", "don", "t", "want", "to", "expose", "the", "conversion", "exceptions", "so", "let", "s", "translate", "them", "into", "our", "own", "exception", "..." ]
train
https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/PatientXmlReader.java#L413-L430
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByPrimaryCustomIndex
public Iterable<DContact> queryByPrimaryCustomIndex(Object parent, java.lang.String primaryCustomIndex) { return queryByField(parent, DContactMapper.Field.PRIMARYCUSTOMINDEX.getFieldName(), primaryCustomIndex); }
java
public Iterable<DContact> queryByPrimaryCustomIndex(Object parent, java.lang.String primaryCustomIndex) { return queryByField(parent, DContactMapper.Field.PRIMARYCUSTOMINDEX.getFieldName(), primaryCustomIndex); }
[ "public", "Iterable", "<", "DContact", ">", "queryByPrimaryCustomIndex", "(", "Object", "parent", ",", "java", ".", "lang", ".", "String", "primaryCustomIndex", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "PRIMARY...
query-by method for field primaryCustomIndex @param primaryCustomIndex the specified attribute @return an Iterable of DContacts for the specified primaryCustomIndex
[ "query", "-", "by", "method", "for", "field", "primaryCustomIndex" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L250-L252
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java
LiveEventsInner.beginResetAsync
public Observable<Void> beginResetAsync(String resourceGroupName, String accountName, String liveEventName) { return beginResetWithServiceResponseAsync(resourceGroupName, accountName, liveEventName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginResetAsync(String resourceGroupName, String accountName, String liveEventName) { return beginResetWithServiceResponseAsync(resourceGroupName, accountName, liveEventName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginResetAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "liveEventName", ")", "{", "return", "beginResetWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", ...
Reset Live Event. Resets an existing Live Event. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param liveEventName The name of the Live Event. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Reset", "Live", "Event", ".", "Resets", "an", "existing", "Live", "Event", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java#L1763-L1770
google/flogger
api/src/main/java/com/google/common/flogger/LogSite.java
LogSite.injectedLogSite
@Deprecated public static LogSite injectedLogSite( String internalClassName, String methodName, int encodedLineNumber, @Nullable String sourceFileName) { return new InjectedLogSite(internalClassName, methodName, encodedLineNumber, sourceFileName); }
java
@Deprecated public static LogSite injectedLogSite( String internalClassName, String methodName, int encodedLineNumber, @Nullable String sourceFileName) { return new InjectedLogSite(internalClassName, methodName, encodedLineNumber, sourceFileName); }
[ "@", "Deprecated", "public", "static", "LogSite", "injectedLogSite", "(", "String", "internalClassName", ",", "String", "methodName", ",", "int", "encodedLineNumber", ",", "@", "Nullable", "String", "sourceFileName", ")", "{", "return", "new", "InjectedLogSite", "("...
Creates a log site injected from constants held a class' constant pool. <p> Used for compile-time log site injection, and by the agent. @param internalClassName Slash separated class name obtained from the class constant pool. @param methodName Method name obtained from the class constant pool. @param encodedLineNumber line number and per-line log statement index encoded as a single 32-bit value. The low 16-bits is the line number (0 to 0xFFFF inclusive) and the high 16 bits is a log statement index to distinguish multiple statements on the same line (this becomes important if line numbers are stripped from the class file and everything appears to be on the same line). @param sourceFileName Optional base name of the source file (this value is strictly for debugging and does not contribute to either equals() or hashCode() behavior). @deprecated this method is only be used for log-site injection and should not be called directly.
[ "Creates", "a", "log", "site", "injected", "from", "constants", "held", "a", "class", "constant", "pool", ".", "<p", ">", "Used", "for", "compile", "-", "time", "log", "site", "injection", "and", "by", "the", "agent", "." ]
train
https://github.com/google/flogger/blob/a164967a93a9f4ce92f34319fc0cc7c91a57321c/api/src/main/java/com/google/common/flogger/LogSite.java#L142-L149
scaleset/scaleset-geo
src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java
GoogleMapsTileMath.lngLatToMeters
public Geometry lngLatToMeters(Geometry geometry) { GeometryTransformer transformer = new GeometryTransformer() { @Override protected CoordinateSequence transformCoordinates(CoordinateSequence coords, Geometry parent) { Coordinate[] newCoords = new Coordinate[coords.size()]; for (int i = 0; i < coords.size(); ++i) { Coordinate coord = coords.getCoordinate(i); newCoords[i] = lngLatToMeters(coord); } return new CoordinateArraySequence(newCoords); } }; Geometry result = transformer.transform(geometry); return result; }
java
public Geometry lngLatToMeters(Geometry geometry) { GeometryTransformer transformer = new GeometryTransformer() { @Override protected CoordinateSequence transformCoordinates(CoordinateSequence coords, Geometry parent) { Coordinate[] newCoords = new Coordinate[coords.size()]; for (int i = 0; i < coords.size(); ++i) { Coordinate coord = coords.getCoordinate(i); newCoords[i] = lngLatToMeters(coord); } return new CoordinateArraySequence(newCoords); } }; Geometry result = transformer.transform(geometry); return result; }
[ "public", "Geometry", "lngLatToMeters", "(", "Geometry", "geometry", ")", "{", "GeometryTransformer", "transformer", "=", "new", "GeometryTransformer", "(", ")", "{", "@", "Override", "protected", "CoordinateSequence", "transformCoordinates", "(", "CoordinateSequence", ...
Converts geometry from lat/lon (EPSG:4326)) to Spherical Mercator (EPSG:3857) @param geometry the geometry to convert @return the geometry transformed to EPSG:3857
[ "Converts", "geometry", "from", "lat", "/", "lon", "(", "EPSG", ":", "4326", "))", "to", "Spherical", "Mercator", "(", "EPSG", ":", "3857", ")" ]
train
https://github.com/scaleset/scaleset-geo/blob/5cff2349668037dc287928a6c1a1f67c76d96b02/src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java#L109-L123
lightblue-platform/lightblue-migrator
jiff/src/main/java/jcmp/DocCompare.java
DocCompare.compareObjects
public Difference<BaseType> compareObjects(List<String> field1, ObjectType node1, List<String> field2, ObjectType node2) throws InvalidArrayIdentity, DuplicateArrayIdentity { Difference<BaseType> ret = new Difference<>(); // Field by field comparison of obj1 to obj2. for (Iterator<Map.Entry<String, BaseType>> fields = getFields(node1); fields.hasNext();) { Map.Entry<String, BaseType> field = fields.next(); String fieldName = field.getKey(); field1.add(fieldName); BaseType value1 = field.getValue(); if (hasField(node2, fieldName)) { // If both obj1 and obj2 have the same field, compare recursively field2.add(fieldName); BaseType value2 = getField(node2, fieldName); ret.add(compareNodes(field1, value1, field2, value2)); pop(field2); } else { // obj1.field1 exists, obj2.field1 does not, so it is removed ret.add(new Removal(field1, value1)); } pop(field1); } // Now compare any new nodes added to obj2 for (Iterator<Map.Entry<String, BaseType>> fields = getFields(node2); fields.hasNext();) { Map.Entry<String, BaseType> field = fields.next(); String fieldName = field.getKey(); if (!hasField(node1, fieldName)) { field2.add(fieldName); ret.add(new Addition(field2, field.getValue())); pop(field2); } } return ret; }
java
public Difference<BaseType> compareObjects(List<String> field1, ObjectType node1, List<String> field2, ObjectType node2) throws InvalidArrayIdentity, DuplicateArrayIdentity { Difference<BaseType> ret = new Difference<>(); // Field by field comparison of obj1 to obj2. for (Iterator<Map.Entry<String, BaseType>> fields = getFields(node1); fields.hasNext();) { Map.Entry<String, BaseType> field = fields.next(); String fieldName = field.getKey(); field1.add(fieldName); BaseType value1 = field.getValue(); if (hasField(node2, fieldName)) { // If both obj1 and obj2 have the same field, compare recursively field2.add(fieldName); BaseType value2 = getField(node2, fieldName); ret.add(compareNodes(field1, value1, field2, value2)); pop(field2); } else { // obj1.field1 exists, obj2.field1 does not, so it is removed ret.add(new Removal(field1, value1)); } pop(field1); } // Now compare any new nodes added to obj2 for (Iterator<Map.Entry<String, BaseType>> fields = getFields(node2); fields.hasNext();) { Map.Entry<String, BaseType> field = fields.next(); String fieldName = field.getKey(); if (!hasField(node1, fieldName)) { field2.add(fieldName); ret.add(new Addition(field2, field.getValue())); pop(field2); } } return ret; }
[ "public", "Difference", "<", "BaseType", ">", "compareObjects", "(", "List", "<", "String", ">", "field1", ",", "ObjectType", "node1", ",", "List", "<", "String", ">", "field2", ",", "ObjectType", "node2", ")", "throws", "InvalidArrayIdentity", ",", "Duplicate...
Compares two object nodes recursively and returns the differences
[ "Compares", "two", "object", "nodes", "recursively", "and", "returns", "the", "differences" ]
train
https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/jiff/src/main/java/jcmp/DocCompare.java#L498-L534
Impetus/Kundera
src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java
HibernateClient.instantiateEntity
private Object instantiateEntity(Class entityClass, Object entity) { try { if (entity == null) { return entityClass.newInstance(); } return entity; } catch (InstantiationException e) { log.error("Error while instantiating " + entityClass + ", Caused by: ", e); } catch (IllegalAccessException e) { log.error("Error while instantiating " + entityClass + ", Caused by: ", e); } return null; }
java
private Object instantiateEntity(Class entityClass, Object entity) { try { if (entity == null) { return entityClass.newInstance(); } return entity; } catch (InstantiationException e) { log.error("Error while instantiating " + entityClass + ", Caused by: ", e); } catch (IllegalAccessException e) { log.error("Error while instantiating " + entityClass + ", Caused by: ", e); } return null; }
[ "private", "Object", "instantiateEntity", "(", "Class", "entityClass", ",", "Object", "entity", ")", "{", "try", "{", "if", "(", "entity", "==", "null", ")", "{", "return", "entityClass", ".", "newInstance", "(", ")", ";", "}", "return", "entity", ";", "...
Instantiate entity. @param entityClass the entity class @param entity the entity @return the object
[ "Instantiate", "entity", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java#L941-L960
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/transform/ChainedTransformationTools.java
ChainedTransformationTools.nextInChainOperation
public static ResourceTransformationContext nextInChainOperation(ResourceTransformationContext context, PlaceholderResolver placeholderResolver) { assert context instanceof ResourceTransformationContextImpl : "Wrong type of context"; ResourceTransformationContextImpl ctx = (ResourceTransformationContextImpl)context; ResourceTransformationContext copy = ctx.copy(placeholderResolver); return copy; }
java
public static ResourceTransformationContext nextInChainOperation(ResourceTransformationContext context, PlaceholderResolver placeholderResolver) { assert context instanceof ResourceTransformationContextImpl : "Wrong type of context"; ResourceTransformationContextImpl ctx = (ResourceTransformationContextImpl)context; ResourceTransformationContext copy = ctx.copy(placeholderResolver); return copy; }
[ "public", "static", "ResourceTransformationContext", "nextInChainOperation", "(", "ResourceTransformationContext", "context", ",", "PlaceholderResolver", "placeholderResolver", ")", "{", "assert", "context", "instanceof", "ResourceTransformationContextImpl", ":", "\"Wrong type of c...
Call when transforming a new model version delta for an operation. This will copy the {@link ResourceTransformationContext} instance, using the extra resolver to resolve the children of the placeholder resource. @param context the context to copy. It should be at a chained placeholder @param placeholderResolver the extra resolver to use to resolve the placeholder's children for the model version delta we are transforming @return a new {@code ResourceTransformationContext} instance using the extra resolver
[ "Call", "when", "transforming", "a", "new", "model", "version", "delta", "for", "an", "operation", ".", "This", "will", "copy", "the", "{", "@link", "ResourceTransformationContext", "}", "instance", "using", "the", "extra", "resolver", "to", "resolve", "the", ...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/ChainedTransformationTools.java#L75-L81
sarxos/v4l4j
src/main/java/au/edu/jcu/v4l4j/ImageFormatList.java
ImageFormatList.moveToFirst
private void moveToFirst(List<ImageFormat> v, int format){ for(ImageFormat i : v) if(i.getIndex()==format){ v.remove(i); v.add(0, i); break; } }
java
private void moveToFirst(List<ImageFormat> v, int format){ for(ImageFormat i : v) if(i.getIndex()==format){ v.remove(i); v.add(0, i); break; } }
[ "private", "void", "moveToFirst", "(", "List", "<", "ImageFormat", ">", "v", ",", "int", "format", ")", "{", "for", "(", "ImageFormat", "i", ":", "v", ")", "if", "(", "i", ".", "getIndex", "(", ")", "==", "format", ")", "{", "v", ".", "remove", "...
This method moves the given image format <code>format</code> in the first position of the vector. @param v the vector if image format @param format the index of the format to be moved in first position
[ "This", "method", "moves", "the", "given", "image", "format", "<code", ">", "format<", "/", "code", ">", "in", "the", "first", "position", "of", "the", "vector", "." ]
train
https://github.com/sarxos/v4l4j/blob/4fc0eec2c3a1a4260593f6ac03b7a8013e3804c9/src/main/java/au/edu/jcu/v4l4j/ImageFormatList.java#L177-L184
overturetool/overture
ide/ui/src/main/java/org/overture/ide/ui/commands/ToggleComment.java
ToggleComment.getFirstCompleteLineOfRegion
private int getFirstCompleteLineOfRegion(IRegion region, IDocument document) { try { int startLine= document.getLineOfOffset(region.getOffset()); int offset= document.getLineOffset(startLine); if (offset >= region.getOffset()) return startLine; offset= document.getLineOffset(startLine + 1); return (offset > region.getOffset() + region.getLength() ? -1 : startLine + 1); } catch (BadLocationException x) { // should not happen VdmUIPlugin.log(x); } return -1; }
java
private int getFirstCompleteLineOfRegion(IRegion region, IDocument document) { try { int startLine= document.getLineOfOffset(region.getOffset()); int offset= document.getLineOffset(startLine); if (offset >= region.getOffset()) return startLine; offset= document.getLineOffset(startLine + 1); return (offset > region.getOffset() + region.getLength() ? -1 : startLine + 1); } catch (BadLocationException x) { // should not happen VdmUIPlugin.log(x); } return -1; }
[ "private", "int", "getFirstCompleteLineOfRegion", "(", "IRegion", "region", ",", "IDocument", "document", ")", "{", "try", "{", "int", "startLine", "=", "document", ".", "getLineOfOffset", "(", "region", ".", "getOffset", "(", ")", ")", ";", "int", "offset", ...
Returns the index of the first line whose start offset is in the given text range. @param region the text range in characters where to find the line @param document The document @return the first line whose start index is in the given range, -1 if there is no such line
[ "Returns", "the", "index", "of", "the", "first", "line", "whose", "start", "offset", "is", "in", "the", "given", "text", "range", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/ui/src/main/java/org/overture/ide/ui/commands/ToggleComment.java#L221-L240
windup/windup
config-xml/addon/src/main/java/org/jboss/windup/config/parser/xml/RuleHandler.java
RuleHandler.processRuleElement
public static void processRuleElement(ParserContext context, ConfigurationRuleBuilder rule, Element element) { String id = $(element).attr("id"); List<Element> children = $(element).children().get(); for (Element child : children) { Object result = context.processElement(child); switch ($(child).tag()) { case "when": rule.when(((Condition) result)); break; case "perform": rule.perform(((Operation) result)); break; case "otherwise": rule.otherwise(((Operation) result)); break; case "where": break; } } if (StringUtils.isNotBlank(id)) { rule.withId(id); } }
java
public static void processRuleElement(ParserContext context, ConfigurationRuleBuilder rule, Element element) { String id = $(element).attr("id"); List<Element> children = $(element).children().get(); for (Element child : children) { Object result = context.processElement(child); switch ($(child).tag()) { case "when": rule.when(((Condition) result)); break; case "perform": rule.perform(((Operation) result)); break; case "otherwise": rule.otherwise(((Operation) result)); break; case "where": break; } } if (StringUtils.isNotBlank(id)) { rule.withId(id); } }
[ "public", "static", "void", "processRuleElement", "(", "ParserContext", "context", ",", "ConfigurationRuleBuilder", "rule", ",", "Element", "element", ")", "{", "String", "id", "=", "$", "(", "element", ")", ".", "attr", "(", "\"id\"", ")", ";", "List", "<",...
Processes all of the elements within a rule and attaches this data to the passed in rule. For example, this will process all of the "when", "perform", and "otherwise" elements.
[ "Processes", "all", "of", "the", "elements", "within", "a", "rule", "and", "attaches", "this", "data", "to", "the", "passed", "in", "rule", ".", "For", "example", "this", "will", "process", "all", "of", "the", "when", "perform", "and", "otherwise", "elemen...
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config-xml/addon/src/main/java/org/jboss/windup/config/parser/xml/RuleHandler.java#L38-L71
davetcc/tcMenu
tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/model/CodeVariableBuilder.java
CodeVariableBuilder.paramFromPropertyWithDefault
public CodeVariableBuilder paramFromPropertyWithDefault(String property, String defVal) { params.add(new PropertyWithDefaultParameter(property, defVal)); return this; }
java
public CodeVariableBuilder paramFromPropertyWithDefault(String property, String defVal) { params.add(new PropertyWithDefaultParameter(property, defVal)); return this; }
[ "public", "CodeVariableBuilder", "paramFromPropertyWithDefault", "(", "String", "property", ",", "String", "defVal", ")", "{", "params", ".", "add", "(", "new", "PropertyWithDefaultParameter", "(", "property", ",", "defVal", ")", ")", ";", "return", "this", ";", ...
This parameter will be based on the value of a property, if the property is empty or missing then the replacement default will be used. @param property the property to lookup @param defVal the default if the above is blank @return this for chaining.
[ "This", "parameter", "will", "be", "based", "on", "the", "value", "of", "a", "property", "if", "the", "property", "is", "empty", "or", "missing", "then", "the", "replacement", "default", "will", "be", "used", "." ]
train
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/model/CodeVariableBuilder.java#L116-L119
alexholmes/htuple
examples/src/main/java/org/htuple/examples/SecondarySort.java
SecondarySort.writeInput
public static void writeInput(Configuration conf, Path inputDir) throws IOException { FileSystem fs = FileSystem.get(conf); if (fs.exists(inputDir)) { throw new IOException(String.format("Input directory '%s' exists - please remove and rerun this example", inputDir)); } OutputStreamWriter writer = new OutputStreamWriter(fs.create(new Path(inputDir, "input.txt"))); for (String name : EXAMPLE_NAMES) { writer.write(name); } IOUtils.closeStream(writer); }
java
public static void writeInput(Configuration conf, Path inputDir) throws IOException { FileSystem fs = FileSystem.get(conf); if (fs.exists(inputDir)) { throw new IOException(String.format("Input directory '%s' exists - please remove and rerun this example", inputDir)); } OutputStreamWriter writer = new OutputStreamWriter(fs.create(new Path(inputDir, "input.txt"))); for (String name : EXAMPLE_NAMES) { writer.write(name); } IOUtils.closeStream(writer); }
[ "public", "static", "void", "writeInput", "(", "Configuration", "conf", ",", "Path", "inputDir", ")", "throws", "IOException", "{", "FileSystem", "fs", "=", "FileSystem", ".", "get", "(", "conf", ")", ";", "if", "(", "fs", ".", "exists", "(", "inputDir", ...
Writes the contents of {@link #EXAMPLE_NAMES} into a file in the job input directory in HDFS. @param conf the Hadoop config @param inputDir the HDFS input directory where we'll write a file @throws IOException if something goes wrong
[ "Writes", "the", "contents", "of", "{", "@link", "#EXAMPLE_NAMES", "}", "into", "a", "file", "in", "the", "job", "input", "directory", "in", "HDFS", "." ]
train
https://github.com/alexholmes/htuple/blob/5aba63f78a4a9bb505ad3de0a5b0b392724644c4/examples/src/main/java/org/htuple/examples/SecondarySort.java#L78-L90
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java
ContextItems.lookupItemName
private String lookupItemName(String itemName, String suffix, boolean autoAdd) { return lookupItemName(itemName + "." + suffix, autoAdd); }
java
private String lookupItemName(String itemName, String suffix, boolean autoAdd) { return lookupItemName(itemName + "." + suffix, autoAdd); }
[ "private", "String", "lookupItemName", "(", "String", "itemName", ",", "String", "suffix", ",", "boolean", "autoAdd", ")", "{", "return", "lookupItemName", "(", "itemName", "+", "\".\"", "+", "suffix", ",", "autoAdd", ")", ";", "}" ]
Performs a case-insensitive lookup of the item name + suffix in the index. @param itemName Item name @param suffix Item suffix @param autoAdd If true and item name not in index, add it. @return Item name with suffix as stored internally
[ "Performs", "a", "case", "-", "insensitive", "lookup", "of", "the", "item", "name", "+", "suffix", "in", "the", "index", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L85-L87
apache/groovy
src/main/groovy/groovy/ui/GroovyMain.java
GroovyMain.processReader
private void processReader(Script s, BufferedReader reader, PrintWriter pw) throws IOException { String line; String lineCountName = "count"; s.setProperty(lineCountName, BigInteger.ZERO); String autoSplitName = "split"; s.setProperty("out", pw); try { InvokerHelper.invokeMethod(s, "begin", null); } catch (MissingMethodException mme) { // ignore the missing method exception // as it means no begin() method is present } while ((line = reader.readLine()) != null) { s.setProperty("line", line); s.setProperty(lineCountName, ((BigInteger)s.getProperty(lineCountName)).add(BigInteger.ONE)); if(autoSplit) { s.setProperty(autoSplitName, line.split(splitPattern)); } Object o = s.run(); if (autoOutput && o != null) { pw.println(o); } } try { InvokerHelper.invokeMethod(s, "end", null); } catch (MissingMethodException mme) { // ignore the missing method exception // as it means no end() method is present } }
java
private void processReader(Script s, BufferedReader reader, PrintWriter pw) throws IOException { String line; String lineCountName = "count"; s.setProperty(lineCountName, BigInteger.ZERO); String autoSplitName = "split"; s.setProperty("out", pw); try { InvokerHelper.invokeMethod(s, "begin", null); } catch (MissingMethodException mme) { // ignore the missing method exception // as it means no begin() method is present } while ((line = reader.readLine()) != null) { s.setProperty("line", line); s.setProperty(lineCountName, ((BigInteger)s.getProperty(lineCountName)).add(BigInteger.ONE)); if(autoSplit) { s.setProperty(autoSplitName, line.split(splitPattern)); } Object o = s.run(); if (autoOutput && o != null) { pw.println(o); } } try { InvokerHelper.invokeMethod(s, "end", null); } catch (MissingMethodException mme) { // ignore the missing method exception // as it means no end() method is present } }
[ "private", "void", "processReader", "(", "Script", "s", ",", "BufferedReader", "reader", ",", "PrintWriter", "pw", ")", "throws", "IOException", "{", "String", "line", ";", "String", "lineCountName", "=", "\"count\"", ";", "s", ".", "setProperty", "(", "lineCo...
Process a script against a single input file. @param s script to execute. @param reader input file. @param pw output sink.
[ "Process", "a", "script", "against", "a", "single", "input", "file", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/ui/GroovyMain.java#L549-L584
lightblue-platform/lightblue-migrator
facade/src/main/java/com/redhat/lightblue/migrator/facade/TimeoutConfiguration.java
TimeoutConfiguration.getSlowWarningMS
public long getSlowWarningMS(String methodName, FacadeOperation op) { return getMS(methodName, op, Type.slowwarning); }
java
public long getSlowWarningMS(String methodName, FacadeOperation op) { return getMS(methodName, op, Type.slowwarning); }
[ "public", "long", "getSlowWarningMS", "(", "String", "methodName", ",", "FacadeOperation", "op", ")", "{", "return", "getMS", "(", "methodName", ",", "op", ",", "Type", ".", "slowwarning", ")", ";", "}" ]
See ${link {@link TimeoutConfiguration#getMS(String, FacadeOperation, Type)} @param methodName @param op @return
[ "See", "$", "{", "link", "{", "@link", "TimeoutConfiguration#getMS", "(", "String", "FacadeOperation", "Type", ")", "}" ]
train
https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/facade/src/main/java/com/redhat/lightblue/migrator/facade/TimeoutConfiguration.java#L181-L183
wellner/jcarafe
jcarafe-core/src/main/java/cern/colt/list/DoubleArrayList.java
DoubleArrayList.partFromTo
public AbstractDoubleList partFromTo(int from, int to) { if (size==0) return new DoubleArrayList(0); checkRangeFromTo(from, to, size); double[] part = new double[to-from+1]; System.arraycopy(elements, from, part, 0, to-from+1); return new DoubleArrayList(part); }
java
public AbstractDoubleList partFromTo(int from, int to) { if (size==0) return new DoubleArrayList(0); checkRangeFromTo(from, to, size); double[] part = new double[to-from+1]; System.arraycopy(elements, from, part, 0, to-from+1); return new DoubleArrayList(part); }
[ "public", "AbstractDoubleList", "partFromTo", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "size", "==", "0", ")", "return", "new", "DoubleArrayList", "(", "0", ")", ";", "checkRangeFromTo", "(", "from", ",", "to", ",", "size", ")", ";", ...
Returns a new list of the part of the receiver between <code>from</code>, inclusive, and <code>to</code>, inclusive. @param from the index of the first element (inclusive). @param to the index of the last element (inclusive). @return a new list @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
[ "Returns", "a", "new", "list", "of", "the", "part", "of", "the", "receiver", "between", "<code", ">", "from<", "/", "code", ">", "inclusive", "and", "<code", ">", "to<", "/", "code", ">", "inclusive", "." ]
train
https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/DoubleArrayList.java#L279-L287
h2oai/h2o-3
h2o-core/src/main/java/water/ExternalFrameWriterBackend.java
ExternalFrameWriterBackend.handleWriteToChunk
static void handleWriteToChunk(ByteChannel sock, AutoBuffer ab) throws IOException { String frameKey = ab.getStr(); byte[] expectedTypes = ab.getA1(); if( expectedTypes == null){ throw new RuntimeException("Expected types can't be null."); } int[] maxVecSizes = ab.getA4(); int[] elemSizes = ExternalFrameUtils.getElemSizes(expectedTypes, maxVecSizes != null ? maxVecSizes : EMPTY_ARI); int[] startPos = ExternalFrameUtils.getStartPositions(elemSizes); byte[] vecTypes = vecTypesFromExpectedTypes(expectedTypes, maxVecSizes != null ? maxVecSizes : EMPTY_ARI); int expectedNumRows = ab.getInt(); int currentRowIdx = 0; int chunk_id = ab.getInt(); NewChunk[] nchnk = ChunkUtils.createNewChunks(frameKey, vecTypes, chunk_id); assert nchnk != null; while (currentRowIdx < expectedNumRows) { for(int typeIdx = 0; typeIdx < expectedTypes.length; typeIdx++){ switch (expectedTypes[typeIdx]) { case EXPECTED_BOOL: // fall through to byte since BOOL is internally stored in frame as number (byte) case EXPECTED_BYTE: store(ab, nchnk[startPos[typeIdx]], ab.get1()); break; case EXPECTED_CHAR: store(ab, nchnk[startPos[typeIdx]], ab.get2()); break; case EXPECTED_SHORT: store(ab, nchnk[startPos[typeIdx]], ab.get2s()); break; case EXPECTED_INT: store(ab, nchnk[startPos[typeIdx]], ab.getInt()); break; case EXPECTED_TIMESTAMP: // fall through to long since TIMESTAMP is internally stored in frame as long case EXPECTED_LONG: store(ab, nchnk[startPos[typeIdx]], ab.get8()); break; case EXPECTED_FLOAT: store(nchnk[startPos[typeIdx]], ab.get4f()); break; case EXPECTED_DOUBLE: store(nchnk[startPos[typeIdx]], ab.get8d()); break; case EXPECTED_STRING: store(ab, nchnk[startPos[typeIdx]], ab.getStr()); break; case EXPECTED_VECTOR: storeVector(ab, nchnk, elemSizes[typeIdx], startPos[typeIdx]); break; default: throw new IllegalArgumentException("Unknown expected type: " + expectedTypes[typeIdx]); } } currentRowIdx++; } // close chunks at the end ChunkUtils.closeNewChunks(nchnk); // Flag informing sender that all work is done and // chunks are ready to be finalized. // // This also needs to be sent because in the sender we have to // wait for all chunks to be written to DKV; otherwise we get race during finalizing and // it happens that we try to finalize frame with chunks not ready yet AutoBuffer outputAb = new AutoBuffer(); outputAb.put1(ExternalFrameHandler.CONFIRM_WRITING_DONE); writeToChannel(outputAb, sock); }
java
static void handleWriteToChunk(ByteChannel sock, AutoBuffer ab) throws IOException { String frameKey = ab.getStr(); byte[] expectedTypes = ab.getA1(); if( expectedTypes == null){ throw new RuntimeException("Expected types can't be null."); } int[] maxVecSizes = ab.getA4(); int[] elemSizes = ExternalFrameUtils.getElemSizes(expectedTypes, maxVecSizes != null ? maxVecSizes : EMPTY_ARI); int[] startPos = ExternalFrameUtils.getStartPositions(elemSizes); byte[] vecTypes = vecTypesFromExpectedTypes(expectedTypes, maxVecSizes != null ? maxVecSizes : EMPTY_ARI); int expectedNumRows = ab.getInt(); int currentRowIdx = 0; int chunk_id = ab.getInt(); NewChunk[] nchnk = ChunkUtils.createNewChunks(frameKey, vecTypes, chunk_id); assert nchnk != null; while (currentRowIdx < expectedNumRows) { for(int typeIdx = 0; typeIdx < expectedTypes.length; typeIdx++){ switch (expectedTypes[typeIdx]) { case EXPECTED_BOOL: // fall through to byte since BOOL is internally stored in frame as number (byte) case EXPECTED_BYTE: store(ab, nchnk[startPos[typeIdx]], ab.get1()); break; case EXPECTED_CHAR: store(ab, nchnk[startPos[typeIdx]], ab.get2()); break; case EXPECTED_SHORT: store(ab, nchnk[startPos[typeIdx]], ab.get2s()); break; case EXPECTED_INT: store(ab, nchnk[startPos[typeIdx]], ab.getInt()); break; case EXPECTED_TIMESTAMP: // fall through to long since TIMESTAMP is internally stored in frame as long case EXPECTED_LONG: store(ab, nchnk[startPos[typeIdx]], ab.get8()); break; case EXPECTED_FLOAT: store(nchnk[startPos[typeIdx]], ab.get4f()); break; case EXPECTED_DOUBLE: store(nchnk[startPos[typeIdx]], ab.get8d()); break; case EXPECTED_STRING: store(ab, nchnk[startPos[typeIdx]], ab.getStr()); break; case EXPECTED_VECTOR: storeVector(ab, nchnk, elemSizes[typeIdx], startPos[typeIdx]); break; default: throw new IllegalArgumentException("Unknown expected type: " + expectedTypes[typeIdx]); } } currentRowIdx++; } // close chunks at the end ChunkUtils.closeNewChunks(nchnk); // Flag informing sender that all work is done and // chunks are ready to be finalized. // // This also needs to be sent because in the sender we have to // wait for all chunks to be written to DKV; otherwise we get race during finalizing and // it happens that we try to finalize frame with chunks not ready yet AutoBuffer outputAb = new AutoBuffer(); outputAb.put1(ExternalFrameHandler.CONFIRM_WRITING_DONE); writeToChannel(outputAb, sock); }
[ "static", "void", "handleWriteToChunk", "(", "ByteChannel", "sock", ",", "AutoBuffer", "ab", ")", "throws", "IOException", "{", "String", "frameKey", "=", "ab", ".", "getStr", "(", ")", ";", "byte", "[", "]", "expectedTypes", "=", "ab", ".", "getA1", "(", ...
Internal method use on the h2o backend side to handle writing to the chunk from non-h2o environment @param sock socket channel originating from non-h2o node @param ab {@link AutoBuffer} containing information necessary for preparing backend for writing
[ "Internal", "method", "use", "on", "the", "h2o", "backend", "side", "to", "handle", "writing", "to", "the", "chunk", "from", "non", "-", "h2o", "environment" ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/ExternalFrameWriterBackend.java#L20-L86
JodaOrg/joda-convert
src/main/java/org/joda/convert/StringConvert.java
StringConvert.findToStringMethod
private Method findToStringMethod(Class<?> cls, String methodName) { Method m; try { m = cls.getMethod(methodName); } catch (NoSuchMethodException ex) { throw new IllegalArgumentException(ex); } if (Modifier.isStatic(m.getModifiers())) { throw new IllegalArgumentException("Method must not be static: " + methodName); } return m; }
java
private Method findToStringMethod(Class<?> cls, String methodName) { Method m; try { m = cls.getMethod(methodName); } catch (NoSuchMethodException ex) { throw new IllegalArgumentException(ex); } if (Modifier.isStatic(m.getModifiers())) { throw new IllegalArgumentException("Method must not be static: " + methodName); } return m; }
[ "private", "Method", "findToStringMethod", "(", "Class", "<", "?", ">", "cls", ",", "String", "methodName", ")", "{", "Method", "m", ";", "try", "{", "m", "=", "cls", ".", "getMethod", "(", "methodName", ")", ";", "}", "catch", "(", "NoSuchMethodExceptio...
Finds the conversion method. @param cls the class to find a method for, not null @param methodName the name of the method to find, not null @return the method to call, null means use {@code toString}
[ "Finds", "the", "conversion", "method", "." ]
train
https://github.com/JodaOrg/joda-convert/blob/266bd825f4550590d5dafdf4225c548559e0633b/src/main/java/org/joda/convert/StringConvert.java#L796-L807
sdl/odata
odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java
EntityDataModelUtil.getAndCheckPrimitiveType
public static PrimitiveType getAndCheckPrimitiveType(EntityDataModel entityDataModel, String typeName) { return checkIsPrimitiveType(getAndCheckType(entityDataModel, typeName)); }
java
public static PrimitiveType getAndCheckPrimitiveType(EntityDataModel entityDataModel, String typeName) { return checkIsPrimitiveType(getAndCheckType(entityDataModel, typeName)); }
[ "public", "static", "PrimitiveType", "getAndCheckPrimitiveType", "(", "EntityDataModel", "entityDataModel", ",", "String", "typeName", ")", "{", "return", "checkIsPrimitiveType", "(", "getAndCheckType", "(", "entityDataModel", ",", "typeName", ")", ")", ";", "}" ]
Gets the OData type with a specified name and checks if the OData type is a primitive type; throws an exception if the OData type is not a primitive type. @param entityDataModel The entity data model. @param typeName The type name. @return The OData primitive type with the specified name. @throws ODataSystemException If there is no OData type with the specified name or if the OData type is not a primitive type.
[ "Gets", "the", "OData", "type", "with", "a", "specified", "name", "and", "checks", "if", "the", "OData", "type", "is", "a", "primitive", "type", ";", "throws", "an", "exception", "if", "the", "OData", "type", "is", "not", "a", "primitive", "type", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L129-L131
geomajas/geomajas-project-server
api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java
AssociationValue.setStringAttribute
public void setStringAttribute(String name, String value) { ensureAttributes(); Attribute attribute = new StringAttribute(value); attribute.setEditable(isEditable(name)); getAllAttributes().put(name, attribute); }
java
public void setStringAttribute(String name, String value) { ensureAttributes(); Attribute attribute = new StringAttribute(value); attribute.setEditable(isEditable(name)); getAllAttributes().put(name, attribute); }
[ "public", "void", "setStringAttribute", "(", "String", "name", ",", "String", "value", ")", "{", "ensureAttributes", "(", ")", ";", "Attribute", "attribute", "=", "new", "StringAttribute", "(", "value", ")", ";", "attribute", ".", "setEditable", "(", "isEditab...
Sets the specified string attribute to the specified value. @param name name of the attribute @param value value of the attribute @since 1.9.0
[ "Sets", "the", "specified", "string", "attribute", "to", "the", "specified", "value", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java#L350-L356
lkwg82/enforcer-rules
src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
RequirePluginVersions.findCurrentPlugin
protected Plugin findCurrentPlugin( Plugin plugin, MavenProject project ) { Plugin found = null; try { Model model = project.getModel(); @SuppressWarnings( "unchecked" ) Map<String, Plugin> plugins = model.getBuild().getPluginsAsMap(); found = plugins.get( plugin.getKey() ); } catch ( NullPointerException e ) { // nothing to do here } if ( found == null ) { found = resolvePlugin( plugin, project ); } return found; }
java
protected Plugin findCurrentPlugin( Plugin plugin, MavenProject project ) { Plugin found = null; try { Model model = project.getModel(); @SuppressWarnings( "unchecked" ) Map<String, Plugin> plugins = model.getBuild().getPluginsAsMap(); found = plugins.get( plugin.getKey() ); } catch ( NullPointerException e ) { // nothing to do here } if ( found == null ) { found = resolvePlugin( plugin, project ); } return found; }
[ "protected", "Plugin", "findCurrentPlugin", "(", "Plugin", "plugin", ",", "MavenProject", "project", ")", "{", "Plugin", "found", "=", "null", ";", "try", "{", "Model", "model", "=", "project", ".", "getModel", "(", ")", ";", "@", "SuppressWarnings", "(", ...
Given a plugin, this will retrieve the matching plugin artifact from the model. @param plugin plugin to lookup @param project project to search @return matching plugin, <code>null</code> if not found.
[ "Given", "a", "plugin", "this", "will", "retrieve", "the", "matching", "plugin", "artifact", "from", "the", "model", "." ]
train
https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java#L524-L545
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/ConversionSchemas.java
ConversionSchemas.v2CompatibleBuilder
public static Builder v2CompatibleBuilder(String name) { return new Builder(name, V2CompatibleMarshallerSet.marshallers(), V2CompatibleMarshallerSet.setMarshallers(), StandardUnmarshallerSet.unmarshallers(), StandardUnmarshallerSet.setUnmarshallers()); }
java
public static Builder v2CompatibleBuilder(String name) { return new Builder(name, V2CompatibleMarshallerSet.marshallers(), V2CompatibleMarshallerSet.setMarshallers(), StandardUnmarshallerSet.unmarshallers(), StandardUnmarshallerSet.setUnmarshallers()); }
[ "public", "static", "Builder", "v2CompatibleBuilder", "(", "String", "name", ")", "{", "return", "new", "Builder", "(", "name", ",", "V2CompatibleMarshallerSet", ".", "marshallers", "(", ")", ",", "V2CompatibleMarshallerSet", ".", "setMarshallers", "(", ")", ",", ...
A ConversionSchema builder that defaults to building {@link #V2_COMPATIBLE}.
[ "A", "ConversionSchema", "builder", "that", "defaults", "to", "building", "{" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/ConversionSchemas.java#L165-L170
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
NodeIndexer.addStringValue
protected void addStringValue(Document doc, String fieldName, Object internalValue, boolean tokenized, boolean includeInNodeIndex, float boost, boolean useInExcerpt) { // simple String String stringValue = (String)internalValue; doc.add(createFieldWithoutNorms(fieldName, stringValue, PropertyType.STRING)); if (tokenized) { if (stringValue.length() == 0) { return; } // create fulltext index on property int idx = fieldName.indexOf(':'); fieldName = fieldName.substring(0, idx + 1) + FieldNames.FULLTEXT_PREFIX + fieldName.substring(idx + 1); Field f = new Field(fieldName, stringValue, Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.NO); f.setBoost(boost); doc.add(f); if (includeInNodeIndex) { // also create fulltext index of this value boolean store = supportHighlighting && useInExcerpt; f = createFulltextField(stringValue, store, supportHighlighting); if (useInExcerpt) { doc.add(f); } else { doNotUseInExcerpt.add(f); } } } }
java
protected void addStringValue(Document doc, String fieldName, Object internalValue, boolean tokenized, boolean includeInNodeIndex, float boost, boolean useInExcerpt) { // simple String String stringValue = (String)internalValue; doc.add(createFieldWithoutNorms(fieldName, stringValue, PropertyType.STRING)); if (tokenized) { if (stringValue.length() == 0) { return; } // create fulltext index on property int idx = fieldName.indexOf(':'); fieldName = fieldName.substring(0, idx + 1) + FieldNames.FULLTEXT_PREFIX + fieldName.substring(idx + 1); Field f = new Field(fieldName, stringValue, Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.NO); f.setBoost(boost); doc.add(f); if (includeInNodeIndex) { // also create fulltext index of this value boolean store = supportHighlighting && useInExcerpt; f = createFulltextField(stringValue, store, supportHighlighting); if (useInExcerpt) { doc.add(f); } else { doNotUseInExcerpt.add(f); } } } }
[ "protected", "void", "addStringValue", "(", "Document", "doc", ",", "String", "fieldName", ",", "Object", "internalValue", ",", "boolean", "tokenized", ",", "boolean", "includeInNodeIndex", ",", "float", "boost", ",", "boolean", "useInExcerpt", ")", "{", "// simpl...
Adds the string value to the document both as the named field and optionally for full text indexing if <code>tokenized</code> is <code>true</code>. @param doc The document to which to add the field @param fieldName The name of the field to add @param internalValue The value for the field to add to the document. @param tokenized If <code>true</code> the string is also tokenized and fulltext indexed. @param includeInNodeIndex If <code>true</code> the string is also tokenized and added to the node scope fulltext index. @param boost the boost value for this string field. @param useInExcerpt If <code>true</code> the string may show up in an excerpt.
[ "Adds", "the", "string", "value", "to", "the", "document", "both", "as", "the", "named", "field", "and", "optionally", "for", "full", "text", "indexing", "if", "<code", ">", "tokenized<", "/", "code", ">", "is", "<code", ">", "true<", "/", "code", ">", ...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L847-L882
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_service_serviceName_task_GET
public ArrayList<Long> billingAccount_service_serviceName_task_GET(String billingAccount, String serviceName, String action, String serviceType, OvhTaskStatusEnum status) throws IOException { String qPath = "/telephony/{billingAccount}/service/{serviceName}/task"; StringBuilder sb = path(qPath, billingAccount, serviceName); query(sb, "action", action); query(sb, "serviceType", serviceType); query(sb, "status", status); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<Long> billingAccount_service_serviceName_task_GET(String billingAccount, String serviceName, String action, String serviceType, OvhTaskStatusEnum status) throws IOException { String qPath = "/telephony/{billingAccount}/service/{serviceName}/task"; StringBuilder sb = path(qPath, billingAccount, serviceName); query(sb, "action", action); query(sb, "serviceType", serviceType); query(sb, "status", status); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "Long", ">", "billingAccount_service_serviceName_task_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "String", "action", ",", "String", "serviceType", ",", "OvhTaskStatusEnum", "status", ")", "throws", "IOException"...
Operations on a telephony service REST: GET /telephony/{billingAccount}/service/{serviceName}/task @param action [required] Filter the value of action property (=) @param status [required] Filter the value of status property (=) @param serviceType [required] Filter the value of serviceType property (=) @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Operations", "on", "a", "telephony", "service" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3878-L3886
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/virtual/ExpressionSelectors.java
ExpressionSelectors.makeExprEvalSelector
public static ColumnValueSelector<ExprEval> makeExprEvalSelector( ColumnSelectorFactory columnSelectorFactory, Expr expression ) { final List<String> columns = Parser.findRequiredBindings(expression); if (columns.size() == 1) { final String column = Iterables.getOnlyElement(columns); final ColumnCapabilities capabilities = columnSelectorFactory.getColumnCapabilities(column); if (capabilities != null && capabilities.getType() == ValueType.LONG) { // Optimization for expressions that hit one long column and nothing else. return new SingleLongInputCachingExpressionColumnValueSelector( columnSelectorFactory.makeColumnValueSelector(column), expression, !ColumnHolder.TIME_COLUMN_NAME.equals(column) // __time doesn't need an LRU cache since it is sorted. ); } else if (capabilities != null && capabilities.getType() == ValueType.STRING && capabilities.isDictionaryEncoded()) { // Optimization for expressions that hit one string column and nothing else. return new SingleStringInputCachingExpressionColumnValueSelector( columnSelectorFactory.makeDimensionSelector(new DefaultDimensionSpec(column, column, ValueType.STRING)), expression ); } } final Expr.ObjectBinding bindings = createBindings(expression, columnSelectorFactory); if (bindings.equals(ExprUtils.nilBindings())) { // Optimization for constant expressions. return new ConstantExprEvalSelector(expression.eval(bindings)); } // No special optimization. return new ExpressionColumnValueSelector(expression, bindings); }
java
public static ColumnValueSelector<ExprEval> makeExprEvalSelector( ColumnSelectorFactory columnSelectorFactory, Expr expression ) { final List<String> columns = Parser.findRequiredBindings(expression); if (columns.size() == 1) { final String column = Iterables.getOnlyElement(columns); final ColumnCapabilities capabilities = columnSelectorFactory.getColumnCapabilities(column); if (capabilities != null && capabilities.getType() == ValueType.LONG) { // Optimization for expressions that hit one long column and nothing else. return new SingleLongInputCachingExpressionColumnValueSelector( columnSelectorFactory.makeColumnValueSelector(column), expression, !ColumnHolder.TIME_COLUMN_NAME.equals(column) // __time doesn't need an LRU cache since it is sorted. ); } else if (capabilities != null && capabilities.getType() == ValueType.STRING && capabilities.isDictionaryEncoded()) { // Optimization for expressions that hit one string column and nothing else. return new SingleStringInputCachingExpressionColumnValueSelector( columnSelectorFactory.makeDimensionSelector(new DefaultDimensionSpec(column, column, ValueType.STRING)), expression ); } } final Expr.ObjectBinding bindings = createBindings(expression, columnSelectorFactory); if (bindings.equals(ExprUtils.nilBindings())) { // Optimization for constant expressions. return new ConstantExprEvalSelector(expression.eval(bindings)); } // No special optimization. return new ExpressionColumnValueSelector(expression, bindings); }
[ "public", "static", "ColumnValueSelector", "<", "ExprEval", ">", "makeExprEvalSelector", "(", "ColumnSelectorFactory", "columnSelectorFactory", ",", "Expr", "expression", ")", "{", "final", "List", "<", "String", ">", "columns", "=", "Parser", ".", "findRequiredBindin...
Makes a ColumnValueSelector whose getObject method returns an {@link ExprEval}. @see ExpressionSelectors#makeColumnValueSelector(ColumnSelectorFactory, Expr)
[ "Makes", "a", "ColumnValueSelector", "whose", "getObject", "method", "returns", "an", "{", "@link", "ExprEval", "}", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/virtual/ExpressionSelectors.java#L129-L167
gosu-lang/gosu-lang
gosu-lab/src/main/java/editor/GosuDocument.java
GosuDocument.getStyleCodeAtPosition
public Integer getStyleCodeAtPosition( int iPosition ) { if( _locations == null || _locations.isEmpty() ) { return null; } IParseTree l; try { l = IParseTree.Search.getDeepestLocation( _locations, iPosition - _locationsOffset, true ); } catch( Throwable t ) { // Ok, what we are guarding against here is primarly a InnerClassNotFoundException. These can happen here in the UI // Thread when the intellisense thread is midway though parsing. The UI thread gets an old parsedelement which has // an old anonymous gosu class type in it and fails to load due the how anonymous class names are encoded with // offsets into the enclosing class file. return null; } if( l == null ) { return null; } if( !l.contains( iPosition - _locationsOffset ) ) { return null; } IParsedElement parsedElem = l.getParsedElement(); try { return getStyleCodeForParsedElement( iPosition, parsedElem ); } catch( Throwable t ) { // Ok, what we are guarding against here is primarly a InnerClassNotFoundException. These can happen here in the UI // Thread when the intellisense thread is midway though parsing. The UI thread gets an old parsedelement which has // an old anonymous gosu class type in it and fails to load due the how anonymous class names are encoded with // offsets into the enclosing class file. return null; } }
java
public Integer getStyleCodeAtPosition( int iPosition ) { if( _locations == null || _locations.isEmpty() ) { return null; } IParseTree l; try { l = IParseTree.Search.getDeepestLocation( _locations, iPosition - _locationsOffset, true ); } catch( Throwable t ) { // Ok, what we are guarding against here is primarly a InnerClassNotFoundException. These can happen here in the UI // Thread when the intellisense thread is midway though parsing. The UI thread gets an old parsedelement which has // an old anonymous gosu class type in it and fails to load due the how anonymous class names are encoded with // offsets into the enclosing class file. return null; } if( l == null ) { return null; } if( !l.contains( iPosition - _locationsOffset ) ) { return null; } IParsedElement parsedElem = l.getParsedElement(); try { return getStyleCodeForParsedElement( iPosition, parsedElem ); } catch( Throwable t ) { // Ok, what we are guarding against here is primarly a InnerClassNotFoundException. These can happen here in the UI // Thread when the intellisense thread is midway though parsing. The UI thread gets an old parsedelement which has // an old anonymous gosu class type in it and fails to load due the how anonymous class names are encoded with // offsets into the enclosing class file. return null; } }
[ "public", "Integer", "getStyleCodeAtPosition", "(", "int", "iPosition", ")", "{", "if", "(", "_locations", "==", "null", "||", "_locations", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "IParseTree", "l", ";", "try", "{", "l", "=", "...
Returns a style code for the absolute position in the document or null if no code is mapped.
[ "Returns", "a", "style", "code", "for", "the", "absolute", "position", "in", "the", "document", "or", "null", "if", "no", "code", "is", "mapped", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/GosuDocument.java#L151-L193
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.getDisplayKeyword
public static String getDisplayKeyword(String keyword, String displayLocaleID) { return getDisplayKeywordInternal(keyword, new ULocale(displayLocaleID)); }
java
public static String getDisplayKeyword(String keyword, String displayLocaleID) { return getDisplayKeywordInternal(keyword, new ULocale(displayLocaleID)); }
[ "public", "static", "String", "getDisplayKeyword", "(", "String", "keyword", ",", "String", "displayLocaleID", ")", "{", "return", "getDisplayKeywordInternal", "(", "keyword", ",", "new", "ULocale", "(", "displayLocaleID", ")", ")", ";", "}" ]
<strong>[icu]</strong> Returns a keyword localized for display in the specified locale. @param keyword the keyword to be displayed. @param displayLocaleID the id of the locale in which to display the keyword. @return the localized keyword name. @see #getKeywords(String)
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Returns", "a", "keyword", "localized", "for", "display", "in", "the", "specified", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1679-L1681
scireum/server-sass
src/main/java/org/serversass/Functions.java
Functions.desaturate
public static Expression desaturate(Generator generator, FunctionCall input) { Color color = input.getExpectedColorParam(0); int decrease = input.getExpectedIntParam(1); return changeSaturation(color, -decrease); }
java
public static Expression desaturate(Generator generator, FunctionCall input) { Color color = input.getExpectedColorParam(0); int decrease = input.getExpectedIntParam(1); return changeSaturation(color, -decrease); }
[ "public", "static", "Expression", "desaturate", "(", "Generator", "generator", ",", "FunctionCall", "input", ")", "{", "Color", "color", "=", "input", ".", "getExpectedColorParam", "(", "0", ")", ";", "int", "decrease", "=", "input", ".", "getExpectedIntParam", ...
Decreases the saturation of the given color by N percent. @param generator the surrounding generator @param input the function call to evaluate @return the result of the evaluation
[ "Decreases", "the", "saturation", "of", "the", "given", "color", "by", "N", "percent", "." ]
train
https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L156-L160
xetorthio/jedis
src/main/java/redis/clients/jedis/BinaryJedis.java
BinaryJedis.zincrby
@Override public Double zincrby(final byte[] key, final double increment, final byte[] member) { checkIsInMultiOrPipeline(); client.zincrby(key, increment, member); return BuilderFactory.DOUBLE.build(client.getOne()); }
java
@Override public Double zincrby(final byte[] key, final double increment, final byte[] member) { checkIsInMultiOrPipeline(); client.zincrby(key, increment, member); return BuilderFactory.DOUBLE.build(client.getOne()); }
[ "@", "Override", "public", "Double", "zincrby", "(", "final", "byte", "[", "]", "key", ",", "final", "double", "increment", ",", "final", "byte", "[", "]", "member", ")", "{", "checkIsInMultiOrPipeline", "(", ")", ";", "client", ".", "zincrby", "(", "key...
If member already exists in the sorted set adds the increment to its score and updates the position of the element in the sorted set accordingly. If member does not already exist in the sorted set it is added with increment as score (that is, like if the previous score was virtually zero). If key does not exist a new sorted set with the specified member as sole member is created. If the key exists but does not hold a sorted set value an error is returned. <p> The score value can be the string representation of a double precision floating point number. It's possible to provide a negative value to perform a decrement. <p> For an introduction to sorted sets check the Introduction to Redis data types page. <p> Time complexity O(log(N)) with N being the number of elements in the sorted set @param key @param increment @param member @return The new score
[ "If", "member", "already", "exists", "in", "the", "sorted", "set", "adds", "the", "increment", "to", "its", "score", "and", "updates", "the", "position", "of", "the", "element", "in", "the", "sorted", "set", "accordingly", ".", "If", "member", "does", "not...
train
https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L1730-L1735
zzsrv/torrent-utils
src/main/java/cc/vcode/util/SHA1Hasher.java
SHA1Hasher.update
public void update( byte[] data, int pos, int len ) { update( ByteBuffer.wrap( data, pos, len )); }
java
public void update( byte[] data, int pos, int len ) { update( ByteBuffer.wrap( data, pos, len )); }
[ "public", "void", "update", "(", "byte", "[", "]", "data", ",", "int", "pos", ",", "int", "len", ")", "{", "update", "(", "ByteBuffer", ".", "wrap", "(", "data", ",", "pos", ",", "len", ")", ")", ";", "}" ]
Start or continue a hash calculation with the given data, starting at the given position, for the given length. @param data input @param pos start position @param len length
[ "Start", "or", "continue", "a", "hash", "calculation", "with", "the", "given", "data", "starting", "at", "the", "given", "position", "for", "the", "given", "length", "." ]
train
https://github.com/zzsrv/torrent-utils/blob/70ba8bccd5af1ed7a18c42c61ad409256e9865f3/src/main/java/cc/vcode/util/SHA1Hasher.java#L66-L68
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java
XmlStringBuilder.optIntAttribute
public XmlStringBuilder optIntAttribute(String name, int value) { if (value >= 0) { attribute(name, Integer.toString(value)); } return this; }
java
public XmlStringBuilder optIntAttribute(String name, int value) { if (value >= 0) { attribute(name, Integer.toString(value)); } return this; }
[ "public", "XmlStringBuilder", "optIntAttribute", "(", "String", "name", ",", "int", "value", ")", "{", "if", "(", "value", ">=", "0", ")", "{", "attribute", "(", "name", ",", "Integer", ".", "toString", "(", "value", ")", ")", ";", "}", "return", "this...
Add the given attribute if {@code value => 0}. @param name @param value @return a reference to this object
[ "Add", "the", "given", "attribute", "if", "{", "@code", "value", "=", ">", "0", "}", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java#L337-L342
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/ArtifactoryAnalyzer.java
ArtifactoryAnalyzer.processPom
private void processPom(Dependency dependency, MavenArtifact ma) throws IOException, AnalysisException { File pomFile = null; try { final File baseDir = getSettings().getTempDirectory(); pomFile = File.createTempFile("pom", ".xml", baseDir); Files.delete(pomFile.toPath()); LOGGER.debug("Downloading {}", ma.getPomUrl()); final Downloader downloader = new Downloader(getSettings()); downloader.fetchFile(new URL(ma.getPomUrl()), pomFile); PomUtils.analyzePOM(dependency, pomFile); } catch (DownloadFailedException ex) { LOGGER.warn("Unable to download pom.xml for {} from Artifactory; " + "this could result in undetected CPE/CVEs.", dependency.getFileName()); } finally { if (pomFile != null && pomFile.exists() && !FileUtils.deleteQuietly(pomFile)) { LOGGER.debug("Failed to delete temporary pom file {}", pomFile); pomFile.deleteOnExit(); } } }
java
private void processPom(Dependency dependency, MavenArtifact ma) throws IOException, AnalysisException { File pomFile = null; try { final File baseDir = getSettings().getTempDirectory(); pomFile = File.createTempFile("pom", ".xml", baseDir); Files.delete(pomFile.toPath()); LOGGER.debug("Downloading {}", ma.getPomUrl()); final Downloader downloader = new Downloader(getSettings()); downloader.fetchFile(new URL(ma.getPomUrl()), pomFile); PomUtils.analyzePOM(dependency, pomFile); } catch (DownloadFailedException ex) { LOGGER.warn("Unable to download pom.xml for {} from Artifactory; " + "this could result in undetected CPE/CVEs.", dependency.getFileName()); } finally { if (pomFile != null && pomFile.exists() && !FileUtils.deleteQuietly(pomFile)) { LOGGER.debug("Failed to delete temporary pom file {}", pomFile); pomFile.deleteOnExit(); } } }
[ "private", "void", "processPom", "(", "Dependency", "dependency", ",", "MavenArtifact", "ma", ")", "throws", "IOException", ",", "AnalysisException", "{", "File", "pomFile", "=", "null", ";", "try", "{", "final", "File", "baseDir", "=", "getSettings", "(", ")"...
If necessary, downloads the pom.xml from Central and adds the evidence to the dependency. @param dependency the dependency to download and process the pom.xml @param ma the Maven artifact coordinates @throws IOException thrown if there is an I/O error @throws AnalysisException thrown if there is an error analyzing the pom
[ "If", "necessary", "downloads", "the", "pom", ".", "xml", "from", "Central", "and", "adds", "the", "evidence", "to", "the", "dependency", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/ArtifactoryAnalyzer.java#L232-L252
isisaddons-legacy/isis-module-excel
dom/src/main/java/org/isisaddons/module/excel/dom/util/ExcelServiceImpl.java
ExcelServiceImpl.toExcel
@Programmatic public Blob toExcel(final List<WorksheetContent> worksheetContents, final String fileName) { try { final File file = newExcelConverter().appendSheet(worksheetContents); return excelFileBlobConverter.toBlob(fileName, file); } catch (final IOException ex) { throw new ExcelService.Exception(ex); } }
java
@Programmatic public Blob toExcel(final List<WorksheetContent> worksheetContents, final String fileName) { try { final File file = newExcelConverter().appendSheet(worksheetContents); return excelFileBlobConverter.toBlob(fileName, file); } catch (final IOException ex) { throw new ExcelService.Exception(ex); } }
[ "@", "Programmatic", "public", "Blob", "toExcel", "(", "final", "List", "<", "WorksheetContent", ">", "worksheetContents", ",", "final", "String", "fileName", ")", "{", "try", "{", "final", "File", "file", "=", "newExcelConverter", "(", ")", ".", "appendSheet"...
As {@link #toExcel(WorksheetContent, String)}, but with multiple sheets.
[ "As", "{" ]
train
https://github.com/isisaddons-legacy/isis-module-excel/blob/a3b92b1797ab2ed609667933d4164e9fb54b9f25/dom/src/main/java/org/isisaddons/module/excel/dom/util/ExcelServiceImpl.java#L80-L88
kochedykov/jlibmodbus
src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java
ModbusMaster.writeMultipleRegisters
final public void writeMultipleRegisters(int serverAddress, int startAddress, int[] registers) throws ModbusProtocolException, ModbusNumberException, ModbusIOException { processRequest(ModbusRequestBuilder.getInstance().buildWriteMultipleRegisters(serverAddress, startAddress, registers)); }
java
final public void writeMultipleRegisters(int serverAddress, int startAddress, int[] registers) throws ModbusProtocolException, ModbusNumberException, ModbusIOException { processRequest(ModbusRequestBuilder.getInstance().buildWriteMultipleRegisters(serverAddress, startAddress, registers)); }
[ "final", "public", "void", "writeMultipleRegisters", "(", "int", "serverAddress", ",", "int", "startAddress", ",", "int", "[", "]", "registers", ")", "throws", "ModbusProtocolException", ",", "ModbusNumberException", ",", "ModbusIOException", "{", "processRequest", "(...
This function code is used to write a block of contiguous registers (1 to 123 registers) in a remote device. The requested written values are specified in the request data field. Data is packed as two bytes per register. @param serverAddress a slave address @param startAddress the address of the registers to be written @param registers the register data @throws ModbusProtocolException if modbus-exception is received @throws ModbusNumberException if response is invalid @throws ModbusIOException if remote slave is unavailable
[ "This", "function", "code", "is", "used", "to", "write", "a", "block", "of", "contiguous", "registers", "(", "1", "to", "123", "registers", ")", "in", "a", "remote", "device", ".", "The", "requested", "written", "values", "are", "specified", "in", "the", ...
train
https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java#L338-L341
alkacon/opencms-core
src/org/opencms/loader/CmsResourceManager.java
CmsResourceManager.addMimeType
public CmsMimeType addMimeType(String extension, String type) throws CmsConfigurationException { // check if new mime types can still be added if (m_frozen) { throw new CmsConfigurationException(Messages.get().container(Messages.ERR_NO_CONFIG_AFTER_STARTUP_0)); } CmsMimeType mimeType = new CmsMimeType(extension, type); m_configuredMimeTypes.add(mimeType); return mimeType; }
java
public CmsMimeType addMimeType(String extension, String type) throws CmsConfigurationException { // check if new mime types can still be added if (m_frozen) { throw new CmsConfigurationException(Messages.get().container(Messages.ERR_NO_CONFIG_AFTER_STARTUP_0)); } CmsMimeType mimeType = new CmsMimeType(extension, type); m_configuredMimeTypes.add(mimeType); return mimeType; }
[ "public", "CmsMimeType", "addMimeType", "(", "String", "extension", ",", "String", "type", ")", "throws", "CmsConfigurationException", "{", "// check if new mime types can still be added", "if", "(", "m_frozen", ")", "{", "throw", "new", "CmsConfigurationException", "(", ...
Adds a new MIME type from the XML configuration to the internal list of MIME types.<p> @param extension the MIME type extension @param type the MIME type description @return the created MIME type instance @throws CmsConfigurationException in case the resource manager configuration is already initialized
[ "Adds", "a", "new", "MIME", "type", "from", "the", "XML", "configuration", "to", "the", "internal", "list", "of", "MIME", "types", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsResourceManager.java#L504-L514
ModeShape/modeshape
web/modeshape-web-explorer/src/main/java/org/modeshape/web/client/Console.java
Console.changeRepositoryInURL
public void changeRepositoryInURL(String name, boolean changeHistory) { jcrURL.setRepository(name); if (changeHistory) { htmlHistory.newItem(jcrURL.toString(), false); } }
java
public void changeRepositoryInURL(String name, boolean changeHistory) { jcrURL.setRepository(name); if (changeHistory) { htmlHistory.newItem(jcrURL.toString(), false); } }
[ "public", "void", "changeRepositoryInURL", "(", "String", "name", ",", "boolean", "changeHistory", ")", "{", "jcrURL", ".", "setRepository", "(", "name", ")", ";", "if", "(", "changeHistory", ")", "{", "htmlHistory", ".", "newItem", "(", "jcrURL", ".", "toSt...
Changes repository name in URL displayed by browser. @param name the name of the repository. @param changeHistory if true store URL changes in history.
[ "Changes", "repository", "name", "in", "URL", "displayed", "by", "browser", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-explorer/src/main/java/org/modeshape/web/client/Console.java#L250-L255
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java
ValueFactoryImpl.createValue
public Value createValue(JCRName value) throws RepositoryException { if (value == null) return null; try { return new NameValue(value.getInternalName(), locationFactory); } catch (IOException e) { throw new RepositoryException("Cannot create NAME Value from JCRName", e); } }
java
public Value createValue(JCRName value) throws RepositoryException { if (value == null) return null; try { return new NameValue(value.getInternalName(), locationFactory); } catch (IOException e) { throw new RepositoryException("Cannot create NAME Value from JCRName", e); } }
[ "public", "Value", "createValue", "(", "JCRName", "value", ")", "throws", "RepositoryException", "{", "if", "(", "value", "==", "null", ")", "return", "null", ";", "try", "{", "return", "new", "NameValue", "(", "value", ".", "getInternalName", "(", ")", ",...
Create Value from JCRName. @param value JCRName @return Value @throws RepositoryException if error
[ "Create", "Value", "from", "JCRName", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java#L304-L316
ThreeTen/threetenbp
src/main/java/org/threeten/bp/chrono/HijrahDate.java
HijrahDate.getDayOfYear
private static int getDayOfYear(int cycleNumber, int dayOfCycle, int yearInCycle) { Integer[] cycles = getAdjustedCycle(cycleNumber); if (dayOfCycle > 0) { return dayOfCycle - cycles[yearInCycle].intValue(); } else { return cycles[yearInCycle].intValue() + dayOfCycle; } }
java
private static int getDayOfYear(int cycleNumber, int dayOfCycle, int yearInCycle) { Integer[] cycles = getAdjustedCycle(cycleNumber); if (dayOfCycle > 0) { return dayOfCycle - cycles[yearInCycle].intValue(); } else { return cycles[yearInCycle].intValue() + dayOfCycle; } }
[ "private", "static", "int", "getDayOfYear", "(", "int", "cycleNumber", ",", "int", "dayOfCycle", ",", "int", "yearInCycle", ")", "{", "Integer", "[", "]", "cycles", "=", "getAdjustedCycle", "(", "cycleNumber", ")", ";", "if", "(", "dayOfCycle", ">", "0", "...
Returns day-of-year. @param cycleNumber a cycle number @param dayOfCycle day of cycle @param yearInCycle year in cycle @return day-of-year
[ "Returns", "day", "-", "of", "-", "year", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/chrono/HijrahDate.java#L1038-L1046
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java
FixedFatJarExportPage.getPathLabel
protected static String getPathLabel(IPath path, boolean isOSPath) { String label; if (isOSPath) { label= path.toOSString(); } else { label= path.makeRelative().toString(); } return label; }
java
protected static String getPathLabel(IPath path, boolean isOSPath) { String label; if (isOSPath) { label= path.toOSString(); } else { label= path.makeRelative().toString(); } return label; }
[ "protected", "static", "String", "getPathLabel", "(", "IPath", "path", ",", "boolean", "isOSPath", ")", "{", "String", "label", ";", "if", "(", "isOSPath", ")", "{", "label", "=", "path", ".", "toOSString", "(", ")", ";", "}", "else", "{", "label", "="...
Returns the label of a path. @param path the path @param isOSPath if <code>true</code>, the path represents an OS path, if <code>false</code> it is a workspace path. @return the label of the path to be used in the UI.
[ "Returns", "the", "label", "of", "a", "path", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java#L711-L719
fuinorg/utils4j
src/main/java/org/fuin/utils4j/Utils4J.java
Utils4J.getCanonicalPath
public static String getCanonicalPath(final File file) { if (file == null) { return null; } try { return file.getCanonicalPath(); } catch (final IOException ex) { throw new RuntimeException("Couldn't get canonical path for: " + file, ex); } }
java
public static String getCanonicalPath(final File file) { if (file == null) { return null; } try { return file.getCanonicalPath(); } catch (final IOException ex) { throw new RuntimeException("Couldn't get canonical path for: " + file, ex); } }
[ "public", "static", "String", "getCanonicalPath", "(", "final", "File", "file", ")", "{", "if", "(", "file", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "return", "file", ".", "getCanonicalPath", "(", ")", ";", "}", "catch", "(", ...
Returns the canonical path for the file without throwing a checked exception. A potential {@link IOException} is converted into a {@link RuntimeException} @param file File to return the canonical path for or <code>null</code>. @return Canonical path for the given argument or <code>null</code> if the input was <code>null</code>.
[ "Returns", "the", "canonical", "path", "for", "the", "file", "without", "throwing", "a", "checked", "exception", ".", "A", "potential", "{", "@link", "IOException", "}", "is", "converted", "into", "a", "{", "@link", "RuntimeException", "}" ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L551-L560
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/ElevationUtil.java
ElevationUtil.getShadowWidth
private static float getShadowWidth(@NonNull final Context context, final int elevation, @NonNull final Orientation orientation, final boolean parallelLight) { float referenceElevationWidth = (float) elevation / (float) REFERENCE_ELEVATION * REFERENCE_SHADOW_WIDTH; float shadowWidth; if (parallelLight) { shadowWidth = referenceElevationWidth * BOTTOM_SCALE_FACTOR; } else { switch (orientation) { case LEFT: shadowWidth = referenceElevationWidth * LEFT_SCALE_FACTOR; break; case TOP: shadowWidth = referenceElevationWidth * TOP_SCALE_FACTOR; break; case RIGHT: shadowWidth = referenceElevationWidth * RIGHT_SCALE_FACTOR; break; case BOTTOM: shadowWidth = referenceElevationWidth * BOTTOM_SCALE_FACTOR; break; default: throw new IllegalArgumentException("Invalid orientation: " + orientation); } } return dpToPixels(context, shadowWidth); }
java
private static float getShadowWidth(@NonNull final Context context, final int elevation, @NonNull final Orientation orientation, final boolean parallelLight) { float referenceElevationWidth = (float) elevation / (float) REFERENCE_ELEVATION * REFERENCE_SHADOW_WIDTH; float shadowWidth; if (parallelLight) { shadowWidth = referenceElevationWidth * BOTTOM_SCALE_FACTOR; } else { switch (orientation) { case LEFT: shadowWidth = referenceElevationWidth * LEFT_SCALE_FACTOR; break; case TOP: shadowWidth = referenceElevationWidth * TOP_SCALE_FACTOR; break; case RIGHT: shadowWidth = referenceElevationWidth * RIGHT_SCALE_FACTOR; break; case BOTTOM: shadowWidth = referenceElevationWidth * BOTTOM_SCALE_FACTOR; break; default: throw new IllegalArgumentException("Invalid orientation: " + orientation); } } return dpToPixels(context, shadowWidth); }
[ "private", "static", "float", "getShadowWidth", "(", "@", "NonNull", "final", "Context", "context", ",", "final", "int", "elevation", ",", "@", "NonNull", "final", "Orientation", "orientation", ",", "final", "boolean", "parallelLight", ")", "{", "float", "refere...
Returns the width of a shadow, which is located besides an edge of an elevated view. @param context The context, which should be used, as an instance of the class {@link Context}. The context may not be null @param elevation The elevation, which should be emulated, in dp as an {@link Integer} value. The elevation must be at least 0 and at maximum the value of the constant <code>MAX_ELEVATION</code> @param orientation The orientation of the shadow in relation to the elevated view as a value of the enum {@link Orientation}. The orientation may either be <code>LEFT</code>, <code>TOP</code>, <code>RIGHT</code> or <code>BOTTOM</code> @param parallelLight True, if parallel light should be emulated, false otherwise @return The width of the shadow in pixels as a {@link Float} value
[ "Returns", "the", "width", "of", "a", "shadow", "which", "is", "located", "besides", "an", "edge", "of", "an", "elevated", "view", "." ]
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/ElevationUtil.java#L489-L518
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
RTFEmbeddedObject.readObjectData
private static int readObjectData(int offset, String text, List<RTFEmbeddedObject> objects) { LinkedList<byte[]> blocks = new LinkedList<byte[]>(); offset += (OBJDATA.length()); offset = skipEndOfLine(text, offset); int length; int lastOffset = offset; while (offset != -1) { length = getBlockLength(text, offset); lastOffset = readDataBlock(text, offset, length, blocks); offset = skipEndOfLine(text, lastOffset); } RTFEmbeddedObject headerObject; RTFEmbeddedObject dataObject; while (blocks.isEmpty() == false) { headerObject = new RTFEmbeddedObject(blocks, 2); objects.add(headerObject); if (blocks.isEmpty() == false) { dataObject = new RTFEmbeddedObject(blocks, headerObject.getTypeFlag2()); objects.add(dataObject); } } return (lastOffset); }
java
private static int readObjectData(int offset, String text, List<RTFEmbeddedObject> objects) { LinkedList<byte[]> blocks = new LinkedList<byte[]>(); offset += (OBJDATA.length()); offset = skipEndOfLine(text, offset); int length; int lastOffset = offset; while (offset != -1) { length = getBlockLength(text, offset); lastOffset = readDataBlock(text, offset, length, blocks); offset = skipEndOfLine(text, lastOffset); } RTFEmbeddedObject headerObject; RTFEmbeddedObject dataObject; while (blocks.isEmpty() == false) { headerObject = new RTFEmbeddedObject(blocks, 2); objects.add(headerObject); if (blocks.isEmpty() == false) { dataObject = new RTFEmbeddedObject(blocks, headerObject.getTypeFlag2()); objects.add(dataObject); } } return (lastOffset); }
[ "private", "static", "int", "readObjectData", "(", "int", "offset", ",", "String", "text", ",", "List", "<", "RTFEmbeddedObject", ">", "objects", ")", "{", "LinkedList", "<", "byte", "[", "]", ">", "blocks", "=", "new", "LinkedList", "<", "byte", "[", "]...
This method extracts byte arrays from the embedded object data and converts them into RTFEmbeddedObject instances, which it then adds to the supplied list. @param offset offset into the RTF document @param text RTF document @param objects destination for RTFEmbeddedObject instances @return new offset into the RTF document
[ "This", "method", "extracts", "byte", "arrays", "from", "the", "embedded", "object", "data", "and", "converts", "them", "into", "RTFEmbeddedObject", "instances", "which", "it", "then", "adds", "to", "the", "supplied", "list", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L243-L275
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java
DataService.deleteAsync
public <T extends IEntity> void deleteAsync(T entity, CallbackHandler callbackHandler) throws FMSException { IntuitMessage intuitMessage = prepareDelete(entity); //set callback handler intuitMessage.getRequestElements().setCallbackHandler(callbackHandler); //execute async interceptors executeAsyncInterceptors(intuitMessage); }
java
public <T extends IEntity> void deleteAsync(T entity, CallbackHandler callbackHandler) throws FMSException { IntuitMessage intuitMessage = prepareDelete(entity); //set callback handler intuitMessage.getRequestElements().setCallbackHandler(callbackHandler); //execute async interceptors executeAsyncInterceptors(intuitMessage); }
[ "public", "<", "T", "extends", "IEntity", ">", "void", "deleteAsync", "(", "T", "entity", ",", "CallbackHandler", "callbackHandler", ")", "throws", "FMSException", "{", "IntuitMessage", "intuitMessage", "=", "prepareDelete", "(", "entity", ")", ";", "//set callbac...
Method to delete record for the given entity in asynchronous fashion @param entity the entity @param callbackHandler the callback handler @throws FMSException
[ "Method", "to", "delete", "record", "for", "the", "given", "entity", "in", "asynchronous", "fashion" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L779-L788
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java
ConfusionMatrix.getCount
public synchronized int getCount(T actual, T predicted) { if (!matrix.containsKey(actual)) { return 0; } else { return matrix.get(actual).count(predicted); } }
java
public synchronized int getCount(T actual, T predicted) { if (!matrix.containsKey(actual)) { return 0; } else { return matrix.get(actual).count(predicted); } }
[ "public", "synchronized", "int", "getCount", "(", "T", "actual", ",", "T", "predicted", ")", "{", "if", "(", "!", "matrix", ".", "containsKey", "(", "actual", ")", ")", "{", "return", "0", ";", "}", "else", "{", "return", "matrix", ".", "get", "(", ...
Gives the count of the number of times the "predicted" class was predicted for the "actual" class.
[ "Gives", "the", "count", "of", "the", "number", "of", "times", "the", "predicted", "class", "was", "predicted", "for", "the", "actual", "class", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java#L100-L106
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/LabelsApi.java
LabelsApi.updateLabelName
public Label updateLabelName(Object projectIdOrPath, String name, String newName, String description, Integer priority) throws GitLabApiException { return (updateLabel(projectIdOrPath, name, newName, null, description, priority)); }
java
public Label updateLabelName(Object projectIdOrPath, String name, String newName, String description, Integer priority) throws GitLabApiException { return (updateLabel(projectIdOrPath, name, newName, null, description, priority)); }
[ "public", "Label", "updateLabelName", "(", "Object", "projectIdOrPath", ",", "String", "name", ",", "String", "newName", ",", "String", "description", ",", "Integer", "priority", ")", "throws", "GitLabApiException", "{", "return", "(", "updateLabel", "(", "project...
Update the specified label @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param name the name for the label @param newName the new name for the label @param description the description for the label @param priority the priority for the label @return the modified Label instance @throws GitLabApiException if any exception occurs
[ "Update", "the", "specified", "label" ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/LabelsApi.java#L142-L144
cdk/cdk
tool/charges/src/main/java/org/openscience/cdk/charges/PiElectronegativity.java
PiElectronegativity.calculatePiElectronegativity
public double calculatePiElectronegativity(IAtomContainer ac, IAtom atom) { return calculatePiElectronegativity(ac, atom, maxI, maxRS); }
java
public double calculatePiElectronegativity(IAtomContainer ac, IAtom atom) { return calculatePiElectronegativity(ac, atom, maxI, maxRS); }
[ "public", "double", "calculatePiElectronegativity", "(", "IAtomContainer", "ac", ",", "IAtom", "atom", ")", "{", "return", "calculatePiElectronegativity", "(", "ac", ",", "atom", ",", "maxI", ",", "maxRS", ")", ";", "}" ]
calculate the electronegativity of orbitals pi. @param ac IAtomContainer @param atom atom for which effective atom electronegativity should be calculated @return piElectronegativity
[ "calculate", "the", "electronegativity", "of", "orbitals", "pi", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/charges/src/main/java/org/openscience/cdk/charges/PiElectronegativity.java#L82-L85
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodDelegation.java
MethodDelegation.toField
public static MethodDelegation toField(String name, FieldLocator.Factory fieldLocatorFactory, MethodGraph.Compiler methodGraphCompiler) { return withDefaultConfiguration().toField(name, fieldLocatorFactory, methodGraphCompiler); }
java
public static MethodDelegation toField(String name, FieldLocator.Factory fieldLocatorFactory, MethodGraph.Compiler methodGraphCompiler) { return withDefaultConfiguration().toField(name, fieldLocatorFactory, methodGraphCompiler); }
[ "public", "static", "MethodDelegation", "toField", "(", "String", "name", ",", "FieldLocator", ".", "Factory", "fieldLocatorFactory", ",", "MethodGraph", ".", "Compiler", "methodGraphCompiler", ")", "{", "return", "withDefaultConfiguration", "(", ")", ".", "toField", ...
Delegates any intercepted method to invoke a non-{@code static} method on the instance of the supplied field. To be considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the case if the method's declaring type is either public or in the same package as the instrumented type and if the method is either public or non-private and in the same package as the instrumented type. Private methods can only be used as a delegation target if the delegation is targeting the instrumented type. @param name The field's name. @param fieldLocatorFactory The field locator factory to use. @param methodGraphCompiler The method graph compiler to use. @return A delegation that redirects invocations to a method of the specified field's instance.
[ "Delegates", "any", "intercepted", "method", "to", "invoke", "a", "non", "-", "{", "@code", "static", "}", "method", "on", "the", "instance", "of", "the", "supplied", "field", ".", "To", "be", "considered", "a", "valid", "delegation", "target", "a", "metho...
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodDelegation.java#L496-L498
goldmansachs/reladomo
reladomo/src/main/java/com/gs/fw/common/mithra/transaction/TransactionLocalMap.java
TransactionLocalMap.getEntryAfterMiss
private Object getEntryAfterMiss(TransactionLocal key, int i, Entry e) { Entry[] tab = table; int len = tab.length; while (e != null) { if (e.key == key) return e.value; i = nextIndex(i, len); e = tab[i]; } return null; }
java
private Object getEntryAfterMiss(TransactionLocal key, int i, Entry e) { Entry[] tab = table; int len = tab.length; while (e != null) { if (e.key == key) return e.value; i = nextIndex(i, len); e = tab[i]; } return null; }
[ "private", "Object", "getEntryAfterMiss", "(", "TransactionLocal", "key", ",", "int", "i", ",", "Entry", "e", ")", "{", "Entry", "[", "]", "tab", "=", "table", ";", "int", "len", "=", "tab", ".", "length", ";", "while", "(", "e", "!=", "null", ")", ...
Version of getEntry method for use when key is not found in its direct hash slot. @param key the thread local object @param i the table index for key's hash code @param e the entry at table[i] @return the entry associated with key, or null if no such
[ "Version", "of", "getEntry", "method", "for", "use", "when", "key", "is", "not", "found", "in", "its", "direct", "hash", "slot", "." ]
train
https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/transaction/TransactionLocalMap.java#L121-L134
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java
JSONHelpers.optPoint
public static <P extends Enum<P>> Point optPoint(final JSONObject json, P e) { return optPoint(json, e, null); }
java
public static <P extends Enum<P>> Point optPoint(final JSONObject json, P e) { return optPoint(json, e, null); }
[ "public", "static", "<", "P", "extends", "Enum", "<", "P", ">", ">", "Point", "optPoint", "(", "final", "JSONObject", "json", ",", "P", "e", ")", "{", "return", "optPoint", "(", "json", ",", "e", ",", "null", ")", ";", "}" ]
Return the value mapped by enum if it exists and is a {@link JSONObject} by mapping "x" and "y" members into a {@link Point}. @param json {@code JSONObject} to get data from @param e {@link Enum} labeling the data to get @return An instance of {@code Point} or {@null} if there is no object mapping for {@code e}.
[ "Return", "the", "value", "mapped", "by", "enum", "if", "it", "exists", "and", "is", "a", "{", "@link", "JSONObject", "}", "by", "mapping", "x", "and", "y", "members", "into", "a", "{", "@link", "Point", "}", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L490-L492
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/VariablesInner.java
VariablesInner.updateAsync
public Observable<VariableInner> updateAsync(String resourceGroupName, String automationAccountName, String variableName, VariableUpdateParameters parameters) { return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, variableName, parameters).map(new Func1<ServiceResponse<VariableInner>, VariableInner>() { @Override public VariableInner call(ServiceResponse<VariableInner> response) { return response.body(); } }); }
java
public Observable<VariableInner> updateAsync(String resourceGroupName, String automationAccountName, String variableName, VariableUpdateParameters parameters) { return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, variableName, parameters).map(new Func1<ServiceResponse<VariableInner>, VariableInner>() { @Override public VariableInner call(ServiceResponse<VariableInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VariableInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "variableName", ",", "VariableUpdateParameters", "parameters", ")", "{", "return", "updateWithServiceResponseAsync", ...
Update a variable. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param variableName The variable name. @param parameters The parameters supplied to the update variable operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VariableInner object
[ "Update", "a", "variable", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/VariablesInner.java#L234-L241
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/internal/Provider.java
Provider.createInstance
public static <T> T createInstance(Class<?> rawClass, Class<T> superclass) { try { return rawClass.asSubclass(superclass).getConstructor().newInstance(); } catch (Exception e) { throw new ServiceConfigurationError( "Provider " + rawClass.getName() + " could not be instantiated.", e); } }
java
public static <T> T createInstance(Class<?> rawClass, Class<T> superclass) { try { return rawClass.asSubclass(superclass).getConstructor().newInstance(); } catch (Exception e) { throw new ServiceConfigurationError( "Provider " + rawClass.getName() + " could not be instantiated.", e); } }
[ "public", "static", "<", "T", ">", "T", "createInstance", "(", "Class", "<", "?", ">", "rawClass", ",", "Class", "<", "T", ">", "superclass", ")", "{", "try", "{", "return", "rawClass", ".", "asSubclass", "(", "superclass", ")", ".", "getConstructor", ...
Tries to create an instance of the given rawClass as a subclass of the given superclass. @param rawClass The class that is initialized. @param superclass The initialized class must be a subclass of this. @return an instance of the class given rawClass which is a subclass of the given superclass. @throws ServiceConfigurationError if any error happens.
[ "Tries", "to", "create", "an", "instance", "of", "the", "given", "rawClass", "as", "a", "subclass", "of", "the", "given", "superclass", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/internal/Provider.java#L41-L48
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/impl/JdbcTemplateJdbcHelper.java
JdbcTemplateJdbcHelper.namedParameterJdbcTemplate
protected NamedParameterJdbcTemplate namedParameterJdbcTemplate(Connection conn) { DataSource ds = new SingleConnectionDataSource(conn, true); return new NamedParameterJdbcTemplate(ds); }
java
protected NamedParameterJdbcTemplate namedParameterJdbcTemplate(Connection conn) { DataSource ds = new SingleConnectionDataSource(conn, true); return new NamedParameterJdbcTemplate(ds); }
[ "protected", "NamedParameterJdbcTemplate", "namedParameterJdbcTemplate", "(", "Connection", "conn", ")", "{", "DataSource", "ds", "=", "new", "SingleConnectionDataSource", "(", "conn", ",", "true", ")", ";", "return", "new", "NamedParameterJdbcTemplate", "(", "ds", ")...
Get {@link NamedParameterJdbcTemplate} instance for a given {@link Connection}. Note: the returned {@link JdbcTemplate} will not automatically close the {@link Connection}. @param conn @return @since 0.8.0
[ "Get", "{", "@link", "NamedParameterJdbcTemplate", "}", "instance", "for", "a", "given", "{", "@link", "Connection", "}", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/impl/JdbcTemplateJdbcHelper.java#L59-L62
bramp/ffmpeg-cli-wrapper
src/main/java/net/bramp/ffmpeg/io/ProcessUtils.java
ProcessUtils.waitForWithTimeout
public static int waitForWithTimeout(final Process p, long timeout, TimeUnit unit) throws TimeoutException { ProcessThread t = new ProcessThread(p); t.start(); try { unit.timedJoin(t, timeout); } catch (InterruptedException e) { t.interrupt(); Thread.currentThread().interrupt(); } if (!t.hasFinished()) { throw new TimeoutException("Process did not finish within timeout"); } return t.exitValue(); }
java
public static int waitForWithTimeout(final Process p, long timeout, TimeUnit unit) throws TimeoutException { ProcessThread t = new ProcessThread(p); t.start(); try { unit.timedJoin(t, timeout); } catch (InterruptedException e) { t.interrupt(); Thread.currentThread().interrupt(); } if (!t.hasFinished()) { throw new TimeoutException("Process did not finish within timeout"); } return t.exitValue(); }
[ "public", "static", "int", "waitForWithTimeout", "(", "final", "Process", "p", ",", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "TimeoutException", "{", "ProcessThread", "t", "=", "new", "ProcessThread", "(", "p", ")", ";", "t", ".", "start", ...
Waits until a process finishes or a timeout occurs @param p process @param timeout timeout in given unit @param unit time unit @return the process exit value @throws TimeoutException if a timeout occurs
[ "Waits", "until", "a", "process", "finishes", "or", "a", "timeout", "occurs" ]
train
https://github.com/bramp/ffmpeg-cli-wrapper/blob/3819b155edf9132acc75bb6af66dcef1b98c64b2/src/main/java/net/bramp/ffmpeg/io/ProcessUtils.java#L50-L68
mozilla/rhino
src/org/mozilla/javascript/EmbeddedSlotMap.java
EmbeddedSlotMap.addKnownAbsentSlot
private void addKnownAbsentSlot(ScriptableObject.Slot[] addSlots, ScriptableObject.Slot slot) { final int insertPos = getSlotIndex(addSlots.length, slot.indexOrHash); ScriptableObject.Slot old = addSlots[insertPos]; addSlots[insertPos] = slot; slot.next = old; }
java
private void addKnownAbsentSlot(ScriptableObject.Slot[] addSlots, ScriptableObject.Slot slot) { final int insertPos = getSlotIndex(addSlots.length, slot.indexOrHash); ScriptableObject.Slot old = addSlots[insertPos]; addSlots[insertPos] = slot; slot.next = old; }
[ "private", "void", "addKnownAbsentSlot", "(", "ScriptableObject", ".", "Slot", "[", "]", "addSlots", ",", "ScriptableObject", ".", "Slot", "slot", ")", "{", "final", "int", "insertPos", "=", "getSlotIndex", "(", "addSlots", ".", "length", ",", "slot", ".", "...
Add slot with keys that are known to absent from the table. This is an optimization to use when inserting into empty table, after table growth or during deserialization.
[ "Add", "slot", "with", "keys", "that", "are", "known", "to", "absent", "from", "the", "table", ".", "This", "is", "an", "optimization", "to", "use", "when", "inserting", "into", "empty", "table", "after", "table", "growth", "or", "during", "deserialization",...
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/EmbeddedSlotMap.java#L343-L349
stripe/stripe-java
src/main/java/com/stripe/model/EventDataObjectDeserializer.java
EventDataObjectDeserializer.deserializeUnsafe
public StripeObject deserializeUnsafe() throws EventDataObjectDeserializationException { try { return EventDataDeserializer.deserializeStripeObject(rawJsonObject); } catch (JsonParseException e) { String errorMessage; if (!apiVersionMatch()) { errorMessage = String.format( "Current `stripe-java` integration has Stripe API version %s, but the event data " + "object has %s. The JSON data might have schema not compatible with the " + "current model classes; such incompatibility can be the cause of " + "deserialization failure. " + "If you are deserializing webhoook events, consider creating a different webhook " + "endpoint with `api_version` at %s. See Stripe API reference for more details. " + "If you are deserializing old events from `Event#retrieve`, " + "consider transforming the raw JSON data object to be compatible with this " + "current model class schemas using `deserializeUnsafeWith`. " + "Original error message: %s", getIntegrationApiVersion(), this.apiVersion, getIntegrationApiVersion(), e.getMessage() ); } else { errorMessage = String.format("Unable to deserialize event data object to respective Stripe " + "object. Please see the raw JSON, and contact support@stripe.com for " + "assistance. Original error message: %s", e.getMessage()); } throw new EventDataObjectDeserializationException(errorMessage, rawJsonObject.toString()); } }
java
public StripeObject deserializeUnsafe() throws EventDataObjectDeserializationException { try { return EventDataDeserializer.deserializeStripeObject(rawJsonObject); } catch (JsonParseException e) { String errorMessage; if (!apiVersionMatch()) { errorMessage = String.format( "Current `stripe-java` integration has Stripe API version %s, but the event data " + "object has %s. The JSON data might have schema not compatible with the " + "current model classes; such incompatibility can be the cause of " + "deserialization failure. " + "If you are deserializing webhoook events, consider creating a different webhook " + "endpoint with `api_version` at %s. See Stripe API reference for more details. " + "If you are deserializing old events from `Event#retrieve`, " + "consider transforming the raw JSON data object to be compatible with this " + "current model class schemas using `deserializeUnsafeWith`. " + "Original error message: %s", getIntegrationApiVersion(), this.apiVersion, getIntegrationApiVersion(), e.getMessage() ); } else { errorMessage = String.format("Unable to deserialize event data object to respective Stripe " + "object. Please see the raw JSON, and contact support@stripe.com for " + "assistance. Original error message: %s", e.getMessage()); } throw new EventDataObjectDeserializationException(errorMessage, rawJsonObject.toString()); } }
[ "public", "StripeObject", "deserializeUnsafe", "(", ")", "throws", "EventDataObjectDeserializationException", "{", "try", "{", "return", "EventDataDeserializer", ".", "deserializeStripeObject", "(", "rawJsonObject", ")", ";", "}", "catch", "(", "JsonParseException", "e", ...
Force deserialize raw JSON to {@code StripeObject}. The deserialized data is not guaranteed to fully represent the JSON. For example, events of new API version having fields that are not captured by current model class will be lost. Similarly, events of old API version having fields that should be translated into the new fields, like field rename, will be lost. <p>Upon deserialization failure, consider making the JSON compatible to the current model classes and recover from failure with {@link EventDataObjectDeserializer#deserializeUnsafeWith(CompatibilityTransformer)}. @return Object with no guarantee on full representation of its original raw JSON response. @throws EventDataObjectDeserializationException exception that contains the message error and the raw JSON response of the {@code StripeObject} to be deserialized.
[ "Force", "deserialize", "raw", "JSON", "to", "{", "@code", "StripeObject", "}", ".", "The", "deserialized", "data", "is", "not", "guaranteed", "to", "fully", "represent", "the", "JSON", ".", "For", "example", "events", "of", "new", "API", "version", "having"...
train
https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/model/EventDataObjectDeserializer.java#L147-L173
shrinkwrap/descriptors
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataUtil.java
MetadataUtil.hasParentOf
public static boolean hasParentOf(final Element parentElement, XsdElementEnum parentEnum) { Node parent = parentElement.getParentNode(); while (parent != null) { if (parent.getNodeType() == Node.ELEMENT_NODE) { final Element parentElm = (Element) parent; if (parentEnum.isTagNameEqual(parentElm.getTagName())) { return true; } } parent = parent.getParentNode(); } return false; }
java
public static boolean hasParentOf(final Element parentElement, XsdElementEnum parentEnum) { Node parent = parentElement.getParentNode(); while (parent != null) { if (parent.getNodeType() == Node.ELEMENT_NODE) { final Element parentElm = (Element) parent; if (parentEnum.isTagNameEqual(parentElm.getTagName())) { return true; } } parent = parent.getParentNode(); } return false; }
[ "public", "static", "boolean", "hasParentOf", "(", "final", "Element", "parentElement", ",", "XsdElementEnum", "parentEnum", ")", "{", "Node", "parent", "=", "parentElement", ".", "getParentNode", "(", ")", ";", "while", "(", "parent", "!=", "null", ")", "{", ...
Checks for the first parent node occurrence of the a w3c parentEnum element. @param parentElement the element from which the search starts. @param parentEnum the <code>XsdElementEnum</code> specifying the parent element. @return true, if found, otherwise false.
[ "Checks", "for", "the", "first", "parent", "node", "occurrence", "of", "the", "a", "w3c", "parentEnum", "element", "." ]
train
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataUtil.java#L144-L156
casbin/jcasbin
src/main/java/org/casbin/jcasbin/rbac/DefaultRoleManager.java
DefaultRoleManager.addLink
@Override public void addLink(String name1, String name2, String... domain) { if (domain.length == 1) { name1 = domain[0] + "::" + name1; name2 = domain[0] + "::" + name2; } else if (domain.length > 1) { throw new Error("error: domain should be 1 parameter"); } Role role1 = createRole(name1); Role role2 = createRole(name2); role1.addRole(role2); }
java
@Override public void addLink(String name1, String name2, String... domain) { if (domain.length == 1) { name1 = domain[0] + "::" + name1; name2 = domain[0] + "::" + name2; } else if (domain.length > 1) { throw new Error("error: domain should be 1 parameter"); } Role role1 = createRole(name1); Role role2 = createRole(name2); role1.addRole(role2); }
[ "@", "Override", "public", "void", "addLink", "(", "String", "name1", ",", "String", "name2", ",", "String", "...", "domain", ")", "{", "if", "(", "domain", ".", "length", "==", "1", ")", "{", "name1", "=", "domain", "[", "0", "]", "+", "\"::\"", "...
addLink adds the inheritance link between role: name1 and role: name2. aka role: name1 inherits role: name2. domain is a prefix to the roles.
[ "addLink", "adds", "the", "inheritance", "link", "between", "role", ":", "name1", "and", "role", ":", "name2", ".", "aka", "role", ":", "name1", "inherits", "role", ":", "name2", ".", "domain", "is", "a", "prefix", "to", "the", "roles", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/rbac/DefaultRoleManager.java#L66-L78
Red5/red5-server-common
src/main/java/org/red5/server/Client.java
Client.unregister
protected void unregister(IConnection conn, boolean deleteIfNoConns) { log.debug("Unregister connection ({}:{}) client id: {}", conn.getRemoteAddress(), conn.getRemotePort(), id); // remove connection from connected scopes list connections.remove(conn); // If client is not connected to any scope any longer then remove if (deleteIfNoConns && connections.isEmpty()) { // TODO DW dangerous the way this is called from BaseConnection.initialize(). Could we unexpectedly pop a Client out of the registry? removeInstance(); } }
java
protected void unregister(IConnection conn, boolean deleteIfNoConns) { log.debug("Unregister connection ({}:{}) client id: {}", conn.getRemoteAddress(), conn.getRemotePort(), id); // remove connection from connected scopes list connections.remove(conn); // If client is not connected to any scope any longer then remove if (deleteIfNoConns && connections.isEmpty()) { // TODO DW dangerous the way this is called from BaseConnection.initialize(). Could we unexpectedly pop a Client out of the registry? removeInstance(); } }
[ "protected", "void", "unregister", "(", "IConnection", "conn", ",", "boolean", "deleteIfNoConns", ")", "{", "log", ".", "debug", "(", "\"Unregister connection ({}:{}) client id: {}\"", ",", "conn", ".", "getRemoteAddress", "(", ")", ",", "conn", ".", "getRemotePort"...
Removes client-connection association for given connection @param conn Connection object @param deleteIfNoConns Whether to delete this client if it no longer has any connections
[ "Removes", "client", "-", "connection", "association", "for", "given", "connection" ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Client.java#L300-L309
google/closure-templates
java/src/com/google/template/soy/passes/CombineConsecutiveRawTextNodesPass.java
CombineConsecutiveRawTextNodesPass.mergeRange
@SuppressWarnings("unchecked") private int mergeRange(ParentSoyNode<?> parent, int start, int lastNonEmptyRawTextNode, int end) { checkArgument(start < end); if (start == -1 || end == start + 1) { return end; } // general case, there are N rawtextnodes to merge where n > 1 // merge all the nodes together, then drop all the raw text nodes from the end RawTextNode newNode = RawTextNode.concat( (List<RawTextNode>) parent.getChildren().subList(start, lastNonEmptyRawTextNode + 1)); ((ParentSoyNode) parent).replaceChild(start, newNode); for (int i = end - 1; i > start; i--) { parent.removeChild(i); } return start + 1; }
java
@SuppressWarnings("unchecked") private int mergeRange(ParentSoyNode<?> parent, int start, int lastNonEmptyRawTextNode, int end) { checkArgument(start < end); if (start == -1 || end == start + 1) { return end; } // general case, there are N rawtextnodes to merge where n > 1 // merge all the nodes together, then drop all the raw text nodes from the end RawTextNode newNode = RawTextNode.concat( (List<RawTextNode>) parent.getChildren().subList(start, lastNonEmptyRawTextNode + 1)); ((ParentSoyNode) parent).replaceChild(start, newNode); for (int i = end - 1; i > start; i--) { parent.removeChild(i); } return start + 1; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "int", "mergeRange", "(", "ParentSoyNode", "<", "?", ">", "parent", ",", "int", "start", ",", "int", "lastNonEmptyRawTextNode", ",", "int", "end", ")", "{", "checkArgument", "(", "start", "<", "e...
RawTextNodes and if we can remove a RawTextNode, we can also add one.
[ "RawTextNodes", "and", "if", "we", "can", "remove", "a", "RawTextNode", "we", "can", "also", "add", "one", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/CombineConsecutiveRawTextNodesPass.java#L96-L112
foundation-runtime/configuration
configuration-api/src/main/java/com/cisco/oss/foundation/configuration/validation/params/ParamValidators.java
ParamValidators.getValidatorsMap
private static ConcurrentHashMap<Class, List<ParamValidator>> getValidatorsMap() { // use <ConcurrentHashMap> in case validators are added while initializing parameters through <getValidator> method. ConcurrentHashMap<Class, List<ParamValidator>> map = new ConcurrentHashMap(); addValidators(map, ParamValidator.class, new ParamValidator(true), new ParamValidator(false)); // default validator addValidators(map, FileValidator.class, new FileValidator(true), new FileValidator(false)); addValidators(map, URLValidator.class, new URLValidator(true), new URLValidator(false)); addValidators(map, HEXValidator.class, new HEXValidator(true), new HEXValidator(false)); return map; }
java
private static ConcurrentHashMap<Class, List<ParamValidator>> getValidatorsMap() { // use <ConcurrentHashMap> in case validators are added while initializing parameters through <getValidator> method. ConcurrentHashMap<Class, List<ParamValidator>> map = new ConcurrentHashMap(); addValidators(map, ParamValidator.class, new ParamValidator(true), new ParamValidator(false)); // default validator addValidators(map, FileValidator.class, new FileValidator(true), new FileValidator(false)); addValidators(map, URLValidator.class, new URLValidator(true), new URLValidator(false)); addValidators(map, HEXValidator.class, new HEXValidator(true), new HEXValidator(false)); return map; }
[ "private", "static", "ConcurrentHashMap", "<", "Class", ",", "List", "<", "ParamValidator", ">", ">", "getValidatorsMap", "(", ")", "{", "// use <ConcurrentHashMap> in case validators are added while initializing parameters through <getValidator> method.", "ConcurrentHashMap", "<",...
build a map of all Validator implementations by their class type and required value
[ "build", "a", "map", "of", "all", "Validator", "implementations", "by", "their", "class", "type", "and", "required", "value" ]
train
https://github.com/foundation-runtime/configuration/blob/c5bd171a2cca0dc1c8d568f987843ca47c6d1eed/configuration-api/src/main/java/com/cisco/oss/foundation/configuration/validation/params/ParamValidators.java#L402-L412
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/AttributeRenderer.java
AttributeRenderer.renderIconImage
public void renderIconImage(ImageTag.State state, TreeElement elem) { ArrayList al = _lists[TreeHtmlAttributeInfo.HTML_LOCATION_ICON]; assert(al != null); if (al.size() == 0) return; int cnt = al.size(); for (int i = 0; i < cnt; i++) { TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(i); state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, attr.getAttribute(), attr.getValue()); } }
java
public void renderIconImage(ImageTag.State state, TreeElement elem) { ArrayList al = _lists[TreeHtmlAttributeInfo.HTML_LOCATION_ICON]; assert(al != null); if (al.size() == 0) return; int cnt = al.size(); for (int i = 0; i < cnt; i++) { TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(i); state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, attr.getAttribute(), attr.getValue()); } }
[ "public", "void", "renderIconImage", "(", "ImageTag", ".", "State", "state", ",", "TreeElement", "elem", ")", "{", "ArrayList", "al", "=", "_lists", "[", "TreeHtmlAttributeInfo", ".", "HTML_LOCATION_ICON", "]", ";", "assert", "(", "al", "!=", "null", ")", ";...
This method will render the values assocated with the Icon Image. @param state @param elem
[ "This", "method", "will", "render", "the", "values", "assocated", "with", "the", "Icon", "Image", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/AttributeRenderer.java#L168-L181
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java
AnnotationTypeBuilder.buildAnnotationTypeDoc
public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws Exception { contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") + " " + annotationTypeDoc.name()); Content annotationContentTree = writer.getAnnotationContentHeader(); buildChildren(node, annotationContentTree); contentTree.addContent(annotationContentTree); writer.addFooter(contentTree); writer.printDocument(contentTree); writer.close(); copyDocFiles(); }
java
public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws Exception { contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") + " " + annotationTypeDoc.name()); Content annotationContentTree = writer.getAnnotationContentHeader(); buildChildren(node, annotationContentTree); contentTree.addContent(annotationContentTree); writer.addFooter(contentTree); writer.printDocument(contentTree); writer.close(); copyDocFiles(); }
[ "public", "void", "buildAnnotationTypeDoc", "(", "XMLNode", "node", ",", "Content", "contentTree", ")", "throws", "Exception", "{", "contentTree", "=", "writer", ".", "getHeader", "(", "configuration", ".", "getText", "(", "\"doclet.AnnotationType\"", ")", "+", "\...
Build the annotation type documentation. @param node the XML element that specifies which components to document @param contentTree the content tree to which the documentation will be added
[ "Build", "the", "annotation", "type", "documentation", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java#L118-L128
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnnotationPropertyRangeAxiomImpl_CustomFieldSerializer.java
OWLAnnotationPropertyRangeAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLAnnotationPropertyRangeAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLAnnotationPropertyRangeAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLAnnotationPropertyRangeAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", ...
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnnotationPropertyRangeAxiomImpl_CustomFieldSerializer.java#L99-L102
EdwardRaff/JSAT
JSAT/src/jsat/io/JSATData.java
JSATData.loadClassification
public static ClassificationDataSet loadClassification(InputStream inRaw, DataStore backingStore) throws IOException { return (ClassificationDataSet) load(inRaw, backingStore); }
java
public static ClassificationDataSet loadClassification(InputStream inRaw, DataStore backingStore) throws IOException { return (ClassificationDataSet) load(inRaw, backingStore); }
[ "public", "static", "ClassificationDataSet", "loadClassification", "(", "InputStream", "inRaw", ",", "DataStore", "backingStore", ")", "throws", "IOException", "{", "return", "(", "ClassificationDataSet", ")", "load", "(", "inRaw", ",", "backingStore", ")", ";", "}"...
Loads in a JSAT dataset as a {@link ClassificationDataSet}. An exception will be thrown if the original dataset in the file was not a {@link ClassificationDataSet}. @param inRaw the input stream, caller should buffer it @param backingStore the data store to put all data points in @return a ClassificationDataSet object @throws IOException @throws ClassCastException if the original dataset was a not a ClassificationDataSet
[ "Loads", "in", "a", "JSAT", "dataset", "as", "a", "{", "@link", "ClassificationDataSet", "}", ".", "An", "exception", "will", "be", "thrown", "if", "the", "original", "dataset", "in", "the", "file", "was", "not", "a", "{", "@link", "ClassificationDataSet", ...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/JSATData.java#L568-L571
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/i18n/Messages.java
Messages.get
public String get(String key, Object... arguments) { if (this.bundle.containsKey(key)) { return MessageFormat.format(this.bundle.getString(key), arguments); } else if (this.defaults.containsKey(key)) { return MessageFormat.format(this.defaults.get(key), arguments); } else { // Ignore anything else } return ""; }
java
public String get(String key, Object... arguments) { if (this.bundle.containsKey(key)) { return MessageFormat.format(this.bundle.getString(key), arguments); } else if (this.defaults.containsKey(key)) { return MessageFormat.format(this.defaults.get(key), arguments); } else { // Ignore anything else } return ""; }
[ "public", "String", "get", "(", "String", "key", ",", "Object", "...", "arguments", ")", "{", "if", "(", "this", ".", "bundle", ".", "containsKey", "(", "key", ")", ")", "{", "return", "MessageFormat", ".", "format", "(", "this", ".", "bundle", ".", ...
Returns a localized value for a given key stored in messages_xx.properties and passing the given arguments @param key The key to look up the localized value @param arguments The arguments to use @return The localized value or null value if the given key is not configured
[ "Returns", "a", "localized", "value", "for", "a", "given", "key", "stored", "in", "messages_xx", ".", "properties", "and", "passing", "the", "given", "arguments" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/i18n/Messages.java#L54-L64
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/HarIndex.java
HarIndex.findEntry
public IndexEntry findEntry(String partName, long partFileOffset) { for (IndexEntry e: entries) { boolean nameMatch = partName.equals(e.partFileName); boolean inRange = (partFileOffset >= e.startOffset) && (partFileOffset < e.startOffset + e.length); if (nameMatch && inRange) { return e; } } return null; }
java
public IndexEntry findEntry(String partName, long partFileOffset) { for (IndexEntry e: entries) { boolean nameMatch = partName.equals(e.partFileName); boolean inRange = (partFileOffset >= e.startOffset) && (partFileOffset < e.startOffset + e.length); if (nameMatch && inRange) { return e; } } return null; }
[ "public", "IndexEntry", "findEntry", "(", "String", "partName", ",", "long", "partFileOffset", ")", "{", "for", "(", "IndexEntry", "e", ":", "entries", ")", "{", "boolean", "nameMatch", "=", "partName", ".", "equals", "(", "e", ".", "partFileName", ")", ";...
Finds the index entry corresponding to a HAR partFile at an offset. @param partName The name of the part file (part-*). @param partFileOffset The offset into the part file. @return The entry corresponding to partName:partFileOffset.
[ "Finds", "the", "index", "entry", "corresponding", "to", "a", "HAR", "partFile", "at", "an", "offset", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/HarIndex.java#L151-L161
bushidowallet/bushido-java-service
bushido-service-lib/src/main/java/com/bccapi/bitlib/util/HexUtils.java
HexUtils.toHex
public static String toHex(byte[] bytes, String separator) { return toHex(bytes, 0, bytes.length, separator); }
java
public static String toHex(byte[] bytes, String separator) { return toHex(bytes, 0, bytes.length, separator); }
[ "public", "static", "String", "toHex", "(", "byte", "[", "]", "bytes", ",", "String", "separator", ")", "{", "return", "toHex", "(", "bytes", ",", "0", ",", "bytes", ".", "length", ",", "separator", ")", ";", "}" ]
Encodes an array of bytes as hex symbols. @param bytes the array of bytes to encode @param separator the separator to use between two bytes, can be null @return the resulting hex string
[ "Encodes", "an", "array", "of", "bytes", "as", "hex", "symbols", "." ]
train
https://github.com/bushidowallet/bushido-java-service/blob/e1a0157527e57459b509718044d2df44084876a2/bushido-service-lib/src/main/java/com/bccapi/bitlib/util/HexUtils.java#L44-L46
apache/incubator-druid
sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java
DruidQuery.computeDimensions
private static List<DimensionExpression> computeDimensions( final PartialDruidQuery partialQuery, final PlannerContext plannerContext, final DruidQuerySignature querySignature ) { final Aggregate aggregate = Preconditions.checkNotNull(partialQuery.getAggregate()); final List<DimensionExpression> dimensions = new ArrayList<>(); final String outputNamePrefix = Calcites.findUnusedPrefix( "d", new TreeSet<>(querySignature.getRowSignature().getRowOrder()) ); int outputNameCounter = 0; for (int i : aggregate.getGroupSet()) { // Dimension might need to create virtual columns. Avoid giving it a name that would lead to colliding columns. final RexNode rexNode = Expressions.fromFieldAccess( querySignature.getRowSignature(), partialQuery.getSelectProject(), i ); final DruidExpression druidExpression = Expressions.toDruidExpression( plannerContext, querySignature.getRowSignature(), rexNode ); if (druidExpression == null) { throw new CannotBuildQueryException(aggregate, rexNode); } final SqlTypeName sqlTypeName = rexNode.getType().getSqlTypeName(); final ValueType outputType = Calcites.getValueTypeForSqlTypeName(sqlTypeName); if (outputType == null || outputType == ValueType.COMPLEX) { // Can't group on unknown or COMPLEX types. throw new CannotBuildQueryException(aggregate, rexNode); } final VirtualColumn virtualColumn; final String dimOutputName; if (!druidExpression.isSimpleExtraction()) { virtualColumn = querySignature.getOrCreateVirtualColumnForExpression( plannerContext, druidExpression, sqlTypeName ); dimOutputName = virtualColumn.getOutputName(); } else { dimOutputName = outputNamePrefix + outputNameCounter++; } dimensions.add(new DimensionExpression(dimOutputName, druidExpression, outputType)); } return dimensions; }
java
private static List<DimensionExpression> computeDimensions( final PartialDruidQuery partialQuery, final PlannerContext plannerContext, final DruidQuerySignature querySignature ) { final Aggregate aggregate = Preconditions.checkNotNull(partialQuery.getAggregate()); final List<DimensionExpression> dimensions = new ArrayList<>(); final String outputNamePrefix = Calcites.findUnusedPrefix( "d", new TreeSet<>(querySignature.getRowSignature().getRowOrder()) ); int outputNameCounter = 0; for (int i : aggregate.getGroupSet()) { // Dimension might need to create virtual columns. Avoid giving it a name that would lead to colliding columns. final RexNode rexNode = Expressions.fromFieldAccess( querySignature.getRowSignature(), partialQuery.getSelectProject(), i ); final DruidExpression druidExpression = Expressions.toDruidExpression( plannerContext, querySignature.getRowSignature(), rexNode ); if (druidExpression == null) { throw new CannotBuildQueryException(aggregate, rexNode); } final SqlTypeName sqlTypeName = rexNode.getType().getSqlTypeName(); final ValueType outputType = Calcites.getValueTypeForSqlTypeName(sqlTypeName); if (outputType == null || outputType == ValueType.COMPLEX) { // Can't group on unknown or COMPLEX types. throw new CannotBuildQueryException(aggregate, rexNode); } final VirtualColumn virtualColumn; final String dimOutputName; if (!druidExpression.isSimpleExtraction()) { virtualColumn = querySignature.getOrCreateVirtualColumnForExpression( plannerContext, druidExpression, sqlTypeName ); dimOutputName = virtualColumn.getOutputName(); } else { dimOutputName = outputNamePrefix + outputNameCounter++; } dimensions.add(new DimensionExpression(dimOutputName, druidExpression, outputType)); } return dimensions; }
[ "private", "static", "List", "<", "DimensionExpression", ">", "computeDimensions", "(", "final", "PartialDruidQuery", "partialQuery", ",", "final", "PlannerContext", "plannerContext", ",", "final", "DruidQuerySignature", "querySignature", ")", "{", "final", "Aggregate", ...
Returns dimensions corresponding to {@code aggregate.getGroupSet()}, in the same order. @param partialQuery partial query @param plannerContext planner context @param querySignature source row signature and re-usable virtual column references @return dimensions @throws CannotBuildQueryException if dimensions cannot be computed
[ "Returns", "dimensions", "corresponding", "to", "{", "@code", "aggregate", ".", "getGroupSet", "()", "}", "in", "the", "same", "order", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java#L450-L505
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/jni/AnalogInputMonitor.java
AnalogInputMonitor.pinValueChangeCallback
@SuppressWarnings("unchecked") private static void pinValueChangeCallback(int pin, double value) { Vector<AnalogInputListener> listenersClone; listenersClone = (Vector<AnalogInputListener>) listeners.clone(); for (int i = 0; i < listenersClone.size(); i++) { AnalogInputListener listener = listenersClone.elementAt(i); if(listener != null) { AnalogInputEvent event = new AnalogInputEvent(listener, pin, value); listener.pinValueChange(event); } } }
java
@SuppressWarnings("unchecked") private static void pinValueChangeCallback(int pin, double value) { Vector<AnalogInputListener> listenersClone; listenersClone = (Vector<AnalogInputListener>) listeners.clone(); for (int i = 0; i < listenersClone.size(); i++) { AnalogInputListener listener = listenersClone.elementAt(i); if(listener != null) { AnalogInputEvent event = new AnalogInputEvent(listener, pin, value); listener.pinValueChange(event); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "void", "pinValueChangeCallback", "(", "int", "pin", ",", "double", "value", ")", "{", "Vector", "<", "AnalogInputListener", ">", "listenersClone", ";", "listenersClone", "=", "(", "Vector", ...
<p> This method is provided as the callback handler for the Pi4J native library to invoke when a GPIO analog input calue change is detected. This method should not be called from any Java consumers. (Thus it is marked as a private method.) </p> @param pin GPIO pin number @param value New GPIO analog input value
[ "<p", ">", "This", "method", "is", "provided", "as", "the", "callback", "handler", "for", "the", "Pi4J", "native", "library", "to", "invoke", "when", "a", "GPIO", "analog", "input", "calue", "change", "is", "detected", ".", "This", "method", "should", "not...
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/jni/AnalogInputMonitor.java#L107-L120
Azure/azure-sdk-for-java
cognitiveservices/data-plane/search/bingnewssearch/src/main/java/com/microsoft/azure/cognitiveservices/search/newssearch/implementation/BingNewsImpl.java
BingNewsImpl.trendingWithServiceResponseAsync
public Observable<ServiceResponse<TrendingTopics>> trendingWithServiceResponseAsync(TrendingOptionalParameter trendingOptionalParameter) { final String acceptLanguage = trendingOptionalParameter != null ? trendingOptionalParameter.acceptLanguage() : null; final String userAgent = trendingOptionalParameter != null ? trendingOptionalParameter.userAgent() : this.client.userAgent(); final String clientId = trendingOptionalParameter != null ? trendingOptionalParameter.clientId() : null; final String clientIp = trendingOptionalParameter != null ? trendingOptionalParameter.clientIp() : null; final String location = trendingOptionalParameter != null ? trendingOptionalParameter.location() : null; final String countryCode = trendingOptionalParameter != null ? trendingOptionalParameter.countryCode() : null; final Integer count = trendingOptionalParameter != null ? trendingOptionalParameter.count() : null; final String market = trendingOptionalParameter != null ? trendingOptionalParameter.market() : null; final Integer offset = trendingOptionalParameter != null ? trendingOptionalParameter.offset() : null; final SafeSearch safeSearch = trendingOptionalParameter != null ? trendingOptionalParameter.safeSearch() : null; final String setLang = trendingOptionalParameter != null ? trendingOptionalParameter.setLang() : null; final Long since = trendingOptionalParameter != null ? trendingOptionalParameter.since() : null; final String sortBy = trendingOptionalParameter != null ? trendingOptionalParameter.sortBy() : null; final Boolean textDecorations = trendingOptionalParameter != null ? trendingOptionalParameter.textDecorations() : null; final TextFormat textFormat = trendingOptionalParameter != null ? trendingOptionalParameter.textFormat() : null; return trendingWithServiceResponseAsync(acceptLanguage, userAgent, clientId, clientIp, location, countryCode, count, market, offset, safeSearch, setLang, since, sortBy, textDecorations, textFormat); }
java
public Observable<ServiceResponse<TrendingTopics>> trendingWithServiceResponseAsync(TrendingOptionalParameter trendingOptionalParameter) { final String acceptLanguage = trendingOptionalParameter != null ? trendingOptionalParameter.acceptLanguage() : null; final String userAgent = trendingOptionalParameter != null ? trendingOptionalParameter.userAgent() : this.client.userAgent(); final String clientId = trendingOptionalParameter != null ? trendingOptionalParameter.clientId() : null; final String clientIp = trendingOptionalParameter != null ? trendingOptionalParameter.clientIp() : null; final String location = trendingOptionalParameter != null ? trendingOptionalParameter.location() : null; final String countryCode = trendingOptionalParameter != null ? trendingOptionalParameter.countryCode() : null; final Integer count = trendingOptionalParameter != null ? trendingOptionalParameter.count() : null; final String market = trendingOptionalParameter != null ? trendingOptionalParameter.market() : null; final Integer offset = trendingOptionalParameter != null ? trendingOptionalParameter.offset() : null; final SafeSearch safeSearch = trendingOptionalParameter != null ? trendingOptionalParameter.safeSearch() : null; final String setLang = trendingOptionalParameter != null ? trendingOptionalParameter.setLang() : null; final Long since = trendingOptionalParameter != null ? trendingOptionalParameter.since() : null; final String sortBy = trendingOptionalParameter != null ? trendingOptionalParameter.sortBy() : null; final Boolean textDecorations = trendingOptionalParameter != null ? trendingOptionalParameter.textDecorations() : null; final TextFormat textFormat = trendingOptionalParameter != null ? trendingOptionalParameter.textFormat() : null; return trendingWithServiceResponseAsync(acceptLanguage, userAgent, clientId, clientIp, location, countryCode, count, market, offset, safeSearch, setLang, since, sortBy, textDecorations, textFormat); }
[ "public", "Observable", "<", "ServiceResponse", "<", "TrendingTopics", ">", ">", "trendingWithServiceResponseAsync", "(", "TrendingOptionalParameter", "trendingOptionalParameter", ")", "{", "final", "String", "acceptLanguage", "=", "trendingOptionalParameter", "!=", "null", ...
The News Trending Topics API lets lets you search on Bing and get back a list of trending news topics that are currently trending on Bing. This section provides technical details about the query parameters and headers that you use to request news and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the web for news](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-news-search/search-the-web). @param trendingOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TrendingTopics object
[ "The", "News", "Trending", "Topics", "API", "lets", "lets", "you", "search", "on", "Bing", "and", "get", "back", "a", "list", "of", "trending", "news", "topics", "that", "are", "currently", "trending", "on", "Bing", ".", "This", "section", "provides", "tec...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingnewssearch/src/main/java/com/microsoft/azure/cognitiveservices/search/newssearch/implementation/BingNewsImpl.java#L667-L685
pac4j/pac4j
pac4j-http/src/main/java/org/pac4j/http/credentials/CredentialUtil.java
CredentialUtil.encryptMD5
public static String encryptMD5(String data) { try { MessageDigest digest = MessageDigest.getInstance("MD5"); return copyValueOf(Hex.encodeHex(digest.digest(data.getBytes(StandardCharsets.UTF_8)))); } catch (final NoSuchAlgorithmException ex) { throw new TechnicalException("Failed to instantiate an MD5 algorithm", ex); } }
java
public static String encryptMD5(String data) { try { MessageDigest digest = MessageDigest.getInstance("MD5"); return copyValueOf(Hex.encodeHex(digest.digest(data.getBytes(StandardCharsets.UTF_8)))); } catch (final NoSuchAlgorithmException ex) { throw new TechnicalException("Failed to instantiate an MD5 algorithm", ex); } }
[ "public", "static", "String", "encryptMD5", "(", "String", "data", ")", "{", "try", "{", "MessageDigest", "digest", "=", "MessageDigest", ".", "getInstance", "(", "\"MD5\"", ")", ";", "return", "copyValueOf", "(", "Hex", ".", "encodeHex", "(", "digest", ".",...
Defined in rfc 2617 as H(data) = MD5(data); @param data data @return MD5(data)
[ "Defined", "in", "rfc", "2617", "as", "H", "(", "data", ")", "=", "MD5", "(", "data", ")", ";" ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-http/src/main/java/org/pac4j/http/credentials/CredentialUtil.java#L27-L34
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Form.java
Form.addTagID
public void addTagID(String tagID, String name) { if (_focusMap == null) { _focusMap = new HashMap(); } _focusMap.put(tagID, name); }
java
public void addTagID(String tagID, String name) { if (_focusMap == null) { _focusMap = new HashMap(); } _focusMap.put(tagID, name); }
[ "public", "void", "addTagID", "(", "String", "tagID", ",", "String", "name", ")", "{", "if", "(", "_focusMap", "==", "null", ")", "{", "_focusMap", "=", "new", "HashMap", "(", ")", ";", "}", "_focusMap", ".", "put", "(", "tagID", ",", "name", ")", ...
Adds a tagId and name to the Form's focusMap. @param tagID the tagID of a child tag. @param name the name of a child tag.
[ "Adds", "a", "tagId", "and", "name", "to", "the", "Form", "s", "focusMap", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Form.java#L560-L566
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.moveToBack
public void moveToBack(Object parent, String name) { Element parentElement = getGroup(parent); if (parentElement == null) { throw new IllegalArgumentException("moveToBack failed: could not find parent group."); } Element element = getElement(parent, name); if (element == null) { throw new IllegalArgumentException("moveToBack failed: could not find element within group."); } if (parentElement.getFirstChildElement() != element) { parentElement.insertFirst(element); } }
java
public void moveToBack(Object parent, String name) { Element parentElement = getGroup(parent); if (parentElement == null) { throw new IllegalArgumentException("moveToBack failed: could not find parent group."); } Element element = getElement(parent, name); if (element == null) { throw new IllegalArgumentException("moveToBack failed: could not find element within group."); } if (parentElement.getFirstChildElement() != element) { parentElement.insertFirst(element); } }
[ "public", "void", "moveToBack", "(", "Object", "parent", ",", "String", "name", ")", "{", "Element", "parentElement", "=", "getGroup", "(", "parent", ")", ";", "if", "(", "parentElement", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(...
Within a certain group, move an element to the back. All siblings will be rendered after this one. @param object The group wherein to search for the element. @param name The name of the element to move to the back. @since 1.10.0
[ "Within", "a", "certain", "group", "move", "an", "element", "to", "the", "back", ".", "All", "siblings", "will", "be", "rendered", "after", "this", "one", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L381-L395
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkbooksInner.java
WorkbooksInner.getAsync
public Observable<WorkbookInner> getAsync(String resourceGroupName, String resourceName) { return getWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<WorkbookInner>, WorkbookInner>() { @Override public WorkbookInner call(ServiceResponse<WorkbookInner> response) { return response.body(); } }); }
java
public Observable<WorkbookInner> getAsync(String resourceGroupName, String resourceName) { return getWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<WorkbookInner>, WorkbookInner>() { @Override public WorkbookInner call(ServiceResponse<WorkbookInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "WorkbookInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", ".", "map", "(", "new", "Func1", ...
Get a single workbook by its resourceName. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WorkbookInner object
[ "Get", "a", "single", "workbook", "by", "its", "resourceName", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkbooksInner.java#L308-L315
rFlex/SCJavaTools
src/main/java/me/corsin/javatools/reflect/ClassIndexer.java
ClassIndexer.add
public boolean add(T element, Class<?> accessibleClass) { boolean added = false; while (accessibleClass != null && accessibleClass != this.baseClass) { added |= this.addSingle(element, accessibleClass); for (Class<?> interf : accessibleClass.getInterfaces()) { this.addSingle(element, interf); } accessibleClass = accessibleClass.getSuperclass(); } return added; }
java
public boolean add(T element, Class<?> accessibleClass) { boolean added = false; while (accessibleClass != null && accessibleClass != this.baseClass) { added |= this.addSingle(element, accessibleClass); for (Class<?> interf : accessibleClass.getInterfaces()) { this.addSingle(element, interf); } accessibleClass = accessibleClass.getSuperclass(); } return added; }
[ "public", "boolean", "add", "(", "T", "element", ",", "Class", "<", "?", ">", "accessibleClass", ")", "{", "boolean", "added", "=", "false", ";", "while", "(", "accessibleClass", "!=", "null", "&&", "accessibleClass", "!=", "this", ".", "baseClass", ")", ...
Associate the element with accessibleClass and any of the the superclass and interfaces of the accessibleClass until baseClass @param element @param accessibleClass @return
[ "Associate", "the", "element", "with", "accessibleClass", "and", "any", "of", "the", "the", "superclass", "and", "interfaces", "of", "the", "accessibleClass", "until", "baseClass" ]
train
https://github.com/rFlex/SCJavaTools/blob/6bafee99f12a6ad73265db64776edac2bab71f67/src/main/java/me/corsin/javatools/reflect/ClassIndexer.java#L77-L91
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/Utils.java
Utils.getResourceLocation
public static ResourceLocation getResourceLocation(String name) { int index = name.lastIndexOf(':'); String res = null; String modid = null; if (index == -1) { ModContainer container = Loader.instance().activeModContainer(); modid = container != null ? container.getModId() : "minecraft"; res = name; } else { modid = name.substring(0, index); res = name.substring(index + 1); } return new ResourceLocation(modid, res); }
java
public static ResourceLocation getResourceLocation(String name) { int index = name.lastIndexOf(':'); String res = null; String modid = null; if (index == -1) { ModContainer container = Loader.instance().activeModContainer(); modid = container != null ? container.getModId() : "minecraft"; res = name; } else { modid = name.substring(0, index); res = name.substring(index + 1); } return new ResourceLocation(modid, res); }
[ "public", "static", "ResourceLocation", "getResourceLocation", "(", "String", "name", ")", "{", "int", "index", "=", "name", ".", "lastIndexOf", "(", "'", "'", ")", ";", "String", "res", "=", "null", ";", "String", "modid", "=", "null", ";", "if", "(", ...
Creates a {@link ResourceLocation} from the specified name.<br> The name is split on ':' to find the modid.<br> If the modid is not specified, the current active mod container is used, or "minecraft" if none is found. @param name the name @return the resource location
[ "Creates", "a", "{", "@link", "ResourceLocation", "}", "from", "the", "specified", "name", ".", "<br", ">", "The", "name", "is", "split", "on", ":", "to", "find", "the", "modid", ".", "<br", ">", "If", "the", "modid", "is", "not", "specified", "the", ...
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/Utils.java#L107-L125
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/utils/BtcFormat.java
BtcFormat.getMilliInstance
public static BtcFormat getMilliInstance(int scale, int... groups) { return getInstance(MILLICOIN_SCALE, defaultLocale(), scale, boxAsList(groups)); }
java
public static BtcFormat getMilliInstance(int scale, int... groups) { return getInstance(MILLICOIN_SCALE, defaultLocale(), scale, boxAsList(groups)); }
[ "public", "static", "BtcFormat", "getMilliInstance", "(", "int", "scale", ",", "int", "...", "groups", ")", "{", "return", "getInstance", "(", "MILLICOIN_SCALE", ",", "defaultLocale", "(", ")", ",", "scale", ",", "boxAsList", "(", "groups", ")", ")", ";", ...
Return a new millicoin-denominated formatter with the specified fractional decimal placing. The returned object will format and parse values according to the default locale, and will format the fractional part of numbers with the given minimum number of fractional decimal places. Optionally, repeating integer arguments can be passed, each indicating the size of an additional group of fractional decimal places to be used as necessary to avoid rounding, to a limiting precision of satoshis.
[ "Return", "a", "new", "millicoin", "-", "denominated", "formatter", "with", "the", "specified", "fractional", "decimal", "placing", ".", "The", "returned", "object", "will", "format", "and", "parse", "values", "according", "to", "the", "default", "locale", "and"...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L996-L998
groupon/odo
proxyui/src/main/java/com/groupon/odo/controllers/ClientController.java
ClientController.addClient
@RequestMapping(value = "/api/profile/{profileIdentifier}/clients", method = RequestMethod.POST) public @ResponseBody HashMap<String, Object> addClient(Model model, @PathVariable("profileIdentifier") String profileIdentifier, @RequestParam(required = false) String friendlyName) throws Exception { Integer profileId = ControllerUtils.convertProfileIdentifier(profileIdentifier); // make sure client with this name does not already exist if (null != clientService.findClientFromFriendlyName(profileId, friendlyName)) { throw new Exception("Cannot add client. Friendly name already in use."); } Client client = clientService.add(profileId); // set friendly name if it was specified if (friendlyName != null) { clientService.setFriendlyName(profileId, client.getUUID(), friendlyName); client.setFriendlyName(friendlyName); } HashMap<String, Object> valueHash = new HashMap<String, Object>(); valueHash.put("client", client); return valueHash; }
java
@RequestMapping(value = "/api/profile/{profileIdentifier}/clients", method = RequestMethod.POST) public @ResponseBody HashMap<String, Object> addClient(Model model, @PathVariable("profileIdentifier") String profileIdentifier, @RequestParam(required = false) String friendlyName) throws Exception { Integer profileId = ControllerUtils.convertProfileIdentifier(profileIdentifier); // make sure client with this name does not already exist if (null != clientService.findClientFromFriendlyName(profileId, friendlyName)) { throw new Exception("Cannot add client. Friendly name already in use."); } Client client = clientService.add(profileId); // set friendly name if it was specified if (friendlyName != null) { clientService.setFriendlyName(profileId, client.getUUID(), friendlyName); client.setFriendlyName(friendlyName); } HashMap<String, Object> valueHash = new HashMap<String, Object>(); valueHash.put("client", client); return valueHash; }
[ "@", "RequestMapping", "(", "value", "=", "\"/api/profile/{profileIdentifier}/clients\"", ",", "method", "=", "RequestMethod", ".", "POST", ")", "public", "@", "ResponseBody", "HashMap", "<", "String", ",", "Object", ">", "addClient", "(", "Model", "model", ",", ...
Returns a new client id for the profileIdentifier @param model @param profileIdentifier @return json with a new client_id @throws Exception
[ "Returns", "a", "new", "client", "id", "for", "the", "profileIdentifier" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyui/src/main/java/com/groupon/odo/controllers/ClientController.java#L104-L128
esigate/esigate
esigate-server/src/main/java/org/esigate/server/EsigateServer.java
EsigateServer.getProperty
private static String getProperty(String prefix, String name, String defaultValue) { return System.getProperty(prefix + name, defaultValue); }
java
private static String getProperty(String prefix, String name, String defaultValue) { return System.getProperty(prefix + name, defaultValue); }
[ "private", "static", "String", "getProperty", "(", "String", "prefix", ",", "String", "name", ",", "String", "defaultValue", ")", "{", "return", "System", ".", "getProperty", "(", "prefix", "+", "name", ",", "defaultValue", ")", ";", "}" ]
Get String from System properties @param prefix @param name @param defaultValue @return
[ "Get", "String", "from", "System", "properties" ]
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-server/src/main/java/org/esigate/server/EsigateServer.java#L106-L108
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_virtualMac_macAddress_virtualAddress_ipAddress_GET
public OvhVirtualMacManagement serviceName_virtualMac_macAddress_virtualAddress_ipAddress_GET(String serviceName, String macAddress, String ipAddress) throws IOException { String qPath = "/dedicated/server/{serviceName}/virtualMac/{macAddress}/virtualAddress/{ipAddress}"; StringBuilder sb = path(qPath, serviceName, macAddress, ipAddress); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhVirtualMacManagement.class); }
java
public OvhVirtualMacManagement serviceName_virtualMac_macAddress_virtualAddress_ipAddress_GET(String serviceName, String macAddress, String ipAddress) throws IOException { String qPath = "/dedicated/server/{serviceName}/virtualMac/{macAddress}/virtualAddress/{ipAddress}"; StringBuilder sb = path(qPath, serviceName, macAddress, ipAddress); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhVirtualMacManagement.class); }
[ "public", "OvhVirtualMacManagement", "serviceName_virtualMac_macAddress_virtualAddress_ipAddress_GET", "(", "String", "serviceName", ",", "String", "macAddress", ",", "String", "ipAddress", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{service...
Get this object properties REST: GET /dedicated/server/{serviceName}/virtualMac/{macAddress}/virtualAddress/{ipAddress} @param serviceName [required] The internal name of your dedicated server @param macAddress [required] Virtual MAC address in 00:00:00:00:00:00 format @param ipAddress [required] IP address
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L574-L579
lucee/Lucee
core/src/main/java/lucee/runtime/converter/ScriptConverter.java
ScriptConverter._serializeArray
private void _serializeArray(Array array, StringBuilder sb, Set<Object> done) throws ConverterException { _serializeList(array.toList(), sb, done); }
java
private void _serializeArray(Array array, StringBuilder sb, Set<Object> done) throws ConverterException { _serializeList(array.toList(), sb, done); }
[ "private", "void", "_serializeArray", "(", "Array", "array", ",", "StringBuilder", "sb", ",", "Set", "<", "Object", ">", "done", ")", "throws", "ConverterException", "{", "_serializeList", "(", "array", ".", "toList", "(", ")", ",", "sb", ",", "done", ")",...
serialize a Array @param array Array to serialize @param sb @param done @throws ConverterException
[ "serialize", "a", "Array" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/ScriptConverter.java#L151-L153
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/AwardEmojiApi.java
AwardEmojiApi.deleteSnippetAwardEmoji
public void deleteSnippetAwardEmoji(Object projectIdOrPath, Integer snippetId, Integer awardId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId, "award_emoji", awardId); }
java
public void deleteSnippetAwardEmoji(Object projectIdOrPath, Integer snippetId, Integer awardId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId, "award_emoji", awardId); }
[ "public", "void", "deleteSnippetAwardEmoji", "(", "Object", "projectIdOrPath", ",", "Integer", "snippetId", ",", "Integer", "awardId", ")", "throws", "GitLabApiException", "{", "delete", "(", "Response", ".", "Status", ".", "NO_CONTENT", ",", "null", ",", "\"proje...
Delete an award emoji from the specified snippet. <pre><code>GitLab Endpoint: DELETE /projects/:id/snippets/:snippet_id/award_emoji/:award_id</code></pre> @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path @param snippetId the snippet ID to delete the award emoji from @param awardId the ID of the award emoji to delete @throws GitLabApiException if any exception occurs
[ "Delete", "an", "award", "emoji", "from", "the", "specified", "snippet", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/AwardEmojiApi.java#L269-L272
minio/minio-java
api/src/main/java/io/minio/messages/XmlEntity.java
XmlEntity.parseXml
protected void parseXml(Reader reader, XmlNamespaceDictionary namespaceDictionary) throws IOException, XmlPullParserException { this.xmlPullParser.setInput(reader); Xml.parseElement(this.xmlPullParser, this, namespaceDictionary, null); }
java
protected void parseXml(Reader reader, XmlNamespaceDictionary namespaceDictionary) throws IOException, XmlPullParserException { this.xmlPullParser.setInput(reader); Xml.parseElement(this.xmlPullParser, this, namespaceDictionary, null); }
[ "protected", "void", "parseXml", "(", "Reader", "reader", ",", "XmlNamespaceDictionary", "namespaceDictionary", ")", "throws", "IOException", ",", "XmlPullParserException", "{", "this", ".", "xmlPullParser", ".", "setInput", "(", "reader", ")", ";", "Xml", ".", "p...
Parses content from given reader input stream and namespace dictionary.
[ "Parses", "content", "from", "given", "reader", "input", "stream", "and", "namespace", "dictionary", "." ]
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/messages/XmlEntity.java#L72-L76
lessthanoptimal/BoofCV
integration/boofcv-swing/src/main/java/boofcv/gui/learning/ConfusionMatrixPanel.java
ConfusionMatrixPanel.whatIsAtPoint
public LocationInfo whatIsAtPoint( int pixelX , int pixelY , LocationInfo output ) { if( output == null ) output = new LocationInfo(); int numCategories = confusion.getNumRows(); synchronized ( this ) { if( pixelX >= gridWidth ) { output.insideMatrix = false; output.col = output.row = pixelY*numCategories/gridHeight; } else { output.insideMatrix = true; output.row = pixelY*numCategories/gridHeight; output.col = pixelX*numCategories/gridWidth; } } return output; }
java
public LocationInfo whatIsAtPoint( int pixelX , int pixelY , LocationInfo output ) { if( output == null ) output = new LocationInfo(); int numCategories = confusion.getNumRows(); synchronized ( this ) { if( pixelX >= gridWidth ) { output.insideMatrix = false; output.col = output.row = pixelY*numCategories/gridHeight; } else { output.insideMatrix = true; output.row = pixelY*numCategories/gridHeight; output.col = pixelX*numCategories/gridWidth; } } return output; }
[ "public", "LocationInfo", "whatIsAtPoint", "(", "int", "pixelX", ",", "int", "pixelY", ",", "LocationInfo", "output", ")", "{", "if", "(", "output", "==", "null", ")", "output", "=", "new", "LocationInfo", "(", ")", ";", "int", "numCategories", "=", "confu...
Use to sample the panel to see what is being displayed at the location clicked. All coordinates are in panel coordinates. @param pixelX x-axis in panel coordinates @param pixelY y-axis in panel coordinates @param output (Optional) storage for output. @return Information on what is at the specified location
[ "Use", "to", "sample", "the", "panel", "to", "see", "what", "is", "being", "displayed", "at", "the", "location", "clicked", ".", "All", "coordinates", "are", "in", "panel", "coordinates", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/learning/ConfusionMatrixPanel.java#L301-L319
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java
IndexChangeAdapters.forNodeTypes
public static IndexChangeAdapter forNodeTypes( String propertyName, ExecutionContext context, NodeTypePredicate matcher, String workspaceName, ProvidedIndex<?> index ) { return new NodeTypesChangeAdapter(propertyName, context, matcher, workspaceName, index); }
java
public static IndexChangeAdapter forNodeTypes( String propertyName, ExecutionContext context, NodeTypePredicate matcher, String workspaceName, ProvidedIndex<?> index ) { return new NodeTypesChangeAdapter(propertyName, context, matcher, workspaceName, index); }
[ "public", "static", "IndexChangeAdapter", "forNodeTypes", "(", "String", "propertyName", ",", "ExecutionContext", "context", ",", "NodeTypePredicate", "matcher", ",", "String", "workspaceName", ",", "ProvidedIndex", "<", "?", ">", "index", ")", "{", "return", "new",...
Create an {@link IndexChangeAdapter} implementation that handles node type information. @param propertyName a symbolic name of the property that will be sent to the {@link ProvidedIndex} when the adapter notices that there are either primary type of mixin type changes. @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 local index that should be used; may not be null @return the new {@link IndexChangeAdapter}; never null
[ "Create", "an", "{", "@link", "IndexChangeAdapter", "}", "implementation", "that", "handles", "node", "type", "information", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java#L237-L243
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/paintable/Circle.java
Circle.setRadius
public void setRadius(float radius) { if (getOriginalLocation() != null) { Bbox oldBounds = (Bbox) getOriginalLocation(); Bbox newBounds = (Bbox) oldBounds.clone(); newBounds.setWidth(2 * radius); newBounds.setHeight(2 * radius); newBounds.setCenterPoint(oldBounds.getCenterPoint()); setOriginalLocation(newBounds); } else { setOriginalLocation(new Bbox(0, 0, 2 * radius, 2 * radius)); } }
java
public void setRadius(float radius) { if (getOriginalLocation() != null) { Bbox oldBounds = (Bbox) getOriginalLocation(); Bbox newBounds = (Bbox) oldBounds.clone(); newBounds.setWidth(2 * radius); newBounds.setHeight(2 * radius); newBounds.setCenterPoint(oldBounds.getCenterPoint()); setOriginalLocation(newBounds); } else { setOriginalLocation(new Bbox(0, 0, 2 * radius, 2 * radius)); } }
[ "public", "void", "setRadius", "(", "float", "radius", ")", "{", "if", "(", "getOriginalLocation", "(", ")", "!=", "null", ")", "{", "Bbox", "oldBounds", "=", "(", "Bbox", ")", "getOriginalLocation", "(", ")", ";", "Bbox", "newBounds", "=", "(", "Bbox", ...
Set circle radius in world coordinates. @param radius circle radius in world units
[ "Set", "circle", "radius", "in", "world", "coordinates", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/paintable/Circle.java#L107-L118
vatbub/common
updater/src/main/java/com/github/vatbub/common/updater/UpdateChecker.java
UpdateChecker.downloadAndInstallUpdate
public static boolean downloadAndInstallUpdate(UpdateInfo updateToInstall, UpdateProgressDialog gui, boolean launchUpdateAfterInstall, @SuppressWarnings("SameParameterValue") boolean deleteOldVersion, String... params) throws IllegalStateException, IOException { return downloadAndInstallUpdate(updateToInstall, gui, launchUpdateAfterInstall, deleteOldVersion, false, params); }
java
public static boolean downloadAndInstallUpdate(UpdateInfo updateToInstall, UpdateProgressDialog gui, boolean launchUpdateAfterInstall, @SuppressWarnings("SameParameterValue") boolean deleteOldVersion, String... params) throws IllegalStateException, IOException { return downloadAndInstallUpdate(updateToInstall, gui, launchUpdateAfterInstall, deleteOldVersion, false, params); }
[ "public", "static", "boolean", "downloadAndInstallUpdate", "(", "UpdateInfo", "updateToInstall", ",", "UpdateProgressDialog", "gui", ",", "boolean", "launchUpdateAfterInstall", ",", "@", "SuppressWarnings", "(", "\"SameParameterValue\"", ")", "boolean", "deleteOldVersion", ...
Downloads the specified update as a jar-file and launches it. The jar file will be saved at the same location as the currently executed file but will not replace it (unless it has the same filename but this will never happen) @param updateToInstall The {@link UpdateInfo}-object that contains the information about the update to download @param gui The reference to an {@link UpdateProgressDialog} that displays the current update status. @param launchUpdateAfterInstall If {@code true}, the downloaded file will be launched after the download succeeds. @param deleteOldVersion If {@code true}, the old app version will be automatically deleted once the new version is downloaded. <b>Please note</b> that the file can't delete itself on some operating systems. Therefore, the deletion is done by the updated file. To actually delete the file, you need to call {@link #completeUpdate(String[])} in your applications main method. @param params Additional commandline parameters to be submitted to the new application version. @return {@code true} if the download finished successfully, {@code false} if the download was cancelled using {@link #cancelDownloadAndLaunch()} @throws IllegalStateException if maven fails to download or copy the new artifact. @throws IOException If the updated artifact cannot be launched. @see #completeUpdate(String[])
[ "Downloads", "the", "specified", "update", "as", "a", "jar", "-", "file", "and", "launches", "it", ".", "The", "jar", "file", "will", "be", "saved", "at", "the", "same", "location", "as", "the", "currently", "executed", "file", "but", "will", "not", "rep...
train
https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/updater/src/main/java/com/github/vatbub/common/updater/UpdateChecker.java#L484-L487
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/auth/AuthenticatorFactory.java
AuthenticatorFactory.createPersonaAuthenticator
public static Authenticator createPersonaAuthenticator(String assertion) { Map<String, String> params = new HashMap<String, String>(); params.put("assertion", assertion); return new TokenAuthenticator("_persona", params); }
java
public static Authenticator createPersonaAuthenticator(String assertion) { Map<String, String> params = new HashMap<String, String>(); params.put("assertion", assertion); return new TokenAuthenticator("_persona", params); }
[ "public", "static", "Authenticator", "createPersonaAuthenticator", "(", "String", "assertion", ")", "{", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "params", ".", "put", "(",...
/* Creates an Authenticator that knows how to do Persona authentication. @param assertion Persona Assertion
[ "/", "*", "Creates", "an", "Authenticator", "that", "knows", "how", "to", "do", "Persona", "authentication", "." ]
train
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/auth/AuthenticatorFactory.java#L50-L54
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.setCacheEventJournalConfigs
public Config setCacheEventJournalConfigs(Map<String, EventJournalConfig> eventJournalConfigs) { this.cacheEventJournalConfigs.clear(); this.cacheEventJournalConfigs.putAll(eventJournalConfigs); for (Entry<String, EventJournalConfig> entry : eventJournalConfigs.entrySet()) { entry.getValue().setCacheName(entry.getKey()); } return this; }
java
public Config setCacheEventJournalConfigs(Map<String, EventJournalConfig> eventJournalConfigs) { this.cacheEventJournalConfigs.clear(); this.cacheEventJournalConfigs.putAll(eventJournalConfigs); for (Entry<String, EventJournalConfig> entry : eventJournalConfigs.entrySet()) { entry.getValue().setCacheName(entry.getKey()); } return this; }
[ "public", "Config", "setCacheEventJournalConfigs", "(", "Map", "<", "String", ",", "EventJournalConfig", ">", "eventJournalConfigs", ")", "{", "this", ".", "cacheEventJournalConfigs", ".", "clear", "(", ")", ";", "this", ".", "cacheEventJournalConfigs", ".", "putAll...
Sets the map of cache event journal configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param eventJournalConfigs the cache event journal configuration map to set @return this config instance
[ "Sets", "the", "map", "of", "cache", "event", "journal", "configurations", "mapped", "by", "config", "name", ".", "The", "config", "name", "may", "be", "a", "pattern", "with", "which", "the", "configuration", "will", "be", "obtained", "in", "the", "future", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L3139-L3146
forge/furnace
maven-plugin/src/main/java/org/jboss/forge/furnace/maven/plugin/GenerateDOTMojo.java
GenerateDOTMojo.generateDOTFile
private File generateDOTFile(AddonDependencyResolver addonResolver, AddonId id, String fileName) { File parent = new File(outputDirectory); parent.mkdirs(); File file = new File(parent, fileName); getLog().info("Generating " + file); AddonInfo addonInfo = addonResolver.resolveAddonDependencyHierarchy(id); toDOT(file, toGraph(addonResolver, addonInfo)); return file; }
java
private File generateDOTFile(AddonDependencyResolver addonResolver, AddonId id, String fileName) { File parent = new File(outputDirectory); parent.mkdirs(); File file = new File(parent, fileName); getLog().info("Generating " + file); AddonInfo addonInfo = addonResolver.resolveAddonDependencyHierarchy(id); toDOT(file, toGraph(addonResolver, addonInfo)); return file; }
[ "private", "File", "generateDOTFile", "(", "AddonDependencyResolver", "addonResolver", ",", "AddonId", "id", ",", "String", "fileName", ")", "{", "File", "parent", "=", "new", "File", "(", "outputDirectory", ")", ";", "parent", ".", "mkdirs", "(", ")", ";", ...
Generates the DOT file for a given addonId @param addonResolver @param id @return generated file
[ "Generates", "the", "DOT", "file", "for", "a", "given", "addonId" ]
train
https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/maven-plugin/src/main/java/org/jboss/forge/furnace/maven/plugin/GenerateDOTMojo.java#L167-L176
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/BaseRTMPHandler.java
BaseRTMPHandler.handlePendingCallResult
protected void handlePendingCallResult(RTMPConnection conn, Invoke invoke) { final IServiceCall call = invoke.getCall(); final IPendingServiceCall pendingCall = conn.retrievePendingCall(invoke.getTransactionId()); if (pendingCall != null) { // The client sent a response to a previously made call. Object[] args = call.getArguments(); if (args != null && args.length > 0) { // TODO: can a client return multiple results? pendingCall.setResult(args[0]); } Set<IPendingServiceCallback> callbacks = pendingCall.getCallbacks(); if (!callbacks.isEmpty()) { HashSet<IPendingServiceCallback> tmp = new HashSet<>(); tmp.addAll(callbacks); for (IPendingServiceCallback callback : tmp) { try { callback.resultReceived(pendingCall); } catch (Exception e) { log.error("Error while executing callback {}", callback, e); } } } } }
java
protected void handlePendingCallResult(RTMPConnection conn, Invoke invoke) { final IServiceCall call = invoke.getCall(); final IPendingServiceCall pendingCall = conn.retrievePendingCall(invoke.getTransactionId()); if (pendingCall != null) { // The client sent a response to a previously made call. Object[] args = call.getArguments(); if (args != null && args.length > 0) { // TODO: can a client return multiple results? pendingCall.setResult(args[0]); } Set<IPendingServiceCallback> callbacks = pendingCall.getCallbacks(); if (!callbacks.isEmpty()) { HashSet<IPendingServiceCallback> tmp = new HashSet<>(); tmp.addAll(callbacks); for (IPendingServiceCallback callback : tmp) { try { callback.resultReceived(pendingCall); } catch (Exception e) { log.error("Error while executing callback {}", callback, e); } } } } }
[ "protected", "void", "handlePendingCallResult", "(", "RTMPConnection", "conn", ",", "Invoke", "invoke", ")", "{", "final", "IServiceCall", "call", "=", "invoke", ".", "getCall", "(", ")", ";", "final", "IPendingServiceCall", "pendingCall", "=", "conn", ".", "ret...
Handler for pending call result. Dispatches results to all pending call handlers. @param conn Connection @param invoke Pending call result event context
[ "Handler", "for", "pending", "call", "result", ".", "Dispatches", "results", "to", "all", "pending", "call", "handlers", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/BaseRTMPHandler.java#L234-L257
PawelAdamski/HttpClientMock
src/main/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilder.java
HttpClientMockBuilder.withParameter
public HttpClientMockBuilder withParameter(String name, String value) { return withParameter(name, equalTo(value)); }
java
public HttpClientMockBuilder withParameter(String name, String value) { return withParameter(name, equalTo(value)); }
[ "public", "HttpClientMockBuilder", "withParameter", "(", "String", "name", ",", "String", "value", ")", "{", "return", "withParameter", "(", "name", ",", "equalTo", "(", "value", ")", ")", ";", "}" ]
Adds parameter condition. Parameter must be equal to provided value. @param name parameter name @param value expected parameter value @return condition builder
[ "Adds", "parameter", "condition", ".", "Parameter", "must", "be", "equal", "to", "provided", "value", "." ]
train
https://github.com/PawelAdamski/HttpClientMock/blob/0205498434bbc0c78c187a51181cac9b266a28fb/src/main/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilder.java#L75-L77
protostuff/protostuff
protostuff-msgpack/src/main/java/io/protostuff/MsgpackIOUtil.java
MsgpackIOUtil.mergeFrom
public static <T> void mergeFrom(MessageUnpacker unpacker, T message, Schema<T> schema, boolean numeric) throws IOException { MsgpackParser parser = new MsgpackParser(unpacker, numeric); schema.mergeFrom(new MsgpackInput(parser), message); }
java
public static <T> void mergeFrom(MessageUnpacker unpacker, T message, Schema<T> schema, boolean numeric) throws IOException { MsgpackParser parser = new MsgpackParser(unpacker, numeric); schema.mergeFrom(new MsgpackInput(parser), message); }
[ "public", "static", "<", "T", ">", "void", "mergeFrom", "(", "MessageUnpacker", "unpacker", ",", "T", "message", ",", "Schema", "<", "T", ">", "schema", ",", "boolean", "numeric", ")", "throws", "IOException", "{", "MsgpackParser", "parser", "=", "new", "M...
Merges the {@code message} from the JsonParser using the given {@code schema}.
[ "Merges", "the", "{" ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-msgpack/src/main/java/io/protostuff/MsgpackIOUtil.java#L181-L186
aws/aws-sdk-java
aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/FunctionConfigurationEnvironment.java
FunctionConfigurationEnvironment.withVariables
public FunctionConfigurationEnvironment withVariables(java.util.Map<String, String> variables) { setVariables(variables); return this; }
java
public FunctionConfigurationEnvironment withVariables(java.util.Map<String, String> variables) { setVariables(variables); return this; }
[ "public", "FunctionConfigurationEnvironment", "withVariables", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "variables", ")", "{", "setVariables", "(", "variables", ")", ";", "return", "this", ";", "}" ]
Environment variables for the Lambda function's configuration. @param variables Environment variables for the Lambda function's configuration. @return Returns a reference to this object so that method calls can be chained together.
[ "Environment", "variables", "for", "the", "Lambda", "function", "s", "configuration", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/FunctionConfigurationEnvironment.java#L247-L250