repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeSpeeDRFModel | private static void summarizeSpeeDRFModel(ModelSummary summary, hex.singlenoderf.SpeeDRFModel model) {
// add generic fields such as column names
summarizeModelCommonFields(summary, model);
summary.model_algorithm = "Random Forest";
JsonObject all_params = (model.get_params()).toJSON();
summary.critical_parameters = whitelistJsonObject(all_params, SpeeDRF_critical_params);
summary.secondary_parameters = whitelistJsonObject(all_params, SpeeDRF_secondary_params);
summary.expert_parameters = whitelistJsonObject(all_params, SpeeDRF_expert_params);
} | java | private static void summarizeSpeeDRFModel(ModelSummary summary, hex.singlenoderf.SpeeDRFModel model) {
// add generic fields such as column names
summarizeModelCommonFields(summary, model);
summary.model_algorithm = "Random Forest";
JsonObject all_params = (model.get_params()).toJSON();
summary.critical_parameters = whitelistJsonObject(all_params, SpeeDRF_critical_params);
summary.secondary_parameters = whitelistJsonObject(all_params, SpeeDRF_secondary_params);
summary.expert_parameters = whitelistJsonObject(all_params, SpeeDRF_expert_params);
} | [
"private",
"static",
"void",
"summarizeSpeeDRFModel",
"(",
"ModelSummary",
"summary",
",",
"hex",
".",
"singlenoderf",
".",
"SpeeDRFModel",
"model",
")",
"{",
"// add generic fields such as column names",
"summarizeModelCommonFields",
"(",
"summary",
",",
"model",
")",
... | Summarize fields which are specific to hex.drf.DRF.SpeeDRFModel. | [
"Summarize",
"fields",
"which",
"are",
"specific",
"to",
"hex",
".",
"drf",
".",
"DRF",
".",
"SpeeDRFModel",
"."
] | train | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L289-L299 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.orthoSymmetric | public Matrix4d orthoSymmetric(double width, double height, double zNear, double zFar) {
return orthoSymmetric(width, height, zNear, zFar, false, this);
} | java | public Matrix4d orthoSymmetric(double width, double height, double zNear, double zFar) {
return orthoSymmetric(width, height, zNear, zFar, false, this);
} | [
"public",
"Matrix4d",
"orthoSymmetric",
"(",
"double",
"width",
",",
"double",
"height",
",",
"double",
"zNear",
",",
"double",
"zFar",
")",
"{",
"return",
"orthoSymmetric",
"(",
"width",
",",
"height",
",",
"zNear",
",",
"zFar",
",",
"false",
",",
"this",... | Apply a symmetric orthographic projection transformation for a right-handed coordinate system
using OpenGL's NDC z range of <code>[-1..+1]</code> to this matrix.
<p>
This method is equivalent to calling {@link #ortho(double, double, double, double, double, double) ortho()} with
<code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix,
then the new matrix will be <code>M * O</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the
orthographic projection transformation will be applied first!
<p>
In order to set the matrix to a symmetric orthographic projection without post-multiplying it,
use {@link #setOrthoSymmetric(double, double, double, double) setOrthoSymmetric()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #setOrthoSymmetric(double, double, double, double)
@param width
the distance between the right and left frustum edges
@param height
the distance between the top and bottom frustum edges
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@return this | [
"Apply",
"a",
"symmetric",
"orthographic",
"projection",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"using",
"OpenGL",
"s",
"NDC",
"z",
"range",
"of",
"<code",
">",
"[",
"-",
"1",
"..",
"+",
"1",
"]",
"<",
"/",
"code",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L10223-L10225 |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/ChangeObjects.java | ChangeObjects.setCountToDefault | public final static void setCountToDefault(PolymerNotation polymer, int position) {
polymer.getPolymerElements().getListOfElements().get(position).setCount("1");
} | java | public final static void setCountToDefault(PolymerNotation polymer, int position) {
polymer.getPolymerElements().getListOfElements().get(position).setCount("1");
} | [
"public",
"final",
"static",
"void",
"setCountToDefault",
"(",
"PolymerNotation",
"polymer",
",",
"int",
"position",
")",
"{",
"polymer",
".",
"getPolymerElements",
"(",
")",
".",
"getListOfElements",
"(",
")",
".",
"get",
"(",
"position",
")",
".",
"setCount"... | method to set the count of a MonomerNotation to default (=1)
@param polymer
PolymerNotation
@param position
position of the MonomerNotation | [
"method",
"to",
"set",
"the",
"count",
"of",
"a",
"MonomerNotation",
"to",
"default",
"(",
"=",
"1",
")"
] | train | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L364-L366 |
Jasig/uPortal | uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/ReferenceEntityLockService.java | ReferenceEntityLockService.isLocked | private boolean isLocked(Class entityType, String entityKey, Integer lockType)
throws LockingException {
IEntityLock[] locks = retrieveLocks(entityType, entityKey, lockType);
return locks.length > 0;
} | java | private boolean isLocked(Class entityType, String entityKey, Integer lockType)
throws LockingException {
IEntityLock[] locks = retrieveLocks(entityType, entityKey, lockType);
return locks.length > 0;
} | [
"private",
"boolean",
"isLocked",
"(",
"Class",
"entityType",
",",
"String",
"entityKey",
",",
"Integer",
"lockType",
")",
"throws",
"LockingException",
"{",
"IEntityLock",
"[",
"]",
"locks",
"=",
"retrieveLocks",
"(",
"entityType",
",",
"entityKey",
",",
"lockT... | Answers if the entity represented by entityType and entityKey has one or more locks. Param
<code>lockType</code> can be null.
@param entityType
@param entityKey
@param lockType (optional)
@exception org.apereo.portal.concurrency.LockingException | [
"Answers",
"if",
"the",
"entity",
"represented",
"by",
"entityType",
"and",
"entityKey",
"has",
"one",
"or",
"more",
"locks",
".",
"Param",
"<code",
">",
"lockType<",
"/",
"code",
">",
"can",
"be",
"null",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/ReferenceEntityLockService.java#L202-L206 |
alkacon/opencms-core | src/org/opencms/ade/galleries/CmsPreviewService.java | CmsPreviewService.readResourceInfo | public void readResourceInfo(CmsObject cms, CmsResource resource, CmsResourceInfoBean resInfo, String locale)
throws CmsException {
I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(resource.getTypeId());
Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
resInfo.setTitle(resource.getName());
resInfo.setStructureId(resource.getStructureId());
resInfo.setDescription(CmsWorkplaceMessages.getResourceTypeName(wpLocale, type.getTypeName()));
resInfo.setResourcePath(cms.getSitePath(resource));
resInfo.setResourceType(type.getTypeName());
resInfo.setBigIconClasses(
CmsIconUtil.getIconClasses(CmsIconUtil.getDisplayType(cms, resource), resource.getName(), false));
// set the default file and detail type info
String detailType = CmsResourceIcon.getDefaultFileOrDetailType(cms, resource);
if (detailType != null) {
resInfo.setSmallIconClasses(CmsIconUtil.getIconClasses(detailType, null, true));
}
resInfo.setSize((resource.getLength() / 1024) + " kb");
resInfo.setLastModified(new Date(resource.getDateLastModified()));
resInfo.setNoEditReason(new CmsResourceUtil(cms, resource).getNoEditReason(wpLocale, true));
// reading default explorer-type properties
CmsExplorerTypeSettings setting = OpenCms.getWorkplaceManager().getExplorerTypeSetting(type.getTypeName());
List<String> properties;
if (OpenCms.getResourceManager().matchResourceType(
CmsResourceTypeImage.getStaticTypeName(),
resource.getTypeId())) {
properties = Lists.newArrayList(
CmsPropertyDefinition.PROPERTY_TITLE,
CmsPropertyDefinition.PROPERTY_COPYRIGHT);
} else {
properties = setting.getProperties();
String reference = setting.getReference();
while ((properties.size() == 0) && !CmsStringUtil.isEmptyOrWhitespaceOnly(reference)) {
// looking up properties from referenced explorer types if properties list is empty
setting = OpenCms.getWorkplaceManager().getExplorerTypeSetting(reference);
properties = setting.getProperties();
reference = setting.getReference();
}
}
Map<String, String> props = new LinkedHashMap<String, String>();
Iterator<String> propIt = properties.iterator();
while (propIt.hasNext()) {
String propertyName = propIt.next();
CmsProperty property = cms.readPropertyObject(resource, propertyName, false);
if (!property.isNullProperty()) {
props.put(property.getName(), property.getValue());
} else {
props.put(propertyName, null);
}
}
resInfo.setProperties(props);
resInfo.setPreviewContent(getPreviewContent(cms, resource, CmsLocaleManager.getLocale(locale)));
} | java | public void readResourceInfo(CmsObject cms, CmsResource resource, CmsResourceInfoBean resInfo, String locale)
throws CmsException {
I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(resource.getTypeId());
Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
resInfo.setTitle(resource.getName());
resInfo.setStructureId(resource.getStructureId());
resInfo.setDescription(CmsWorkplaceMessages.getResourceTypeName(wpLocale, type.getTypeName()));
resInfo.setResourcePath(cms.getSitePath(resource));
resInfo.setResourceType(type.getTypeName());
resInfo.setBigIconClasses(
CmsIconUtil.getIconClasses(CmsIconUtil.getDisplayType(cms, resource), resource.getName(), false));
// set the default file and detail type info
String detailType = CmsResourceIcon.getDefaultFileOrDetailType(cms, resource);
if (detailType != null) {
resInfo.setSmallIconClasses(CmsIconUtil.getIconClasses(detailType, null, true));
}
resInfo.setSize((resource.getLength() / 1024) + " kb");
resInfo.setLastModified(new Date(resource.getDateLastModified()));
resInfo.setNoEditReason(new CmsResourceUtil(cms, resource).getNoEditReason(wpLocale, true));
// reading default explorer-type properties
CmsExplorerTypeSettings setting = OpenCms.getWorkplaceManager().getExplorerTypeSetting(type.getTypeName());
List<String> properties;
if (OpenCms.getResourceManager().matchResourceType(
CmsResourceTypeImage.getStaticTypeName(),
resource.getTypeId())) {
properties = Lists.newArrayList(
CmsPropertyDefinition.PROPERTY_TITLE,
CmsPropertyDefinition.PROPERTY_COPYRIGHT);
} else {
properties = setting.getProperties();
String reference = setting.getReference();
while ((properties.size() == 0) && !CmsStringUtil.isEmptyOrWhitespaceOnly(reference)) {
// looking up properties from referenced explorer types if properties list is empty
setting = OpenCms.getWorkplaceManager().getExplorerTypeSetting(reference);
properties = setting.getProperties();
reference = setting.getReference();
}
}
Map<String, String> props = new LinkedHashMap<String, String>();
Iterator<String> propIt = properties.iterator();
while (propIt.hasNext()) {
String propertyName = propIt.next();
CmsProperty property = cms.readPropertyObject(resource, propertyName, false);
if (!property.isNullProperty()) {
props.put(property.getName(), property.getValue());
} else {
props.put(propertyName, null);
}
}
resInfo.setProperties(props);
resInfo.setPreviewContent(getPreviewContent(cms, resource, CmsLocaleManager.getLocale(locale)));
} | [
"public",
"void",
"readResourceInfo",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"CmsResourceInfoBean",
"resInfo",
",",
"String",
"locale",
")",
"throws",
"CmsException",
"{",
"I_CmsResourceType",
"type",
"=",
"OpenCms",
".",
"getResourceManager",
... | Retrieves the resource information and puts it into the provided resource info bean.<p>
@param cms the initialized cms object
@param resource the resource
@param resInfo the resource info bean
@param locale the content locale
@throws CmsException if something goes wrong | [
"Retrieves",
"the",
"resource",
"information",
"and",
"puts",
"it",
"into",
"the",
"provided",
"resource",
"info",
"bean",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsPreviewService.java#L274-L326 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.getChildSize | public float getChildSize(final int dataIndex, final Axis axis) {
float size = 0;
Widget child = mContainer.get(dataIndex);
if (child != null) {
switch (axis) {
case X:
size = child.getLayoutWidth();
break;
case Y:
size = child.getLayoutHeight();
break;
case Z:
size = child.getLayoutDepth();
break;
default:
throw new RuntimeAssertion("Bad axis specified: %s", axis);
}
}
return size;
} | java | public float getChildSize(final int dataIndex, final Axis axis) {
float size = 0;
Widget child = mContainer.get(dataIndex);
if (child != null) {
switch (axis) {
case X:
size = child.getLayoutWidth();
break;
case Y:
size = child.getLayoutHeight();
break;
case Z:
size = child.getLayoutDepth();
break;
default:
throw new RuntimeAssertion("Bad axis specified: %s", axis);
}
}
return size;
} | [
"public",
"float",
"getChildSize",
"(",
"final",
"int",
"dataIndex",
",",
"final",
"Axis",
"axis",
")",
"{",
"float",
"size",
"=",
"0",
";",
"Widget",
"child",
"=",
"mContainer",
".",
"get",
"(",
"dataIndex",
")",
";",
"if",
"(",
"child",
"!=",
"null",... | Calculate the child size along the axis
@param dataIndex data index
@param axis {@link Axis}
@return child size | [
"Calculate",
"the",
"child",
"size",
"along",
"the",
"axis"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L161-L180 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.beginSetVpnclientIpsecParametersAsync | public Observable<VpnClientIPsecParametersInner> beginSetVpnclientIpsecParametersAsync(String resourceGroupName, String virtualNetworkGatewayName, VpnClientIPsecParametersInner vpnclientIpsecParams) {
return beginSetVpnclientIpsecParametersWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams).map(new Func1<ServiceResponse<VpnClientIPsecParametersInner>, VpnClientIPsecParametersInner>() {
@Override
public VpnClientIPsecParametersInner call(ServiceResponse<VpnClientIPsecParametersInner> response) {
return response.body();
}
});
} | java | public Observable<VpnClientIPsecParametersInner> beginSetVpnclientIpsecParametersAsync(String resourceGroupName, String virtualNetworkGatewayName, VpnClientIPsecParametersInner vpnclientIpsecParams) {
return beginSetVpnclientIpsecParametersWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams).map(new Func1<ServiceResponse<VpnClientIPsecParametersInner>, VpnClientIPsecParametersInner>() {
@Override
public VpnClientIPsecParametersInner call(ServiceResponse<VpnClientIPsecParametersInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VpnClientIPsecParametersInner",
">",
"beginSetVpnclientIpsecParametersAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
",",
"VpnClientIPsecParametersInner",
"vpnclientIpsecParams",
")",
"{",
"return",
"beginSetV... | The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The name of the virtual network gateway.
@param vpnclientIpsecParams Parameters supplied to the Begin Set vpnclient ipsec parameters of Virtual Network Gateway P2S client operation through Network resource provider.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VpnClientIPsecParametersInner object | [
"The",
"Set",
"VpnclientIpsecParameters",
"operation",
"sets",
"the",
"vpnclient",
"ipsec",
"policy",
"for",
"P2S",
"client",
"of",
"virtual",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
"through",
"Network",
"resource",
"provider",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2761-L2768 |
apache/predictionio-sdk-java | client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java | EventClient.unsetItem | public String unsetItem(String iid, List<String> properties, DateTime eventTime)
throws ExecutionException, InterruptedException, IOException {
return createEvent(unsetItemAsFuture(iid, properties, eventTime));
} | java | public String unsetItem(String iid, List<String> properties, DateTime eventTime)
throws ExecutionException, InterruptedException, IOException {
return createEvent(unsetItemAsFuture(iid, properties, eventTime));
} | [
"public",
"String",
"unsetItem",
"(",
"String",
"iid",
",",
"List",
"<",
"String",
">",
"properties",
",",
"DateTime",
"eventTime",
")",
"throws",
"ExecutionException",
",",
"InterruptedException",
",",
"IOException",
"{",
"return",
"createEvent",
"(",
"unsetItemA... | Unsets properties of a item. The list must not be empty.
@param iid ID of the item
@param properties a list of all the properties to unset
@param eventTime timestamp of the event
@return ID of this event | [
"Unsets",
"properties",
"of",
"a",
"item",
".",
"The",
"list",
"must",
"not",
"be",
"empty",
"."
] | train | https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L541-L544 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/PropertiesSynonymProvider.java | PropertiesSynonymProvider.addSynonym | private static void addSynonym(String term, String synonym, Map<String, String[]> synonyms)
{
term = term.toLowerCase();
String[] syns = synonyms.get(term);
if (syns == null)
{
syns = new String[]{synonym};
}
else
{
String[] tmp = new String[syns.length + 1];
System.arraycopy(syns, 0, tmp, 0, syns.length);
tmp[syns.length] = synonym;
syns = tmp;
}
synonyms.put(term, syns);
} | java | private static void addSynonym(String term, String synonym, Map<String, String[]> synonyms)
{
term = term.toLowerCase();
String[] syns = synonyms.get(term);
if (syns == null)
{
syns = new String[]{synonym};
}
else
{
String[] tmp = new String[syns.length + 1];
System.arraycopy(syns, 0, tmp, 0, syns.length);
tmp[syns.length] = synonym;
syns = tmp;
}
synonyms.put(term, syns);
} | [
"private",
"static",
"void",
"addSynonym",
"(",
"String",
"term",
",",
"String",
"synonym",
",",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"synonyms",
")",
"{",
"term",
"=",
"term",
".",
"toLowerCase",
"(",
")",
";",
"String",
"[",
"]",
"sy... | Adds a synonym definition to the map.
@param term the term
@param synonym synonym for <code>term</code>.
@param synonyms the Map containing the synonyms. | [
"Adds",
"a",
"synonym",
"definition",
"to",
"the",
"map",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/PropertiesSynonymProvider.java#L176-L192 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmUtils.java | XsdAsmUtils.generateClass | static ClassWriter generateClass(String className, String superName, String[] interfaces, String signature, int classModifiers, String apiName) {
ClassWriter classWriter = new ClassWriter(0);
if (interfaces != null){
for (int i = 0; i < interfaces.length; i++) {
interfaces[i] = getFullClassTypeName(interfaces[i], apiName);
}
}
classWriter.visit(V1_8, classModifiers, getFullClassTypeName(className, apiName), signature, superName, interfaces);
return classWriter;
} | java | static ClassWriter generateClass(String className, String superName, String[] interfaces, String signature, int classModifiers, String apiName) {
ClassWriter classWriter = new ClassWriter(0);
if (interfaces != null){
for (int i = 0; i < interfaces.length; i++) {
interfaces[i] = getFullClassTypeName(interfaces[i], apiName);
}
}
classWriter.visit(V1_8, classModifiers, getFullClassTypeName(className, apiName), signature, superName, interfaces);
return classWriter;
} | [
"static",
"ClassWriter",
"generateClass",
"(",
"String",
"className",
",",
"String",
"superName",
",",
"String",
"[",
"]",
"interfaces",
",",
"String",
"signature",
",",
"int",
"classModifiers",
",",
"String",
"apiName",
")",
"{",
"ClassWriter",
"classWriter",
"... | Generates an empty class.
@param className The classes name.
@param superName The super object, which the class extends from.
@param interfaces The name of the interfaces which this class implements.
@param classModifiers The modifiers to the class.
@return A class writer that will be used to write the remaining information of the class. | [
"Generates",
"an",
"empty",
"class",
"."
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmUtils.java#L514-L526 |
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsUserEditDialog.java | CmsUserEditDialog.iniRole | protected static void iniRole(CmsObject cms, String ou, com.vaadin.ui.ComboBox<CmsRole> roleComboBox, Log log) {
try {
List<CmsRole> roles = OpenCms.getRoleManager().getRoles(cms, ou, false);
CmsRole.applySystemRoleOrder(roles);
DataProvider provider = new ListDataProvider<CmsRole>(roles);
roleComboBox.setDataProvider(provider);
roleComboBox.setItemCaptionGenerator(role -> {
try {
return role.getDisplayName(cms, A_CmsUI.get().getLocale());
} catch (CmsException e) {
return "";
}
});
roleComboBox.setEmptySelectionAllowed(false);
} catch (CmsException e) {
if (log != null) {
log.error("Unable to read roles.", e);
}
}
} | java | protected static void iniRole(CmsObject cms, String ou, com.vaadin.ui.ComboBox<CmsRole> roleComboBox, Log log) {
try {
List<CmsRole> roles = OpenCms.getRoleManager().getRoles(cms, ou, false);
CmsRole.applySystemRoleOrder(roles);
DataProvider provider = new ListDataProvider<CmsRole>(roles);
roleComboBox.setDataProvider(provider);
roleComboBox.setItemCaptionGenerator(role -> {
try {
return role.getDisplayName(cms, A_CmsUI.get().getLocale());
} catch (CmsException e) {
return "";
}
});
roleComboBox.setEmptySelectionAllowed(false);
} catch (CmsException e) {
if (log != null) {
log.error("Unable to read roles.", e);
}
}
} | [
"protected",
"static",
"void",
"iniRole",
"(",
"CmsObject",
"cms",
",",
"String",
"ou",
",",
"com",
".",
"vaadin",
".",
"ui",
".",
"ComboBox",
"<",
"CmsRole",
">",
"roleComboBox",
",",
"Log",
"log",
")",
"{",
"try",
"{",
"List",
"<",
"CmsRole",
">",
... | Initialized the role ComboBox.<p>
@param cms CmsObject
@param ou to load roles for
@param roleComboBox ComboBox
@param log LOG | [
"Initialized",
"the",
"role",
"ComboBox",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsUserEditDialog.java#L507-L530 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/TextEnterer.java | TextEnterer.setEditText | public void setEditText(final EditText editText, final String text) {
if(editText != null){
final String previousText = editText.getText().toString();
inst.runOnMainSync(new Runnable()
{
public void run()
{
editText.setInputType(InputType.TYPE_NULL);
editText.performClick();
dialogUtils.hideSoftKeyboard(editText, false, false);
if(text.equals(""))
editText.setText(text);
else{
editText.setText(previousText + text);
editText.setCursorVisible(false);
}
}
});
}
} | java | public void setEditText(final EditText editText, final String text) {
if(editText != null){
final String previousText = editText.getText().toString();
inst.runOnMainSync(new Runnable()
{
public void run()
{
editText.setInputType(InputType.TYPE_NULL);
editText.performClick();
dialogUtils.hideSoftKeyboard(editText, false, false);
if(text.equals(""))
editText.setText(text);
else{
editText.setText(previousText + text);
editText.setCursorVisible(false);
}
}
});
}
} | [
"public",
"void",
"setEditText",
"(",
"final",
"EditText",
"editText",
",",
"final",
"String",
"text",
")",
"{",
"if",
"(",
"editText",
"!=",
"null",
")",
"{",
"final",
"String",
"previousText",
"=",
"editText",
".",
"getText",
"(",
")",
".",
"toString",
... | Sets an {@code EditText} text
@param index the index of the {@code EditText}
@param text the text that should be set | [
"Sets",
"an",
"{",
"@code",
"EditText",
"}",
"text"
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/TextEnterer.java#L44-L64 |
aws/aws-sdk-java | aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/DescribeThingResult.java | DescribeThingResult.withAttributes | public DescribeThingResult withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public DescribeThingResult withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"DescribeThingResult",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The thing attributes.
</p>
@param attributes
The thing attributes.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"thing",
"attributes",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/DescribeThingResult.java#L316-L319 |
wcm-io/wcm-io-handler | link/src/main/java/io/wcm/handler/link/spi/LinkHandlerConfig.java | LinkHandlerConfig.getLinkRootPath | public @Nullable String getLinkRootPath(@NotNull Page page, @NotNull String linkTypeId) {
if (StringUtils.equals(linkTypeId, InternalLinkType.ID)) {
// inside an experience fragment it does not make sense to use a site root path
if (Path.isExperienceFragmentPath(page.getPath())) {
return DEFAULT_ROOT_PATH_CONTENT;
}
return AdaptTo.notNull(page.getContentResource(), SiteRoot.class).getRootPath(page);
}
else if (StringUtils.equals(linkTypeId, InternalCrossContextLinkType.ID)) {
return DEFAULT_ROOT_PATH_CONTENT;
}
else if (StringUtils.equals(linkTypeId, MediaLinkType.ID)) {
return DEFAULT_ROOT_PATH_MEDIA;
}
return null;
} | java | public @Nullable String getLinkRootPath(@NotNull Page page, @NotNull String linkTypeId) {
if (StringUtils.equals(linkTypeId, InternalLinkType.ID)) {
// inside an experience fragment it does not make sense to use a site root path
if (Path.isExperienceFragmentPath(page.getPath())) {
return DEFAULT_ROOT_PATH_CONTENT;
}
return AdaptTo.notNull(page.getContentResource(), SiteRoot.class).getRootPath(page);
}
else if (StringUtils.equals(linkTypeId, InternalCrossContextLinkType.ID)) {
return DEFAULT_ROOT_PATH_CONTENT;
}
else if (StringUtils.equals(linkTypeId, MediaLinkType.ID)) {
return DEFAULT_ROOT_PATH_MEDIA;
}
return null;
} | [
"public",
"@",
"Nullable",
"String",
"getLinkRootPath",
"(",
"@",
"NotNull",
"Page",
"page",
",",
"@",
"NotNull",
"String",
"linkTypeId",
")",
"{",
"if",
"(",
"StringUtils",
".",
"equals",
"(",
"linkTypeId",
",",
"InternalLinkType",
".",
"ID",
")",
")",
"{... | Get root path for picking links using path field widgets.
@param page Context page
@param linkTypeId Link type ID
@return Root path or null | [
"Get",
"root",
"path",
"for",
"picking",
"links",
"using",
"path",
"field",
"widgets",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/link/src/main/java/io/wcm/handler/link/spi/LinkHandlerConfig.java#L133-L148 |
deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/ImageLoader.java | ImageLoader.asImageMiniBatches | public INDArray asImageMiniBatches(File f, int numMiniBatches, int numRowsPerSlice) {
try {
INDArray d = asMatrix(f);
return Nd4j.create(numMiniBatches, numRowsPerSlice, d.columns());
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public INDArray asImageMiniBatches(File f, int numMiniBatches, int numRowsPerSlice) {
try {
INDArray d = asMatrix(f);
return Nd4j.create(numMiniBatches, numRowsPerSlice, d.columns());
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"INDArray",
"asImageMiniBatches",
"(",
"File",
"f",
",",
"int",
"numMiniBatches",
",",
"int",
"numRowsPerSlice",
")",
"{",
"try",
"{",
"INDArray",
"d",
"=",
"asMatrix",
"(",
"f",
")",
";",
"return",
"Nd4j",
".",
"create",
"(",
"numMiniBatches",
"... | Slices up an image in to a mini batch.
@param f the file to load from
@param numMiniBatches the number of images in a mini batch
@param numRowsPerSlice the number of rows for each image
@return a tensor representing one image as a mini batch | [
"Slices",
"up",
"an",
"image",
"in",
"to",
"a",
"mini",
"batch",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/ImageLoader.java#L324-L331 |
js-lib-com/dom | src/main/java/js/dom/w3c/DocumentBuilderImpl.java | DocumentBuilderImpl.loadXML | private Document loadXML(URL url, boolean useNamespace) {
InputStream stream = null;
try {
stream = url.openConnection().getInputStream();
InputSource source = new InputSource(stream);
return useNamespace ? loadXMLNS(source) : loadXML(source);
} catch (Exception e) {
throw new DomException(e);
} finally {
close(stream);
}
} | java | private Document loadXML(URL url, boolean useNamespace) {
InputStream stream = null;
try {
stream = url.openConnection().getInputStream();
InputSource source = new InputSource(stream);
return useNamespace ? loadXMLNS(source) : loadXML(source);
} catch (Exception e) {
throw new DomException(e);
} finally {
close(stream);
}
} | [
"private",
"Document",
"loadXML",
"(",
"URL",
"url",
",",
"boolean",
"useNamespace",
")",
"{",
"InputStream",
"stream",
"=",
"null",
";",
"try",
"{",
"stream",
"=",
"url",
".",
"openConnection",
"(",
")",
".",
"getInputStream",
"(",
")",
";",
"InputSource"... | Helper method to load XML document from URL.
@param url source URL,
@param useNamespace flag to control name space awareness.
@return newly created XML document. | [
"Helper",
"method",
"to",
"load",
"XML",
"document",
"from",
"URL",
"."
] | train | https://github.com/js-lib-com/dom/blob/8c7cd7c802977f210674dec7c2a8f61e8de05b63/src/main/java/js/dom/w3c/DocumentBuilderImpl.java#L195-L206 |
scottbw/spaws | src/main/java/uk/ac/bolton/spaws/ParadataManager.java | ParadataManager.getExternalRatingSubmissions | public List<ISubmission> getExternalRatingSubmissions(String resourceUrl) throws Exception{
return getExternalSubmissions(resourceUrl, IRating.VERB);
} | java | public List<ISubmission> getExternalRatingSubmissions(String resourceUrl) throws Exception{
return getExternalSubmissions(resourceUrl, IRating.VERB);
} | [
"public",
"List",
"<",
"ISubmission",
">",
"getExternalRatingSubmissions",
"(",
"String",
"resourceUrl",
")",
"throws",
"Exception",
"{",
"return",
"getExternalSubmissions",
"(",
"resourceUrl",
",",
"IRating",
".",
"VERB",
")",
";",
"}"
] | Return all rating submissions from other submitters for the resource
@param resourceUrl
@return
@throws Exception | [
"Return",
"all",
"rating",
"submissions",
"from",
"other",
"submitters",
"for",
"the",
"resource"
] | train | https://github.com/scottbw/spaws/blob/9b1e07453091f6a8d60c6046d194b1a8f1236502/src/main/java/uk/ac/bolton/spaws/ParadataManager.java#L83-L85 |
jbundle/jbundle | app/program/db/src/main/java/org/jbundle/app/program/db/util/ResourcesUtilities.java | ResourcesUtilities.encodeLine | public static String encodeLine(String string, boolean bResourceListBundle)
{
if (string == null)
return string;
for (int i = 0; i < string.length(); i++)
{
if (((string.charAt(i) == '\"') || (string.charAt(i) == '\\'))
|| ((!bResourceListBundle) && (string.charAt(i) == ':')))
{ // must preceed these special characters with a "\"
string = string.substring(0, i) + "\\" + string.substring(i);
i++;
}
else if (string.charAt(i) > 127)
{
String strHex = "0123456789ABCDEF";
String strOut = "\\u";
strOut += strHex.charAt((string.charAt(i) & 0xF000) >> 12);
strOut += strHex.charAt((string.charAt(i) & 0xF00) >> 8);
strOut += strHex.charAt((string.charAt(i) & 0xF0) >> 4);
strOut += strHex.charAt(string.charAt(i) & 0xF);
string = string.substring(0, i) + strOut + string.substring(i + 1);
i = i + strOut.length() - 1;
}
}
return string;
} | java | public static String encodeLine(String string, boolean bResourceListBundle)
{
if (string == null)
return string;
for (int i = 0; i < string.length(); i++)
{
if (((string.charAt(i) == '\"') || (string.charAt(i) == '\\'))
|| ((!bResourceListBundle) && (string.charAt(i) == ':')))
{ // must preceed these special characters with a "\"
string = string.substring(0, i) + "\\" + string.substring(i);
i++;
}
else if (string.charAt(i) > 127)
{
String strHex = "0123456789ABCDEF";
String strOut = "\\u";
strOut += strHex.charAt((string.charAt(i) & 0xF000) >> 12);
strOut += strHex.charAt((string.charAt(i) & 0xF00) >> 8);
strOut += strHex.charAt((string.charAt(i) & 0xF0) >> 4);
strOut += strHex.charAt(string.charAt(i) & 0xF);
string = string.substring(0, i) + strOut + string.substring(i + 1);
i = i + strOut.length() - 1;
}
}
return string;
} | [
"public",
"static",
"String",
"encodeLine",
"(",
"String",
"string",
",",
"boolean",
"bResourceListBundle",
")",
"{",
"if",
"(",
"string",
"==",
"null",
")",
"return",
"string",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"string",
".",
"leng... | Encode the utf-16 characters in this line to escaped java strings. | [
"Encode",
"the",
"utf",
"-",
"16",
"characters",
"in",
"this",
"line",
"to",
"escaped",
"java",
"strings",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/util/ResourcesUtilities.java#L87-L112 |
openbase/jul | visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGIcon.java | SVGIcon.startBackgroundIconRotateAnimation | public void startBackgroundIconRotateAnimation(final double fromAngle, final double toAngle, final int cycleCount, final double duration, final Interpolator interpolator, final boolean autoReverse) {
stopBackgroundIconRotateAnimation();
backgroundRotateAnimation = Animations.createRotateTransition(backgroundIcon, fromAngle, toAngle, cycleCount, duration, interpolator, autoReverse);
backgroundRotateAnimation.setOnFinished(event -> backgroundIcon.setRotate(0));
backgroundRotateAnimation.play();
} | java | public void startBackgroundIconRotateAnimation(final double fromAngle, final double toAngle, final int cycleCount, final double duration, final Interpolator interpolator, final boolean autoReverse) {
stopBackgroundIconRotateAnimation();
backgroundRotateAnimation = Animations.createRotateTransition(backgroundIcon, fromAngle, toAngle, cycleCount, duration, interpolator, autoReverse);
backgroundRotateAnimation.setOnFinished(event -> backgroundIcon.setRotate(0));
backgroundRotateAnimation.play();
} | [
"public",
"void",
"startBackgroundIconRotateAnimation",
"(",
"final",
"double",
"fromAngle",
",",
"final",
"double",
"toAngle",
",",
"final",
"int",
"cycleCount",
",",
"final",
"double",
"duration",
",",
"final",
"Interpolator",
"interpolator",
",",
"final",
"boolea... | Method starts the rotate animation of the background icon.
@param fromAngle the rotation angle where the transition should start.
@param toAngle the rotation angle where the transition should end.
@param cycleCount the number of times the animation should be played (use Animation.INDEFINITE for endless).
@param duration the duration which one animation cycle should take.
@param interpolator defines the rotation value interpolation between {@code fromAngle} and {@code toAngle}.
@param autoReverse defines if the animation should be reversed at the end. | [
"Method",
"starts",
"the",
"rotate",
"animation",
"of",
"the",
"background",
"icon",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGIcon.java#L376-L381 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/runtime/AbstractJobLauncher.java | AbstractJobLauncher.cleanupStagingData | private void cleanupStagingData(JobState jobState)
throws JobException {
if (jobState.getPropAsBoolean(ConfigurationKeys.CLEANUP_STAGING_DATA_BY_INITIALIZER, false)) {
//Clean up will be done by initializer.
return;
}
try {
if (!canCleanStagingData(jobState)) {
LOG.error("Job " + jobState.getJobName() + " has unfinished commit sequences. Will not clean up staging data.");
return;
}
} catch (IOException e) {
throw new JobException("Failed to check unfinished commit sequences", e);
}
if (this.jobContext.shouldCleanupStagingDataPerTask()) {
cleanupStagingDataPerTask(jobState);
} else {
cleanupStagingDataForEntireJob(jobState);
}
} | java | private void cleanupStagingData(JobState jobState)
throws JobException {
if (jobState.getPropAsBoolean(ConfigurationKeys.CLEANUP_STAGING_DATA_BY_INITIALIZER, false)) {
//Clean up will be done by initializer.
return;
}
try {
if (!canCleanStagingData(jobState)) {
LOG.error("Job " + jobState.getJobName() + " has unfinished commit sequences. Will not clean up staging data.");
return;
}
} catch (IOException e) {
throw new JobException("Failed to check unfinished commit sequences", e);
}
if (this.jobContext.shouldCleanupStagingDataPerTask()) {
cleanupStagingDataPerTask(jobState);
} else {
cleanupStagingDataForEntireJob(jobState);
}
} | [
"private",
"void",
"cleanupStagingData",
"(",
"JobState",
"jobState",
")",
"throws",
"JobException",
"{",
"if",
"(",
"jobState",
".",
"getPropAsBoolean",
"(",
"ConfigurationKeys",
".",
"CLEANUP_STAGING_DATA_BY_INITIALIZER",
",",
"false",
")",
")",
"{",
"//Clean up wil... | Cleanup the job's task staging data. This is not doing anything in case job succeeds
and data is successfully committed because the staging data has already been moved
to the job output directory. But in case the job fails and data is not committed,
we want the staging data to be cleaned up.
Property {@link ConfigurationKeys#CLEANUP_STAGING_DATA_PER_TASK} controls whether to cleanup
staging data per task, or to cleanup entire job's staging data at once.
Staging data will not be cleaned if the job has unfinished {@link CommitSequence}s. | [
"Cleanup",
"the",
"job",
"s",
"task",
"staging",
"data",
".",
"This",
"is",
"not",
"doing",
"anything",
"in",
"case",
"job",
"succeeds",
"and",
"data",
"is",
"successfully",
"committed",
"because",
"the",
"staging",
"data",
"has",
"already",
"been",
"moved",... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/AbstractJobLauncher.java#L893-L914 |
icode/ameba | src/main/java/ameba/core/Addon.java | Addon.unsubscribeSystemEvent | protected static <E extends Event> void unsubscribeSystemEvent(Class<E> eventClass, final Listener<E> listener) {
SystemEventBus.unsubscribe(eventClass, listener);
} | java | protected static <E extends Event> void unsubscribeSystemEvent(Class<E> eventClass, final Listener<E> listener) {
SystemEventBus.unsubscribe(eventClass, listener);
} | [
"protected",
"static",
"<",
"E",
"extends",
"Event",
">",
"void",
"unsubscribeSystemEvent",
"(",
"Class",
"<",
"E",
">",
"eventClass",
",",
"final",
"Listener",
"<",
"E",
">",
"listener",
")",
"{",
"SystemEventBus",
".",
"unsubscribe",
"(",
"eventClass",
","... | <p>unsubscribeSystemEvent.</p>
@param eventClass a {@link java.lang.Class} object.
@param listener a {@link ameba.event.Listener} object.
@param <E> a E object. | [
"<p",
">",
"unsubscribeSystemEvent",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/core/Addon.java#L94-L96 |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/FileUtils.java | FileUtils.toHashMap | public static Map<String, List<String>> toHashMap(final String aFilePath, final String aPattern,
final String... aIgnoreList) throws FileNotFoundException {
final String filePattern = aPattern != null ? aPattern : WILDCARD;
final RegexFileFilter filter = new RegexFileFilter(filePattern);
final Map<String, List<String>> fileMap = new HashMap<>();
final File source = new File(aFilePath);
for (final File file : listFiles(source, filter, true, aIgnoreList)) {
final String fileName = file.getName();
final String filePath = file.getAbsolutePath();
if (fileMap.containsKey(fileName)) {
final List<String> paths = fileMap.get(fileName);
if (!paths.contains(filePath)) {
paths.add(filePath);
} else {
throw new I18nRuntimeException(BUNDLE_NAME, MessageCodes.UTIL_034);
}
} else {
final ArrayList<String> pathList = new ArrayList<>();
pathList.add(filePath);
fileMap.put(fileName, pathList);
}
}
return Collections.unmodifiableMap(fileMap);
} | java | public static Map<String, List<String>> toHashMap(final String aFilePath, final String aPattern,
final String... aIgnoreList) throws FileNotFoundException {
final String filePattern = aPattern != null ? aPattern : WILDCARD;
final RegexFileFilter filter = new RegexFileFilter(filePattern);
final Map<String, List<String>> fileMap = new HashMap<>();
final File source = new File(aFilePath);
for (final File file : listFiles(source, filter, true, aIgnoreList)) {
final String fileName = file.getName();
final String filePath = file.getAbsolutePath();
if (fileMap.containsKey(fileName)) {
final List<String> paths = fileMap.get(fileName);
if (!paths.contains(filePath)) {
paths.add(filePath);
} else {
throw new I18nRuntimeException(BUNDLE_NAME, MessageCodes.UTIL_034);
}
} else {
final ArrayList<String> pathList = new ArrayList<>();
pathList.add(filePath);
fileMap.put(fileName, pathList);
}
}
return Collections.unmodifiableMap(fileMap);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"toHashMap",
"(",
"final",
"String",
"aFilePath",
",",
"final",
"String",
"aPattern",
",",
"final",
"String",
"...",
"aIgnoreList",
")",
"throws",
"FileNotFoundException",
"{",
"... | Returns a Map representation of the supplied directory's structure. The map contains the file name as the key
and its path as the value. If a file with a name occurs more than once, multiple path values are returned for
that file name key. The map that is returned is unmodifiable.
@param aFilePath The directory of which you'd like a file listing
@param aPattern A regular expression pattern which the files must match to be returned
@param aIgnoreList A list of directories into which we shouldn't descend
@return An unmodifiable map representing the files in the file structure
@throws FileNotFoundException If the directory for the supplied file path does not exist
@throws RuntimeException If a duplicate file path name is discovered | [
"Returns",
"a",
"Map",
"representation",
"of",
"the",
"supplied",
"directory",
"s",
"structure",
".",
"The",
"map",
"contains",
"the",
"file",
"name",
"as",
"the",
"key",
"and",
"its",
"path",
"as",
"the",
"value",
".",
"If",
"a",
"file",
"with",
"a",
... | train | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/FileUtils.java#L214-L241 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java | ImageLoading.saveBmp | public static void saveBmp(Bitmap src, String fileName) throws ImageSaveException {
try {
BitmapUtil.save(src, fileName);
} catch (IOException e) {
throw new ImageSaveException(e);
}
} | java | public static void saveBmp(Bitmap src, String fileName) throws ImageSaveException {
try {
BitmapUtil.save(src, fileName);
} catch (IOException e) {
throw new ImageSaveException(e);
}
} | [
"public",
"static",
"void",
"saveBmp",
"(",
"Bitmap",
"src",
",",
"String",
"fileName",
")",
"throws",
"ImageSaveException",
"{",
"try",
"{",
"BitmapUtil",
".",
"save",
"(",
"src",
",",
"fileName",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{... | Saving image in bmp to file
@param src source image
@param fileName destination file name
@throws ImageSaveException if it is unable to save image | [
"Saving",
"image",
"in",
"bmp",
"to",
"file"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L343-L349 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java | ImageLoaderCurrent.processINodes | private void processINodes(DataInputStream in, ImageVisitor v,
long numInodes, boolean skipBlocks) throws IOException {
v.visitEnclosingElement(ImageElement.INODES,
ImageElement.NUM_INODES, numInodes);
if (LayoutVersion.supports(Feature.FSIMAGE_NAME_OPTIMIZATION, imageVersion)) {
processLocalNameINodes(in, v, numInodes, skipBlocks);
} else { // full path name
processFullNameINodes(in, v, numInodes, skipBlocks);
}
v.leaveEnclosingElement(); // INodes
} | java | private void processINodes(DataInputStream in, ImageVisitor v,
long numInodes, boolean skipBlocks) throws IOException {
v.visitEnclosingElement(ImageElement.INODES,
ImageElement.NUM_INODES, numInodes);
if (LayoutVersion.supports(Feature.FSIMAGE_NAME_OPTIMIZATION, imageVersion)) {
processLocalNameINodes(in, v, numInodes, skipBlocks);
} else { // full path name
processFullNameINodes(in, v, numInodes, skipBlocks);
}
v.leaveEnclosingElement(); // INodes
} | [
"private",
"void",
"processINodes",
"(",
"DataInputStream",
"in",
",",
"ImageVisitor",
"v",
",",
"long",
"numInodes",
",",
"boolean",
"skipBlocks",
")",
"throws",
"IOException",
"{",
"v",
".",
"visitEnclosingElement",
"(",
"ImageElement",
".",
"INODES",
",",
"Im... | Process the INode records stored in the fsimage.
@param in Datastream to process
@param v Visitor to walk over INodes
@param numInodes Number of INodes stored in file
@param skipBlocks Process all the blocks within the INode?
@throws VisitException
@throws IOException | [
"Process",
"the",
"INode",
"records",
"stored",
"in",
"the",
"fsimage",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java#L322-L335 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_easyHunting_serviceName_hunting_agent_agentId_eventToken_GET | public OvhEventToken billingAccount_easyHunting_serviceName_hunting_agent_agentId_eventToken_GET(String billingAccount, String serviceName, Long agentId) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}/eventToken";
StringBuilder sb = path(qPath, billingAccount, serviceName, agentId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhEventToken.class);
} | java | public OvhEventToken billingAccount_easyHunting_serviceName_hunting_agent_agentId_eventToken_GET(String billingAccount, String serviceName, Long agentId) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}/eventToken";
StringBuilder sb = path(qPath, billingAccount, serviceName, agentId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhEventToken.class);
} | [
"public",
"OvhEventToken",
"billingAccount_easyHunting_serviceName_hunting_agent_agentId_eventToken_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"agentId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAcco... | Get this object properties
REST: GET /telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}/eventToken
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param agentId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L2543-L2548 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container/src/com/ibm/ws/jpa/container/osgi/internal/JPAComponentImpl.java | JPAComponentImpl.processWebModulePersistenceXml | private void processWebModulePersistenceXml(JPAApplInfo applInfo, ContainerInfo warContainerInfo, ClassLoader warClassLoader) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "processWebModulePersistenceXml : " + applInfo.getApplName() + "#" + warContainerInfo);
}
String archiveName = warContainerInfo.getName();
Container warContainer = warContainerInfo.getContainer();
// ------------------------------------------------------------------------
// JPA 2.0 Specification - 8.2 Persistence Unit Packaging
//
// A persistence unit is defined by a persistence.xml file. The jar file or
// directory whose META-INF directory contains the persistence.xml file is
// termed the root of the persistence unit. In Java EE environments, the
// root of a persistence unit may be one of the following:
//
// -> the WEB-INF/classes directory of a WAR file
// -> a jar file in the WEB-INF/lib directory of a WAR file
// ------------------------------------------------------------------------
// Obtain any persistence.xml in WEB-INF/classes/META-INF
Entry pxml = warContainer.getEntry("WEB-INF/classes/META-INF/persistence.xml");
if (pxml != null) {
String appName = applInfo.getApplName();
URL puRoot = getPXmlRootURL(appName, archiveName, pxml);
applInfo.addPersistenceUnits(new OSGiJPAPXml(applInfo, archiveName, JPAPuScope.Web_Scope, puRoot, warClassLoader, pxml));
}
// Obtain any persistenc.xml in WEB-INF/lib/*.jar. This includes 'utility'
// jars and web fragments. Any PUs found are WEB scoped and considered to
// be in the WAR, so just use the WAR archiveName (don't use a root prefix
// that is prepended to the jar/fragment name).
Entry webInfLib = warContainer.getEntry("WEB-INF/lib/");
if (webInfLib != null) {
try {
Container webInfLibContainer = webInfLib.adapt(Container.class);
processLibraryJarPersistenceXml(applInfo, webInfLibContainer, archiveName, null, JPAPuScope.Web_Scope, warClassLoader);
} catch (UnableToAdaptException ex) {
// Should never occur... just propagate failure
throw new RuntimeException("Failure locating persistence.xml", ex);
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processWebModulePersistenceXml : " + applInfo.getApplName() +
"#" + warContainer);
} | java | private void processWebModulePersistenceXml(JPAApplInfo applInfo, ContainerInfo warContainerInfo, ClassLoader warClassLoader) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "processWebModulePersistenceXml : " + applInfo.getApplName() + "#" + warContainerInfo);
}
String archiveName = warContainerInfo.getName();
Container warContainer = warContainerInfo.getContainer();
// ------------------------------------------------------------------------
// JPA 2.0 Specification - 8.2 Persistence Unit Packaging
//
// A persistence unit is defined by a persistence.xml file. The jar file or
// directory whose META-INF directory contains the persistence.xml file is
// termed the root of the persistence unit. In Java EE environments, the
// root of a persistence unit may be one of the following:
//
// -> the WEB-INF/classes directory of a WAR file
// -> a jar file in the WEB-INF/lib directory of a WAR file
// ------------------------------------------------------------------------
// Obtain any persistence.xml in WEB-INF/classes/META-INF
Entry pxml = warContainer.getEntry("WEB-INF/classes/META-INF/persistence.xml");
if (pxml != null) {
String appName = applInfo.getApplName();
URL puRoot = getPXmlRootURL(appName, archiveName, pxml);
applInfo.addPersistenceUnits(new OSGiJPAPXml(applInfo, archiveName, JPAPuScope.Web_Scope, puRoot, warClassLoader, pxml));
}
// Obtain any persistenc.xml in WEB-INF/lib/*.jar. This includes 'utility'
// jars and web fragments. Any PUs found are WEB scoped and considered to
// be in the WAR, so just use the WAR archiveName (don't use a root prefix
// that is prepended to the jar/fragment name).
Entry webInfLib = warContainer.getEntry("WEB-INF/lib/");
if (webInfLib != null) {
try {
Container webInfLibContainer = webInfLib.adapt(Container.class);
processLibraryJarPersistenceXml(applInfo, webInfLibContainer, archiveName, null, JPAPuScope.Web_Scope, warClassLoader);
} catch (UnableToAdaptException ex) {
// Should never occur... just propagate failure
throw new RuntimeException("Failure locating persistence.xml", ex);
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processWebModulePersistenceXml : " + applInfo.getApplName() +
"#" + warContainer);
} | [
"private",
"void",
"processWebModulePersistenceXml",
"(",
"JPAApplInfo",
"applInfo",
",",
"ContainerInfo",
"warContainerInfo",
",",
"ClassLoader",
"warClassLoader",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"... | Locates and processes all persistence.xml file in a WAR module. <p>
@param applInfo the application archive information
@param module the WAR module archive information | [
"Locates",
"and",
"processes",
"all",
"persistence",
".",
"xml",
"file",
"in",
"a",
"WAR",
"module",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container/src/com/ibm/ws/jpa/container/osgi/internal/JPAComponentImpl.java#L485-L532 |
Netflix/conductor | client/src/main/java/com/netflix/conductor/client/http/MetadataClient.java | MetadataClient.getTaskDef | public TaskDef getTaskDef(String taskType) {
Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank");
return getForEntity("metadata/taskdefs/{tasktype}", null, TaskDef.class, taskType);
} | java | public TaskDef getTaskDef(String taskType) {
Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank");
return getForEntity("metadata/taskdefs/{tasktype}", null, TaskDef.class, taskType);
} | [
"public",
"TaskDef",
"getTaskDef",
"(",
"String",
"taskType",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"taskType",
")",
",",
"\"Task type cannot be blank\"",
")",
";",
"return",
"getForEntity",
"(",
"\"metadata/tas... | Retrieve the task definition of a given task type
@param taskType type of task for which to retrieve the definition
@return Task Definition for the given task type | [
"Retrieve",
"the",
"task",
"definition",
"of",
"a",
"given",
"task",
"type"
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/MetadataClient.java#L161-L164 |
ironjacamar/ironjacamar | common/src/main/java/org/ironjacamar/common/annotations/Annotations.java | Annotations.processConnectionDefinitions | private ArrayList<ConnectionDefinition> processConnectionDefinitions(AnnotationRepository annotationRepository,
ClassLoader classLoader,
ArrayList<? extends ConfigProperty> configProperties,
ArrayList<? extends ConfigProperty> plainConfigProperties)
throws Exception
{
Collection<Annotation> values = annotationRepository.getAnnotation(ConnectionDefinitions.class);
if (values != null)
{
if (values.size() == 1)
{
Annotation annotation = values.iterator().next();
ConnectionDefinitions connectionDefinitionsAnnotation = (ConnectionDefinitions) annotation
.getAnnotation();
if (trace)
log.trace("Processing: " + connectionDefinitionsAnnotation);
return attachConnectionDefinitions(connectionDefinitionsAnnotation, annotation.getClassName(),
classLoader,
configProperties, plainConfigProperties);
}
else
throw new ValidateException(bundle.moreThanOneConnectionDefinitionsDefined());
}
return null;
} | java | private ArrayList<ConnectionDefinition> processConnectionDefinitions(AnnotationRepository annotationRepository,
ClassLoader classLoader,
ArrayList<? extends ConfigProperty> configProperties,
ArrayList<? extends ConfigProperty> plainConfigProperties)
throws Exception
{
Collection<Annotation> values = annotationRepository.getAnnotation(ConnectionDefinitions.class);
if (values != null)
{
if (values.size() == 1)
{
Annotation annotation = values.iterator().next();
ConnectionDefinitions connectionDefinitionsAnnotation = (ConnectionDefinitions) annotation
.getAnnotation();
if (trace)
log.trace("Processing: " + connectionDefinitionsAnnotation);
return attachConnectionDefinitions(connectionDefinitionsAnnotation, annotation.getClassName(),
classLoader,
configProperties, plainConfigProperties);
}
else
throw new ValidateException(bundle.moreThanOneConnectionDefinitionsDefined());
}
return null;
} | [
"private",
"ArrayList",
"<",
"ConnectionDefinition",
">",
"processConnectionDefinitions",
"(",
"AnnotationRepository",
"annotationRepository",
",",
"ClassLoader",
"classLoader",
",",
"ArrayList",
"<",
"?",
"extends",
"ConfigProperty",
">",
"configProperties",
",",
"ArrayLis... | Process: @ConnectionDefinitions
@param annotationRepository The annotation repository
@param classLoader The class loader
@param configProperties Config properties
@param plainConfigProperties Plain config properties
@return The updated metadata
@exception Exception Thrown if an error occurs | [
"Process",
":"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/annotations/Annotations.java#L551-L578 |
belaban/JGroups | src/org/jgroups/util/Bits.java | Bits.writeInt | public static void writeInt(int num, DataOutput out) throws IOException {
if(num == 0) {
out.write(0);
return;
}
final byte bytes_needed=bytesRequiredFor(num);
out.write(bytes_needed);
for(int i=0; i < bytes_needed; i++)
out.write(getByteAt(num, i));
} | java | public static void writeInt(int num, DataOutput out) throws IOException {
if(num == 0) {
out.write(0);
return;
}
final byte bytes_needed=bytesRequiredFor(num);
out.write(bytes_needed);
for(int i=0; i < bytes_needed; i++)
out.write(getByteAt(num, i));
} | [
"public",
"static",
"void",
"writeInt",
"(",
"int",
"num",
",",
"DataOutput",
"out",
")",
"throws",
"IOException",
"{",
"if",
"(",
"num",
"==",
"0",
")",
"{",
"out",
".",
"write",
"(",
"0",
")",
";",
"return",
";",
"}",
"final",
"byte",
"bytes_needed... | Writes an int to an output stream
@param num the int to be written
@param out the output stream | [
"Writes",
"an",
"int",
"to",
"an",
"output",
"stream"
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L102-L111 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.email_exchange_organizationName_service_exchangeService_outlook_duration_GET | public OvhOrder email_exchange_organizationName_service_exchangeService_outlook_duration_GET(String organizationName, String exchangeService, String duration, OvhOutlookVersionEnum licence, String primaryEmailAddress) throws IOException {
String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/outlook/{duration}";
StringBuilder sb = path(qPath, organizationName, exchangeService, duration);
query(sb, "licence", licence);
query(sb, "primaryEmailAddress", primaryEmailAddress);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder email_exchange_organizationName_service_exchangeService_outlook_duration_GET(String organizationName, String exchangeService, String duration, OvhOutlookVersionEnum licence, String primaryEmailAddress) throws IOException {
String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/outlook/{duration}";
StringBuilder sb = path(qPath, organizationName, exchangeService, duration);
query(sb, "licence", licence);
query(sb, "primaryEmailAddress", primaryEmailAddress);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"email_exchange_organizationName_service_exchangeService_outlook_duration_GET",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"duration",
",",
"OvhOutlookVersionEnum",
"licence",
",",
"String",
"primaryEmailAddress",
")"... | Get prices and contracts information
REST: GET /order/email/exchange/{organizationName}/service/{exchangeService}/outlook/{duration}
@param licence [required] Outlook version
@param primaryEmailAddress [required] Primary email address for account which You want to buy an outlook
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@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#L3832-L3839 |
highsource/maven-jaxb2-plugin | plugin-core/src/main/java/org/jvnet/jaxb2/maven2/util/IOUtils.java | IOUtils.scanDirectoryForFiles | public static List<File> scanDirectoryForFiles(BuildContext buildContext, final File directory,
final String[] includes, final String[] excludes, boolean defaultExcludes) throws IOException {
if (!directory.exists()) {
return Collections.emptyList();
}
final Scanner scanner;
if (buildContext != null) {
scanner = buildContext.newScanner(directory, true);
} else {
final DirectoryScanner directoryScanner = new DirectoryScanner();
directoryScanner.setBasedir(directory.getAbsoluteFile());
scanner = directoryScanner;
}
scanner.setIncludes(includes);
scanner.setExcludes(excludes);
if (defaultExcludes) {
scanner.addDefaultExcludes();
}
scanner.scan();
final List<File> files = new ArrayList<File>();
for (final String name : scanner.getIncludedFiles()) {
files.add(new File(directory, name).getCanonicalFile());
}
return files;
} | java | public static List<File> scanDirectoryForFiles(BuildContext buildContext, final File directory,
final String[] includes, final String[] excludes, boolean defaultExcludes) throws IOException {
if (!directory.exists()) {
return Collections.emptyList();
}
final Scanner scanner;
if (buildContext != null) {
scanner = buildContext.newScanner(directory, true);
} else {
final DirectoryScanner directoryScanner = new DirectoryScanner();
directoryScanner.setBasedir(directory.getAbsoluteFile());
scanner = directoryScanner;
}
scanner.setIncludes(includes);
scanner.setExcludes(excludes);
if (defaultExcludes) {
scanner.addDefaultExcludes();
}
scanner.scan();
final List<File> files = new ArrayList<File>();
for (final String name : scanner.getIncludedFiles()) {
files.add(new File(directory, name).getCanonicalFile());
}
return files;
} | [
"public",
"static",
"List",
"<",
"File",
">",
"scanDirectoryForFiles",
"(",
"BuildContext",
"buildContext",
",",
"final",
"File",
"directory",
",",
"final",
"String",
"[",
"]",
"includes",
",",
"final",
"String",
"[",
"]",
"excludes",
",",
"boolean",
"defaultE... | Scans given directory for files satisfying given inclusion/exclusion
patterns.
@param buildContext
Build context provided by the environment, used to scan for files.
@param directory
Directory to scan.
@param includes
inclusion pattern.
@param excludes
exclusion pattern.
@param defaultExcludes
default exclusion flag.
@return Files from the given directory which satisfy given patterns. The
files are {@link File#getCanonicalFile() canonical}.
@throws IOException
If an I/O error occurs, which is possible because the
construction of the canonical pathname may require filesystem
queries. | [
"Scans",
"given",
"directory",
"for",
"files",
"satisfying",
"given",
"inclusion",
"/",
"exclusion",
"patterns",
"."
] | train | https://github.com/highsource/maven-jaxb2-plugin/blob/a4d3955be5a8c2a5f6137c0f436798c95ef95176/plugin-core/src/main/java/org/jvnet/jaxb2/maven2/util/IOUtils.java#L76-L104 |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/JoblogUtil.java | JoblogUtil.logToJoblogIfNotTraceLoggable | @Trivial
private static void logToJoblogIfNotTraceLoggable(Level level, String msg, Logger traceLogger){
if(includeServerLogging){
if(!traceLogger.isLoggable(level)){
jobLogger.log(level,msg);
}
}
else{
jobLogger.log(level, msg);
}
} | java | @Trivial
private static void logToJoblogIfNotTraceLoggable(Level level, String msg, Logger traceLogger){
if(includeServerLogging){
if(!traceLogger.isLoggable(level)){
jobLogger.log(level,msg);
}
}
else{
jobLogger.log(level, msg);
}
} | [
"@",
"Trivial",
"private",
"static",
"void",
"logToJoblogIfNotTraceLoggable",
"(",
"Level",
"level",
",",
"String",
"msg",
",",
"Logger",
"traceLogger",
")",
"{",
"if",
"(",
"includeServerLogging",
")",
"{",
"if",
"(",
"!",
"traceLogger",
".",
"isLoggable",
"(... | if property includeServerLogging = true (default) in the server.xml,
then all the messages logged to trace.log are also logged to the joblog.
So logging to trace is enough for the message to be in both trace.log and the joblog.
if property includeServerLogging = false in the server.xml,
then none of the messages logged to trace.log are logged to the joblog.
So printing to trace.log and joblogs has to be done separately. | [
"if",
"property",
"includeServerLogging",
"=",
"true",
"(",
"default",
")",
"in",
"the",
"server",
".",
"xml",
"then",
"all",
"the",
"messages",
"logged",
"to",
"trace",
".",
"log",
"are",
"also",
"logged",
"to",
"the",
"joblog",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/JoblogUtil.java#L137-L147 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/products/ProductExtraUrl.java | ProductExtraUrl.getExtraValueLocalizedDeltaPriceUrl | public static MozuUrl getExtraValueLocalizedDeltaPriceUrl(String attributeFQN, String currencyCode, String productCode, String responseFields, String value)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/Extras/{attributeFQN}/Values/{value}/localizedDeltaPrice/{currencyCode}?responseFields={responseFields}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("currencyCode", currencyCode);
formatter.formatUrl("productCode", productCode);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("value", value);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getExtraValueLocalizedDeltaPriceUrl(String attributeFQN, String currencyCode, String productCode, String responseFields, String value)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/Extras/{attributeFQN}/Values/{value}/localizedDeltaPrice/{currencyCode}?responseFields={responseFields}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("currencyCode", currencyCode);
formatter.formatUrl("productCode", productCode);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("value", value);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getExtraValueLocalizedDeltaPriceUrl",
"(",
"String",
"attributeFQN",
",",
"String",
"currencyCode",
",",
"String",
"productCode",
",",
"String",
"responseFields",
",",
"String",
"value",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new"... | Get Resource Url for GetExtraValueLocalizedDeltaPrice
@param attributeFQN Fully qualified name for an attribute.
@param currencyCode The three character ISOÂ currency code, such as USDÂ for US Dollars.
@param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param value The value string to create.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetExtraValueLocalizedDeltaPrice"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/products/ProductExtraUrl.java#L53-L62 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/TextAnalyticsImpl.java | TextAnalyticsImpl.entitiesAsync | public ServiceFuture<EntitiesBatchResult> entitiesAsync(EntitiesOptionalParameter entitiesOptionalParameter, final ServiceCallback<EntitiesBatchResult> serviceCallback) {
return ServiceFuture.fromResponse(entitiesWithServiceResponseAsync(entitiesOptionalParameter), serviceCallback);
} | java | public ServiceFuture<EntitiesBatchResult> entitiesAsync(EntitiesOptionalParameter entitiesOptionalParameter, final ServiceCallback<EntitiesBatchResult> serviceCallback) {
return ServiceFuture.fromResponse(entitiesWithServiceResponseAsync(entitiesOptionalParameter), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"EntitiesBatchResult",
">",
"entitiesAsync",
"(",
"EntitiesOptionalParameter",
"entitiesOptionalParameter",
",",
"final",
"ServiceCallback",
"<",
"EntitiesBatchResult",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromRe... | The API returns a list of recognized entities in a given document.
To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages.
@param entitiesOptionalParameter the object representing the optional parameters to be set before calling this API
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"The",
"API",
"returns",
"a",
"list",
"of",
"recognized",
"entities",
"in",
"a",
"given",
"document",
".",
"To",
"get",
"even",
"more",
"information",
"on",
"each",
"recognized",
"entity",
"we",
"recommend",
"using",
"the",
"Bing",
"Entity",
"Search",
"API",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/TextAnalyticsImpl.java#L111-L113 |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateAssign | private Context translateAssign(WyilFile.LVal[] lval, Expr[] rval, Context context) {
Expr[] ls = new Expr[lval.length];
for (int i = 0; i != ls.length; ++i) {
WyilFile.LVal lhs = lval[i];
generateTypeInvariantCheck(lhs.getType(), rval[i], context);
context = translateSingleAssignment(lval[i], rval[i], context);
}
return context;
} | java | private Context translateAssign(WyilFile.LVal[] lval, Expr[] rval, Context context) {
Expr[] ls = new Expr[lval.length];
for (int i = 0; i != ls.length; ++i) {
WyilFile.LVal lhs = lval[i];
generateTypeInvariantCheck(lhs.getType(), rval[i], context);
context = translateSingleAssignment(lval[i], rval[i], context);
}
return context;
} | [
"private",
"Context",
"translateAssign",
"(",
"WyilFile",
".",
"LVal",
"[",
"]",
"lval",
",",
"Expr",
"[",
"]",
"rval",
",",
"Context",
"context",
")",
"{",
"Expr",
"[",
"]",
"ls",
"=",
"new",
"Expr",
"[",
"lval",
".",
"length",
"]",
";",
"for",
"(... | Translate an individual assignment from one rval to one or more lvals. If
there are multiple lvals, then a tuple is created to represent the left-hand
side.
@param lval
One or more expressions representing the left-hand side
@param rval
A single expression representing the right-hand side
@param context
@return
@throws ResolutionError | [
"Translate",
"an",
"individual",
"assignment",
"from",
"one",
"rval",
"to",
"one",
"or",
"more",
"lvals",
".",
"If",
"there",
"are",
"multiple",
"lvals",
"then",
"a",
"tuple",
"is",
"created",
"to",
"represent",
"the",
"left",
"-",
"hand",
"side",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L565-L573 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java | OjbTagsHandler.forAllColumns | public void forAllColumns(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _curTableDef.getColumns(); it.hasNext(); )
{
_curColumnDef = (ColumnDef)it.next();
generate(template);
}
_curColumnDef = null;
} | java | public void forAllColumns(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _curTableDef.getColumns(); it.hasNext(); )
{
_curColumnDef = (ColumnDef)it.next();
generate(template);
}
_curColumnDef = null;
} | [
"public",
"void",
"forAllColumns",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"for",
"(",
"Iterator",
"it",
"=",
"_curTableDef",
".",
"getColumns",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
... | Processes the template for all column definitions of the current table.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" | [
"Processes",
"the",
"template",
"for",
"all",
"column",
"definitions",
"of",
"the",
"current",
"table",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L1344-L1352 |
threerings/nenya | core/src/main/java/com/threerings/media/image/ImageManager.java | ImageManager.getMirage | public Mirage getMirage (String rsrcPath)
{
return getMirage(getImageKey(_defaultProvider, rsrcPath), null, null);
} | java | public Mirage getMirage (String rsrcPath)
{
return getMirage(getImageKey(_defaultProvider, rsrcPath), null, null);
} | [
"public",
"Mirage",
"getMirage",
"(",
"String",
"rsrcPath",
")",
"{",
"return",
"getMirage",
"(",
"getImageKey",
"(",
"_defaultProvider",
",",
"rsrcPath",
")",
",",
"null",
",",
"null",
")",
";",
"}"
] | Creates a mirage which is an image optimized for display on our current display device and
which will be stored into video memory if possible. | [
"Creates",
"a",
"mirage",
"which",
"is",
"an",
"image",
"optimized",
"for",
"display",
"on",
"our",
"current",
"display",
"device",
"and",
"which",
"will",
"be",
"stored",
"into",
"video",
"memory",
"if",
"possible",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L320-L323 |
google/flatbuffers | java/com/google/flatbuffers/Utf8Safe.java | Utf8Safe.encodeUtf8 | @Override
public void encodeUtf8(CharSequence in, ByteBuffer out) {
if (out.hasArray()) {
int start = out.arrayOffset();
int end = encodeUtf8Array(in, out.array(), start + out.position(),
out.remaining());
out.position(end - start);
} else {
encodeUtf8Buffer(in, out);
}
} | java | @Override
public void encodeUtf8(CharSequence in, ByteBuffer out) {
if (out.hasArray()) {
int start = out.arrayOffset();
int end = encodeUtf8Array(in, out.array(), start + out.position(),
out.remaining());
out.position(end - start);
} else {
encodeUtf8Buffer(in, out);
}
} | [
"@",
"Override",
"public",
"void",
"encodeUtf8",
"(",
"CharSequence",
"in",
",",
"ByteBuffer",
"out",
")",
"{",
"if",
"(",
"out",
".",
"hasArray",
"(",
")",
")",
"{",
"int",
"start",
"=",
"out",
".",
"arrayOffset",
"(",
")",
";",
"int",
"end",
"=",
... | Encodes the given characters to the target {@link ByteBuffer} using UTF-8 encoding.
<p>Selects an optimal algorithm based on the type of {@link ByteBuffer} (i.e. heap or direct)
and the capabilities of the platform.
@param in the source string to be encoded
@param out the target buffer to receive the encoded string. | [
"Encodes",
"the",
"given",
"characters",
"to",
"the",
"target",
"{",
"@link",
"ByteBuffer",
"}",
"using",
"UTF",
"-",
"8",
"encoding",
"."
] | train | https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Utf8Safe.java#L431-L441 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.ortho2D | public Matrix4x3f ortho2D(float left, float right, float bottom, float top) {
return ortho2D(left, right, bottom, top, this);
} | java | public Matrix4x3f ortho2D(float left, float right, float bottom, float top) {
return ortho2D(left, right, bottom, top, this);
} | [
"public",
"Matrix4x3f",
"ortho2D",
"(",
"float",
"left",
",",
"float",
"right",
",",
"float",
"bottom",
",",
"float",
"top",
")",
"{",
"return",
"ortho2D",
"(",
"left",
",",
"right",
",",
"bottom",
",",
"top",
",",
"this",
")",
";",
"}"
] | Apply an orthographic projection transformation for a right-handed coordinate system to this matrix.
<p>
This method is equivalent to calling {@link #ortho(float, float, float, float, float, float) ortho()} with
<code>zNear=-1</code> and <code>zFar=+1</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix,
then the new matrix will be <code>M * O</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the
orthographic projection transformation will be applied first!
<p>
In order to set the matrix to an orthographic projection without post-multiplying it,
use {@link #setOrtho2D(float, float, float, float) setOrtho2D()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #ortho(float, float, float, float, float, float)
@see #setOrtho2D(float, float, float, float)
@param left
the distance from the center to the left frustum edge
@param right
the distance from the center to the right frustum edge
@param bottom
the distance from the center to the bottom frustum edge
@param top
the distance from the center to the top frustum edge
@return this | [
"Apply",
"an",
"orthographic",
"projection",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"to",
"this",
"matrix",
".",
"<p",
">",
"This",
"method",
"is",
"equivalent",
"to",
"calling",
"{",
"@link",
"#ortho",
"(",
"float",
"f... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L5739-L5741 |
alkacon/opencms-core | src/org/opencms/ugc/CmsUgcEditService.java | CmsUgcEditService.readContent | private CmsUgcContent readContent(CmsUgcSession session, CmsResource resource) throws CmsException {
CmsUgcContent formContent = new CmsUgcContent();
Map<String, String> contentValues = session.getValues();
formContent.setContentValues(contentValues);
formContent.setSessionId(session.getId());
formContent.setResourceType(OpenCms.getResourceManager().getResourceType(resource).getTypeName());
formContent.setSitePath(getCmsObject().getSitePath(resource));
formContent.setStrucureId(resource.getStructureId());
return formContent;
} | java | private CmsUgcContent readContent(CmsUgcSession session, CmsResource resource) throws CmsException {
CmsUgcContent formContent = new CmsUgcContent();
Map<String, String> contentValues = session.getValues();
formContent.setContentValues(contentValues);
formContent.setSessionId(session.getId());
formContent.setResourceType(OpenCms.getResourceManager().getResourceType(resource).getTypeName());
formContent.setSitePath(getCmsObject().getSitePath(resource));
formContent.setStrucureId(resource.getStructureId());
return formContent;
} | [
"private",
"CmsUgcContent",
"readContent",
"(",
"CmsUgcSession",
"session",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"CmsUgcContent",
"formContent",
"=",
"new",
"CmsUgcContent",
"(",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
... | Reads the form content information.<p>
@param session the editing session
@param resource the edited resource
@return the form content
@throws CmsException if reading the info fails | [
"Reads",
"the",
"form",
"content",
"information",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcEditService.java#L277-L287 |
igniterealtime/Smack | smack-experimental/src/main/java/org/jivesoftware/smackx/mam/MamManager.java | MamManager.updateArchivingPreferences | @Deprecated
public MamPrefsResult updateArchivingPreferences(List<Jid> alwaysJids, List<Jid> neverJids, DefaultBehavior defaultBehavior)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException,
NotLoggedInException {
Objects.requireNonNull(defaultBehavior, "Default behavior must be set");
MamPrefsIQ mamPrefIQ = new MamPrefsIQ(alwaysJids, neverJids, defaultBehavior);
return queryMamPrefs(mamPrefIQ);
} | java | @Deprecated
public MamPrefsResult updateArchivingPreferences(List<Jid> alwaysJids, List<Jid> neverJids, DefaultBehavior defaultBehavior)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException,
NotLoggedInException {
Objects.requireNonNull(defaultBehavior, "Default behavior must be set");
MamPrefsIQ mamPrefIQ = new MamPrefsIQ(alwaysJids, neverJids, defaultBehavior);
return queryMamPrefs(mamPrefIQ);
} | [
"@",
"Deprecated",
"public",
"MamPrefsResult",
"updateArchivingPreferences",
"(",
"List",
"<",
"Jid",
">",
"alwaysJids",
",",
"List",
"<",
"Jid",
">",
"neverJids",
",",
"DefaultBehavior",
"defaultBehavior",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorExceptio... | Update the preferences in the server.
@param alwaysJids
is the list of JIDs that should always have messages to/from
archived in the user's store
@param neverJids
is the list of JIDs that should never have messages to/from
archived in the user's store
@param defaultBehavior
can be "roster", "always", "never" (see XEP-0313)
@return the MAM preferences result
@throws NoResponseException
@throws XMPPErrorException
@throws NotConnectedException
@throws InterruptedException
@throws NotLoggedInException
@deprecated use {@link #updateArchivingPreferences(MamPrefs)} instead. | [
"Update",
"the",
"preferences",
"in",
"the",
"server",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/MamManager.java#L815-L822 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsync | public static <T1, T2, T3, T4, T5, T6> Func6<T1, T2, T3, T4, T5, T6, Observable<Void>> toAsync(Action6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6> action) {
return toAsync(action, Schedulers.computation());
} | java | public static <T1, T2, T3, T4, T5, T6> Func6<T1, T2, T3, T4, T5, T6, Observable<Void>> toAsync(Action6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6> action) {
return toAsync(action, Schedulers.computation());
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
">",
"Func6",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
",",
"Observable",
"<",
"Void",
">",
">",
"toAsync",
"(",
"Action6",
"<",
... | Convert a synchronous action call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.an.png" alt="">
@param <T1> the first parameter type
@param <T2> the second parameter type
@param <T3> the third parameter type
@param <T4> the fourth parameter type
@param <T5> the fifth parameter type
@param <T6> the sixth parameter type
@param action the action to convert
@return a function that returns an Observable that executes the {@code action} and emits {@code null}
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh211773.aspx">MSDN: Observable.ToAsync</a> | [
"Convert",
"a",
"synchronous",
"action",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L461-L463 |
apache/groovy | subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java | SwingGroovyMethods.leftShift | public static MutableComboBoxModel leftShift(MutableComboBoxModel self, Object i) {
self.addElement(i);
return self;
} | java | public static MutableComboBoxModel leftShift(MutableComboBoxModel self, Object i) {
self.addElement(i);
return self;
} | [
"public",
"static",
"MutableComboBoxModel",
"leftShift",
"(",
"MutableComboBoxModel",
"self",
",",
"Object",
"i",
")",
"{",
"self",
".",
"addElement",
"(",
"i",
")",
";",
"return",
"self",
";",
"}"
] | Overloads the left shift operator to provide an easy way to add
items to a MutableComboBoxModel.
@param self a MutableComboBoxModel
@param i an item to be added to the model.
@return same model, after the value was added to it.
@since 1.6.4 | [
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"easy",
"way",
"to",
"add",
"items",
"to",
"a",
"MutableComboBoxModel",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L336-L339 |
adyliu/jafka | src/main/java/io/jafka/utils/Utils.java | Utils.writeShortString | public static void writeShortString(ByteBuffer buffer, String s) {
if (s == null) {
buffer.putShort((short) -1);
} else if (s.length() > Short.MAX_VALUE) {
throw new IllegalArgumentException("String exceeds the maximum size of " + Short.MAX_VALUE + ".");
} else {
byte[] data = getBytes(s); //topic support non-ascii character
buffer.putShort((short) data.length);
buffer.put(data);
}
} | java | public static void writeShortString(ByteBuffer buffer, String s) {
if (s == null) {
buffer.putShort((short) -1);
} else if (s.length() > Short.MAX_VALUE) {
throw new IllegalArgumentException("String exceeds the maximum size of " + Short.MAX_VALUE + ".");
} else {
byte[] data = getBytes(s); //topic support non-ascii character
buffer.putShort((short) data.length);
buffer.put(data);
}
} | [
"public",
"static",
"void",
"writeShortString",
"(",
"ByteBuffer",
"buffer",
",",
"String",
"s",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"buffer",
".",
"putShort",
"(",
"(",
"short",
")",
"-",
"1",
")",
";",
"}",
"else",
"if",
"(",
"s",
... | Write a size prefixed string where the size is stored as a 2 byte
short
@param buffer The buffer to write to
@param s The string to write | [
"Write",
"a",
"size",
"prefixed",
"string",
"where",
"the",
"size",
"is",
"stored",
"as",
"a",
"2",
"byte",
"short"
] | train | https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/utils/Utils.java#L205-L215 |
pressgang-ccms/PressGangCCMSContentSpecProcessor | src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java | ContentSpecProcessor.syncDuplicatedTopics | protected void syncDuplicatedTopics(final Map<ITopicNode, ITopicNode> duplicatedTopics) {
for (final Map.Entry<ITopicNode, ITopicNode> topicEntry : duplicatedTopics.entrySet()) {
final ITopicNode topic = topicEntry.getKey();
final ITopicNode cloneTopic = topicEntry.getValue();
// Set the id
topic.setId(cloneTopic.getDBId() == null ? null : cloneTopic.getDBId().toString());
}
} | java | protected void syncDuplicatedTopics(final Map<ITopicNode, ITopicNode> duplicatedTopics) {
for (final Map.Entry<ITopicNode, ITopicNode> topicEntry : duplicatedTopics.entrySet()) {
final ITopicNode topic = topicEntry.getKey();
final ITopicNode cloneTopic = topicEntry.getValue();
// Set the id
topic.setId(cloneTopic.getDBId() == null ? null : cloneTopic.getDBId().toString());
}
} | [
"protected",
"void",
"syncDuplicatedTopics",
"(",
"final",
"Map",
"<",
"ITopicNode",
",",
"ITopicNode",
">",
"duplicatedTopics",
")",
"{",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"ITopicNode",
",",
"ITopicNode",
">",
"topicEntry",
":",
"duplicatedTopics",... | Syncs all duplicated topics with their real topic counterpart in the content specification.
@param duplicatedTopics A Map of the all the duplicated topics in the Content Specification mapped to there bae topic. | [
"Syncs",
"all",
"duplicated",
"topics",
"with",
"their",
"real",
"topic",
"counterpart",
"in",
"the",
"content",
"specification",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java#L1028-L1036 |
Red5/red5-server-common | src/main/java/org/red5/server/so/SharedObject.java | SharedObject.sendMessage | protected void sendMessage(String handler, List<?> arguments) {
final SharedObjectEvent event = new SharedObjectEvent(Type.CLIENT_SEND_MESSAGE, handler, arguments);
if (ownerMessage.addEvent(event)) {
syncEvents.add(event);
sendStats.incrementAndGet();
if (log.isTraceEnabled()) {
log.trace("Send message: {}", arguments);
}
}
} | java | protected void sendMessage(String handler, List<?> arguments) {
final SharedObjectEvent event = new SharedObjectEvent(Type.CLIENT_SEND_MESSAGE, handler, arguments);
if (ownerMessage.addEvent(event)) {
syncEvents.add(event);
sendStats.incrementAndGet();
if (log.isTraceEnabled()) {
log.trace("Send message: {}", arguments);
}
}
} | [
"protected",
"void",
"sendMessage",
"(",
"String",
"handler",
",",
"List",
"<",
"?",
">",
"arguments",
")",
"{",
"final",
"SharedObjectEvent",
"event",
"=",
"new",
"SharedObjectEvent",
"(",
"Type",
".",
"CLIENT_SEND_MESSAGE",
",",
"handler",
",",
"arguments",
... | Broadcast event to event handler
@param handler
Event handler
@param arguments
Arguments | [
"Broadcast",
"event",
"to",
"event",
"handler"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/so/SharedObject.java#L516-L525 |
samskivert/pythagoras | src/main/java/pythagoras/f/Crossing.java | Crossing.intersectShape | public static int intersectShape (IShape s, float x, float y, float w, float h) {
if (!s.bounds().intersects(x, y, w, h)) {
return 0;
}
return intersectPath(s.pathIterator(null), x, y, w, h);
} | java | public static int intersectShape (IShape s, float x, float y, float w, float h) {
if (!s.bounds().intersects(x, y, w, h)) {
return 0;
}
return intersectPath(s.pathIterator(null), x, y, w, h);
} | [
"public",
"static",
"int",
"intersectShape",
"(",
"IShape",
"s",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"w",
",",
"float",
"h",
")",
"{",
"if",
"(",
"!",
"s",
".",
"bounds",
"(",
")",
".",
"intersects",
"(",
"x",
",",
"y",
",",
"w"... | Returns how many times rectangle stripe cross shape or the are intersect | [
"Returns",
"how",
"many",
"times",
"rectangle",
"stripe",
"cross",
"shape",
"or",
"the",
"are",
"intersect"
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Crossing.java#L761-L766 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java | DTMDocumentImpl.getNextPreceding | public int getNextPreceding(int axisContextHandle, int nodeHandle) {
// ###shs copied from Xalan 1, what is this suppose to do?
nodeHandle &= NODEHANDLE_MASK;
while (nodeHandle > 1) {
nodeHandle--;
if (ATTRIBUTE_NODE == (nodes.readEntry(nodeHandle, 0) & 0xFFFF))
continue;
// if nodeHandle is _not_ an ancestor of
// axisContextHandle, specialFind will return it.
// If it _is_ an ancestor, specialFind will return -1
// %REVIEW% unconditional return defeats the
// purpose of the while loop -- does this
// logic make any sense?
return (m_docHandle | nodes.specialFind(axisContextHandle, nodeHandle));
}
return NULL;
} | java | public int getNextPreceding(int axisContextHandle, int nodeHandle) {
// ###shs copied from Xalan 1, what is this suppose to do?
nodeHandle &= NODEHANDLE_MASK;
while (nodeHandle > 1) {
nodeHandle--;
if (ATTRIBUTE_NODE == (nodes.readEntry(nodeHandle, 0) & 0xFFFF))
continue;
// if nodeHandle is _not_ an ancestor of
// axisContextHandle, specialFind will return it.
// If it _is_ an ancestor, specialFind will return -1
// %REVIEW% unconditional return defeats the
// purpose of the while loop -- does this
// logic make any sense?
return (m_docHandle | nodes.specialFind(axisContextHandle, nodeHandle));
}
return NULL;
} | [
"public",
"int",
"getNextPreceding",
"(",
"int",
"axisContextHandle",
",",
"int",
"nodeHandle",
")",
"{",
"// ###shs copied from Xalan 1, what is this suppose to do?",
"nodeHandle",
"&=",
"NODEHANDLE_MASK",
";",
"while",
"(",
"nodeHandle",
">",
"1",
")",
"{",
"nodeHandl... | Given a node handle, advance to the next node on the preceding axis.
@param axisContextHandle the start of the axis that is being traversed.
@param nodeHandle the id of the node.
@return int Node-number of preceding sibling,
or DTM.NULL to indicate none exists. | [
"Given",
"a",
"node",
"handle",
"advance",
"to",
"the",
"next",
"node",
"on",
"the",
"preceding",
"axis",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L1322-L1341 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java | UnsignedNumeric.writeUnsignedLong | public static void writeUnsignedLong(ObjectOutput out, long i) throws IOException {
while ((i & ~0x7F) != 0) {
out.writeByte((byte) ((i & 0x7f) | 0x80));
i >>>= 7;
}
out.writeByte((byte) i);
} | java | public static void writeUnsignedLong(ObjectOutput out, long i) throws IOException {
while ((i & ~0x7F) != 0) {
out.writeByte((byte) ((i & 0x7f) | 0x80));
i >>>= 7;
}
out.writeByte((byte) i);
} | [
"public",
"static",
"void",
"writeUnsignedLong",
"(",
"ObjectOutput",
"out",
",",
"long",
"i",
")",
"throws",
"IOException",
"{",
"while",
"(",
"(",
"i",
"&",
"~",
"0x7F",
")",
"!=",
"0",
")",
"{",
"out",
".",
"writeByte",
"(",
"(",
"byte",
")",
"(",... | Writes a long in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes.
Negative numbers are not supported.
@param i int to write | [
"Writes",
"a",
"long",
"in",
"a",
"variable",
"-",
"length",
"format",
".",
"Writes",
"between",
"one",
"and",
"nine",
"bytes",
".",
"Smaller",
"values",
"take",
"fewer",
"bytes",
".",
"Negative",
"numbers",
"are",
"not",
"supported",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java#L129-L135 |
sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java | ImageUtils.setRGB | public static void setRGB( BufferedImage image, int x, int y, int width, int height, int[] pixels ) {
int type = image.getType();
if ( type == BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB )
image.getRaster().setDataElements( x, y, width, height, pixels );
else
image.setRGB( x, y, width, height, pixels, 0, width );
} | java | public static void setRGB( BufferedImage image, int x, int y, int width, int height, int[] pixels ) {
int type = image.getType();
if ( type == BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB )
image.getRaster().setDataElements( x, y, width, height, pixels );
else
image.setRGB( x, y, width, height, pixels, 0, width );
} | [
"public",
"static",
"void",
"setRGB",
"(",
"BufferedImage",
"image",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
",",
"int",
"[",
"]",
"pixels",
")",
"{",
"int",
"type",
"=",
"image",
".",
"getType",
"(",
")",
";",
... | A convenience method for setting ARGB pixels in an image. This tries to avoid the performance
penalty of BufferedImage.setRGB unmanaging the image.
@param image a BufferedImage object
@param x the left edge of the pixel block
@param y the right edge of the pixel block
@param width the width of the pixel arry
@param height the height of the pixel arry
@param pixels the array of pixels to set
@see #getRGB | [
"A",
"convenience",
"method",
"for",
"setting",
"ARGB",
"pixels",
"in",
"an",
"image",
".",
"This",
"tries",
"to",
"avoid",
"the",
"performance",
"penalty",
"of",
"BufferedImage",
".",
"setRGB",
"unmanaging",
"the",
"image",
"."
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L279-L285 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicated_server_serviceName_staticIP_duration_POST | public OvhOrder dedicated_server_serviceName_staticIP_duration_POST(String serviceName, String duration, OvhIpStaticCountryEnum country) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/staticIP/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "country", country);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder dedicated_server_serviceName_staticIP_duration_POST(String serviceName, String duration, OvhIpStaticCountryEnum country) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/staticIP/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "country", country);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"dedicated_server_serviceName_staticIP_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"OvhIpStaticCountryEnum",
"country",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/dedicated/server/{serviceName}/st... | Create order
REST: POST /order/dedicated/server/{serviceName}/staticIP/{duration}
@param country [required] Ip localization
@param serviceName [required] The internal name of your dedicated server
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2306-L2313 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_subServices_domain_GET | public net.minidev.ovh.api.pack.xdsl.OvhService packName_subServices_domain_GET(String packName, String domain) throws IOException {
String qPath = "/pack/xdsl/{packName}/subServices/{domain}";
StringBuilder sb = path(qPath, packName, domain);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, net.minidev.ovh.api.pack.xdsl.OvhService.class);
} | java | public net.minidev.ovh.api.pack.xdsl.OvhService packName_subServices_domain_GET(String packName, String domain) throws IOException {
String qPath = "/pack/xdsl/{packName}/subServices/{domain}";
StringBuilder sb = path(qPath, packName, domain);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, net.minidev.ovh.api.pack.xdsl.OvhService.class);
} | [
"public",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"pack",
".",
"xdsl",
".",
"OvhService",
"packName_subServices_domain_GET",
"(",
"String",
"packName",
",",
"String",
"domain",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xds... | Get this object properties
REST: GET /pack/xdsl/{packName}/subServices/{domain}
@param packName [required] The internal name of your pack
@param domain [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L702-L707 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java | DomHelper.doSetController | protected void doSetController(Element element, GraphicsController controller, int eventMask) {
if (element != null) {
Dom.setEventListener(element, new EventListenerHelper(element, controller, eventMask));
Dom.sinkEvents(element, eventMask);
}
} | java | protected void doSetController(Element element, GraphicsController controller, int eventMask) {
if (element != null) {
Dom.setEventListener(element, new EventListenerHelper(element, controller, eventMask));
Dom.sinkEvents(element, eventMask);
}
} | [
"protected",
"void",
"doSetController",
"(",
"Element",
"element",
",",
"GraphicsController",
"controller",
",",
"int",
"eventMask",
")",
"{",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"Dom",
".",
"setEventListener",
"(",
"element",
",",
"new",
"EventListe... | Set the controller on an element of this <code>GraphicsContext</code> so it can react to events.
@param element
the element on which the controller should be set
@param controller
The new <code>GraphicsController</code>
@param eventMask
a bitmask to specify which events to listen for {@link com.google.gwt.user.client.Event} | [
"Set",
"the",
"controller",
"on",
"an",
"element",
"of",
"this",
"<code",
">",
"GraphicsContext<",
"/",
"code",
">",
"so",
"it",
"can",
"react",
"to",
"events",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L613-L618 |
dwdyer/reportng | reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java | HTMLReporter.generateReport | public void generateReport(List<XmlSuite> xmlSuites,
List<ISuite> suites,
String outputDirectoryName)
{
removeEmptyDirectories(new File(outputDirectoryName));
boolean useFrames = System.getProperty(FRAMES_PROPERTY, "true").equals("true");
boolean onlyFailures = System.getProperty(ONLY_FAILURES_PROPERTY, "false").equals("true");
File outputDirectory = new File(outputDirectoryName, REPORT_DIRECTORY);
outputDirectory.mkdirs();
try
{
if (useFrames)
{
createFrameset(outputDirectory);
}
createOverview(suites, outputDirectory, !useFrames, onlyFailures);
createSuiteList(suites, outputDirectory, onlyFailures);
createGroups(suites, outputDirectory);
createResults(suites, outputDirectory, onlyFailures);
createLog(outputDirectory, onlyFailures);
copyResources(outputDirectory);
}
catch (Exception ex)
{
throw new ReportNGException("Failed generating HTML report.", ex);
}
} | java | public void generateReport(List<XmlSuite> xmlSuites,
List<ISuite> suites,
String outputDirectoryName)
{
removeEmptyDirectories(new File(outputDirectoryName));
boolean useFrames = System.getProperty(FRAMES_PROPERTY, "true").equals("true");
boolean onlyFailures = System.getProperty(ONLY_FAILURES_PROPERTY, "false").equals("true");
File outputDirectory = new File(outputDirectoryName, REPORT_DIRECTORY);
outputDirectory.mkdirs();
try
{
if (useFrames)
{
createFrameset(outputDirectory);
}
createOverview(suites, outputDirectory, !useFrames, onlyFailures);
createSuiteList(suites, outputDirectory, onlyFailures);
createGroups(suites, outputDirectory);
createResults(suites, outputDirectory, onlyFailures);
createLog(outputDirectory, onlyFailures);
copyResources(outputDirectory);
}
catch (Exception ex)
{
throw new ReportNGException("Failed generating HTML report.", ex);
}
} | [
"public",
"void",
"generateReport",
"(",
"List",
"<",
"XmlSuite",
">",
"xmlSuites",
",",
"List",
"<",
"ISuite",
">",
"suites",
",",
"String",
"outputDirectoryName",
")",
"{",
"removeEmptyDirectories",
"(",
"new",
"File",
"(",
"outputDirectoryName",
")",
")",
"... | Generates a set of HTML files that contain data about the outcome of
the specified test suites.
@param suites Data about the test runs.
@param outputDirectoryName The directory in which to create the report. | [
"Generates",
"a",
"set",
"of",
"HTML",
"files",
"that",
"contain",
"data",
"about",
"the",
"outcome",
"of",
"the",
"specified",
"test",
"suites",
"."
] | train | https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java#L90-L119 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.generateMFAToken | public MFAToken generateMFAToken(long userId,Integer expiresIn) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return generateMFAToken(userId, expiresIn, false);
} | java | public MFAToken generateMFAToken(long userId,Integer expiresIn) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return generateMFAToken(userId, expiresIn, false);
} | [
"public",
"MFAToken",
"generateMFAToken",
"(",
"long",
"userId",
",",
"Integer",
"expiresIn",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
"URISyntaxException",
"{",
"return",
"generateMFAToken",
"(",
"userId",
",",
"expiresIn",
",",
"fals... | Generates an access token for a user
@param userId
Id of the user
@param expiresIn
Set the duration of the token in seconds. (default: 259200 seconds = 72h)
72 hours is the max value.
@return Created MFAToken
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/multi-factor-authentication/generate-mfa-token">Generate MFA Token documentation</a> | [
"Generates",
"an",
"access",
"token",
"for",
"a",
"user"
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L777-L779 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/graph/GraphBuilder.java | GraphBuilder.buildNode | public final Node buildNode(Object entity, PersistenceDelegator pd, Object entityId, NodeState nodeState)
{
String nodeId = ObjectGraphUtils.getNodeId(entityId, entity.getClass());
Node node = this.graph.getNode(nodeId);
// If this node is already there in graph (may happen for bidirectional
// relationship, do nothing and return null)
// return node in case has already been traversed.
if (node != null)
{
if (this.generator.traversedNodes.contains(node))
{
return node;
}
return null;
}
node = new NodeBuilder().assignState(nodeState).buildNode(entity, pd, entityId, nodeId).node;
this.graph.addNode(node.getNodeId(), node);
return node;
} | java | public final Node buildNode(Object entity, PersistenceDelegator pd, Object entityId, NodeState nodeState)
{
String nodeId = ObjectGraphUtils.getNodeId(entityId, entity.getClass());
Node node = this.graph.getNode(nodeId);
// If this node is already there in graph (may happen for bidirectional
// relationship, do nothing and return null)
// return node in case has already been traversed.
if (node != null)
{
if (this.generator.traversedNodes.contains(node))
{
return node;
}
return null;
}
node = new NodeBuilder().assignState(nodeState).buildNode(entity, pd, entityId, nodeId).node;
this.graph.addNode(node.getNodeId(), node);
return node;
} | [
"public",
"final",
"Node",
"buildNode",
"(",
"Object",
"entity",
",",
"PersistenceDelegator",
"pd",
",",
"Object",
"entityId",
",",
"NodeState",
"nodeState",
")",
"{",
"String",
"nodeId",
"=",
"ObjectGraphUtils",
".",
"getNodeId",
"(",
"entityId",
",",
"entity",... | On build node.
@param entity
entity
@param pc
persistence cache
@param entityId
entity id
@return added node. | [
"On",
"build",
"node",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/graph/GraphBuilder.java#L80-L104 |
BlueBrain/bluima | modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/grobid/diff_match_patch.java | diff_match_patch.patch_addContext | protected void patch_addContext(Patch patch, String text) {
if (text.length() == 0) {
return;
}
String pattern = text.substring(patch.start2, patch.start2
+ patch.length1);
int padding = 0;
// Look for the first and last matches of pattern in text. If two
// different
// matches are found, increase the pattern length.
while (text.indexOf(pattern) != text.lastIndexOf(pattern)
&& pattern.length() < Match_MaxBits - Patch_Margin
- Patch_Margin) {
padding += Patch_Margin;
pattern = text.substring(
Math.max(0, patch.start2 - padding),
Math.min(text.length(), patch.start2 + patch.length1
+ padding));
}
// Add one chunk for good luck.
padding += Patch_Margin;
// Add the prefix.
String prefix = text.substring(Math.max(0, patch.start2 - padding),
patch.start2);
if (prefix.length() != 0) {
patch.diffs.addFirst(new Diff(Operation.EQUAL, prefix));
}
// Add the suffix.
String suffix = text
.substring(
patch.start2 + patch.length1,
Math.min(text.length(), patch.start2 + patch.length1
+ padding));
if (suffix.length() != 0) {
patch.diffs.addLast(new Diff(Operation.EQUAL, suffix));
}
// Roll back the start points.
patch.start1 -= prefix.length();
patch.start2 -= prefix.length();
// Extend the lengths.
patch.length1 += prefix.length() + suffix.length();
patch.length2 += prefix.length() + suffix.length();
} | java | protected void patch_addContext(Patch patch, String text) {
if (text.length() == 0) {
return;
}
String pattern = text.substring(patch.start2, patch.start2
+ patch.length1);
int padding = 0;
// Look for the first and last matches of pattern in text. If two
// different
// matches are found, increase the pattern length.
while (text.indexOf(pattern) != text.lastIndexOf(pattern)
&& pattern.length() < Match_MaxBits - Patch_Margin
- Patch_Margin) {
padding += Patch_Margin;
pattern = text.substring(
Math.max(0, patch.start2 - padding),
Math.min(text.length(), patch.start2 + patch.length1
+ padding));
}
// Add one chunk for good luck.
padding += Patch_Margin;
// Add the prefix.
String prefix = text.substring(Math.max(0, patch.start2 - padding),
patch.start2);
if (prefix.length() != 0) {
patch.diffs.addFirst(new Diff(Operation.EQUAL, prefix));
}
// Add the suffix.
String suffix = text
.substring(
patch.start2 + patch.length1,
Math.min(text.length(), patch.start2 + patch.length1
+ padding));
if (suffix.length() != 0) {
patch.diffs.addLast(new Diff(Operation.EQUAL, suffix));
}
// Roll back the start points.
patch.start1 -= prefix.length();
patch.start2 -= prefix.length();
// Extend the lengths.
patch.length1 += prefix.length() + suffix.length();
patch.length2 += prefix.length() + suffix.length();
} | [
"protected",
"void",
"patch_addContext",
"(",
"Patch",
"patch",
",",
"String",
"text",
")",
"{",
"if",
"(",
"text",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"String",
"pattern",
"=",
"text",
".",
"substring",
"(",
"patch",
".... | Increase the context until it is unique, but don't let the pattern expand
beyond Match_MaxBits.
@param patch
The patch to grow.
@param text
Source text. | [
"Increase",
"the",
"context",
"until",
"it",
"is",
"unique",
"but",
"don",
"t",
"let",
"the",
"pattern",
"expand",
"beyond",
"Match_MaxBits",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/grobid/diff_match_patch.java#L1875-L1920 |
wanglinsong/thx-webservice | src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java | WebServiceCommunication.newInstance | public static WebServiceCommunication newInstance() throws Exception {
SystemConfiguration sysConfig = SystemConfiguration.getInstance();
String host = sysConfig.getProperty(WebServiceCommunication.SYSPROP_HOST, "localhost");
int port = sysConfig.getIntProperty(WebServiceCommunication.SYSPROP_PORT, 443);
WebServiceCommunication wsc = new WebServiceCommunication(host, port);
String user = sysConfig.getProperty(WebServiceCommunication.SYSPROP_USER);
String pass = sysConfig.getProperty(WebServiceCommunication.SYSPROP_PASS);
if (null != user && null != pass) {
wsc.setBasicUsernamePassword(user, pass);
}
String clientCert = sysConfig.getProperty(WebServiceCommunication.SYSPROP_CLIENT_CERT);
String clientCertPass = sysConfig.getProperty(WebServiceCommunication.SYSPROP_CLIENT_CERT_PASS);
if (null != clientCert && null != clientCertPass) {
wsc.setClientCertificate(clientCert, clientCertPass);
}
wsc.connect();
return wsc;
} | java | public static WebServiceCommunication newInstance() throws Exception {
SystemConfiguration sysConfig = SystemConfiguration.getInstance();
String host = sysConfig.getProperty(WebServiceCommunication.SYSPROP_HOST, "localhost");
int port = sysConfig.getIntProperty(WebServiceCommunication.SYSPROP_PORT, 443);
WebServiceCommunication wsc = new WebServiceCommunication(host, port);
String user = sysConfig.getProperty(WebServiceCommunication.SYSPROP_USER);
String pass = sysConfig.getProperty(WebServiceCommunication.SYSPROP_PASS);
if (null != user && null != pass) {
wsc.setBasicUsernamePassword(user, pass);
}
String clientCert = sysConfig.getProperty(WebServiceCommunication.SYSPROP_CLIENT_CERT);
String clientCertPass = sysConfig.getProperty(WebServiceCommunication.SYSPROP_CLIENT_CERT_PASS);
if (null != clientCert && null != clientCertPass) {
wsc.setClientCertificate(clientCert, clientCertPass);
}
wsc.connect();
return wsc;
} | [
"public",
"static",
"WebServiceCommunication",
"newInstance",
"(",
")",
"throws",
"Exception",
"{",
"SystemConfiguration",
"sysConfig",
"=",
"SystemConfiguration",
".",
"getInstance",
"(",
")",
";",
"String",
"host",
"=",
"sysConfig",
".",
"getProperty",
"(",
"WebSe... | Needs system properties.
<ul>
<li>qa.th.comm.ws.HOST, default to localhost if not set</li>
<li>qa.th.comm.ws.PORT, default to 443 if not set</li>
<li>qa.th.comm.ws.USER, no default</li>
<li>qa.th.comm.ws.PASS, no default</li>
<li>qa.th.comm.ws.CLIENT_CERT, no default</li>
<li>qa.th.comm.ws.CLIENT_CERT_PASS, no default</li>
</ul>
@return an instance of communication
@throws Exception if having problem connecting to the service | [
"Needs",
"system",
"properties",
".",
"<ul",
">",
"<li",
">",
"qa",
".",
"th",
".",
"comm",
".",
"ws",
".",
"HOST",
"default",
"to",
"localhost",
"if",
"not",
"set<",
"/",
"li",
">",
"<li",
">",
"qa",
".",
"th",
".",
"comm",
".",
"ws",
".",
"PO... | train | https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java#L249-L269 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderParser.java | GenericGenbankHeaderParser.parseHeader | @Override
public void parseHeader(String header, S sequence) {
sequence.setOriginalHeader(header);
sequence.setAccession(new AccessionID(accession, DataSource.GENBANK, version, identifier));
sequence.setDescription(description);
sequence.setComments(comments);
sequence.setReferences(references);
} | java | @Override
public void parseHeader(String header, S sequence) {
sequence.setOriginalHeader(header);
sequence.setAccession(new AccessionID(accession, DataSource.GENBANK, version, identifier));
sequence.setDescription(description);
sequence.setComments(comments);
sequence.setReferences(references);
} | [
"@",
"Override",
"public",
"void",
"parseHeader",
"(",
"String",
"header",
",",
"S",
"sequence",
")",
"{",
"sequence",
".",
"setOriginalHeader",
"(",
"header",
")",
";",
"sequence",
".",
"setAccession",
"(",
"new",
"AccessionID",
"(",
"accession",
",",
"Data... | Parse the header and set the values in the sequence
@param header
@param sequence | [
"Parse",
"the",
"header",
"and",
"set",
"the",
"values",
"in",
"the",
"sequence"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderParser.java#L54-L61 |
duracloud/duracloud | snapshotstorageprovider/src/main/java/org/duracloud/snapshottask/snapshot/CreateSnapshotTaskRunner.java | CreateSnapshotTaskRunner.buildSnapshotProps | protected String buildSnapshotProps(Map<String, String> props) {
Properties snapshotProperties = new Properties();
for (String key : props.keySet()) {
snapshotProperties.setProperty(key, props.get(key));
}
StringWriter writer = new StringWriter();
try {
snapshotProperties.store(writer, null);
} catch (IOException e) {
throw new TaskException("Could not write snapshot properties: " +
e.getMessage(), e);
}
writer.flush();
return writer.toString();
} | java | protected String buildSnapshotProps(Map<String, String> props) {
Properties snapshotProperties = new Properties();
for (String key : props.keySet()) {
snapshotProperties.setProperty(key, props.get(key));
}
StringWriter writer = new StringWriter();
try {
snapshotProperties.store(writer, null);
} catch (IOException e) {
throw new TaskException("Could not write snapshot properties: " +
e.getMessage(), e);
}
writer.flush();
return writer.toString();
} | [
"protected",
"String",
"buildSnapshotProps",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"props",
")",
"{",
"Properties",
"snapshotProperties",
"=",
"new",
"Properties",
"(",
")",
";",
"for",
"(",
"String",
"key",
":",
"props",
".",
"keySet",
"(",
")",
... | Constructs the contents of a properties file given a set of
key/value pairs
@param props snapshot properties
@return Properties-file formatted key/value pairs | [
"Constructs",
"the",
"contents",
"of",
"a",
"properties",
"file",
"given",
"a",
"set",
"of",
"key",
"/",
"value",
"pairs"
] | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/snapshotstorageprovider/src/main/java/org/duracloud/snapshottask/snapshot/CreateSnapshotTaskRunner.java#L210-L225 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java | IntegrationAccountsInner.regenerateAccessKeyAsync | public Observable<IntegrationAccountInner> regenerateAccessKeyAsync(String resourceGroupName, String integrationAccountName, KeyType keyType) {
return regenerateAccessKeyWithServiceResponseAsync(resourceGroupName, integrationAccountName, keyType).map(new Func1<ServiceResponse<IntegrationAccountInner>, IntegrationAccountInner>() {
@Override
public IntegrationAccountInner call(ServiceResponse<IntegrationAccountInner> response) {
return response.body();
}
});
} | java | public Observable<IntegrationAccountInner> regenerateAccessKeyAsync(String resourceGroupName, String integrationAccountName, KeyType keyType) {
return regenerateAccessKeyWithServiceResponseAsync(resourceGroupName, integrationAccountName, keyType).map(new Func1<ServiceResponse<IntegrationAccountInner>, IntegrationAccountInner>() {
@Override
public IntegrationAccountInner call(ServiceResponse<IntegrationAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"IntegrationAccountInner",
">",
"regenerateAccessKeyAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
",",
"KeyType",
"keyType",
")",
"{",
"return",
"regenerateAccessKeyWithServiceResponseAsync",
"(",
"resourceGr... | Regenerates the integration account access key.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param keyType The key type. Possible values include: 'NotSpecified', 'Primary', 'Secondary'
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the IntegrationAccountInner object | [
"Regenerates",
"the",
"integration",
"account",
"access",
"key",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java#L1333-L1340 |
wigforss/Ka-Commons-Reflection | src/main/java/org/kasource/commons/reflection/util/ClassUtils.java | ClassUtils.loadClass | @SuppressWarnings("unchecked")
public static <T> Class<? extends T> loadClass(String className, Class<T> ofType) {
try {
Class<?> clazz = Class.forName(className);
if(ofType == null || ! ofType.isAssignableFrom(clazz)) {
throw new IllegalArgumentException("Class " + className + " must extend or implement " + ofType + "!");
}
return (Class<? extends T>) clazz;
}catch (ClassNotFoundException cnfe) {
throw new IllegalArgumentException("Class " + className + " could not be found!", cnfe);
}
} | java | @SuppressWarnings("unchecked")
public static <T> Class<? extends T> loadClass(String className, Class<T> ofType) {
try {
Class<?> clazz = Class.forName(className);
if(ofType == null || ! ofType.isAssignableFrom(clazz)) {
throw new IllegalArgumentException("Class " + className + " must extend or implement " + ofType + "!");
}
return (Class<? extends T>) clazz;
}catch (ClassNotFoundException cnfe) {
throw new IllegalArgumentException("Class " + className + " could not be found!", cnfe);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Class",
"<",
"?",
"extends",
"T",
">",
"loadClass",
"(",
"String",
"className",
",",
"Class",
"<",
"T",
">",
"ofType",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">... | Loads and returns the class named className of type superClass.
@param <T> Type of the class
@param className Name of the class to load
@param superClass Type of the class to load
@return The loaded class of type superClass.
@throws IllegalArgumentException if the class with className could not be loaded or
if the that class does not extend the class supplied in the superClass parameter. | [
"Loads",
"and",
"returns",
"the",
"class",
"named",
"className",
"of",
"type",
"superClass",
"."
] | train | https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/ClassUtils.java#L123-L135 |
finnyb/javampd | src/main/java/org/bff/javampd/admin/MPDAdmin.java | MPDAdmin.fireMPDChangeEvent | protected synchronized void fireMPDChangeEvent(MPDChangeEvent.Event event) {
MPDChangeEvent mce = new MPDChangeEvent(this, event);
for (MPDChangeListener mcl : listeners) {
mcl.mpdChanged(mce);
}
} | java | protected synchronized void fireMPDChangeEvent(MPDChangeEvent.Event event) {
MPDChangeEvent mce = new MPDChangeEvent(this, event);
for (MPDChangeListener mcl : listeners) {
mcl.mpdChanged(mce);
}
} | [
"protected",
"synchronized",
"void",
"fireMPDChangeEvent",
"(",
"MPDChangeEvent",
".",
"Event",
"event",
")",
"{",
"MPDChangeEvent",
"mce",
"=",
"new",
"MPDChangeEvent",
"(",
"this",
",",
"event",
")",
";",
"for",
"(",
"MPDChangeListener",
"mcl",
":",
"listeners... | Sends the appropriate {@link MPDChangeEvent} to all registered
{@link MPDChangeListener}s.
@param event the {@link MPDChangeEvent.Event} to send | [
"Sends",
"the",
"appropriate",
"{",
"@link",
"MPDChangeEvent",
"}",
"to",
"all",
"registered",
"{",
"@link",
"MPDChangeListener",
"}",
"s",
"."
] | train | https://github.com/finnyb/javampd/blob/186736e85fc238b4208cc9ee23373f9249376b4c/src/main/java/org/bff/javampd/admin/MPDAdmin.java#L120-L126 |
javamelody/javamelody | javamelody-core/src/main/java/net/bull/javamelody/internal/common/I18N.java | I18N.getFormattedString | public static String getFormattedString(String key, Object... arguments) {
// échappement des quotes qui sont des caractères spéciaux pour MessageFormat
final String string = getString(key).replace("'", "''");
return new MessageFormat(string, getCurrentLocale()).format(arguments);
} | java | public static String getFormattedString(String key, Object... arguments) {
// échappement des quotes qui sont des caractères spéciaux pour MessageFormat
final String string = getString(key).replace("'", "''");
return new MessageFormat(string, getCurrentLocale()).format(arguments);
} | [
"public",
"static",
"String",
"getFormattedString",
"(",
"String",
"key",
",",
"Object",
"...",
"arguments",
")",
"{",
"// échappement des quotes qui sont des caractères spéciaux pour MessageFormat\r",
"final",
"String",
"string",
"=",
"getString",
"(",
"key",
")",
".",
... | Retourne une traduction dans la locale courante et insère les arguments aux positions {i}.
@param key clé d'un libellé dans les fichiers de traduction
@param arguments Valeur à inclure dans le résultat
@return String | [
"Retourne",
"une",
"traduction",
"dans",
"la",
"locale",
"courante",
"et",
"insère",
"les",
"arguments",
"aux",
"positions",
"{",
"i",
"}",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/internal/common/I18N.java#L130-L134 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/StatementManager.java | StatementManager.getGenericStatement | public Statement getGenericStatement(ClassDescriptor cds, boolean scrollable) throws PersistenceBrokerException
{
try
{
return cds.getStatementsForClass(m_conMan).getGenericStmt(m_conMan.getConnection(), scrollable);
}
catch (LookupException e)
{
throw new PersistenceBrokerException("Used ConnectionManager instance could not obtain a connection", e);
}
} | java | public Statement getGenericStatement(ClassDescriptor cds, boolean scrollable) throws PersistenceBrokerException
{
try
{
return cds.getStatementsForClass(m_conMan).getGenericStmt(m_conMan.getConnection(), scrollable);
}
catch (LookupException e)
{
throw new PersistenceBrokerException("Used ConnectionManager instance could not obtain a connection", e);
}
} | [
"public",
"Statement",
"getGenericStatement",
"(",
"ClassDescriptor",
"cds",
",",
"boolean",
"scrollable",
")",
"throws",
"PersistenceBrokerException",
"{",
"try",
"{",
"return",
"cds",
".",
"getStatementsForClass",
"(",
"m_conMan",
")",
".",
"getGenericStmt",
"(",
... | return a generic Statement for the given ClassDescriptor.
Never use this method for UPDATE/INSERT/DELETE if you want to use the batch mode. | [
"return",
"a",
"generic",
"Statement",
"for",
"the",
"given",
"ClassDescriptor",
".",
"Never",
"use",
"this",
"method",
"for",
"UPDATE",
"/",
"INSERT",
"/",
"DELETE",
"if",
"you",
"want",
"to",
"use",
"the",
"batch",
"mode",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java#L569-L579 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/AbstractJPAProviderIntegration.java | AbstractJPAProviderIntegration.logProviderInfo | @FFDCIgnore(Exception.class)
private void logProviderInfo(String providerName, ClassLoader loader) {
try {
if (PROVIDER_ECLIPSELINK.equals(providerName)) {
// org.eclipse.persistence.Version.getVersion(): 2.6.4.v20160829-44060b6
Class<?> Version = loadClass(loader, "org.eclipse.persistence.Version");
String version = (String) Version.getMethod("getVersionString").invoke(Version.newInstance());
Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "EclipseLink", version);
} else if (PROVIDER_HIBERNATE.equals(providerName)) {
// org.hibernate.Version.getVersionString(): 5.2.6.Final
Class<?> Version = loadClass(loader, "org.hibernate.Version");
String version = (String) Version.getMethod("getVersionString").invoke(null);
Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "Hibernate", version);
} else if (PROVIDER_OPENJPA.equals(providerName)) {
// OpenJPAVersion.appendOpenJPABanner(sb): OpenJPA #.#.#\n version id: openjpa-#.#.#-r# \n Apache svn revision: #
StringBuilder version = new StringBuilder();
Class<?> OpenJPAVersion = loadClass(loader, "org.apache.openjpa.conf.OpenJPAVersion");
OpenJPAVersion.getMethod("appendOpenJPABanner", StringBuilder.class).invoke(OpenJPAVersion.newInstance(), version);
Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "OpenJPA", version);
} else {
Tr.info(tc, "JPA_THIRD_PARTY_PROV_NAME_CWWJP0052I", providerName);
}
} catch (Exception x) {
Tr.info(tc, "JPA_THIRD_PARTY_PROV_NAME_CWWJP0052I", providerName);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "unable to determine provider info", x);
}
} | java | @FFDCIgnore(Exception.class)
private void logProviderInfo(String providerName, ClassLoader loader) {
try {
if (PROVIDER_ECLIPSELINK.equals(providerName)) {
// org.eclipse.persistence.Version.getVersion(): 2.6.4.v20160829-44060b6
Class<?> Version = loadClass(loader, "org.eclipse.persistence.Version");
String version = (String) Version.getMethod("getVersionString").invoke(Version.newInstance());
Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "EclipseLink", version);
} else if (PROVIDER_HIBERNATE.equals(providerName)) {
// org.hibernate.Version.getVersionString(): 5.2.6.Final
Class<?> Version = loadClass(loader, "org.hibernate.Version");
String version = (String) Version.getMethod("getVersionString").invoke(null);
Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "Hibernate", version);
} else if (PROVIDER_OPENJPA.equals(providerName)) {
// OpenJPAVersion.appendOpenJPABanner(sb): OpenJPA #.#.#\n version id: openjpa-#.#.#-r# \n Apache svn revision: #
StringBuilder version = new StringBuilder();
Class<?> OpenJPAVersion = loadClass(loader, "org.apache.openjpa.conf.OpenJPAVersion");
OpenJPAVersion.getMethod("appendOpenJPABanner", StringBuilder.class).invoke(OpenJPAVersion.newInstance(), version);
Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "OpenJPA", version);
} else {
Tr.info(tc, "JPA_THIRD_PARTY_PROV_NAME_CWWJP0052I", providerName);
}
} catch (Exception x) {
Tr.info(tc, "JPA_THIRD_PARTY_PROV_NAME_CWWJP0052I", providerName);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "unable to determine provider info", x);
}
} | [
"@",
"FFDCIgnore",
"(",
"Exception",
".",
"class",
")",
"private",
"void",
"logProviderInfo",
"(",
"String",
"providerName",
",",
"ClassLoader",
"loader",
")",
"{",
"try",
"{",
"if",
"(",
"PROVIDER_ECLIPSELINK",
".",
"equals",
"(",
"providerName",
")",
")",
... | Log version information about the specified persistence provider, if it can be determined.
@param providerName fully qualified class name of JPA persistence provider
@param loader class loader with access to the JPA provider classes | [
"Log",
"version",
"information",
"about",
"the",
"specified",
"persistence",
"provider",
"if",
"it",
"can",
"be",
"determined",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/AbstractJPAProviderIntegration.java#L68-L95 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/listener/ExternalEventHandlerBase.java | ExternalEventHandlerBase.createResponseMessage | protected String createResponseMessage(Exception e, String request, Object msgdoc, Map<String,String> metaInfo) {
ListenerHelper helper = new ListenerHelper();
if (e instanceof ServiceException)
return helper.createErrorResponse(request, metaInfo, (ServiceException)e).getContent();
else if (e != null)
return helper.createErrorResponse(request, metaInfo, new ServiceException(ServiceException.INTERNAL_ERROR, e.getMessage())).getContent();
else
return helper.createAckResponse(request, metaInfo);
} | java | protected String createResponseMessage(Exception e, String request, Object msgdoc, Map<String,String> metaInfo) {
ListenerHelper helper = new ListenerHelper();
if (e instanceof ServiceException)
return helper.createErrorResponse(request, metaInfo, (ServiceException)e).getContent();
else if (e != null)
return helper.createErrorResponse(request, metaInfo, new ServiceException(ServiceException.INTERNAL_ERROR, e.getMessage())).getContent();
else
return helper.createAckResponse(request, metaInfo);
} | [
"protected",
"String",
"createResponseMessage",
"(",
"Exception",
"e",
",",
"String",
"request",
",",
"Object",
"msgdoc",
",",
"Map",
"<",
"String",
",",
"String",
">",
"metaInfo",
")",
"{",
"ListenerHelper",
"helper",
"=",
"new",
"ListenerHelper",
"(",
")",
... | This method is used to create an MDW default response message. Such
a message is only used when an exception occurred before customizable
code is reached (e.g. the external message is malformed so we cannot
determine which handler to call), or a simple acknowledgment is sufficient.
@param e The exception that triggers the response message. This should be null
if the message is for simple acknowledgment rather than for reporting an
exception
@param request request String
@param msgdoc parsed object such XML Bean and JSON object if it is possible to parse the external message
@param metaInfo protocol headers
@return | [
"This",
"method",
"is",
"used",
"to",
"create",
"an",
"MDW",
"default",
"response",
"message",
".",
"Such",
"a",
"message",
"is",
"only",
"used",
"when",
"an",
"exception",
"occurred",
"before",
"customizable",
"code",
"is",
"reached",
"(",
"e",
".",
"g",
... | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/listener/ExternalEventHandlerBase.java#L223-L231 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java | AbstractPlainSocketImpl.doConnect | synchronized void doConnect(InetAddress address, int port, int timeout) throws IOException {
synchronized (fdLock) {
if (!closePending && (socket == null || !socket.isBound())) {
NetHooks.beforeTcpConnect(fd, address, port);
}
}
try {
BlockGuard.getThreadPolicy().onNetwork();
socketConnect(address, port, timeout);
/* socket may have been closed during poll/select */
synchronized (fdLock) {
if (closePending) {
throw new SocketException ("Socket closed");
}
}
// If we have a ref. to the Socket, then sets the flags
// created, bound & connected to true.
// This is normally done in Socket.connect() but some
// subclasses of Socket may call impl.connect() directly!
if (socket != null) {
socket.setBound();
socket.setConnected();
}
} catch (IOException e) {
close();
throw e;
}
} | java | synchronized void doConnect(InetAddress address, int port, int timeout) throws IOException {
synchronized (fdLock) {
if (!closePending && (socket == null || !socket.isBound())) {
NetHooks.beforeTcpConnect(fd, address, port);
}
}
try {
BlockGuard.getThreadPolicy().onNetwork();
socketConnect(address, port, timeout);
/* socket may have been closed during poll/select */
synchronized (fdLock) {
if (closePending) {
throw new SocketException ("Socket closed");
}
}
// If we have a ref. to the Socket, then sets the flags
// created, bound & connected to true.
// This is normally done in Socket.connect() but some
// subclasses of Socket may call impl.connect() directly!
if (socket != null) {
socket.setBound();
socket.setConnected();
}
} catch (IOException e) {
close();
throw e;
}
} | [
"synchronized",
"void",
"doConnect",
"(",
"InetAddress",
"address",
",",
"int",
"port",
",",
"int",
"timeout",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"fdLock",
")",
"{",
"if",
"(",
"!",
"closePending",
"&&",
"(",
"socket",
"==",
"null",
"|... | The workhorse of the connection operation. Tries several times to
establish a connection to the given <host, port>. If unsuccessful,
throws an IOException indicating what went wrong. | [
"The",
"workhorse",
"of",
"the",
"connection",
"operation",
".",
"Tries",
"several",
"times",
"to",
"establish",
"a",
"connection",
"to",
"the",
"given",
"<host",
"port",
">",
".",
"If",
"unsuccessful",
"throws",
"an",
"IOException",
"indicating",
"what",
"wen... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java#L329-L356 |
allengeorge/libraft | libraft-agent/src/main/java/io/libraft/agent/rpc/Handshakers.java | Handshakers.createHandshakeMessage | static ChannelBuffer createHandshakeMessage(String serverId, ObjectMapper mapper) throws JsonProcessingException {
return ChannelBuffers.wrappedBuffer(mapper.writeValueAsBytes(new Handshake(serverId)));
} | java | static ChannelBuffer createHandshakeMessage(String serverId, ObjectMapper mapper) throws JsonProcessingException {
return ChannelBuffers.wrappedBuffer(mapper.writeValueAsBytes(new Handshake(serverId)));
} | [
"static",
"ChannelBuffer",
"createHandshakeMessage",
"(",
"String",
"serverId",
",",
"ObjectMapper",
"mapper",
")",
"throws",
"JsonProcessingException",
"{",
"return",
"ChannelBuffers",
".",
"wrappedBuffer",
"(",
"mapper",
".",
"writeValueAsBytes",
"(",
"new",
"Handshak... | Create a {@code RaftNetworkClient} handshake message.
@param serverId unique id of the Raft server (sent in the handshake message)
@param mapper instance of {@code ObjectMapper} used to map handshake properties to
their corresponding fields in the encoded handshake message
@return {@code ChannelBuffer} instance that contains the encoded handshake message
@throws JsonProcessingException if the handshake message cannot be constructed | [
"Create",
"a",
"{",
"@code",
"RaftNetworkClient",
"}",
"handshake",
"message",
"."
] | train | https://github.com/allengeorge/libraft/blob/00d68bb5e68d4020af59df3c8a9a14380108ac89/libraft-agent/src/main/java/io/libraft/agent/rpc/Handshakers.java#L106-L108 |
groundupworks/wings | wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookSettingsActivity.java | FacebookSettingsActivity.replaceFragment | void replaceFragment(Fragment fragment, boolean addToBackStack, boolean popPreviousState) {
final FragmentManager fragmentManager = getSupportFragmentManager();
if (popPreviousState) {
fragmentManager.popBackStack();
}
final FragmentTransaction ft = fragmentManager.beginTransaction();
ft.replace(R.id.fragment_container, fragment);
if (addToBackStack) {
ft.addToBackStack(null);
}
ft.commit();
} | java | void replaceFragment(Fragment fragment, boolean addToBackStack, boolean popPreviousState) {
final FragmentManager fragmentManager = getSupportFragmentManager();
if (popPreviousState) {
fragmentManager.popBackStack();
}
final FragmentTransaction ft = fragmentManager.beginTransaction();
ft.replace(R.id.fragment_container, fragment);
if (addToBackStack) {
ft.addToBackStack(null);
}
ft.commit();
} | [
"void",
"replaceFragment",
"(",
"Fragment",
"fragment",
",",
"boolean",
"addToBackStack",
",",
"boolean",
"popPreviousState",
")",
"{",
"final",
"FragmentManager",
"fragmentManager",
"=",
"getSupportFragmentManager",
"(",
")",
";",
"if",
"(",
"popPreviousState",
")",
... | Replaces a {@link android.support.v4.app.Fragment} in the container.
@param fragment the new {@link android.support.v4.app.Fragment} used to replace the current.
@param addToBackStack true to add transaction to back stack; false otherwise.
@param popPreviousState true to pop the previous state from the back stack; false otherwise. | [
"Replaces",
"a",
"{",
"@link",
"android",
".",
"support",
".",
"v4",
".",
"app",
".",
"Fragment",
"}",
"in",
"the",
"container",
"."
] | train | https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookSettingsActivity.java#L76-L88 |
spotify/async-google-pubsub-client | src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java | Pubsub.getTopic | public PubsubFuture<Topic> getTopic(final String project, final String topic) {
return getTopic(canonicalTopic(project, topic));
} | java | public PubsubFuture<Topic> getTopic(final String project, final String topic) {
return getTopic(canonicalTopic(project, topic));
} | [
"public",
"PubsubFuture",
"<",
"Topic",
">",
"getTopic",
"(",
"final",
"String",
"project",
",",
"final",
"String",
"topic",
")",
"{",
"return",
"getTopic",
"(",
"canonicalTopic",
"(",
"project",
",",
"topic",
")",
")",
";",
"}"
] | Get a Pub/Sub topic.
@param project The Google Cloud project.
@param topic The name of the topic to get.
@return A future that is completed when this request is completed. The future will be completed with {@code null}
if the response is 404. | [
"Get",
"a",
"Pub",
"/",
"Sub",
"topic",
"."
] | train | https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L306-L308 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbLists.java | TmdbLists.checkItemStatus | public boolean checkItemStatus(String listId, int mediaId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, listId);
parameters.add(Param.MOVIE_ID, mediaId);
URL url = new ApiUrl(apiKey, MethodBase.LIST).subMethod(MethodSub.ITEM_STATUS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, ListItemStatus.class).isItemPresent();
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get item status", url, ex);
}
} | java | public boolean checkItemStatus(String listId, int mediaId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, listId);
parameters.add(Param.MOVIE_ID, mediaId);
URL url = new ApiUrl(apiKey, MethodBase.LIST).subMethod(MethodSub.ITEM_STATUS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, ListItemStatus.class).isItemPresent();
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get item status", url, ex);
}
} | [
"public",
"boolean",
"checkItemStatus",
"(",
"String",
"listId",
",",
"int",
"mediaId",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
".",
"ID",
",",... | Check to see if an ID is already on a list.
@param listId
@param mediaId
@return true if the movie is on the list
@throws MovieDbException | [
"Check",
"to",
"see",
"if",
"an",
"ID",
"is",
"already",
"on",
"a",
"list",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbLists.java#L89-L102 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/icon/Icon.java | Icon.initIcon | protected void initIcon(Icon baseIcon, int width, int height, int x, int y, boolean rotated)
{
copyFrom(baseIcon);
} | java | protected void initIcon(Icon baseIcon, int width, int height, int x, int y, boolean rotated)
{
copyFrom(baseIcon);
} | [
"protected",
"void",
"initIcon",
"(",
"Icon",
"baseIcon",
",",
"int",
"width",
",",
"int",
"height",
",",
"int",
"x",
",",
"int",
"y",
",",
"boolean",
"rotated",
")",
"{",
"copyFrom",
"(",
"baseIcon",
")",
";",
"}"
] | Initializes this {@link Icon}. Called from the icon this one depends on, copying the <b>baseIcon</b> values.
@param baseIcon the base icon
@param width the width
@param height the height
@param x the x
@param y the y
@param rotated the rotated | [
"Initializes",
"this",
"{",
"@link",
"Icon",
"}",
".",
"Called",
"from",
"the",
"icon",
"this",
"one",
"depends",
"on",
"copying",
"the",
"<b",
">",
"baseIcon<",
"/",
"b",
">",
"values",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/icon/Icon.java#L301-L304 |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.executeBatchSQLKey | public static int[] executeBatchSQLKey(String sqlKey, Object[][] params)
throws SQLStatementNotFoundException, YankSQLException {
return executeBatchSQLKey(YankPoolManager.DEFAULT_POOL_NAME, sqlKey, params);
} | java | public static int[] executeBatchSQLKey(String sqlKey, Object[][] params)
throws SQLStatementNotFoundException, YankSQLException {
return executeBatchSQLKey(YankPoolManager.DEFAULT_POOL_NAME, sqlKey, params);
} | [
"public",
"static",
"int",
"[",
"]",
"executeBatchSQLKey",
"(",
"String",
"sqlKey",
",",
"Object",
"[",
"]",
"[",
"]",
"params",
")",
"throws",
"SQLStatementNotFoundException",
",",
"YankSQLException",
"{",
"return",
"executeBatchSQLKey",
"(",
"YankPoolManager",
"... | Batch executes the given INSERT, UPDATE, DELETE, REPLACE or UPSERT SQL statement matching the
sqlKey String in a properties file loaded via Yank.addSQLStatements(...) using the default
connection pool.
@param sqlKey The SQL Key found in a properties file corresponding to the desired SQL statement
value
@param params An array of query replacement parameters. Each row in this array is one set of
batch replacement values
@return The number of rows affected or each individual execution
@throws SQLStatementNotFoundException if an SQL statement could not be found for the given
sqlKey String | [
"Batch",
"executes",
"the",
"given",
"INSERT",
"UPDATE",
"DELETE",
"REPLACE",
"or",
"UPSERT",
"SQL",
"statement",
"matching",
"the",
"sqlKey",
"String",
"in",
"a",
"properties",
"file",
"loaded",
"via",
"Yank",
".",
"addSQLStatements",
"(",
"...",
")",
"using"... | train | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L714-L718 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/util/Geometry.java | Geometry.getPathIntersect | public static Point2D getPathIntersect(final WiresConnection connection, final MultiPath path, final Point2D c, final int pointIndex)
{
final Point2DArray plist = connection.getConnector().getLine().getPoint2DArray();
Point2D p = plist.get(pointIndex).copy();
final Point2D offsetP = path.getComputedLocation();
p.offset(-offsetP.getX(), -offsetP.getY());
// p may be within the path boundary, so work of a vector that guarantees a point outside
final double width = path.getBoundingBox().getWidth();
if (c.equals(p))
{
// this happens with the magnet is over the center of the opposite shape
// so either the shapes are horizontall or vertically aligned.
// this means we can just take the original centre point for the project
// without this the project throw an error as you cannot unit() something of length 0,0
p.offset(offsetP.getX(), offsetP.getY());
}
try
{
p = getProjection(c, p, width);
final Set<Point2D>[] set = Geometry.getCardinalIntersects(path, new Point2DArray(c, p));
final Point2DArray points = Geometry.removeInnerPoints(c, set);
return (points.size() > 1) ? points.get(1) : null;
}
catch (final Exception e)
{
return null;
}
} | java | public static Point2D getPathIntersect(final WiresConnection connection, final MultiPath path, final Point2D c, final int pointIndex)
{
final Point2DArray plist = connection.getConnector().getLine().getPoint2DArray();
Point2D p = plist.get(pointIndex).copy();
final Point2D offsetP = path.getComputedLocation();
p.offset(-offsetP.getX(), -offsetP.getY());
// p may be within the path boundary, so work of a vector that guarantees a point outside
final double width = path.getBoundingBox().getWidth();
if (c.equals(p))
{
// this happens with the magnet is over the center of the opposite shape
// so either the shapes are horizontall or vertically aligned.
// this means we can just take the original centre point for the project
// without this the project throw an error as you cannot unit() something of length 0,0
p.offset(offsetP.getX(), offsetP.getY());
}
try
{
p = getProjection(c, p, width);
final Set<Point2D>[] set = Geometry.getCardinalIntersects(path, new Point2DArray(c, p));
final Point2DArray points = Geometry.removeInnerPoints(c, set);
return (points.size() > 1) ? points.get(1) : null;
}
catch (final Exception e)
{
return null;
}
} | [
"public",
"static",
"Point2D",
"getPathIntersect",
"(",
"final",
"WiresConnection",
"connection",
",",
"final",
"MultiPath",
"path",
",",
"final",
"Point2D",
"c",
",",
"final",
"int",
"pointIndex",
")",
"{",
"final",
"Point2DArray",
"plist",
"=",
"connection",
"... | Finds the intersection of the connector's end segment on a path.
@param connection
@param path
@param c
@param pointIndex
@return | [
"Finds",
"the",
"intersection",
"of",
"the",
"connector",
"s",
"end",
"segment",
"on",
"a",
"path",
"."
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/util/Geometry.java#L1179-L1214 |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java | ShutdownHook.writeCygwinCleanup | private void writeCygwinCleanup(File file, BufferedWriter bw) throws IOException {
// Under cygwin, must explicitly kill the process that runs
// the server. It simply does not die on its own. And it's
// JVM holds file locks which will prevent cleanup of extraction
// directory. So kill it.
String pid = getPID(dir, serverName);
if (pid != null)
bw.write("kill " + pid + "\n");
writeUnixCleanup(file, bw);
} | java | private void writeCygwinCleanup(File file, BufferedWriter bw) throws IOException {
// Under cygwin, must explicitly kill the process that runs
// the server. It simply does not die on its own. And it's
// JVM holds file locks which will prevent cleanup of extraction
// directory. So kill it.
String pid = getPID(dir, serverName);
if (pid != null)
bw.write("kill " + pid + "\n");
writeUnixCleanup(file, bw);
} | [
"private",
"void",
"writeCygwinCleanup",
"(",
"File",
"file",
",",
"BufferedWriter",
"bw",
")",
"throws",
"IOException",
"{",
"// Under cygwin, must explicitly kill the process that runs",
"// the server. It simply does not die on its own. And it's",
"// JVM holds file locks which will... | Write logic for Cygwin cleanup script
@param file - script File object
@param bw - bufferedWriter to write into script file
@throws IOException | [
"Write",
"logic",
"for",
"Cygwin",
"cleanup",
"script"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java#L198-L207 |
GII/broccoli | broccoli-impl/src/main/java/com/hi3project/broccoli/bsdm/impl/grounding/AbstractFunctionalityGrounding.java | AbstractFunctionalityGrounding.executeWithValues | @Override
public void executeWithValues(Collection<IAnnotatedValue> values, IAsyncMessageClient clientCallback) throws ModelException
{
// a new conversation ID is generated
String conversationId = this.idGenerator.getSId();
if (null != this.getServiceImplementation())
{
IFunctionalityImplementation functionalityImplementation
= this.getServiceImplementation().getFunctionalityImplementation(this.name());
if (null != functionalityImplementation)
{
// if there is an implementation for this functionality, its execution is invoked
//and the results are sent back using the clientCallback
this.registerInternalChannelsFor(this.name(), clientCallback, conversationId);
Collection<IResult> results =
functionalityImplementation.executeWithValues(
values,
new FunctionalityExecutionVO(clientCallback.getName(), conversationId));
BSDFLogger.getLogger().info("Sends functionality implementation result to callback");
clientCallback.receiveMessage(
new FunctionalityResultMessage(results,
this.name(),
clientCallback.getName(),
conversationId));
return;
}
}
// a clientChannel is obtained to receive result messages
this.getClientChannelFor(this.name(), clientCallback, conversationId);
// when there is not an implementation, the control channel is used to send and execution message...
this.serviceGrounding.getControlChannelProducer().send(
new FunctionalityExecMessage(values, this.name(), clientCallback.getName(), conversationId));
BSDFLogger.getLogger().info("Sends FunctionalityExecMessage to grounding: " + this.serviceGrounding.toString());
} | java | @Override
public void executeWithValues(Collection<IAnnotatedValue> values, IAsyncMessageClient clientCallback) throws ModelException
{
// a new conversation ID is generated
String conversationId = this.idGenerator.getSId();
if (null != this.getServiceImplementation())
{
IFunctionalityImplementation functionalityImplementation
= this.getServiceImplementation().getFunctionalityImplementation(this.name());
if (null != functionalityImplementation)
{
// if there is an implementation for this functionality, its execution is invoked
//and the results are sent back using the clientCallback
this.registerInternalChannelsFor(this.name(), clientCallback, conversationId);
Collection<IResult> results =
functionalityImplementation.executeWithValues(
values,
new FunctionalityExecutionVO(clientCallback.getName(), conversationId));
BSDFLogger.getLogger().info("Sends functionality implementation result to callback");
clientCallback.receiveMessage(
new FunctionalityResultMessage(results,
this.name(),
clientCallback.getName(),
conversationId));
return;
}
}
// a clientChannel is obtained to receive result messages
this.getClientChannelFor(this.name(), clientCallback, conversationId);
// when there is not an implementation, the control channel is used to send and execution message...
this.serviceGrounding.getControlChannelProducer().send(
new FunctionalityExecMessage(values, this.name(), clientCallback.getName(), conversationId));
BSDFLogger.getLogger().info("Sends FunctionalityExecMessage to grounding: " + this.serviceGrounding.toString());
} | [
"@",
"Override",
"public",
"void",
"executeWithValues",
"(",
"Collection",
"<",
"IAnnotatedValue",
">",
"values",
",",
"IAsyncMessageClient",
"clientCallback",
")",
"throws",
"ModelException",
"{",
"// a new conversation ID is generated",
"String",
"conversationId",
"=",
... | /*
It executes the functionality, using the given inputs and communicating the result
via the given IAsyncMessageClient callback.
The execution can be resolved in two ways: using a functionality implementation
(if there is any) or communicating throught the grounding. | [
"/",
"*",
"It",
"executes",
"the",
"functionality",
"using",
"the",
"given",
"inputs",
"and",
"communicating",
"the",
"result",
"via",
"the",
"given",
"IAsyncMessageClient",
"callback",
".",
"The",
"execution",
"can",
"be",
"resolved",
"in",
"two",
"ways",
":"... | train | https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-impl/src/main/java/com/hi3project/broccoli/bsdm/impl/grounding/AbstractFunctionalityGrounding.java#L234-L270 |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/style/FontLoader.java | FontLoader.loadFont | public LOADSTATUS loadFont(String path) throws VectorPrintException {
try {
File f = new File(path);
LOADSTATUS stat = LOADSTATUS.NOT_LOADED;
if (loadAWTFonts) {
Font fo = Font.createFont(Font.TRUETYPE_FONT, f);
GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(fo);
stat = LOADSTATUS.LOADED_ONLY_AWT;
}
if (loadiText) {
FontFactory.register(path);
stat = (stat.equals(LOADSTATUS.LOADED_ONLY_AWT)) ? LOADSTATUS.LOADED_ITEXT_AND_AWT : LOADSTATUS.LOADED_ONLY_ITEXT;
log.info(String.format("font loaded from %s", f.getAbsolutePath()));
}
return stat;
} catch (FontFormatException | IOException ex) {
log.log(Level.SEVERE, null, ex);
throw new VectorPrintException("failed to load " + path, ex);
}
} | java | public LOADSTATUS loadFont(String path) throws VectorPrintException {
try {
File f = new File(path);
LOADSTATUS stat = LOADSTATUS.NOT_LOADED;
if (loadAWTFonts) {
Font fo = Font.createFont(Font.TRUETYPE_FONT, f);
GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(fo);
stat = LOADSTATUS.LOADED_ONLY_AWT;
}
if (loadiText) {
FontFactory.register(path);
stat = (stat.equals(LOADSTATUS.LOADED_ONLY_AWT)) ? LOADSTATUS.LOADED_ITEXT_AND_AWT : LOADSTATUS.LOADED_ONLY_ITEXT;
log.info(String.format("font loaded from %s", f.getAbsolutePath()));
}
return stat;
} catch (FontFormatException | IOException ex) {
log.log(Level.SEVERE, null, ex);
throw new VectorPrintException("failed to load " + path, ex);
}
} | [
"public",
"LOADSTATUS",
"loadFont",
"(",
"String",
"path",
")",
"throws",
"VectorPrintException",
"{",
"try",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"path",
")",
";",
"LOADSTATUS",
"stat",
"=",
"LOADSTATUS",
".",
"NOT_LOADED",
";",
"if",
"(",
"loadAWTF... | Bottleneck method for loading fonts, calls {@link FontFactory#register(java.lang.String) } for iText, {@link GraphicsEnvironment#registerFont(java.awt.Font) }
for awt.
@param path the path to the font file
ed
@return
@throws VectorPrintException | [
"Bottleneck",
"method",
"for",
"loading",
"fonts",
"calls",
"{"
] | train | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/FontLoader.java#L115-L138 |
bazaarvoice/emodb | web/src/main/java/com/bazaarvoice/emodb/web/uac/LocalSubjectUserAccessControl.java | LocalSubjectUserAccessControl.convertUncheckedException | private RuntimeException convertUncheckedException(Exception e) {
if (Throwables.getRootCause(e) instanceof TimeoutException) {
_lockTimeoutMeter.mark();
throw new ServiceUnavailableException("Failed to acquire update lock, try again later", new Random().nextInt(5) + 1);
}
throw Throwables.propagate(e);
} | java | private RuntimeException convertUncheckedException(Exception e) {
if (Throwables.getRootCause(e) instanceof TimeoutException) {
_lockTimeoutMeter.mark();
throw new ServiceUnavailableException("Failed to acquire update lock, try again later", new Random().nextInt(5) + 1);
}
throw Throwables.propagate(e);
} | [
"private",
"RuntimeException",
"convertUncheckedException",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"Throwables",
".",
"getRootCause",
"(",
"e",
")",
"instanceof",
"TimeoutException",
")",
"{",
"_lockTimeoutMeter",
".",
"mark",
"(",
")",
";",
"throw",
"new",... | Converts unchecked exceptions to appropriate API exceptions. Specifically, if the subsystem fails to acquire
the synchronization lock for a non-read operation it will throw a TimeoutException. This method converts
that to a ServiceUnavailableException. All other exceptions are rethrown as-is.
This method never returns, it always results in an exception being thrown. The return value is present to
support more natural exception handling by the caller. | [
"Converts",
"unchecked",
"exceptions",
"to",
"appropriate",
"API",
"exceptions",
".",
"Specifically",
"if",
"the",
"subsystem",
"fails",
"to",
"acquire",
"the",
"synchronization",
"lock",
"for",
"a",
"non",
"-",
"read",
"operation",
"it",
"will",
"throw",
"a",
... | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/uac/LocalSubjectUserAccessControl.java#L628-L634 |
kikinteractive/ice | ice/src/main/java/com/kik/config/ice/ConfigSystem.java | ConfigSystem.configModuleWithOverrides | public static <C> Module configModuleWithOverrides(final Class<C> configInterface, Named name, OverrideConsumer<C> overrideConsumer)
{
checkNotNull(configInterface);
checkNotNull(name);
checkNotNull(overrideConsumer);
return configModuleWithOverrides(configInterface, Optional.ofNullable(name), Optional.ofNullable(overrideConsumer));
} | java | public static <C> Module configModuleWithOverrides(final Class<C> configInterface, Named name, OverrideConsumer<C> overrideConsumer)
{
checkNotNull(configInterface);
checkNotNull(name);
checkNotNull(overrideConsumer);
return configModuleWithOverrides(configInterface, Optional.ofNullable(name), Optional.ofNullable(overrideConsumer));
} | [
"public",
"static",
"<",
"C",
">",
"Module",
"configModuleWithOverrides",
"(",
"final",
"Class",
"<",
"C",
">",
"configInterface",
",",
"Named",
"name",
",",
"OverrideConsumer",
"<",
"C",
">",
"overrideConsumer",
")",
"{",
"checkNotNull",
"(",
"configInterface",... | Generates a Guice Module for use with Injector creation. The generate Guice module binds a number of support
classes to service a dynamically generate implementation of the provided configuration interface.
This method further overrides the annotated defaults on the configuration class as per the code in
the given overrideConsumer
@param <C> The configuration interface type to be implemented
@param configInterface The configuration interface
@param name Named annotation to provide an arbitrary scope to the configuration interface. Used when
there are multiple implementations of the config interface.
@param overrideConsumer a lambda which is given an instance of {@link OverrideModule} which can be used to
build type-safe overrides for the default configuration of the config.
@return a module to install in your Guice Injector | [
"Generates",
"a",
"Guice",
"Module",
"for",
"use",
"with",
"Injector",
"creation",
".",
"The",
"generate",
"Guice",
"module",
"binds",
"a",
"number",
"of",
"support",
"classes",
"to",
"service",
"a",
"dynamically",
"generate",
"implementation",
"of",
"the",
"p... | train | https://github.com/kikinteractive/ice/blob/0c58d7bf2d9f6504892d0768d6022fcfa6df7514/ice/src/main/java/com/kik/config/ice/ConfigSystem.java#L128-L134 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.plus | public static Number plus(Character left, Number right) {
return NumberNumberPlus.plus(Integer.valueOf(left), right);
} | java | public static Number plus(Character left, Number right) {
return NumberNumberPlus.plus(Integer.valueOf(left), right);
} | [
"public",
"static",
"Number",
"plus",
"(",
"Character",
"left",
",",
"Number",
"right",
")",
"{",
"return",
"NumberNumberPlus",
".",
"plus",
"(",
"Integer",
".",
"valueOf",
"(",
"left",
")",
",",
"right",
")",
";",
"}"
] | Add a Character and a Number. The ordinal value of the Character
is used in the addition (the ordinal value is the unicode
value which for simple character sets is the ASCII value).
This operation will always create a new object for the result,
while the operands remain unchanged.
@see java.lang.Integer#valueOf(int)
@param left a Character
@param right a Number
@return the Number corresponding to the addition of left and right
@since 1.0 | [
"Add",
"a",
"Character",
"and",
"a",
"Number",
".",
"The",
"ordinal",
"value",
"of",
"the",
"Character",
"is",
"used",
"in",
"the",
"addition",
"(",
"the",
"ordinal",
"value",
"is",
"the",
"unicode",
"value",
"which",
"for",
"simple",
"character",
"sets",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15011-L15013 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/search/bingnewssearch/src/main/java/com/microsoft/azure/cognitiveservices/search/newssearch/implementation/BingNewsImpl.java | BingNewsImpl.categoryAsync | public ServiceFuture<NewsModel> categoryAsync(CategoryOptionalParameter categoryOptionalParameter, final ServiceCallback<NewsModel> serviceCallback) {
return ServiceFuture.fromResponse(categoryWithServiceResponseAsync(categoryOptionalParameter), serviceCallback);
} | java | public ServiceFuture<NewsModel> categoryAsync(CategoryOptionalParameter categoryOptionalParameter, final ServiceCallback<NewsModel> serviceCallback) {
return ServiceFuture.fromResponse(categoryWithServiceResponseAsync(categoryOptionalParameter), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"NewsModel",
">",
"categoryAsync",
"(",
"CategoryOptionalParameter",
"categoryOptionalParameter",
",",
"final",
"ServiceCallback",
"<",
"NewsModel",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromResponse",
"(",
"c... | The News Category API lets lets you search on Bing and get back a list of top news articles by category. This section provides technical details about the query parameters and headers that you use to request news and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the web for news](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-news-search/search-the-web).
@param categoryOptionalParameter the object representing the optional parameters to be set before calling this API
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"The",
"News",
"Category",
"API",
"lets",
"lets",
"you",
"search",
"on",
"Bing",
"and",
"get",
"back",
"a",
"list",
"of",
"top",
"news",
"articles",
"by",
"category",
".",
"This",
"section",
"provides",
"technical",
"details",
"about",
"the",
"query",
"par... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingnewssearch/src/main/java/com/microsoft/azure/cognitiveservices/search/newssearch/implementation/BingNewsImpl.java#L378-L380 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java | Uris.getRawPath | public static String getRawPath(final URI uri, final boolean strict) {
return esc(strict).escapePath(prependSlash(Strings.nullToEmpty(uri.getRawPath())));
} | java | public static String getRawPath(final URI uri, final boolean strict) {
return esc(strict).escapePath(prependSlash(Strings.nullToEmpty(uri.getRawPath())));
} | [
"public",
"static",
"String",
"getRawPath",
"(",
"final",
"URI",
"uri",
",",
"final",
"boolean",
"strict",
")",
"{",
"return",
"esc",
"(",
"strict",
")",
".",
"escapePath",
"(",
"prependSlash",
"(",
"Strings",
".",
"nullToEmpty",
"(",
"uri",
".",
"getRawPa... | Returns the raw (and normalized) path of the given URI - prefixed with a "/". This means that an empty path
becomes a single slash.
@param uri the URI to extract the path from
@param strict whether or not to do strict escaping
@return the extracted path | [
"Returns",
"the",
"raw",
"(",
"and",
"normalized",
")",
"path",
"of",
"the",
"given",
"URI",
"-",
"prefixed",
"with",
"a",
"/",
".",
"This",
"means",
"that",
"an",
"empty",
"path",
"becomes",
"a",
"single",
"slash",
"."
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L154-L156 |
icode/ameba | src/main/java/ameba/mvc/template/internal/ResolvingViewableContext.java | ResolvingViewableContext.resolveViewable | public ResolvedViewable resolveViewable(final Viewable viewable, final MediaType mediaType,
final Class<?> resourceClass, final TemplateProcessor templateProcessor) {
if (viewable.isTemplateNameAbsolute()) {
return resolveAbsoluteViewable(viewable, resourceClass, mediaType, templateProcessor);
} else {
if (resourceClass == null) {
throw new ViewableContextException(LocalizationMessages.TEMPLATE_RESOLVING_CLASS_CANNOT_BE_NULL());
}
return resolveRelativeViewable(viewable, resourceClass, mediaType, templateProcessor);
}
} | java | public ResolvedViewable resolveViewable(final Viewable viewable, final MediaType mediaType,
final Class<?> resourceClass, final TemplateProcessor templateProcessor) {
if (viewable.isTemplateNameAbsolute()) {
return resolveAbsoluteViewable(viewable, resourceClass, mediaType, templateProcessor);
} else {
if (resourceClass == null) {
throw new ViewableContextException(LocalizationMessages.TEMPLATE_RESOLVING_CLASS_CANNOT_BE_NULL());
}
return resolveRelativeViewable(viewable, resourceClass, mediaType, templateProcessor);
}
} | [
"public",
"ResolvedViewable",
"resolveViewable",
"(",
"final",
"Viewable",
"viewable",
",",
"final",
"MediaType",
"mediaType",
",",
"final",
"Class",
"<",
"?",
">",
"resourceClass",
",",
"final",
"TemplateProcessor",
"templateProcessor",
")",
"{",
"if",
"(",
"view... | {@inheritDoc}
Resolve given {@link Viewable viewable} using {@link MediaType media type}, {@code resolving class} and
{@link TemplateProcessor template processor}. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/mvc/template/internal/ResolvingViewableContext.java#L39-L50 |
jhy/jsoup | src/main/java/org/jsoup/nodes/Element.java | Element.getElementsByAttributeValueMatching | public Elements getElementsByAttributeValueMatching(String key, String regex) {
Pattern pattern;
try {
pattern = Pattern.compile(regex);
} catch (PatternSyntaxException e) {
throw new IllegalArgumentException("Pattern syntax error: " + regex, e);
}
return getElementsByAttributeValueMatching(key, pattern);
} | java | public Elements getElementsByAttributeValueMatching(String key, String regex) {
Pattern pattern;
try {
pattern = Pattern.compile(regex);
} catch (PatternSyntaxException e) {
throw new IllegalArgumentException("Pattern syntax error: " + regex, e);
}
return getElementsByAttributeValueMatching(key, pattern);
} | [
"public",
"Elements",
"getElementsByAttributeValueMatching",
"(",
"String",
"key",
",",
"String",
"regex",
")",
"{",
"Pattern",
"pattern",
";",
"try",
"{",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"regex",
")",
";",
"}",
"catch",
"(",
"PatternSyntaxExce... | Find elements that have attributes whose values match the supplied regular expression.
@param key name of the attribute
@param regex regular expression to match against attribute values. You can use <a href="http://java.sun.com/docs/books/tutorial/essential/regex/pattern.html#embedded">embedded flags</a> (such as (?i) and (?m) to control regex options.
@return elements that have attributes matching this regular expression | [
"Find",
"elements",
"that",
"have",
"attributes",
"whose",
"values",
"match",
"the",
"supplied",
"regular",
"expression",
"."
] | train | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L928-L936 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.localGoto | public void localGoto(String name, float llx, float lly, float urx, float ury) {
pdf.localGoto(name, llx, lly, urx, ury);
} | java | public void localGoto(String name, float llx, float lly, float urx, float ury) {
pdf.localGoto(name, llx, lly, urx, ury);
} | [
"public",
"void",
"localGoto",
"(",
"String",
"name",
",",
"float",
"llx",
",",
"float",
"lly",
",",
"float",
"urx",
",",
"float",
"ury",
")",
"{",
"pdf",
".",
"localGoto",
"(",
"name",
",",
"llx",
",",
"lly",
",",
"urx",
",",
"ury",
")",
";",
"}... | Implements a link to other part of the document. The jump will
be made to a local destination with the same name, that must exist.
@param name the name for this link
@param llx the lower left x corner of the activation area
@param lly the lower left y corner of the activation area
@param urx the upper right x corner of the activation area
@param ury the upper right y corner of the activation area | [
"Implements",
"a",
"link",
"to",
"other",
"part",
"of",
"the",
"document",
".",
"The",
"jump",
"will",
"be",
"made",
"to",
"a",
"local",
"destination",
"with",
"the",
"same",
"name",
"that",
"must",
"exist",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L2525-L2527 |
derari/cthul | matchers/src/main/java/org/cthul/proc/ProcBase.java | ProcBase.assertArgCount | protected void assertArgCount(Object[] args, int count) {
if (args.length != count) {
throw illegalArgumentException(String.format(
"Wrong number of arguments, expected %d got %d",
count, args.length));
}
} | java | protected void assertArgCount(Object[] args, int count) {
if (args.length != count) {
throw illegalArgumentException(String.format(
"Wrong number of arguments, expected %d got %d",
count, args.length));
}
} | [
"protected",
"void",
"assertArgCount",
"(",
"Object",
"[",
"]",
"args",
",",
"int",
"count",
")",
"{",
"if",
"(",
"args",
".",
"length",
"!=",
"count",
")",
"{",
"throw",
"illegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Wrong number of argum... | Throws a ProcError exception if {@code args.length != count}
@param args
@param count | [
"Throws",
"a",
"ProcError",
"exception",
"if",
"{"
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/matchers/src/main/java/org/cthul/proc/ProcBase.java#L87-L93 |
spotify/async-google-pubsub-client | src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java | Pubsub.listSubscriptions | public PubsubFuture<SubscriptionList> listSubscriptions(final String project,
final String pageToken) {
final String query = (pageToken == null) ? "" : "?pageToken=" + pageToken;
final String path = "projects/" + project + "/subscriptions" + query;
return get("list subscriptions", path, readJson(SubscriptionList.class));
} | java | public PubsubFuture<SubscriptionList> listSubscriptions(final String project,
final String pageToken) {
final String query = (pageToken == null) ? "" : "?pageToken=" + pageToken;
final String path = "projects/" + project + "/subscriptions" + query;
return get("list subscriptions", path, readJson(SubscriptionList.class));
} | [
"public",
"PubsubFuture",
"<",
"SubscriptionList",
">",
"listSubscriptions",
"(",
"final",
"String",
"project",
",",
"final",
"String",
"pageToken",
")",
"{",
"final",
"String",
"query",
"=",
"(",
"pageToken",
"==",
"null",
")",
"?",
"\"\"",
":",
"\"?pageToken... | Get a page of Pub/Sub subscriptions in a project using a specified page token.
@param project The Google Cloud project.
@param pageToken A token for the page of subscriptions to get.
@return A future that is completed when this request is completed. | [
"Get",
"a",
"page",
"of",
"Pub",
"/",
"Sub",
"subscriptions",
"in",
"a",
"project",
"using",
"a",
"specified",
"page",
"token",
"."
] | train | https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L381-L386 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_11_01/src/main/java/com/microsoft/azure/management/storage/v2018_11_01/implementation/ManagementPoliciesInner.java | ManagementPoliciesInner.createOrUpdateAsync | public ServiceFuture<ManagementPolicyInner> createOrUpdateAsync(String resourceGroupName, String accountName, ManagementPolicySchema policy, final ServiceCallback<ManagementPolicyInner> serviceCallback) {
return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, policy), serviceCallback);
} | java | public ServiceFuture<ManagementPolicyInner> createOrUpdateAsync(String resourceGroupName, String accountName, ManagementPolicySchema policy, final ServiceCallback<ManagementPolicyInner> serviceCallback) {
return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, policy), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"ManagementPolicyInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"ManagementPolicySchema",
"policy",
",",
"final",
"ServiceCallback",
"<",
"ManagementPolicyInner",
">",
"serviceCallba... | Sets the managementpolicy to the specified storage account.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param policy The Storage Account ManagementPolicy, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Sets",
"the",
"managementpolicy",
"to",
"the",
"specified",
"storage",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_11_01/src/main/java/com/microsoft/azure/management/storage/v2018_11_01/implementation/ManagementPoliciesInner.java#L186-L188 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.asType | @SuppressWarnings("unchecked")
public static <T> T asType(Number self, Class<T> c) {
if (c == BigDecimal.class) {
return (T) toBigDecimal(self);
} else if (c == BigInteger.class) {
return (T) toBigInteger(self);
} else if (c == Double.class) {
return (T) toDouble(self);
} else if (c == Float.class) {
return (T) toFloat(self);
}
return asType((Object) self, c);
} | java | @SuppressWarnings("unchecked")
public static <T> T asType(Number self, Class<T> c) {
if (c == BigDecimal.class) {
return (T) toBigDecimal(self);
} else if (c == BigInteger.class) {
return (T) toBigInteger(self);
} else if (c == Double.class) {
return (T) toDouble(self);
} else if (c == Float.class) {
return (T) toFloat(self);
}
return asType((Object) self, c);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"asType",
"(",
"Number",
"self",
",",
"Class",
"<",
"T",
">",
"c",
")",
"{",
"if",
"(",
"c",
"==",
"BigDecimal",
".",
"class",
")",
"{",
"return",
"(",
"T",... | Transform this number to a the given type, using the 'as' operator. The
following types are supported in addition to the default
{@link #asType(java.lang.Object, java.lang.Class)}:
<ul>
<li>BigDecimal</li>
<li>BigInteger</li>
<li>Double</li>
<li>Float</li>
</ul>
@param self this number
@param c the desired type of the transformed result
@return an instance of the given type
@since 1.0 | [
"Transform",
"this",
"number",
"to",
"a",
"the",
"given",
"type",
"using",
"the",
"as",
"operator",
".",
"The",
"following",
"types",
"are",
"supported",
"in",
"addition",
"to",
"the",
"default",
"{"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16550-L16562 |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java | DividableGridAdapter.setItemEnabled | public final void setItemEnabled(final int index, final boolean enabled) {
AbstractItem item = items.get(index);
if (item instanceof Item) {
((Item) item).setEnabled(enabled);
rawItems = null;
notifyOnDataSetChanged();
}
} | java | public final void setItemEnabled(final int index, final boolean enabled) {
AbstractItem item = items.get(index);
if (item instanceof Item) {
((Item) item).setEnabled(enabled);
rawItems = null;
notifyOnDataSetChanged();
}
} | [
"public",
"final",
"void",
"setItemEnabled",
"(",
"final",
"int",
"index",
",",
"final",
"boolean",
"enabled",
")",
"{",
"AbstractItem",
"item",
"=",
"items",
".",
"get",
"(",
"index",
")",
";",
"if",
"(",
"item",
"instanceof",
"Item",
")",
"{",
"(",
"... | Sets, whether the item at a specific index should be enabled, or not.
@param index
The index of the item as an {@link Integer} value
@param enabled
True, if the item should be enabled, false otherwise | [
"Sets",
"whether",
"the",
"item",
"at",
"a",
"specific",
"index",
"should",
"be",
"enabled",
"or",
"not",
"."
] | train | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L599-L607 |
vipshop/vjtools | vjtop/src/main/java/com/vip/vjtools/vjtop/VMInfo.java | VMInfo.createDeadVM | public static VMInfo createDeadVM(String pid, VMInfoState state) {
VMInfo vmInfo = new VMInfo();
vmInfo.state = state;
vmInfo.pid = pid;
return vmInfo;
} | java | public static VMInfo createDeadVM(String pid, VMInfoState state) {
VMInfo vmInfo = new VMInfo();
vmInfo.state = state;
vmInfo.pid = pid;
return vmInfo;
} | [
"public",
"static",
"VMInfo",
"createDeadVM",
"(",
"String",
"pid",
",",
"VMInfoState",
"state",
")",
"{",
"VMInfo",
"vmInfo",
"=",
"new",
"VMInfo",
"(",
")",
";",
"vmInfo",
".",
"state",
"=",
"state",
";",
"vmInfo",
".",
"pid",
"=",
"pid",
";",
"retur... | Creates a dead VMInfo, representing a jvm in a given state which cannot
be attached or other monitoring issues occurred. | [
"Creates",
"a",
"dead",
"VMInfo",
"representing",
"a",
"jvm",
"in",
"a",
"given",
"state",
"which",
"cannot",
"be",
"attached",
"or",
"other",
"monitoring",
"issues",
"occurred",
"."
] | train | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjtop/src/main/java/com/vip/vjtools/vjtop/VMInfo.java#L151-L156 |
jlinn/quartz-redis-jobstore | src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java | AbstractRedisStorage.retrieveTrigger | public OperableTrigger retrieveTrigger(TriggerKey triggerKey, T jedis) throws JobPersistenceException{
final String triggerHashKey = redisSchema.triggerHashKey(triggerKey);
Map<String, String> triggerMap = jedis.hgetAll(triggerHashKey);
if(triggerMap == null || triggerMap.isEmpty()){
logger.debug(String.format("No trigger exists for key %s", triggerHashKey));
return null;
}
Class triggerClass;
try {
triggerClass = Class.forName(triggerMap.get(TRIGGER_CLASS));
} catch (ClassNotFoundException e) {
throw new JobPersistenceException(String.format("Could not find class %s for trigger.", triggerMap.get(TRIGGER_CLASS)), e);
}
triggerMap.remove(TRIGGER_CLASS);
OperableTrigger operableTrigger = (OperableTrigger) mapper.convertValue(triggerMap, triggerClass);
operableTrigger.setFireInstanceId(schedulerInstanceId + "-" + operableTrigger.getKey() + "-" + operableTrigger.getStartTime().getTime());
final Map<String, String> jobData = jedis.hgetAll(redisSchema.triggerDataMapHashKey(triggerKey));
if (jobData != null && !jobData.isEmpty()){
JobDataMap jobDataMap = new JobDataMap();
jobDataMap.putAll(jobData);
operableTrigger.setJobDataMap(jobDataMap);
}
return operableTrigger;
} | java | public OperableTrigger retrieveTrigger(TriggerKey triggerKey, T jedis) throws JobPersistenceException{
final String triggerHashKey = redisSchema.triggerHashKey(triggerKey);
Map<String, String> triggerMap = jedis.hgetAll(triggerHashKey);
if(triggerMap == null || triggerMap.isEmpty()){
logger.debug(String.format("No trigger exists for key %s", triggerHashKey));
return null;
}
Class triggerClass;
try {
triggerClass = Class.forName(triggerMap.get(TRIGGER_CLASS));
} catch (ClassNotFoundException e) {
throw new JobPersistenceException(String.format("Could not find class %s for trigger.", triggerMap.get(TRIGGER_CLASS)), e);
}
triggerMap.remove(TRIGGER_CLASS);
OperableTrigger operableTrigger = (OperableTrigger) mapper.convertValue(triggerMap, triggerClass);
operableTrigger.setFireInstanceId(schedulerInstanceId + "-" + operableTrigger.getKey() + "-" + operableTrigger.getStartTime().getTime());
final Map<String, String> jobData = jedis.hgetAll(redisSchema.triggerDataMapHashKey(triggerKey));
if (jobData != null && !jobData.isEmpty()){
JobDataMap jobDataMap = new JobDataMap();
jobDataMap.putAll(jobData);
operableTrigger.setJobDataMap(jobDataMap);
}
return operableTrigger;
} | [
"public",
"OperableTrigger",
"retrieveTrigger",
"(",
"TriggerKey",
"triggerKey",
",",
"T",
"jedis",
")",
"throws",
"JobPersistenceException",
"{",
"final",
"String",
"triggerHashKey",
"=",
"redisSchema",
".",
"triggerHashKey",
"(",
"triggerKey",
")",
";",
"Map",
"<"... | Retrieve a trigger from Redis
@param triggerKey the trigger key
@param jedis a thread-safe Redis connection
@return the requested {@link org.quartz.spi.OperableTrigger} if it exists; null if it does not
@throws JobPersistenceException if the job associated with the retrieved trigger does not exist | [
"Retrieve",
"a",
"trigger",
"from",
"Redis"
] | train | https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java#L278-L301 |
taimos/dvalin | interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/service/DaemonScanner.java | DaemonScanner.isAnnotationPresent | public static boolean isAnnotationPresent(final Class<? extends Annotation> annotation, final Method method) {
final Annotation e = DaemonScanner.getAnnotation(annotation, method);
return e != null;
} | java | public static boolean isAnnotationPresent(final Class<? extends Annotation> annotation, final Method method) {
final Annotation e = DaemonScanner.getAnnotation(annotation, method);
return e != null;
} | [
"public",
"static",
"boolean",
"isAnnotationPresent",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
",",
"final",
"Method",
"method",
")",
"{",
"final",
"Annotation",
"e",
"=",
"DaemonScanner",
".",
"getAnnotation",
"(",
"annotatio... | Checks also the inheritance hierarchy.
@param annotation Annotation
@param method Method
@return Is present? | [
"Checks",
"also",
"the",
"inheritance",
"hierarchy",
"."
] | train | https://github.com/taimos/dvalin/blob/ff8f1bf594e43d7e8ca8de0b4da9f923b66a1a47/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/service/DaemonScanner.java#L134-L137 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java | FileOperations.listFilesFromTask | public PagedList<NodeFile> listFilesFromTask(String jobId, String taskId) throws BatchErrorException, IOException {
return listFilesFromTask(jobId, taskId, null, null, null);
} | java | public PagedList<NodeFile> listFilesFromTask(String jobId, String taskId) throws BatchErrorException, IOException {
return listFilesFromTask(jobId, taskId, null, null, null);
} | [
"public",
"PagedList",
"<",
"NodeFile",
">",
"listFilesFromTask",
"(",
"String",
"jobId",
",",
"String",
"taskId",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"return",
"listFilesFromTask",
"(",
"jobId",
",",
"taskId",
",",
"null",
",",
"null"... | Lists the files in the specified task's directory on its compute node.
@param jobId The ID of the job.
@param taskId The ID of the task.
@return A list of {@link NodeFile} objects.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Lists",
"the",
"files",
"in",
"the",
"specified",
"task",
"s",
"directory",
"on",
"its",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java#L73-L75 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/RegionMap.java | RegionMap.snapToNextHigherInRegionResolution | public Coordinate snapToNextHigherInRegionResolution( double x, double y ) {
double minx = getWest();
double ewres = getXres();
double xsnap = minx + (Math.ceil((x - minx) / ewres) * ewres);
double miny = getSouth();
double nsres = getYres();
double ysnap = miny + (Math.ceil((y - miny) / nsres) * nsres);
return new Coordinate(xsnap, ysnap);
} | java | public Coordinate snapToNextHigherInRegionResolution( double x, double y ) {
double minx = getWest();
double ewres = getXres();
double xsnap = minx + (Math.ceil((x - minx) / ewres) * ewres);
double miny = getSouth();
double nsres = getYres();
double ysnap = miny + (Math.ceil((y - miny) / nsres) * nsres);
return new Coordinate(xsnap, ysnap);
} | [
"public",
"Coordinate",
"snapToNextHigherInRegionResolution",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"double",
"minx",
"=",
"getWest",
"(",
")",
";",
"double",
"ewres",
"=",
"getXres",
"(",
")",
";",
"double",
"xsnap",
"=",
"minx",
"+",
"(",
"... | Snaps a geographic point to be on the region grid.
<p>
Moves the point given by X and Y to be on the grid of the supplied
region.
</p>
@param x the easting of the arbitrary point.
@param y the northing of the arbitrary point.
@return the snapped coordinate. | [
"Snaps",
"a",
"geographic",
"point",
"to",
"be",
"on",
"the",
"region",
"grid",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/RegionMap.java#L180-L191 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/cpnl/CpnlElFunctions.java | CpnlElFunctions.mappedExternalUrl | public static String mappedExternalUrl(SlingHttpServletRequest request, String path) {
return LinkUtil.getAbsoluteUrl(request, LinkUtil.getMappedUrl(request, path));
} | java | public static String mappedExternalUrl(SlingHttpServletRequest request, String path) {
return LinkUtil.getAbsoluteUrl(request, LinkUtil.getMappedUrl(request, path));
} | [
"public",
"static",
"String",
"mappedExternalUrl",
"(",
"SlingHttpServletRequest",
"request",
",",
"String",
"path",
")",
"{",
"return",
"LinkUtil",
".",
"getAbsoluteUrl",
"(",
"request",
",",
"LinkUtil",
".",
"getMappedUrl",
"(",
"request",
",",
"path",
")",
")... | Builds an external (full qualified) URL for a repository path using the LinkUtil.getMappedURL() method.
@param request the current request (domain host hint)
@param path the repository path
@return the URL built in the context of the requested domain host | [
"Builds",
"an",
"external",
"(",
"full",
"qualified",
")",
"URL",
"for",
"a",
"repository",
"path",
"using",
"the",
"LinkUtil",
".",
"getMappedURL",
"()",
"method",
"."
] | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/cpnl/CpnlElFunctions.java#L220-L222 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/WikipediaInfo.java | WikipediaInfo.getNumberOfCategorizedArticles | public int getNumberOfCategorizedArticles(Wikipedia pWiki, CategoryGraph catGraph) throws WikiApiException{
if (categorizedArticleSet == null) { // has not been initialized yet
iterateCategoriesGetArticles(pWiki, catGraph);
}
return categorizedArticleSet.size();
} | java | public int getNumberOfCategorizedArticles(Wikipedia pWiki, CategoryGraph catGraph) throws WikiApiException{
if (categorizedArticleSet == null) { // has not been initialized yet
iterateCategoriesGetArticles(pWiki, catGraph);
}
return categorizedArticleSet.size();
} | [
"public",
"int",
"getNumberOfCategorizedArticles",
"(",
"Wikipedia",
"pWiki",
",",
"CategoryGraph",
"catGraph",
")",
"throws",
"WikiApiException",
"{",
"if",
"(",
"categorizedArticleSet",
"==",
"null",
")",
"{",
"// has not been initialized yet",
"iterateCategoriesGetArticl... | If the return value has been already computed, it is returned, else it is computed at retrieval time.
@param pWiki The wikipedia object.
@param catGraph The category graph.
@return The number of categorized articles, i.e. articles that have at least one category. | [
"If",
"the",
"return",
"value",
"has",
"been",
"already",
"computed",
"it",
"is",
"returned",
"else",
"it",
"is",
"computed",
"at",
"retrieval",
"time",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/WikipediaInfo.java#L287-L292 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java | JavaScriptUtils.getJavaScriptHtmlCookieString | public String getJavaScriptHtmlCookieString(String name, String value) {
return getJavaScriptHtmlCookieString(name, value, null);
} | java | public String getJavaScriptHtmlCookieString(String name, String value) {
return getJavaScriptHtmlCookieString(name, value, null);
} | [
"public",
"String",
"getJavaScriptHtmlCookieString",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"return",
"getJavaScriptHtmlCookieString",
"(",
"name",
",",
"value",
",",
"null",
")",
";",
"}"
] | Creates and returns a JavaScript line that sets a cookie with the specified name and value. For example, a cookie name
of "test" and value of "123" would return {@code document.cookie="test=123;";}. Note: The name and value will be
HTML-encoded. | [
"Creates",
"and",
"returns",
"a",
"JavaScript",
"line",
"that",
"sets",
"a",
"cookie",
"with",
"the",
"specified",
"name",
"and",
"value",
".",
"For",
"example",
"a",
"cookie",
"name",
"of",
"test",
"and",
"value",
"of",
"123",
"would",
"return",
"{"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java#L39-L41 |
sdl/odata | odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java | EntityDataModelUtil.isCollection | public static boolean isCollection(EntityDataModel entityDataModel, String typeName) {
EntitySet entitySet = entityDataModel.getEntityContainer().getEntitySet(typeName);
if (entitySet != null) {
return true;
}
try {
if (Collection.class.isAssignableFrom(Class.forName(typeName))
|| COLLECTION_PATTERN.matcher(typeName).matches()) {
return true;
}
} catch (ClassNotFoundException e) {
LOG.debug("Not possible to find class for type name: {}", typeName);
}
return false;
} | java | public static boolean isCollection(EntityDataModel entityDataModel, String typeName) {
EntitySet entitySet = entityDataModel.getEntityContainer().getEntitySet(typeName);
if (entitySet != null) {
return true;
}
try {
if (Collection.class.isAssignableFrom(Class.forName(typeName))
|| COLLECTION_PATTERN.matcher(typeName).matches()) {
return true;
}
} catch (ClassNotFoundException e) {
LOG.debug("Not possible to find class for type name: {}", typeName);
}
return false;
} | [
"public",
"static",
"boolean",
"isCollection",
"(",
"EntityDataModel",
"entityDataModel",
",",
"String",
"typeName",
")",
"{",
"EntitySet",
"entitySet",
"=",
"entityDataModel",
".",
"getEntityContainer",
"(",
")",
".",
"getEntitySet",
"(",
"typeName",
")",
";",
"i... | Checks if the specified typeName is a collection.
@param entityDataModel The entity data model.
@param typeName The type name to check.
@return True if the type is a collection, False if not | [
"Checks",
"if",
"the",
"specified",
"typeName",
"is",
"a",
"collection",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L671-L686 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.