repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.readXMLFragment | public static DocumentFragment readXMLFragment(File file) throws IOException, SAXException, ParserConfigurationException {
return readXMLFragment(file, false);
} | java | public static DocumentFragment readXMLFragment(File file) throws IOException, SAXException, ParserConfigurationException {
return readXMLFragment(file, false);
} | [
"public",
"static",
"DocumentFragment",
"readXMLFragment",
"(",
"File",
"file",
")",
"throws",
"IOException",
",",
"SAXException",
",",
"ParserConfigurationException",
"{",
"return",
"readXMLFragment",
"(",
"file",
",",
"false",
")",
";",
"}"
] | Read an XML fragment from an XML file.
The XML file is well-formed. It means that the fragment will contains a single element: the root element
within the input file.
@param file is the file to read
@return the fragment from the {@code file}.
@throws IOException if the stream cannot be read.
@throws SAXException if the stream does not contains valid XML data.
@throws ParserConfigurationException if the parser cannot be configured. | [
"Read",
"an",
"XML",
"fragment",
"from",
"an",
"XML",
"file",
".",
"The",
"XML",
"file",
"is",
"well",
"-",
"formed",
".",
"It",
"means",
"that",
"the",
"fragment",
"will",
"contains",
"a",
"single",
"element",
":",
"the",
"root",
"element",
"within",
... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1944-L1946 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java | ListManagementImagesImpl.deleteImageAsync | public Observable<String> deleteImageAsync(String listId, String imageId) {
return deleteImageWithServiceResponseAsync(listId, imageId).map(new Func1<ServiceResponse<String>, String>() {
@Override
public String call(ServiceResponse<String> response) {
return response.body();
}
});
} | java | public Observable<String> deleteImageAsync(String listId, String imageId) {
return deleteImageWithServiceResponseAsync(listId, imageId).map(new Func1<ServiceResponse<String>, String>() {
@Override
public String call(ServiceResponse<String> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"String",
">",
"deleteImageAsync",
"(",
"String",
"listId",
",",
"String",
"imageId",
")",
"{",
"return",
"deleteImageWithServiceResponseAsync",
"(",
"listId",
",",
"imageId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceRespon... | Deletes an image from the list with list Id and image Id passed.
@param listId List Id of the image list.
@param imageId Id of the image.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the String object | [
"Deletes",
"an",
"image",
"from",
"the",
"list",
"with",
"list",
"Id",
"and",
"image",
"Id",
"passed",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java#L443-L450 |
lucee/Lucee | core/src/main/java/lucee/runtime/converter/WDDXConverter.java | WDDXConverter._serializeMap | private String _serializeMap(Map map, Set<Object> done) throws ConverterException {
StringBuilder sb = new StringBuilder(goIn() + "<struct>");
Iterator it = map.keySet().iterator();
deep++;
while (it.hasNext()) {
Object key = it.next();
sb.append(goIn() + "<var name=" + del + XMLUtil.escapeXMLString(key.toString()) + del + ">");
sb.append(_serialize(map.get(key), done));
sb.append(goIn() + "</var>");
}
deep--;
sb.append(goIn() + "</struct>");
return sb.toString();
} | java | private String _serializeMap(Map map, Set<Object> done) throws ConverterException {
StringBuilder sb = new StringBuilder(goIn() + "<struct>");
Iterator it = map.keySet().iterator();
deep++;
while (it.hasNext()) {
Object key = it.next();
sb.append(goIn() + "<var name=" + del + XMLUtil.escapeXMLString(key.toString()) + del + ">");
sb.append(_serialize(map.get(key), done));
sb.append(goIn() + "</var>");
}
deep--;
sb.append(goIn() + "</struct>");
return sb.toString();
} | [
"private",
"String",
"_serializeMap",
"(",
"Map",
"map",
",",
"Set",
"<",
"Object",
">",
"done",
")",
"throws",
"ConverterException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"goIn",
"(",
")",
"+",
"\"<struct>\"",
")",
";",
"Iterator",
... | serialize a Map (as Struct)
@param map Map to serialize
@param done
@return serialized map
@throws ConverterException | [
"serialize",
"a",
"Map",
"(",
"as",
"Struct",
")"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/WDDXConverter.java#L297-L313 |
wcm-io/wcm-io-handler | url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java | SuffixParser.getPages | public @NotNull List<Page> getPages(@NotNull Predicate<Page> filter) {
return getPages(filter, (Page)null);
} | java | public @NotNull List<Page> getPages(@NotNull Predicate<Page> filter) {
return getPages(filter, (Page)null);
} | [
"public",
"@",
"NotNull",
"List",
"<",
"Page",
">",
"getPages",
"(",
"@",
"NotNull",
"Predicate",
"<",
"Page",
">",
"filter",
")",
"{",
"return",
"getPages",
"(",
"filter",
",",
"(",
"Page",
")",
"null",
")",
";",
"}"
] | Get the pages selected in the suffix of the URL with page paths relative
to the current page path.
@param filter optional filter to select only specific pages
@return a list containing the Pages | [
"Get",
"the",
"pages",
"selected",
"in",
"the",
"suffix",
"of",
"the",
"URL",
"with",
"page",
"paths",
"relative",
"to",
"the",
"current",
"page",
"path",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java#L337-L339 |
h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/utils/GenmodelBitSet.java | GenmodelBitSet.fill3_1 | public void fill3_1(byte[] bits, ByteBufferWrapper ab) {
int bitoff = ab.get2();
int nbytes = ab.get2();
fill_1(bits, ab.position(), nbytes<<3, bitoff);
ab.skip(nbytes); // Skip inline bitset
} | java | public void fill3_1(byte[] bits, ByteBufferWrapper ab) {
int bitoff = ab.get2();
int nbytes = ab.get2();
fill_1(bits, ab.position(), nbytes<<3, bitoff);
ab.skip(nbytes); // Skip inline bitset
} | [
"public",
"void",
"fill3_1",
"(",
"byte",
"[",
"]",
"bits",
",",
"ByteBufferWrapper",
"ab",
")",
"{",
"int",
"bitoff",
"=",
"ab",
".",
"get2",
"(",
")",
";",
"int",
"nbytes",
"=",
"ab",
".",
"get2",
"(",
")",
";",
"fill_1",
"(",
"bits",
",",
"ab"... | /* SET IN STONE FOR MOJO VERSION "1.10" AND OLDER - DO NOT CHANGE | [
"/",
"*",
"SET",
"IN",
"STONE",
"FOR",
"MOJO",
"VERSION",
"1",
".",
"10",
"AND",
"OLDER",
"-",
"DO",
"NOT",
"CHANGE"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/utils/GenmodelBitSet.java#L78-L83 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getClassName | public static String getClassName(Object obj, boolean isSimple) {
if (null == obj) {
return null;
}
final Class<?> clazz = obj.getClass();
return getClassName(clazz, isSimple);
} | java | public static String getClassName(Object obj, boolean isSimple) {
if (null == obj) {
return null;
}
final Class<?> clazz = obj.getClass();
return getClassName(clazz, isSimple);
} | [
"public",
"static",
"String",
"getClassName",
"(",
"Object",
"obj",
",",
"boolean",
"isSimple",
")",
"{",
"if",
"(",
"null",
"==",
"obj",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Class",
"<",
"?",
">",
"clazz",
"=",
"obj",
".",
"getClass",
"("... | 获取类名
@param obj 获取类名对象
@param isSimple 是否简单类名,如果为true,返回不带包名的类名
@return 类名
@since 3.0.7 | [
"获取类名"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L81-L87 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.unlockResource | public void unlockResource(CmsDbContext dbc, CmsResource resource, boolean force, boolean removeSystemLock)
throws CmsException {
// update the resource cache
m_monitor.clearResourceCache();
// now update lock status
m_lockManager.removeResource(dbc, resource, force, removeSystemLock);
// we must also clear the permission cache
m_monitor.flushCache(CmsMemoryMonitor.CacheType.PERMISSION);
// fire resource modification event
Map<String, Object> data = new HashMap<String, Object>(2);
data.put(I_CmsEventListener.KEY_RESOURCE, resource);
data.put(I_CmsEventListener.KEY_CHANGE, new Integer(NOTHING_CHANGED));
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_RESOURCE_MODIFIED, data));
} | java | public void unlockResource(CmsDbContext dbc, CmsResource resource, boolean force, boolean removeSystemLock)
throws CmsException {
// update the resource cache
m_monitor.clearResourceCache();
// now update lock status
m_lockManager.removeResource(dbc, resource, force, removeSystemLock);
// we must also clear the permission cache
m_monitor.flushCache(CmsMemoryMonitor.CacheType.PERMISSION);
// fire resource modification event
Map<String, Object> data = new HashMap<String, Object>(2);
data.put(I_CmsEventListener.KEY_RESOURCE, resource);
data.put(I_CmsEventListener.KEY_CHANGE, new Integer(NOTHING_CHANGED));
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_RESOURCE_MODIFIED, data));
} | [
"public",
"void",
"unlockResource",
"(",
"CmsDbContext",
"dbc",
",",
"CmsResource",
"resource",
",",
"boolean",
"force",
",",
"boolean",
"removeSystemLock",
")",
"throws",
"CmsException",
"{",
"// update the resource cache",
"m_monitor",
".",
"clearResourceCache",
"(",
... | Unlocks a resource.<p>
@param dbc the current database context
@param resource the resource to unlock
@param force <code>true</code>, if a resource is forced to get unlocked, no matter by which user and in which project the resource is currently locked
@param removeSystemLock <code>true</code>, if you also want to remove system locks
@throws CmsException if something goes wrong
@see CmsObject#unlockResource(String)
@see I_CmsResourceType#unlockResource(CmsObject, CmsSecurityManager, CmsResource) | [
"Unlocks",
"a",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L9220-L9237 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClient.java | BigtableInstanceAdminClient.getAppProfile | @SuppressWarnings("WeakerAccess")
public AppProfile getAppProfile(String instanceId, String appProfileId) {
return ApiExceptions.callAndTranslateApiException(getAppProfileAsync(instanceId, appProfileId));
} | java | @SuppressWarnings("WeakerAccess")
public AppProfile getAppProfile(String instanceId, String appProfileId) {
return ApiExceptions.callAndTranslateApiException(getAppProfileAsync(instanceId, appProfileId));
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"AppProfile",
"getAppProfile",
"(",
"String",
"instanceId",
",",
"String",
"appProfileId",
")",
"{",
"return",
"ApiExceptions",
".",
"callAndTranslateApiException",
"(",
"getAppProfileAsync",
"(",
"instanc... | Get the app profile by id.
<p>Sample code:
<pre>{@code
AppProfile appProfile = client.getAppProfile("my-instance", "my-app-profile");
}</pre>
@see AppProfile | [
"Get",
"the",
"app",
"profile",
"by",
"id",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClient.java#L847-L850 |
virgo47/javasimon | core/src/main/java/org/javasimon/AbstractSimon.java | AbstractSimon.setAttribute | @Override
public void setAttribute(String name, Object value) {
attributesSupport.setAttribute(name, value);
} | java | @Override
public void setAttribute(String name, Object value) {
attributesSupport.setAttribute(name, value);
} | [
"@",
"Override",
"public",
"void",
"setAttribute",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"attributesSupport",
".",
"setAttribute",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Stores an attribute in this Simon. Attributes can be used to store any custom objects.
@param name a String specifying the name of the attribute
@param value the Object to be stored
@since 2.3 | [
"Stores",
"an",
"attribute",
"in",
"this",
"Simon",
".",
"Attributes",
"can",
"be",
"used",
"to",
"store",
"any",
"custom",
"objects",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/AbstractSimon.java#L194-L197 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/factory/ConfigurableFactory.java | ConfigurableFactory.createNewInstance | public Object createNewInstance(Class[] types, Object[] args)
{
try
{
Object result;
// create an instance of the target class
if (types != null)
{
result = ClassHelper.newInstance(getClassToServe(), types, args, true);
}
else
{
result = ClassHelper.newInstance(getClassToServe(), true);
}
// if defined in OJB.properties all instances are wrapped by an interceptor
result = InterceptorFactory.getInstance().createInterceptorFor(result);
return result;
}
catch (InstantiationException e)
{
getLogger().error("ConfigurableFactory can't instantiate class " +
getClassToServe() + buildArgumentString(types, args), e);
throw new PersistenceBrokerException(e);
}
catch (IllegalAccessException e)
{
getLogger().error("ConfigurableFactory can't access constructor for class " +
getClassToServe() + buildArgumentString(types, args), e);
throw new PersistenceBrokerException(e);
}
catch (Exception e)
{
getLogger().error("ConfigurableFactory instantiation failed for class " +
getClassToServe() + buildArgumentString(types, args), e);
throw new PersistenceBrokerException(e);
}
} | java | public Object createNewInstance(Class[] types, Object[] args)
{
try
{
Object result;
// create an instance of the target class
if (types != null)
{
result = ClassHelper.newInstance(getClassToServe(), types, args, true);
}
else
{
result = ClassHelper.newInstance(getClassToServe(), true);
}
// if defined in OJB.properties all instances are wrapped by an interceptor
result = InterceptorFactory.getInstance().createInterceptorFor(result);
return result;
}
catch (InstantiationException e)
{
getLogger().error("ConfigurableFactory can't instantiate class " +
getClassToServe() + buildArgumentString(types, args), e);
throw new PersistenceBrokerException(e);
}
catch (IllegalAccessException e)
{
getLogger().error("ConfigurableFactory can't access constructor for class " +
getClassToServe() + buildArgumentString(types, args), e);
throw new PersistenceBrokerException(e);
}
catch (Exception e)
{
getLogger().error("ConfigurableFactory instantiation failed for class " +
getClassToServe() + buildArgumentString(types, args), e);
throw new PersistenceBrokerException(e);
}
} | [
"public",
"Object",
"createNewInstance",
"(",
"Class",
"[",
"]",
"types",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"try",
"{",
"Object",
"result",
";",
"// create an instance of the target class\r",
"if",
"(",
"types",
"!=",
"null",
")",
"{",
"result",
"="... | factory method for creating new instances
the Class to be instantiated is defined by getClassToServe().
@return Object the created instance | [
"factory",
"method",
"for",
"creating",
"new",
"instances",
"the",
"Class",
"to",
"be",
"instantiated",
"is",
"defined",
"by",
"getClassToServe",
"()",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/factory/ConfigurableFactory.java#L93-L130 |
i-net-software/jlessc | src/com/inet/lib/less/Operation.java | Operation.doubleValue | private double doubleValue( double left, double right ) {
switch( operator ) {
case '+':
return left + right;
case '-':
return left - right;
case '*':
return left * right;
case '/':
return left / right;
default:
throw createException( "Not supported Oprator '" + operator + "' for Expression '" + toString() + '\'' );
}
} | java | private double doubleValue( double left, double right ) {
switch( operator ) {
case '+':
return left + right;
case '-':
return left - right;
case '*':
return left * right;
case '/':
return left / right;
default:
throw createException( "Not supported Oprator '" + operator + "' for Expression '" + toString() + '\'' );
}
} | [
"private",
"double",
"doubleValue",
"(",
"double",
"left",
",",
"double",
"right",
")",
"{",
"switch",
"(",
"operator",
")",
"{",
"case",
"'",
"'",
":",
"return",
"left",
"+",
"right",
";",
"case",
"'",
"'",
":",
"return",
"left",
"-",
"right",
";",
... | Calculate the number value of two operands if possible.
@param left the left
@param right the right
@return the result. | [
"Calculate",
"the",
"number",
"value",
"of",
"two",
"operands",
"if",
"possible",
"."
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L358-L371 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SortedBugCollection.java | SortedBugCollection.addAll | public void addAll(Collection<BugInstance> collection, boolean updateActiveTime) {
for (BugInstance warning : collection) {
add(warning, updateActiveTime);
}
} | java | public void addAll(Collection<BugInstance> collection, boolean updateActiveTime) {
for (BugInstance warning : collection) {
add(warning, updateActiveTime);
}
} | [
"public",
"void",
"addAll",
"(",
"Collection",
"<",
"BugInstance",
">",
"collection",
",",
"boolean",
"updateActiveTime",
")",
"{",
"for",
"(",
"BugInstance",
"warning",
":",
"collection",
")",
"{",
"add",
"(",
"warning",
",",
"updateActiveTime",
")",
";",
"... | Add a Collection of BugInstances to this BugCollection object.
@param collection
the Collection of BugInstances to add
@param updateActiveTime
true if active time of added BugInstances should be updated to
match collection: false if not | [
"Add",
"a",
"Collection",
"of",
"BugInstances",
"to",
"this",
"BugCollection",
"object",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SortedBugCollection.java#L207-L211 |
mozilla/rhino | src/org/mozilla/javascript/FunctionObject.java | FunctionObject.addAsConstructor | public void addAsConstructor(Scriptable scope, Scriptable prototype)
{
initAsConstructor(scope, prototype);
defineProperty(scope, prototype.getClassName(),
this, ScriptableObject.DONTENUM);
} | java | public void addAsConstructor(Scriptable scope, Scriptable prototype)
{
initAsConstructor(scope, prototype);
defineProperty(scope, prototype.getClassName(),
this, ScriptableObject.DONTENUM);
} | [
"public",
"void",
"addAsConstructor",
"(",
"Scriptable",
"scope",
",",
"Scriptable",
"prototype",
")",
"{",
"initAsConstructor",
"(",
"scope",
",",
"prototype",
")",
";",
"defineProperty",
"(",
"scope",
",",
"prototype",
".",
"getClassName",
"(",
")",
",",
"th... | Define this function as a JavaScript constructor.
<p>
Sets up the "prototype" and "constructor" properties. Also
calls setParent and setPrototype with appropriate values.
Then adds the function object as a property of the given scope, using
<code>prototype.getClassName()</code>
as the name of the property.
@param scope the scope in which to define the constructor (typically
the global object)
@param prototype the prototype object
@see org.mozilla.javascript.Scriptable#setParentScope
@see org.mozilla.javascript.Scriptable#setPrototype
@see org.mozilla.javascript.Scriptable#getClassName | [
"Define",
"this",
"function",
"as",
"a",
"JavaScript",
"constructor",
".",
"<p",
">",
"Sets",
"up",
"the",
"prototype",
"and",
"constructor",
"properties",
".",
"Also",
"calls",
"setParent",
"and",
"setPrototype",
"with",
"appropriate",
"values",
".",
"Then",
... | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/FunctionObject.java#L322-L327 |
deeplearning4j/deeplearning4j | datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java | ArrowConverter.providerForVectors | public static DictionaryProvider providerForVectors(List<FieldVector> vectors,List<Field> fields) {
Dictionary[] dictionaries = new Dictionary[vectors.size()];
for(int i = 0; i < vectors.size(); i++) {
DictionaryEncoding dictionary = fields.get(i).getDictionary();
if(dictionary == null) {
dictionary = new DictionaryEncoding(i,true,null);
}
dictionaries[i] = new Dictionary(vectors.get(i), dictionary);
}
return new DictionaryProvider.MapDictionaryProvider(dictionaries);
} | java | public static DictionaryProvider providerForVectors(List<FieldVector> vectors,List<Field> fields) {
Dictionary[] dictionaries = new Dictionary[vectors.size()];
for(int i = 0; i < vectors.size(); i++) {
DictionaryEncoding dictionary = fields.get(i).getDictionary();
if(dictionary == null) {
dictionary = new DictionaryEncoding(i,true,null);
}
dictionaries[i] = new Dictionary(vectors.get(i), dictionary);
}
return new DictionaryProvider.MapDictionaryProvider(dictionaries);
} | [
"public",
"static",
"DictionaryProvider",
"providerForVectors",
"(",
"List",
"<",
"FieldVector",
">",
"vectors",
",",
"List",
"<",
"Field",
">",
"fields",
")",
"{",
"Dictionary",
"[",
"]",
"dictionaries",
"=",
"new",
"Dictionary",
"[",
"vectors",
".",
"size",
... | Provide a value look up dictionary based on the
given set of input {@link FieldVector} s for
reading and writing to arrow streams
@param vectors the vectors to use as a lookup
@return the associated {@link DictionaryProvider} for the given
input {@link FieldVector} list | [
"Provide",
"a",
"value",
"look",
"up",
"dictionary",
"based",
"on",
"the",
"given",
"set",
"of",
"input",
"{"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java#L555-L565 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java | CPDefinitionLinkPersistenceImpl.findAll | @Override
public List<CPDefinitionLink> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CPDefinitionLink> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinitionLink",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the cp definition links.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionLinkModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of cp definition links
@param end the upper bound of the range of cp definition links (not inclusive)
@return the range of cp definition links | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"definition",
"links",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java#L4737-L4740 |
Azure/azure-sdk-for-java | eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java | EventSubscriptionsInner.listByResourceAsync | public Observable<List<EventSubscriptionInner>> listByResourceAsync(String resourceGroupName, String providerNamespace, String resourceTypeName, String resourceName) {
return listByResourceWithServiceResponseAsync(resourceGroupName, providerNamespace, resourceTypeName, resourceName).map(new Func1<ServiceResponse<List<EventSubscriptionInner>>, List<EventSubscriptionInner>>() {
@Override
public List<EventSubscriptionInner> call(ServiceResponse<List<EventSubscriptionInner>> response) {
return response.body();
}
});
} | java | public Observable<List<EventSubscriptionInner>> listByResourceAsync(String resourceGroupName, String providerNamespace, String resourceTypeName, String resourceName) {
return listByResourceWithServiceResponseAsync(resourceGroupName, providerNamespace, resourceTypeName, resourceName).map(new Func1<ServiceResponse<List<EventSubscriptionInner>>, List<EventSubscriptionInner>>() {
@Override
public List<EventSubscriptionInner> call(ServiceResponse<List<EventSubscriptionInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"EventSubscriptionInner",
">",
">",
"listByResourceAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"providerNamespace",
",",
"String",
"resourceTypeName",
",",
"String",
"resourceName",
")",
"{",
"return",
"listByRe... | List all event subscriptions for a specific topic.
List all event subscriptions that have been created for a specific topic.
@param resourceGroupName The name of the resource group within the user's subscription.
@param providerNamespace Namespace of the provider of the topic
@param resourceTypeName Name of the resource type
@param resourceName Name of the resource
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<EventSubscriptionInner> object | [
"List",
"all",
"event",
"subscriptions",
"for",
"a",
"specific",
"topic",
".",
"List",
"all",
"event",
"subscriptions",
"that",
"have",
"been",
"created",
"for",
"a",
"specific",
"topic",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java#L1597-L1604 |
OpenNTF/JavascriptAggregator | jaggr-service/src/main/java/com/ibm/jaggr/service/impl/resource/BundleResourceFactory.java | BundleResourceFactory.getNBRPath | protected String getNBRPath(String bundle, URI uri) {
String path = uri.getPath();
return path.startsWith("/" + bundle) ? path.substring(bundle.length() + 1) : path; //$NON-NLS-1$
} | java | protected String getNBRPath(String bundle, URI uri) {
String path = uri.getPath();
return path.startsWith("/" + bundle) ? path.substring(bundle.length() + 1) : path; //$NON-NLS-1$
} | [
"protected",
"String",
"getNBRPath",
"(",
"String",
"bundle",
",",
"URI",
"uri",
")",
"{",
"String",
"path",
"=",
"uri",
".",
"getPath",
"(",
")",
";",
"return",
"path",
".",
"startsWith",
"(",
"\"/\"",
"+",
"bundle",
")",
"?",
"path",
".",
"substring"... | Extracts the path of the file resource from a uri with the <code>namedbundleresource<code> scheme.
Supports backwards compatibility for names from 1.0.0 release (for now).
@param bundle The name of the bundle within the uri from {@link BundleResourceFactory#getNBRBundleName(URI)}
@param uri The uri with a <code>namedbundleresource<code> scheme.
@return The path of the file resource within the uri. | [
"Extracts",
"the",
"path",
"of",
"the",
"file",
"resource",
"from",
"a",
"uri",
"with",
"the",
"<code",
">",
"namedbundleresource<code",
">",
"scheme",
"."
] | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-service/src/main/java/com/ibm/jaggr/service/impl/resource/BundleResourceFactory.java#L206-L209 |
haifengl/smile | data/src/main/java/smile/data/parser/ArffParser.java | ArffParser.getNextToken | private void getNextToken(StreamTokenizer tokenizer) throws IOException, ParseException {
if (tokenizer.nextToken() == StreamTokenizer.TT_EOL) {
throw new ParseException("premature end of line", tokenizer.lineno());
}
if (tokenizer.ttype == StreamTokenizer.TT_EOF) {
throw new ParseException(PREMATURE_END_OF_FILE, tokenizer.lineno());
} else if ((tokenizer.ttype == '\'') || (tokenizer.ttype == '"')) {
tokenizer.ttype = StreamTokenizer.TT_WORD;
} else if ((tokenizer.ttype == StreamTokenizer.TT_WORD) && (tokenizer.sval.equals("?"))) {
tokenizer.ttype = '?';
}
} | java | private void getNextToken(StreamTokenizer tokenizer) throws IOException, ParseException {
if (tokenizer.nextToken() == StreamTokenizer.TT_EOL) {
throw new ParseException("premature end of line", tokenizer.lineno());
}
if (tokenizer.ttype == StreamTokenizer.TT_EOF) {
throw new ParseException(PREMATURE_END_OF_FILE, tokenizer.lineno());
} else if ((tokenizer.ttype == '\'') || (tokenizer.ttype == '"')) {
tokenizer.ttype = StreamTokenizer.TT_WORD;
} else if ((tokenizer.ttype == StreamTokenizer.TT_WORD) && (tokenizer.sval.equals("?"))) {
tokenizer.ttype = '?';
}
} | [
"private",
"void",
"getNextToken",
"(",
"StreamTokenizer",
"tokenizer",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"if",
"(",
"tokenizer",
".",
"nextToken",
"(",
")",
"==",
"StreamTokenizer",
".",
"TT_EOL",
")",
"{",
"throw",
"new",
"ParseExceptio... | Gets next token, checking for a premature and of line.
@throws IllegalStateException if it finds a premature end of line | [
"Gets",
"next",
"token",
"checking",
"for",
"a",
"premature",
"and",
"of",
"line",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/parser/ArffParser.java#L164-L175 |
dropwizard-bundles/dropwizard-redirect-bundle | src/main/java/io/dropwizard/bundles/redirect/HttpsRedirect.java | HttpsRedirect.getRedirectUrl | private String getRedirectUrl(HttpServletRequest request, String newScheme) {
String serverName = request.getServerName();
String uri = request.getRequestURI();
StringBuilder redirect = new StringBuilder(100);
redirect.append(newScheme);
redirect.append("://");
redirect.append(serverName);
redirect.append(uri);
String query = request.getQueryString();
if (query != null) {
redirect.append('?');
redirect.append(query);
}
return redirect.toString();
} | java | private String getRedirectUrl(HttpServletRequest request, String newScheme) {
String serverName = request.getServerName();
String uri = request.getRequestURI();
StringBuilder redirect = new StringBuilder(100);
redirect.append(newScheme);
redirect.append("://");
redirect.append(serverName);
redirect.append(uri);
String query = request.getQueryString();
if (query != null) {
redirect.append('?');
redirect.append(query);
}
return redirect.toString();
} | [
"private",
"String",
"getRedirectUrl",
"(",
"HttpServletRequest",
"request",
",",
"String",
"newScheme",
")",
"{",
"String",
"serverName",
"=",
"request",
".",
"getServerName",
"(",
")",
";",
"String",
"uri",
"=",
"request",
".",
"getRequestURI",
"(",
")",
";"... | Return the full URL that should be redirected to including query parameters. | [
"Return",
"the",
"full",
"URL",
"that",
"should",
"be",
"redirected",
"to",
"including",
"query",
"parameters",
"."
] | train | https://github.com/dropwizard-bundles/dropwizard-redirect-bundle/blob/73d484dfe81d75355bed31b541adbefab25e8f7f/src/main/java/io/dropwizard/bundles/redirect/HttpsRedirect.java#L68-L85 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updateRegexEntityModel | public OperationStatus updateRegexEntityModel(UUID appId, String versionId, UUID regexEntityId, RegexModelUpdateObject regexEntityUpdateObject) {
return updateRegexEntityModelWithServiceResponseAsync(appId, versionId, regexEntityId, regexEntityUpdateObject).toBlocking().single().body();
} | java | public OperationStatus updateRegexEntityModel(UUID appId, String versionId, UUID regexEntityId, RegexModelUpdateObject regexEntityUpdateObject) {
return updateRegexEntityModelWithServiceResponseAsync(appId, versionId, regexEntityId, regexEntityUpdateObject).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"updateRegexEntityModel",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"regexEntityId",
",",
"RegexModelUpdateObject",
"regexEntityUpdateObject",
")",
"{",
"return",
"updateRegexEntityModelWithServiceResponseAsync",
"(",
"appId",... | Updates the regex entity model .
@param appId The application ID.
@param versionId The version ID.
@param regexEntityId The regex entity extractor ID.
@param regexEntityUpdateObject An object containing the new entity name and regex pattern.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Updates",
"the",
"regex",
"entity",
"model",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L10271-L10273 |
jMetal/jMetal | jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/moead/MOEADD.java | MOEADD.deleteCrowdIndiv_same | public void deleteCrowdIndiv_same(int crowdIdx, int nicheCount, double indivFitness, S indiv) {
// find the solution indices within this crowdIdx subregion
ArrayList<Integer> indList = new ArrayList<>();
for (int i = 0; i < populationSize; i++) {
if (subregionIdx[crowdIdx][i] == 1) {
indList.add(i);
}
}
// find the solution with the worst fitness value
int listSize = indList.size();
int worstIdx = indList.get(0);
double maxFitness = fitnessFunction(population.get(worstIdx), lambda[crowdIdx]);
for (int i = 1; i < listSize; i++) {
int curIdx = indList.get(i);
double curFitness = fitnessFunction(population.get(curIdx), lambda[crowdIdx]);
if (curFitness > maxFitness) {
worstIdx = curIdx;
maxFitness = curFitness;
}
}
// if indiv has a better fitness, use indiv to replace the worst one
if (indivFitness < maxFitness) {
replace(worstIdx, indiv);
}
} | java | public void deleteCrowdIndiv_same(int crowdIdx, int nicheCount, double indivFitness, S indiv) {
// find the solution indices within this crowdIdx subregion
ArrayList<Integer> indList = new ArrayList<>();
for (int i = 0; i < populationSize; i++) {
if (subregionIdx[crowdIdx][i] == 1) {
indList.add(i);
}
}
// find the solution with the worst fitness value
int listSize = indList.size();
int worstIdx = indList.get(0);
double maxFitness = fitnessFunction(population.get(worstIdx), lambda[crowdIdx]);
for (int i = 1; i < listSize; i++) {
int curIdx = indList.get(i);
double curFitness = fitnessFunction(population.get(curIdx), lambda[crowdIdx]);
if (curFitness > maxFitness) {
worstIdx = curIdx;
maxFitness = curFitness;
}
}
// if indiv has a better fitness, use indiv to replace the worst one
if (indivFitness < maxFitness) {
replace(worstIdx, indiv);
}
} | [
"public",
"void",
"deleteCrowdIndiv_same",
"(",
"int",
"crowdIdx",
",",
"int",
"nicheCount",
",",
"double",
"indivFitness",
",",
"S",
"indiv",
")",
"{",
"// find the solution indices within this crowdIdx subregion",
"ArrayList",
"<",
"Integer",
">",
"indList",
"=",
"n... | delete one solution from the most crowded subregion, which is indiv's subregion. Compare
indiv's fitness value and the worst one in this subregion | [
"delete",
"one",
"solution",
"from",
"the",
"most",
"crowded",
"subregion",
"which",
"is",
"indiv",
"s",
"subregion",
".",
"Compare",
"indiv",
"s",
"fitness",
"value",
"and",
"the",
"worst",
"one",
"in",
"this",
"subregion"
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/moead/MOEADD.java#L1124-L1151 |
netplex/json-smart-v2 | accessors-smart/src/main/java/net/minidev/asm/ASMUtil.java | ASMUtil.autoUnBoxing1 | protected static void autoUnBoxing1(MethodVisitor mv, Type fieldType) {
switch (fieldType.getSort()) {
case Type.BOOLEAN:
mv.visitTypeInsn(CHECKCAST, "java/lang/Boolean");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z");
break;
case Type.BYTE:
mv.visitTypeInsn(CHECKCAST, "java/lang/Byte");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B");
break;
case Type.CHAR:
mv.visitTypeInsn(CHECKCAST, "java/lang/Character");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C");
break;
case Type.SHORT:
mv.visitTypeInsn(CHECKCAST, "java/lang/Short");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S");
break;
case Type.INT:
mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I");
break;
case Type.FLOAT:
mv.visitTypeInsn(CHECKCAST, "java/lang/Float");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F");
break;
case Type.LONG:
mv.visitTypeInsn(CHECKCAST, "java/lang/Long");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J");
break;
case Type.DOUBLE:
mv.visitTypeInsn(CHECKCAST, "java/lang/Double");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D");
break;
case Type.ARRAY:
mv.visitTypeInsn(CHECKCAST, fieldType.getInternalName());
break;
default:
mv.visitTypeInsn(CHECKCAST, fieldType.getInternalName());
}
} | java | protected static void autoUnBoxing1(MethodVisitor mv, Type fieldType) {
switch (fieldType.getSort()) {
case Type.BOOLEAN:
mv.visitTypeInsn(CHECKCAST, "java/lang/Boolean");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z");
break;
case Type.BYTE:
mv.visitTypeInsn(CHECKCAST, "java/lang/Byte");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B");
break;
case Type.CHAR:
mv.visitTypeInsn(CHECKCAST, "java/lang/Character");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C");
break;
case Type.SHORT:
mv.visitTypeInsn(CHECKCAST, "java/lang/Short");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S");
break;
case Type.INT:
mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I");
break;
case Type.FLOAT:
mv.visitTypeInsn(CHECKCAST, "java/lang/Float");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F");
break;
case Type.LONG:
mv.visitTypeInsn(CHECKCAST, "java/lang/Long");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J");
break;
case Type.DOUBLE:
mv.visitTypeInsn(CHECKCAST, "java/lang/Double");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D");
break;
case Type.ARRAY:
mv.visitTypeInsn(CHECKCAST, fieldType.getInternalName());
break;
default:
mv.visitTypeInsn(CHECKCAST, fieldType.getInternalName());
}
} | [
"protected",
"static",
"void",
"autoUnBoxing1",
"(",
"MethodVisitor",
"mv",
",",
"Type",
"fieldType",
")",
"{",
"switch",
"(",
"fieldType",
".",
"getSort",
"(",
")",
")",
"{",
"case",
"Type",
".",
"BOOLEAN",
":",
"mv",
".",
"visitTypeInsn",
"(",
"CHECKCAST... | Append the call of proper extract primitive type of an boxed object. | [
"Append",
"the",
"call",
"of",
"proper",
"extract",
"primitive",
"type",
"of",
"an",
"boxed",
"object",
"."
] | train | https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/accessors-smart/src/main/java/net/minidev/asm/ASMUtil.java#L105-L145 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ClassContext.java | ClassContext.getMethodAnalysis | public Object getMethodAnalysis(Class<?> analysisClass, MethodDescriptor methodDescriptor) {
Map<MethodDescriptor, Object> objectMap = getObjectMap(analysisClass);
return objectMap.get(methodDescriptor);
} | java | public Object getMethodAnalysis(Class<?> analysisClass, MethodDescriptor methodDescriptor) {
Map<MethodDescriptor, Object> objectMap = getObjectMap(analysisClass);
return objectMap.get(methodDescriptor);
} | [
"public",
"Object",
"getMethodAnalysis",
"(",
"Class",
"<",
"?",
">",
"analysisClass",
",",
"MethodDescriptor",
"methodDescriptor",
")",
"{",
"Map",
"<",
"MethodDescriptor",
",",
"Object",
">",
"objectMap",
"=",
"getObjectMap",
"(",
"analysisClass",
")",
";",
"r... | Retrieve a method analysis object.
@param analysisClass
class the method analysis object should belong to
@param methodDescriptor
method descriptor identifying the analyzed method
@return the analysis object | [
"Retrieve",
"a",
"method",
"analysis",
"object",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ClassContext.java#L169-L172 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java | OptimalCECPMain.alignPermuted | public AFPChain alignPermuted(Atom[] ca1, Atom[] ca2, Object param, int cp) throws StructureException {
// initial permutation
permuteArray(ca2,cp);
// perform alignment
AFPChain afpChain = super.align(ca1, ca2, param);
// un-permute alignment
permuteAFPChain(afpChain, -cp);
if(afpChain.getName2() != null) {
afpChain.setName2(afpChain.getName2()+" CP="+cp);
}
// Specify the permuted
return afpChain;
} | java | public AFPChain alignPermuted(Atom[] ca1, Atom[] ca2, Object param, int cp) throws StructureException {
// initial permutation
permuteArray(ca2,cp);
// perform alignment
AFPChain afpChain = super.align(ca1, ca2, param);
// un-permute alignment
permuteAFPChain(afpChain, -cp);
if(afpChain.getName2() != null) {
afpChain.setName2(afpChain.getName2()+" CP="+cp);
}
// Specify the permuted
return afpChain;
} | [
"public",
"AFPChain",
"alignPermuted",
"(",
"Atom",
"[",
"]",
"ca1",
",",
"Atom",
"[",
"]",
"ca2",
",",
"Object",
"param",
",",
"int",
"cp",
")",
"throws",
"StructureException",
"{",
"// initial permutation",
"permuteArray",
"(",
"ca2",
",",
"cp",
")",
";"... | Aligns ca1 with ca2 permuted by <i>cp</i> residues.
<p><strong>WARNING:</strong> Modifies ca2 during the permutation. Be sure
to make a copy before calling this method.
@param ca1
@param ca2
@param param
@param cp
@return
@throws StructureException | [
"Aligns",
"ca1",
"with",
"ca2",
"permuted",
"by",
"<i",
">",
"cp<",
"/",
"i",
">",
"residues",
".",
"<p",
">",
"<strong",
">",
"WARNING",
":",
"<",
"/",
"strong",
">",
"Modifies",
"ca2",
"during",
"the",
"permutation",
".",
"Be",
"sure",
"to",
"make"... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java#L193-L209 |
VerbalExpressions/JavaVerbalExpressions | src/main/java/ru/lanwen/verbalregex/VerbalExpression.java | VerbalExpression.getTextGroups | public List<String> getTextGroups(final String toTest, final int group) {
List<String> groups = new ArrayList<>();
Matcher m = pattern.matcher(toTest);
while (m.find()) {
groups.add(m.group(group));
}
return groups;
} | java | public List<String> getTextGroups(final String toTest, final int group) {
List<String> groups = new ArrayList<>();
Matcher m = pattern.matcher(toTest);
while (m.find()) {
groups.add(m.group(group));
}
return groups;
} | [
"public",
"List",
"<",
"String",
">",
"getTextGroups",
"(",
"final",
"String",
"toTest",
",",
"final",
"int",
"group",
")",
"{",
"List",
"<",
"String",
">",
"groups",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Matcher",
"m",
"=",
"pattern",
".",
... | Extract exact group from string and add it to list
Example:
String text = "SampleHelloWorldString";
VerbalExpression regex = regex().capt().oneOf("Hello", "World").endCapt().maybe("String").build();
list = regex.getTextGroups(text, 0) //result: "Hello", "WorldString"
list = regex.getTextGroups(text, 1) //result: "Hello", "World"
@param toTest - string to extract from
@param group - group to extract
@return list of extracted groups | [
"Extract",
"exact",
"group",
"from",
"string",
"and",
"add",
"it",
"to",
"list"
] | train | https://github.com/VerbalExpressions/JavaVerbalExpressions/blob/4ee34e6c96ea2cf8335e3b425afa44c535229347/src/main/java/ru/lanwen/verbalregex/VerbalExpression.java#L783-L790 |
hellosign/hellosign-java-sdk | src/main/java/com/hellosign/sdk/HelloSignClient.java | HelloSignClient.createAccount | public Account createAccount(String email, String clientId, String clientSecret) throws HelloSignException {
HttpClient client = httpClient.withAuth(auth).withPostField(Account.ACCOUNT_EMAIL_ADDRESS, email);
if (clientId != null && clientSecret != null) {
client = client.withPostField(CLIENT_ID, clientId).withPostField(CLIENT_SECRET, clientSecret);
}
JSONObject response = client.post(BASE_URI + ACCOUNT_CREATE_URI).asJson();
JSONObject copy;
try {
copy = new JSONObject(response.toString());
} catch (JSONException e) {
throw new HelloSignException(e);
}
OauthData data = new OauthData(copy);
Account account = new Account(response);
account.setOauthData(data);
return account;
} | java | public Account createAccount(String email, String clientId, String clientSecret) throws HelloSignException {
HttpClient client = httpClient.withAuth(auth).withPostField(Account.ACCOUNT_EMAIL_ADDRESS, email);
if (clientId != null && clientSecret != null) {
client = client.withPostField(CLIENT_ID, clientId).withPostField(CLIENT_SECRET, clientSecret);
}
JSONObject response = client.post(BASE_URI + ACCOUNT_CREATE_URI).asJson();
JSONObject copy;
try {
copy = new JSONObject(response.toString());
} catch (JSONException e) {
throw new HelloSignException(e);
}
OauthData data = new OauthData(copy);
Account account = new Account(response);
account.setOauthData(data);
return account;
} | [
"public",
"Account",
"createAccount",
"(",
"String",
"email",
",",
"String",
"clientId",
",",
"String",
"clientSecret",
")",
"throws",
"HelloSignException",
"{",
"HttpClient",
"client",
"=",
"httpClient",
".",
"withAuth",
"(",
"auth",
")",
".",
"withPostField",
... | Creates a new HelloSign account and provides OAuth app credentials to
automatically generate an OAuth token with the user Account response.
@param email String New user's email address
@param clientId String Client ID
@param clientSecret String App secret
@return Account New user's account information
@throws HelloSignException thrown if there's a problem processing the
HTTP request or the JSON response. | [
"Creates",
"a",
"new",
"HelloSign",
"account",
"and",
"provides",
"OAuth",
"app",
"credentials",
"to",
"automatically",
"generate",
"an",
"OAuth",
"token",
"with",
"the",
"user",
"Account",
"response",
"."
] | train | https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/HelloSignClient.java#L282-L298 |
TheHortonMachine/hortonmachine | dbs/src/main/java/org/hortonmachine/dbs/utils/SerializationUtilities.java | SerializationUtilities.deSerializeFromDisk | public static <T> T deSerializeFromDisk( File file, Class<T> adaptee ) throws Exception {
try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
long length = raf.length();
// System.out.println(length + "/" + (int) length);
byte[] bytes = new byte[(int) length];
int read = raf.read(bytes);
if (read != length) {
throw new IOException();
}
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
Object readObject = in.readObject();
return adaptee.cast(readObject);
}
} | java | public static <T> T deSerializeFromDisk( File file, Class<T> adaptee ) throws Exception {
try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
long length = raf.length();
// System.out.println(length + "/" + (int) length);
byte[] bytes = new byte[(int) length];
int read = raf.read(bytes);
if (read != length) {
throw new IOException();
}
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
Object readObject = in.readObject();
return adaptee.cast(readObject);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"deSerializeFromDisk",
"(",
"File",
"file",
",",
"Class",
"<",
"T",
">",
"adaptee",
")",
"throws",
"Exception",
"{",
"try",
"(",
"RandomAccessFile",
"raf",
"=",
"new",
"RandomAccessFile",
"(",
"file",
",",
"\"r\"",
... | Deserialize a file to a given object.
@param file
the file to read.
@param adaptee
the class to adapt to.
@return the object.
@throws Exception | [
"Deserialize",
"a",
"file",
"to",
"a",
"given",
"object",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/utils/SerializationUtilities.java#L75-L88 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java | WordVectorSerializer.writeWordVectors | public static void writeWordVectors(@NonNull Glove vectors, @NonNull File file) {
try (BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
writeWordVectors(vectors, fos);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public static void writeWordVectors(@NonNull Glove vectors, @NonNull File file) {
try (BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
writeWordVectors(vectors, fos);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"void",
"writeWordVectors",
"(",
"@",
"NonNull",
"Glove",
"vectors",
",",
"@",
"NonNull",
"File",
"file",
")",
"{",
"try",
"(",
"BufferedOutputStream",
"fos",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"file",
... | This method saves GloVe model to the given output stream.
@param vectors GloVe model to be saved
@param file path where model should be saved to | [
"This",
"method",
"saves",
"GloVe",
"model",
"to",
"the",
"given",
"output",
"stream",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L1113-L1119 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java | PriorityQueue.put | public final void put(long priority, Object value)
{
// if (tc.isEntryEnabled())
// SibTr.entry(tc, "put", new Object[] { new Long(priority), value});
PriorityQueueNode node = new PriorityQueueNode(priority,value);
// Resize the array (double it) if we are out of space.
if (size == elements.length)
{
PriorityQueueNode[] tmp = new PriorityQueueNode[2*size];
System.arraycopy(elements,0,tmp,0,size);
elements = tmp;
}
int pos = size++;
setElement(node, pos);
moveUp(pos);
// if (tc.isEntryEnabled())
// SibTr.exit(tc, "put");
} | java | public final void put(long priority, Object value)
{
// if (tc.isEntryEnabled())
// SibTr.entry(tc, "put", new Object[] { new Long(priority), value});
PriorityQueueNode node = new PriorityQueueNode(priority,value);
// Resize the array (double it) if we are out of space.
if (size == elements.length)
{
PriorityQueueNode[] tmp = new PriorityQueueNode[2*size];
System.arraycopy(elements,0,tmp,0,size);
elements = tmp;
}
int pos = size++;
setElement(node, pos);
moveUp(pos);
// if (tc.isEntryEnabled())
// SibTr.exit(tc, "put");
} | [
"public",
"final",
"void",
"put",
"(",
"long",
"priority",
",",
"Object",
"value",
")",
"{",
"// if (tc.isEntryEnabled())",
"// SibTr.entry(tc, \"put\", new Object[] { new Long(priority), value});",
"PriorityQueueNode",
"node",
"=",
"new",
"PriorityQueueNode",
"(",
"p... | Insert data with the given priority into the heap and heapify.
@param priority the priority to associate with the new data.
@param value the date to enqueue. | [
"Insert",
"data",
"with",
"the",
"given",
"priority",
"into",
"the",
"heap",
"and",
"heapify",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java#L155-L177 |
tootedom/related | app/domain/src/main/java/org/greencheek/related/elastic/http/ahc/AHCFactory.java | AHCFactory.createClient | public static AsyncHttpClient createClient(Configuration configuration, int numberOfHostsBeingConnectedTo) {
AsyncHttpClientConfig.Builder cf = createClientConfig(configuration);
// A Bug exists in the AsyncConnection library that leak permits on a
// Connection exception (i.e. when host not listening .. hard fail)
// So we do not enable connection tracking. Which is fine as the ring
// buffer does the job of having a single thread talking to the backend repo (ES)
// So the connection should not grow in an unmanaged way, as the ring buffer
// is restricting the connections
// cf.setMaximumConnectionsTotal(numberOfHostsBeingConnectedTo);
cf.setMaximumConnectionsTotal(-1);
cf.setMaximumConnectionsPerHost(-1);
cf.setExecutorService(getExecutorService(numberOfHostsBeingConnectedTo));
return createClient(cf);
} | java | public static AsyncHttpClient createClient(Configuration configuration, int numberOfHostsBeingConnectedTo) {
AsyncHttpClientConfig.Builder cf = createClientConfig(configuration);
// A Bug exists in the AsyncConnection library that leak permits on a
// Connection exception (i.e. when host not listening .. hard fail)
// So we do not enable connection tracking. Which is fine as the ring
// buffer does the job of having a single thread talking to the backend repo (ES)
// So the connection should not grow in an unmanaged way, as the ring buffer
// is restricting the connections
// cf.setMaximumConnectionsTotal(numberOfHostsBeingConnectedTo);
cf.setMaximumConnectionsTotal(-1);
cf.setMaximumConnectionsPerHost(-1);
cf.setExecutorService(getExecutorService(numberOfHostsBeingConnectedTo));
return createClient(cf);
} | [
"public",
"static",
"AsyncHttpClient",
"createClient",
"(",
"Configuration",
"configuration",
",",
"int",
"numberOfHostsBeingConnectedTo",
")",
"{",
"AsyncHttpClientConfig",
".",
"Builder",
"cf",
"=",
"createClientConfig",
"(",
"configuration",
")",
";",
"// A Bug exists ... | Creates a AsyncHttpClient object that can be used for talking to elasticsearch
@param configuration The configuration object containing properties for configuring the http connections
@param numberOfHostsBeingConnectedTo the number of hosts that are currently known about in the es cluster
@return | [
"Creates",
"a",
"AsyncHttpClient",
"object",
"that",
"can",
"be",
"used",
"for",
"talking",
"to",
"elasticsearch"
] | train | https://github.com/tootedom/related/blob/3782dd5a839bbcdc15661d598e8b895aae8aabb7/app/domain/src/main/java/org/greencheek/related/elastic/http/ahc/AHCFactory.java#L30-L46 |
trellis-ldp/trellis | core/http/src/main/java/org/trellisldp/http/impl/GetHandler.java | GetHandler.standardHeaders | public ResponseBuilder standardHeaders(final ResponseBuilder builder) {
// Standard HTTP Headers
builder.lastModified(from(getResource().getModified())).header(VARY, ACCEPT);
final IRI model;
if (getRequest().getExt() == null || DESCRIPTION.equals(getRequest().getExt())) {
if (syntax != null) {
builder.header(VARY, PREFER);
builder.type(syntax.mediaType());
}
model = getResource().getBinaryMetadata().isPresent() && syntax != null
? LDP.RDFSource : getResource().getInteractionModel();
// Link headers from User data
getResource().getExtraLinkRelations().collect(toMap(Entry::getKey, Entry::getValue))
.entrySet().forEach(entry -> builder.link(entry.getKey(), join(" ", entry.getValue())));
} else {
model = LDP.RDFSource;
}
// Add LDP-required headers
addLdpHeaders(builder, model);
// Memento-related headers
addMementoHeaders(builder);
return builder;
} | java | public ResponseBuilder standardHeaders(final ResponseBuilder builder) {
// Standard HTTP Headers
builder.lastModified(from(getResource().getModified())).header(VARY, ACCEPT);
final IRI model;
if (getRequest().getExt() == null || DESCRIPTION.equals(getRequest().getExt())) {
if (syntax != null) {
builder.header(VARY, PREFER);
builder.type(syntax.mediaType());
}
model = getResource().getBinaryMetadata().isPresent() && syntax != null
? LDP.RDFSource : getResource().getInteractionModel();
// Link headers from User data
getResource().getExtraLinkRelations().collect(toMap(Entry::getKey, Entry::getValue))
.entrySet().forEach(entry -> builder.link(entry.getKey(), join(" ", entry.getValue())));
} else {
model = LDP.RDFSource;
}
// Add LDP-required headers
addLdpHeaders(builder, model);
// Memento-related headers
addMementoHeaders(builder);
return builder;
} | [
"public",
"ResponseBuilder",
"standardHeaders",
"(",
"final",
"ResponseBuilder",
"builder",
")",
"{",
"// Standard HTTP Headers",
"builder",
".",
"lastModified",
"(",
"from",
"(",
"getResource",
"(",
")",
".",
"getModified",
"(",
")",
")",
")",
".",
"header",
"(... | Get the standard headers.
@param builder the response builder
@return the response builder | [
"Get",
"the",
"standard",
"headers",
"."
] | train | https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/core/http/src/main/java/org/trellisldp/http/impl/GetHandler.java#L168-L197 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.ifInf | public static Expression ifInf(Expression expression1, Expression expression2, Expression... others) {
return build("IFINF", expression1, expression2, others);
} | java | public static Expression ifInf(Expression expression1, Expression expression2, Expression... others) {
return build("IFINF", expression1, expression2, others);
} | [
"public",
"static",
"Expression",
"ifInf",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
",",
"Expression",
"...",
"others",
")",
"{",
"return",
"build",
"(",
"\"IFINF\"",
",",
"expression1",
",",
"expression2",
",",
"others",
")",
";",
"... | Returned expression results in first non-MISSING, non-Inf number.
Returns MISSING or NULL if a non-number input is encountered first. | [
"Returned",
"expression",
"results",
"in",
"first",
"non",
"-",
"MISSING",
"non",
"-",
"Inf",
"number",
".",
"Returns",
"MISSING",
"or",
"NULL",
"if",
"a",
"non",
"-",
"number",
"input",
"is",
"encountered",
"first",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L100-L102 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java | Agg.rankBy | public static <T, U extends Comparable<? super U>> Collector<T, ?, Optional<Long>> rankBy(U value, Function<? super T, ? extends U> function) {
return rankBy(value, function, naturalOrder());
} | java | public static <T, U extends Comparable<? super U>> Collector<T, ?, Optional<Long>> rankBy(U value, Function<? super T, ? extends U> function) {
return rankBy(value, function, naturalOrder());
} | [
"public",
"static",
"<",
"T",
",",
"U",
"extends",
"Comparable",
"<",
"?",
"super",
"U",
">",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"Optional",
"<",
"Long",
">",
">",
"rankBy",
"(",
"U",
"value",
",",
"Function",
"<",
"?",
"super",
"T",
",",... | Get a {@link Collector} that calculates the derived <code>RANK()</code> function given natural ordering. | [
"Get",
"a",
"{"
] | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java#L669-L671 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/chrono/IsoChronology.java | IsoChronology.zonedDateTime | @Override // override with covariant return type
public ZonedDateTime zonedDateTime(Instant instant, ZoneId zone) {
return ZonedDateTime.ofInstant(instant, zone);
} | java | @Override // override with covariant return type
public ZonedDateTime zonedDateTime(Instant instant, ZoneId zone) {
return ZonedDateTime.ofInstant(instant, zone);
} | [
"@",
"Override",
"// override with covariant return type",
"public",
"ZonedDateTime",
"zonedDateTime",
"(",
"Instant",
"instant",
",",
"ZoneId",
"zone",
")",
"{",
"return",
"ZonedDateTime",
".",
"ofInstant",
"(",
"instant",
",",
"zone",
")",
";",
"}"
] | Obtains an ISO zoned date-time from an instant.
<p>
This is equivalent to {@link ZonedDateTime#ofInstant(Instant, ZoneId)}.
@param instant the instant to convert, not null
@param zone the zone to use, not null
@return the ISO zoned date-time, not null
@throws DateTimeException if unable to create the date-time | [
"Obtains",
"an",
"ISO",
"zoned",
"date",
"-",
"time",
"from",
"an",
"instant",
".",
"<p",
">",
"This",
"is",
"equivalent",
"to",
"{",
"@link",
"ZonedDateTime#ofInstant",
"(",
"Instant",
"ZoneId",
")",
"}",
"."
] | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/chrono/IsoChronology.java#L278-L281 |
voldemort/voldemort | src/java/voldemort/utils/JmxUtils.java | JmxUtils.registerMbean | public static ObjectName registerMbean(String typeName, Object obj) {
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ObjectName name = JmxUtils.createObjectName(JmxUtils.getPackageName(obj.getClass()),
typeName);
registerMbean(server, JmxUtils.createModelMBean(obj), name);
return name;
} | java | public static ObjectName registerMbean(String typeName, Object obj) {
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ObjectName name = JmxUtils.createObjectName(JmxUtils.getPackageName(obj.getClass()),
typeName);
registerMbean(server, JmxUtils.createModelMBean(obj), name);
return name;
} | [
"public",
"static",
"ObjectName",
"registerMbean",
"(",
"String",
"typeName",
",",
"Object",
"obj",
")",
"{",
"MBeanServer",
"server",
"=",
"ManagementFactory",
".",
"getPlatformMBeanServer",
"(",
")",
";",
"ObjectName",
"name",
"=",
"JmxUtils",
".",
"createObject... | Register the given object under the package name of the object's class
with the given type name.
this method using the platform mbean server as returned by
ManagementFactory.getPlatformMBeanServer()
@param typeName The name of the type to register
@param obj The object to register as an mbean | [
"Register",
"the",
"given",
"object",
"under",
"the",
"package",
"name",
"of",
"the",
"object",
"s",
"class",
"with",
"the",
"given",
"type",
"name",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/JmxUtils.java#L300-L306 |
line/armeria | core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedValueResolver.java | AnnotatedValueResolver.ofServiceMethod | static List<AnnotatedValueResolver> ofServiceMethod(Method method, Set<String> pathParams,
List<RequestObjectResolver> objectResolvers) {
return of(method, pathParams, objectResolvers, true, true);
} | java | static List<AnnotatedValueResolver> ofServiceMethod(Method method, Set<String> pathParams,
List<RequestObjectResolver> objectResolvers) {
return of(method, pathParams, objectResolvers, true, true);
} | [
"static",
"List",
"<",
"AnnotatedValueResolver",
">",
"ofServiceMethod",
"(",
"Method",
"method",
",",
"Set",
"<",
"String",
">",
"pathParams",
",",
"List",
"<",
"RequestObjectResolver",
">",
"objectResolvers",
")",
"{",
"return",
"of",
"(",
"method",
",",
"pa... | Returns a list of {@link AnnotatedValueResolver} which is constructed with the specified
{@link Method}, {@code pathParams} and {@code objectResolvers}. | [
"Returns",
"a",
"list",
"of",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedValueResolver.java#L140-L143 |
super-csv/super-csv | super-csv-joda/src/main/java/org/supercsv/cellprocessor/joda/AbstractJodaParsingProcessor.java | AbstractJodaParsingProcessor.execute | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
if (!(value instanceof String)) {
throw new SuperCsvCellProcessorException(String.class, value,
context, this);
}
final String string = (String) value;
final T result;
try {
if (formatter != null) {
result = parse(string, formatter);
} else {
result = parse(string);
}
} catch (IllegalArgumentException e) {
throw new SuperCsvCellProcessorException("Failed to parse value",
context, this, e);
}
return next.execute(result, context);
} | java | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
if (!(value instanceof String)) {
throw new SuperCsvCellProcessorException(String.class, value,
context, this);
}
final String string = (String) value;
final T result;
try {
if (formatter != null) {
result = parse(string, formatter);
} else {
result = parse(string);
}
} catch (IllegalArgumentException e) {
throw new SuperCsvCellProcessorException("Failed to parse value",
context, this, e);
}
return next.execute(result, context);
} | [
"public",
"Object",
"execute",
"(",
"final",
"Object",
"value",
",",
"final",
"CsvContext",
"context",
")",
"{",
"validateInputNotNull",
"(",
"value",
",",
"context",
")",
";",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"String",
")",
")",
"{",
"throw",
... | {@inheritDoc}
@throws SuperCsvCellProcessorException
if value is null or is not a String | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv-joda/src/main/java/org/supercsv/cellprocessor/joda/AbstractJodaParsingProcessor.java#L115-L136 |
eyp/serfj | src/main/java/net/sf/serfj/UrlInspector.java | UrlInspector.getUrlInfo | public UrlInfo getUrlInfo(String url, HttpMethod requestMethod) {
LOGGER.debug("*** Retreiving information from the URL [{}] with method [{}] ***", url, requestMethod);
UrlInfo info = new UrlInfo(url, requestMethod);
// Split URL by slash
String[] splits = url.split("/");
String resource = null;
String id = null;
String action = null;
Integer lastElement = splits.length - 1;
// Reverse loop to start for the resource or action
for (int i = lastElement; i > 0; i--) {
String split = utils.cleanURL(splits[i]);
if (resource == null && isResource(split)) {
resource = utils.singularize(split);
info.setController(getControllerClass(split));
} else if (action == null && !utils.isIdentifier(split) && i == lastElement) {
action = split;
} else if (utils.isIdentifier(split)) {
if (this.isMainId(id, resource, splits[lastElement])) {
id = split;
} else {
info.addId(utils.singularize(splits[i - 1]), split);
}
}
}
// Puts the main resource
info.setResource(resource);
// Puts the main resource's ID
info.addId(id);
// Puts the REST action
info.setAction(deduceAction(id, action, requestMethod));
// Puts the result type
info.setSerializer(this.getSerializerClass(resource, utils.removeQueryString(splits[lastElement])));
info.setExtension(this.utils.getExtension(utils.removeQueryString(splits[lastElement])));
LOGGER.debug("*** URL information retrieved ***");
return info;
} | java | public UrlInfo getUrlInfo(String url, HttpMethod requestMethod) {
LOGGER.debug("*** Retreiving information from the URL [{}] with method [{}] ***", url, requestMethod);
UrlInfo info = new UrlInfo(url, requestMethod);
// Split URL by slash
String[] splits = url.split("/");
String resource = null;
String id = null;
String action = null;
Integer lastElement = splits.length - 1;
// Reverse loop to start for the resource or action
for (int i = lastElement; i > 0; i--) {
String split = utils.cleanURL(splits[i]);
if (resource == null && isResource(split)) {
resource = utils.singularize(split);
info.setController(getControllerClass(split));
} else if (action == null && !utils.isIdentifier(split) && i == lastElement) {
action = split;
} else if (utils.isIdentifier(split)) {
if (this.isMainId(id, resource, splits[lastElement])) {
id = split;
} else {
info.addId(utils.singularize(splits[i - 1]), split);
}
}
}
// Puts the main resource
info.setResource(resource);
// Puts the main resource's ID
info.addId(id);
// Puts the REST action
info.setAction(deduceAction(id, action, requestMethod));
// Puts the result type
info.setSerializer(this.getSerializerClass(resource, utils.removeQueryString(splits[lastElement])));
info.setExtension(this.utils.getExtension(utils.removeQueryString(splits[lastElement])));
LOGGER.debug("*** URL information retrieved ***");
return info;
} | [
"public",
"UrlInfo",
"getUrlInfo",
"(",
"String",
"url",
",",
"HttpMethod",
"requestMethod",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"*** Retreiving information from the URL [{}] with method [{}] ***\"",
",",
"url",
",",
"requestMethod",
")",
";",
"UrlInfo",
"info",
... | Gets the information which comes implicit in the URL, that is, the
identifiers, resources and the REST action.
<p/>
Examples of several URL formats:
<p/>
/orders /orders/1 /orders/new /orders/1/edit /orders/1/some-action
/orders/1/items /orders/1/items/some-action /orders/1/items/new
/orders/1/items/2 /orders/1/items/2/edit
@param url
Url to process.
@param requestMethod
HTTP request method (GET, POST, PUT, DELETE)
@return an object with all the information related with the URL. | [
"Gets",
"the",
"information",
"which",
"comes",
"implicit",
"in",
"the",
"URL",
"that",
"is",
"the",
"identifiers",
"resources",
"and",
"the",
"REST",
"action",
".",
"<p",
"/",
">",
"Examples",
"of",
"several",
"URL",
"formats",
":",
"<p",
"/",
">",
"/",... | train | https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/UrlInspector.java#L68-L104 |
samskivert/samskivert | src/main/java/com/samskivert/jdbc/SimpleRepository.java | SimpleRepository.checkedUpdate | protected void checkedUpdate (final String query, final int count)
throws PersistenceException
{
executeUpdate(new Operation<Object>() {
public Object invoke (Connection conn, DatabaseLiaison liaison)
throws SQLException, PersistenceException
{
Statement stmt = null;
try {
stmt = conn.createStatement();
JDBCUtil.checkedUpdate(stmt, query, 1);
} finally {
JDBCUtil.close(stmt);
}
return null;
}
});
} | java | protected void checkedUpdate (final String query, final int count)
throws PersistenceException
{
executeUpdate(new Operation<Object>() {
public Object invoke (Connection conn, DatabaseLiaison liaison)
throws SQLException, PersistenceException
{
Statement stmt = null;
try {
stmt = conn.createStatement();
JDBCUtil.checkedUpdate(stmt, query, 1);
} finally {
JDBCUtil.close(stmt);
}
return null;
}
});
} | [
"protected",
"void",
"checkedUpdate",
"(",
"final",
"String",
"query",
",",
"final",
"int",
"count",
")",
"throws",
"PersistenceException",
"{",
"executeUpdate",
"(",
"new",
"Operation",
"<",
"Object",
">",
"(",
")",
"{",
"public",
"Object",
"invoke",
"(",
"... | Executes the supplied update query in this repository, throwing an exception if the
modification count is not equal to the specified count. | [
"Executes",
"the",
"supplied",
"update",
"query",
"in",
"this",
"repository",
"throwing",
"an",
"exception",
"if",
"the",
"modification",
"count",
"is",
"not",
"equal",
"to",
"the",
"specified",
"count",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/SimpleRepository.java#L273-L290 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/LocalVariableAnnotation.java | LocalVariableAnnotation.getParameterLocalVariableAnnotation | public static LocalVariableAnnotation getParameterLocalVariableAnnotation(Method method, int local) {
LocalVariableAnnotation lva = getLocalVariableAnnotation(method, local, 0, 0);
if (lva.isNamed()) {
lva.setDescription(LocalVariableAnnotation.PARAMETER_NAMED_ROLE);
} else {
lva.setDescription(LocalVariableAnnotation.PARAMETER_ROLE);
}
return lva;
} | java | public static LocalVariableAnnotation getParameterLocalVariableAnnotation(Method method, int local) {
LocalVariableAnnotation lva = getLocalVariableAnnotation(method, local, 0, 0);
if (lva.isNamed()) {
lva.setDescription(LocalVariableAnnotation.PARAMETER_NAMED_ROLE);
} else {
lva.setDescription(LocalVariableAnnotation.PARAMETER_ROLE);
}
return lva;
} | [
"public",
"static",
"LocalVariableAnnotation",
"getParameterLocalVariableAnnotation",
"(",
"Method",
"method",
",",
"int",
"local",
")",
"{",
"LocalVariableAnnotation",
"lva",
"=",
"getLocalVariableAnnotation",
"(",
"method",
",",
"local",
",",
"0",
",",
"0",
")",
"... | Get a local variable annotation describing a parameter.
@param method
a Method
@param local
the local variable containing the parameter
@return LocalVariableAnnotation describing the parameter | [
"Get",
"a",
"local",
"variable",
"annotation",
"describing",
"a",
"parameter",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/LocalVariableAnnotation.java#L179-L187 |
Red5/red5-server-common | src/main/java/org/red5/server/util/ScopeUtils.java | ScopeUtils.isAncestor | public static boolean isAncestor(IBasicScope from, IBasicScope ancestor) {
IBasicScope current = from;
while (current.hasParent()) {
current = current.getParent();
if (current.equals(ancestor)) {
return true;
}
}
return false;
} | java | public static boolean isAncestor(IBasicScope from, IBasicScope ancestor) {
IBasicScope current = from;
while (current.hasParent()) {
current = current.getParent();
if (current.equals(ancestor)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isAncestor",
"(",
"IBasicScope",
"from",
",",
"IBasicScope",
"ancestor",
")",
"{",
"IBasicScope",
"current",
"=",
"from",
";",
"while",
"(",
"current",
".",
"hasParent",
"(",
")",
")",
"{",
"current",
"=",
"current",
".",
"g... | Check whether one scope is an ancestor of another
@param from
Scope
@param ancestor
Scope to check
@return <pre>
true
</pre>
if ancestor scope is really an ancestor of scope passed as from parameter,
<pre>
false
</pre>
otherwise. | [
"Check",
"whether",
"one",
"scope",
"is",
"an",
"ancestor",
"of",
"another"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/util/ScopeUtils.java#L151-L160 |
Azure/azure-sdk-for-java | authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java | RoleAssignmentsInner.createById | public RoleAssignmentInner createById(String roleAssignmentId, RoleAssignmentProperties properties) {
return createByIdWithServiceResponseAsync(roleAssignmentId, properties).toBlocking().single().body();
} | java | public RoleAssignmentInner createById(String roleAssignmentId, RoleAssignmentProperties properties) {
return createByIdWithServiceResponseAsync(roleAssignmentId, properties).toBlocking().single().body();
} | [
"public",
"RoleAssignmentInner",
"createById",
"(",
"String",
"roleAssignmentId",
",",
"RoleAssignmentProperties",
"properties",
")",
"{",
"return",
"createByIdWithServiceResponseAsync",
"(",
"roleAssignmentId",
",",
"properties",
")",
".",
"toBlocking",
"(",
")",
".",
... | Creates a role assignment by ID.
@param roleAssignmentId The fully qualified ID of the role assignment, including the scope, resource name and resource type. Use the format, /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}.
@param properties Role assignment properties.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RoleAssignmentInner object if successful. | [
"Creates",
"a",
"role",
"assignment",
"by",
"ID",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java#L993-L995 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/MessagingMBeanFactoryImpl.java | MessagingMBeanFactoryImpl.createTopicMBean | private Controllable createTopicMBean(Controllable c) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createPublicationPointMBean", new Object[] { c });
TopicImpl pp = new TopicImpl(_me, c);
controllableMap.put(c, pp);
try {
Dictionary<String, Object> properties = new Hashtable<String, Object>();
properties.put("service.vendor", "IBM");
String cName = c.getName();
properties.put("jmx.objectname", "WebSphere:feature=wasJmsServer,type=Topic,name=" + cName);
ServiceRegistration<TopicMBean> topicMBean = (ServiceRegistration<TopicMBean>) bcontext.registerService(TopicMBean.class.getName(), pp, properties);
serviceObjects.put(cName, topicMBean);
} catch (Exception e) {
SibTr.exception(tc, e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createPublicationPointMBean", new Object[] { pp });
return pp;
} | java | private Controllable createTopicMBean(Controllable c) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createPublicationPointMBean", new Object[] { c });
TopicImpl pp = new TopicImpl(_me, c);
controllableMap.put(c, pp);
try {
Dictionary<String, Object> properties = new Hashtable<String, Object>();
properties.put("service.vendor", "IBM");
String cName = c.getName();
properties.put("jmx.objectname", "WebSphere:feature=wasJmsServer,type=Topic,name=" + cName);
ServiceRegistration<TopicMBean> topicMBean = (ServiceRegistration<TopicMBean>) bcontext.registerService(TopicMBean.class.getName(), pp, properties);
serviceObjects.put(cName, topicMBean);
} catch (Exception e) {
SibTr.exception(tc, e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createPublicationPointMBean", new Object[] { pp });
return pp;
} | [
"private",
"Controllable",
"createTopicMBean",
"(",
"Controllable",
"c",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createPublicationP... | Create an instance of the required MBean and register it
@param c | [
"Create",
"an",
"instance",
"of",
"the",
"required",
"MBean",
"and",
"register",
"it"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/MessagingMBeanFactoryImpl.java#L321-L340 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/MediaAPI.java | MediaAPI.mediaUploadnews | public static Media mediaUploadnews(String access_token,List<Article> articles){
String str = JsonUtil.toJSONString(articles);
String messageJson = "{\"articles\":"+str+"}";
return mediaUploadnews(access_token, messageJson);
} | java | public static Media mediaUploadnews(String access_token,List<Article> articles){
String str = JsonUtil.toJSONString(articles);
String messageJson = "{\"articles\":"+str+"}";
return mediaUploadnews(access_token, messageJson);
} | [
"public",
"static",
"Media",
"mediaUploadnews",
"(",
"String",
"access_token",
",",
"List",
"<",
"Article",
">",
"articles",
")",
"{",
"String",
"str",
"=",
"JsonUtil",
".",
"toJSONString",
"(",
"articles",
")",
";",
"String",
"messageJson",
"=",
"\"{\\\"artic... | 高级群发 构成 MassMPnewsMessage 对象的前置请求接口
@param access_token access_token
@param articles 图文信息 1-10 个
@return Media | [
"高级群发",
"构成",
"MassMPnewsMessage",
"对象的前置请求接口"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/MediaAPI.java#L272-L276 |
seedstack/seed | core/src/main/java/org/seedstack/seed/core/internal/guice/BindingUtils.java | BindingUtils.resolveBindingDefinitions | @SuppressWarnings("unchecked")
public static <T> Map<Key<T>, Class<? extends T>> resolveBindingDefinitions(Class<T> injecteeClass,
Collection<Class<? extends T>> implClasses) {
if (implClasses != null && !implClasses.isEmpty()) {
return resolveBindingDefinitions(injecteeClass, null, implClasses.toArray(new Class[implClasses.size()]));
}
return new HashMap<>();
} | java | @SuppressWarnings("unchecked")
public static <T> Map<Key<T>, Class<? extends T>> resolveBindingDefinitions(Class<T> injecteeClass,
Collection<Class<? extends T>> implClasses) {
if (implClasses != null && !implClasses.isEmpty()) {
return resolveBindingDefinitions(injecteeClass, null, implClasses.toArray(new Class[implClasses.size()]));
}
return new HashMap<>();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Map",
"<",
"Key",
"<",
"T",
">",
",",
"Class",
"<",
"?",
"extends",
"T",
">",
">",
"resolveBindingDefinitions",
"(",
"Class",
"<",
"T",
">",
"injecteeClass",
",",
"... | Same as {@link #resolveBindingDefinitions(Class, Class, Class...)}.
@param injecteeClass the parent class to reach
@param implClasses the sub classes collection
@return a multimap with typeliterals for keys and a list of associated subclasses for values | [
"Same",
"as",
"{",
"@link",
"#resolveBindingDefinitions",
"(",
"Class",
"Class",
"Class",
"...",
")",
"}",
"."
] | train | https://github.com/seedstack/seed/blob/d9cf33bfb2fffcdbb0976f4726e943acda90e828/core/src/main/java/org/seedstack/seed/core/internal/guice/BindingUtils.java#L128-L135 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java | HttpChannelConfig.parseOutgoingBufferSize | private void parseOutgoingBufferSize(Map<Object, Object> props) {
Object value = props.get(HttpConfigConstants.PROPNAME_OUTGOING_HDR_BUFFSIZE);
if (null != value) {
try {
this.outgoingHdrBuffSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_BUFFER_SIZE, HttpConfigConstants.MAX_BUFFER_SIZE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: Outgoing hdr buffer size is " + getOutgoingHdrBufferSize());
}
} catch (NumberFormatException nfe) {
FFDCFilter.processException(nfe, getClass().getName() + ".parseOutgoingBufferSize", "1");
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: Invalid outgoing header buffer size; " + value);
}
}
}
} | java | private void parseOutgoingBufferSize(Map<Object, Object> props) {
Object value = props.get(HttpConfigConstants.PROPNAME_OUTGOING_HDR_BUFFSIZE);
if (null != value) {
try {
this.outgoingHdrBuffSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_BUFFER_SIZE, HttpConfigConstants.MAX_BUFFER_SIZE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: Outgoing hdr buffer size is " + getOutgoingHdrBufferSize());
}
} catch (NumberFormatException nfe) {
FFDCFilter.processException(nfe, getClass().getName() + ".parseOutgoingBufferSize", "1");
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: Invalid outgoing header buffer size; " + value);
}
}
}
} | [
"private",
"void",
"parseOutgoingBufferSize",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
"props",
")",
"{",
"Object",
"value",
"=",
"props",
".",
"get",
"(",
"HttpConfigConstants",
".",
"PROPNAME_OUTGOING_HDR_BUFFSIZE",
")",
";",
"if",
"(",
"null",
"!=",
... | Check the input configuration for the maximum buffer size allowed for
marshalling headers outbound.
@param props | [
"Check",
"the",
"input",
"configuration",
"for",
"the",
"maximum",
"buffer",
"size",
"allowed",
"for",
"marshalling",
"headers",
"outbound",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L566-L581 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.bezierArc | public static ArrayList bezierArc(float x1, float y1, float x2, float y2, float startAng, float extent) {
float tmp;
if (x1 > x2) {
tmp = x1;
x1 = x2;
x2 = tmp;
}
if (y2 > y1) {
tmp = y1;
y1 = y2;
y2 = tmp;
}
float fragAngle;
int Nfrag;
if (Math.abs(extent) <= 90f) {
fragAngle = extent;
Nfrag = 1;
}
else {
Nfrag = (int)(Math.ceil(Math.abs(extent)/90f));
fragAngle = extent / Nfrag;
}
float x_cen = (x1+x2)/2f;
float y_cen = (y1+y2)/2f;
float rx = (x2-x1)/2f;
float ry = (y2-y1)/2f;
float halfAng = (float)(fragAngle * Math.PI / 360.);
float kappa = (float)(Math.abs(4. / 3. * (1. - Math.cos(halfAng)) / Math.sin(halfAng)));
ArrayList pointList = new ArrayList();
for (int i = 0; i < Nfrag; ++i) {
float theta0 = (float)((startAng + i*fragAngle) * Math.PI / 180.);
float theta1 = (float)((startAng + (i+1)*fragAngle) * Math.PI / 180.);
float cos0 = (float)Math.cos(theta0);
float cos1 = (float)Math.cos(theta1);
float sin0 = (float)Math.sin(theta0);
float sin1 = (float)Math.sin(theta1);
if (fragAngle > 0f) {
pointList.add(new float[]{x_cen + rx * cos0,
y_cen - ry * sin0,
x_cen + rx * (cos0 - kappa * sin0),
y_cen - ry * (sin0 + kappa * cos0),
x_cen + rx * (cos1 + kappa * sin1),
y_cen - ry * (sin1 - kappa * cos1),
x_cen + rx * cos1,
y_cen - ry * sin1});
}
else {
pointList.add(new float[]{x_cen + rx * cos0,
y_cen - ry * sin0,
x_cen + rx * (cos0 + kappa * sin0),
y_cen - ry * (sin0 - kappa * cos0),
x_cen + rx * (cos1 - kappa * sin1),
y_cen - ry * (sin1 + kappa * cos1),
x_cen + rx * cos1,
y_cen - ry * sin1});
}
}
return pointList;
} | java | public static ArrayList bezierArc(float x1, float y1, float x2, float y2, float startAng, float extent) {
float tmp;
if (x1 > x2) {
tmp = x1;
x1 = x2;
x2 = tmp;
}
if (y2 > y1) {
tmp = y1;
y1 = y2;
y2 = tmp;
}
float fragAngle;
int Nfrag;
if (Math.abs(extent) <= 90f) {
fragAngle = extent;
Nfrag = 1;
}
else {
Nfrag = (int)(Math.ceil(Math.abs(extent)/90f));
fragAngle = extent / Nfrag;
}
float x_cen = (x1+x2)/2f;
float y_cen = (y1+y2)/2f;
float rx = (x2-x1)/2f;
float ry = (y2-y1)/2f;
float halfAng = (float)(fragAngle * Math.PI / 360.);
float kappa = (float)(Math.abs(4. / 3. * (1. - Math.cos(halfAng)) / Math.sin(halfAng)));
ArrayList pointList = new ArrayList();
for (int i = 0; i < Nfrag; ++i) {
float theta0 = (float)((startAng + i*fragAngle) * Math.PI / 180.);
float theta1 = (float)((startAng + (i+1)*fragAngle) * Math.PI / 180.);
float cos0 = (float)Math.cos(theta0);
float cos1 = (float)Math.cos(theta1);
float sin0 = (float)Math.sin(theta0);
float sin1 = (float)Math.sin(theta1);
if (fragAngle > 0f) {
pointList.add(new float[]{x_cen + rx * cos0,
y_cen - ry * sin0,
x_cen + rx * (cos0 - kappa * sin0),
y_cen - ry * (sin0 + kappa * cos0),
x_cen + rx * (cos1 + kappa * sin1),
y_cen - ry * (sin1 - kappa * cos1),
x_cen + rx * cos1,
y_cen - ry * sin1});
}
else {
pointList.add(new float[]{x_cen + rx * cos0,
y_cen - ry * sin0,
x_cen + rx * (cos0 + kappa * sin0),
y_cen - ry * (sin0 - kappa * cos0),
x_cen + rx * (cos1 - kappa * sin1),
y_cen - ry * (sin1 + kappa * cos1),
x_cen + rx * cos1,
y_cen - ry * sin1});
}
}
return pointList;
} | [
"public",
"static",
"ArrayList",
"bezierArc",
"(",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
",",
"float",
"startAng",
",",
"float",
"extent",
")",
"{",
"float",
"tmp",
";",
"if",
"(",
"x1",
">",
"x2",
")",
"{",
"tm... | Generates an array of bezier curves to draw an arc.
<P>
(x1, y1) and (x2, y2) are the corners of the enclosing rectangle.
Angles, measured in degrees, start with 0 to the right (the positive X
axis) and increase counter-clockwise. The arc extends from startAng
to startAng+extent. I.e. startAng=0 and extent=180 yields an openside-down
semi-circle.
<P>
The resulting coordinates are of the form float[]{x1,y1,x2,y2,x3,y3, x4,y4}
such that the curve goes from (x1, y1) to (x4, y4) with (x2, y2) and
(x3, y3) as their respective Bezier control points.
<P>
Note: this code was taken from ReportLab (www.reportlab.org), an excellent
PDF generator for Python (BSD license: http://www.reportlab.org/devfaq.html#1.3 ).
@param x1 a corner of the enclosing rectangle
@param y1 a corner of the enclosing rectangle
@param x2 a corner of the enclosing rectangle
@param y2 a corner of the enclosing rectangle
@param startAng starting angle in degrees
@param extent angle extent in degrees
@return a list of float[] with the bezier curves | [
"Generates",
"an",
"array",
"of",
"bezier",
"curves",
"to",
"draw",
"an",
"arc",
".",
"<P",
">",
"(",
"x1",
"y1",
")",
"and",
"(",
"x2",
"y2",
")",
"are",
"the",
"corners",
"of",
"the",
"enclosing",
"rectangle",
".",
"Angles",
"measured",
"in",
"degr... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L1810-L1869 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.offerCapabilities_GET | public OvhCapabilities offerCapabilities_GET(OvhOfferCapabilitiesEnum offer) throws IOException {
String qPath = "/hosting/web/offerCapabilities";
StringBuilder sb = path(qPath);
query(sb, "offer", offer);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCapabilities.class);
} | java | public OvhCapabilities offerCapabilities_GET(OvhOfferCapabilitiesEnum offer) throws IOException {
String qPath = "/hosting/web/offerCapabilities";
StringBuilder sb = path(qPath);
query(sb, "offer", offer);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCapabilities.class);
} | [
"public",
"OvhCapabilities",
"offerCapabilities_GET",
"(",
"OvhOfferCapabilitiesEnum",
"offer",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/offerCapabilities\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"query",
"... | Get offer capabilities
REST: GET /hosting/web/offerCapabilities
@param offer [required] Describe offer capabilities | [
"Get",
"offer",
"capabilities"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L2194-L2200 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java | Utils.logException | public static void logException( Logger logger, Level logLevel, Throwable t ) {
logException( logger, logLevel, t, null );
} | java | public static void logException( Logger logger, Level logLevel, Throwable t ) {
logException( logger, logLevel, t, null );
} | [
"public",
"static",
"void",
"logException",
"(",
"Logger",
"logger",
",",
"Level",
"logLevel",
",",
"Throwable",
"t",
")",
"{",
"logException",
"(",
"logger",
",",
"logLevel",
",",
"t",
",",
"null",
")",
";",
"}"
] | Logs an exception with the given logger and the given level.
<p>
Writing a stack trace may be time-consuming in some environments.
To prevent useless computing, this method checks the current log level
before trying to log anything.
</p>
@param logger the logger
@param t an exception or a throwable
@param logLevel the log level (see {@link Level}) | [
"Logs",
"an",
"exception",
"with",
"the",
"given",
"logger",
"and",
"the",
"given",
"level",
".",
"<p",
">",
"Writing",
"a",
"stack",
"trace",
"may",
"be",
"time",
"-",
"consuming",
"in",
"some",
"environments",
".",
"To",
"prevent",
"useless",
"computing"... | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java#L1126-L1128 |
pravega/pravega | controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java | TransactionMetrics.createTransaction | public void createTransaction(String scope, String streamName, Duration latency) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(CREATE_TRANSACTION), 1);
DYNAMIC_LOGGER.incCounterValue(CREATE_TRANSACTION, 1, streamTags(scope, streamName));
createTransactionLatency.reportSuccessValue(latency.toMillis());
} | java | public void createTransaction(String scope, String streamName, Duration latency) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(CREATE_TRANSACTION), 1);
DYNAMIC_LOGGER.incCounterValue(CREATE_TRANSACTION, 1, streamTags(scope, streamName));
createTransactionLatency.reportSuccessValue(latency.toMillis());
} | [
"public",
"void",
"createTransaction",
"(",
"String",
"scope",
",",
"String",
"streamName",
",",
"Duration",
"latency",
")",
"{",
"DYNAMIC_LOGGER",
".",
"incCounterValue",
"(",
"globalMetricName",
"(",
"CREATE_TRANSACTION",
")",
",",
"1",
")",
";",
"DYNAMIC_LOGGER... | This method increments the global and Stream-related counters of created Transactions and reports the latency of
the operation.
@param scope Scope.
@param streamName Name of the Stream.
@param latency Latency of the create Transaction operation. | [
"This",
"method",
"increments",
"the",
"global",
"and",
"Stream",
"-",
"related",
"counters",
"of",
"created",
"Transactions",
"and",
"reports",
"the",
"latency",
"of",
"the",
"operation",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java#L46-L50 |
ujmp/universal-java-matrix-package | ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java | Ginv.swapRows | public static void swapRows(DenseDoubleMatrix2D matrix, long row1, long row2) {
double temp = 0;
long cols = matrix.getColumnCount();
for (long col = 0; col < cols; col++) {
temp = matrix.getDouble(row1, col);
matrix.setDouble(matrix.getDouble(row2, col), row1, col);
matrix.setDouble(temp, row2, col);
}
} | java | public static void swapRows(DenseDoubleMatrix2D matrix, long row1, long row2) {
double temp = 0;
long cols = matrix.getColumnCount();
for (long col = 0; col < cols; col++) {
temp = matrix.getDouble(row1, col);
matrix.setDouble(matrix.getDouble(row2, col), row1, col);
matrix.setDouble(temp, row2, col);
}
} | [
"public",
"static",
"void",
"swapRows",
"(",
"DenseDoubleMatrix2D",
"matrix",
",",
"long",
"row1",
",",
"long",
"row2",
")",
"{",
"double",
"temp",
"=",
"0",
";",
"long",
"cols",
"=",
"matrix",
".",
"getColumnCount",
"(",
")",
";",
"for",
"(",
"long",
... | Swap components in the two rows.
@param matrix
the matrix to modify
@param row1
the first row
@param row2
the second row | [
"Swap",
"components",
"in",
"the",
"two",
"rows",
"."
] | train | https://github.com/ujmp/universal-java-matrix-package/blob/b7e1d293adeadaf35d208ffe8884028d6c06b63b/ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java#L226-L234 |
fcrepo3/fcrepo | fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/decorator/PolicyIndexInvocationHandler.java | PolicyIndexInvocationHandler.invokeTarget | private Object invokeTarget(Object target, Method method, Object[] args) throws Throwable {
Object returnValue;
try {
returnValue = method.invoke(target, args);
} catch(InvocationTargetException ite) {
throw ite.getTargetException();
}
return returnValue;
} | java | private Object invokeTarget(Object target, Method method, Object[] args) throws Throwable {
Object returnValue;
try {
returnValue = method.invoke(target, args);
} catch(InvocationTargetException ite) {
throw ite.getTargetException();
}
return returnValue;
} | [
"private",
"Object",
"invokeTarget",
"(",
"Object",
"target",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"Throwable",
"{",
"Object",
"returnValue",
";",
"try",
"{",
"returnValue",
"=",
"method",
".",
"invoke",
"(",
"target",
"... | Invoke the underlying method, catching any InvocationTargetException and rethrowing the target exception | [
"Invoke",
"the",
"underlying",
"method",
"catching",
"any",
"InvocationTargetException",
"and",
"rethrowing",
"the",
"target",
"exception"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/decorator/PolicyIndexInvocationHandler.java#L313-L321 |
trustathsh/ifmapj | src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identifiers.java | Identifiers.createOtherIdentity | public static Identity createOtherIdentity(String name, String admDom,
String otherTypeDef) {
return createIdentity(IdentityType.other, name, admDom, otherTypeDef);
} | java | public static Identity createOtherIdentity(String name, String admDom,
String otherTypeDef) {
return createIdentity(IdentityType.other, name, admDom, otherTypeDef);
} | [
"public",
"static",
"Identity",
"createOtherIdentity",
"(",
"String",
"name",
",",
"String",
"admDom",
",",
"String",
"otherTypeDef",
")",
"{",
"return",
"createIdentity",
"(",
"IdentityType",
".",
"other",
",",
"name",
",",
"admDom",
",",
"otherTypeDef",
")",
... | Create an other identity identifier.
<b>Note: The type is set to {@link IdentityType#other} by default.</b>
@param name the name of the identity identifier
@param admDom the administrative-domain of the identity identifier
@param otherTypeDef vendor specific {@link String}
@return the new {@link Identity} instance | [
"Create",
"an",
"other",
"identity",
"identifier",
"."
] | train | https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identifiers.java#L508-L511 |
line/armeria | core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedValueResolver.java | AnnotatedValueResolver.ofBeanConstructorOrMethod | static List<AnnotatedValueResolver> ofBeanConstructorOrMethod(Executable constructorOrMethod,
Set<String> pathParams,
List<RequestObjectResolver> objectResolvers) {
return of(constructorOrMethod, pathParams, objectResolvers, false, false);
} | java | static List<AnnotatedValueResolver> ofBeanConstructorOrMethod(Executable constructorOrMethod,
Set<String> pathParams,
List<RequestObjectResolver> objectResolvers) {
return of(constructorOrMethod, pathParams, objectResolvers, false, false);
} | [
"static",
"List",
"<",
"AnnotatedValueResolver",
">",
"ofBeanConstructorOrMethod",
"(",
"Executable",
"constructorOrMethod",
",",
"Set",
"<",
"String",
">",
"pathParams",
",",
"List",
"<",
"RequestObjectResolver",
">",
"objectResolvers",
")",
"{",
"return",
"of",
"(... | Returns a list of {@link AnnotatedValueResolver} which is constructed with the specified
{@code constructorOrMethod}, {@code pathParams} and {@code objectResolvers}. | [
"Returns",
"a",
"list",
"of",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedValueResolver.java#L149-L153 |
nominanuda/zen-project | zen-core/src/main/java/com/nominanuda/zen/xml/DOMBuilder.java | DOMBuilder.charactersRaw | public void charactersRaw(char ch[], int start, int length)
throws SAXException {
if (isOutsideDocElem()
&& XML.isWhiteSpace(ch, start, length))
return; // avoid DOM006 Hierarchy request error
String s = new String(ch, start, length);
append(m_doc.createProcessingInstruction("xslt-next-is-raw",
"formatter-to-dom"));
append(m_doc.createTextNode(s));
} | java | public void charactersRaw(char ch[], int start, int length)
throws SAXException {
if (isOutsideDocElem()
&& XML.isWhiteSpace(ch, start, length))
return; // avoid DOM006 Hierarchy request error
String s = new String(ch, start, length);
append(m_doc.createProcessingInstruction("xslt-next-is-raw",
"formatter-to-dom"));
append(m_doc.createTextNode(s));
} | [
"public",
"void",
"charactersRaw",
"(",
"char",
"ch",
"[",
"]",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"isOutsideDocElem",
"(",
")",
"&&",
"XML",
".",
"isWhiteSpace",
"(",
"ch",
",",
"start",
",",
"len... | If available, when the disable-output-escaping attribute is used, output
raw text without escaping. A PI will be inserted in front of the node
with the name "lotusxsl-next-is-raw" and a value of "formatter-to-dom".
@param ch
Array containing the characters
@param start
Index to start of characters in the array
@param length
Number of characters in the array
@throws SAXException | [
"If",
"available",
"when",
"the",
"disable",
"-",
"output",
"-",
"escaping",
"attribute",
"is",
"used",
"output",
"raw",
"text",
"without",
"escaping",
".",
"A",
"PI",
"will",
"be",
"inserted",
"in",
"front",
"of",
"the",
"node",
"with",
"the",
"name",
"... | train | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-core/src/main/java/com/nominanuda/zen/xml/DOMBuilder.java#L481-L492 |
elki-project/elki | elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/COP.java | COP.computeCentroid | private static void computeCentroid(double[] centroid, Relation<? extends NumberVector> relation, DBIDs ids) {
Arrays.fill(centroid, 0);
int dim = centroid.length;
for(DBIDIter it = ids.iter(); it.valid(); it.advance()) {
NumberVector v = relation.get(it);
for(int i = 0; i < dim; i++) {
centroid[i] += v.doubleValue(i);
}
}
timesEquals(centroid, 1. / ids.size());
} | java | private static void computeCentroid(double[] centroid, Relation<? extends NumberVector> relation, DBIDs ids) {
Arrays.fill(centroid, 0);
int dim = centroid.length;
for(DBIDIter it = ids.iter(); it.valid(); it.advance()) {
NumberVector v = relation.get(it);
for(int i = 0; i < dim; i++) {
centroid[i] += v.doubleValue(i);
}
}
timesEquals(centroid, 1. / ids.size());
} | [
"private",
"static",
"void",
"computeCentroid",
"(",
"double",
"[",
"]",
"centroid",
",",
"Relation",
"<",
"?",
"extends",
"NumberVector",
">",
"relation",
",",
"DBIDs",
"ids",
")",
"{",
"Arrays",
".",
"fill",
"(",
"centroid",
",",
"0",
")",
";",
"int",
... | Recompute the centroid of a set.
@param centroid Scratch buffer
@param relation Input data
@param ids IDs to include | [
"Recompute",
"the",
"centroid",
"of",
"a",
"set",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/COP.java#L285-L295 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java | LinuxTaskController.setup | @Override
void setup() {
super.setup();
//set up job cache directory and associated permissions
String localDirs[] = this.mapredLocalDirs;
for(String localDir : localDirs) {
//Cache root
File cacheDirectory = new File(localDir,TaskTracker.getCacheSubdir());
File jobCacheDirectory = new File(localDir,TaskTracker.getJobCacheSubdir());
if(!cacheDirectory.exists()) {
if(!cacheDirectory.mkdirs()) {
LOG.warn("Unable to create cache directory : " +
cacheDirectory.getPath());
}
}
if(!jobCacheDirectory.exists()) {
if(!jobCacheDirectory.mkdirs()) {
LOG.warn("Unable to create job cache directory : " +
jobCacheDirectory.getPath());
}
}
//Give world writable permission for every directory under
//mapred-local-dir.
//Child tries to write files under it when executing.
changeDirectoryPermissions(localDir, FILE_PERMISSIONS, true);
}//end of local directory manipulations
//setting up perms for user logs
File taskLog = TaskLog.getUserLogDir();
changeDirectoryPermissions(taskLog.getPath(), FILE_PERMISSIONS,false);
} | java | @Override
void setup() {
super.setup();
//set up job cache directory and associated permissions
String localDirs[] = this.mapredLocalDirs;
for(String localDir : localDirs) {
//Cache root
File cacheDirectory = new File(localDir,TaskTracker.getCacheSubdir());
File jobCacheDirectory = new File(localDir,TaskTracker.getJobCacheSubdir());
if(!cacheDirectory.exists()) {
if(!cacheDirectory.mkdirs()) {
LOG.warn("Unable to create cache directory : " +
cacheDirectory.getPath());
}
}
if(!jobCacheDirectory.exists()) {
if(!jobCacheDirectory.mkdirs()) {
LOG.warn("Unable to create job cache directory : " +
jobCacheDirectory.getPath());
}
}
//Give world writable permission for every directory under
//mapred-local-dir.
//Child tries to write files under it when executing.
changeDirectoryPermissions(localDir, FILE_PERMISSIONS, true);
}//end of local directory manipulations
//setting up perms for user logs
File taskLog = TaskLog.getUserLogDir();
changeDirectoryPermissions(taskLog.getPath(), FILE_PERMISSIONS,false);
} | [
"@",
"Override",
"void",
"setup",
"(",
")",
"{",
"super",
".",
"setup",
"(",
")",
";",
"//set up job cache directory and associated permissions",
"String",
"localDirs",
"[",
"]",
"=",
"this",
".",
"mapredLocalDirs",
";",
"for",
"(",
"String",
"localDir",
":",
... | Sets up the permissions of the following directories:
Job cache directory
Archive directory
Hadoop log directories | [
"Sets",
"up",
"the",
"permissions",
"of",
"the",
"following",
"directories",
":"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java#L491-L520 |
tbrooks8/Precipice | precipice-core/src/main/java/net/uncontended/precipice/GuardRail.java | GuardRail.releasePermitsWithoutResult | public void releasePermitsWithoutResult(long number, long nanoTime) {
for (BackPressure<Rejected> backPressure : backPressureList) {
backPressure.releasePermit(number, nanoTime);
}
} | java | public void releasePermitsWithoutResult(long number, long nanoTime) {
for (BackPressure<Rejected> backPressure : backPressureList) {
backPressure.releasePermit(number, nanoTime);
}
} | [
"public",
"void",
"releasePermitsWithoutResult",
"(",
"long",
"number",
",",
"long",
"nanoTime",
")",
"{",
"for",
"(",
"BackPressure",
"<",
"Rejected",
">",
"backPressure",
":",
"backPressureList",
")",
"{",
"backPressure",
".",
"releasePermit",
"(",
"number",
"... | Release acquired permits without result. Since there is not a known result the result
count object and latency will not be updated.
@param number of permits to release
@param nanoTime currentInterval nano time | [
"Release",
"acquired",
"permits",
"without",
"result",
".",
"Since",
"there",
"is",
"not",
"a",
"known",
"result",
"the",
"result",
"count",
"object",
"and",
"latency",
"will",
"not",
"be",
"updated",
"."
] | train | https://github.com/tbrooks8/Precipice/blob/97fae467fd676b16a96b8d88b02569d8fc1f2681/precipice-core/src/main/java/net/uncontended/precipice/GuardRail.java#L102-L106 |
fuinorg/srcgen4j-commons | src/main/java/org/fuin/srcgen4j/commons/SrcGen4JConfig.java | SrcGen4JConfig.createMavenStyleSingleProject | @NotNull
public static SrcGen4JConfig createMavenStyleSingleProject(@NotNull final SrcGen4JContext context, @NotNull final String projectName,
@NotNull @FileExists @IsDirectory final File rootDir) {
Contract.requireArgNotNull("context", context);
Contract.requireArgNotNull(ROOT_DIR_VAR, rootDir);
FileExistsValidator.requireArgValid(ROOT_DIR_VAR, rootDir);
IsDirectoryValidator.requireArgValid(ROOT_DIR_VAR, rootDir);
Contract.requireArgNotNull("projectName", projectName);
final SrcGen4JConfig config = new SrcGen4JConfig();
final List<Project> projects = new ArrayList<>();
final Project project = new Project(projectName, ".");
project.setMaven(true);
projects.add(project);
config.setProjects(projects);
config.init(context, rootDir);
return config;
} | java | @NotNull
public static SrcGen4JConfig createMavenStyleSingleProject(@NotNull final SrcGen4JContext context, @NotNull final String projectName,
@NotNull @FileExists @IsDirectory final File rootDir) {
Contract.requireArgNotNull("context", context);
Contract.requireArgNotNull(ROOT_DIR_VAR, rootDir);
FileExistsValidator.requireArgValid(ROOT_DIR_VAR, rootDir);
IsDirectoryValidator.requireArgValid(ROOT_DIR_VAR, rootDir);
Contract.requireArgNotNull("projectName", projectName);
final SrcGen4JConfig config = new SrcGen4JConfig();
final List<Project> projects = new ArrayList<>();
final Project project = new Project(projectName, ".");
project.setMaven(true);
projects.add(project);
config.setProjects(projects);
config.init(context, rootDir);
return config;
} | [
"@",
"NotNull",
"public",
"static",
"SrcGen4JConfig",
"createMavenStyleSingleProject",
"(",
"@",
"NotNull",
"final",
"SrcGen4JContext",
"context",
",",
"@",
"NotNull",
"final",
"String",
"projectName",
",",
"@",
"NotNull",
"@",
"FileExists",
"@",
"IsDirectory",
"fin... | Creates a new configuration with a single project and a Maven directory structure.
@param context
Current context.
@param projectName
Name of the one and only project.
@param rootDir
Root directory that is available as variable 'srcgen4jRootDir'.
@return New initialized configuration instance. | [
"Creates",
"a",
"new",
"configuration",
"with",
"a",
"single",
"project",
"and",
"a",
"Maven",
"directory",
"structure",
"."
] | train | https://github.com/fuinorg/srcgen4j-commons/blob/bce26fd3167ea91fb2f3ad3fc9a1836d3d9fb14b/src/main/java/org/fuin/srcgen4j/commons/SrcGen4JConfig.java#L428-L446 |
lucee/Lucee | core/src/main/java/lucee/runtime/net/ipsettings/IPSettings.java | IPSettings.put | public synchronized void put(IPRangeNode<Map> ipr, boolean doCheck) {
IPRangeNode parent = ipr.isV4() ? ipv4 : ipv6;
parent.addChild(ipr, doCheck);
version++;
isSorted = false;
} | java | public synchronized void put(IPRangeNode<Map> ipr, boolean doCheck) {
IPRangeNode parent = ipr.isV4() ? ipv4 : ipv6;
parent.addChild(ipr, doCheck);
version++;
isSorted = false;
} | [
"public",
"synchronized",
"void",
"put",
"(",
"IPRangeNode",
"<",
"Map",
">",
"ipr",
",",
"boolean",
"doCheck",
")",
"{",
"IPRangeNode",
"parent",
"=",
"ipr",
".",
"isV4",
"(",
")",
"?",
"ipv4",
":",
"ipv6",
";",
"parent",
".",
"addChild",
"(",
"ipr",
... | all added data should go through this method
@param ipr
@param doCheck | [
"all",
"added",
"data",
"should",
"go",
"through",
"this",
"method"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ipsettings/IPSettings.java#L64-L69 |
alibaba/ARouter | arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java | Postcard.withStringArrayList | public Postcard withStringArrayList(@Nullable String key, @Nullable ArrayList<String> value) {
mBundle.putStringArrayList(key, value);
return this;
} | java | public Postcard withStringArrayList(@Nullable String key, @Nullable ArrayList<String> value) {
mBundle.putStringArrayList(key, value);
return this;
} | [
"public",
"Postcard",
"withStringArrayList",
"(",
"@",
"Nullable",
"String",
"key",
",",
"@",
"Nullable",
"ArrayList",
"<",
"String",
">",
"value",
")",
"{",
"mBundle",
".",
"putStringArrayList",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"... | Inserts an ArrayList value into the mapping of this Bundle, replacing
any existing value for the given key. Either key or value may be null.
@param key a String, or null
@param value an ArrayList object, or null
@return current | [
"Inserts",
"an",
"ArrayList",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | train | https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L442-L445 |
code4everything/util | src/main/java/com/zhazhapan/util/FileExecutor.java | FileExecutor.copyFiles | public static void copyFiles(File[] files, File[] destinationFiles) throws IOException {
int length = Integer.min(files.length, destinationFiles.length);
for (int i = 0; i < length; i++) {
copyFile(files[i], destinationFiles[i]);
}
} | java | public static void copyFiles(File[] files, File[] destinationFiles) throws IOException {
int length = Integer.min(files.length, destinationFiles.length);
for (int i = 0; i < length; i++) {
copyFile(files[i], destinationFiles[i]);
}
} | [
"public",
"static",
"void",
"copyFiles",
"(",
"File",
"[",
"]",
"files",
",",
"File",
"[",
"]",
"destinationFiles",
")",
"throws",
"IOException",
"{",
"int",
"length",
"=",
"Integer",
".",
"min",
"(",
"files",
".",
"length",
",",
"destinationFiles",
".",
... | 批量复制文件,并重命名
@param files 文件数组
@param destinationFiles 目标文件数组,与文件数组一一对应
@throws IOException 异常 | [
"批量复制文件,并重命名"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/FileExecutor.java#L513-L518 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/util/LineInput.java | LineInput.readLine | public int readLine(char[] c,int off,int len)
throws IOException
{
int blen=fillLine(len);
if (blen<0)
return -1;
if (blen==0)
return 0;
_byteBuffer.setStream(_mark,blen);
int read=0;
while(read<len && _reader.ready())
{
int r = _reader.read(c,off+read,len-read);
if (r<=0)
break;
read+=r;
}
_mark=-1;
return read;
} | java | public int readLine(char[] c,int off,int len)
throws IOException
{
int blen=fillLine(len);
if (blen<0)
return -1;
if (blen==0)
return 0;
_byteBuffer.setStream(_mark,blen);
int read=0;
while(read<len && _reader.ready())
{
int r = _reader.read(c,off+read,len-read);
if (r<=0)
break;
read+=r;
}
_mark=-1;
return read;
} | [
"public",
"int",
"readLine",
"(",
"char",
"[",
"]",
"c",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"int",
"blen",
"=",
"fillLine",
"(",
"len",
")",
";",
"if",
"(",
"blen",
"<",
"0",
")",
"return",
"-",
"1",
";",
"... | Read a line ended by CR, LF or CRLF.
The default or supplied encoding is used to convert bytes to
characters.
@param c Character buffer to place the line into.
@param off Offset into the buffer.
@param len Maximum length of line.
@return The length of the line or -1 for EOF.
@exception IOException | [
"Read",
"a",
"line",
"ended",
"by",
"CR",
"LF",
"or",
"CRLF",
".",
"The",
"default",
"or",
"supplied",
"encoding",
"is",
"used",
"to",
"convert",
"bytes",
"to",
"characters",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/LineInput.java#L217-L241 |
apache/groovy | src/main/groovy/groovy/beans/VetoableASTTransformation.java | VetoableASTTransformation.visit | public void visit(ASTNode[] nodes, SourceUnit source) {
if (!(nodes[0] instanceof AnnotationNode) || !(nodes[1] instanceof AnnotatedNode)) {
throw new RuntimeException("Internal error: wrong types: $node.class / $parent.class");
}
AnnotationNode node = (AnnotationNode) nodes[0];
if (nodes[1] instanceof ClassNode) {
addListenerToClass(source, (ClassNode) nodes[1]);
} else {
if ((((FieldNode)nodes[1]).getModifiers() & Opcodes.ACC_FINAL) != 0) {
source.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(
new SyntaxException("@groovy.beans.Vetoable cannot annotate a final property.",
node.getLineNumber(), node.getColumnNumber(), node.getLastLineNumber(), node.getLastColumnNumber()),
source));
}
addListenerToProperty(source, node, (AnnotatedNode) nodes[1]);
}
} | java | public void visit(ASTNode[] nodes, SourceUnit source) {
if (!(nodes[0] instanceof AnnotationNode) || !(nodes[1] instanceof AnnotatedNode)) {
throw new RuntimeException("Internal error: wrong types: $node.class / $parent.class");
}
AnnotationNode node = (AnnotationNode) nodes[0];
if (nodes[1] instanceof ClassNode) {
addListenerToClass(source, (ClassNode) nodes[1]);
} else {
if ((((FieldNode)nodes[1]).getModifiers() & Opcodes.ACC_FINAL) != 0) {
source.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(
new SyntaxException("@groovy.beans.Vetoable cannot annotate a final property.",
node.getLineNumber(), node.getColumnNumber(), node.getLastLineNumber(), node.getLastColumnNumber()),
source));
}
addListenerToProperty(source, node, (AnnotatedNode) nodes[1]);
}
} | [
"public",
"void",
"visit",
"(",
"ASTNode",
"[",
"]",
"nodes",
",",
"SourceUnit",
"source",
")",
"{",
"if",
"(",
"!",
"(",
"nodes",
"[",
"0",
"]",
"instanceof",
"AnnotationNode",
")",
"||",
"!",
"(",
"nodes",
"[",
"1",
"]",
"instanceof",
"AnnotatedNode"... | Handles the bulk of the processing, mostly delegating to other methods.
@param nodes the AST nodes
@param source the source unit for the nodes | [
"Handles",
"the",
"bulk",
"of",
"the",
"processing",
"mostly",
"delegating",
"to",
"other",
"methods",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/beans/VetoableASTTransformation.java#L103-L121 |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/SetupOptions.java | SetupOptions.getWorkDir | public File getWorkDir() {
if (null == this.workDir) {
File dir = new File(teBaseDir, "work");
if (!dir.exists() && !dir.mkdir()) {
throw new RuntimeException("Failed to create directory at "
+ dir.getAbsolutePath());
}
this.workDir = dir;
}
return workDir;
} | java | public File getWorkDir() {
if (null == this.workDir) {
File dir = new File(teBaseDir, "work");
if (!dir.exists() && !dir.mkdir()) {
throw new RuntimeException("Failed to create directory at "
+ dir.getAbsolutePath());
}
this.workDir = dir;
}
return workDir;
} | [
"public",
"File",
"getWorkDir",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"this",
".",
"workDir",
")",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"teBaseDir",
",",
"\"work\"",
")",
";",
"if",
"(",
"!",
"dir",
".",
"exists",
"(",
")",
"&&",
"!",
... | Returns the location of the work directory (TE_BASE/work).
@return A File denoting a directory location; it is created if it does
not exist. | [
"Returns",
"the",
"location",
"of",
"the",
"work",
"directory",
"(",
"TE_BASE",
"/",
"work",
")",
"."
] | train | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/SetupOptions.java#L154-L164 |
hypercube1024/firefly | firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java | HttpFields.addDateField | public void addDateField(String name, long date) {
String d = DateGenerator.formatDate(date);
add(name, d);
} | java | public void addDateField(String name, long date) {
String d = DateGenerator.formatDate(date);
add(name, d);
} | [
"public",
"void",
"addDateField",
"(",
"String",
"name",
",",
"long",
"date",
")",
"{",
"String",
"d",
"=",
"DateGenerator",
".",
"formatDate",
"(",
"date",
")",
";",
"add",
"(",
"name",
",",
"d",
")",
";",
"}"
] | Sets the value of a date field.
@param name the field name
@param date the field date value | [
"Sets",
"the",
"value",
"of",
"a",
"date",
"field",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java#L695-L698 |
bremersee/pagebuilder | bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/PageControlFactory.java | PageControlFactory.newPageControl | public <E, T> PageControlDto newPageControl(final Page<E> page, final PageEntryTransformer<T, E> transformer,
final String pageUrl, final Locale locale) {
return newPageControl(PageBuilderUtils.createPageDto(page, transformer), pageUrl, locale);
} | java | public <E, T> PageControlDto newPageControl(final Page<E> page, final PageEntryTransformer<T, E> transformer,
final String pageUrl, final Locale locale) {
return newPageControl(PageBuilderUtils.createPageDto(page, transformer), pageUrl, locale);
} | [
"public",
"<",
"E",
",",
"T",
">",
"PageControlDto",
"newPageControl",
"(",
"final",
"Page",
"<",
"E",
">",
"page",
",",
"final",
"PageEntryTransformer",
"<",
"T",
",",
"E",
">",
"transformer",
",",
"final",
"String",
"pageUrl",
",",
"final",
"Locale",
"... | Creates a new {@link PageControlDto} from the given page.<br>
The page URL must be the plain URL (with no page control query
parameters), e. g.: http://example.org/myapp/mypage.html<br>
If the locale is not present, the default locale will be used.
@param page the page
@param transformer the page entry transformer (may be {@code null})
@param pageUrl the plain page URL
@param locale the locale
@param <E> source type of the page entries
@param <T> target type of the page entries
@return the created page control | [
"Creates",
"a",
"new",
"{",
"@link",
"PageControlDto",
"}",
"from",
"the",
"given",
"page",
".",
"<br",
">",
"The",
"page",
"URL",
"must",
"be",
"the",
"plain",
"URL",
"(",
"with",
"no",
"page",
"control",
"query",
"parameters",
")",
"e",
".",
"g",
"... | train | https://github.com/bremersee/pagebuilder/blob/498614b02f577b08d2d65131ba472a09f080a192/bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/PageControlFactory.java#L390-L393 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.vps_serviceName_ip_duration_GET | public OvhOrder vps_serviceName_ip_duration_GET(String serviceName, String duration, OvhGeolocationEnum country, Long number) throws IOException {
String qPath = "/order/vps/{serviceName}/ip/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
query(sb, "country", country);
query(sb, "number", number);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder vps_serviceName_ip_duration_GET(String serviceName, String duration, OvhGeolocationEnum country, Long number) throws IOException {
String qPath = "/order/vps/{serviceName}/ip/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
query(sb, "country", country);
query(sb, "number", number);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"vps_serviceName_ip_duration_GET",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"OvhGeolocationEnum",
"country",
",",
"Long",
"number",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/vps/{serviceName}/ip/{durati... | Get prices and contracts information
REST: GET /order/vps/{serviceName}/ip/{duration}
@param number [required] Number of IPs to order
@param country [required] Choose a geolocation for your IP Address
@param serviceName [required] The internal name of your VPS offer
@param duration [required] Duration | [
"Get",
"prices",
"and",
"contracts",
"information"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3418-L3425 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/JobLauncherUtils.java | JobLauncherUtils.cleanJobStagingData | public static void cleanJobStagingData(State state, Logger logger) throws IOException {
Preconditions.checkArgument(state.contains(ConfigurationKeys.WRITER_STAGING_DIR),
"Missing required property " + ConfigurationKeys.WRITER_STAGING_DIR);
Preconditions.checkArgument(state.contains(ConfigurationKeys.WRITER_OUTPUT_DIR),
"Missing required property " + ConfigurationKeys.WRITER_OUTPUT_DIR);
String writerFsUri = state.getProp(ConfigurationKeys.WRITER_FILE_SYSTEM_URI, ConfigurationKeys.LOCAL_FS_URI);
FileSystem fs = getFsWithProxy(state, writerFsUri, WriterUtils.getFsConfiguration(state));
Path jobStagingPath = new Path(state.getProp(ConfigurationKeys.WRITER_STAGING_DIR));
logger.info("Cleaning up staging directory " + jobStagingPath);
HadoopUtils.deletePath(fs, jobStagingPath, true);
if (fs.exists(jobStagingPath.getParent()) && fs.listStatus(jobStagingPath.getParent()).length == 0) {
logger.info("Deleting directory " + jobStagingPath.getParent());
HadoopUtils.deletePath(fs, jobStagingPath.getParent(), true);
}
Path jobOutputPath = new Path(state.getProp(ConfigurationKeys.WRITER_OUTPUT_DIR));
logger.info("Cleaning up output directory " + jobOutputPath);
HadoopUtils.deletePath(fs, jobOutputPath, true);
if (fs.exists(jobOutputPath.getParent()) && fs.listStatus(jobOutputPath.getParent()).length == 0) {
logger.info("Deleting directory " + jobOutputPath.getParent());
HadoopUtils.deletePath(fs, jobOutputPath.getParent(), true);
}
if (state.contains(ConfigurationKeys.ROW_LEVEL_ERR_FILE)) {
if (state.getPropAsBoolean(ConfigurationKeys.CLEAN_ERR_DIR, ConfigurationKeys.DEFAULT_CLEAN_ERR_DIR)) {
Path jobErrPath = new Path(state.getProp(ConfigurationKeys.ROW_LEVEL_ERR_FILE));
log.info("Cleaning up err directory : " + jobErrPath);
HadoopUtils.deleteIfExists(fs, jobErrPath, true);
}
}
} | java | public static void cleanJobStagingData(State state, Logger logger) throws IOException {
Preconditions.checkArgument(state.contains(ConfigurationKeys.WRITER_STAGING_DIR),
"Missing required property " + ConfigurationKeys.WRITER_STAGING_DIR);
Preconditions.checkArgument(state.contains(ConfigurationKeys.WRITER_OUTPUT_DIR),
"Missing required property " + ConfigurationKeys.WRITER_OUTPUT_DIR);
String writerFsUri = state.getProp(ConfigurationKeys.WRITER_FILE_SYSTEM_URI, ConfigurationKeys.LOCAL_FS_URI);
FileSystem fs = getFsWithProxy(state, writerFsUri, WriterUtils.getFsConfiguration(state));
Path jobStagingPath = new Path(state.getProp(ConfigurationKeys.WRITER_STAGING_DIR));
logger.info("Cleaning up staging directory " + jobStagingPath);
HadoopUtils.deletePath(fs, jobStagingPath, true);
if (fs.exists(jobStagingPath.getParent()) && fs.listStatus(jobStagingPath.getParent()).length == 0) {
logger.info("Deleting directory " + jobStagingPath.getParent());
HadoopUtils.deletePath(fs, jobStagingPath.getParent(), true);
}
Path jobOutputPath = new Path(state.getProp(ConfigurationKeys.WRITER_OUTPUT_DIR));
logger.info("Cleaning up output directory " + jobOutputPath);
HadoopUtils.deletePath(fs, jobOutputPath, true);
if (fs.exists(jobOutputPath.getParent()) && fs.listStatus(jobOutputPath.getParent()).length == 0) {
logger.info("Deleting directory " + jobOutputPath.getParent());
HadoopUtils.deletePath(fs, jobOutputPath.getParent(), true);
}
if (state.contains(ConfigurationKeys.ROW_LEVEL_ERR_FILE)) {
if (state.getPropAsBoolean(ConfigurationKeys.CLEAN_ERR_DIR, ConfigurationKeys.DEFAULT_CLEAN_ERR_DIR)) {
Path jobErrPath = new Path(state.getProp(ConfigurationKeys.ROW_LEVEL_ERR_FILE));
log.info("Cleaning up err directory : " + jobErrPath);
HadoopUtils.deleteIfExists(fs, jobErrPath, true);
}
}
} | [
"public",
"static",
"void",
"cleanJobStagingData",
"(",
"State",
"state",
",",
"Logger",
"logger",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"state",
".",
"contains",
"(",
"ConfigurationKeys",
".",
"WRITER_STAGING_DIR",
")",
",... | Cleanup staging data of all tasks of a job.
@param state a {@link State} instance storing job configuration properties
@param logger a {@link Logger} used for logging | [
"Cleanup",
"staging",
"data",
"of",
"all",
"tasks",
"of",
"a",
"job",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/JobLauncherUtils.java#L134-L168 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addErrorsFailedToStopJob | public FessMessages addErrorsFailedToStopJob(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_failed_to_stop_job, arg0));
return this;
} | java | public FessMessages addErrorsFailedToStopJob(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_failed_to_stop_job, arg0));
return this;
} | [
"public",
"FessMessages",
"addErrorsFailedToStopJob",
"(",
"String",
"property",
",",
"String",
"arg0",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"ERRORS_failed_to_stop_job",
",",
"arg0",
... | Add the created action message for the key 'errors.failed_to_stop_job' with parameters.
<pre>
message: Failed to stop job {0}.
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"errors",
".",
"failed_to_stop_job",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"Failed",
"to",
"stop",
"job",
"{",
"0",
"}",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L1537-L1541 |
super-csv/super-csv | super-csv/src/main/java/org/supercsv/cellprocessor/ParseBool.java | ParseBool.execute | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
if( !(value instanceof String) ) {
throw new SuperCsvCellProcessorException(String.class, value, context, this);
}
final String stringValue = (String) value;
final Boolean result;
if( contains(trueValues, stringValue, ignoreCase) ) {
result = Boolean.TRUE;
} else if( contains(falseValues, stringValue, ignoreCase) ) {
result = Boolean.FALSE;
} else {
throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a Boolean", value),
context, this);
}
return next.execute(result, context);
} | java | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
if( !(value instanceof String) ) {
throw new SuperCsvCellProcessorException(String.class, value, context, this);
}
final String stringValue = (String) value;
final Boolean result;
if( contains(trueValues, stringValue, ignoreCase) ) {
result = Boolean.TRUE;
} else if( contains(falseValues, stringValue, ignoreCase) ) {
result = Boolean.FALSE;
} else {
throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a Boolean", value),
context, this);
}
return next.execute(result, context);
} | [
"public",
"Object",
"execute",
"(",
"final",
"Object",
"value",
",",
"final",
"CsvContext",
"context",
")",
"{",
"validateInputNotNull",
"(",
"value",
",",
"context",
")",
";",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"String",
")",
")",
"{",
"throw",
... | {@inheritDoc}
@throws SuperCsvCellProcessorException
if value is null, not a String, or can't be parsed to a Boolean | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/ParseBool.java#L326-L345 |
Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java | CompletableFuture.supplyAsync | public static <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier) {
return asyncSupplyStage(ASYNC_POOL, supplier);
} | java | public static <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier) {
return asyncSupplyStage(ASYNC_POOL, supplier);
} | [
"public",
"static",
"<",
"U",
">",
"CompletableFuture",
"<",
"U",
">",
"supplyAsync",
"(",
"Supplier",
"<",
"U",
">",
"supplier",
")",
"{",
"return",
"asyncSupplyStage",
"(",
"ASYNC_POOL",
",",
"supplier",
")",
";",
"}"
] | Returns a new CompletableFuture that is asynchronously completed by a task running in the
{@link ForkJoinPool#commonPool()} with the value obtained by calling the given Supplier.
@param supplier a function returning the value to be used to complete the returned
CompletableFuture
@param <U> the function's return type
@return the new CompletableFuture | [
"Returns",
"a",
"new",
"CompletableFuture",
"that",
"is",
"asynchronously",
"completed",
"by",
"a",
"task",
"running",
"in",
"the",
"{",
"@link",
"ForkJoinPool#commonPool",
"()",
"}",
"with",
"the",
"value",
"obtained",
"by",
"calling",
"the",
"given",
"Supplier... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java#L394-L396 |
op4j/op4j | src/main/java/org/op4j/functions/FnString.java | FnString.replaceFirst | public static final Function<String,String> replaceFirst(final String regex, final String replacement) {
return new Replace(regex, replacement, ReplaceType.FIRST);
} | java | public static final Function<String,String> replaceFirst(final String regex, final String replacement) {
return new Replace(regex, replacement, ReplaceType.FIRST);
} | [
"public",
"static",
"final",
"Function",
"<",
"String",
",",
"String",
">",
"replaceFirst",
"(",
"final",
"String",
"regex",
",",
"final",
"String",
"replacement",
")",
"{",
"return",
"new",
"Replace",
"(",
"regex",
",",
"replacement",
",",
"ReplaceType",
".... | <p>
Replaces in the target String the first substring matching the specified regular expression
with the specified replacement String.
</p>
<p>
Regular expressions must conform to the <tt>java.util.regex.Pattern</tt> format.
</p>
@param regex the regular expression to match against
@param replacement the replacement string
@return the resulting String | [
"<p",
">",
"Replaces",
"in",
"the",
"target",
"String",
"the",
"first",
"substring",
"matching",
"the",
"specified",
"regular",
"expression",
"with",
"the",
"specified",
"replacement",
"String",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Regular",
"expressions",
"... | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L2022-L2024 |
omadahealth/CircularBarPager | library/src/main/java/com/github/omadahealth/circularbarpager/library/CircularBar.java | CircularBar.loadStyledAttributes | public void loadStyledAttributes(AttributeSet attrs, int defStyleAttr) {
if (attrs != null) {
final TypedArray attributes = mContext.getTheme().obtainStyledAttributes(attrs, R.styleable.CircularViewPager,
defStyleAttr, 0);
mStartLineEnabled = attributes.getBoolean(R.styleable.CircularViewPager_progress_start_line_enabled, true);
mClockwiseArcColor = attributes.getColor(R.styleable.CircularViewPager_progress_arc_clockwise_color, default_clockwise_reached_color);
mCounterClockwiseArcColor = attributes.getColor(R.styleable.CircularViewPager_progress_arc_counter_clockwise_color, default_counter_clockwise_reached_color);
mClockwiseOutlineArcColor = attributes.getColor(R.styleable.CircularViewPager_progress_arc_clockwise_outline_color, default_clockwise_outline_color);
mCounterClockwiseOutlineArcColor = attributes.getColor(R.styleable.CircularViewPager_progress_arc_counter_clockwise_outline_color, default_counter_clockwise_outline_color);
mClockwiseReachedArcWidth = attributes.getDimension(R.styleable.CircularViewPager_progress_arc_clockwise_width, default_reached_arc_width);
mCounterClockwiseReachedArcWidth = attributes.getDimension(R.styleable.CircularViewPager_progress_arc_counter_clockwise_width, default_reached_arc_width);
mClockwiseOutlineArcWidth = attributes.getDimension(R.styleable.CircularViewPager_progress_arc_clockwise_outline_width, default_outline_arc_width);
mCounterClockwiseOutlineArcWidth = attributes.getDimension(R.styleable.CircularViewPager_progress_arc_counter_clockwise_outline_width, default_outline_arc_width);
mCircleFillColor = attributes.getColor(R.styleable.CircularViewPager_progress_pager_fill_circle_color, default_circle_fill_color);
mCircleFillMode = attributes.getInt(R.styleable.CircularViewPager_progress_pager_fill_mode, default_circle_fill_mode);
cicleFillEnable(mCircleFillColor != default_circle_fill_color);
setMax(attributes.getInt(R.styleable.CircularViewPager_progress_arc_max, 100));
setProgress(attributes.getInt(R.styleable.CircularViewPager_arc_progress, 0));
attributes.recycle();
initializePainters();
}
} | java | public void loadStyledAttributes(AttributeSet attrs, int defStyleAttr) {
if (attrs != null) {
final TypedArray attributes = mContext.getTheme().obtainStyledAttributes(attrs, R.styleable.CircularViewPager,
defStyleAttr, 0);
mStartLineEnabled = attributes.getBoolean(R.styleable.CircularViewPager_progress_start_line_enabled, true);
mClockwiseArcColor = attributes.getColor(R.styleable.CircularViewPager_progress_arc_clockwise_color, default_clockwise_reached_color);
mCounterClockwiseArcColor = attributes.getColor(R.styleable.CircularViewPager_progress_arc_counter_clockwise_color, default_counter_clockwise_reached_color);
mClockwiseOutlineArcColor = attributes.getColor(R.styleable.CircularViewPager_progress_arc_clockwise_outline_color, default_clockwise_outline_color);
mCounterClockwiseOutlineArcColor = attributes.getColor(R.styleable.CircularViewPager_progress_arc_counter_clockwise_outline_color, default_counter_clockwise_outline_color);
mClockwiseReachedArcWidth = attributes.getDimension(R.styleable.CircularViewPager_progress_arc_clockwise_width, default_reached_arc_width);
mCounterClockwiseReachedArcWidth = attributes.getDimension(R.styleable.CircularViewPager_progress_arc_counter_clockwise_width, default_reached_arc_width);
mClockwiseOutlineArcWidth = attributes.getDimension(R.styleable.CircularViewPager_progress_arc_clockwise_outline_width, default_outline_arc_width);
mCounterClockwiseOutlineArcWidth = attributes.getDimension(R.styleable.CircularViewPager_progress_arc_counter_clockwise_outline_width, default_outline_arc_width);
mCircleFillColor = attributes.getColor(R.styleable.CircularViewPager_progress_pager_fill_circle_color, default_circle_fill_color);
mCircleFillMode = attributes.getInt(R.styleable.CircularViewPager_progress_pager_fill_mode, default_circle_fill_mode);
cicleFillEnable(mCircleFillColor != default_circle_fill_color);
setMax(attributes.getInt(R.styleable.CircularViewPager_progress_arc_max, 100));
setProgress(attributes.getInt(R.styleable.CircularViewPager_arc_progress, 0));
attributes.recycle();
initializePainters();
}
} | [
"public",
"void",
"loadStyledAttributes",
"(",
"AttributeSet",
"attrs",
",",
"int",
"defStyleAttr",
")",
"{",
"if",
"(",
"attrs",
"!=",
"null",
")",
"{",
"final",
"TypedArray",
"attributes",
"=",
"mContext",
".",
"getTheme",
"(",
")",
".",
"obtainStyledAttribu... | Loads the styles and attributes defined in the xml tag of this class
@param attrs The attributes to read from
@param defStyleAttr The styles to read from | [
"Loads",
"the",
"styles",
"and",
"attributes",
"defined",
"in",
"the",
"xml",
"tag",
"of",
"this",
"class"
] | train | https://github.com/omadahealth/CircularBarPager/blob/3a43e8828849da727fd13345e83b8432f7271155/library/src/main/java/com/github/omadahealth/circularbarpager/library/CircularBar.java#L438-L466 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java | OjbTagsHandler.forAllSubClasses | public void forAllSubClasses(String template, Properties attributes) throws XDocletException
{
ArrayList subTypes = new ArrayList();
XClass type = getCurrentClass();
addDirectSubTypes(type, subTypes);
int pos = 0;
ClassDescriptorDef classDef;
while (pos < subTypes.size())
{
type = (XClass)subTypes.get(pos);
classDef = _model.getClass(type.getQualifiedName());
if ((classDef != null) && classDef.hasProperty(PropertyHelper.OJB_PROPERTY_OJB_PERSISTENT))
{
pos++;
}
else
{
subTypes.remove(pos);
addDirectSubTypes(type, subTypes);
}
}
for (Iterator it = subTypes.iterator(); it.hasNext(); )
{
pushCurrentClass((XClass)it.next());
generate(template);
popCurrentClass();
}
} | java | public void forAllSubClasses(String template, Properties attributes) throws XDocletException
{
ArrayList subTypes = new ArrayList();
XClass type = getCurrentClass();
addDirectSubTypes(type, subTypes);
int pos = 0;
ClassDescriptorDef classDef;
while (pos < subTypes.size())
{
type = (XClass)subTypes.get(pos);
classDef = _model.getClass(type.getQualifiedName());
if ((classDef != null) && classDef.hasProperty(PropertyHelper.OJB_PROPERTY_OJB_PERSISTENT))
{
pos++;
}
else
{
subTypes.remove(pos);
addDirectSubTypes(type, subTypes);
}
}
for (Iterator it = subTypes.iterator(); it.hasNext(); )
{
pushCurrentClass((XClass)it.next());
generate(template);
popCurrentClass();
}
} | [
"public",
"void",
"forAllSubClasses",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"ArrayList",
"subTypes",
"=",
"new",
"ArrayList",
"(",
")",
";",
"XClass",
"type",
"=",
"getCurrentClass",
"(",
")",
";",
... | The <code>forAllSubClasses</code> method iterates through all sub types of the current type (classes if it is a
class or classes and interfaces for an interface).
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" | [
"The",
"<code",
">",
"forAllSubClasses<",
"/",
"code",
">",
"method",
"iterates",
"through",
"all",
"sub",
"types",
"of",
"the",
"current",
"type",
"(",
"classes",
"if",
"it",
"is",
"a",
"class",
"or",
"classes",
"and",
"interfaces",
"for",
"an",
"interfac... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L283-L313 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/MemcachedClient.java | MemcachedClient.getBulk | @Override
public Map<String, Object> getBulk(Collection<String> keys) {
return getBulk(keys, transcoder);
} | java | @Override
public Map<String, Object> getBulk(Collection<String> keys) {
return getBulk(keys, transcoder);
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getBulk",
"(",
"Collection",
"<",
"String",
">",
"keys",
")",
"{",
"return",
"getBulk",
"(",
"keys",
",",
"transcoder",
")",
";",
"}"
] | Get the values for multiple keys from the cache.
@param keys the keys
@return a map of the values (for each value that exists)
@throws OperationTimeoutException if the global operation timeout is
exceeded
@throws IllegalStateException in the rare circumstance where queue is too
full to accept any more requests | [
"Get",
"the",
"values",
"for",
"multiple",
"keys",
"from",
"the",
"cache",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L1614-L1617 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java | PropertiesConfigHelper.getCustomBundleVariantSets | public Map<String, VariantSet> getCustomBundleVariantSets(String bundleName) {
Map<String, VariantSet> variantSets = new HashMap<>();
StringTokenizer tk = new StringTokenizer(
getCustomBundleProperty(bundleName, PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_VARIANTS, ""), ";");
while (tk.hasMoreTokens()) {
String[] mapEntry = tk.nextToken().trim().split(":");
String type = mapEntry[0];
String defaultVariant = mapEntry[1];
String values = mapEntry[2];
String[] variantsArray = StringUtils.split(values, ",");
List<String> variants = new ArrayList<>();
variants.addAll(Arrays.asList(variantsArray));
VariantSet variantSet = new VariantSet(type, defaultVariant, variants);
variantSets.put(type, variantSet);
}
return variantSets;
} | java | public Map<String, VariantSet> getCustomBundleVariantSets(String bundleName) {
Map<String, VariantSet> variantSets = new HashMap<>();
StringTokenizer tk = new StringTokenizer(
getCustomBundleProperty(bundleName, PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_VARIANTS, ""), ";");
while (tk.hasMoreTokens()) {
String[] mapEntry = tk.nextToken().trim().split(":");
String type = mapEntry[0];
String defaultVariant = mapEntry[1];
String values = mapEntry[2];
String[] variantsArray = StringUtils.split(values, ",");
List<String> variants = new ArrayList<>();
variants.addAll(Arrays.asList(variantsArray));
VariantSet variantSet = new VariantSet(type, defaultVariant, variants);
variantSets.put(type, variantSet);
}
return variantSets;
} | [
"public",
"Map",
"<",
"String",
",",
"VariantSet",
">",
"getCustomBundleVariantSets",
"(",
"String",
"bundleName",
")",
"{",
"Map",
"<",
"String",
",",
"VariantSet",
">",
"variantSets",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"StringTokenizer",
"tk",
"="... | Returns the map of variantSet for the bundle
@param bundleName
the bundle name
@return the map of variantSet for the bundle | [
"Returns",
"the",
"map",
"of",
"variantSet",
"for",
"the",
"bundle"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java#L241-L260 |
cdk/cdk | storage/inchi/src/main/java/org/openscience/cdk/graph/invariant/InChINumbersTools.java | InChINumbersTools.parseAuxInfo | public static void parseAuxInfo(String aux, long[] numbers) {
aux = aux.substring(aux.indexOf("/N:") + 3);
String numberStringAux = aux.substring(0, aux.indexOf('/'));
int i = 1;
for (String numberString : numberStringAux.split("[,;]"))
numbers[Integer.valueOf(numberString) - 1] = i++;
} | java | public static void parseAuxInfo(String aux, long[] numbers) {
aux = aux.substring(aux.indexOf("/N:") + 3);
String numberStringAux = aux.substring(0, aux.indexOf('/'));
int i = 1;
for (String numberString : numberStringAux.split("[,;]"))
numbers[Integer.valueOf(numberString) - 1] = i++;
} | [
"public",
"static",
"void",
"parseAuxInfo",
"(",
"String",
"aux",
",",
"long",
"[",
"]",
"numbers",
")",
"{",
"aux",
"=",
"aux",
".",
"substring",
"(",
"aux",
".",
"indexOf",
"(",
"\"/N:\"",
")",
"+",
"3",
")",
";",
"String",
"numberStringAux",
"=",
... | Parse the atom numbering from the auxinfo.
@param aux InChI AuxInfo
@param numbers the atom numbers | [
"Parse",
"the",
"atom",
"numbering",
"from",
"the",
"auxinfo",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/inchi/src/main/java/org/openscience/cdk/graph/invariant/InChINumbersTools.java#L63-L69 |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/io/MatFileReader.java | MatFileReader.readHeader | private void readHeader(ByteBuffer buf) throws IOException
{
//header values
String description;
int version;
byte[] endianIndicator = new byte[2];
// This part of the header is missing if the file isn't a regular mat file. So ignore.
if (matType == MatFileType.Regular) {
//descriptive text 116 bytes
byte[] descriptionBuffer = new byte[116];
buf.get(descriptionBuffer);
description = zeroEndByteArrayToString(descriptionBuffer);
if (!description.matches("MATLAB 5.0 MAT-file.*")) {
throw new MatlabIOException("This is not a valid MATLAB 5.0 MAT-file.");
}
//subsyst data offset 8 bytes
buf.position(buf.position() + 8);
} else {
description = "Simulink generated MATLAB 5.0 MAT-file"; // Default simulink description.
}
byte[] bversion = new byte[2];
//version 2 bytes
buf.get(bversion);
//endian indicator 2 bytes
buf.get(endianIndicator);
//program reading the MAT-file must perform byte swapping to interpret the data
//in the MAT-file correctly
if ( (char)endianIndicator[0] == 'I' && (char)endianIndicator[1] == 'M')
{
byteOrder = ByteOrder.LITTLE_ENDIAN;
version = bversion[1] & 0xff | bversion[0] << 8;
}
else
{
byteOrder = ByteOrder.BIG_ENDIAN;
version = bversion[0] & 0xff | bversion[1] << 8;
}
buf.order( byteOrder );
matFileHeader = new MatFileHeader(description, version, endianIndicator, byteOrder);
// After the header, the next read must be aligned. Thus force the alignment. Only matters with reduced header data,
// but apply it regardless for safety.
buf.position((buf.position() + 7) & 0xfffffff8);
} | java | private void readHeader(ByteBuffer buf) throws IOException
{
//header values
String description;
int version;
byte[] endianIndicator = new byte[2];
// This part of the header is missing if the file isn't a regular mat file. So ignore.
if (matType == MatFileType.Regular) {
//descriptive text 116 bytes
byte[] descriptionBuffer = new byte[116];
buf.get(descriptionBuffer);
description = zeroEndByteArrayToString(descriptionBuffer);
if (!description.matches("MATLAB 5.0 MAT-file.*")) {
throw new MatlabIOException("This is not a valid MATLAB 5.0 MAT-file.");
}
//subsyst data offset 8 bytes
buf.position(buf.position() + 8);
} else {
description = "Simulink generated MATLAB 5.0 MAT-file"; // Default simulink description.
}
byte[] bversion = new byte[2];
//version 2 bytes
buf.get(bversion);
//endian indicator 2 bytes
buf.get(endianIndicator);
//program reading the MAT-file must perform byte swapping to interpret the data
//in the MAT-file correctly
if ( (char)endianIndicator[0] == 'I' && (char)endianIndicator[1] == 'M')
{
byteOrder = ByteOrder.LITTLE_ENDIAN;
version = bversion[1] & 0xff | bversion[0] << 8;
}
else
{
byteOrder = ByteOrder.BIG_ENDIAN;
version = bversion[0] & 0xff | bversion[1] << 8;
}
buf.order( byteOrder );
matFileHeader = new MatFileHeader(description, version, endianIndicator, byteOrder);
// After the header, the next read must be aligned. Thus force the alignment. Only matters with reduced header data,
// but apply it regardless for safety.
buf.position((buf.position() + 7) & 0xfffffff8);
} | [
"private",
"void",
"readHeader",
"(",
"ByteBuffer",
"buf",
")",
"throws",
"IOException",
"{",
"//header values",
"String",
"description",
";",
"int",
"version",
";",
"byte",
"[",
"]",
"endianIndicator",
"=",
"new",
"byte",
"[",
"2",
"]",
";",
"// This part of ... | Reads MAT-file header.
Modifies <code>buf</code> position.
@param buf
<code>ByteBuffer</code>
@throws IOException
if reading from buffer fails or if this is not a valid
MAT-file | [
"Reads",
"MAT",
"-",
"file",
"header",
"."
] | train | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/io/MatFileReader.java#L1370-L1422 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java | SessionDataManager.getItemData | public ItemData getItemData(String identifier,boolean checkChangesLogOnly) throws RepositoryException
{
ItemData data = null;
// 1. Try in transient changes
ItemState state = changesLog.getItemState(identifier);
if (state == null)
{
// 2. Try from txdatamanager
data = transactionableManager.getItemData(identifier,checkChangesLogOnly);
data = updatePathIfNeeded(data);
}
else if (!state.isDeleted())
{
data = state.getData();
}
return data;
} | java | public ItemData getItemData(String identifier,boolean checkChangesLogOnly) throws RepositoryException
{
ItemData data = null;
// 1. Try in transient changes
ItemState state = changesLog.getItemState(identifier);
if (state == null)
{
// 2. Try from txdatamanager
data = transactionableManager.getItemData(identifier,checkChangesLogOnly);
data = updatePathIfNeeded(data);
}
else if (!state.isDeleted())
{
data = state.getData();
}
return data;
} | [
"public",
"ItemData",
"getItemData",
"(",
"String",
"identifier",
",",
"boolean",
"checkChangesLogOnly",
")",
"throws",
"RepositoryException",
"{",
"ItemData",
"data",
"=",
"null",
";",
"// 1. Try in transient changes",
"ItemState",
"state",
"=",
"changesLog",
".",
"g... | Return item data by identifier in this transient storage then in workspace container.
@param identifier
@param checkChangesLogOnly
@return existed item data or null if not found
@throws RepositoryException
@see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getItemData(java.lang.String) | [
"Return",
"item",
"data",
"by",
"identifier",
"in",
"this",
"transient",
"storage",
"then",
"in",
"workspace",
"container",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L316-L332 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/SocketGroovyMethods.java | SocketGroovyMethods.withObjectStreams | public static <T> T withObjectStreams(Socket socket, @ClosureParams(value=SimpleType.class, options={"java.io.ObjectInputStream","java.io.ObjectOutputStream"}) Closure<T> closure) throws IOException {
InputStream input = socket.getInputStream();
OutputStream output = socket.getOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(output);
ObjectInputStream ois = new ObjectInputStream(input);
try {
T result = closure.call(new Object[]{ois, oos});
InputStream temp1 = ois;
ois = null;
temp1.close();
temp1 = input;
input = null;
temp1.close();
OutputStream temp2 = oos;
oos = null;
temp2.close();
temp2 = output;
output = null;
temp2.close();
return result;
} finally {
closeWithWarning(ois);
closeWithWarning(input);
closeWithWarning(oos);
closeWithWarning(output);
}
} | java | public static <T> T withObjectStreams(Socket socket, @ClosureParams(value=SimpleType.class, options={"java.io.ObjectInputStream","java.io.ObjectOutputStream"}) Closure<T> closure) throws IOException {
InputStream input = socket.getInputStream();
OutputStream output = socket.getOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(output);
ObjectInputStream ois = new ObjectInputStream(input);
try {
T result = closure.call(new Object[]{ois, oos});
InputStream temp1 = ois;
ois = null;
temp1.close();
temp1 = input;
input = null;
temp1.close();
OutputStream temp2 = oos;
oos = null;
temp2.close();
temp2 = output;
output = null;
temp2.close();
return result;
} finally {
closeWithWarning(ois);
closeWithWarning(input);
closeWithWarning(oos);
closeWithWarning(output);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"withObjectStreams",
"(",
"Socket",
"socket",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"{",
"\"java.io.ObjectInputStream\"",
",",
"\"java.io.ObjectOutputStream\"",
"}",
... | Creates an InputObjectStream and an OutputObjectStream from a Socket, and
passes them to the closure. The streams will be closed after the closure
returns, even if an exception is thrown.
@param socket this Socket
@param closure a Closure
@return the value returned by the closure
@throws IOException if an IOException occurs.
@since 1.5.0 | [
"Creates",
"an",
"InputObjectStream",
"and",
"an",
"OutputObjectStream",
"from",
"a",
"Socket",
"and",
"passes",
"them",
"to",
"the",
"closure",
".",
"The",
"streams",
"will",
"be",
"closed",
"after",
"the",
"closure",
"returns",
"even",
"if",
"an",
"exception... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/SocketGroovyMethods.java#L92-L120 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java | IotHubResourcesInner.importDevicesAsync | public ServiceFuture<JobResponseInner> importDevicesAsync(String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters, final ServiceCallback<JobResponseInner> serviceCallback) {
return ServiceFuture.fromResponse(importDevicesWithServiceResponseAsync(resourceGroupName, resourceName, importDevicesParameters), serviceCallback);
} | java | public ServiceFuture<JobResponseInner> importDevicesAsync(String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters, final ServiceCallback<JobResponseInner> serviceCallback) {
return ServiceFuture.fromResponse(importDevicesWithServiceResponseAsync(resourceGroupName, resourceName, importDevicesParameters), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"JobResponseInner",
">",
"importDevicesAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"ImportDevicesRequest",
"importDevicesParameters",
",",
"final",
"ServiceCallback",
"<",
"JobResponseInner",
">",
"serviceC... | Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@param importDevicesParameters The parameters that specify the import devices operation.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Import",
"update",
"or",
"delete",
"device",
"identities",
"in",
"the",
"IoT",
"hub",
"identity",
"registry",
"from",
"a",
"blob",
".",
"For",
"more",
"information",
"see",
":",
"https",
":",
"//",
"docs",
".",
"microsoft",
".",
"com",
"/",
"azure",
"/"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L3180-L3182 |
lamydev/Android-Notification | core/src/zemin/notification/NotificationEntry.java | NotificationEntry.setContentAction | public void setContentAction(Action.OnActionListener listener, ComponentName activity, Bundle extra) {
setContentAction(listener, activity, null, null, extra);
} | java | public void setContentAction(Action.OnActionListener listener, ComponentName activity, Bundle extra) {
setContentAction(listener, activity, null, null, extra);
} | [
"public",
"void",
"setContentAction",
"(",
"Action",
".",
"OnActionListener",
"listener",
",",
"ComponentName",
"activity",
",",
"Bundle",
"extra",
")",
"{",
"setContentAction",
"(",
"listener",
",",
"activity",
",",
"null",
",",
"null",
",",
"extra",
")",
";"... | Set a action to be fired when the notification content gets clicked.
@param listener
@param activity The activity to be started.
@param extra Intent extra. | [
"Set",
"a",
"action",
"to",
"be",
"fired",
"when",
"the",
"notification",
"content",
"gets",
"clicked",
"."
] | train | https://github.com/lamydev/Android-Notification/blob/6d6571d2862cb6edbacf9a78125418f7d621c3f8/core/src/zemin/notification/NotificationEntry.java#L419-L421 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/endpoint/resolver/DynamicEndpointUriResolver.java | DynamicEndpointUriResolver.resolveEndpointUri | public String resolveEndpointUri(Message message, String defaultUri) {
Map<String, Object> headers = message.getHeaders();
String requestUri;
if (headers.containsKey(ENDPOINT_URI_HEADER_NAME)) {
requestUri = headers.get(ENDPOINT_URI_HEADER_NAME).toString();
} else if (StringUtils.hasText(defaultUri)) {
requestUri = defaultUri;
} else {
requestUri = defaultEndpointUri;
}
if (requestUri == null) {
throw new CitrusRuntimeException("Unable to resolve dynamic endpoint uri! Neither header entry '" +
ENDPOINT_URI_HEADER_NAME + "' nor default endpoint uri is set");
}
requestUri = appendRequestPath(requestUri, headers);
requestUri = appendQueryParams(requestUri, headers);
return requestUri;
} | java | public String resolveEndpointUri(Message message, String defaultUri) {
Map<String, Object> headers = message.getHeaders();
String requestUri;
if (headers.containsKey(ENDPOINT_URI_HEADER_NAME)) {
requestUri = headers.get(ENDPOINT_URI_HEADER_NAME).toString();
} else if (StringUtils.hasText(defaultUri)) {
requestUri = defaultUri;
} else {
requestUri = defaultEndpointUri;
}
if (requestUri == null) {
throw new CitrusRuntimeException("Unable to resolve dynamic endpoint uri! Neither header entry '" +
ENDPOINT_URI_HEADER_NAME + "' nor default endpoint uri is set");
}
requestUri = appendRequestPath(requestUri, headers);
requestUri = appendQueryParams(requestUri, headers);
return requestUri;
} | [
"public",
"String",
"resolveEndpointUri",
"(",
"Message",
"message",
",",
"String",
"defaultUri",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"headers",
"=",
"message",
".",
"getHeaders",
"(",
")",
";",
"String",
"requestUri",
";",
"if",
"(",
"head... | Get the endpoint uri according to message header entry with fallback default uri. | [
"Get",
"the",
"endpoint",
"uri",
"according",
"to",
"message",
"header",
"entry",
"with",
"fallback",
"default",
"uri",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/endpoint/resolver/DynamicEndpointUriResolver.java#L47-L68 |
io7m/jregions | com.io7m.jregions.generators/src/main/java/com/io7m/jregions/generators/PAreaSizeBIGenerator.java | PAreaSizeBIGenerator.create | public static <S> PAreaSizeBIGenerator<S> create()
{
final LongGenerator gen = new LongGenerator(0L, Long.MAX_VALUE);
return new PAreaSizeBIGenerator<>(() -> new BigInteger(gen.next().toString()));
} | java | public static <S> PAreaSizeBIGenerator<S> create()
{
final LongGenerator gen = new LongGenerator(0L, Long.MAX_VALUE);
return new PAreaSizeBIGenerator<>(() -> new BigInteger(gen.next().toString()));
} | [
"public",
"static",
"<",
"S",
">",
"PAreaSizeBIGenerator",
"<",
"S",
">",
"create",
"(",
")",
"{",
"final",
"LongGenerator",
"gen",
"=",
"new",
"LongGenerator",
"(",
"0L",
",",
"Long",
".",
"MAX_VALUE",
")",
";",
"return",
"new",
"PAreaSizeBIGenerator",
"<... | @param <S> A phantom type parameter indicating the coordinate space of the
area
@return A generator initialized with useful defaults | [
"@param",
"<S",
">",
"A",
"phantom",
"type",
"parameter",
"indicating",
"the",
"coordinate",
"space",
"of",
"the",
"area"
] | train | https://github.com/io7m/jregions/blob/ae03850b5fa2a5fcbd8788953fba7897d4a88d7c/com.io7m.jregions.generators/src/main/java/com/io7m/jregions/generators/PAreaSizeBIGenerator.java#L56-L60 |
alkacon/opencms-core | src/org/opencms/gwt/shared/CmsHistoryVersion.java | CmsHistoryVersion.fromString | public static CmsHistoryVersion fromString(String s) {
List<String> l = CmsStringUtil.splitAsList(s, ":");
if (l.size() == 2) {
Integer ver = null;
try {
ver = Integer.valueOf(l.get(0));
} catch (Exception e) {
//
}
OfflineOnline onlineStatus = "null".equals("" + l.get(1)) ? null : OfflineOnline.valueOf(l.get(1));
return new CmsHistoryVersion(ver, onlineStatus);
}
return null;
} | java | public static CmsHistoryVersion fromString(String s) {
List<String> l = CmsStringUtil.splitAsList(s, ":");
if (l.size() == 2) {
Integer ver = null;
try {
ver = Integer.valueOf(l.get(0));
} catch (Exception e) {
//
}
OfflineOnline onlineStatus = "null".equals("" + l.get(1)) ? null : OfflineOnline.valueOf(l.get(1));
return new CmsHistoryVersion(ver, onlineStatus);
}
return null;
} | [
"public",
"static",
"CmsHistoryVersion",
"fromString",
"(",
"String",
"s",
")",
"{",
"List",
"<",
"String",
">",
"l",
"=",
"CmsStringUtil",
".",
"splitAsList",
"(",
"s",
",",
"\":\"",
")",
";",
"if",
"(",
"l",
".",
"size",
"(",
")",
"==",
"2",
")",
... | Converts a string to a CmsHistoryVersion.<p>
This is the inverse of toString().
@param s the string from which to read the history version
@return the history version | [
"Converts",
"a",
"string",
"to",
"a",
"CmsHistoryVersion",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/shared/CmsHistoryVersion.java#L91-L107 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/CollidableConfig.java | CollidableConfig.exports | public static void exports(Xml root, Collidable collidable)
{
Check.notNull(root);
Check.notNull(collidable);
final Xml node = root.createChild(NODE_GROUP);
node.setText(collidable.getGroup().toString());
} | java | public static void exports(Xml root, Collidable collidable)
{
Check.notNull(root);
Check.notNull(collidable);
final Xml node = root.createChild(NODE_GROUP);
node.setText(collidable.getGroup().toString());
} | [
"public",
"static",
"void",
"exports",
"(",
"Xml",
"root",
",",
"Collidable",
"collidable",
")",
"{",
"Check",
".",
"notNull",
"(",
"root",
")",
";",
"Check",
".",
"notNull",
"(",
"collidable",
")",
";",
"final",
"Xml",
"node",
"=",
"root",
".",
"creat... | Create an XML node from a collidable.
@param root The node root (must not be <code>null</code>).
@param collidable The collidable reference (must not be <code>null</code>).
@throws LionEngineException If invalid argument. | [
"Create",
"an",
"XML",
"node",
"from",
"a",
"collidable",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/CollidableConfig.java#L77-L84 |
voldemort/voldemort | src/java/voldemort/client/protocol/admin/SocketPool.java | SocketPool.checkin | public void checkin(SocketDestination destination, SocketAndStreams socket) {
try {
pool.checkin(destination, socket);
} catch(Exception e) {
throw new VoldemortException("Failure while checking in socket for " + destination
+ ": ", e);
}
} | java | public void checkin(SocketDestination destination, SocketAndStreams socket) {
try {
pool.checkin(destination, socket);
} catch(Exception e) {
throw new VoldemortException("Failure while checking in socket for " + destination
+ ": ", e);
}
} | [
"public",
"void",
"checkin",
"(",
"SocketDestination",
"destination",
",",
"SocketAndStreams",
"socket",
")",
"{",
"try",
"{",
"pool",
".",
"checkin",
"(",
"destination",
",",
"socket",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new... | Check the socket back into the pool.
@param destination The socket destination of the socket
@param socket The socket to check back in | [
"Check",
"the",
"socket",
"back",
"into",
"the",
"pool",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/protocol/admin/SocketPool.java#L118-L125 |
cdk/cdk | storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesParser.java | CxSmilesParser.processRadicals | private static boolean processRadicals(CharIter iter, CxSmilesState state) {
if (state.atomRads == null)
state.atomRads = new TreeMap<>();
CxSmilesState.Radical rad;
switch (iter.next()) {
case '1':
rad = CxSmilesState.Radical.Monovalent;
break;
case '2':
rad = CxSmilesState.Radical.Divalent;
break;
case '3':
rad = CxSmilesState.Radical.DivalentSinglet;
break;
case '4':
rad = CxSmilesState.Radical.DivalentTriplet;
break;
case '5':
rad = CxSmilesState.Radical.Trivalent;
break;
case '6':
rad = CxSmilesState.Radical.TrivalentDoublet;
break;
case '7':
rad = CxSmilesState.Radical.TrivalentQuartet;
break;
default:
return false;
}
if (!iter.nextIf(':'))
return false;
List<Integer> dest = new ArrayList<>(4);
if (!processIntList(iter, COMMA_SEPARATOR, dest))
return false;
for (Integer atomidx : dest)
state.atomRads.put(atomidx, rad);
return true;
} | java | private static boolean processRadicals(CharIter iter, CxSmilesState state) {
if (state.atomRads == null)
state.atomRads = new TreeMap<>();
CxSmilesState.Radical rad;
switch (iter.next()) {
case '1':
rad = CxSmilesState.Radical.Monovalent;
break;
case '2':
rad = CxSmilesState.Radical.Divalent;
break;
case '3':
rad = CxSmilesState.Radical.DivalentSinglet;
break;
case '4':
rad = CxSmilesState.Radical.DivalentTriplet;
break;
case '5':
rad = CxSmilesState.Radical.Trivalent;
break;
case '6':
rad = CxSmilesState.Radical.TrivalentDoublet;
break;
case '7':
rad = CxSmilesState.Radical.TrivalentQuartet;
break;
default:
return false;
}
if (!iter.nextIf(':'))
return false;
List<Integer> dest = new ArrayList<>(4);
if (!processIntList(iter, COMMA_SEPARATOR, dest))
return false;
for (Integer atomidx : dest)
state.atomRads.put(atomidx, rad);
return true;
} | [
"private",
"static",
"boolean",
"processRadicals",
"(",
"CharIter",
"iter",
",",
"CxSmilesState",
"state",
")",
"{",
"if",
"(",
"state",
".",
"atomRads",
"==",
"null",
")",
"state",
".",
"atomRads",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"CxSmilesStat... | CXSMILES radicals.
@param iter input characters, iterator is progressed by this method
@param state output CXSMILES state
@return parse was a success (or not) | [
"CXSMILES",
"radicals",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesParser.java#L364-L401 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/tm/tmtrafficpolicy_binding.java | tmtrafficpolicy_binding.get | public static tmtrafficpolicy_binding get(nitro_service service, String name) throws Exception{
tmtrafficpolicy_binding obj = new tmtrafficpolicy_binding();
obj.set_name(name);
tmtrafficpolicy_binding response = (tmtrafficpolicy_binding) obj.get_resource(service);
return response;
} | java | public static tmtrafficpolicy_binding get(nitro_service service, String name) throws Exception{
tmtrafficpolicy_binding obj = new tmtrafficpolicy_binding();
obj.set_name(name);
tmtrafficpolicy_binding response = (tmtrafficpolicy_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"tmtrafficpolicy_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"tmtrafficpolicy_binding",
"obj",
"=",
"new",
"tmtrafficpolicy_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"nam... | Use this API to fetch tmtrafficpolicy_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"tmtrafficpolicy_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/tm/tmtrafficpolicy_binding.java#L125-L130 |
apereo/cas | support/cas-server-support-pac4j-authentication/src/main/java/org/apereo/cas/integration/pac4j/authentication/handler/support/AbstractPac4jAuthenticationHandler.java | AbstractPac4jAuthenticationHandler.finalizeAuthenticationHandlerResult | protected AuthenticationHandlerExecutionResult finalizeAuthenticationHandlerResult(final ClientCredential credentials,
final Principal principal,
final UserProfile profile,
final BaseClient client) {
preFinalizeAuthenticationHandlerResult(credentials, principal, profile, client);
return createHandlerResult(credentials, principal, new ArrayList<>(0));
} | java | protected AuthenticationHandlerExecutionResult finalizeAuthenticationHandlerResult(final ClientCredential credentials,
final Principal principal,
final UserProfile profile,
final BaseClient client) {
preFinalizeAuthenticationHandlerResult(credentials, principal, profile, client);
return createHandlerResult(credentials, principal, new ArrayList<>(0));
} | [
"protected",
"AuthenticationHandlerExecutionResult",
"finalizeAuthenticationHandlerResult",
"(",
"final",
"ClientCredential",
"credentials",
",",
"final",
"Principal",
"principal",
",",
"final",
"UserProfile",
"profile",
",",
"final",
"BaseClient",
"client",
")",
"{",
"preF... | Finalize authentication handler result.
@param credentials the credentials
@param principal the principal
@param profile the profile
@param client the client
@return the authentication handler execution result | [
"Finalize",
"authentication",
"handler",
"result",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-pac4j-authentication/src/main/java/org/apereo/cas/integration/pac4j/authentication/handler/support/AbstractPac4jAuthenticationHandler.java#L78-L84 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java | AbstractJsonDeserializer.parseDefault | public Double parseDefault(String input, Double defaultValue) {
if (input == null) {
return defaultValue;
}
Double answer = defaultValue;
try {
answer = Double.parseDouble(input);
} catch (NumberFormatException ignored) {
}
return answer;
} | java | public Double parseDefault(String input, Double defaultValue) {
if (input == null) {
return defaultValue;
}
Double answer = defaultValue;
try {
answer = Double.parseDouble(input);
} catch (NumberFormatException ignored) {
}
return answer;
} | [
"public",
"Double",
"parseDefault",
"(",
"String",
"input",
",",
"Double",
"defaultValue",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"Double",
"answer",
"=",
"defaultValue",
";",
"try",
"{",
"answer",
"=",
... | Convenience method. Parses a string into a double. If it can no be converted to a double, the
defaultvalue is returned. Depending on your choice, you can allow null as output or assign it some value
and have very convenient syntax such as: double d = parseDefault(myString, 0.0); which is a lot shorter
than dealing with all kinds of numberformatexceptions.
@param input The inputstring
@param defaultValue The value to assign in case of error
@return A double corresponding with the input, or defaultValue if no double can be extracted | [
"Convenience",
"method",
".",
"Parses",
"a",
"string",
"into",
"a",
"double",
".",
"If",
"it",
"can",
"no",
"be",
"converted",
"to",
"a",
"double",
"the",
"defaultvalue",
"is",
"returned",
".",
"Depending",
"on",
"your",
"choice",
"you",
"can",
"allow",
... | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java#L314-L324 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/DatabaseSpec.java | DatabaseSpec.comparetable | @Then("^I check that table '(.+?)' is iqual to$")
public void comparetable(String tableName, DataTable dataTable) throws Exception {
Statement myStatement = null;
java.sql.ResultSet rs = null;
//from postgres table
List<String> sqlTable = new ArrayList<String>();
List<String> sqlTableAux = new ArrayList<String>();
//from Cucumber Datatable
List<String> tablePattern = new ArrayList<String>();
//comparison is by lists of string
tablePattern = dataTable.asList(String.class);
Connection myConnection = this.commonspec.getConnection();
String query = "SELECT * FROM " + tableName + " order by " + "id" + ";";
try {
myStatement = myConnection.createStatement();
rs = myStatement.executeQuery(query);
//takes column names and culumn count
ResultSetMetaData resultSetMetaData = rs.getMetaData();
int count = resultSetMetaData.getColumnCount();
for (int i = 1; i <= count; i++) {
sqlTable.add(resultSetMetaData.getColumnName(i).toString());
}
//takes column names and culumn count
while (rs.next()) {
for (int i = 1; i <= count; i++) {
//aux list without column names
sqlTableAux.add(rs.getObject(i).toString());
}
}
sqlTable.addAll(sqlTableAux);
assertThat(sqlTable).as("Not equal elements!").isEqualTo(tablePattern);
rs.close();
myStatement.close();
} catch (Exception e) {
e.printStackTrace();
assertThat(rs).as("There are no table " + tableName).isNotNull();
}
} | java | @Then("^I check that table '(.+?)' is iqual to$")
public void comparetable(String tableName, DataTable dataTable) throws Exception {
Statement myStatement = null;
java.sql.ResultSet rs = null;
//from postgres table
List<String> sqlTable = new ArrayList<String>();
List<String> sqlTableAux = new ArrayList<String>();
//from Cucumber Datatable
List<String> tablePattern = new ArrayList<String>();
//comparison is by lists of string
tablePattern = dataTable.asList(String.class);
Connection myConnection = this.commonspec.getConnection();
String query = "SELECT * FROM " + tableName + " order by " + "id" + ";";
try {
myStatement = myConnection.createStatement();
rs = myStatement.executeQuery(query);
//takes column names and culumn count
ResultSetMetaData resultSetMetaData = rs.getMetaData();
int count = resultSetMetaData.getColumnCount();
for (int i = 1; i <= count; i++) {
sqlTable.add(resultSetMetaData.getColumnName(i).toString());
}
//takes column names and culumn count
while (rs.next()) {
for (int i = 1; i <= count; i++) {
//aux list without column names
sqlTableAux.add(rs.getObject(i).toString());
}
}
sqlTable.addAll(sqlTableAux);
assertThat(sqlTable).as("Not equal elements!").isEqualTo(tablePattern);
rs.close();
myStatement.close();
} catch (Exception e) {
e.printStackTrace();
assertThat(rs).as("There are no table " + tableName).isNotNull();
}
} | [
"@",
"Then",
"(",
"\"^I check that table '(.+?)' is iqual to$\"",
")",
"public",
"void",
"comparetable",
"(",
"String",
"tableName",
",",
"DataTable",
"dataTable",
")",
"throws",
"Exception",
"{",
"Statement",
"myStatement",
"=",
"null",
";",
"java",
".",
"sql",
"... | /*
@param tableName
@param dataTable
compares two tables: pattern table and the result from remote database
by default: order by id | [
"/",
"*",
"@param",
"tableName",
"@param",
"dataTable",
"compares",
"two",
"tables",
":",
"pattern",
"table",
"and",
"the",
"result",
"from",
"remote",
"database",
"by",
"default",
":",
"order",
"by",
"id"
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DatabaseSpec.java#L952-L995 |
JOML-CI/JOML | src/org/joml/Intersectionf.java | Intersectionf.intersectRayCircle | public static boolean intersectRayCircle(Vector2fc origin, Vector2fc dir, Vector2fc center, float radiusSquared, Vector2f result) {
return intersectRayCircle(origin.x(), origin.y(), dir.x(), dir.y(), center.x(), center.y(), radiusSquared, result);
} | java | public static boolean intersectRayCircle(Vector2fc origin, Vector2fc dir, Vector2fc center, float radiusSquared, Vector2f result) {
return intersectRayCircle(origin.x(), origin.y(), dir.x(), dir.y(), center.x(), center.y(), radiusSquared, result);
} | [
"public",
"static",
"boolean",
"intersectRayCircle",
"(",
"Vector2fc",
"origin",
",",
"Vector2fc",
"dir",
",",
"Vector2fc",
"center",
",",
"float",
"radiusSquared",
",",
"Vector2f",
"result",
")",
"{",
"return",
"intersectRayCircle",
"(",
"origin",
".",
"x",
"("... | Test whether the ray with the given <code>origin</code> and direction <code>dir</code>
intersects the circle with the given <code>center</code> and square radius <code>radiusSquared</code>,
and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near
and far) of intersections into the given <code>result</code> vector.
<p>
This method returns <code>true</code> for a ray whose origin lies inside the circle.
<p>
Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a>
@param origin
the ray's origin
@param dir
the ray's direction
@param center
the circle's center
@param radiusSquared
the circle radius squared
@param result
a vector that will contain the values of the parameter <i>t</i> in the ray equation
<i>p(t) = origin + t * dir</i> for both points (near, far) of intersections with the circle
@return <code>true</code> if the ray intersects the circle; <code>false</code> otherwise | [
"Test",
"whether",
"the",
"ray",
"with",
"the",
"given",
"<code",
">",
"origin<",
"/",
"code",
">",
"and",
"direction",
"<code",
">",
"dir<",
"/",
"code",
">",
"intersects",
"the",
"circle",
"with",
"the",
"given",
"<code",
">",
"center<",
"/",
"code",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L4267-L4269 |
resource4j/resource4j | core/src/main/java/com/github/resource4j/values/ResourceStrings.java | ResourceStrings.ofNullable | public static OptionalString ofNullable(ResourceKey key, String value) {
return new GenericOptionalString(RUNTIME_SOURCE, key, value);
} | java | public static OptionalString ofNullable(ResourceKey key, String value) {
return new GenericOptionalString(RUNTIME_SOURCE, key, value);
} | [
"public",
"static",
"OptionalString",
"ofNullable",
"(",
"ResourceKey",
"key",
",",
"String",
"value",
")",
"{",
"return",
"new",
"GenericOptionalString",
"(",
"RUNTIME_SOURCE",
",",
"key",
",",
"value",
")",
";",
"}"
] | Returns new instance of OptionalString with given key and value
@param key key of the returned OptionalString
@param value wrapped string
@return given object wrapped in OptionalString with given key | [
"Returns",
"new",
"instance",
"of",
"OptionalString",
"with",
"given",
"key",
"and",
"value"
] | train | https://github.com/resource4j/resource4j/blob/6100443b9a78edc8a5867e1e075f7ee12e6698ca/core/src/main/java/com/github/resource4j/values/ResourceStrings.java#L41-L43 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/XMLUtils.java | XMLUtils.getAttribute | public static String getAttribute(XMLStreamReader reader, String localName) {
int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
String name = reader.getAttributeLocalName(i);
if (localName.equals(name)) {
return reader.getAttributeValue(i);
}
}
return null;
} | java | public static String getAttribute(XMLStreamReader reader, String localName) {
int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
String name = reader.getAttributeLocalName(i);
if (localName.equals(name)) {
return reader.getAttributeValue(i);
}
}
return null;
} | [
"public",
"static",
"String",
"getAttribute",
"(",
"XMLStreamReader",
"reader",
",",
"String",
"localName",
")",
"{",
"int",
"count",
"=",
"reader",
".",
"getAttributeCount",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
... | Get the element attribute value
@param reader
@param localName
@return | [
"Get",
"the",
"element",
"attribute",
"value"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/XMLUtils.java#L29-L38 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobLauncherFactory.java | JobLauncherFactory.newJobLauncher | public static @Nonnull JobLauncher newJobLauncher(Properties sysProps, Properties jobProps) throws Exception {
return newJobLauncher(sysProps, jobProps, null);
} | java | public static @Nonnull JobLauncher newJobLauncher(Properties sysProps, Properties jobProps) throws Exception {
return newJobLauncher(sysProps, jobProps, null);
} | [
"public",
"static",
"@",
"Nonnull",
"JobLauncher",
"newJobLauncher",
"(",
"Properties",
"sysProps",
",",
"Properties",
"jobProps",
")",
"throws",
"Exception",
"{",
"return",
"newJobLauncher",
"(",
"sysProps",
",",
"jobProps",
",",
"null",
")",
";",
"}"
] | Create a new {@link JobLauncher}.
<p>
This method will never return a {@code null}.
</p>
@param sysProps system configuration properties
@param jobProps job configuration properties
@return newly created {@link JobLauncher} | [
"Create",
"a",
"new",
"{",
"@link",
"JobLauncher",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobLauncherFactory.java#L67-L69 |
SimplicityApks/ReminderDatePicker | lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java | ReminderDatePicker.setHideTime | public void setHideTime(boolean enable, final boolean useDarkTheme) {
if(enable && !shouldHideTime) {
// hide the time spinner and show a button to show it instead
timeSpinner.setVisibility(GONE);
ImageButton timeButton = (ImageButton) LayoutInflater.from(getContext()).inflate(R.layout.time_button, null);
timeButton.setImageResource(useDarkTheme ? R.drawable.ic_action_time_dark : R.drawable.ic_action_time_light);
timeButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setHideTime(false, useDarkTheme);
}
});
this.addView(timeButton);
} else if(!enable && shouldHideTime) {
timeSpinner.setVisibility(VISIBLE);
this.removeViewAt(2);
}
shouldHideTime = enable;
} | java | public void setHideTime(boolean enable, final boolean useDarkTheme) {
if(enable && !shouldHideTime) {
// hide the time spinner and show a button to show it instead
timeSpinner.setVisibility(GONE);
ImageButton timeButton = (ImageButton) LayoutInflater.from(getContext()).inflate(R.layout.time_button, null);
timeButton.setImageResource(useDarkTheme ? R.drawable.ic_action_time_dark : R.drawable.ic_action_time_light);
timeButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setHideTime(false, useDarkTheme);
}
});
this.addView(timeButton);
} else if(!enable && shouldHideTime) {
timeSpinner.setVisibility(VISIBLE);
this.removeViewAt(2);
}
shouldHideTime = enable;
} | [
"public",
"void",
"setHideTime",
"(",
"boolean",
"enable",
",",
"final",
"boolean",
"useDarkTheme",
")",
"{",
"if",
"(",
"enable",
"&&",
"!",
"shouldHideTime",
")",
"{",
"// hide the time spinner and show a button to show it instead",
"timeSpinner",
".",
"setVisibility"... | Toggles hiding the Time Spinner and replaces it with a Button.
@param enable True to hide the Spinner, false to show it.
@param useDarkTheme True if a white icon shall be used, false for a dark one. | [
"Toggles",
"hiding",
"the",
"Time",
"Spinner",
"and",
"replaces",
"it",
"with",
"a",
"Button",
"."
] | train | https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java#L330-L348 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/route/Route.java | Route.ANY | public static Route ANY(String uriPattern, RouteHandler routeHandler) {
return new Route(HttpConstants.Method.ANY, uriPattern, routeHandler);
} | java | public static Route ANY(String uriPattern, RouteHandler routeHandler) {
return new Route(HttpConstants.Method.ANY, uriPattern, routeHandler);
} | [
"public",
"static",
"Route",
"ANY",
"(",
"String",
"uriPattern",
",",
"RouteHandler",
"routeHandler",
")",
"{",
"return",
"new",
"Route",
"(",
"HttpConstants",
".",
"Method",
".",
"ANY",
",",
"uriPattern",
",",
"routeHandler",
")",
";",
"}"
] | Create a route responding to any HTTP Verb (GET, POST, PUT, ...).
@param uriPattern
@param routeHandler
@return | [
"Create",
"a",
"route",
"responding",
"to",
"any",
"HTTP",
"Verb",
"(",
"GET",
"POST",
"PUT",
"...",
")",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/Route.java#L166-L168 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.restoreKey | public KeyBundle restoreKey(String vaultBaseUrl, byte[] keyBundleBackup) {
return restoreKeyWithServiceResponseAsync(vaultBaseUrl, keyBundleBackup).toBlocking().single().body();
} | java | public KeyBundle restoreKey(String vaultBaseUrl, byte[] keyBundleBackup) {
return restoreKeyWithServiceResponseAsync(vaultBaseUrl, keyBundleBackup).toBlocking().single().body();
} | [
"public",
"KeyBundle",
"restoreKey",
"(",
"String",
"vaultBaseUrl",
",",
"byte",
"[",
"]",
"keyBundleBackup",
")",
"{",
"return",
"restoreKeyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"keyBundleBackup",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(... | Restores a backed up key to a vault.
Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, attributes and access control policies. The RESTORE operation may be used to import a previously backed up key. Individual versions of a key cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the key name is not available in the target Key Vault, the RESTORE operation will be rejected. While the key name is retained during restore, the final key identifier will change if the key is restored to a different vault. Restore will restore all versions and preserve version identifiers. The RESTORE operation is subject to security constraints: The target Key Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission in the target Key Vault. This operation requires the keys/restore permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyBundleBackup The backup blob associated with a key bundle.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the KeyBundle object if successful. | [
"Restores",
"a",
"backed",
"up",
"key",
"to",
"a",
"vault",
".",
"Imports",
"a",
"previously",
"backed",
"up",
"key",
"into",
"Azure",
"Key",
"Vault",
"restoring",
"the",
"key",
"its",
"key",
"identifier",
"attributes",
"and",
"access",
"control",
"policies"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L2053-L2055 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.