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 |
|---|---|---|---|---|---|---|---|---|---|---|
xfcjscn/sudoor-server-lib | src/main/java/net/gplatform/sudoor/server/spring/SpringContextsUtil.java | SpringContextsUtil.getBean | public static Object getBean(String name, Class requiredType) throws BeansException {
return applicationContext.getBean(name, requiredType);
} | java | public static Object getBean(String name, Class requiredType) throws BeansException {
return applicationContext.getBean(name, requiredType);
} | [
"public",
"static",
"Object",
"getBean",
"(",
"String",
"name",
",",
"Class",
"requiredType",
")",
"throws",
"BeansException",
"{",
"return",
"applicationContext",
".",
"getBean",
"(",
"name",
",",
"requiredType",
")",
";",
"}"
] | 获取类型为requiredType的对象
如果bean不能被类型转换,相应的异常将会被抛出(BeanNotOfRequiredTypeException)
@param name bean注册名
@param requiredType 返回对象类型
@return Object 返回requiredType类型对象
@throws BeansException | [
"获取类型为requiredType的对象",
"如果bean不能被类型转换,相应的异常将会被抛出(BeanNotOfRequiredTypeException)"
] | train | https://github.com/xfcjscn/sudoor-server-lib/blob/37dc1996eaa9cad25c82abd1de315ba565e32097/src/main/java/net/gplatform/sudoor/server/spring/SpringContextsUtil.java#L88-L90 |
square/okhttp | samples/slack/src/main/java/okhttp3/slack/SlackClient.java | SlackClient.requestOauthSession | public void requestOauthSession(String scopes, String team) throws Exception {
if (sessionFactory == null) {
sessionFactory = new OAuthSessionFactory(slackApi);
sessionFactory.start();
}
HttpUrl authorizeUrl = sessionFactory.newAuthorizeUrl(scopes, team, session -> {
initOauthSession(session);
System.out.printf("session granted: %s\n", session);
});
System.out.printf("open this URL in a browser: %s\n", authorizeUrl);
} | java | public void requestOauthSession(String scopes, String team) throws Exception {
if (sessionFactory == null) {
sessionFactory = new OAuthSessionFactory(slackApi);
sessionFactory.start();
}
HttpUrl authorizeUrl = sessionFactory.newAuthorizeUrl(scopes, team, session -> {
initOauthSession(session);
System.out.printf("session granted: %s\n", session);
});
System.out.printf("open this URL in a browser: %s\n", authorizeUrl);
} | [
"public",
"void",
"requestOauthSession",
"(",
"String",
"scopes",
",",
"String",
"team",
")",
"throws",
"Exception",
"{",
"if",
"(",
"sessionFactory",
"==",
"null",
")",
"{",
"sessionFactory",
"=",
"new",
"OAuthSessionFactory",
"(",
"slackApi",
")",
";",
"sess... | Shows a browser URL to authorize this app to act as this user. | [
"Shows",
"a",
"browser",
"URL",
"to",
"authorize",
"this",
"app",
"to",
"act",
"as",
"this",
"user",
"."
] | train | https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/samples/slack/src/main/java/okhttp3/slack/SlackClient.java#L36-L48 |
playn/playn | core/src/playn/core/Platform.java | Platform.dispatchEvent | public <E> void dispatchEvent (Signal<E> signal, E event) {
try {
signal.emit(event);
} catch (Throwable cause) {
reportError("Event dispatch failure", cause);
}
} | java | public <E> void dispatchEvent (Signal<E> signal, E event) {
try {
signal.emit(event);
} catch (Throwable cause) {
reportError("Event dispatch failure", cause);
}
} | [
"public",
"<",
"E",
">",
"void",
"dispatchEvent",
"(",
"Signal",
"<",
"E",
">",
"signal",
",",
"E",
"event",
")",
"{",
"try",
"{",
"signal",
".",
"emit",
"(",
"event",
")",
";",
"}",
"catch",
"(",
"Throwable",
"cause",
")",
"{",
"reportError",
"(",... | Dispatches {@code event} on {@code signal} and catches any error that propagates out of the
event dispatch, reporting it via {@link #reportError}. | [
"Dispatches",
"{"
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Platform.java#L108-L114 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/decompose/qr/QrHelperFunctions_ZDRM.java | QrHelperFunctions_ZDRM.findMax | public static double findMax( double[] u, int startU , int length ) {
double max = -1;
int index = startU*2;
int stopIndex = (startU + length)*2;
for( ; index < stopIndex;) {
double real = u[index++];
double img = u[index++];
double val = real*real + img*img;
if( val > max ) {
max = val;
}
}
return Math.sqrt(max);
} | java | public static double findMax( double[] u, int startU , int length ) {
double max = -1;
int index = startU*2;
int stopIndex = (startU + length)*2;
for( ; index < stopIndex;) {
double real = u[index++];
double img = u[index++];
double val = real*real + img*img;
if( val > max ) {
max = val;
}
}
return Math.sqrt(max);
} | [
"public",
"static",
"double",
"findMax",
"(",
"double",
"[",
"]",
"u",
",",
"int",
"startU",
",",
"int",
"length",
")",
"{",
"double",
"max",
"=",
"-",
"1",
";",
"int",
"index",
"=",
"startU",
"*",
"2",
";",
"int",
"stopIndex",
"=",
"(",
"startU",
... | Returns the maximum magnitude of the complex numbers
@param u Array of complex numbers
@param startU first index to consider in u
@param length Number of complex numebrs to consider
@return magnitude | [
"Returns",
"the",
"maximum",
"magnitude",
"of",
"the",
"complex",
"numbers"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/decompose/qr/QrHelperFunctions_ZDRM.java#L55-L72 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java | ExpressRouteConnectionsInner.createOrUpdateAsync | public Observable<ExpressRouteConnectionInner> createOrUpdateAsync(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters).map(new Func1<ServiceResponse<ExpressRouteConnectionInner>, ExpressRouteConnectionInner>() {
@Override
public ExpressRouteConnectionInner call(ServiceResponse<ExpressRouteConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteConnectionInner> createOrUpdateAsync(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters).map(new Func1<ServiceResponse<ExpressRouteConnectionInner>, ExpressRouteConnectionInner>() {
@Override
public ExpressRouteConnectionInner call(ServiceResponse<ExpressRouteConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteConnectionInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRouteGatewayName",
",",
"String",
"connectionName",
",",
"ExpressRouteConnectionInner",
"putExpressRouteConnectionParameters",
")",
... | Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param connectionName The name of the connection subresource.
@param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"a",
"connection",
"between",
"an",
"ExpressRoute",
"gateway",
"and",
"an",
"ExpressRoute",
"circuit",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java#L125-L132 |
tacitknowledge/discovery | src/main/java/com/tacitknowledge/util/discovery/ArchiveResourceListSource.java | ArchiveResourceListSource.getResources | private List getResources(ZipFile file, String root)
{
List resourceNames = new ArrayList();
Enumeration e = file.entries();
while (e.hasMoreElements())
{
ZipEntry entry = (ZipEntry) e.nextElement();
String name = entry.getName();
if (name.startsWith(root)
&& !(name.indexOf('/') > root.length())
&& !entry.isDirectory())
{
// Calling File.getPath() cleans up the path so that it's using
// the proper path separators for the host OS
name = new File(name).getPath();
resourceNames.add(name);
}
}
return resourceNames;
} | java | private List getResources(ZipFile file, String root)
{
List resourceNames = new ArrayList();
Enumeration e = file.entries();
while (e.hasMoreElements())
{
ZipEntry entry = (ZipEntry) e.nextElement();
String name = entry.getName();
if (name.startsWith(root)
&& !(name.indexOf('/') > root.length())
&& !entry.isDirectory())
{
// Calling File.getPath() cleans up the path so that it's using
// the proper path separators for the host OS
name = new File(name).getPath();
resourceNames.add(name);
}
}
return resourceNames;
} | [
"private",
"List",
"getResources",
"(",
"ZipFile",
"file",
",",
"String",
"root",
")",
"{",
"List",
"resourceNames",
"=",
"new",
"ArrayList",
"(",
")",
";",
"Enumeration",
"e",
"=",
"file",
".",
"entries",
"(",
")",
";",
"while",
"(",
"e",
".",
"hasMor... | Returns a list of file resources contained in the specified directory
within a given Zip'd archive file.
@param file the zip file containing the resources to return
@param root the directory within the zip file containing the resources
@return a list of file resources contained in the specified directory
within a given Zip'd archive file | [
"Returns",
"a",
"list",
"of",
"file",
"resources",
"contained",
"in",
"the",
"specified",
"directory",
"within",
"a",
"given",
"Zip",
"d",
"archive",
"file",
"."
] | train | https://github.com/tacitknowledge/discovery/blob/700f5492c9cb5c0146d684acb38b71fd4ef4e97a/src/main/java/com/tacitknowledge/util/discovery/ArchiveResourceListSource.java#L95-L114 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/matrix/DiagonalMatrix.java | DiagonalMatrix.checkIndices | private void checkIndices(int row, int col) {
if (row < 0 || col < 0 || row >= values.length || col >= values.length)
throw new ArrayIndexOutOfBoundsException();
} | java | private void checkIndices(int row, int col) {
if (row < 0 || col < 0 || row >= values.length || col >= values.length)
throw new ArrayIndexOutOfBoundsException();
} | [
"private",
"void",
"checkIndices",
"(",
"int",
"row",
",",
"int",
"col",
")",
"{",
"if",
"(",
"row",
"<",
"0",
"||",
"col",
"<",
"0",
"||",
"row",
">=",
"values",
".",
"length",
"||",
"col",
">=",
"values",
".",
"length",
")",
"throw",
"new",
"Ar... | Checks that the given row and column values are non-negative, and less
than the number of diagonals in this {@code DiagonalMatrix}.
@param row The row index to check.
@param col The col index to check.
@throws IllegalArgumentException if either index is invalid. | [
"Checks",
"that",
"the",
"given",
"row",
"and",
"column",
"values",
"are",
"non",
"-",
"negative",
"and",
"less",
"than",
"the",
"number",
"of",
"diagonals",
"in",
"this",
"{",
"@code",
"DiagonalMatrix",
"}",
"."
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/DiagonalMatrix.java#L79-L82 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java | AbstractHibernateCriteriaBuilder.geProperty | public org.grails.datastore.mapping.query.api.Criteria geProperty(String propertyName, String otherPropertyName) {
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [geProperty] with propertyName [" +
propertyName + "] and other property name [" + otherPropertyName + "] not allowed here."));
}
propertyName = calculatePropertyName(propertyName);
otherPropertyName = calculatePropertyName(otherPropertyName);
addToCriteria(Restrictions.geProperty(propertyName, otherPropertyName));
return this;
} | java | public org.grails.datastore.mapping.query.api.Criteria geProperty(String propertyName, String otherPropertyName) {
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [geProperty] with propertyName [" +
propertyName + "] and other property name [" + otherPropertyName + "] not allowed here."));
}
propertyName = calculatePropertyName(propertyName);
otherPropertyName = calculatePropertyName(otherPropertyName);
addToCriteria(Restrictions.geProperty(propertyName, otherPropertyName));
return this;
} | [
"public",
"org",
".",
"grails",
".",
"datastore",
".",
"mapping",
".",
"query",
".",
"api",
".",
"Criteria",
"geProperty",
"(",
"String",
"propertyName",
",",
"String",
"otherPropertyName",
")",
"{",
"if",
"(",
"!",
"validateSimpleExpression",
"(",
")",
")",... | Creates a Criterion that tests if the first property is greater than or equal to the second property
@param propertyName The first property name
@param otherPropertyName The second property name
@return A Criterion instance | [
"Creates",
"a",
"Criterion",
"that",
"tests",
"if",
"the",
"first",
"property",
"is",
"greater",
"than",
"or",
"equal",
"to",
"the",
"second",
"property"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java#L639-L649 |
apache/incubator-heron | heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java | SchedulerStateManagerAdaptor.updatePackingPlan | public Boolean updatePackingPlan(PackingPlans.PackingPlan packingPlan, String topologyName) {
if (getPackingPlan(topologyName) != null) {
deletePackingPlan(topologyName);
}
return setPackingPlan(packingPlan, topologyName);
} | java | public Boolean updatePackingPlan(PackingPlans.PackingPlan packingPlan, String topologyName) {
if (getPackingPlan(topologyName) != null) {
deletePackingPlan(topologyName);
}
return setPackingPlan(packingPlan, topologyName);
} | [
"public",
"Boolean",
"updatePackingPlan",
"(",
"PackingPlans",
".",
"PackingPlan",
"packingPlan",
",",
"String",
"topologyName",
")",
"{",
"if",
"(",
"getPackingPlan",
"(",
"topologyName",
")",
"!=",
"null",
")",
"{",
"deletePackingPlan",
"(",
"topologyName",
")",... | Update the packing plan for the given topology. If the packing plan doesn't exist, create it.
If it does, update it.
@param packingPlan the packing plan of the topology
@return Boolean - Success or Failure | [
"Update",
"the",
"packing",
"plan",
"for",
"the",
"given",
"topology",
".",
"If",
"the",
"packing",
"plan",
"doesn",
"t",
"exist",
"create",
"it",
".",
"If",
"it",
"does",
"update",
"it",
"."
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java#L164-L169 |
bozaro/git-lfs-java | gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java | Client.putObject | public boolean putObject(@NotNull final StreamProvider streamProvider, @NotNull final Meta meta, @NotNull final Links links) throws IOException {
if (links.getLinks().containsKey(LinkType.Download)) {
return false;
}
final Link uploadLink = links.getLinks().get(LinkType.Upload);
if (uploadLink == null) {
throw new IOException("Upload link not found");
}
doRequest(uploadLink, new ObjectPut(streamProvider, meta.getSize()), uploadLink.getHref());
final Link verifyLink = links.getLinks().get(LinkType.Verify);
if (verifyLink != null) {
doRequest(verifyLink, new ObjectVerify(meta), verifyLink.getHref());
}
return true;
} | java | public boolean putObject(@NotNull final StreamProvider streamProvider, @NotNull final Meta meta, @NotNull final Links links) throws IOException {
if (links.getLinks().containsKey(LinkType.Download)) {
return false;
}
final Link uploadLink = links.getLinks().get(LinkType.Upload);
if (uploadLink == null) {
throw new IOException("Upload link not found");
}
doRequest(uploadLink, new ObjectPut(streamProvider, meta.getSize()), uploadLink.getHref());
final Link verifyLink = links.getLinks().get(LinkType.Verify);
if (verifyLink != null) {
doRequest(verifyLink, new ObjectVerify(meta), verifyLink.getHref());
}
return true;
} | [
"public",
"boolean",
"putObject",
"(",
"@",
"NotNull",
"final",
"StreamProvider",
"streamProvider",
",",
"@",
"NotNull",
"final",
"Meta",
"meta",
",",
"@",
"NotNull",
"final",
"Links",
"links",
")",
"throws",
"IOException",
"{",
"if",
"(",
"links",
".",
"get... | Upload object by metadata.
@param links Object links.
@param streamProvider Object stream provider.
@param meta Object metadata.
@return Return true is object is uploaded successfully and false if object is already uploaded.
@throws IOException On some errors. | [
"Upload",
"object",
"by",
"metadata",
"."
] | train | https://github.com/bozaro/git-lfs-java/blob/ee05bf0472ee61bf362cf93d283e5ee5d44ef685/gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java#L230-L245 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerFactoryBaseImpl.java | PersistenceBrokerFactoryBaseImpl.createPersistenceBroker | public PersistenceBrokerInternal createPersistenceBroker(PBKey pbKey) throws PBFactoryException
{
if (log.isDebugEnabled()) log.debug("Obtain broker from pool, used PBKey is " + pbKey);
/*
try to find a valid PBKey, if given key does not full match
*/
pbKey = BrokerHelper.crossCheckPBKey(pbKey);
try
{
return createNewBrokerInstance(pbKey);
}
catch (Exception e)
{
throw new PBFactoryException("Borrow broker from pool failed, using PBKey " + pbKey, e);
}
} | java | public PersistenceBrokerInternal createPersistenceBroker(PBKey pbKey) throws PBFactoryException
{
if (log.isDebugEnabled()) log.debug("Obtain broker from pool, used PBKey is " + pbKey);
/*
try to find a valid PBKey, if given key does not full match
*/
pbKey = BrokerHelper.crossCheckPBKey(pbKey);
try
{
return createNewBrokerInstance(pbKey);
}
catch (Exception e)
{
throw new PBFactoryException("Borrow broker from pool failed, using PBKey " + pbKey, e);
}
} | [
"public",
"PersistenceBrokerInternal",
"createPersistenceBroker",
"(",
"PBKey",
"pbKey",
")",
"throws",
"PBFactoryException",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"\"Obtain broker from pool, used PBKey is \"",
"+",
"pb... | Always return a new created {@link PersistenceBroker} instance
@param pbKey
@return
@throws PBFactoryException | [
"Always",
"return",
"a",
"new",
"created",
"{",
"@link",
"PersistenceBroker",
"}",
"instance"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerFactoryBaseImpl.java#L124-L142 |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/TargetAssignmentOperations.java | TargetAssignmentOperations.createAssignmentTab | public static ConfirmationTab createAssignmentTab(
final ActionTypeOptionGroupAssignmentLayout actionTypeOptionGroupLayout,
final MaintenanceWindowLayout maintenanceWindowLayout, final Consumer<Boolean> saveButtonToggle,
final VaadinMessageSource i18n, final UiProperties uiProperties) {
final CheckBox maintenanceWindowControl = maintenanceWindowControl(i18n, maintenanceWindowLayout,
saveButtonToggle);
final Link maintenanceWindowHelpLink = maintenanceWindowHelpLinkControl(uiProperties, i18n);
final HorizontalLayout layout = createHorizontalLayout(maintenanceWindowControl, maintenanceWindowHelpLink);
actionTypeOptionGroupLayout.selectDefaultOption();
initMaintenanceWindow(maintenanceWindowLayout, saveButtonToggle);
addValueChangeListener(actionTypeOptionGroupLayout, maintenanceWindowControl, maintenanceWindowHelpLink);
return createAssignmentTab(actionTypeOptionGroupLayout, layout, maintenanceWindowLayout);
} | java | public static ConfirmationTab createAssignmentTab(
final ActionTypeOptionGroupAssignmentLayout actionTypeOptionGroupLayout,
final MaintenanceWindowLayout maintenanceWindowLayout, final Consumer<Boolean> saveButtonToggle,
final VaadinMessageSource i18n, final UiProperties uiProperties) {
final CheckBox maintenanceWindowControl = maintenanceWindowControl(i18n, maintenanceWindowLayout,
saveButtonToggle);
final Link maintenanceWindowHelpLink = maintenanceWindowHelpLinkControl(uiProperties, i18n);
final HorizontalLayout layout = createHorizontalLayout(maintenanceWindowControl, maintenanceWindowHelpLink);
actionTypeOptionGroupLayout.selectDefaultOption();
initMaintenanceWindow(maintenanceWindowLayout, saveButtonToggle);
addValueChangeListener(actionTypeOptionGroupLayout, maintenanceWindowControl, maintenanceWindowHelpLink);
return createAssignmentTab(actionTypeOptionGroupLayout, layout, maintenanceWindowLayout);
} | [
"public",
"static",
"ConfirmationTab",
"createAssignmentTab",
"(",
"final",
"ActionTypeOptionGroupAssignmentLayout",
"actionTypeOptionGroupLayout",
",",
"final",
"MaintenanceWindowLayout",
"maintenanceWindowLayout",
",",
"final",
"Consumer",
"<",
"Boolean",
">",
"saveButtonToggle... | Create the Assignment Confirmation Tab
@param actionTypeOptionGroupLayout
the action Type Option Group Layout
@param maintenanceWindowLayout
the Maintenance Window Layout
@param saveButtonToggle
The event listener to derimne if save button should be enabled or not
@param i18n
the Vaadin Message Source for multi language
@param uiProperties
the UI Properties
@return the Assignment Confirmation tab | [
"Create",
"the",
"Assignment",
"Confirmation",
"Tab"
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/TargetAssignmentOperations.java#L197-L211 |
buschmais/jqa-java-plugin | src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java | VisitorHelper.getVariableDescriptor | VariableDescriptor getVariableDescriptor(String name, String signature) {
VariableDescriptor variableDescriptor = scannerContext.getStore().create(VariableDescriptor.class);
variableDescriptor.setName(name);
variableDescriptor.setSignature(signature);
return variableDescriptor;
} | java | VariableDescriptor getVariableDescriptor(String name, String signature) {
VariableDescriptor variableDescriptor = scannerContext.getStore().create(VariableDescriptor.class);
variableDescriptor.setName(name);
variableDescriptor.setSignature(signature);
return variableDescriptor;
} | [
"VariableDescriptor",
"getVariableDescriptor",
"(",
"String",
"name",
",",
"String",
"signature",
")",
"{",
"VariableDescriptor",
"variableDescriptor",
"=",
"scannerContext",
".",
"getStore",
"(",
")",
".",
"create",
"(",
"VariableDescriptor",
".",
"class",
")",
";"... | Return the field descriptor for the given type and field signature.
@param name
The variable name.
@param signature
The variable signature.
@return The field descriptor. | [
"Return",
"the",
"field",
"descriptor",
"for",
"the",
"given",
"type",
"and",
"field",
"signature",
"."
] | train | https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java#L199-L204 |
timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/destination/DestinationTools.java | DestinationTools.asRef | public static DestinationRef asRef( Destination destination ) throws JMSException
{
if (destination == null)
return null;
if (destination instanceof DestinationRef)
return (DestinationRef)destination;
if (destination instanceof Queue)
return new QueueRef(((Queue)destination).getQueueName());
if (destination instanceof Topic)
return new TopicRef(((Topic)destination).getTopicName());
throw new InvalidDestinationException("Unsupported destination type : "+destination,"INVALID_DESTINATION");
} | java | public static DestinationRef asRef( Destination destination ) throws JMSException
{
if (destination == null)
return null;
if (destination instanceof DestinationRef)
return (DestinationRef)destination;
if (destination instanceof Queue)
return new QueueRef(((Queue)destination).getQueueName());
if (destination instanceof Topic)
return new TopicRef(((Topic)destination).getTopicName());
throw new InvalidDestinationException("Unsupported destination type : "+destination,"INVALID_DESTINATION");
} | [
"public",
"static",
"DestinationRef",
"asRef",
"(",
"Destination",
"destination",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"destination",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"destination",
"instanceof",
"DestinationRef",
")",
"return",
"("... | Make sure the given destination is a light-weight serializable destination reference | [
"Make",
"sure",
"the",
"given",
"destination",
"is",
"a",
"light",
"-",
"weight",
"serializable",
"destination",
"reference"
] | train | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/destination/DestinationTools.java#L38-L53 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java | BoundedOverlay.isWithinBoundingBox | public boolean isWithinBoundingBox(int x, int y, int zoom) {
boolean withinBounds = true;
// If a bounding box is set, check if it overlaps with the request
if (webMercatorBoundingBox != null) {
// Get the bounding box of the requested tile
BoundingBox tileWebMercatorBoundingBox = TileBoundingBoxUtils
.getWebMercatorBoundingBox(x, y, zoom);
// Adjust the bounding box if needed
BoundingBox adjustedWebMercatorBoundingBox = getWebMercatorBoundingBox(tileWebMercatorBoundingBox);
// Check if the request overlaps
withinBounds = adjustedWebMercatorBoundingBox.intersects(
tileWebMercatorBoundingBox, true);
}
return withinBounds;
} | java | public boolean isWithinBoundingBox(int x, int y, int zoom) {
boolean withinBounds = true;
// If a bounding box is set, check if it overlaps with the request
if (webMercatorBoundingBox != null) {
// Get the bounding box of the requested tile
BoundingBox tileWebMercatorBoundingBox = TileBoundingBoxUtils
.getWebMercatorBoundingBox(x, y, zoom);
// Adjust the bounding box if needed
BoundingBox adjustedWebMercatorBoundingBox = getWebMercatorBoundingBox(tileWebMercatorBoundingBox);
// Check if the request overlaps
withinBounds = adjustedWebMercatorBoundingBox.intersects(
tileWebMercatorBoundingBox, true);
}
return withinBounds;
} | [
"public",
"boolean",
"isWithinBoundingBox",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"zoom",
")",
"{",
"boolean",
"withinBounds",
"=",
"true",
";",
"// If a bounding box is set, check if it overlaps with the request",
"if",
"(",
"webMercatorBoundingBox",
"!=",
"n... | Check if the tile request is within the desired tile bounds
@param x x coordinate
@param y y coordinate
@param zoom zoom value
@return true if within bounds | [
"Check",
"if",
"the",
"tile",
"request",
"is",
"within",
"the",
"desired",
"tile",
"bounds"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java#L213-L232 |
haifengl/smile | core/src/main/java/smile/association/FPGrowth.java | FPGrowth.getLocalItemSupport | private boolean getLocalItemSupport(FPTree.Node node, int[] localItemSupport) {
boolean end = true;
Arrays.fill(localItemSupport, 0);
while (node != null) {
int support = node.count;
Node parent = node.parent;
while (parent != null) {
localItemSupport[parent.id] += support;
parent = parent.parent;
end = false;
}
node = node.next;
}
return !end;
} | java | private boolean getLocalItemSupport(FPTree.Node node, int[] localItemSupport) {
boolean end = true;
Arrays.fill(localItemSupport, 0);
while (node != null) {
int support = node.count;
Node parent = node.parent;
while (parent != null) {
localItemSupport[parent.id] += support;
parent = parent.parent;
end = false;
}
node = node.next;
}
return !end;
} | [
"private",
"boolean",
"getLocalItemSupport",
"(",
"FPTree",
".",
"Node",
"node",
",",
"int",
"[",
"]",
"localItemSupport",
")",
"{",
"boolean",
"end",
"=",
"true",
";",
"Arrays",
".",
"fill",
"(",
"localItemSupport",
",",
"0",
")",
";",
"while",
"(",
"no... | Counts the supports of single items in ancestor item sets linked list.
@return true if there are condition patterns given this node | [
"Counts",
"the",
"supports",
"of",
"single",
"items",
"in",
"ancestor",
"item",
"sets",
"linked",
"list",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/FPGrowth.java#L421-L437 |
sagiegurari/fax4j | src/main/java/org/fax4j/util/IOHelper.java | IOHelper.readAndWriteStreams | public static void readAndWriteStreams(InputStream inputStream,OutputStream outputStream) throws IOException
{
byte[] buffer=new byte[5000];
int read=-1;
try
{
do
{
//read next buffer
read=inputStream.read(buffer);
if(read!=-1)
{
//write to in memory stream
outputStream.write(buffer,0,read);
}
}while(read!=-1);
}
finally
{
//close streams
IOHelper.closeResource(inputStream);
IOHelper.closeResource(outputStream);
}
} | java | public static void readAndWriteStreams(InputStream inputStream,OutputStream outputStream) throws IOException
{
byte[] buffer=new byte[5000];
int read=-1;
try
{
do
{
//read next buffer
read=inputStream.read(buffer);
if(read!=-1)
{
//write to in memory stream
outputStream.write(buffer,0,read);
}
}while(read!=-1);
}
finally
{
//close streams
IOHelper.closeResource(inputStream);
IOHelper.closeResource(outputStream);
}
} | [
"public",
"static",
"void",
"readAndWriteStreams",
"(",
"InputStream",
"inputStream",
",",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"5000",
"]",
";",
"int",
"read",
"=",
"-",
"1",... | Reads the data from the input stream and writes to the
output stream.
@param inputStream
The inputStream to read from
@param outputStream
The output stream to write to
@throws IOException
Any IO exception | [
"Reads",
"the",
"data",
"from",
"the",
"input",
"stream",
"and",
"writes",
"to",
"the",
"output",
"stream",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/util/IOHelper.java#L384-L408 |
mkolisnyk/cucumber-reports | cucumber-runner/src/main/java/com/github/mkolisnyk/cucumber/assertions/LazyAssert.java | LazyAssert.assertThat | public static <T> void assertThat(T actual, Matcher<? super T> matcher) {
assertThat("", actual, matcher);
} | java | public static <T> void assertThat(T actual, Matcher<? super T> matcher) {
assertThat("", actual, matcher);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"assertThat",
"(",
"T",
"actual",
",",
"Matcher",
"<",
"?",
"super",
"T",
">",
"matcher",
")",
"{",
"assertThat",
"(",
"\"\"",
",",
"actual",
",",
"matcher",
")",
";",
"}"
] | Asserts that <code>actual</code> satisfies the condition specified by
<code>matcher</code>. If not, an {@link LazyAssertionError} is thrown with
information about the matcher and failing value. Example:
<pre>
assertThat(0, is(1)); // fails:
// failure message:
// expected: is <1>
// got value: <0>
assertThat(0, is(not(1))) // passes
</pre>
<code>org.hamcrest.Matcher</code> does not currently document the meaning
of its type parameter <code>T</code>. This method assumes that a matcher
typed as <code>Matcher<T></code> can be meaningfully applied only
to values that could be assigned to a variable of type <code>T</code>.
@param <T> the static type accepted by the matcher (this can flag obvious
compile-time problems such as {@code assertThat(1, is("a"))}
@param actual the computed value being compared
@param matcher an expression, built of {@link Matcher}s, specifying allowed
values
@see org.hamcrest.CoreMatchers
@see org.hamcrest.MatcherAssert | [
"Asserts",
"that",
"<code",
">",
"actual<",
"/",
"code",
">",
"satisfies",
"the",
"condition",
"specified",
"by",
"<code",
">",
"matcher<",
"/",
"code",
">",
".",
"If",
"not",
"an",
"{",
"@link",
"LazyAssertionError",
"}",
"is",
"thrown",
"with",
"informat... | train | https://github.com/mkolisnyk/cucumber-reports/blob/9c9a32f15f0bf1eb1d3d181a11bae9c5eec84a8e/cucumber-runner/src/main/java/com/github/mkolisnyk/cucumber/assertions/LazyAssert.java#L922-L924 |
stephanenicolas/toothpick | toothpick-runtime/src/main/java/toothpick/ScopeImpl.java | ScopeImpl.getUnBoundProvider | private <T> InternalProviderImpl<? extends T> getUnBoundProvider(Class<T> clazz, String bindingName) {
return getInternalProvider(clazz, bindingName, false);
} | java | private <T> InternalProviderImpl<? extends T> getUnBoundProvider(Class<T> clazz, String bindingName) {
return getInternalProvider(clazz, bindingName, false);
} | [
"private",
"<",
"T",
">",
"InternalProviderImpl",
"<",
"?",
"extends",
"T",
">",
"getUnBoundProvider",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"bindingName",
")",
"{",
"return",
"getInternalProvider",
"(",
"clazz",
",",
"bindingName",
",",
"fals... | Obtains the provider of the class {@code clazz} and name {@code bindingName}, if any. The returned provider
will belong to the pool of unbound providers. It can be {@code null} if there is no such provider.
@param clazz the class for which to obtain the unbound provider.
@param bindingName the name, possibly {@code null}, for which to obtain the unbound provider.
@param <T> the type of {@code clazz}.
@return the unbound provider for class {@code clazz} and {@code bindingName}. Returns {@code null} is there
is no such unbound provider. | [
"Obtains",
"the",
"provider",
"of",
"the",
"class",
"{",
"@code",
"clazz",
"}",
"and",
"name",
"{",
"@code",
"bindingName",
"}",
"if",
"any",
".",
"The",
"returned",
"provider",
"will",
"belong",
"to",
"the",
"pool",
"of",
"unbound",
"providers",
".",
"I... | train | https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-runtime/src/main/java/toothpick/ScopeImpl.java#L376-L378 |
JodaOrg/joda-money | src/main/java/org/joda/money/CurrencyUnit.java | CurrencyUnit.registerCurrency | public static synchronized CurrencyUnit registerCurrency(
String currencyCode,
int numericCurrencyCode,
int decimalPlaces,
boolean force) {
List<String> countryCodes = Collections.emptyList();
return registerCurrency(currencyCode, numericCurrencyCode, decimalPlaces, countryCodes, force);
} | java | public static synchronized CurrencyUnit registerCurrency(
String currencyCode,
int numericCurrencyCode,
int decimalPlaces,
boolean force) {
List<String> countryCodes = Collections.emptyList();
return registerCurrency(currencyCode, numericCurrencyCode, decimalPlaces, countryCodes, force);
} | [
"public",
"static",
"synchronized",
"CurrencyUnit",
"registerCurrency",
"(",
"String",
"currencyCode",
",",
"int",
"numericCurrencyCode",
",",
"int",
"decimalPlaces",
",",
"boolean",
"force",
")",
"{",
"List",
"<",
"String",
">",
"countryCodes",
"=",
"Collections",
... | Registers a currency allowing it to be used, allowing replacement.
<p>
This class only permits known currencies to be returned.
To achieve this, all currencies have to be registered in advance.
<p>
Since this method is public, it is possible to add currencies in
application code. It is recommended to do this only at startup, however
it is safe to do so later as the internal implementation is thread-safe.
<p>
This method uses a flag to determine whether the registered currency
must be new, or can replace an existing currency.
<p>
The currency code must be three upper-case ASCII letters, based on ISO-4217.
The numeric code must be from 0 to 999, or -1 if not applicable.
@param currencyCode the three-letter upper-case currency code, not null
@param numericCurrencyCode the numeric currency code, from 0 to 999, -1 if none
@param decimalPlaces the number of decimal places that the currency
normally has, from 0 to 30 (normally 0, 2 or 3), or -1 for a pseudo-currency
use of ISO-3166 is recommended, not null
@param force true to register forcefully, replacing any existing matching currency,
false to validate that there is no existing matching currency
@return the new instance, never null
@throws IllegalArgumentException if the code is already registered and {@code force} is false;
or if the specified data is invalid | [
"Registers",
"a",
"currency",
"allowing",
"it",
"to",
"be",
"used",
"allowing",
"replacement",
".",
"<p",
">",
"This",
"class",
"only",
"permits",
"known",
"currencies",
"to",
"be",
"returned",
".",
"To",
"achieve",
"this",
"all",
"currencies",
"have",
"to",... | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/CurrencyUnit.java#L265-L273 |
FXMisc/WellBehavedFX | src/main/java/org/fxmisc/wellbehaved/event/Nodes.java | Nodes.popInputMap | public static boolean popInputMap(Node node) {
Stack<InputMap<?>> stackedInputMaps = getStack(node);
if (!stackedInputMaps.isEmpty()) {
// If stack is not empty, node has already been initialized, so can use unsafe methods.
// Now, completely override current input map with previous one on stack
setInputMapUnsafe(node, stackedInputMaps.pop());
return true;
} else {
return false;
}
} | java | public static boolean popInputMap(Node node) {
Stack<InputMap<?>> stackedInputMaps = getStack(node);
if (!stackedInputMaps.isEmpty()) {
// If stack is not empty, node has already been initialized, so can use unsafe methods.
// Now, completely override current input map with previous one on stack
setInputMapUnsafe(node, stackedInputMaps.pop());
return true;
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"popInputMap",
"(",
"Node",
"node",
")",
"{",
"Stack",
"<",
"InputMap",
"<",
"?",
">",
">",
"stackedInputMaps",
"=",
"getStack",
"(",
"node",
")",
";",
"if",
"(",
"!",
"stackedInputMaps",
".",
"isEmpty",
"(",
")",
")",
"{... | If the internal stack has an {@link InputMap}, removes the current {@link InputMap} that was installed
on the give node via {@link #pushInputMap(Node, InputMap)}, reinstalls the previous {@code InputMap},
and then returns true. If the stack is empty, returns false. | [
"If",
"the",
"internal",
"stack",
"has",
"an",
"{"
] | train | https://github.com/FXMisc/WellBehavedFX/blob/ca889734481f5439655ca8deb6f742964b5654b0/src/main/java/org/fxmisc/wellbehaved/event/Nodes.java#L102-L112 |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.deployModule | private void deployModule(final Node node, final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
log.debug(String.format("%s - Deploying %s to %s", NetworkManager.this, instance.component().asModule().module(), node.address()));
node.deployModule(instance.component().asModule().module(), Components.buildConfig(instance, cluster), 1, new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
if (result.failed()) {
counter.fail(result.cause());
} else {
deploymentIDs.put(instance.address(), result.result(), new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
counter.succeed();
}
});
}
}
});
} | java | private void deployModule(final Node node, final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
log.debug(String.format("%s - Deploying %s to %s", NetworkManager.this, instance.component().asModule().module(), node.address()));
node.deployModule(instance.component().asModule().module(), Components.buildConfig(instance, cluster), 1, new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
if (result.failed()) {
counter.fail(result.cause());
} else {
deploymentIDs.put(instance.address(), result.result(), new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
counter.succeed();
}
});
}
}
});
} | [
"private",
"void",
"deployModule",
"(",
"final",
"Node",
"node",
",",
"final",
"InstanceContext",
"instance",
",",
"final",
"CountingCompletionHandler",
"<",
"Void",
">",
"counter",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"%s - Depl... | Deploys a module component instance in the network's cluster. | [
"Deploys",
"a",
"module",
"component",
"instance",
"in",
"the",
"network",
"s",
"cluster",
"."
] | train | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L833-L850 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newSystemException | public static SystemException newSystemException(String message, Object... args) {
return newSystemException(null, message, args);
} | java | public static SystemException newSystemException(String message, Object... args) {
return newSystemException(null, message, args);
} | [
"public",
"static",
"SystemException",
"newSystemException",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"newSystemException",
"(",
"null",
",",
"message",
",",
"args",
")",
";",
"}"
] | Constructs and initializes a new {@link SystemException} with the given {@link String message}
formatted with the given {@link Object[] arguments}.
@param message {@link String} describing the {@link SystemException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link SystemException} with the given {@link String message}.
@see #newSystemException(Throwable, String, Object...)
@see org.cp.elements.util.SystemException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"SystemException",
"}",
"with",
"the",
"given",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",
"[]",
"arguments",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L901-L903 |
netty/netty | handler/src/main/java/io/netty/handler/logging/LoggingHandler.java | LoggingHandler.formatSimple | private static String formatSimple(ChannelHandlerContext ctx, String eventName, Object msg) {
String chStr = ctx.channel().toString();
String msgStr = String.valueOf(msg);
StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + msgStr.length());
return buf.append(chStr).append(' ').append(eventName).append(": ").append(msgStr).toString();
} | java | private static String formatSimple(ChannelHandlerContext ctx, String eventName, Object msg) {
String chStr = ctx.channel().toString();
String msgStr = String.valueOf(msg);
StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + msgStr.length());
return buf.append(chStr).append(' ').append(eventName).append(": ").append(msgStr).toString();
} | [
"private",
"static",
"String",
"formatSimple",
"(",
"ChannelHandlerContext",
"ctx",
",",
"String",
"eventName",
",",
"Object",
"msg",
")",
"{",
"String",
"chStr",
"=",
"ctx",
".",
"channel",
"(",
")",
".",
"toString",
"(",
")",
";",
"String",
"msgStr",
"="... | Generates the default log message of the specified event whose argument is an arbitrary object. | [
"Generates",
"the",
"default",
"log",
"message",
"of",
"the",
"specified",
"event",
"whose",
"argument",
"is",
"an",
"arbitrary",
"object",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/logging/LoggingHandler.java#L369-L374 |
UrielCh/ovh-java-sdk | ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java | ApiOvhPrice.dedicated_server_ip_routedTo_GET | public OvhPrice dedicated_server_ip_routedTo_GET(net.minidev.ovh.api.price.dedicated.server.OvhIpEnum routedTo) throws IOException {
String qPath = "/price/dedicated/server/ip/{routedTo}";
StringBuilder sb = path(qPath, routedTo);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | java | public OvhPrice dedicated_server_ip_routedTo_GET(net.minidev.ovh.api.price.dedicated.server.OvhIpEnum routedTo) throws IOException {
String qPath = "/price/dedicated/server/ip/{routedTo}";
StringBuilder sb = path(qPath, routedTo);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | [
"public",
"OvhPrice",
"dedicated_server_ip_routedTo_GET",
"(",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"price",
".",
"dedicated",
".",
"server",
".",
"OvhIpEnum",
"routedTo",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/price/dedica... | Get price of IPs
REST: GET /price/dedicated/server/ip/{routedTo}
@param routedTo [required] Ip | [
"Get",
"price",
"of",
"IPs"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java#L128-L133 |
amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.ofCombinations | public static StreamEx<int[]> ofCombinations(int n, int k) {
checkNonNegative("k", k);
checkNonNegative("n", n);
if (k > n) {
return StreamEx.empty();
}
if (k == 0) {
return StreamEx.of(new int[0]);
}
long size = CombinationSpliterator.cnk(n, k);
int[] value = new int[k];
for (int i = 0; i < k; i++) {
value[i] = i;
}
return StreamEx.of(new CombinationSpliterator(n, size, 0, value));
} | java | public static StreamEx<int[]> ofCombinations(int n, int k) {
checkNonNegative("k", k);
checkNonNegative("n", n);
if (k > n) {
return StreamEx.empty();
}
if (k == 0) {
return StreamEx.of(new int[0]);
}
long size = CombinationSpliterator.cnk(n, k);
int[] value = new int[k];
for (int i = 0; i < k; i++) {
value[i] = i;
}
return StreamEx.of(new CombinationSpliterator(n, size, 0, value));
} | [
"public",
"static",
"StreamEx",
"<",
"int",
"[",
"]",
">",
"ofCombinations",
"(",
"int",
"n",
",",
"int",
"k",
")",
"{",
"checkNonNegative",
"(",
"\"k\"",
",",
"k",
")",
";",
"checkNonNegative",
"(",
"\"n\"",
",",
"n",
")",
";",
"if",
"(",
"k",
">"... | Returns a new {@code StreamEx} of {@code int[]} arrays containing all the possible combinations of length {@code
k} consisting of numbers from 0 to {@code n-1} in lexicographic order.
<p>
Example: {@code StreamEx.ofCombinations(3, 2)} returns the stream of three elements: {@code [0, 1]}, {@code [0,
2]} and {@code [1, 2]} in this order.
@param n number of possible distinct elements
@param k number of elements in each combination
@return new sequential stream of possible combinations. Returns an empty stream if {@code k} is bigger
than {@code n}.
@throws IllegalArgumentException if n or k is negative or number of possible combinations exceeds {@code
Long.MAX_VALUE}.
@since 0.6.7 | [
"Returns",
"a",
"new",
"{",
"@code",
"StreamEx",
"}",
"of",
"{",
"@code",
"int",
"[]",
"}",
"arrays",
"containing",
"all",
"the",
"possible",
"combinations",
"of",
"length",
"{",
"@code",
"k",
"}",
"consisting",
"of",
"numbers",
"from",
"0",
"to",
"{",
... | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L2511-L2527 |
joelittlejohn/jsonschema2pojo | jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/TitleRule.java | TitleRule.apply | @Override
public JDocComment apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema schema) {
JDocComment javadoc = generatableType.javadoc();
javadoc.add(0, node.asText() + "\n<p>\n");
return javadoc;
} | java | @Override
public JDocComment apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema schema) {
JDocComment javadoc = generatableType.javadoc();
javadoc.add(0, node.asText() + "\n<p>\n");
return javadoc;
} | [
"@",
"Override",
"public",
"JDocComment",
"apply",
"(",
"String",
"nodeName",
",",
"JsonNode",
"node",
",",
"JsonNode",
"parent",
",",
"JDocCommentable",
"generatableType",
",",
"Schema",
"schema",
")",
"{",
"JDocComment",
"javadoc",
"=",
"generatableType",
".",
... | Applies this schema rule to take the required code generation steps.
<p>
When a title node is found and applied with this rule, the value of the
title is added as a JavaDoc comment. This rule is typically applied to
the generated field, generated getter and generated setter for the
property.
<p>
Note that the title is always inserted at the top of the JavaDoc comment.
@param nodeName
the name of the property to which this title applies
@param node
the "title" schema node
@param parent
the parent node
@param generatableType
comment-able code generation construct, usually a field or
method, which should have this title applied
@return the JavaDoc comment created to contain the title | [
"Applies",
"this",
"schema",
"rule",
"to",
"take",
"the",
"required",
"code",
"generation",
"steps",
".",
"<p",
">",
"When",
"a",
"title",
"node",
"is",
"found",
"and",
"applied",
"with",
"this",
"rule",
"the",
"value",
"of",
"the",
"title",
"is",
"added... | train | https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/TitleRule.java#L56-L63 |
Jasig/uPortal | uPortal-web/src/main/java/org/apereo/portal/portlet/rendering/PortletRendererImpl.java | PortletRendererImpl.doRenderReplayCachedContent | protected PortletRenderResult doRenderReplayCachedContent(
IPortletWindow portletWindow,
HttpServletRequest httpServletRequest,
CacheState<CachedPortletData<PortletRenderResult>, PortletRenderResult> cacheState,
PortletOutputHandler portletOutputHandler,
RenderPart renderPart,
long baseExecutionTime)
throws IOException {
enforceConfigPermission(httpServletRequest, portletWindow);
logger.debug(
"Replaying cached content for Render {} request to {}", renderPart, portletWindow);
final long renderStartTime = System.nanoTime();
final CachedPortletData<PortletRenderResult> cachedPortletData =
cacheState.getCachedPortletData();
cachedPortletData.replay(portletOutputHandler);
final long executionTime = baseExecutionTime + (System.nanoTime() - renderStartTime);
publishRenderEvent(portletWindow, httpServletRequest, renderPart, executionTime, true);
final PortletRenderResult portletResult = cachedPortletData.getPortletResult();
return new PortletRenderResult(portletResult, executionTime);
} | java | protected PortletRenderResult doRenderReplayCachedContent(
IPortletWindow portletWindow,
HttpServletRequest httpServletRequest,
CacheState<CachedPortletData<PortletRenderResult>, PortletRenderResult> cacheState,
PortletOutputHandler portletOutputHandler,
RenderPart renderPart,
long baseExecutionTime)
throws IOException {
enforceConfigPermission(httpServletRequest, portletWindow);
logger.debug(
"Replaying cached content for Render {} request to {}", renderPart, portletWindow);
final long renderStartTime = System.nanoTime();
final CachedPortletData<PortletRenderResult> cachedPortletData =
cacheState.getCachedPortletData();
cachedPortletData.replay(portletOutputHandler);
final long executionTime = baseExecutionTime + (System.nanoTime() - renderStartTime);
publishRenderEvent(portletWindow, httpServletRequest, renderPart, executionTime, true);
final PortletRenderResult portletResult = cachedPortletData.getPortletResult();
return new PortletRenderResult(portletResult, executionTime);
} | [
"protected",
"PortletRenderResult",
"doRenderReplayCachedContent",
"(",
"IPortletWindow",
"portletWindow",
",",
"HttpServletRequest",
"httpServletRequest",
",",
"CacheState",
"<",
"CachedPortletData",
"<",
"PortletRenderResult",
">",
",",
"PortletRenderResult",
">",
"cacheState... | Replay the cached content inside the {@link CachedPortletData} as the response to a doRender. | [
"Replay",
"the",
"cached",
"content",
"inside",
"the",
"{"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-web/src/main/java/org/apereo/portal/portlet/rendering/PortletRendererImpl.java#L550-L576 |
alkacon/opencms-core | src/org/opencms/lock/CmsLockUtil.java | CmsLockUtil.tryUnlock | public static void tryUnlock(CmsObject cms, CmsResource resource) {
try {
cms.unlockResource(resource);
} catch (CmsException e) {
LOG.debug("Unable to unlock " + resource.getRootPath(), e);
}
} | java | public static void tryUnlock(CmsObject cms, CmsResource resource) {
try {
cms.unlockResource(resource);
} catch (CmsException e) {
LOG.debug("Unable to unlock " + resource.getRootPath(), e);
}
} | [
"public",
"static",
"void",
"tryUnlock",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
")",
"{",
"try",
"{",
"cms",
".",
"unlockResource",
"(",
"resource",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"LOG",
".",
"debug",
"(",
... | Tries to unlock the given resource.<p>
Will ignore any failure.<p>
@param cms the cms context
@param resource the resource to unlock | [
"Tries",
"to",
"unlock",
"the",
"given",
"resource",
".",
"<p",
">",
"Will",
"ignore",
"any",
"failure",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/lock/CmsLockUtil.java#L229-L236 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java | DomHelper.setCursor | public void setCursor(Object object, String cursor) {
if (object == null) {
Dom.setStyleAttribute(getRootElement(), "cursor", cursor);
} else {
Element element = getGroup(object);
if (element != null) {
Dom.setStyleAttribute(element, "cursor", cursor);
}
}
} | java | public void setCursor(Object object, String cursor) {
if (object == null) {
Dom.setStyleAttribute(getRootElement(), "cursor", cursor);
} else {
Element element = getGroup(object);
if (element != null) {
Dom.setStyleAttribute(element, "cursor", cursor);
}
}
} | [
"public",
"void",
"setCursor",
"(",
"Object",
"object",
",",
"String",
"cursor",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"Dom",
".",
"setStyleAttribute",
"(",
"getRootElement",
"(",
")",
",",
"\"cursor\"",
",",
"cursor",
")",
";",
"}",
"... | Set a specific cursor on an element of this <code>GraphicsContext</code>.
@param object
the element on which the controller should be set.
@param cursor
The string representation of the cursor to use. | [
"Set",
"a",
"specific",
"cursor",
"on",
"an",
"element",
"of",
"this",
"<code",
">",
"GraphicsContext<",
"/",
"code",
">",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L628-L637 |
Pi4J/pi4j | pi4j-core/src/main/java/com/pi4j/wiringpi/GpioInterrupt.java | GpioInterrupt.pinStateChangeCallback | @SuppressWarnings("unchecked")
private static void pinStateChangeCallback(int pin, boolean state) {
Vector<GpioInterruptListener> listenersClone;
listenersClone = (Vector<GpioInterruptListener>) listeners.clone();
for (int i = 0; i < listenersClone.size(); i++) {
GpioInterruptListener listener = listenersClone.elementAt(i);
if(listener != null) {
GpioInterruptEvent event = new GpioInterruptEvent(listener, pin, state);
listener.pinStateChange(event);
}
}
//System.out.println("GPIO PIN [" + pin + "] = " + state);
} | java | @SuppressWarnings("unchecked")
private static void pinStateChangeCallback(int pin, boolean state) {
Vector<GpioInterruptListener> listenersClone;
listenersClone = (Vector<GpioInterruptListener>) listeners.clone();
for (int i = 0; i < listenersClone.size(); i++) {
GpioInterruptListener listener = listenersClone.elementAt(i);
if(listener != null) {
GpioInterruptEvent event = new GpioInterruptEvent(listener, pin, state);
listener.pinStateChange(event);
}
}
//System.out.println("GPIO PIN [" + pin + "] = " + state);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"void",
"pinStateChangeCallback",
"(",
"int",
"pin",
",",
"boolean",
"state",
")",
"{",
"Vector",
"<",
"GpioInterruptListener",
">",
"listenersClone",
";",
"listenersClone",
"=",
"(",
"Vector... | <p>
This method is provided as the callback handler for the Pi4J native library to invoke when a
GPIO interrupt is detected. This method should not be called from any Java consumers. (Thus
is is marked as a private method.)
</p>
@param pin GPIO pin number (not header pin number; not wiringPi pin number)
@param state New GPIO pin state. | [
"<p",
">",
"This",
"method",
"is",
"provided",
"as",
"the",
"callback",
"handler",
"for",
"the",
"Pi4J",
"native",
"library",
"to",
"invoke",
"when",
"a",
"GPIO",
"interrupt",
"is",
"detected",
".",
"This",
"method",
"should",
"not",
"be",
"called",
"from"... | train | https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/wiringpi/GpioInterrupt.java#L118-L133 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java | CalendarUtil.addYears | public XMLGregorianCalendar addYears(final XMLGregorianCalendar cal, final int amount) {
XMLGregorianCalendar to = buildXMLGregorianCalendarDate(cal);
// Add amount of months
to.add(addYears(amount));
return to;
} | java | public XMLGregorianCalendar addYears(final XMLGregorianCalendar cal, final int amount) {
XMLGregorianCalendar to = buildXMLGregorianCalendarDate(cal);
// Add amount of months
to.add(addYears(amount));
return to;
} | [
"public",
"XMLGregorianCalendar",
"addYears",
"(",
"final",
"XMLGregorianCalendar",
"cal",
",",
"final",
"int",
"amount",
")",
"{",
"XMLGregorianCalendar",
"to",
"=",
"buildXMLGregorianCalendarDate",
"(",
"cal",
")",
";",
"// Add amount of months",
"to",
".",
"add",
... | Add Years to a Gregorian Calendar.
@param cal The XMLGregorianCalendar source
@param amount The amount of years. Can be a negative Integer to
substract.
@return A XMLGregorianCalendar with the new Date | [
"Add",
"Years",
"to",
"a",
"Gregorian",
"Calendar",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java#L63-L68 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java | AlignmentTools.getSymmetryOrder | public static int getSymmetryOrder(Map<Integer, Integer> alignment,
final int maxSymmetry, final float minimumMetricChange) {
return getSymmetryOrder(alignment, new IdentityMap<Integer>(), maxSymmetry, minimumMetricChange);
} | java | public static int getSymmetryOrder(Map<Integer, Integer> alignment,
final int maxSymmetry, final float minimumMetricChange) {
return getSymmetryOrder(alignment, new IdentityMap<Integer>(), maxSymmetry, minimumMetricChange);
} | [
"public",
"static",
"int",
"getSymmetryOrder",
"(",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"alignment",
",",
"final",
"int",
"maxSymmetry",
",",
"final",
"float",
"minimumMetricChange",
")",
"{",
"return",
"getSymmetryOrder",
"(",
"alignment",
",",
"new",
... | Helper for {@link #getSymmetryOrder(Map, Map, int, float)} with a true
identity function (X->X).
<p>This method should only be used in cases where the two proteins
aligned have identical numbering, as for self-alignments. See
{@link #getSymmetryOrder(AFPChain, int, float)} for a way to guess
the sequential correspondence between two proteins.
@param alignment
@param maxSymmetry
@param minimumMetricChange
@return | [
"Helper",
"for",
"{",
"@link",
"#getSymmetryOrder",
"(",
"Map",
"Map",
"int",
"float",
")",
"}",
"with",
"a",
"true",
"identity",
"function",
"(",
"X",
"-",
">",
"X",
")",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java#L283-L286 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java | TypesafeConfigUtils.getObject | @SuppressWarnings("unchecked")
public static <T> T getObject(Config config, String path, Class<T> clazz) {
Object obj = getObject(config, path);
return obj != null && clazz.isAssignableFrom(obj.getClass()) ? (T) obj : null;
} | java | @SuppressWarnings("unchecked")
public static <T> T getObject(Config config, String path, Class<T> clazz) {
Object obj = getObject(config, path);
return obj != null && clazz.isAssignableFrom(obj.getClass()) ? (T) obj : null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getObject",
"(",
"Config",
"config",
",",
"String",
"path",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"Object",
"obj",
"=",
"getObject",
"(",
"config",
"... | Get a configuration as Java object. Return {@code null} if missing or wrong type.
@param config
@param path
@param clazz
@return | [
"Get",
"a",
"configuration",
"as",
"Java",
"object",
".",
"Return",
"{",
"@code",
"null",
"}",
"if",
"missing",
"or",
"wrong",
"type",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java#L825-L829 |
deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/resources/Downloader.java | Downloader.checkMD5OfFile | public static boolean checkMD5OfFile(String targetMD5, File file) throws IOException {
InputStream in = FileUtils.openInputStream(file);
String trueMd5 = DigestUtils.md5Hex(in);
IOUtils.closeQuietly(in);
return (targetMD5.equals(trueMd5));
} | java | public static boolean checkMD5OfFile(String targetMD5, File file) throws IOException {
InputStream in = FileUtils.openInputStream(file);
String trueMd5 = DigestUtils.md5Hex(in);
IOUtils.closeQuietly(in);
return (targetMD5.equals(trueMd5));
} | [
"public",
"static",
"boolean",
"checkMD5OfFile",
"(",
"String",
"targetMD5",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"InputStream",
"in",
"=",
"FileUtils",
".",
"openInputStream",
"(",
"file",
")",
";",
"String",
"trueMd5",
"=",
"DigestUtils",
... | Check the MD5 of the specified file
@param targetMD5 Expected MD5
@param file File to check
@return True if MD5 matches, false otherwise | [
"Check",
"the",
"MD5",
"of",
"the",
"specified",
"file"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/resources/Downloader.java#L118-L123 |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java | OriginTrackedValue.of | public static OriginTrackedValue of(Object value, Origin origin) {
if (value == null) {
return null;
}
if (value instanceof CharSequence) {
return new OriginTrackedCharSequence((CharSequence) value, origin);
}
return new OriginTrackedValue(value, origin);
} | java | public static OriginTrackedValue of(Object value, Origin origin) {
if (value == null) {
return null;
}
if (value instanceof CharSequence) {
return new OriginTrackedCharSequence((CharSequence) value, origin);
}
return new OriginTrackedValue(value, origin);
} | [
"public",
"static",
"OriginTrackedValue",
"of",
"(",
"Object",
"value",
",",
"Origin",
"origin",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"value",
"instanceof",
"CharSequence",
")",
"{",
"return",
"new"... | Create an {@link OriginTrackedValue} containing the specified {@code value} and
{@code origin}. If the source value implements {@link CharSequence} then so will
the resulting {@link OriginTrackedValue}.
@param value the source value
@param origin the origin
@return an {@link OriginTrackedValue} or {@code null} if the source value was
{@code null}. | [
"Create",
"an",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java#L85-L93 |
alkacon/opencms-core | src/org/opencms/i18n/tools/CmsContainerPageCopier.java | CmsContainerPageCopier.copyPageOnly | public void copyPageOnly(CmsResource originalPage, String targetPageRootPath)
throws CmsException, NoCustomReplacementException {
if ((null == originalPage)
|| !OpenCms.getResourceManager().getResourceType(originalPage).getTypeName().equals(
CmsResourceTypeXmlContainerPage.getStaticTypeName())) {
throw new CmsException(new CmsMessageContainer(Messages.get(), Messages.ERR_PAGECOPY_INVALID_PAGE_0));
}
m_originalPage = originalPage;
CmsObject rootCms = getRootCms();
rootCms.copyResource(originalPage.getRootPath(), targetPageRootPath);
CmsResource copiedPage = rootCms.readResource(targetPageRootPath, CmsResourceFilter.IGNORE_EXPIRATION);
m_targetFolder = rootCms.readResource(CmsResource.getFolderPath(copiedPage.getRootPath()));
replaceElements(copiedPage);
attachLocaleGroups(copiedPage);
tryUnlock(copiedPage);
} | java | public void copyPageOnly(CmsResource originalPage, String targetPageRootPath)
throws CmsException, NoCustomReplacementException {
if ((null == originalPage)
|| !OpenCms.getResourceManager().getResourceType(originalPage).getTypeName().equals(
CmsResourceTypeXmlContainerPage.getStaticTypeName())) {
throw new CmsException(new CmsMessageContainer(Messages.get(), Messages.ERR_PAGECOPY_INVALID_PAGE_0));
}
m_originalPage = originalPage;
CmsObject rootCms = getRootCms();
rootCms.copyResource(originalPage.getRootPath(), targetPageRootPath);
CmsResource copiedPage = rootCms.readResource(targetPageRootPath, CmsResourceFilter.IGNORE_EXPIRATION);
m_targetFolder = rootCms.readResource(CmsResource.getFolderPath(copiedPage.getRootPath()));
replaceElements(copiedPage);
attachLocaleGroups(copiedPage);
tryUnlock(copiedPage);
} | [
"public",
"void",
"copyPageOnly",
"(",
"CmsResource",
"originalPage",
",",
"String",
"targetPageRootPath",
")",
"throws",
"CmsException",
",",
"NoCustomReplacementException",
"{",
"if",
"(",
"(",
"null",
"==",
"originalPage",
")",
"||",
"!",
"OpenCms",
".",
"getRe... | Copies the given container page to the provided root path.
@param originalPage the page to copy
@param targetPageRootPath the root path of the copy target.
@throws CmsException thrown if something goes wrong.
@throws NoCustomReplacementException if a custom replacement is not found for a type which requires it. | [
"Copies",
"the",
"given",
"container",
"page",
"to",
"the",
"provided",
"root",
"path",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/tools/CmsContainerPageCopier.java#L223-L240 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/model/DefBase.java | DefBase.setProperty | public void setProperty(String name, String value)
{
if ((value == null) || (value.length() == 0))
{
_properties.remove(name);
}
else
{
_properties.setProperty(name, value);
}
} | java | public void setProperty(String name, String value)
{
if ((value == null) || (value.length() == 0))
{
_properties.remove(name);
}
else
{
_properties.setProperty(name, value);
}
} | [
"public",
"void",
"setProperty",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"(",
"value",
"==",
"null",
")",
"||",
"(",
"value",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"_properties",
".",
"remove",
"(",
"name",
... | Sets a property.
@param name The property name
@param value The property value | [
"Sets",
"a",
"property",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/DefBase.java#L133-L143 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/VarOptItemsUnion.java | VarOptItemsUnion.update | public void update(final Memory mem, final ArrayOfItemsSerDe<T> serDe) {
if (mem != null) {
final VarOptItemsSketch<T> vis = VarOptItemsSketch.heapify(mem, serDe);
mergeInto(vis);
}
} | java | public void update(final Memory mem, final ArrayOfItemsSerDe<T> serDe) {
if (mem != null) {
final VarOptItemsSketch<T> vis = VarOptItemsSketch.heapify(mem, serDe);
mergeInto(vis);
}
} | [
"public",
"void",
"update",
"(",
"final",
"Memory",
"mem",
",",
"final",
"ArrayOfItemsSerDe",
"<",
"T",
">",
"serDe",
")",
"{",
"if",
"(",
"mem",
"!=",
"null",
")",
"{",
"final",
"VarOptItemsSketch",
"<",
"T",
">",
"vis",
"=",
"VarOptItemsSketch",
".",
... | Union the given Memory image of the sketch.
<p>This method can be repeatedly called.</p>
@param mem Memory image of sketch to be merged
@param serDe An instance of ArrayOfItemsSerDe | [
"Union",
"the",
"given",
"Memory",
"image",
"of",
"the",
"sketch",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/VarOptItemsUnion.java#L205-L210 |
anotheria/moskito | moskito-webui/src/main/java/net/anotheria/moskito/webui/producers/action/ShowProducerAction.java | ShowProducerAction.populateCumulatedStats | private void populateCumulatedStats(final StatDecoratorBean decoratorBean, final List<StatLineAO> allStatLines) {
if (allStatLines == null || allStatLines.isEmpty()) {
LOGGER.warn("Producer's stats are empty");
return;
}
final int cumulatedIndex = getCumulatedIndex(allStatLines);
if (cumulatedIndex == -1)
return;
final StatLineAO cumulatedStatLineAO = allStatLines.get(cumulatedIndex);
final StatBean cumulatedStat = new StatBean();
cumulatedStat.setName(cumulatedStatLineAO.getStatName());
cumulatedStat.setValues(cumulatedStatLineAO.getValues());
decoratorBean.setCumulatedStat(cumulatedStat);
} | java | private void populateCumulatedStats(final StatDecoratorBean decoratorBean, final List<StatLineAO> allStatLines) {
if (allStatLines == null || allStatLines.isEmpty()) {
LOGGER.warn("Producer's stats are empty");
return;
}
final int cumulatedIndex = getCumulatedIndex(allStatLines);
if (cumulatedIndex == -1)
return;
final StatLineAO cumulatedStatLineAO = allStatLines.get(cumulatedIndex);
final StatBean cumulatedStat = new StatBean();
cumulatedStat.setName(cumulatedStatLineAO.getStatName());
cumulatedStat.setValues(cumulatedStatLineAO.getValues());
decoratorBean.setCumulatedStat(cumulatedStat);
} | [
"private",
"void",
"populateCumulatedStats",
"(",
"final",
"StatDecoratorBean",
"decoratorBean",
",",
"final",
"List",
"<",
"StatLineAO",
">",
"allStatLines",
")",
"{",
"if",
"(",
"allStatLines",
"==",
"null",
"||",
"allStatLines",
".",
"isEmpty",
"(",
")",
")",... | Allows to set cumulated stat to decorator bean.
@param decoratorBean {@link StatDecoratorBean}
@param allStatLines list of {@link StatLineAO}, all stats present in producer | [
"Allows",
"to",
"set",
"cumulated",
"stat",
"to",
"decorator",
"bean",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-webui/src/main/java/net/anotheria/moskito/webui/producers/action/ShowProducerAction.java#L231-L248 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/EntityUtils.java | EntityUtils.getEntityRotation | public static int getEntityRotation(Entity entity, boolean sixWays)
{
if (entity == null)
return 6;
float pitch = entity.rotationPitch;
if (sixWays && pitch < -45)
return 4;
if (sixWays && pitch > 45)
return 5;
return (MathHelper.floor(entity.rotationYaw * 4.0F / 360.0F + 0.5D) + 2) & 3;
} | java | public static int getEntityRotation(Entity entity, boolean sixWays)
{
if (entity == null)
return 6;
float pitch = entity.rotationPitch;
if (sixWays && pitch < -45)
return 4;
if (sixWays && pitch > 45)
return 5;
return (MathHelper.floor(entity.rotationYaw * 4.0F / 360.0F + 0.5D) + 2) & 3;
} | [
"public",
"static",
"int",
"getEntityRotation",
"(",
"Entity",
"entity",
",",
"boolean",
"sixWays",
")",
"{",
"if",
"(",
"entity",
"==",
"null",
")",
"return",
"6",
";",
"float",
"pitch",
"=",
"entity",
".",
"rotationPitch",
";",
"if",
"(",
"sixWays",
"&... | Gets the entity rotation based on where it's currently facing.
@param entity the entity
@param sixWays the six ways
@return the entity rotation | [
"Gets",
"the",
"entity",
"rotation",
"based",
"on",
"where",
"it",
"s",
"currently",
"facing",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/EntityUtils.java#L180-L192 |
aws/aws-sdk-java | aws-java-sdk-storagegateway/src/main/java/com/amazonaws/services/storagegateway/StorageGatewayUtils.java | StorageGatewayUtils.getActivationKey | public static String getActivationKey(String gatewayAddress, Region activationRegion) throws AmazonClientException {
return getActivationKey(gatewayAddress,
activationRegion == null ?
null : activationRegion.getName());
} | java | public static String getActivationKey(String gatewayAddress, Region activationRegion) throws AmazonClientException {
return getActivationKey(gatewayAddress,
activationRegion == null ?
null : activationRegion.getName());
} | [
"public",
"static",
"String",
"getActivationKey",
"(",
"String",
"gatewayAddress",
",",
"Region",
"activationRegion",
")",
"throws",
"AmazonClientException",
"{",
"return",
"getActivationKey",
"(",
"gatewayAddress",
",",
"activationRegion",
"==",
"null",
"?",
"null",
... | Sends a request to the AWS Storage Gateway server running at the
specified address, and returns the activation key for that server.
@param gatewayAddress
The DNS name or IP address of a running AWS Storage Gateway
@param activationRegionName
The region in which the gateway will be activated.
@return The activation key required for some API calls to AWS Storage
Gateway.
@throws AmazonClientException
If any problems are encountered while trying to contact the
remote AWS Storage Gateway server. | [
"Sends",
"a",
"request",
"to",
"the",
"AWS",
"Storage",
"Gateway",
"server",
"running",
"at",
"the",
"specified",
"address",
"and",
"returns",
"the",
"activation",
"key",
"for",
"that",
"server",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-storagegateway/src/main/java/com/amazonaws/services/storagegateway/StorageGatewayUtils.java#L72-L76 |
apache/incubator-gobblin | gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/converter/jdbc/AvroToJdbcEntryConverter.java | AvroToJdbcEntryConverter.convertSchema | @Override
public JdbcEntrySchema convertSchema(Schema inputSchema, WorkUnitState workUnit) throws SchemaConversionException {
LOG.info("Converting schema " + inputSchema);
Preconditions.checkArgument(Type.RECORD.equals(inputSchema.getType()),
"%s is expected for the first level element in Avro schema %s",
Type.RECORD, inputSchema);
Map<String, Type> avroColumnType = flatten(inputSchema);
String jsonStr = Preconditions.checkNotNull(workUnit.getProp(CONVERTER_AVRO_JDBC_DATE_FIELDS));
java.lang.reflect.Type typeOfMap = new TypeToken<Map<String, JdbcType>>() {}.getType();
Map<String, JdbcType> dateColumnMapping = new Gson().fromJson(jsonStr, typeOfMap);
LOG.info("Date column mapping: " + dateColumnMapping);
List<JdbcEntryMetaDatum> jdbcEntryMetaData = Lists.newArrayList();
for (Map.Entry<String, Type> avroEntry : avroColumnType.entrySet()) {
String colName = tryConvertAvroColNameToJdbcColName(avroEntry.getKey());
JdbcType JdbcType = dateColumnMapping.get(colName);
if (JdbcType == null) {
JdbcType = AVRO_TYPE_JDBC_TYPE_MAPPING.get(avroEntry.getValue());
}
Preconditions.checkNotNull(JdbcType, "Failed to convert " + avroEntry + " AVRO_TYPE_JDBC_TYPE_MAPPING: "
+ AVRO_TYPE_JDBC_TYPE_MAPPING + " , dateColumnMapping: " + dateColumnMapping);
jdbcEntryMetaData.add(new JdbcEntryMetaDatum(colName, JdbcType));
}
JdbcEntrySchema converted = new JdbcEntrySchema(jdbcEntryMetaData);
LOG.info("Converted schema into " + converted);
return converted;
} | java | @Override
public JdbcEntrySchema convertSchema(Schema inputSchema, WorkUnitState workUnit) throws SchemaConversionException {
LOG.info("Converting schema " + inputSchema);
Preconditions.checkArgument(Type.RECORD.equals(inputSchema.getType()),
"%s is expected for the first level element in Avro schema %s",
Type.RECORD, inputSchema);
Map<String, Type> avroColumnType = flatten(inputSchema);
String jsonStr = Preconditions.checkNotNull(workUnit.getProp(CONVERTER_AVRO_JDBC_DATE_FIELDS));
java.lang.reflect.Type typeOfMap = new TypeToken<Map<String, JdbcType>>() {}.getType();
Map<String, JdbcType> dateColumnMapping = new Gson().fromJson(jsonStr, typeOfMap);
LOG.info("Date column mapping: " + dateColumnMapping);
List<JdbcEntryMetaDatum> jdbcEntryMetaData = Lists.newArrayList();
for (Map.Entry<String, Type> avroEntry : avroColumnType.entrySet()) {
String colName = tryConvertAvroColNameToJdbcColName(avroEntry.getKey());
JdbcType JdbcType = dateColumnMapping.get(colName);
if (JdbcType == null) {
JdbcType = AVRO_TYPE_JDBC_TYPE_MAPPING.get(avroEntry.getValue());
}
Preconditions.checkNotNull(JdbcType, "Failed to convert " + avroEntry + " AVRO_TYPE_JDBC_TYPE_MAPPING: "
+ AVRO_TYPE_JDBC_TYPE_MAPPING + " , dateColumnMapping: " + dateColumnMapping);
jdbcEntryMetaData.add(new JdbcEntryMetaDatum(colName, JdbcType));
}
JdbcEntrySchema converted = new JdbcEntrySchema(jdbcEntryMetaData);
LOG.info("Converted schema into " + converted);
return converted;
} | [
"@",
"Override",
"public",
"JdbcEntrySchema",
"convertSchema",
"(",
"Schema",
"inputSchema",
",",
"WorkUnitState",
"workUnit",
")",
"throws",
"SchemaConversionException",
"{",
"LOG",
".",
"info",
"(",
"\"Converting schema \"",
"+",
"inputSchema",
")",
";",
"Preconditi... | Converts Avro schema to JdbcEntrySchema.
Few precondition to the Avro schema
1. Avro schema should have one entry type record at first depth.
2. Avro schema can recurse by having record inside record.
3. Supported Avro primitive types and conversion
boolean --> java.lang.Boolean
int --> java.lang.Integer
long --> java.lang.Long or java.sql.Date , java.sql.Time , java.sql.Timestamp
float --> java.lang.Float
double --> java.lang.Double
bytes --> byte[]
string --> java.lang.String
null: only allowed if it's within union (see complex types for more details)
4. Supported Avro complex types
Records: Supports nested record type as well.
Enum --> java.lang.String
Unions --> Only allowed if it have one primitive type in it, along with Record type, or null type with one primitive type where null will be ignored.
Once Union is narrowed down to one primitive type, it will follow conversion of primitive type above.
{@inheritDoc}
5. In order to make conversion from Avro long type to java.sql.Date or java.sql.Time or java.sql.Timestamp,
converter will get table metadata from JDBC.
6. As it needs JDBC connection from condition 5, it also assumes that it will use JDBC publisher where it will get connection information from.
7. Conversion assumes that both schema, Avro and JDBC, uses same column name where name space in Avro is ignored.
For case sensitivity, Avro is case sensitive where it differs in JDBC based on underlying database. As Avro is case sensitive, column name equality also take case sensitive in to account.
@see org.apache.gobblin.converter.Converter#convertSchema(java.lang.Object, org.apache.gobblin.configuration.WorkUnitState) | [
"Converts",
"Avro",
"schema",
"to",
"JdbcEntrySchema",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/converter/jdbc/AvroToJdbcEntryConverter.java#L176-L205 |
jparsec/jparsec | jparsec/src/main/java/org/jparsec/pattern/Patterns.java | Patterns.hasAtLeast | public static Pattern hasAtLeast(final int n) {
return new Pattern() {
@Override public int match(CharSequence src, int begin, int end) {
if ((begin + n) > end) return MISMATCH;
else return n;
}
@Override public String toString() {
return ".{" + n + ",}";
}
};
} | java | public static Pattern hasAtLeast(final int n) {
return new Pattern() {
@Override public int match(CharSequence src, int begin, int end) {
if ((begin + n) > end) return MISMATCH;
else return n;
}
@Override public String toString() {
return ".{" + n + ",}";
}
};
} | [
"public",
"static",
"Pattern",
"hasAtLeast",
"(",
"final",
"int",
"n",
")",
"{",
"return",
"new",
"Pattern",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"match",
"(",
"CharSequence",
"src",
",",
"int",
"begin",
",",
"int",
"end",
")",
"{",
"if",
... | Returns a {@link Pattern} object that matches if the input has at least {@code n} characters left. Match length is
{@code n} if succeed. | [
"Returns",
"a",
"{"
] | train | https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/pattern/Patterns.java#L130-L140 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java | BlocksMap.removeNode | boolean removeNode(Block b, DatanodeDescriptor node) {
BlockInfo info = blocks.get(b);
if (info == null)
return false;
// remove block from the data-node list and the node from the block info
boolean removed = node.removeBlock(info);
if (info.getDatanode(0) == null // no datanodes left
&& info.inode == null) { // does not belong to a file
removeBlockFromMap(b); // remove block from the map
}
return removed;
} | java | boolean removeNode(Block b, DatanodeDescriptor node) {
BlockInfo info = blocks.get(b);
if (info == null)
return false;
// remove block from the data-node list and the node from the block info
boolean removed = node.removeBlock(info);
if (info.getDatanode(0) == null // no datanodes left
&& info.inode == null) { // does not belong to a file
removeBlockFromMap(b); // remove block from the map
}
return removed;
} | [
"boolean",
"removeNode",
"(",
"Block",
"b",
",",
"DatanodeDescriptor",
"node",
")",
"{",
"BlockInfo",
"info",
"=",
"blocks",
".",
"get",
"(",
"b",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"false",
";",
"// remove block from the data-node lis... | Remove data-node reference from the block.
Remove the block from the block map
only if it does not belong to any file and data-nodes. | [
"Remove",
"data",
"-",
"node",
"reference",
"from",
"the",
"block",
".",
"Remove",
"the",
"block",
"from",
"the",
"block",
"map",
"only",
"if",
"it",
"does",
"not",
"belong",
"to",
"any",
"file",
"and",
"data",
"-",
"nodes",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java#L555-L568 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cache/impl/MXBeanUtil.java | MXBeanUtil.unregisterCacheObject | public static void unregisterCacheObject(String cacheManagerName, String name, boolean stats) {
synchronized (mBeanServer) {
ObjectName objectName = calculateObjectName(cacheManagerName, name, stats);
Set<ObjectName> registeredObjectNames = mBeanServer.queryNames(objectName, null);
if (isRegistered(cacheManagerName, name, stats)) {
//should just be one
for (ObjectName registeredObjectName : registeredObjectNames) {
try {
mBeanServer.unregisterMBean(registeredObjectName);
} catch (InstanceNotFoundException e) {
// it can happen that the instance that we want to unregister isn't found. So lets ignore it
// https://github.com/hazelcast/hazelcast/issues/11055
ignore(e);
} catch (Exception e) {
throw new CacheException("Error unregistering object instance " + registeredObjectName
+ ". Error was " + e.getMessage(), e);
}
}
}
}
} | java | public static void unregisterCacheObject(String cacheManagerName, String name, boolean stats) {
synchronized (mBeanServer) {
ObjectName objectName = calculateObjectName(cacheManagerName, name, stats);
Set<ObjectName> registeredObjectNames = mBeanServer.queryNames(objectName, null);
if (isRegistered(cacheManagerName, name, stats)) {
//should just be one
for (ObjectName registeredObjectName : registeredObjectNames) {
try {
mBeanServer.unregisterMBean(registeredObjectName);
} catch (InstanceNotFoundException e) {
// it can happen that the instance that we want to unregister isn't found. So lets ignore it
// https://github.com/hazelcast/hazelcast/issues/11055
ignore(e);
} catch (Exception e) {
throw new CacheException("Error unregistering object instance " + registeredObjectName
+ ". Error was " + e.getMessage(), e);
}
}
}
}
} | [
"public",
"static",
"void",
"unregisterCacheObject",
"(",
"String",
"cacheManagerName",
",",
"String",
"name",
",",
"boolean",
"stats",
")",
"{",
"synchronized",
"(",
"mBeanServer",
")",
"{",
"ObjectName",
"objectName",
"=",
"calculateObjectName",
"(",
"cacheManager... | UnRegisters the mxbean if registered already.
@param cacheManagerName name generated by URI and classloader.
@param name cache name.
@param stats is mxbean, a statistics mxbean. | [
"UnRegisters",
"the",
"mxbean",
"if",
"registered",
"already",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/impl/MXBeanUtil.java#L79-L99 |
chr78rm/tracelogger | src/main/java/de/christofreichardt/diagnosis/AbstractTracer.java | AbstractTracer.initCurrentTracingContext | public void initCurrentTracingContext(int debugLevel, boolean online) {
// todo: prevent manually creation of tracing contexts by configuration?!
TracingContext tracingContext = this.threadMap.getCurrentTracingContext();
if (tracingContext == null) {
System.out.println(formatContextInfo(debugLevel, online));
tracingContext = new TracingContext(debugLevel, online);
this.threadMap.setCurrentTracingContext(tracingContext);
}
else {
tracingContext.setDebugLevel(debugLevel);
tracingContext.setOnline(online);
}
} | java | public void initCurrentTracingContext(int debugLevel, boolean online) {
// todo: prevent manually creation of tracing contexts by configuration?!
TracingContext tracingContext = this.threadMap.getCurrentTracingContext();
if (tracingContext == null) {
System.out.println(formatContextInfo(debugLevel, online));
tracingContext = new TracingContext(debugLevel, online);
this.threadMap.setCurrentTracingContext(tracingContext);
}
else {
tracingContext.setDebugLevel(debugLevel);
tracingContext.setOnline(online);
}
} | [
"public",
"void",
"initCurrentTracingContext",
"(",
"int",
"debugLevel",
",",
"boolean",
"online",
")",
"{",
"// todo: prevent manually creation of tracing contexts by configuration?!\r",
"TracingContext",
"tracingContext",
"=",
"this",
".",
"threadMap",
".",
"getCurrentTracing... | Initialises the current tracing context with the given debugLevel and online state.
@param debugLevel controls the extent of the output
@param online a value of false delivers no output of the current thread at all whereas a value of true delivers output controlled by debugLevel | [
"Initialises",
"the",
"current",
"tracing",
"context",
"with",
"the",
"given",
"debugLevel",
"and",
"online",
"state",
"."
] | train | https://github.com/chr78rm/tracelogger/blob/ad22452b20f8111ad4d367302c2b26a100a20200/src/main/java/de/christofreichardt/diagnosis/AbstractTracer.java#L571-L585 |
LearnLib/automatalib | util/src/main/java/net/automatalib/util/automata/copy/AutomatonLowLevelCopy.java | AutomatonLowLevelCopy.rawCopy | public static <S1, I, T1, S2, T2, SP2, TP2> Mapping<S1, S2> rawCopy(AutomatonCopyMethod method,
Automaton<S1, ? super I, T1> in,
Collection<? extends I> inputs,
MutableAutomaton<S2, I, T2, SP2, TP2> out,
Function<? super S1, ? extends SP2> spMapping,
Function<? super T1, ? extends TP2> tpMapping) {
return rawCopy(method, in, inputs, out, spMapping, tpMapping, s -> true, (s, i, t) -> true);
} | java | public static <S1, I, T1, S2, T2, SP2, TP2> Mapping<S1, S2> rawCopy(AutomatonCopyMethod method,
Automaton<S1, ? super I, T1> in,
Collection<? extends I> inputs,
MutableAutomaton<S2, I, T2, SP2, TP2> out,
Function<? super S1, ? extends SP2> spMapping,
Function<? super T1, ? extends TP2> tpMapping) {
return rawCopy(method, in, inputs, out, spMapping, tpMapping, s -> true, (s, i, t) -> true);
} | [
"public",
"static",
"<",
"S1",
",",
"I",
",",
"T1",
",",
"S2",
",",
"T2",
",",
"SP2",
",",
"TP2",
">",
"Mapping",
"<",
"S1",
",",
"S2",
">",
"rawCopy",
"(",
"AutomatonCopyMethod",
"method",
",",
"Automaton",
"<",
"S1",
",",
"?",
"super",
"I",
","... | Copies an {@link Automaton} to a {@link MutableAutomaton} with a compatible input alphabet, but possibly
heterogeneous state and transition properties. States and transitions will not be filtered.
@param <S1>
input automaton state type
@param <I>
input symbol type
@param <T1>
input automaton transition type
@param <S2>
output automaton state type
@param <T2>
output automaton transition type
@param <SP2>
output automaton state property type
@param <TP2>
output automaton transition property type
@param method
the copy method to use
@param in
the input automaton
@param inputs
the inputs to consider
@param out
the output automaton
@param spMapping
the function for obtaining state properties
@param tpMapping
the function for obtaining transition properties
@return a mapping from old to new states | [
"Copies",
"an",
"{",
"@link",
"Automaton",
"}",
"to",
"a",
"{",
"@link",
"MutableAutomaton",
"}",
"with",
"a",
"compatible",
"input",
"alphabet",
"but",
"possibly",
"heterogeneous",
"state",
"and",
"transition",
"properties",
".",
"States",
"and",
"transitions",... | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/copy/AutomatonLowLevelCopy.java#L185-L192 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.getEventsBatch | public OneLoginResponse<Event> getEventsBatch(int batchSize, String afterCursor)
throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return getEventsBatch(new HashMap<String, String>(), batchSize, afterCursor);
} | java | public OneLoginResponse<Event> getEventsBatch(int batchSize, String afterCursor)
throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return getEventsBatch(new HashMap<String, String>(), batchSize, afterCursor);
} | [
"public",
"OneLoginResponse",
"<",
"Event",
">",
"getEventsBatch",
"(",
"int",
"batchSize",
",",
"String",
"afterCursor",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
"URISyntaxException",
"{",
"return",
"getEventsBatch",
"(",
"new",
"Hash... | Get a batch of Events.
@param batchSize Size of the Batch
@param afterCursor Reference to continue collecting items of next page
@return OneLoginResponse of Event (Batch)
@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 com.onelogin.sdk.model.Event
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/events/get-events">Get Events documentation</a> | [
"Get",
"a",
"batch",
"of",
"Events",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L2004-L2007 |
deephacks/confit | api-model/src/main/java/org/deephacks/confit/model/Bean.java | Bean.setReferences | public void setReferences(final String propertyName, final List<BeanId> values) {
Preconditions.checkNotNull(propertyName);
if (values == null || values.size() == 0) {
references.put(propertyName, null);
return;
}
checkCircularReference(values.toArray(new BeanId[values.size()]));
references.put(propertyName, values);
} | java | public void setReferences(final String propertyName, final List<BeanId> values) {
Preconditions.checkNotNull(propertyName);
if (values == null || values.size() == 0) {
references.put(propertyName, null);
return;
}
checkCircularReference(values.toArray(new BeanId[values.size()]));
references.put(propertyName, values);
} | [
"public",
"void",
"setReferences",
"(",
"final",
"String",
"propertyName",
",",
"final",
"List",
"<",
"BeanId",
">",
"values",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"propertyName",
")",
";",
"if",
"(",
"values",
"==",
"null",
"||",
"values",
... | Overwrite/replace the current references with the provided reference.
@param propertyName name of the property as defined by the bean's schema.
@param values override | [
"Overwrite",
"/",
"replace",
"the",
"current",
"references",
"with",
"the",
"provided",
"reference",
"."
] | train | https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/api-model/src/main/java/org/deephacks/confit/model/Bean.java#L374-L382 |
apereo/cas | support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/SamlUtils.java | SamlUtils.transformSamlObject | public static <T extends XMLObject> T transformSamlObject(final OpenSamlConfigBean configBean, final String xml,
final Class<T> clazz) {
return transformSamlObject(configBean, xml.getBytes(StandardCharsets.UTF_8), clazz);
} | java | public static <T extends XMLObject> T transformSamlObject(final OpenSamlConfigBean configBean, final String xml,
final Class<T> clazz) {
return transformSamlObject(configBean, xml.getBytes(StandardCharsets.UTF_8), clazz);
} | [
"public",
"static",
"<",
"T",
"extends",
"XMLObject",
">",
"T",
"transformSamlObject",
"(",
"final",
"OpenSamlConfigBean",
"configBean",
",",
"final",
"String",
"xml",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"transformSamlObject",
"(... | Transform saml object t.
@param <T> the type parameter
@param configBean the config bean
@param xml the xml
@param clazz the clazz
@return the t | [
"Transform",
"saml",
"object",
"t",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/SamlUtils.java#L84-L87 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.getDestination | public DestinationHandler getDestination(SIBUuid12 destinationUuid, boolean includeInvisible) throws SITemporaryDestinationNotFoundException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getDestination", destinationUuid);
// Get the destination, include invisible dests
DestinationHandler destinationHandler = getDestinationInternal(destinationUuid, includeInvisible);
checkDestinationHandlerExists(
destinationHandler != null,
destinationUuid.toString(),
messageProcessor.getMessagingEngineName());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getDestination", destinationHandler);
return destinationHandler;
} | java | public DestinationHandler getDestination(SIBUuid12 destinationUuid, boolean includeInvisible) throws SITemporaryDestinationNotFoundException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getDestination", destinationUuid);
// Get the destination, include invisible dests
DestinationHandler destinationHandler = getDestinationInternal(destinationUuid, includeInvisible);
checkDestinationHandlerExists(
destinationHandler != null,
destinationUuid.toString(),
messageProcessor.getMessagingEngineName());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getDestination", destinationHandler);
return destinationHandler;
} | [
"public",
"DestinationHandler",
"getDestination",
"(",
"SIBUuid12",
"destinationUuid",
",",
"boolean",
"includeInvisible",
")",
"throws",
"SITemporaryDestinationNotFoundException",
",",
"SINotPossibleInCurrentConfigurationException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAn... | Method getDestination.
@param destinationUuid
@return Destination
@throws SIDestinationNotFoundException
<p>This method provides lookup of a destination by its uuid.
If the destination is not
found, it throws SIDestinationNotFoundException.</p> | [
"Method",
"getDestination",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L5184-L5201 |
EsotericSoftware/kryo | src/com/esotericsoftware/kryo/Kryo.java | Kryo.addDefaultSerializer | public void addDefaultSerializer (Class type, SerializerFactory serializerFactory) {
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (serializerFactory == null) throw new IllegalArgumentException("serializerFactory cannot be null.");
insertDefaultSerializer(type, serializerFactory);
} | java | public void addDefaultSerializer (Class type, SerializerFactory serializerFactory) {
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (serializerFactory == null) throw new IllegalArgumentException("serializerFactory cannot be null.");
insertDefaultSerializer(type, serializerFactory);
} | [
"public",
"void",
"addDefaultSerializer",
"(",
"Class",
"type",
",",
"SerializerFactory",
"serializerFactory",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"type cannot be null.\"",
")",
";",
"if",
"(",
"serial... | Instances of the specified class will use the specified factory to create a serializer when {@link #register(Class)} or
{@link #register(Class, int)} are called.
@see #setDefaultSerializer(Class) | [
"Instances",
"of",
"the",
"specified",
"class",
"will",
"use",
"the",
"specified",
"factory",
"to",
"create",
"a",
"serializer",
"when",
"{"
] | train | https://github.com/EsotericSoftware/kryo/blob/a8be1ab26f347f299a3c3f7171d6447dd5390845/src/com/esotericsoftware/kryo/Kryo.java#L269-L273 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIO.java | StructureIO.getBiologicalAssemblies | public static List<Structure> getBiologicalAssemblies(String pdbId) throws IOException, StructureException {
return getBiologicalAssemblies(pdbId, AtomCache.DEFAULT_BIOASSEMBLY_STYLE);
} | java | public static List<Structure> getBiologicalAssemblies(String pdbId) throws IOException, StructureException {
return getBiologicalAssemblies(pdbId, AtomCache.DEFAULT_BIOASSEMBLY_STYLE);
} | [
"public",
"static",
"List",
"<",
"Structure",
">",
"getBiologicalAssemblies",
"(",
"String",
"pdbId",
")",
"throws",
"IOException",
",",
"StructureException",
"{",
"return",
"getBiologicalAssemblies",
"(",
"pdbId",
",",
"AtomCache",
".",
"DEFAULT_BIOASSEMBLY_STYLE",
"... | Returns all biological assemblies for the given PDB id,
using multiModel={@value AtomCache#DEFAULT_BIOASSEMBLY_STYLE}
<p>
If only one biological assembly is required use {@link #getBiologicalAssembly(String)} or {@link #getBiologicalAssembly(String, int)} instead.
@param pdbId
@return
@throws IOException
@throws StructureException
@since 5.0 | [
"Returns",
"all",
"biological",
"assemblies",
"for",
"the",
"given",
"PDB",
"id",
"using",
"multiModel",
"=",
"{"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIO.java#L265-L267 |
QSFT/Doradus | doradus-client/src/main/java/com/dell/doradus/client/SpiderSession.java | SpiderSession.addObject | public ObjectResult addObject(String tableName, DBObject dbObj) {
Utils.require(!Utils.isEmpty(tableName), "tableName");
Utils.require(dbObj != null, "dbObj");
TableDefinition tableDef = m_appDef.getTableDef(tableName);
Utils.require(tableDef != null,
"Unknown table for application '%s': %s", m_appDef.getAppName(), tableName);
try {
// Send single-object batch to "POST /{application}/{table}"
DBObjectBatch dbObjBatch = new DBObjectBatch();
dbObjBatch.addObject(dbObj);
byte[] body = Utils.toBytes(dbObjBatch.toDoc().toJSON());
StringBuilder uri = new StringBuilder(Utils.isEmpty(m_restClient.getApiPrefix()) ? "" : "/" + m_restClient.getApiPrefix());
uri.append("/");
uri.append(Utils.urlEncode(m_appDef.getAppName()));
uri.append("/");
uri.append(Utils.urlEncode(tableName));
RESTResponse response =
m_restClient.sendRequest(HttpMethod.POST, uri.toString(), ContentType.APPLICATION_JSON, body);
m_logger.debug("addBatch() response: {}", response.toString());
BatchResult batchResult = createBatchResult(response, dbObjBatch);
ObjectResult objResult = null;
if (batchResult.isFailed()) {
objResult = ObjectResult.newErrorResult(batchResult.getErrorMessage(), dbObj.getObjectID());
} else {
objResult = batchResult.getResultObjects().iterator().next();
if (Utils.isEmpty(dbObj.getObjectID())) {
dbObj.setObjectID(objResult.getObjectID());
}
}
return objResult;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public ObjectResult addObject(String tableName, DBObject dbObj) {
Utils.require(!Utils.isEmpty(tableName), "tableName");
Utils.require(dbObj != null, "dbObj");
TableDefinition tableDef = m_appDef.getTableDef(tableName);
Utils.require(tableDef != null,
"Unknown table for application '%s': %s", m_appDef.getAppName(), tableName);
try {
// Send single-object batch to "POST /{application}/{table}"
DBObjectBatch dbObjBatch = new DBObjectBatch();
dbObjBatch.addObject(dbObj);
byte[] body = Utils.toBytes(dbObjBatch.toDoc().toJSON());
StringBuilder uri = new StringBuilder(Utils.isEmpty(m_restClient.getApiPrefix()) ? "" : "/" + m_restClient.getApiPrefix());
uri.append("/");
uri.append(Utils.urlEncode(m_appDef.getAppName()));
uri.append("/");
uri.append(Utils.urlEncode(tableName));
RESTResponse response =
m_restClient.sendRequest(HttpMethod.POST, uri.toString(), ContentType.APPLICATION_JSON, body);
m_logger.debug("addBatch() response: {}", response.toString());
BatchResult batchResult = createBatchResult(response, dbObjBatch);
ObjectResult objResult = null;
if (batchResult.isFailed()) {
objResult = ObjectResult.newErrorResult(batchResult.getErrorMessage(), dbObj.getObjectID());
} else {
objResult = batchResult.getResultObjects().iterator().next();
if (Utils.isEmpty(dbObj.getObjectID())) {
dbObj.setObjectID(objResult.getObjectID());
}
}
return objResult;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"ObjectResult",
"addObject",
"(",
"String",
"tableName",
",",
"DBObject",
"dbObj",
")",
"{",
"Utils",
".",
"require",
"(",
"!",
"Utils",
".",
"isEmpty",
"(",
"tableName",
")",
",",
"\"tableName\"",
")",
";",
"Utils",
".",
"require",
"(",
"dbObj",... | Add the given object to the given table, which must be defined for a table that
belongs to this session's application. This is a convenience method that bundles
the DBObject in a {@link DBObjectBatch} and calls
{@link #addBatch(String, DBObjectBatch)}. The {@link ObjectResult} from the batch
result is returned.
@param tableName Name of table to add object to.
@param dbObj {@link DBObject} of object to add to the database.
@return {@link ObjectResult} of the add request. The result can be used to
determine the ID of the object if it was added by the system. | [
"Add",
"the",
"given",
"object",
"to",
"the",
"given",
"table",
"which",
"must",
"be",
"defined",
"for",
"a",
"table",
"that",
"belongs",
"to",
"this",
"session",
"s",
"application",
".",
"This",
"is",
"a",
"convenience",
"method",
"that",
"bundles",
"the"... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/SpiderSession.java#L102-L137 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java | GVRAvatar.loadModel | public void loadModel(GVRAndroidResource avatarResource)
{
EnumSet<GVRImportSettings> settings = GVRImportSettings.getRecommendedSettingsWith(EnumSet.of(GVRImportSettings.OPTIMIZE_GRAPH, GVRImportSettings.NO_ANIMATION));
GVRContext ctx = mAvatarRoot.getGVRContext();
GVRResourceVolume volume = new GVRResourceVolume(ctx, avatarResource);
GVRSceneObject modelRoot = new GVRSceneObject(ctx);
mAvatarRoot.addChildObject(modelRoot);
ctx.getAssetLoader().loadModel(volume, modelRoot, settings, false, mLoadModelHandler);
} | java | public void loadModel(GVRAndroidResource avatarResource)
{
EnumSet<GVRImportSettings> settings = GVRImportSettings.getRecommendedSettingsWith(EnumSet.of(GVRImportSettings.OPTIMIZE_GRAPH, GVRImportSettings.NO_ANIMATION));
GVRContext ctx = mAvatarRoot.getGVRContext();
GVRResourceVolume volume = new GVRResourceVolume(ctx, avatarResource);
GVRSceneObject modelRoot = new GVRSceneObject(ctx);
mAvatarRoot.addChildObject(modelRoot);
ctx.getAssetLoader().loadModel(volume, modelRoot, settings, false, mLoadModelHandler);
} | [
"public",
"void",
"loadModel",
"(",
"GVRAndroidResource",
"avatarResource",
")",
"{",
"EnumSet",
"<",
"GVRImportSettings",
">",
"settings",
"=",
"GVRImportSettings",
".",
"getRecommendedSettingsWith",
"(",
"EnumSet",
".",
"of",
"(",
"GVRImportSettings",
".",
"OPTIMIZE... | Load the avatar base model
@param avatarResource resource with avatar model | [
"Load",
"the",
"avatar",
"base",
"model"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java#L191-L200 |
google/closure-templates | java/src/com/google/template/soy/passes/ResolveExpressionTypesPass.java | ResolveExpressionTypesPass.getElementType | private SoyType getElementType(SoyType collectionType, ForNonemptyNode node) {
Preconditions.checkNotNull(collectionType);
switch (collectionType.getKind()) {
case UNKNOWN:
// If we don't know anything about the base type, then make no assumptions
// about the field type.
return UnknownType.getInstance();
case LIST:
if (collectionType == ListType.EMPTY_LIST) {
errorReporter.report(node.getParent().getSourceLocation(), EMPTY_LIST_FOREACH);
return ErrorType.getInstance();
}
return ((ListType) collectionType).getElementType();
case UNION:
{
// If it's a union, then do the field type calculation for each member of
// the union and combine the result.
UnionType unionType = (UnionType) collectionType;
List<SoyType> fieldTypes = new ArrayList<>(unionType.getMembers().size());
for (SoyType unionMember : unionType.getMembers()) {
SoyType elementType = getElementType(unionMember, node);
if (elementType.getKind() == SoyType.Kind.ERROR) {
return ErrorType.getInstance();
}
fieldTypes.add(elementType);
}
return SoyTypes.computeLowestCommonType(typeRegistry, fieldTypes);
}
default:
errorReporter.report(
node.getParent().getSourceLocation(),
BAD_FOREACH_TYPE,
node.getExpr().toSourceString(),
node.getExpr().getType()); // Report the outermost union type in the error.
return ErrorType.getInstance();
}
} | java | private SoyType getElementType(SoyType collectionType, ForNonemptyNode node) {
Preconditions.checkNotNull(collectionType);
switch (collectionType.getKind()) {
case UNKNOWN:
// If we don't know anything about the base type, then make no assumptions
// about the field type.
return UnknownType.getInstance();
case LIST:
if (collectionType == ListType.EMPTY_LIST) {
errorReporter.report(node.getParent().getSourceLocation(), EMPTY_LIST_FOREACH);
return ErrorType.getInstance();
}
return ((ListType) collectionType).getElementType();
case UNION:
{
// If it's a union, then do the field type calculation for each member of
// the union and combine the result.
UnionType unionType = (UnionType) collectionType;
List<SoyType> fieldTypes = new ArrayList<>(unionType.getMembers().size());
for (SoyType unionMember : unionType.getMembers()) {
SoyType elementType = getElementType(unionMember, node);
if (elementType.getKind() == SoyType.Kind.ERROR) {
return ErrorType.getInstance();
}
fieldTypes.add(elementType);
}
return SoyTypes.computeLowestCommonType(typeRegistry, fieldTypes);
}
default:
errorReporter.report(
node.getParent().getSourceLocation(),
BAD_FOREACH_TYPE,
node.getExpr().toSourceString(),
node.getExpr().getType()); // Report the outermost union type in the error.
return ErrorType.getInstance();
}
} | [
"private",
"SoyType",
"getElementType",
"(",
"SoyType",
"collectionType",
",",
"ForNonemptyNode",
"node",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"collectionType",
")",
";",
"switch",
"(",
"collectionType",
".",
"getKind",
"(",
")",
")",
"{",
"case"... | Given a collection type, compute the element type.
@param collectionType The base type.
@param node The ForNonemptyNode being iterated.
@return The type of the elements of the collection. | [
"Given",
"a",
"collection",
"type",
"compute",
"the",
"element",
"type",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/ResolveExpressionTypesPass.java#L511-L550 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.readXMLFragment | public static DocumentFragment readXMLFragment(URL file) throws IOException, SAXException, ParserConfigurationException {
return readXMLFragment(file, false);
} | java | public static DocumentFragment readXMLFragment(URL file) throws IOException, SAXException, ParserConfigurationException {
return readXMLFragment(file, false);
} | [
"public",
"static",
"DocumentFragment",
"readXMLFragment",
"(",
"URL",
"file",
")",
"throws",
"IOException",
",",
"SAXException",
",",
"ParserConfigurationException",
"{",
"return",
"readXMLFragment",
"(",
"file",
",",
"false",
")",
";",
"}"
] | Read an XML fragment from an XML file.
The XML file is well-formed. It means that the fragment will contains a single element: the root element
within the input file.
@param file is the file to read
@return the fragment from the {@code file}.
@throws IOException if the stream cannot be read.
@throws SAXException if the stream does not contains valid XML data.
@throws ParserConfigurationException if the parser cannot be configured. | [
"Read",
"an",
"XML",
"fragment",
"from",
"an",
"XML",
"file",
".",
"The",
"XML",
"file",
"is",
"well",
"-",
"formed",
".",
"It",
"means",
"that",
"the",
"fragment",
"will",
"contains",
"a",
"single",
"element",
":",
"the",
"root",
"element",
"within",
... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L2137-L2139 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslUtils.java | SslUtils.toBase64 | static ByteBuf toBase64(ByteBufAllocator allocator, ByteBuf src) {
ByteBuf dst = Base64.encode(src, src.readerIndex(),
src.readableBytes(), true, Base64Dialect.STANDARD, allocator);
src.readerIndex(src.writerIndex());
return dst;
} | java | static ByteBuf toBase64(ByteBufAllocator allocator, ByteBuf src) {
ByteBuf dst = Base64.encode(src, src.readerIndex(),
src.readableBytes(), true, Base64Dialect.STANDARD, allocator);
src.readerIndex(src.writerIndex());
return dst;
} | [
"static",
"ByteBuf",
"toBase64",
"(",
"ByteBufAllocator",
"allocator",
",",
"ByteBuf",
"src",
")",
"{",
"ByteBuf",
"dst",
"=",
"Base64",
".",
"encode",
"(",
"src",
",",
"src",
".",
"readerIndex",
"(",
")",
",",
"src",
".",
"readableBytes",
"(",
")",
",",... | Same as {@link Base64#encode(ByteBuf, boolean)} but allows the use of a custom {@link ByteBufAllocator}.
@see Base64#encode(ByteBuf, boolean) | [
"Same",
"as",
"{",
"@link",
"Base64#encode",
"(",
"ByteBuf",
"boolean",
")",
"}",
"but",
"allows",
"the",
"use",
"of",
"a",
"custom",
"{",
"@link",
"ByteBufAllocator",
"}",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslUtils.java#L375-L380 |
google/allocation-instrumenter | src/main/java/com/google/monitoring/runtime/instrumentation/ConstructorInstrumenter.java | ConstructorInstrumenter.instrumentClass | public static void instrumentClass(Class<?> c, ConstructorCallback<?> sampler)
throws UnmodifiableClassException {
// IMPORTANT: Don't forget that other threads may be accessing this
// class while this code is running. Specifically, the class may be
// executed directly after the retransformClasses is called. Thus, we need
// to be careful about what happens after the retransformClasses call.
synchronized (samplerPutAtomicityLock) {
List<ConstructorCallback<?>> list = samplerMap.get(c);
if (list == null) {
CopyOnWriteArrayList<ConstructorCallback<?>> samplerList =
new CopyOnWriteArrayList<ConstructorCallback<?>>();
samplerList.add(sampler);
samplerMap.put(c, samplerList);
Instrumentation inst = AllocationRecorder.getInstrumentation();
Class<?>[] cs = new Class<?>[1];
cs[0] = c;
inst.retransformClasses(c);
} else {
list.add(sampler);
}
}
} | java | public static void instrumentClass(Class<?> c, ConstructorCallback<?> sampler)
throws UnmodifiableClassException {
// IMPORTANT: Don't forget that other threads may be accessing this
// class while this code is running. Specifically, the class may be
// executed directly after the retransformClasses is called. Thus, we need
// to be careful about what happens after the retransformClasses call.
synchronized (samplerPutAtomicityLock) {
List<ConstructorCallback<?>> list = samplerMap.get(c);
if (list == null) {
CopyOnWriteArrayList<ConstructorCallback<?>> samplerList =
new CopyOnWriteArrayList<ConstructorCallback<?>>();
samplerList.add(sampler);
samplerMap.put(c, samplerList);
Instrumentation inst = AllocationRecorder.getInstrumentation();
Class<?>[] cs = new Class<?>[1];
cs[0] = c;
inst.retransformClasses(c);
} else {
list.add(sampler);
}
}
} | [
"public",
"static",
"void",
"instrumentClass",
"(",
"Class",
"<",
"?",
">",
"c",
",",
"ConstructorCallback",
"<",
"?",
">",
"sampler",
")",
"throws",
"UnmodifiableClassException",
"{",
"// IMPORTANT: Don't forget that other threads may be accessing this",
"// class while th... | Ensures that the given sampler will be invoked every time a constructor for class c is invoked.
@param c The class to be tracked
@param sampler the code to be invoked when an instance of c is constructed
@throws UnmodifiableClassException if c cannot be modified. | [
"Ensures",
"that",
"the",
"given",
"sampler",
"will",
"be",
"invoked",
"every",
"time",
"a",
"constructor",
"for",
"class",
"c",
"is",
"invoked",
"."
] | train | https://github.com/google/allocation-instrumenter/blob/58d8473e8832e51f39ae7aa38328f61c4b747bff/src/main/java/com/google/monitoring/runtime/instrumentation/ConstructorInstrumenter.java#L68-L89 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java | SerializationUtils.fromByteArray | public static <T> T fromByteArray(byte[] data, Class<T> clazz, ClassLoader classLoader) {
if (data == null) {
return null;
}
if (ReflectionUtils.hasInterface(clazz, ISerializationSupport.class)) {
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
if (classLoader != null) {
Thread.currentThread().setContextClassLoader(classLoader);
}
try {
Constructor<T> constructor = clazz.getDeclaredConstructor();
constructor.setAccessible(true);
T obj = constructor.newInstance();
((ISerializationSupport) obj).fromBytes(data);
return obj;
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException
| SecurityException | IllegalArgumentException | InvocationTargetException e) {
throw new DeserializationException(e);
} finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
}
return SerializationUtils.fromByteArrayFst(data, clazz, classLoader);
} | java | public static <T> T fromByteArray(byte[] data, Class<T> clazz, ClassLoader classLoader) {
if (data == null) {
return null;
}
if (ReflectionUtils.hasInterface(clazz, ISerializationSupport.class)) {
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
if (classLoader != null) {
Thread.currentThread().setContextClassLoader(classLoader);
}
try {
Constructor<T> constructor = clazz.getDeclaredConstructor();
constructor.setAccessible(true);
T obj = constructor.newInstance();
((ISerializationSupport) obj).fromBytes(data);
return obj;
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException
| SecurityException | IllegalArgumentException | InvocationTargetException e) {
throw new DeserializationException(e);
} finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
}
return SerializationUtils.fromByteArrayFst(data, clazz, classLoader);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"fromByteArray",
"(",
"byte",
"[",
"]",
"data",
",",
"Class",
"<",
"T",
">",
"clazz",
",",
"ClassLoader",
"classLoader",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
... | Deserialize a byte array back to an object, with custom class loader.
<p>
If the target class implements {@link ISerializationSupport}, this method
calls its {@link ISerializationSupport#toBytes()} method; otherwise FST
library is used to serialize the object.
</p>
@param data
@param clazz
@param classLoader
@return
@deprecated since 0.9.2 with no replacement, use
{@link #fromByteArrayFst(byte[], Class, ClassLoader)} or
{@link #fromByteArrayKryo(byte[], Class, ClassLoader)} | [
"Deserialize",
"a",
"byte",
"array",
"back",
"to",
"an",
"object",
"with",
"custom",
"class",
"loader",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java#L132-L155 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.convert | @Deprecated
public static void convert(ImageInputStream srcStream, String formatName, ImageOutputStream destStream) {
write(read(srcStream), formatName, destStream);
} | java | @Deprecated
public static void convert(ImageInputStream srcStream, String formatName, ImageOutputStream destStream) {
write(read(srcStream), formatName, destStream);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"convert",
"(",
"ImageInputStream",
"srcStream",
",",
"String",
"formatName",
",",
"ImageOutputStream",
"destStream",
")",
"{",
"write",
"(",
"read",
"(",
"srcStream",
")",
",",
"formatName",
",",
"destStream",
")",... | 图像类型转换:GIF=》JPG、GIF=》PNG、PNG=》JPG、PNG=》GIF(X)、BMP=》PNG<br>
此方法并不关闭流
@param srcStream 源图像流
@param formatName 包含格式非正式名称的 String:如JPG、JPEG、GIF等
@param destStream 目标图像输出流
@since 3.0.9
@deprecated 请使用{@link #write(Image, String, ImageOutputStream)} | [
"图像类型转换:GIF",
"=",
"》JPG、GIF",
"=",
"》PNG、PNG",
"=",
"》JPG、PNG",
"=",
"》GIF",
"(",
"X",
")",
"、BMP",
"=",
"》PNG<br",
">",
"此方法并不关闭流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L535-L538 |
ehcache/ehcache3 | core/src/main/java/org/ehcache/core/spi/service/ServiceUtils.java | ServiceUtils.findSingletonAmongst | public static <T> T findSingletonAmongst(Class<T> clazz, Object ... instances) {
return findSingletonAmongst(clazz, Arrays.asList(instances));
} | java | public static <T> T findSingletonAmongst(Class<T> clazz, Object ... instances) {
return findSingletonAmongst(clazz, Arrays.asList(instances));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"findSingletonAmongst",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Object",
"...",
"instances",
")",
"{",
"return",
"findSingletonAmongst",
"(",
"clazz",
",",
"Arrays",
".",
"asList",
"(",
"instances",
")",
")",
"... | Find the only expected instance of {@code clazz} among the {@code instances}.
@param clazz searched class
@param instances instances looked at
@param <T> type of the searched instance
@return the compatible instance or null if none are found
@throws IllegalArgumentException if more than one matching instance | [
"Find",
"the",
"only",
"expected",
"instance",
"of",
"{",
"@code",
"clazz",
"}",
"among",
"the",
"{",
"@code",
"instances",
"}",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/core/src/main/java/org/ehcache/core/spi/service/ServiceUtils.java#L105-L107 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/file/FileHelper.java | FileHelper.getOutputStream | @Nullable
public static FileOutputStream getOutputStream (@Nonnull final File aFile)
{
return getOutputStream (aFile, EAppend.DEFAULT);
} | java | @Nullable
public static FileOutputStream getOutputStream (@Nonnull final File aFile)
{
return getOutputStream (aFile, EAppend.DEFAULT);
} | [
"@",
"Nullable",
"public",
"static",
"FileOutputStream",
"getOutputStream",
"(",
"@",
"Nonnull",
"final",
"File",
"aFile",
")",
"{",
"return",
"getOutputStream",
"(",
"aFile",
",",
"EAppend",
".",
"DEFAULT",
")",
";",
"}"
] | Get an output stream for writing to a file.
@param aFile
The file to write to. May not be <code>null</code>.
@return <code>null</code> if the file could not be opened | [
"Get",
"an",
"output",
"stream",
"for",
"writing",
"to",
"a",
"file",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/file/FileHelper.java#L348-L352 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/DevicesApi.java | DevicesApi.updateDevice | public DeviceEnvelope updateDevice(String deviceId, Device device) throws ApiException {
ApiResponse<DeviceEnvelope> resp = updateDeviceWithHttpInfo(deviceId, device);
return resp.getData();
} | java | public DeviceEnvelope updateDevice(String deviceId, Device device) throws ApiException {
ApiResponse<DeviceEnvelope> resp = updateDeviceWithHttpInfo(deviceId, device);
return resp.getData();
} | [
"public",
"DeviceEnvelope",
"updateDevice",
"(",
"String",
"deviceId",
",",
"Device",
"device",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"DeviceEnvelope",
">",
"resp",
"=",
"updateDeviceWithHttpInfo",
"(",
"deviceId",
",",
"device",
")",
";",
"retur... | Update Device
Updates a device
@param deviceId deviceId (required)
@param device Device to be updated (required)
@return DeviceEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Update",
"Device",
"Updates",
"a",
"device"
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesApi.java#L846-L849 |
mangstadt/biweekly | src/main/java/biweekly/io/ParseContext.java | ParseContext.addTimezonedDate | public void addTimezonedDate(String tzid, ICalProperty property, ICalDate date) {
timezonedDates.put(tzid, new TimezonedDate(date, property));
} | java | public void addTimezonedDate(String tzid, ICalProperty property, ICalDate date) {
timezonedDates.put(tzid, new TimezonedDate(date, property));
} | [
"public",
"void",
"addTimezonedDate",
"(",
"String",
"tzid",
",",
"ICalProperty",
"property",
",",
"ICalDate",
"date",
")",
"{",
"timezonedDates",
".",
"put",
"(",
"tzid",
",",
"new",
"TimezonedDate",
"(",
"date",
",",
"property",
")",
")",
";",
"}"
] | Keeps track of a date-time property value that uses a timezone so it can
be parsed later. Timezones cannot be handled until the entire iCalendar
object has been parsed.
@param tzid the timezone ID (TZID parameter)
@param property the property
@param date the date object that was assigned to the property object | [
"Keeps",
"track",
"of",
"a",
"date",
"-",
"time",
"property",
"value",
"that",
"uses",
"a",
"timezone",
"so",
"it",
"can",
"be",
"parsed",
"later",
".",
"Timezones",
"cannot",
"be",
"handled",
"until",
"the",
"entire",
"iCalendar",
"object",
"has",
"been",... | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/ParseContext.java#L133-L135 |
RestComm/jain-slee.http | resources/http-client-nio/ra/src/main/java/org/restcomm/slee/ra/httpclient/nio/ra/HttpClientNIOResourceAdaptor.java | HttpClientNIOResourceAdaptor.processResponseEvent | public void processResponseEvent(HttpClientNIOResponseEvent event, HttpClientNIORequestActivityImpl activity) {
HttpClientNIORequestActivityHandle ah = new HttpClientNIORequestActivityHandle(activity.getId());
if (tracer.isFineEnabled())
tracer.fine("==== FIRING ResponseEvent EVENT TO LOCAL SLEE, Event: " + event + " ====");
try {
resourceAdaptorContext.getSleeEndpoint().fireEvent(ah, fireableEventType, event, null, null, EVENT_FLAGS);
} catch (Throwable e) {
tracer.severe(e.getMessage(), e);
}
} | java | public void processResponseEvent(HttpClientNIOResponseEvent event, HttpClientNIORequestActivityImpl activity) {
HttpClientNIORequestActivityHandle ah = new HttpClientNIORequestActivityHandle(activity.getId());
if (tracer.isFineEnabled())
tracer.fine("==== FIRING ResponseEvent EVENT TO LOCAL SLEE, Event: " + event + " ====");
try {
resourceAdaptorContext.getSleeEndpoint().fireEvent(ah, fireableEventType, event, null, null, EVENT_FLAGS);
} catch (Throwable e) {
tracer.severe(e.getMessage(), e);
}
} | [
"public",
"void",
"processResponseEvent",
"(",
"HttpClientNIOResponseEvent",
"event",
",",
"HttpClientNIORequestActivityImpl",
"activity",
")",
"{",
"HttpClientNIORequestActivityHandle",
"ah",
"=",
"new",
"HttpClientNIORequestActivityHandle",
"(",
"activity",
".",
"getId",
"(... | Receives an Event from the HTTP client and sends it to the SLEE.
@param event
@param activity | [
"Receives",
"an",
"Event",
"from",
"the",
"HTTP",
"client",
"and",
"sends",
"it",
"to",
"the",
"SLEE",
"."
] | train | https://github.com/RestComm/jain-slee.http/blob/938e502a60355b988d6998d2539bbb16207674e8/resources/http-client-nio/ra/src/main/java/org/restcomm/slee/ra/httpclient/nio/ra/HttpClientNIOResourceAdaptor.java#L489-L501 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java | GeneratedDUserDaoImpl.queryByAddress1 | public Iterable<DUser> queryByAddress1(java.lang.String address1) {
return queryByField(null, DUserMapper.Field.ADDRESS1.getFieldName(), address1);
} | java | public Iterable<DUser> queryByAddress1(java.lang.String address1) {
return queryByField(null, DUserMapper.Field.ADDRESS1.getFieldName(), address1);
} | [
"public",
"Iterable",
"<",
"DUser",
">",
"queryByAddress1",
"(",
"java",
".",
"lang",
".",
"String",
"address1",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DUserMapper",
".",
"Field",
".",
"ADDRESS1",
".",
"getFieldName",
"(",
")",
",",
"addres... | query-by method for field address1
@param address1 the specified attribute
@return an Iterable of DUsers for the specified address1 | [
"query",
"-",
"by",
"method",
"for",
"field",
"address1"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L70-L72 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/gm/data/LibDaiFgIo.java | LibDaiFgIo.libDaiIxToConfigId | public static int libDaiIxToConfigId(int libDaiIx, int[] dims, Var[] varArray, VarSet vs) {
int[] config = Tensor.unravelIndexMatlab(libDaiIx, dims);
VarConfig vc = new VarConfig(varArray, config);
return vc.getConfigIndexOfSubset(vs);
} | java | public static int libDaiIxToConfigId(int libDaiIx, int[] dims, Var[] varArray, VarSet vs) {
int[] config = Tensor.unravelIndexMatlab(libDaiIx, dims);
VarConfig vc = new VarConfig(varArray, config);
return vc.getConfigIndexOfSubset(vs);
} | [
"public",
"static",
"int",
"libDaiIxToConfigId",
"(",
"int",
"libDaiIx",
",",
"int",
"[",
"]",
"dims",
",",
"Var",
"[",
"]",
"varArray",
",",
"VarSet",
"vs",
")",
"{",
"int",
"[",
"]",
"config",
"=",
"Tensor",
".",
"unravelIndexMatlab",
"(",
"libDaiIx",
... | converts the index to the index used in pacaya the difference is that the
vars in vs may be reordered compared to varArray and that pacaya
representation has the leftmost v in vs be the slowest changing while
libdai has the rightmost in varArray be the slowest changing; dims and
varArray are assumed to both correspond to the order of the variables
that is left to right (slowest changing last); the resulting index will
respect the order of var in vs which is vs.get(0) as the slowest
changing. | [
"converts",
"the",
"index",
"to",
"the",
"index",
"used",
"in",
"pacaya",
"the",
"difference",
"is",
"that",
"the",
"vars",
"in",
"vs",
"may",
"be",
"reordered",
"compared",
"to",
"varArray",
"and",
"that",
"pacaya",
"representation",
"has",
"the",
"leftmost... | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/data/LibDaiFgIo.java#L148-L152 |
Azure/azure-sdk-for-java | kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java | ClustersInner.listSkusByResource | public List<AzureResourceSkuInner> listSkusByResource(String resourceGroupName, String clusterName) {
return listSkusByResourceWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
} | java | public List<AzureResourceSkuInner> listSkusByResource(String resourceGroupName, String clusterName) {
return listSkusByResourceWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
} | [
"public",
"List",
"<",
"AzureResourceSkuInner",
">",
"listSkusByResource",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
")",
"{",
"return",
"listSkusByResourceWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
")",
".",
"toBlocki... | Returns the SKUs available for the provided resource.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<AzureResourceSkuInner> object if successful. | [
"Returns",
"the",
"SKUs",
"available",
"for",
"the",
"provided",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java#L1377-L1379 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java | ReUtil.replaceAll | public static String replaceAll(CharSequence content, String regex, String replacementTemplate) {
final Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
return replaceAll(content, pattern, replacementTemplate);
} | java | public static String replaceAll(CharSequence content, String regex, String replacementTemplate) {
final Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
return replaceAll(content, pattern, replacementTemplate);
} | [
"public",
"static",
"String",
"replaceAll",
"(",
"CharSequence",
"content",
",",
"String",
"regex",
",",
"String",
"replacementTemplate",
")",
"{",
"final",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"regex",
",",
"Pattern",
".",
"DOTALL",
")",... | 正则替换指定值<br>
通过正则查找到字符串,然后把匹配到的字符串加入到replacementTemplate中,$1表示分组1的字符串
@param content 文本
@param regex 正则
@param replacementTemplate 替换的文本模板,可以使用$1类似的变量提取正则匹配出的内容
@return 处理后的文本 | [
"正则替换指定值<br",
">",
"通过正则查找到字符串,然后把匹配到的字符串加入到replacementTemplate中,$1表示分组1的字符串"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L600-L603 |
Netflix/astyanax | astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java | Mapping.initInstance | public T initInstance(T instance, ColumnList<String> columns) {
for (com.netflix.astyanax.model.Column<String> column : columns) {
Field field = fields.get(column.getName());
if (field != null) { // otherwise it may be a column that was
// removed, etc.
Coercions.setFieldFromColumn(instance, field, column);
}
}
return instance;
} | java | public T initInstance(T instance, ColumnList<String> columns) {
for (com.netflix.astyanax.model.Column<String> column : columns) {
Field field = fields.get(column.getName());
if (field != null) { // otherwise it may be a column that was
// removed, etc.
Coercions.setFieldFromColumn(instance, field, column);
}
}
return instance;
} | [
"public",
"T",
"initInstance",
"(",
"T",
"instance",
",",
"ColumnList",
"<",
"String",
">",
"columns",
")",
"{",
"for",
"(",
"com",
".",
"netflix",
".",
"astyanax",
".",
"model",
".",
"Column",
"<",
"String",
">",
"column",
":",
"columns",
")",
"{",
... | Populate the given instance with the values from the given column list
@param instance
instance
@param columns
column this
@return instance (as a convenience for chaining) | [
"Populate",
"the",
"given",
"instance",
"with",
"the",
"values",
"from",
"the",
"given",
"column",
"list"
] | train | https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java#L273-L282 |
fuinorg/utils4j | src/main/java/org/fuin/utils4j/Utils4J.java | Utils4J.addToClasspath | public static void addToClasspath(final File file, final ClassLoader classLoader) {
checkNotNull("file", file);
try {
addToClasspath(file.toURI().toURL(), classLoader);
} catch (final MalformedURLException e) {
throw new RuntimeException(e);
}
} | java | public static void addToClasspath(final File file, final ClassLoader classLoader) {
checkNotNull("file", file);
try {
addToClasspath(file.toURI().toURL(), classLoader);
} catch (final MalformedURLException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"void",
"addToClasspath",
"(",
"final",
"File",
"file",
",",
"final",
"ClassLoader",
"classLoader",
")",
"{",
"checkNotNull",
"(",
"\"file\"",
",",
"file",
")",
";",
"try",
"{",
"addToClasspath",
"(",
"file",
".",
"toURI",
"(",
")",
"."... | Adds a file to the classpath.
@param file
File to add - Cannot be <code>null</code>.
@param classLoader
Class loader to use - Cannot be <code>null</code>. | [
"Adds",
"a",
"file",
"to",
"the",
"classpath",
"."
] | train | https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L227-L234 |
mikepenz/Android-Iconics | library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java | IconicsDrawable.roundedCornersDp | @NonNull
public IconicsDrawable roundedCornersDp(@Dimension(unit = DP) int sizeDp) {
return roundedCornersPx(Utils.convertDpToPx(mContext, sizeDp));
} | java | @NonNull
public IconicsDrawable roundedCornersDp(@Dimension(unit = DP) int sizeDp) {
return roundedCornersPx(Utils.convertDpToPx(mContext, sizeDp));
} | [
"@",
"NonNull",
"public",
"IconicsDrawable",
"roundedCornersDp",
"(",
"@",
"Dimension",
"(",
"unit",
"=",
"DP",
")",
"int",
"sizeDp",
")",
"{",
"return",
"roundedCornersPx",
"(",
"Utils",
".",
"convertDpToPx",
"(",
"mContext",
",",
"sizeDp",
")",
")",
";",
... | Set rounded corner from dp
@return The current IconicsDrawable for chaining. | [
"Set",
"rounded",
"corner",
"from",
"dp"
] | train | https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L978-L981 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/log/RaftLog.java | RaftLog.truncateEntriesFrom | public List<LogEntry> truncateEntriesFrom(long entryIndex) {
if (entryIndex <= snapshotIndex()) {
throw new IllegalArgumentException("Illegal index: " + entryIndex + ", snapshot index: " + snapshotIndex());
}
if (entryIndex > lastLogOrSnapshotIndex()) {
throw new IllegalArgumentException("Illegal index: " + entryIndex + ", last log index: " + lastLogOrSnapshotIndex());
}
long startSequence = toSequence(entryIndex);
assert startSequence >= logs.headSequence() : "Entry index: " + entryIndex + ", Head Seq: " + logs.headSequence();
List<LogEntry> truncated = new ArrayList<LogEntry>();
for (long ix = startSequence; ix <= logs.tailSequence(); ix++) {
truncated.add(logs.read(ix));
}
logs.setTailSequence(startSequence - 1);
return truncated;
} | java | public List<LogEntry> truncateEntriesFrom(long entryIndex) {
if (entryIndex <= snapshotIndex()) {
throw new IllegalArgumentException("Illegal index: " + entryIndex + ", snapshot index: " + snapshotIndex());
}
if (entryIndex > lastLogOrSnapshotIndex()) {
throw new IllegalArgumentException("Illegal index: " + entryIndex + ", last log index: " + lastLogOrSnapshotIndex());
}
long startSequence = toSequence(entryIndex);
assert startSequence >= logs.headSequence() : "Entry index: " + entryIndex + ", Head Seq: " + logs.headSequence();
List<LogEntry> truncated = new ArrayList<LogEntry>();
for (long ix = startSequence; ix <= logs.tailSequence(); ix++) {
truncated.add(logs.read(ix));
}
logs.setTailSequence(startSequence - 1);
return truncated;
} | [
"public",
"List",
"<",
"LogEntry",
">",
"truncateEntriesFrom",
"(",
"long",
"entryIndex",
")",
"{",
"if",
"(",
"entryIndex",
"<=",
"snapshotIndex",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illegal index: \"",
"+",
"entryIndex",
"+"... | Truncates log entries with indexes {@code >= entryIndex}.
@return truncated log entries
@throws IllegalArgumentException If no entries are available to
truncate, if {@code entryIndex} is
greater than last log index or smaller
than snapshot index. | [
"Truncates",
"log",
"entries",
"with",
"indexes",
"{",
"@code",
">",
"=",
"entryIndex",
"}",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/log/RaftLog.java#L129-L147 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java | AbstractManagedType.onCheckListAttribute | private <E> boolean onCheckListAttribute(PluralAttribute<? super X, ?, ?> pluralAttribute, Class<E> paramClass)
{
if (pluralAttribute != null)
{
if (isListAttribute(pluralAttribute) && isBindable(pluralAttribute, paramClass))
{
return true;
}
}
return false;
} | java | private <E> boolean onCheckListAttribute(PluralAttribute<? super X, ?, ?> pluralAttribute, Class<E> paramClass)
{
if (pluralAttribute != null)
{
if (isListAttribute(pluralAttribute) && isBindable(pluralAttribute, paramClass))
{
return true;
}
}
return false;
} | [
"private",
"<",
"E",
">",
"boolean",
"onCheckListAttribute",
"(",
"PluralAttribute",
"<",
"?",
"super",
"X",
",",
"?",
",",
"?",
">",
"pluralAttribute",
",",
"Class",
"<",
"E",
">",
"paramClass",
")",
"{",
"if",
"(",
"pluralAttribute",
"!=",
"null",
")",... | On check list attribute.
@param <E>
the element type
@param pluralAttribute
the plural attribute
@param paramClass
the param class
@return true, if successful | [
"On",
"check",
"list",
"attribute",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java#L981-L993 |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/CDIContainerImpl.java | CDIContainerImpl.createWebSphereCDIDeployment | private WebSphereCDIDeployment createWebSphereCDIDeployment(Application application,
Set<ExtensionArchive> extensionArchives) throws CDIException {
WebSphereCDIDeployment webSphereCDIDeployment = new WebSphereCDIDeploymentImpl(application, cdiRuntime);
DiscoveredBdas discoveredBdas = new DiscoveredBdas(webSphereCDIDeployment);
if (application.hasModules()) {
Collection<CDIArchive> libraryArchives = application.getLibraryArchives();
Collection<CDIArchive> moduleArchives = application.getModuleArchives();
ClassLoader applicationClassLoader = application.getClassLoader();
webSphereCDIDeployment.setClassLoader(applicationClassLoader);
processLibraries(webSphereCDIDeployment,
discoveredBdas,
libraryArchives);
processModules(webSphereCDIDeployment,
discoveredBdas,
moduleArchives);
//discoveredBdas has the full map, let's go through them all to make sure the wire is complete
discoveredBdas.makeCrossBoundaryWiring();
//and finally the runtime extensions
addRuntimeExtensions(webSphereCDIDeployment,
discoveredBdas);
}
return webSphereCDIDeployment;
} | java | private WebSphereCDIDeployment createWebSphereCDIDeployment(Application application,
Set<ExtensionArchive> extensionArchives) throws CDIException {
WebSphereCDIDeployment webSphereCDIDeployment = new WebSphereCDIDeploymentImpl(application, cdiRuntime);
DiscoveredBdas discoveredBdas = new DiscoveredBdas(webSphereCDIDeployment);
if (application.hasModules()) {
Collection<CDIArchive> libraryArchives = application.getLibraryArchives();
Collection<CDIArchive> moduleArchives = application.getModuleArchives();
ClassLoader applicationClassLoader = application.getClassLoader();
webSphereCDIDeployment.setClassLoader(applicationClassLoader);
processLibraries(webSphereCDIDeployment,
discoveredBdas,
libraryArchives);
processModules(webSphereCDIDeployment,
discoveredBdas,
moduleArchives);
//discoveredBdas has the full map, let's go through them all to make sure the wire is complete
discoveredBdas.makeCrossBoundaryWiring();
//and finally the runtime extensions
addRuntimeExtensions(webSphereCDIDeployment,
discoveredBdas);
}
return webSphereCDIDeployment;
} | [
"private",
"WebSphereCDIDeployment",
"createWebSphereCDIDeployment",
"(",
"Application",
"application",
",",
"Set",
"<",
"ExtensionArchive",
">",
"extensionArchives",
")",
"throws",
"CDIException",
"{",
"WebSphereCDIDeployment",
"webSphereCDIDeployment",
"=",
"new",
"WebSpher... | This method creates the Deployment structure with all it's BDAs.
@param application
@param extensionArchives
@return
@throws CDIException | [
"This",
"method",
"creates",
"the",
"Deployment",
"structure",
"with",
"all",
"it",
"s",
"BDAs",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/CDIContainerImpl.java#L200-L231 |
google/gson | gson/src/main/java/com/google/gson/Gson.java | Gson.toJsonTree | public JsonElement toJsonTree(Object src) {
if (src == null) {
return JsonNull.INSTANCE;
}
return toJsonTree(src, src.getClass());
} | java | public JsonElement toJsonTree(Object src) {
if (src == null) {
return JsonNull.INSTANCE;
}
return toJsonTree(src, src.getClass());
} | [
"public",
"JsonElement",
"toJsonTree",
"(",
"Object",
"src",
")",
"{",
"if",
"(",
"src",
"==",
"null",
")",
"{",
"return",
"JsonNull",
".",
"INSTANCE",
";",
"}",
"return",
"toJsonTree",
"(",
"src",
",",
"src",
".",
"getClass",
"(",
")",
")",
";",
"}"... | This method serializes the specified object into its equivalent representation as a tree of
{@link JsonElement}s. This method should be used when the specified object is not a generic
type. This method uses {@link Class#getClass()} to get the type for the specified object, but
the {@code getClass()} loses the generic type information because of the Type Erasure feature
of Java. Note that this method works fine if the any of the object fields are of generic type,
just the object itself should not be of a generic type. If the object is of generic type, use
{@link #toJsonTree(Object, Type)} instead.
@param src the object for which Json representation is to be created setting for Gson
@return Json representation of {@code src}.
@since 1.4 | [
"This",
"method",
"serializes",
"the",
"specified",
"object",
"into",
"its",
"equivalent",
"representation",
"as",
"a",
"tree",
"of",
"{",
"@link",
"JsonElement",
"}",
"s",
".",
"This",
"method",
"should",
"be",
"used",
"when",
"the",
"specified",
"object",
... | train | https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/gson/src/main/java/com/google/gson/Gson.java#L572-L577 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/MidaoFactory.java | MidaoFactory.getQueryRunner | public static QueryRunnerService getQueryRunner(DataSource ds, Class<? extends TypeHandler> typeHandlerClazz) {
return (QueryRunnerService) ProfilerFactory.newInstance(new QueryRunner(ds, typeHandlerClazz));
} | java | public static QueryRunnerService getQueryRunner(DataSource ds, Class<? extends TypeHandler> typeHandlerClazz) {
return (QueryRunnerService) ProfilerFactory.newInstance(new QueryRunner(ds, typeHandlerClazz));
} | [
"public",
"static",
"QueryRunnerService",
"getQueryRunner",
"(",
"DataSource",
"ds",
",",
"Class",
"<",
"?",
"extends",
"TypeHandler",
">",
"typeHandlerClazz",
")",
"{",
"return",
"(",
"QueryRunnerService",
")",
"ProfilerFactory",
".",
"newInstance",
"(",
"new",
"... | Returns new {@link org.midao.jdbc.core.service.QueryRunnerService} instance
@param ds SQL DataSource
@param typeHandlerClazz {@link org.midao.jdbc.core.handlers.type.TypeHandler} implementation
@return new {@link org.midao.jdbc.core.service.QueryRunnerService} instance | [
"Returns",
"new",
"{",
"@link",
"org",
".",
"midao",
".",
"jdbc",
".",
"core",
".",
"service",
".",
"QueryRunnerService",
"}",
"instance"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/MidaoFactory.java#L60-L62 |
ziccardi/jnrpe | jnrpe-plugins/src/main/java/it/jnrpe/plugin/CNativePlugin.java | CNativePlugin.execute | public final ReturnValue execute(final ICommandLine cl) {
File fProcessFile = new File(cl.getOptionValue("executable"));
StreamManager streamMgr = new StreamManager();
if (!fProcessFile.exists()) {
return new ReturnValue(Status.UNKNOWN, "Could not exec executable : " + fProcessFile.getAbsolutePath());
}
try {
String[] vsParams = StringUtils.split(cl.getOptionValue("args", ""), false);
String[] vCommand = new String[vsParams.length + 1];
vCommand[0] = cl.getOptionValue("executable");
System.arraycopy(vsParams, 0, vCommand, 1, vsParams.length);
Process p = Runtime.getRuntime().exec(vCommand);
BufferedReader br = (BufferedReader) streamMgr.handle(new BufferedReader(new InputStreamReader(p.getInputStream())));
StringBuilder msg = new StringBuilder();
for (String line = br.readLine(); line != null; line = br.readLine()) {
if (msg.length() != 0) {
msg.append(System.lineSeparator());
}
msg.append(line);
}
int iReturnCode = p.waitFor();
return new ReturnValue(Status.fromIntValue(iReturnCode), msg.toString());
} catch (Exception e) {
String message = e.getMessage();
LOG.warn(getContext(), "Error executing the native plugin : " + message, e);
return new ReturnValue(Status.UNKNOWN, "Could not exec executable : " + fProcessFile.getName() + " - ERROR : " + message);
} finally {
streamMgr.closeAll();
}
} | java | public final ReturnValue execute(final ICommandLine cl) {
File fProcessFile = new File(cl.getOptionValue("executable"));
StreamManager streamMgr = new StreamManager();
if (!fProcessFile.exists()) {
return new ReturnValue(Status.UNKNOWN, "Could not exec executable : " + fProcessFile.getAbsolutePath());
}
try {
String[] vsParams = StringUtils.split(cl.getOptionValue("args", ""), false);
String[] vCommand = new String[vsParams.length + 1];
vCommand[0] = cl.getOptionValue("executable");
System.arraycopy(vsParams, 0, vCommand, 1, vsParams.length);
Process p = Runtime.getRuntime().exec(vCommand);
BufferedReader br = (BufferedReader) streamMgr.handle(new BufferedReader(new InputStreamReader(p.getInputStream())));
StringBuilder msg = new StringBuilder();
for (String line = br.readLine(); line != null; line = br.readLine()) {
if (msg.length() != 0) {
msg.append(System.lineSeparator());
}
msg.append(line);
}
int iReturnCode = p.waitFor();
return new ReturnValue(Status.fromIntValue(iReturnCode), msg.toString());
} catch (Exception e) {
String message = e.getMessage();
LOG.warn(getContext(), "Error executing the native plugin : " + message, e);
return new ReturnValue(Status.UNKNOWN, "Could not exec executable : " + fProcessFile.getName() + " - ERROR : " + message);
} finally {
streamMgr.closeAll();
}
} | [
"public",
"final",
"ReturnValue",
"execute",
"(",
"final",
"ICommandLine",
"cl",
")",
"{",
"File",
"fProcessFile",
"=",
"new",
"File",
"(",
"cl",
".",
"getOptionValue",
"(",
"\"executable\"",
")",
")",
";",
"StreamManager",
"streamMgr",
"=",
"new",
"StreamMana... | The first parameter must be the full path to the executable.
The rest of the array is sent to the executable as commands parameters
@param cl
The parsed command line
@return The return value of the plugin | [
"The",
"first",
"parameter",
"must",
"be",
"the",
"full",
"path",
"to",
"the",
"executable",
"."
] | train | https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-plugins/src/main/java/it/jnrpe/plugin/CNativePlugin.java#L45-L80 |
datumbox/datumbox-framework | datumbox-framework-applications/src/main/java/com/datumbox/framework/applications/nlp/TextClassifier.java | TextClassifier.fit | public void fit(Map<Object, URI> datasets) {
TrainingParameters tp = (TrainingParameters) knowledgeBase.getTrainingParameters();
Dataframe trainingData = Dataframe.Builder.parseTextFiles(datasets,
AbstractTextExtractor.newInstance(tp.getTextExtractorParameters()),
knowledgeBase.getConfiguration()
);
fit(trainingData);
trainingData.close();
} | java | public void fit(Map<Object, URI> datasets) {
TrainingParameters tp = (TrainingParameters) knowledgeBase.getTrainingParameters();
Dataframe trainingData = Dataframe.Builder.parseTextFiles(datasets,
AbstractTextExtractor.newInstance(tp.getTextExtractorParameters()),
knowledgeBase.getConfiguration()
);
fit(trainingData);
trainingData.close();
} | [
"public",
"void",
"fit",
"(",
"Map",
"<",
"Object",
",",
"URI",
">",
"datasets",
")",
"{",
"TrainingParameters",
"tp",
"=",
"(",
"TrainingParameters",
")",
"knowledgeBase",
".",
"getTrainingParameters",
"(",
")",
";",
"Dataframe",
"trainingData",
"=",
"Datafra... | Trains a Machine Learning modeler using the provided dataset files. The data
map should have as index the names of each class and as values the URIs
of the training files. The training files should contain one training example
per row.
@param datasets | [
"Trains",
"a",
"Machine",
"Learning",
"modeler",
"using",
"the",
"provided",
"dataset",
"files",
".",
"The",
"data",
"map",
"should",
"have",
"as",
"index",
"the",
"names",
"of",
"each",
"class",
"and",
"as",
"values",
"the",
"URIs",
"of",
"the",
"training... | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-applications/src/main/java/com/datumbox/framework/applications/nlp/TextClassifier.java#L129-L139 |
vznet/mongo-jackson-mapper | src/main/java/net/vz/mongodb/jackson/DBQuery.java | DBQuery.greaterThan | public static Query greaterThan(String field, Object value) {
return new Query().greaterThan(field, value);
} | java | public static Query greaterThan(String field, Object value) {
return new Query().greaterThan(field, value);
} | [
"public",
"static",
"Query",
"greaterThan",
"(",
"String",
"field",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"Query",
"(",
")",
".",
"greaterThan",
"(",
"field",
",",
"value",
")",
";",
"}"
] | The field is greater than the given value
@param field The field to compare
@param value The value to compare to
@return the query | [
"The",
"field",
"is",
"greater",
"than",
"the",
"given",
"value"
] | train | https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/DBQuery.java#L84-L86 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/DefaultPageShell.java | DefaultPageShell.addJsHeadlines | private void addJsHeadlines(final PrintWriter writer, final List jsHeadlines) {
if (jsHeadlines == null || jsHeadlines.isEmpty()) {
return;
}
writer.println();
writer.write("\n<!-- Start javascript headlines -->"
+ "\n<script type=\"" + WebUtilities.CONTENT_TYPE_JS + "\">");
for (Object line : jsHeadlines) {
writer.write("\n" + line);
}
writer.write("\n</script>"
+ "\n<!-- End javascript headlines -->");
} | java | private void addJsHeadlines(final PrintWriter writer, final List jsHeadlines) {
if (jsHeadlines == null || jsHeadlines.isEmpty()) {
return;
}
writer.println();
writer.write("\n<!-- Start javascript headlines -->"
+ "\n<script type=\"" + WebUtilities.CONTENT_TYPE_JS + "\">");
for (Object line : jsHeadlines) {
writer.write("\n" + line);
}
writer.write("\n</script>"
+ "\n<!-- End javascript headlines -->");
} | [
"private",
"void",
"addJsHeadlines",
"(",
"final",
"PrintWriter",
"writer",
",",
"final",
"List",
"jsHeadlines",
")",
"{",
"if",
"(",
"jsHeadlines",
"==",
"null",
"||",
"jsHeadlines",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"writer",
".",
... | Add a list of javascript headline entries intended to be added only once to the page.
@param writer the writer to write to.
@param jsHeadlines a list of javascript entries to be added to the page as a whole. | [
"Add",
"a",
"list",
"of",
"javascript",
"headline",
"entries",
"intended",
"to",
"be",
"added",
"only",
"once",
"to",
"the",
"page",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/DefaultPageShell.java#L162-L177 |
Netflix/eureka | eureka-core/src/main/java/com/netflix/eureka/aws/AwsAsgUtil.java | AwsAsgUtil.getCacheKeys | private Set<CacheKey> getCacheKeys() {
Set<CacheKey> cacheKeys = new HashSet<CacheKey>();
Applications apps = registry.getApplicationsFromLocalRegionOnly();
for (Application app : apps.getRegisteredApplications()) {
for (InstanceInfo instanceInfo : app.getInstances()) {
String localAccountId = getAccountId(instanceInfo, accountId);
String asgName = instanceInfo.getASGName();
if (asgName != null) {
CacheKey key = new CacheKey(localAccountId, asgName);
cacheKeys.add(key);
}
}
}
return cacheKeys;
} | java | private Set<CacheKey> getCacheKeys() {
Set<CacheKey> cacheKeys = new HashSet<CacheKey>();
Applications apps = registry.getApplicationsFromLocalRegionOnly();
for (Application app : apps.getRegisteredApplications()) {
for (InstanceInfo instanceInfo : app.getInstances()) {
String localAccountId = getAccountId(instanceInfo, accountId);
String asgName = instanceInfo.getASGName();
if (asgName != null) {
CacheKey key = new CacheKey(localAccountId, asgName);
cacheKeys.add(key);
}
}
}
return cacheKeys;
} | [
"private",
"Set",
"<",
"CacheKey",
">",
"getCacheKeys",
"(",
")",
"{",
"Set",
"<",
"CacheKey",
">",
"cacheKeys",
"=",
"new",
"HashSet",
"<",
"CacheKey",
">",
"(",
")",
";",
"Applications",
"apps",
"=",
"registry",
".",
"getApplicationsFromLocalRegionOnly",
"... | Get the cacheKeys of all the ASG to which query AWS for.
<p>
The names are obtained from the {@link com.netflix.eureka.registry.InstanceRegistry} which is then
used for querying the AWS.
</p>
@return the set of ASG cacheKeys (asgName + accountId). | [
"Get",
"the",
"cacheKeys",
"of",
"all",
"the",
"ASG",
"to",
"which",
"query",
"AWS",
"for",
"."
] | train | https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/aws/AwsAsgUtil.java#L424-L439 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/classpath/ClassPathGeneratorHelper.java | ClassPathGeneratorHelper.isDirectChildPath | private boolean isDirectChildPath(String rootEntryPath, String entryPath) {
boolean result = false;
if (entryPath.length() > rootEntryPath.length() && entryPath.startsWith(rootEntryPath)) {
int idx = entryPath.indexOf(URL_SEPARATOR, rootEntryPath.length());
if (idx == -1) { // case where the entry is a child file
// /a/b/c/d.txt
result = true;
} else {
if (entryPath.length() == idx + 1) { // case where the entry is
// a child file
// /a/b/c/d/
result = true;
}
}
}
return result;
} | java | private boolean isDirectChildPath(String rootEntryPath, String entryPath) {
boolean result = false;
if (entryPath.length() > rootEntryPath.length() && entryPath.startsWith(rootEntryPath)) {
int idx = entryPath.indexOf(URL_SEPARATOR, rootEntryPath.length());
if (idx == -1) { // case where the entry is a child file
// /a/b/c/d.txt
result = true;
} else {
if (entryPath.length() == idx + 1) { // case where the entry is
// a child file
// /a/b/c/d/
result = true;
}
}
}
return result;
} | [
"private",
"boolean",
"isDirectChildPath",
"(",
"String",
"rootEntryPath",
",",
"String",
"entryPath",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"entryPath",
".",
"length",
"(",
")",
">",
"rootEntryPath",
".",
"length",
"(",
")",
"&&",
"... | Checks if the entry is a direct child of the root Entry
isDirectChildPath( '/a/b/c/' , '/a/b/c/d.txt') => true isDirectChildPath(
'/a/b/c/' , '/a/b/c/d/') => true isDirectChildPath( '/a/b/c/' ,
'/a/b/c/d/e.txt') => false
@param rootEntryPath
the root entry path
@param entryPath
the entry path to check
@return true if the entry is a direct child of the root Entry | [
"Checks",
"if",
"the",
"entry",
"is",
"a",
"direct",
"child",
"of",
"the",
"root",
"Entry",
"isDirectChildPath",
"(",
"/",
"a",
"/",
"b",
"/",
"c",
"/",
"/",
"a",
"/",
"b",
"/",
"c",
"/",
"d",
".",
"txt",
")",
"=",
">",
"true",
"isDirectChildPath... | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/classpath/ClassPathGeneratorHelper.java#L271-L287 |
dkpro/dkpro-argumentation | dkpro-argumentation-types/src/main/java/org/dkpro/argumentation/types/ArgumentUnitUtils.java | ArgumentUnitUtils.setIsImplicit | public static void setIsImplicit(ArgumentUnit argumentUnit, boolean implicit)
throws IllegalArgumentException
{
int length = argumentUnit.getEnd() - argumentUnit.getBegin();
if (length > 0) {
throw new IllegalArgumentException("Cannot set 'implicit' property to component " +
"with non-zero length (" + length + ")");
}
ArgumentUnitUtils.setProperty(argumentUnit, ArgumentUnitUtils.PROP_KEY_IS_IMPLICIT,
Boolean.valueOf(implicit).toString());
} | java | public static void setIsImplicit(ArgumentUnit argumentUnit, boolean implicit)
throws IllegalArgumentException
{
int length = argumentUnit.getEnd() - argumentUnit.getBegin();
if (length > 0) {
throw new IllegalArgumentException("Cannot set 'implicit' property to component " +
"with non-zero length (" + length + ")");
}
ArgumentUnitUtils.setProperty(argumentUnit, ArgumentUnitUtils.PROP_KEY_IS_IMPLICIT,
Boolean.valueOf(implicit).toString());
} | [
"public",
"static",
"void",
"setIsImplicit",
"(",
"ArgumentUnit",
"argumentUnit",
",",
"boolean",
"implicit",
")",
"throws",
"IllegalArgumentException",
"{",
"int",
"length",
"=",
"argumentUnit",
".",
"getEnd",
"(",
")",
"-",
"argumentUnit",
".",
"getBegin",
"(",
... | Sets the implicit value to the argument
@param argumentUnit argument unit
@param implicit boolean value
@throws java.lang.IllegalArgumentException if the length of argument is non-zero | [
"Sets",
"the",
"implicit",
"value",
"to",
"the",
"argument"
] | train | https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-types/src/main/java/org/dkpro/argumentation/types/ArgumentUnitUtils.java#L216-L228 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java | StorageAccountsInner.beginCreateAsync | public Observable<StorageAccountInner> beginCreateAsync(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<StorageAccountInner>, StorageAccountInner>() {
@Override
public StorageAccountInner call(ServiceResponse<StorageAccountInner> response) {
return response.body();
}
});
} | java | public Observable<StorageAccountInner> beginCreateAsync(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<StorageAccountInner>, StorageAccountInner>() {
@Override
public StorageAccountInner call(ServiceResponse<StorageAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"StorageAccountInner",
">",
"beginCreateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"StorageAccountCreateParameters",
"parameters",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupNa... | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed.
@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 parameters The parameters to provide for the created account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the StorageAccountInner object | [
"Asynchronously",
"creates",
"a",
"new",
"storage",
"account",
"with",
"the",
"specified",
"parameters",
".",
"If",
"an",
"account",
"is",
"already",
"created",
"and",
"a",
"subsequent",
"create",
"request",
"is",
"issued",
"with",
"different",
"properties",
"th... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L331-L338 |
alkacon/opencms-core | src/org/opencms/ui/dialogs/CmsCopyMoveDialog.java | CmsCopyMoveDialog.getTargetName | private String getTargetName(CmsResource source, CmsResource target) throws CmsException {
String name;
String folderRootPath = target.getRootPath();
if (!folderRootPath.endsWith("/")) {
folderRootPath += "/";
}
if (folderRootPath.equals(CmsResource.getParentFolder(source.getRootPath()))) {
name = OpenCms.getResourceManager().getNameGenerator().getCopyFileName(
getRootCms(),
folderRootPath,
source.getName());
} else {
name = source.getName();
}
return name;
} | java | private String getTargetName(CmsResource source, CmsResource target) throws CmsException {
String name;
String folderRootPath = target.getRootPath();
if (!folderRootPath.endsWith("/")) {
folderRootPath += "/";
}
if (folderRootPath.equals(CmsResource.getParentFolder(source.getRootPath()))) {
name = OpenCms.getResourceManager().getNameGenerator().getCopyFileName(
getRootCms(),
folderRootPath,
source.getName());
} else {
name = source.getName();
}
return name;
} | [
"private",
"String",
"getTargetName",
"(",
"CmsResource",
"source",
",",
"CmsResource",
"target",
")",
"throws",
"CmsException",
"{",
"String",
"name",
";",
"String",
"folderRootPath",
"=",
"target",
".",
"getRootPath",
"(",
")",
";",
"if",
"(",
"!",
"folderRo... | Gets a name for the target resource.<p>
@param source Source
@param target Target
@return Name
@throws CmsException exception | [
"Gets",
"a",
"name",
"for",
"the",
"target",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dialogs/CmsCopyMoveDialog.java#L655-L671 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/validation/WValidationErrors.java | WValidationErrors.setTitleText | public void setTitleText(final String title, final Serializable... args) {
ValidationErrorsModel model = getOrCreateComponentModel();
model.title = I18nUtilities.asMessage(title, args);
} | java | public void setTitleText(final String title, final Serializable... args) {
ValidationErrorsModel model = getOrCreateComponentModel();
model.title = I18nUtilities.asMessage(title, args);
} | [
"public",
"void",
"setTitleText",
"(",
"final",
"String",
"title",
",",
"final",
"Serializable",
"...",
"args",
")",
"{",
"ValidationErrorsModel",
"model",
"=",
"getOrCreateComponentModel",
"(",
")",
";",
"model",
".",
"title",
"=",
"I18nUtilities",
".",
"asMess... | Sets the message box title.
@param title the message box title to set, using {@link MessageFormat} syntax.
@param args optional arguments for the message format string. | [
"Sets",
"the",
"message",
"box",
"title",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/validation/WValidationErrors.java#L148-L151 |
Jasig/uPortal | uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/TransientUserLayoutManagerWrapper.java | TransientUserLayoutManagerWrapper.getTransientNode | private IUserLayoutChannelDescription getTransientNode(String nodeId) throws PortalException {
// get fname from subscribe id
final String fname = getFname(nodeId);
if (null == fname || fname.equals("")) {
return null;
}
try {
// check cache first
IPortletDefinition chanDef = mChanMap.get(nodeId);
if (null == chanDef) {
chanDef =
PortletDefinitionRegistryLocator.getPortletDefinitionRegistry()
.getPortletDefinitionByFname(fname);
mChanMap.put(nodeId, chanDef);
}
return createUserLayoutChannelDescription(nodeId, chanDef);
} catch (Exception e) {
throw new PortalException("Failed to obtain channel definition using fname: " + fname);
}
} | java | private IUserLayoutChannelDescription getTransientNode(String nodeId) throws PortalException {
// get fname from subscribe id
final String fname = getFname(nodeId);
if (null == fname || fname.equals("")) {
return null;
}
try {
// check cache first
IPortletDefinition chanDef = mChanMap.get(nodeId);
if (null == chanDef) {
chanDef =
PortletDefinitionRegistryLocator.getPortletDefinitionRegistry()
.getPortletDefinitionByFname(fname);
mChanMap.put(nodeId, chanDef);
}
return createUserLayoutChannelDescription(nodeId, chanDef);
} catch (Exception e) {
throw new PortalException("Failed to obtain channel definition using fname: " + fname);
}
} | [
"private",
"IUserLayoutChannelDescription",
"getTransientNode",
"(",
"String",
"nodeId",
")",
"throws",
"PortalException",
"{",
"// get fname from subscribe id",
"final",
"String",
"fname",
"=",
"getFname",
"(",
"nodeId",
")",
";",
"if",
"(",
"null",
"==",
"fname",
... | Return an IUserLayoutChannelDescription by way of nodeId
@param nodeId the node (subscribe) id to get the channel for.
@return a <code>IUserLayoutNodeDescription</code> | [
"Return",
"an",
"IUserLayoutChannelDescription",
"by",
"way",
"of",
"nodeId"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/TransientUserLayoutManagerWrapper.java#L427-L450 |
SvenEwald/xmlbeam | src/main/java/org/xmlbeam/util/intern/duplex/DuplexExpression.java | DuplexExpression.ensureExistence | @SuppressWarnings("unchecked")
public org.w3c.dom.Node ensureExistence(final org.w3c.dom.Node contextNode) {
final Document document = DOMHelper.getOwnerDocumentFor(contextNode);
final Map<String, String> namespaceMapping = new HashMap<String, String>(userDefinedMapping);
namespaceMapping.putAll(DOMHelper.getNamespaceMapping(document));
//node.dump("");
return ((List<org.w3c.dom.Node>) node.firstChildAccept(new BuildDocumentVisitor(variableResolver, namespaceMapping), contextNode)).get(0);
} | java | @SuppressWarnings("unchecked")
public org.w3c.dom.Node ensureExistence(final org.w3c.dom.Node contextNode) {
final Document document = DOMHelper.getOwnerDocumentFor(contextNode);
final Map<String, String> namespaceMapping = new HashMap<String, String>(userDefinedMapping);
namespaceMapping.putAll(DOMHelper.getNamespaceMapping(document));
//node.dump("");
return ((List<org.w3c.dom.Node>) node.firstChildAccept(new BuildDocumentVisitor(variableResolver, namespaceMapping), contextNode)).get(0);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"ensureExistence",
"(",
"final",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"contextNode",
")",
"{",
"final",
"Document",
"document",
"=",
"DOMHelper... | Creates nodes until selecting such a path would return something.
@param contextNode
@return the node that this expression would select. | [
"Creates",
"nodes",
"until",
"selecting",
"such",
"a",
"path",
"would",
"return",
"something",
"."
] | train | https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/util/intern/duplex/DuplexExpression.java#L184-L191 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/ActorSDK.java | ActorSDK.startChatActivity | public void startChatActivity(Context context, Peer peer, boolean compose) {
Bundle b = new Bundle();
b.putLong(Intents.EXTRA_CHAT_PEER, peer.getUnuqueId());
b.putBoolean(Intents.EXTRA_CHAT_COMPOSE, compose);
if (!startDelegateActivity(context, delegate.getChatIntent(peer, compose), b, new int[]{Intent.FLAG_ACTIVITY_SINGLE_TOP})) {
startActivity(context, b, ChatActivity.class);
}
} | java | public void startChatActivity(Context context, Peer peer, boolean compose) {
Bundle b = new Bundle();
b.putLong(Intents.EXTRA_CHAT_PEER, peer.getUnuqueId());
b.putBoolean(Intents.EXTRA_CHAT_COMPOSE, compose);
if (!startDelegateActivity(context, delegate.getChatIntent(peer, compose), b, new int[]{Intent.FLAG_ACTIVITY_SINGLE_TOP})) {
startActivity(context, b, ChatActivity.class);
}
} | [
"public",
"void",
"startChatActivity",
"(",
"Context",
"context",
",",
"Peer",
"peer",
",",
"boolean",
"compose",
")",
"{",
"Bundle",
"b",
"=",
"new",
"Bundle",
"(",
")",
";",
"b",
".",
"putLong",
"(",
"Intents",
".",
"EXTRA_CHAT_PEER",
",",
"peer",
".",... | Method is used internally for starting default activity or activity added in delegate
@param context current context | [
"Method",
"is",
"used",
"internally",
"for",
"starting",
"default",
"activity",
"or",
"activity",
"added",
"in",
"delegate"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/ActorSDK.java#L989-L996 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java | CPDefinitionPersistenceImpl.removeByLtD_S | @Override
public void removeByLtD_S(Date displayDate, int status) {
for (CPDefinition cpDefinition : findByLtD_S(displayDate, status,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinition);
}
} | java | @Override
public void removeByLtD_S(Date displayDate, int status) {
for (CPDefinition cpDefinition : findByLtD_S(displayDate, status,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinition);
}
} | [
"@",
"Override",
"public",
"void",
"removeByLtD_S",
"(",
"Date",
"displayDate",
",",
"int",
"status",
")",
"{",
"for",
"(",
"CPDefinition",
"cpDefinition",
":",
"findByLtD_S",
"(",
"displayDate",
",",
"status",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil... | Removes all the cp definitions where displayDate < ? and status = ? from the database.
@param displayDate the display date
@param status the status | [
"Removes",
"all",
"the",
"cp",
"definitions",
"where",
"displayDate",
"<",
";",
"?",
";",
"and",
"status",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L5099-L5105 |
andkulikov/Transitions-Everywhere | library(1.x)/src/main/java/com/transitionseverywhere/Scene.java | Scene.getSceneForLayout | @NonNull
public static Scene getSceneForLayout(@NonNull ViewGroup sceneRoot, int layoutId, @NonNull Context context) {
SparseArray<Scene> scenes = (SparseArray<Scene>) sceneRoot.getTag(R.id.scene_layoutid_cache);
if (scenes == null) {
scenes = new SparseArray<Scene>();
sceneRoot.setTag(R.id.scene_layoutid_cache, scenes);
}
Scene scene = scenes.get(layoutId);
if (scene != null) {
return scene;
} else {
scene = new Scene(sceneRoot, layoutId, context);
scenes.put(layoutId, scene);
return scene;
}
} | java | @NonNull
public static Scene getSceneForLayout(@NonNull ViewGroup sceneRoot, int layoutId, @NonNull Context context) {
SparseArray<Scene> scenes = (SparseArray<Scene>) sceneRoot.getTag(R.id.scene_layoutid_cache);
if (scenes == null) {
scenes = new SparseArray<Scene>();
sceneRoot.setTag(R.id.scene_layoutid_cache, scenes);
}
Scene scene = scenes.get(layoutId);
if (scene != null) {
return scene;
} else {
scene = new Scene(sceneRoot, layoutId, context);
scenes.put(layoutId, scene);
return scene;
}
} | [
"@",
"NonNull",
"public",
"static",
"Scene",
"getSceneForLayout",
"(",
"@",
"NonNull",
"ViewGroup",
"sceneRoot",
",",
"int",
"layoutId",
",",
"@",
"NonNull",
"Context",
"context",
")",
"{",
"SparseArray",
"<",
"Scene",
">",
"scenes",
"=",
"(",
"SparseArray",
... | Returns a Scene described by the resource file associated with the given
<code>layoutId</code> parameter. If such a Scene has already been created,
that same Scene will be returned. This caching of layoutId-based scenes enables
sharing of common scenes between those created in code and those referenced
by {@link TransitionManager} XML resource files.
@param sceneRoot The root of the hierarchy in which scene changes
and transitions will take place.
@param layoutId The id of a standard layout resource file.
@param context The context used in the process of inflating
the layout resource.
@return | [
"Returns",
"a",
"Scene",
"described",
"by",
"the",
"resource",
"file",
"associated",
"with",
"the",
"given",
"<code",
">",
"layoutId<",
"/",
"code",
">",
"parameter",
".",
"If",
"such",
"a",
"Scene",
"has",
"already",
"been",
"created",
"that",
"same",
"Sc... | train | https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/Scene.java#L61-L76 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java | FDBigInteger.valueOfPow52 | public static FDBigInteger valueOfPow52(int p5, int p2) {
if (p5 != 0) {
if (p2 == 0) {
return big5pow(p5);
} else if (p5 < SMALL_5_POW.length) {
int pow5 = SMALL_5_POW[p5];
int wordcount = p2 >> 5;
int bitcount = p2 & 0x1f;
if (bitcount == 0) {
return new FDBigInteger(new int[]{pow5}, wordcount);
} else {
return new FDBigInteger(new int[]{
pow5 << bitcount,
pow5 >>> (32 - bitcount)
}, wordcount);
}
} else {
return big5pow(p5).leftShift(p2);
}
} else {
return valueOfPow2(p2);
}
} | java | public static FDBigInteger valueOfPow52(int p5, int p2) {
if (p5 != 0) {
if (p2 == 0) {
return big5pow(p5);
} else if (p5 < SMALL_5_POW.length) {
int pow5 = SMALL_5_POW[p5];
int wordcount = p2 >> 5;
int bitcount = p2 & 0x1f;
if (bitcount == 0) {
return new FDBigInteger(new int[]{pow5}, wordcount);
} else {
return new FDBigInteger(new int[]{
pow5 << bitcount,
pow5 >>> (32 - bitcount)
}, wordcount);
}
} else {
return big5pow(p5).leftShift(p2);
}
} else {
return valueOfPow2(p2);
}
} | [
"public",
"static",
"FDBigInteger",
"valueOfPow52",
"(",
"int",
"p5",
",",
"int",
"p2",
")",
"{",
"if",
"(",
"p5",
"!=",
"0",
")",
"{",
"if",
"(",
"p2",
"==",
"0",
")",
"{",
"return",
"big5pow",
"(",
"p5",
")",
";",
"}",
"else",
"if",
"(",
"p5"... | /*@
@ requires p5 >= 0 && p2 >= 0;
@ assignable \nothing;
@ ensures \result.value() == \old(pow52(p5, p2));
@ | [
"/",
"*"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java#L250-L272 |
ysc/word | src/main/java/org/apdplat/word/WordFrequencyStatistics.java | WordFrequencyStatistics.statistics | private void statistics(Word word, int times, Map<String, AtomicInteger> container){
statistics(word.getText(), times, container);
} | java | private void statistics(Word word, int times, Map<String, AtomicInteger> container){
statistics(word.getText(), times, container);
} | [
"private",
"void",
"statistics",
"(",
"Word",
"word",
",",
"int",
"times",
",",
"Map",
"<",
"String",
",",
"AtomicInteger",
">",
"container",
")",
"{",
"statistics",
"(",
"word",
".",
"getText",
"(",
")",
",",
"times",
",",
"container",
")",
";",
"}"
] | 统计词频
@param word 词
@param times 词频
@param container 内存中保存词频的数据结构 | [
"统计词频"
] | train | https://github.com/ysc/word/blob/5e45607f4e97207f55d1e3bc561abda6b34f7c54/src/main/java/org/apdplat/word/WordFrequencyStatistics.java#L175-L177 |
pressgang-ccms/PressGangCCMSQuery | src/main/java/org/jboss/pressgang/ccms/filter/utils/JPAUtils.java | JPAUtils.findRoot | public static <T> Root<T> findRoot(CriteriaQuery<T> query) {
return findRoot(query, query.getResultType());
} | java | public static <T> Root<T> findRoot(CriteriaQuery<T> query) {
return findRoot(query, query.getResultType());
} | [
"public",
"static",
"<",
"T",
">",
"Root",
"<",
"T",
">",
"findRoot",
"(",
"CriteriaQuery",
"<",
"T",
">",
"query",
")",
"{",
"return",
"findRoot",
"(",
"query",
",",
"query",
".",
"getResultType",
"(",
")",
")",
";",
"}"
] | Find Root of result type
@param query criteria query
@return the root of result type or null if none | [
"Find",
"Root",
"of",
"result",
"type"
] | train | https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/utils/JPAUtils.java#L107-L109 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/persister/MapTilePersisterModel.java | MapTilePersisterModel.saveTiles | private void saveTiles(FileWriting file, int widthInTile, int step, int s) throws IOException
{
for (int tx = 0; tx < widthInTile; tx++)
{
for (int ty = 0; ty < map.getInTileHeight(); ty++)
{
final Tile tile = map.getTile(tx + s * step, ty);
if (tile != null)
{
saveTile(file, tile);
}
}
}
} | java | private void saveTiles(FileWriting file, int widthInTile, int step, int s) throws IOException
{
for (int tx = 0; tx < widthInTile; tx++)
{
for (int ty = 0; ty < map.getInTileHeight(); ty++)
{
final Tile tile = map.getTile(tx + s * step, ty);
if (tile != null)
{
saveTile(file, tile);
}
}
}
} | [
"private",
"void",
"saveTiles",
"(",
"FileWriting",
"file",
",",
"int",
"widthInTile",
",",
"int",
"step",
",",
"int",
"s",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"tx",
"=",
"0",
";",
"tx",
"<",
"widthInTile",
";",
"tx",
"++",
")",
"{"... | Save the active tiles.
@param file The output file.
@param widthInTile The horizontal tiles.
@param step The step number.
@param s The s value.
@throws IOException If error on saving. | [
"Save",
"the",
"active",
"tiles",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/persister/MapTilePersisterModel.java#L144-L157 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java | DeterministicKey.ascertainParentFingerprint | private int ascertainParentFingerprint(DeterministicKey parentKey, int parentFingerprint)
throws IllegalArgumentException {
if (parentFingerprint != 0) {
if (parent != null)
checkArgument(parent.getFingerprint() == parentFingerprint,
"parent fingerprint mismatch",
Integer.toHexString(parent.getFingerprint()), Integer.toHexString(parentFingerprint));
return parentFingerprint;
} else return 0;
} | java | private int ascertainParentFingerprint(DeterministicKey parentKey, int parentFingerprint)
throws IllegalArgumentException {
if (parentFingerprint != 0) {
if (parent != null)
checkArgument(parent.getFingerprint() == parentFingerprint,
"parent fingerprint mismatch",
Integer.toHexString(parent.getFingerprint()), Integer.toHexString(parentFingerprint));
return parentFingerprint;
} else return 0;
} | [
"private",
"int",
"ascertainParentFingerprint",
"(",
"DeterministicKey",
"parentKey",
",",
"int",
"parentFingerprint",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parentFingerprint",
"!=",
"0",
")",
"{",
"if",
"(",
"parent",
"!=",
"null",
")",
"che... | Return the fingerprint of this key's parent as an int value, or zero if this key is the
root node of the key hierarchy. Raise an exception if the arguments are inconsistent.
This method exists to avoid code repetition in the constructors. | [
"Return",
"the",
"fingerprint",
"of",
"this",
"key",
"s",
"parent",
"as",
"an",
"int",
"value",
"or",
"zero",
"if",
"this",
"key",
"is",
"the",
"root",
"node",
"of",
"the",
"key",
"hierarchy",
".",
"Raise",
"an",
"exception",
"if",
"the",
"arguments",
... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java#L118-L127 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/VirtualFile.java | VirtualFile.asDirectoryURL | public URL asDirectoryURL() throws MalformedURLException {
final String pathName = getPathName(false);
return new URL(VFSUtils.VFS_PROTOCOL, "", -1, parent == null ? pathName : pathName + "/", VFSUtils.VFS_URL_HANDLER);
} | java | public URL asDirectoryURL() throws MalformedURLException {
final String pathName = getPathName(false);
return new URL(VFSUtils.VFS_PROTOCOL, "", -1, parent == null ? pathName : pathName + "/", VFSUtils.VFS_URL_HANDLER);
} | [
"public",
"URL",
"asDirectoryURL",
"(",
")",
"throws",
"MalformedURLException",
"{",
"final",
"String",
"pathName",
"=",
"getPathName",
"(",
"false",
")",
";",
"return",
"new",
"URL",
"(",
"VFSUtils",
".",
"VFS_PROTOCOL",
",",
"\"\"",
",",
"-",
"1",
",",
"... | Get file's URL as a directory. There will always be a trailing {@code "/"} character.
@return the url
@throws MalformedURLException if the URL is somehow malformed | [
"Get",
"file",
"s",
"URL",
"as",
"a",
"directory",
".",
"There",
"will",
"always",
"be",
"a",
"trailing",
"{",
"@code",
"/",
"}",
"character",
"."
] | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFile.java#L547-L550 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.