repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.getWrapperProxyClassLoader | private ClassLoader getWrapperProxyClassLoader(BeanMetaData bmd, Class<?> intf) // F58064
throws EJBConfigurationException {
// Wrapper proxies are intended to support application restart scenarios.
// In order to allow GC of the target EJB class loader when the
// application stops, the wrapper proxy class must not be defined by the
// target EJB class loader. Instead, we directly define the class on the
// class loader of the interface.
ClassLoader loader = intf.getClassLoader();
// Classes defined by the boot class loader (i.e., java.lang.Runnable)
// have a null class loader.
if (loader != null) {
try {
loader.loadClass(BusinessLocalWrapperProxy.class.getName());
return loader;
} catch (ClassNotFoundException ex) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "unable to load EJSLocalWrapperProxy for " + intf.getName() + " from " + loader);
}
}
// The class loader of the interface did not have visibility to our
// com.ibm.ejs.container classes, which is required. Attempt to use the
// server class loader instead.
loader = bmd.container.getEJBRuntime().getServerClassLoader();
try {
if (loader.loadClass(intf.getName()) == intf) {
return loader;
}
} catch (ClassNotFoundException ex) {
// Nothing.
}
// The server class loader did not have visibility to the interface
// class. The interface was probably loaded by a non-runtime bundle that
// didn't import com.ibm.ejs.container. Just use the application class
// loader even though this will prevent it from being garbage collected,
// and it will do the wrong thing for package-private methods in
// no-interface view.
return bmd.classLoader; // d727494
} | java | private ClassLoader getWrapperProxyClassLoader(BeanMetaData bmd, Class<?> intf) // F58064
throws EJBConfigurationException {
// Wrapper proxies are intended to support application restart scenarios.
// In order to allow GC of the target EJB class loader when the
// application stops, the wrapper proxy class must not be defined by the
// target EJB class loader. Instead, we directly define the class on the
// class loader of the interface.
ClassLoader loader = intf.getClassLoader();
// Classes defined by the boot class loader (i.e., java.lang.Runnable)
// have a null class loader.
if (loader != null) {
try {
loader.loadClass(BusinessLocalWrapperProxy.class.getName());
return loader;
} catch (ClassNotFoundException ex) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "unable to load EJSLocalWrapperProxy for " + intf.getName() + " from " + loader);
}
}
// The class loader of the interface did not have visibility to our
// com.ibm.ejs.container classes, which is required. Attempt to use the
// server class loader instead.
loader = bmd.container.getEJBRuntime().getServerClassLoader();
try {
if (loader.loadClass(intf.getName()) == intf) {
return loader;
}
} catch (ClassNotFoundException ex) {
// Nothing.
}
// The server class loader did not have visibility to the interface
// class. The interface was probably loaded by a non-runtime bundle that
// didn't import com.ibm.ejs.container. Just use the application class
// loader even though this will prevent it from being garbage collected,
// and it will do the wrong thing for package-private methods in
// no-interface view.
return bmd.classLoader; // d727494
} | [
"private",
"ClassLoader",
"getWrapperProxyClassLoader",
"(",
"BeanMetaData",
"bmd",
",",
"Class",
"<",
"?",
">",
"intf",
")",
"// F58064",
"throws",
"EJBConfigurationException",
"{",
"// Wrapper proxies are intended to support application restart scenarios.",
"// In order to allo... | Returns a class loader that can be used to define a proxy for the
specified interface.
@param bmd the bean metadata
@param intf the interface to proxy
@return the loader
@throws EJBConfigurationException | [
"Returns",
"a",
"class",
"loader",
"that",
"can",
"be",
"used",
"to",
"define",
"a",
"proxy",
"for",
"the",
"specified",
"interface",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L4453-L4495 |
lodborg/interval-tree | src/main/java/com/lodborg/intervaltree/Interval.java | Interval.isLeftOf | public boolean isLeftOf(T point, boolean inclusive){
if (point == null || end == null)
return false;
int compare = point.compareTo(end);
if (compare != 0)
return compare > 0;
return !isEndInclusive() || !inclusive;
} | java | public boolean isLeftOf(T point, boolean inclusive){
if (point == null || end == null)
return false;
int compare = point.compareTo(end);
if (compare != 0)
return compare > 0;
return !isEndInclusive() || !inclusive;
} | [
"public",
"boolean",
"isLeftOf",
"(",
"T",
"point",
",",
"boolean",
"inclusive",
")",
"{",
"if",
"(",
"point",
"==",
"null",
"||",
"end",
"==",
"null",
")",
"return",
"false",
";",
"int",
"compare",
"=",
"point",
".",
"compareTo",
"(",
"end",
")",
";... | This method checks, if this current interval is entirely to the left of a point. More formally,
the method will return {@code true}, if for every point {@code x} from the current interval the inequality
{@code x} < {@code point} holds. If the parameter {@code inclusive} is set to {@code false}, this
method will return {@code true} also if the end point of the interval is equal to the reference
{@code point}.
@param point The reference point
@param inclusive {@code false} if the reference {@code point} is allowed to be the end point
of the current interval.
@return {@code true}, if the current interval is entirely to the left of the {@code other}
interval, or {@code false} instead. | [
"This",
"method",
"checks",
"if",
"this",
"current",
"interval",
"is",
"entirely",
"to",
"the",
"left",
"of",
"a",
"point",
".",
"More",
"formally",
"the",
"method",
"will",
"return",
"{",
"@code",
"true",
"}",
"if",
"for",
"every",
"point",
"{",
"@code"... | train | https://github.com/lodborg/interval-tree/blob/716b18fb0a5a53c9add9926176bc263f14c9bf90/src/main/java/com/lodborg/intervaltree/Interval.java#L434-L441 |
google/closure-templates | java/src/com/google/template/soy/jssrc/internal/JsRuntime.java | JsRuntime.extensionField | public static Expression extensionField(FieldDescriptor desc) {
String jsExtensionImport = ProtoUtils.getJsExtensionImport(desc);
String jsExtensionName = ProtoUtils.getJsExtensionName(desc);
return symbolWithNamespace(jsExtensionImport, jsExtensionName);
} | java | public static Expression extensionField(FieldDescriptor desc) {
String jsExtensionImport = ProtoUtils.getJsExtensionImport(desc);
String jsExtensionName = ProtoUtils.getJsExtensionName(desc);
return symbolWithNamespace(jsExtensionImport, jsExtensionName);
} | [
"public",
"static",
"Expression",
"extensionField",
"(",
"FieldDescriptor",
"desc",
")",
"{",
"String",
"jsExtensionImport",
"=",
"ProtoUtils",
".",
"getJsExtensionImport",
"(",
"desc",
")",
";",
"String",
"jsExtensionName",
"=",
"ProtoUtils",
".",
"getJsExtensionName... | Returns the field containing the extension object for the given field descriptor. | [
"Returns",
"the",
"field",
"containing",
"the",
"extension",
"object",
"for",
"the",
"given",
"field",
"descriptor",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/JsRuntime.java#L179-L183 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachinesInner.java | VirtualMachinesInner.beginUpdate | public VirtualMachineInner beginUpdate(String resourceGroupName, String vmName, VirtualMachineUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, parameters).toBlocking().single().body();
} | java | public VirtualMachineInner beginUpdate(String resourceGroupName, String vmName, VirtualMachineUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, parameters).toBlocking().single().body();
} | [
"public",
"VirtualMachineInner",
"beginUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmName",
",",
"VirtualMachineUpdate",
"parameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmName",
",",
"parameters",
"... | The operation to update a virtual machine.
@param resourceGroupName The name of the resource group.
@param vmName The name of the virtual machine.
@param parameters Parameters supplied to the Update Virtual Machine operation.
@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 VirtualMachineInner object if successful. | [
"The",
"operation",
"to",
"update",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachinesInner.java#L809-L811 |
Azure/azure-sdk-for-java | recoveryservices/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/v2016_06_01/implementation/VaultCertificatesInner.java | VaultCertificatesInner.createAsync | public Observable<VaultCertificateResponseInner> createAsync(String resourceGroupName, String vaultName, String certificateName) {
return createWithServiceResponseAsync(resourceGroupName, vaultName, certificateName).map(new Func1<ServiceResponse<VaultCertificateResponseInner>, VaultCertificateResponseInner>() {
@Override
public VaultCertificateResponseInner call(ServiceResponse<VaultCertificateResponseInner> response) {
return response.body();
}
});
} | java | public Observable<VaultCertificateResponseInner> createAsync(String resourceGroupName, String vaultName, String certificateName) {
return createWithServiceResponseAsync(resourceGroupName, vaultName, certificateName).map(new Func1<ServiceResponse<VaultCertificateResponseInner>, VaultCertificateResponseInner>() {
@Override
public VaultCertificateResponseInner call(ServiceResponse<VaultCertificateResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VaultCertificateResponseInner",
">",
"createAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vaultName",
",",
"String",
"certificateName",
")",
"{",
"return",
"createWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vaultN... | Uploads a certificate for a resource.
@param resourceGroupName The name of the resource group where the recovery services vault is present.
@param vaultName The name of the recovery services vault.
@param certificateName Certificate friendly name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VaultCertificateResponseInner object | [
"Uploads",
"a",
"certificate",
"for",
"a",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/v2016_06_01/implementation/VaultCertificatesInner.java#L102-L109 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java | ServiceEndpointPoliciesInner.beginCreateOrUpdateAsync | public Observable<ServiceEndpointPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serviceEndpointPolicyName, ServiceEndpointPolicyInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, parameters).map(new Func1<ServiceResponse<ServiceEndpointPolicyInner>, ServiceEndpointPolicyInner>() {
@Override
public ServiceEndpointPolicyInner call(ServiceResponse<ServiceEndpointPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<ServiceEndpointPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serviceEndpointPolicyName, ServiceEndpointPolicyInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, parameters).map(new Func1<ServiceResponse<ServiceEndpointPolicyInner>, ServiceEndpointPolicyInner>() {
@Override
public ServiceEndpointPolicyInner call(ServiceResponse<ServiceEndpointPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServiceEndpointPolicyInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serviceEndpointPolicyName",
",",
"ServiceEndpointPolicyInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponse... | Creates or updates a service Endpoint Policies.
@param resourceGroupName The name of the resource group.
@param serviceEndpointPolicyName The name of the service endpoint policy.
@param parameters Parameters supplied to the create or update service endpoint policy operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServiceEndpointPolicyInner object | [
"Creates",
"or",
"updates",
"a",
"service",
"Endpoint",
"Policies",
"."
] | 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/ServiceEndpointPoliciesInner.java#L546-L553 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/FixDependencyChecker.java | FixDependencyChecker.isToBeUninstalled | public boolean isToBeUninstalled(String name, List<UninstallAsset> list) {
for (UninstallAsset asset : list) {
String fixName = asset.getIFixInfo().getId();
if (fixName != null && fixName.equals(name)) {
return true;
}
}
return false;
} | java | public boolean isToBeUninstalled(String name, List<UninstallAsset> list) {
for (UninstallAsset asset : list) {
String fixName = asset.getIFixInfo().getId();
if (fixName != null && fixName.equals(name)) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"isToBeUninstalled",
"(",
"String",
"name",
",",
"List",
"<",
"UninstallAsset",
">",
"list",
")",
"{",
"for",
"(",
"UninstallAsset",
"asset",
":",
"list",
")",
"{",
"String",
"fixName",
"=",
"asset",
".",
"getIFixInfo",
"(",
")",
".",
... | Verify the name is on the uninstall list
@param name symbolic name of the fix
@param list list of the uninstalling fix
@return true if the feature is going to be uninstalled, otherwise, return false. | [
"Verify",
"the",
"name",
"is",
"on",
"the",
"uninstall",
"list"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/FixDependencyChecker.java#L99-L107 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/UserMetadata.java | UserMetadata.isFieldProtected | public static boolean isFieldProtected(FormModel formModel, String fieldName) {
FieldMetadata metaData = formModel.getFieldMetadata(fieldName);
return Boolean.TRUE.equals(metaData.getUserMetadata(UserMetadata.PROTECTED_FIELD));
} | java | public static boolean isFieldProtected(FormModel formModel, String fieldName) {
FieldMetadata metaData = formModel.getFieldMetadata(fieldName);
return Boolean.TRUE.equals(metaData.getUserMetadata(UserMetadata.PROTECTED_FIELD));
} | [
"public",
"static",
"boolean",
"isFieldProtected",
"(",
"FormModel",
"formModel",
",",
"String",
"fieldName",
")",
"{",
"FieldMetadata",
"metaData",
"=",
"formModel",
".",
"getFieldMetadata",
"(",
"fieldName",
")",
";",
"return",
"Boolean",
".",
"TRUE",
".",
"eq... | tests if the usermetadata of the field has a boolean value true for the key {@value #PROTECTED_FIELD}
@param fieldName
the fieldname
@return true if the field is protected, otherwise false | [
"tests",
"if",
"the",
"usermetadata",
"of",
"the",
"field",
"has",
"a",
"boolean",
"value",
"true",
"for",
"the",
"key",
"{",
"@value",
"#PROTECTED_FIELD",
"}"
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/UserMetadata.java#L44-L47 |
ZuInnoTe/hadoopcryptoledger | inputformat/src/main/java/org/zuinnote/hadoop/namecoin/format/common/NamecoinUtil.java | NamecoinUtil.extractNamecoinField | public static String[] extractNamecoinField(byte[] scriptPubKey) {
// check if valid script
if ((scriptPubKey==null) || (scriptPubKey.length<2)) {
return null;
}
// only firstupdate and update work
if (!((scriptPubKey[0]==NamecoinUtil.OP_NAME_UDPATE)|| (scriptPubKey[0]==NamecoinUtil.OP_NAME_FIRSTUPDATE))) {
return null;
}
String[] result = new String[2];
// convert script into ByteBuffer
ByteBuffer scriptByteBuffer = ByteBuffer.wrap(scriptPubKey);
// skip op
scriptByteBuffer.get();
// read name
// get size
long nameSize=BitcoinUtil.convertVarIntByteBufferToLong(scriptByteBuffer);
// extract name
byte[] nameByteArray = new byte[(int)nameSize];
scriptByteBuffer.get(nameByteArray);
String name = new String(nameByteArray,Charset.forName("UTF-8"));
result[0]=name;
if (scriptPubKey[0]==NamecoinUtil.OP_NAME_FIRSTUPDATE) {
// skip intermediate information
long intermediateInformationSize = BitcoinUtil.convertVarIntByteBufferToLong(scriptByteBuffer);
byte[] intermediateInformation=new byte[(int)intermediateInformationSize];
scriptByteBuffer.get(intermediateInformation);
}
// read value
long valueSize = BitcoinUtil.convertVarIntByteBufferToLong(scriptByteBuffer);
byte[] valueByteArray = new byte[(int)valueSize];
scriptByteBuffer.get(valueByteArray);
String value = new String (valueByteArray, Charset.forName("UTF-8"));
result[1]=value;
return result;
} | java | public static String[] extractNamecoinField(byte[] scriptPubKey) {
// check if valid script
if ((scriptPubKey==null) || (scriptPubKey.length<2)) {
return null;
}
// only firstupdate and update work
if (!((scriptPubKey[0]==NamecoinUtil.OP_NAME_UDPATE)|| (scriptPubKey[0]==NamecoinUtil.OP_NAME_FIRSTUPDATE))) {
return null;
}
String[] result = new String[2];
// convert script into ByteBuffer
ByteBuffer scriptByteBuffer = ByteBuffer.wrap(scriptPubKey);
// skip op
scriptByteBuffer.get();
// read name
// get size
long nameSize=BitcoinUtil.convertVarIntByteBufferToLong(scriptByteBuffer);
// extract name
byte[] nameByteArray = new byte[(int)nameSize];
scriptByteBuffer.get(nameByteArray);
String name = new String(nameByteArray,Charset.forName("UTF-8"));
result[0]=name;
if (scriptPubKey[0]==NamecoinUtil.OP_NAME_FIRSTUPDATE) {
// skip intermediate information
long intermediateInformationSize = BitcoinUtil.convertVarIntByteBufferToLong(scriptByteBuffer);
byte[] intermediateInformation=new byte[(int)intermediateInformationSize];
scriptByteBuffer.get(intermediateInformation);
}
// read value
long valueSize = BitcoinUtil.convertVarIntByteBufferToLong(scriptByteBuffer);
byte[] valueByteArray = new byte[(int)valueSize];
scriptByteBuffer.get(valueByteArray);
String value = new String (valueByteArray, Charset.forName("UTF-8"));
result[1]=value;
return result;
} | [
"public",
"static",
"String",
"[",
"]",
"extractNamecoinField",
"(",
"byte",
"[",
"]",
"scriptPubKey",
")",
"{",
"// check if valid script",
"if",
"(",
"(",
"scriptPubKey",
"==",
"null",
")",
"||",
"(",
"scriptPubKey",
".",
"length",
"<",
"2",
")",
")",
"{... | Extracts a Namecoin field name (String) and value field (a JSON object) from a script. Please note that not all Namecoin transactions do contain Namecoin fields, some are coinbase (ie mining) transactions and others are regular transactions to transfer Namecoins (comparable to Bitcoin transactions=
Additionally, you can extract only information related to the OPs NAME_FIRSTUPDATE and NAME_UPDATE, because NAME_NEW does not contain the name, but only a script hash that is used by NAME_FIRSTUPDATE to define the name
There are certain naming conventions that helps to identify the type of field, e.g. if name starts with:
(1) d/ then it is a domain name
(2) s/ or dd/ then it contains further domain data
(3) id/ it contains a public online identity
See also:
https://wiki.namecoin.org/index.php?title=Domain_Name_Specification
https://wiki.namecoin.org/index.php?title=Identity
@param scriptPubKey Output script potentially containing a Namecoin operation
@return Array of size 2 where the first entry is the name (e.g. d/example) and the second entry is a JSON object serialized as String, null if not a valid Namecoin DNS field | [
"Extracts",
"a",
"Namecoin",
"field",
"name",
"(",
"String",
")",
"and",
"value",
"field",
"(",
"a",
"JSON",
"object",
")",
"from",
"a",
"script",
".",
"Please",
"note",
"that",
"not",
"all",
"Namecoin",
"transactions",
"do",
"contain",
"Namecoin",
"fields... | train | https://github.com/ZuInnoTe/hadoopcryptoledger/blob/5c9bfb61dd1a82374cd0de8413a7c66391ee4414/inputformat/src/main/java/org/zuinnote/hadoop/namecoin/format/common/NamecoinUtil.java#L53-L88 |
zerodhatech/javakiteconnect | kiteconnect/src/com/zerodhatech/kiteconnect/kitehttp/KiteRequestHandler.java | KiteRequestHandler.createGetRequest | public Request createGetRequest(String url, String apiKey, String accessToken) {
HttpUrl.Builder httpBuilder = HttpUrl.parse(url).newBuilder();
return new Request.Builder().url(httpBuilder.build()).header("User-Agent", USER_AGENT).header("X-Kite-Version", "3").header("Authorization", "token "+apiKey+":"+accessToken).build();
} | java | public Request createGetRequest(String url, String apiKey, String accessToken) {
HttpUrl.Builder httpBuilder = HttpUrl.parse(url).newBuilder();
return new Request.Builder().url(httpBuilder.build()).header("User-Agent", USER_AGENT).header("X-Kite-Version", "3").header("Authorization", "token "+apiKey+":"+accessToken).build();
} | [
"public",
"Request",
"createGetRequest",
"(",
"String",
"url",
",",
"String",
"apiKey",
",",
"String",
"accessToken",
")",
"{",
"HttpUrl",
".",
"Builder",
"httpBuilder",
"=",
"HttpUrl",
".",
"parse",
"(",
"url",
")",
".",
"newBuilder",
"(",
")",
";",
"retu... | Creates a GET request.
@param url is the endpoint to which request has to be done.
@param apiKey is the api key of the Kite Connect app.
@param accessToken is the access token obtained after successful login process. | [
"Creates",
"a",
"GET",
"request",
"."
] | train | https://github.com/zerodhatech/javakiteconnect/blob/4a3f15ff2c8a1b3b6ec61799f8bb047e4dfeb92d/kiteconnect/src/com/zerodhatech/kiteconnect/kitehttp/KiteRequestHandler.java#L158-L161 |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.getBytes | public static byte[] getBytes(ByteBuf buf, int start, int length) {
return getBytes(buf, start, length, true);
} | java | public static byte[] getBytes(ByteBuf buf, int start, int length) {
return getBytes(buf, start, length, true);
} | [
"public",
"static",
"byte",
"[",
"]",
"getBytes",
"(",
"ByteBuf",
"buf",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"return",
"getBytes",
"(",
"buf",
",",
"start",
",",
"length",
",",
"true",
")",
";",
"}"
] | Create a copy of the underlying storage from {@code buf} into a byte array.
The copy will start at {@code start} and copy {@code length} bytes. | [
"Create",
"a",
"copy",
"of",
"the",
"underlying",
"storage",
"from",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L829-L831 |
DiUS/pact-jvm | pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithoutPath.java | PactDslRequestWithoutPath.queryParameterFromProviderState | public PactDslRequestWithoutPath queryParameterFromProviderState(String name, String expression, String example) {
requestGenerators.addGenerator(Category.QUERY, name, new ProviderStateGenerator(expression));
query.put(name, Collections.singletonList(example));
return this;
} | java | public PactDslRequestWithoutPath queryParameterFromProviderState(String name, String expression, String example) {
requestGenerators.addGenerator(Category.QUERY, name, new ProviderStateGenerator(expression));
query.put(name, Collections.singletonList(example));
return this;
} | [
"public",
"PactDslRequestWithoutPath",
"queryParameterFromProviderState",
"(",
"String",
"name",
",",
"String",
"expression",
",",
"String",
"example",
")",
"{",
"requestGenerators",
".",
"addGenerator",
"(",
"Category",
".",
"QUERY",
",",
"name",
",",
"new",
"Provi... | Adds a query parameter that will have it's value injected from the provider state
@param name Name
@param expression Expression to be evaluated from the provider state
@param example Example value to use in the consumer test | [
"Adds",
"a",
"query",
"parameter",
"that",
"will",
"have",
"it",
"s",
"value",
"injected",
"from",
"the",
"provider",
"state"
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithoutPath.java#L308-L312 |
lucee/Lucee | core/src/main/java/lucee/transformer/bytecode/op/OpDecision.java | OpDecision.toExprBoolean | public static ExprBoolean toExprBoolean(Expression left, Expression right, int operation) {
return new OpDecision(left, right, operation);
} | java | public static ExprBoolean toExprBoolean(Expression left, Expression right, int operation) {
return new OpDecision(left, right, operation);
} | [
"public",
"static",
"ExprBoolean",
"toExprBoolean",
"(",
"Expression",
"left",
",",
"Expression",
"right",
",",
"int",
"operation",
")",
"{",
"return",
"new",
"OpDecision",
"(",
"left",
",",
"right",
",",
"operation",
")",
";",
"}"
] | Create a String expression from a operation
@param left
@param right
@return String expression | [
"Create",
"a",
"String",
"expression",
"from",
"a",
"operation"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/op/OpDecision.java#L67-L69 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java | ClassReader.enterTypevars | protected void enterTypevars(Symbol sym, Type t) {
if (t.getEnclosingType() != null) {
if (!t.getEnclosingType().hasTag(TypeTag.NONE)) {
enterTypevars(sym.owner, t.getEnclosingType());
}
} else if (sym.kind == MTH && !sym.isStatic()) {
enterTypevars(sym.owner, sym.owner.type);
}
for (List<Type> xs = t.getTypeArguments(); xs.nonEmpty(); xs = xs.tail) {
typevars.enter(xs.head.tsym);
}
} | java | protected void enterTypevars(Symbol sym, Type t) {
if (t.getEnclosingType() != null) {
if (!t.getEnclosingType().hasTag(TypeTag.NONE)) {
enterTypevars(sym.owner, t.getEnclosingType());
}
} else if (sym.kind == MTH && !sym.isStatic()) {
enterTypevars(sym.owner, sym.owner.type);
}
for (List<Type> xs = t.getTypeArguments(); xs.nonEmpty(); xs = xs.tail) {
typevars.enter(xs.head.tsym);
}
} | [
"protected",
"void",
"enterTypevars",
"(",
"Symbol",
"sym",
",",
"Type",
"t",
")",
"{",
"if",
"(",
"t",
".",
"getEnclosingType",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"t",
".",
"getEnclosingType",
"(",
")",
".",
"hasTag",
"(",
"TypeTag",
... | Enter type variables of this classtype and all enclosing ones in
`typevars'. | [
"Enter",
"type",
"variables",
"of",
"this",
"classtype",
"and",
"all",
"enclosing",
"ones",
"in",
"typevars",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L2543-L2554 |
ineunetOS/knife-commons | knife-commons-utils/src/main/java/com/ineunet/knife/util/StringUtils.java | StringUtils.indexOf | public static int indexOf(String str, String searchStr, int startPos) {
if (str == null || searchStr == null) {
return INDEX_NOT_FOUND;
}
// JDK1.2/JDK1.3 have a bug, when startPos > str.length for "", hence
if (searchStr.length() == 0 && startPos >= str.length()) {
return str.length();
}
return str.indexOf(searchStr, startPos);
} | java | public static int indexOf(String str, String searchStr, int startPos) {
if (str == null || searchStr == null) {
return INDEX_NOT_FOUND;
}
// JDK1.2/JDK1.3 have a bug, when startPos > str.length for "", hence
if (searchStr.length() == 0 && startPos >= str.length()) {
return str.length();
}
return str.indexOf(searchStr, startPos);
} | [
"public",
"static",
"int",
"indexOf",
"(",
"String",
"str",
",",
"String",
"searchStr",
",",
"int",
"startPos",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"searchStr",
"==",
"null",
")",
"{",
"return",
"INDEX_NOT_FOUND",
";",
"}",
"// JDK1.2/JDK1.3 ha... | <p>Finds the first index within a String, handling <code>null</code>.
This method uses {@link String#indexOf(String, int)}.</p>
<p>A <code>null</code> String will return <code>-1</code>.
A negative start position is treated as zero.
An empty ("") search String always matches.
A start position greater than the string length only matches
an empty search String.</p>
<pre>
StringUtils.indexOf(null, *, *) = -1
StringUtils.indexOf(*, null, *) = -1
StringUtils.indexOf("", "", 0) = 0
StringUtils.indexOf("", *, 0) = -1 (except when * = "")
StringUtils.indexOf("aabaabaa", "a", 0) = 0
StringUtils.indexOf("aabaabaa", "b", 0) = 2
StringUtils.indexOf("aabaabaa", "ab", 0) = 1
StringUtils.indexOf("aabaabaa", "b", 3) = 5
StringUtils.indexOf("aabaabaa", "b", 9) = -1
StringUtils.indexOf("aabaabaa", "b", -1) = 2
StringUtils.indexOf("aabaabaa", "", 2) = 2
StringUtils.indexOf("abc", "", 9) = 3
</pre>
@param str the String to check, may be null
@param searchStr the String to find, may be null
@param startPos the start position, negative treated as zero
@return the first index of the search String,
-1 if no match or <code>null</code> string input
@since 2.0 | [
"<p",
">",
"Finds",
"the",
"first",
"index",
"within",
"a",
"String",
"handling",
"<code",
">",
"null<",
"/",
"code",
">",
".",
"This",
"method",
"uses",
"{",
"@link",
"String#indexOf",
"(",
"String",
"int",
")",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ineunetOS/knife-commons/blob/eae9e59afa020a00ae8977c10d43ac8ae46ae236/knife-commons-utils/src/main/java/com/ineunet/knife/util/StringUtils.java#L852-L861 |
arquillian/arquillian-extension-warp | impl/src/main/java/org/jboss/arquillian/warp/impl/utils/URLUtils.java | URLUtils.buildUrl | public static URL buildUrl(String context, String... relocations) {
try {
return buildUrl(new URL(context), relocations);
} catch (MalformedURLException e) {
throw new AssertionError("URL('" + context + "') isn't valid URL");
}
} | java | public static URL buildUrl(String context, String... relocations) {
try {
return buildUrl(new URL(context), relocations);
} catch (MalformedURLException e) {
throw new AssertionError("URL('" + context + "') isn't valid URL");
}
} | [
"public",
"static",
"URL",
"buildUrl",
"(",
"String",
"context",
",",
"String",
"...",
"relocations",
")",
"{",
"try",
"{",
"return",
"buildUrl",
"(",
"new",
"URL",
"(",
"context",
")",
",",
"relocations",
")",
";",
"}",
"catch",
"(",
"MalformedURLExceptio... | Use URL context and one or more relocations to build end URL.
@param context first URL used like a context root for all relocation changes
@param relocations array of relocation URLs
@return end url after all changes made on context with relocations
@throws AssertionError when context or some of relocations are malformed URLs | [
"Use",
"URL",
"context",
"and",
"one",
"or",
"more",
"relocations",
"to",
"build",
"end",
"URL",
"."
] | train | https://github.com/arquillian/arquillian-extension-warp/blob/e958f4d782851baf7f40e39835d3d1ad185b74dd/impl/src/main/java/org/jboss/arquillian/warp/impl/utils/URLUtils.java#L40-L46 |
infinispan/infinispan | core/src/main/java/org/infinispan/util/concurrent/locks/StripedLock.java | StripedLock.acquireLock | public void acquireLock(Object key, boolean exclusive) {
ReentrantReadWriteLock lock = getLock(key);
if (exclusive) {
lock.writeLock().lock();
if (trace) log.tracef("WL acquired for '%s'", key);
} else {
lock.readLock().lock();
if (trace) log.tracef("RL acquired for '%s'", key);
}
} | java | public void acquireLock(Object key, boolean exclusive) {
ReentrantReadWriteLock lock = getLock(key);
if (exclusive) {
lock.writeLock().lock();
if (trace) log.tracef("WL acquired for '%s'", key);
} else {
lock.readLock().lock();
if (trace) log.tracef("RL acquired for '%s'", key);
}
} | [
"public",
"void",
"acquireLock",
"(",
"Object",
"key",
",",
"boolean",
"exclusive",
")",
"{",
"ReentrantReadWriteLock",
"lock",
"=",
"getLock",
"(",
"key",
")",
";",
"if",
"(",
"exclusive",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
... | Blocks until a lock is acquired.
@param exclusive if true, a write (exclusive) lock is attempted, otherwise a read (shared) lock is used. | [
"Blocks",
"until",
"a",
"lock",
"is",
"acquired",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/concurrent/locks/StripedLock.java#L74-L83 |
LearnLib/learnlib | algorithms/active/ttt/src/main/java/de/learnlib/algorithms/ttt/base/BlockList.java | BlockList.insertBlock | public void insertBlock(AbstractBaseDTNode<I, D> blockRoot) {
blockRoot.removeFromBlockList();
blockRoot.setNextElement(next);
if (getNextElement() != null) {
next.setPrevElement(blockRoot);
}
blockRoot.setPrevElement(this);
next = blockRoot;
} | java | public void insertBlock(AbstractBaseDTNode<I, D> blockRoot) {
blockRoot.removeFromBlockList();
blockRoot.setNextElement(next);
if (getNextElement() != null) {
next.setPrevElement(blockRoot);
}
blockRoot.setPrevElement(this);
next = blockRoot;
} | [
"public",
"void",
"insertBlock",
"(",
"AbstractBaseDTNode",
"<",
"I",
",",
"D",
">",
"blockRoot",
")",
"{",
"blockRoot",
".",
"removeFromBlockList",
"(",
")",
";",
"blockRoot",
".",
"setNextElement",
"(",
"next",
")",
";",
"if",
"(",
"getNextElement",
"(",
... | Inserts a block into the list. Currently, the block is inserted at the head of the list. However, callers should
not rely on this.
@param blockRoot
the root node of the block to be inserted | [
"Inserts",
"a",
"block",
"into",
"the",
"list",
".",
"Currently",
"the",
"block",
"is",
"inserted",
"at",
"the",
"head",
"of",
"the",
"list",
".",
"However",
"callers",
"should",
"not",
"rely",
"on",
"this",
"."
] | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/ttt/src/main/java/de/learnlib/algorithms/ttt/base/BlockList.java#L38-L47 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFSubstitution.java | ModulusSubstitution.doSubstitution | public void doSubstitution(long number, StringBuilder toInsertInto, int position, int recursionCount) {
// if this isn't a >>> substitution, just use the inherited version
// of this function (which uses either a rule set or a DecimalFormat
// to format its substitution value)
if (ruleToUse == null) {
super.doSubstitution(number, toInsertInto, position, recursionCount);
} else {
// a >>> substitution goes straight to a particular rule to
// format the substitution value
long numberToFormat = transformNumber(number);
ruleToUse.doFormat(numberToFormat, toInsertInto, position + pos, recursionCount);
}
} | java | public void doSubstitution(long number, StringBuilder toInsertInto, int position, int recursionCount) {
// if this isn't a >>> substitution, just use the inherited version
// of this function (which uses either a rule set or a DecimalFormat
// to format its substitution value)
if (ruleToUse == null) {
super.doSubstitution(number, toInsertInto, position, recursionCount);
} else {
// a >>> substitution goes straight to a particular rule to
// format the substitution value
long numberToFormat = transformNumber(number);
ruleToUse.doFormat(numberToFormat, toInsertInto, position + pos, recursionCount);
}
} | [
"public",
"void",
"doSubstitution",
"(",
"long",
"number",
",",
"StringBuilder",
"toInsertInto",
",",
"int",
"position",
",",
"int",
"recursionCount",
")",
"{",
"// if this isn't a >>> substitution, just use the inherited version",
"// of this function (which uses either a rule s... | If this is a >>> substitution, use ruleToUse to fill in
the substitution. Otherwise, just use the superclass function.
@param number The number being formatted
@param toInsertInto The string to insert the result of this substitution
into
@param position The position of the rule text in toInsertInto | [
"If",
"this",
"is",
"a",
">",
";",
">",
";",
">",
";",
"substitution",
"use",
"ruleToUse",
"to",
"fill",
"in",
"the",
"substitution",
".",
"Otherwise",
"just",
"use",
"the",
"superclass",
"function",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFSubstitution.java#L879-L892 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/DefaultBeanContext.java | DefaultBeanContext.getActiveBeanRegistration | @Nullable
protected <T> BeanRegistration<T> getActiveBeanRegistration(BeanDefinition<T> beanDefinition, Qualifier qualifier) {
if (beanDefinition == null) {
return null;
}
return singletonObjects.get(new BeanKey(beanDefinition, qualifier));
} | java | @Nullable
protected <T> BeanRegistration<T> getActiveBeanRegistration(BeanDefinition<T> beanDefinition, Qualifier qualifier) {
if (beanDefinition == null) {
return null;
}
return singletonObjects.get(new BeanKey(beanDefinition, qualifier));
} | [
"@",
"Nullable",
"protected",
"<",
"T",
">",
"BeanRegistration",
"<",
"T",
">",
"getActiveBeanRegistration",
"(",
"BeanDefinition",
"<",
"T",
">",
"beanDefinition",
",",
"Qualifier",
"qualifier",
")",
"{",
"if",
"(",
"beanDefinition",
"==",
"null",
")",
"{",
... | Find an active {@link javax.inject.Singleton} bean for the given definition and qualifier.
@param beanDefinition The bean definition
@param qualifier The qualifier
@param <T> The bean generic type
@return The bean registration | [
"Find",
"an",
"active",
"{",
"@link",
"javax",
".",
"inject",
".",
"Singleton",
"}",
"bean",
"for",
"the",
"given",
"definition",
"and",
"qualifier",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/DefaultBeanContext.java#L787-L793 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java | SyncMembersInner.refreshMemberSchema | public void refreshMemberSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) {
refreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().last().body();
} | java | public void refreshMemberSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) {
refreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().last().body();
} | [
"public",
"void",
"refreshMemberSchema",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"syncGroupName",
",",
"String",
"syncMemberName",
")",
"{",
"refreshMemberSchemaWithServiceResponseAsync",
"(",
"resourc... | Refreshes a sync member database schema.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database on which the sync group is hosted.
@param syncGroupName The name of the sync group on which the sync member is hosted.
@param syncMemberName The name of the sync member.
@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 | [
"Refreshes",
"a",
"sync",
"member",
"database",
"schema",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java#L1151-L1153 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuOccupancyMaxActiveBlocksPerMultiprocessor | public static int cuOccupancyMaxActiveBlocksPerMultiprocessor(int numBlocks[], CUfunction func, int blockSize, long dynamicSMemSize)
{
return checkResult(cuOccupancyMaxActiveBlocksPerMultiprocessorNative(numBlocks, func, blockSize, dynamicSMemSize));
} | java | public static int cuOccupancyMaxActiveBlocksPerMultiprocessor(int numBlocks[], CUfunction func, int blockSize, long dynamicSMemSize)
{
return checkResult(cuOccupancyMaxActiveBlocksPerMultiprocessorNative(numBlocks, func, blockSize, dynamicSMemSize));
} | [
"public",
"static",
"int",
"cuOccupancyMaxActiveBlocksPerMultiprocessor",
"(",
"int",
"numBlocks",
"[",
"]",
",",
"CUfunction",
"func",
",",
"int",
"blockSize",
",",
"long",
"dynamicSMemSize",
")",
"{",
"return",
"checkResult",
"(",
"cuOccupancyMaxActiveBlocksPerMultipr... | <code><pre>
\brief Returns occupancy of a function
Returns in \p *numBlocks the number of the maximum active blocks per
streaming multiprocessor.
\param numBlocks - Returned occupancy
\param func - Kernel for which occupancy is calulated
\param blockSize - Block size the kernel is intended to be launched with
\param dynamicSMemSize - Per-block dynamic shared memory usage intended, in bytes
\return
::CUDA_SUCCESS,
::CUDA_ERROR_DEINITIALIZED,
::CUDA_ERROR_NOT_INITIALIZED,
::CUDA_ERROR_INVALID_CONTEXT,
::CUDA_ERROR_INVALID_VALUE,
::CUDA_ERROR_UNKNOWN
\notefnerr
</pre></code> | [
"<code",
">",
"<pre",
">",
"\\",
"brief",
"Returns",
"occupancy",
"of",
"a",
"function"
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L13055-L13058 |
jbundle/jbundle | model/base/src/main/java/org/jbundle/model/util/Util.java | Util.isNumeric | public static boolean isNumeric(String string, boolean bAllowFormatting)
{
if ((string == null) || (string.length() == 0))
return false;
boolean bIsNumeric = true;
for (int i = 0; i < string.length(); i++)
{
if (!Character.isDigit(string.charAt(i)))
{
if ((!bAllowFormatting)
|| (Character.isLetter(string.charAt(i))))
bIsNumeric = false;
}
}
return bIsNumeric;
} | java | public static boolean isNumeric(String string, boolean bAllowFormatting)
{
if ((string == null) || (string.length() == 0))
return false;
boolean bIsNumeric = true;
for (int i = 0; i < string.length(); i++)
{
if (!Character.isDigit(string.charAt(i)))
{
if ((!bAllowFormatting)
|| (Character.isLetter(string.charAt(i))))
bIsNumeric = false;
}
}
return bIsNumeric;
} | [
"public",
"static",
"boolean",
"isNumeric",
"(",
"String",
"string",
",",
"boolean",
"bAllowFormatting",
")",
"{",
"if",
"(",
"(",
"string",
"==",
"null",
")",
"||",
"(",
"string",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"return",
"false",
";",
... | Is this string a valid number?
@param string The string to check.
@return true if this string is a valid number (all characters numeric). | [
"Is",
"this",
"string",
"a",
"valid",
"number?"
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L135-L150 |
jboss/jboss-el-api_spec | src/main/java/org/jboss/el/cache/FactoryFinderCache.java | FactoryFinderCache.addCacheEntry | public static void addCacheEntry(final ClassLoader classLoader, final String factoryId, final String factoryClassName) {
if (factoryClassName == null) {
CLASS_CACHE.put(new CacheKey(classLoader, factoryId), "");
} else {
CLASS_CACHE.put(new CacheKey(classLoader, factoryId), factoryClassName);
}
} | java | public static void addCacheEntry(final ClassLoader classLoader, final String factoryId, final String factoryClassName) {
if (factoryClassName == null) {
CLASS_CACHE.put(new CacheKey(classLoader, factoryId), "");
} else {
CLASS_CACHE.put(new CacheKey(classLoader, factoryId), factoryClassName);
}
} | [
"public",
"static",
"void",
"addCacheEntry",
"(",
"final",
"ClassLoader",
"classLoader",
",",
"final",
"String",
"factoryId",
",",
"final",
"String",
"factoryClassName",
")",
"{",
"if",
"(",
"factoryClassName",
"==",
"null",
")",
"{",
"CLASS_CACHE",
".",
"put",
... | Called by the container at deployment time to set the name of a given factory, to remove the need for the
implementation to look it up on every call.
@param classLoader The deployments class loader
@param factoryId The type of factory that is being recorded (at this stage only javax.el.ExpressionFactory has any effect
@param factoryClassName The name of the factory class that is present in the deployment, or null if none is present | [
"Called",
"by",
"the",
"container",
"at",
"deployment",
"time",
"to",
"set",
"the",
"name",
"of",
"a",
"given",
"factory",
"to",
"remove",
"the",
"need",
"for",
"the",
"implementation",
"to",
"look",
"it",
"up",
"on",
"every",
"call",
"."
] | train | https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/org/jboss/el/cache/FactoryFinderCache.java#L47-L53 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java | DataService.executeCDCQueryAsync | public void executeCDCQueryAsync(List<? extends IEntity> entities, String changedSince, CallbackHandler callbackHandler) throws FMSException {
IntuitMessage intuitMessage = prepareCDCQuery(entities, changedSince);
//set callback handler
intuitMessage.getRequestElements().setCallbackHandler(callbackHandler);
//execute async interceptors
executeAsyncInterceptors(intuitMessage);
} | java | public void executeCDCQueryAsync(List<? extends IEntity> entities, String changedSince, CallbackHandler callbackHandler) throws FMSException {
IntuitMessage intuitMessage = prepareCDCQuery(entities, changedSince);
//set callback handler
intuitMessage.getRequestElements().setCallbackHandler(callbackHandler);
//execute async interceptors
executeAsyncInterceptors(intuitMessage);
} | [
"public",
"void",
"executeCDCQueryAsync",
"(",
"List",
"<",
"?",
"extends",
"IEntity",
">",
"entities",
",",
"String",
"changedSince",
",",
"CallbackHandler",
"callbackHandler",
")",
"throws",
"FMSException",
"{",
"IntuitMessage",
"intuitMessage",
"=",
"prepareCDCQuer... | Method to retrieve records for the given list of query in asynchronous fashion
@param entities the list of entities to be listed in the response
@param changedSince the date where the entities should be listed from the last changed date
@param callbackHandler
the callback handler
@throws FMSException | [
"Method",
"to",
"retrieve",
"records",
"for",
"the",
"given",
"list",
"of",
"query",
"in",
"asynchronous",
"fashion"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L984-L992 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/GZIPOutputStream.java | GZIPOutputStream.writeShort | private void writeShort(int s, byte[] buf, int offset) throws IOException {
buf[offset] = (byte)(s & 0xff);
buf[offset + 1] = (byte)((s >> 8) & 0xff);
} | java | private void writeShort(int s, byte[] buf, int offset) throws IOException {
buf[offset] = (byte)(s & 0xff);
buf[offset + 1] = (byte)((s >> 8) & 0xff);
} | [
"private",
"void",
"writeShort",
"(",
"int",
"s",
",",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
")",
"throws",
"IOException",
"{",
"buf",
"[",
"offset",
"]",
"=",
"(",
"byte",
")",
"(",
"s",
"&",
"0xff",
")",
";",
"buf",
"[",
"offset",
"+",... | /*
Writes short integer in Intel byte order to a byte array, starting
at a given offset | [
"/",
"*",
"Writes",
"short",
"integer",
"in",
"Intel",
"byte",
"order",
"to",
"a",
"byte",
"array",
"starting",
"at",
"a",
"given",
"offset"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/GZIPOutputStream.java#L218-L221 |
elki-project/elki | elki-data-generator/src/main/java/de/lmu/ifi/dbs/elki/datasource/GeneratorXMLDatabaseConnection.java | GeneratorXMLDatabaseConnection.processElementStatic | private void processElementStatic(GeneratorMain gen, Node cur) {
String name = ((Element) cur).getAttribute(ATTR_NAME);
if(name == null) {
throw new AbortException("No cluster name given in specification file.");
}
ArrayList<double[]> points = new ArrayList<>();
// TODO: check for unknown attributes.
XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild());
while(iter.hasNext()) {
Node child = iter.next();
if(TAG_POINT.equals(child.getNodeName())) {
processElementPoint(points, child);
}
else if(child.getNodeType() == Node.ELEMENT_NODE) {
LOG.warning("Unknown element in XML specification file: " + child.getNodeName());
}
}
// *** add new cluster object
GeneratorStatic cluster = new GeneratorStatic(name, points);
gen.addCluster(cluster);
if(LOG.isVerbose()) {
LOG.verbose("Loaded cluster " + cluster.name + " from specification.");
}
} | java | private void processElementStatic(GeneratorMain gen, Node cur) {
String name = ((Element) cur).getAttribute(ATTR_NAME);
if(name == null) {
throw new AbortException("No cluster name given in specification file.");
}
ArrayList<double[]> points = new ArrayList<>();
// TODO: check for unknown attributes.
XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild());
while(iter.hasNext()) {
Node child = iter.next();
if(TAG_POINT.equals(child.getNodeName())) {
processElementPoint(points, child);
}
else if(child.getNodeType() == Node.ELEMENT_NODE) {
LOG.warning("Unknown element in XML specification file: " + child.getNodeName());
}
}
// *** add new cluster object
GeneratorStatic cluster = new GeneratorStatic(name, points);
gen.addCluster(cluster);
if(LOG.isVerbose()) {
LOG.verbose("Loaded cluster " + cluster.name + " from specification.");
}
} | [
"private",
"void",
"processElementStatic",
"(",
"GeneratorMain",
"gen",
",",
"Node",
"cur",
")",
"{",
"String",
"name",
"=",
"(",
"(",
"Element",
")",
"cur",
")",
".",
"getAttribute",
"(",
"ATTR_NAME",
")",
";",
"if",
"(",
"name",
"==",
"null",
")",
"{... | Process a 'static' cluster Element in the XML stream.
@param gen Generator
@param cur Current document nod | [
"Process",
"a",
"static",
"cluster",
"Element",
"in",
"the",
"XML",
"stream",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-data-generator/src/main/java/de/lmu/ifi/dbs/elki/datasource/GeneratorXMLDatabaseConnection.java#L635-L660 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Field.java | Field.newBuilder | public static Builder newBuilder(String name, LegacySQLTypeName type, Field... subFields) {
return new Builder().setName(name).setType(type, subFields);
} | java | public static Builder newBuilder(String name, LegacySQLTypeName type, Field... subFields) {
return new Builder().setName(name).setType(type, subFields);
} | [
"public",
"static",
"Builder",
"newBuilder",
"(",
"String",
"name",
",",
"LegacySQLTypeName",
"type",
",",
"Field",
"...",
"subFields",
")",
"{",
"return",
"new",
"Builder",
"(",
")",
".",
"setName",
"(",
"name",
")",
".",
"setType",
"(",
"type",
",",
"s... | Returns a builder for a Field object with given name and type. | [
"Returns",
"a",
"builder",
"for",
"a",
"Field",
"object",
"with",
"given",
"name",
"and",
"type",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Field.java#L274-L276 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.pinholeToMatrix | public static FMatrixRMaj pinholeToMatrix(CameraPinhole param , FMatrixRMaj K )
{
return ImplPerspectiveOps_F32.pinholeToMatrix(param, K);
} | java | public static FMatrixRMaj pinholeToMatrix(CameraPinhole param , FMatrixRMaj K )
{
return ImplPerspectiveOps_F32.pinholeToMatrix(param, K);
} | [
"public",
"static",
"FMatrixRMaj",
"pinholeToMatrix",
"(",
"CameraPinhole",
"param",
",",
"FMatrixRMaj",
"K",
")",
"{",
"return",
"ImplPerspectiveOps_F32",
".",
"pinholeToMatrix",
"(",
"param",
",",
"K",
")",
";",
"}"
] | Given the intrinsic parameters create a calibration matrix
@param param Intrinsic parameters structure that is to be converted into a matrix
@param K Storage for calibration matrix, must be 3x3. If null then a new matrix is declared
@return Calibration matrix 3x3 | [
"Given",
"the",
"intrinsic",
"parameters",
"create",
"a",
"calibration",
"matrix"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L271-L274 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupPartitioner.java | KeyGroupPartitioner.reportKeyGroupOfElementAtIndex | protected void reportKeyGroupOfElementAtIndex(int index, int keyGroup) {
final int keyGroupIndex = keyGroup - firstKeyGroup;
elementKeyGroups[index] = keyGroupIndex;
++counterHistogram[keyGroupIndex];
} | java | protected void reportKeyGroupOfElementAtIndex(int index, int keyGroup) {
final int keyGroupIndex = keyGroup - firstKeyGroup;
elementKeyGroups[index] = keyGroupIndex;
++counterHistogram[keyGroupIndex];
} | [
"protected",
"void",
"reportKeyGroupOfElementAtIndex",
"(",
"int",
"index",
",",
"int",
"keyGroup",
")",
"{",
"final",
"int",
"keyGroupIndex",
"=",
"keyGroup",
"-",
"firstKeyGroup",
";",
"elementKeyGroups",
"[",
"index",
"]",
"=",
"keyGroupIndex",
";",
"++",
"co... | This method reports in the bookkeeping data that the element at the given index belongs to the given key-group. | [
"This",
"method",
"reports",
"in",
"the",
"bookkeeping",
"data",
"that",
"the",
"element",
"at",
"the",
"given",
"index",
"belongs",
"to",
"the",
"given",
"key",
"-",
"group",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupPartitioner.java#L161-L165 |
Azure/azure-sdk-for-java | policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyDefinitionsInner.java | PolicyDefinitionsInner.deleteAtManagementGroupAsync | public Observable<Void> deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) {
return deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) {
return deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"deleteAtManagementGroupAsync",
"(",
"String",
"policyDefinitionName",
",",
"String",
"managementGroupId",
")",
"{",
"return",
"deleteAtManagementGroupWithServiceResponseAsync",
"(",
"policyDefinitionName",
",",
"managementGroupId",
"... | Deletes a policy definition at management group level.
@param policyDefinitionName The name of the policy definition to delete.
@param managementGroupId The ID of the management group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Deletes",
"a",
"policy",
"definition",
"at",
"management",
"group",
"level",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyDefinitionsInner.java#L564-L571 |
cdk/cdk | tool/charges/src/main/java/org/openscience/cdk/charges/Polarizability.java | Polarizability.getNumberOfHydrogen | private int getNumberOfHydrogen(IAtomContainer atomContainer, IAtom atom) {
java.util.List<IBond> bonds = atomContainer.getConnectedBondsList(atom);
IAtom connectedAtom;
int hCounter = 0;
for (IBond bond : bonds) {
connectedAtom = bond.getOther(atom);
if (connectedAtom.getSymbol().equals("H")) {
hCounter += 1;
}
}
return hCounter;
} | java | private int getNumberOfHydrogen(IAtomContainer atomContainer, IAtom atom) {
java.util.List<IBond> bonds = atomContainer.getConnectedBondsList(atom);
IAtom connectedAtom;
int hCounter = 0;
for (IBond bond : bonds) {
connectedAtom = bond.getOther(atom);
if (connectedAtom.getSymbol().equals("H")) {
hCounter += 1;
}
}
return hCounter;
} | [
"private",
"int",
"getNumberOfHydrogen",
"(",
"IAtomContainer",
"atomContainer",
",",
"IAtom",
"atom",
")",
"{",
"java",
".",
"util",
".",
"List",
"<",
"IBond",
">",
"bonds",
"=",
"atomContainer",
".",
"getConnectedBondsList",
"(",
"atom",
")",
";",
"IAtom",
... | Gets the numberOfHydrogen attribute of the Polarizability object.
@param atomContainer Description of the Parameter
@param atom Description of the Parameter
@return The numberOfHydrogen value | [
"Gets",
"the",
"numberOfHydrogen",
"attribute",
"of",
"the",
"Polarizability",
"object",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/charges/src/main/java/org/openscience/cdk/charges/Polarizability.java#L298-L309 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/doc/DocClient.java | DocClient.listDocuments | public ListDocumentsResponse listDocuments(String status, String marker, int maxSize) {
ListDocumentsRequest request = new ListDocumentsRequest();
InternalRequest internalRequest = this.createRequest(HttpMethodName.GET, request, DOC);
internalRequest.addParameter("status", status);
if (marker != null) {
internalRequest.addParameter("marker", marker);
}
internalRequest.addParameter("maxSize", String.valueOf(maxSize));
ListDocumentsResponse response;
try {
response = this.invokeHttpClient(internalRequest, ListDocumentsResponse.class);
} finally {
try {
internalRequest.getContent().close();
} catch (Exception e) {
// ignore exception
}
}
return response;
} | java | public ListDocumentsResponse listDocuments(String status, String marker, int maxSize) {
ListDocumentsRequest request = new ListDocumentsRequest();
InternalRequest internalRequest = this.createRequest(HttpMethodName.GET, request, DOC);
internalRequest.addParameter("status", status);
if (marker != null) {
internalRequest.addParameter("marker", marker);
}
internalRequest.addParameter("maxSize", String.valueOf(maxSize));
ListDocumentsResponse response;
try {
response = this.invokeHttpClient(internalRequest, ListDocumentsResponse.class);
} finally {
try {
internalRequest.getContent().close();
} catch (Exception e) {
// ignore exception
}
}
return response;
} | [
"public",
"ListDocumentsResponse",
"listDocuments",
"(",
"String",
"status",
",",
"String",
"marker",
",",
"int",
"maxSize",
")",
"{",
"ListDocumentsRequest",
"request",
"=",
"new",
"ListDocumentsRequest",
"(",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"t... | list all Document by status, marker.
@param status document status
@param marker the marker, can be ""
@param maxSize the maxSize, should be (0, 200]
@return A ListDocumentsResponse object containing the information returned by Document. | [
"list",
"all",
"Document",
"by",
"status",
"marker",
".",
"@param",
"status",
"document",
"status",
"@param",
"marker",
"the",
"marker",
"can",
"be",
"@param",
"maxSize",
"the",
"maxSize",
"should",
"be",
"(",
"0",
"200",
"]"
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/doc/DocClient.java#L593-L614 |
jayantk/jklol | src/com/jayantkrish/jklol/models/bayesnet/CptTableFactor.java | CptTableFactor.getTensorFromVariables | private static TensorBuilder getTensorFromVariables(VariableNumMap variables) {
// Get the dimensions and dimension sizes for the tensor.
int[] dimensions = variables.getVariableNumsArray();
int[] sizes = new int[dimensions.length];
List<DiscreteVariable> varTypes = variables.getDiscreteVariables();
for (int i = 0; i < varTypes.size(); i++) {
sizes[i] = varTypes.get(i).numValues();
}
return new SparseTensorBuilder(dimensions, sizes);
} | java | private static TensorBuilder getTensorFromVariables(VariableNumMap variables) {
// Get the dimensions and dimension sizes for the tensor.
int[] dimensions = variables.getVariableNumsArray();
int[] sizes = new int[dimensions.length];
List<DiscreteVariable> varTypes = variables.getDiscreteVariables();
for (int i = 0; i < varTypes.size(); i++) {
sizes[i] = varTypes.get(i).numValues();
}
return new SparseTensorBuilder(dimensions, sizes);
} | [
"private",
"static",
"TensorBuilder",
"getTensorFromVariables",
"(",
"VariableNumMap",
"variables",
")",
"{",
"// Get the dimensions and dimension sizes for the tensor.",
"int",
"[",
"]",
"dimensions",
"=",
"variables",
".",
"getVariableNumsArray",
"(",
")",
";",
"int",
"... | Constructs a tensor with one dimension per variable in {@code variables}.
@param variables
@return | [
"Constructs",
"a",
"tensor",
"with",
"one",
"dimension",
"per",
"variable",
"in",
"{",
"@code",
"variables",
"}",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/bayesnet/CptTableFactor.java#L89-L98 |
digipost/signature-api-client-java | src/main/java/no/digipost/signature/client/security/KeyStoreConfig.java | KeyStoreConfig.fromOrganizationCertificate | public static KeyStoreConfig fromOrganizationCertificate(final InputStream organizationCertificateStream, final String privatekeyPassword) {
KeyStore ks = KeyStoreType.PKCS12.loadKeyStore(organizationCertificateStream, privatekeyPassword);
Enumeration<String> aliases;
try {
aliases = ks.aliases();
} catch (KeyStoreException e) {
throw new KeyException(
"Could not retrieve aliases from the key store, because " + e.getClass().getSimpleName() + ": " +
"'" + e.getMessage() + "'. Are you sure this is an organization certificate in PKCS12 format?", e);
}
if (!aliases.hasMoreElements()) {
throw new KeyException("The keystore contains no aliases, i.e. is empty! Are you sure this is an organization certificate in PKCS12 format?");
}
String keyName = aliases.nextElement();
return new KeyStoreConfig(ks, keyName, privatekeyPassword, privatekeyPassword);
} | java | public static KeyStoreConfig fromOrganizationCertificate(final InputStream organizationCertificateStream, final String privatekeyPassword) {
KeyStore ks = KeyStoreType.PKCS12.loadKeyStore(organizationCertificateStream, privatekeyPassword);
Enumeration<String> aliases;
try {
aliases = ks.aliases();
} catch (KeyStoreException e) {
throw new KeyException(
"Could not retrieve aliases from the key store, because " + e.getClass().getSimpleName() + ": " +
"'" + e.getMessage() + "'. Are you sure this is an organization certificate in PKCS12 format?", e);
}
if (!aliases.hasMoreElements()) {
throw new KeyException("The keystore contains no aliases, i.e. is empty! Are you sure this is an organization certificate in PKCS12 format?");
}
String keyName = aliases.nextElement();
return new KeyStoreConfig(ks, keyName, privatekeyPassword, privatekeyPassword);
} | [
"public",
"static",
"KeyStoreConfig",
"fromOrganizationCertificate",
"(",
"final",
"InputStream",
"organizationCertificateStream",
",",
"final",
"String",
"privatekeyPassword",
")",
"{",
"KeyStore",
"ks",
"=",
"KeyStoreType",
".",
"PKCS12",
".",
"loadKeyStore",
"(",
"or... | Create a {@link KeyStoreConfig} from an Organization Certificate (Virksomhetssertifikat).
@param organizationCertificateStream A stream of the certificate in PKCS12 format. The file should have .p12-file ending.
@param privatekeyPassword The password for the private key of the organization certificate.
@return The config, containing the certificate, the private key and the certificate chain. | [
"Create",
"a",
"{",
"@link",
"KeyStoreConfig",
"}",
"from",
"an",
"Organization",
"Certificate",
"(",
"Virksomhetssertifikat",
")",
"."
] | train | https://github.com/digipost/signature-api-client-java/blob/246207571641fbac6beda5ffc585eec188825c45/src/main/java/no/digipost/signature/client/security/KeyStoreConfig.java#L121-L136 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxUser.java | BoxUser.createAppUser | public static BoxUser.Info createAppUser(BoxAPIConnection api, String name,
CreateUserParams params) {
params.setIsPlatformAccessOnly(true);
return createEnterpriseUser(api, null, name, params);
} | java | public static BoxUser.Info createAppUser(BoxAPIConnection api, String name,
CreateUserParams params) {
params.setIsPlatformAccessOnly(true);
return createEnterpriseUser(api, null, name, params);
} | [
"public",
"static",
"BoxUser",
".",
"Info",
"createAppUser",
"(",
"BoxAPIConnection",
"api",
",",
"String",
"name",
",",
"CreateUserParams",
"params",
")",
"{",
"params",
".",
"setIsPlatformAccessOnly",
"(",
"true",
")",
";",
"return",
"createEnterpriseUser",
"(",... | Provisions a new app user in an enterprise with additional user information using Box Developer Edition.
@param api the API connection to be used by the created user.
@param name the name of the user.
@param params additional user information.
@return the created user's info. | [
"Provisions",
"a",
"new",
"app",
"user",
"in",
"an",
"enterprise",
"with",
"additional",
"user",
"information",
"using",
"Box",
"Developer",
"Edition",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxUser.java#L94-L99 |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | SpringApplication.configureProfiles | protected void configureProfiles(ConfigurableEnvironment environment, String[] args) {
environment.getActiveProfiles(); // ensure they are initialized
// But these ones should go first (last wins in a property key clash)
Set<String> profiles = new LinkedHashSet<>(this.additionalProfiles);
profiles.addAll(Arrays.asList(environment.getActiveProfiles()));
environment.setActiveProfiles(StringUtils.toStringArray(profiles));
} | java | protected void configureProfiles(ConfigurableEnvironment environment, String[] args) {
environment.getActiveProfiles(); // ensure they are initialized
// But these ones should go first (last wins in a property key clash)
Set<String> profiles = new LinkedHashSet<>(this.additionalProfiles);
profiles.addAll(Arrays.asList(environment.getActiveProfiles()));
environment.setActiveProfiles(StringUtils.toStringArray(profiles));
} | [
"protected",
"void",
"configureProfiles",
"(",
"ConfigurableEnvironment",
"environment",
",",
"String",
"[",
"]",
"args",
")",
"{",
"environment",
".",
"getActiveProfiles",
"(",
")",
";",
"// ensure they are initialized",
"// But these ones should go first (last wins in a pro... | Configure which profiles are active (or active by default) for this application
environment. Additional profiles may be activated during configuration file
processing via the {@code spring.profiles.active} property.
@param environment this application's environment
@param args arguments passed to the {@code run} method
@see #configureEnvironment(ConfigurableEnvironment, String[])
@see org.springframework.boot.context.config.ConfigFileApplicationListener | [
"Configure",
"which",
"profiles",
"are",
"active",
"(",
"or",
"active",
"by",
"default",
")",
"for",
"this",
"application",
"environment",
".",
"Additional",
"profiles",
"may",
"be",
"activated",
"during",
"configuration",
"file",
"processing",
"via",
"the",
"{"... | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L540-L546 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/CartUrl.java | CartUrl.rejectSuggestedDiscountUrl | public static MozuUrl rejectSuggestedDiscountUrl(String cartId, Integer discountId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/carts/{cartId}/rejectautodiscount/{discountId}?responseFields={responseFields}");
formatter.formatUrl("cartId", cartId);
formatter.formatUrl("discountId", discountId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl rejectSuggestedDiscountUrl(String cartId, Integer discountId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/carts/{cartId}/rejectautodiscount/{discountId}?responseFields={responseFields}");
formatter.formatUrl("cartId", cartId);
formatter.formatUrl("discountId", discountId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"rejectSuggestedDiscountUrl",
"(",
"String",
"cartId",
",",
"Integer",
"discountId",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/carts/{cartId}/rejectautodiscount/{d... | Get Resource Url for RejectSuggestedDiscount
@param cartId Identifier of the cart to delete.
@param discountId discountId parameter description DOCUMENT_HERE
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"RejectSuggestedDiscount"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/CartUrl.java#L89-L96 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java | BitsUtil.get | public static boolean get(long[] v, int off) {
final int wordindex = off >>> LONG_LOG2_SIZE;
return (wordindex < v.length) && (v[wordindex] & (1L << off)) != 0;
} | java | public static boolean get(long[] v, int off) {
final int wordindex = off >>> LONG_LOG2_SIZE;
return (wordindex < v.length) && (v[wordindex] & (1L << off)) != 0;
} | [
"public",
"static",
"boolean",
"get",
"(",
"long",
"[",
"]",
"v",
",",
"int",
"off",
")",
"{",
"final",
"int",
"wordindex",
"=",
"off",
">>>",
"LONG_LOG2_SIZE",
";",
"return",
"(",
"wordindex",
"<",
"v",
".",
"length",
")",
"&&",
"(",
"v",
"[",
"wo... | Set bit number "off" in v.
<p>
Low-endian layout for the array.
@param v Buffer
@param off Offset to set | [
"Set",
"bit",
"number",
"off",
"in",
"v",
".",
"<p",
">",
"Low",
"-",
"endian",
"layout",
"for",
"the",
"array",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java#L432-L435 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java | AipImageSearch.similarSearchUrl | public JSONObject similarSearchUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(ImageSearchConsts.SIMILAR_SEARCH);
postOperation(request);
return requestServer(request);
} | java | public JSONObject similarSearchUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(ImageSearchConsts.SIMILAR_SEARCH);
postOperation(request);
return requestServer(request);
} | [
"public",
"JSONObject",
"similarSearchUrl",
"(",
"String",
"url",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
"AipRequest",
"request",
"=",
"new",
"AipRequest",
"(",
")",
";",
"preOperation",
"(",
"request",
")",
";",
"request",
... | 相似图检索—检索接口
完成入库后,可使用该接口实现相似图检索。**支持传入指定分类维度(具体变量tags)进行检索,返回结果支持翻页(具体变量pn、rn)。****请注意,检索接口不返回原图,仅反馈当前填写的brief信息,请调用入库接口时尽量填写可关联至本地图库的图片id或者图片url等信息。**
@param url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效
@param options - 可选参数对象,key: value都为string类型
options - options列表:
tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索
tag_logic 检索时tag之间的逻辑, 0:逻辑and,1:逻辑or
pn 分页功能,起始位置,例:0。未指定分页时,默认返回前300个结果;接口返回数量最大限制1000条,例如:起始位置为900,截取条数500条,接口也只返回第900 - 1000条的结果,共计100条
rn 分页功能,截取条数,例:250
@return JSONObject | [
"相似图检索—检索接口",
"完成入库后,可使用该接口实现相似图检索。",
"**",
"支持传入指定分类维度(具体变量tags)进行检索,返回结果支持翻页(具体变量pn、rn)。",
"****",
"请注意,检索接口不返回原图,仅反馈当前填写的brief信息,请调用入库接口时尽量填写可关联至本地图库的图片id或者图片url等信息。",
"**"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java#L491-L502 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java | DataService.findAllAsync | public <T extends IEntity> void findAllAsync(T entity, CallbackHandler callbackHandler) throws FMSException {
//findall is to be called as query
String query = "SELECT * FROM " + entity.getClass().getSimpleName();
executeQueryAsync(query, callbackHandler);
} | java | public <T extends IEntity> void findAllAsync(T entity, CallbackHandler callbackHandler) throws FMSException {
//findall is to be called as query
String query = "SELECT * FROM " + entity.getClass().getSimpleName();
executeQueryAsync(query, callbackHandler);
} | [
"public",
"<",
"T",
"extends",
"IEntity",
">",
"void",
"findAllAsync",
"(",
"T",
"entity",
",",
"CallbackHandler",
"callbackHandler",
")",
"throws",
"FMSException",
"{",
"//findall is to be called as query",
"String",
"query",
"=",
"\"SELECT * FROM \"",
"+",
"entity",... | Method to retrieve all records for the given entity in asynchronous fashion
Note, without pagination this will return only 100 records
Use query API to add pagintion and obtain additional records
@param entity
the entity
@param callbackHandler
the callback handler
@throws FMSException
throws FMSException | [
"Method",
"to",
"retrieve",
"all",
"records",
"for",
"the",
"given",
"entity",
"in",
"asynchronous",
"fashion",
"Note",
"without",
"pagination",
"this",
"will",
"return",
"only",
"100",
"records",
"Use",
"query",
"API",
"to",
"add",
"pagintion",
"and",
"obtain... | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L740-L745 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/tregex/tsurgeon/Tsurgeon.java | Tsurgeon.processPattern | public static Tree processPattern(TregexPattern matchPattern, TsurgeonPattern p, Tree t) {
TregexMatcher m = matchPattern.matcher(t);
while(m.find()) {
t = p.evaluate(t,m);
if(t==null)
break;
m = matchPattern.matcher(t);
}
return t;
} | java | public static Tree processPattern(TregexPattern matchPattern, TsurgeonPattern p, Tree t) {
TregexMatcher m = matchPattern.matcher(t);
while(m.find()) {
t = p.evaluate(t,m);
if(t==null)
break;
m = matchPattern.matcher(t);
}
return t;
} | [
"public",
"static",
"Tree",
"processPattern",
"(",
"TregexPattern",
"matchPattern",
",",
"TsurgeonPattern",
"p",
",",
"Tree",
"t",
")",
"{",
"TregexMatcher",
"m",
"=",
"matchPattern",
".",
"matcher",
"(",
"t",
")",
";",
"while",
"(",
"m",
".",
"find",
"(",... | Tries to match a pattern against a tree. If it succeeds, apply the surgical operations contained in a {@link TsurgeonPattern}.
@param matchPattern A {@link TregexPattern} to be matched against a {@link Tree}.
@param p A {@link TsurgeonPattern} to apply.
@param t the {@link Tree} to match against and perform surgery on.
@return t, which has been surgically modified. | [
"Tries",
"to",
"match",
"a",
"pattern",
"against",
"a",
"tree",
".",
"If",
"it",
"succeeds",
"apply",
"the",
"surgical",
"operations",
"contained",
"in",
"a",
"{"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/tregex/tsurgeon/Tsurgeon.java#L435-L444 |
Viascom/groundwork | foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/query/FoxHttpRequestQuery.java | FoxHttpRequestQuery.parseObjectAsQueryMap | public void parseObjectAsQueryMap(List<String> params, Object o) throws FoxHttpRequestException {
try {
Class clazz = o.getClass();
HashMap<String, String> paramMap = new HashMap<>();
for (String param : params) {
Field field = clazz.getDeclaredField(param);
field.setAccessible(true);
String paramName = field.getName();
String value = String.valueOf(field.get(o));
if (field.get(o) != null && !value.isEmpty()) {
paramMap.put(paramName, value);
}
}
queryMap = paramMap;
} catch (Exception e) {
throw new FoxHttpRequestException(e);
}
} | java | public void parseObjectAsQueryMap(List<String> params, Object o) throws FoxHttpRequestException {
try {
Class clazz = o.getClass();
HashMap<String, String> paramMap = new HashMap<>();
for (String param : params) {
Field field = clazz.getDeclaredField(param);
field.setAccessible(true);
String paramName = field.getName();
String value = String.valueOf(field.get(o));
if (field.get(o) != null && !value.isEmpty()) {
paramMap.put(paramName, value);
}
}
queryMap = paramMap;
} catch (Exception e) {
throw new FoxHttpRequestException(e);
}
} | [
"public",
"void",
"parseObjectAsQueryMap",
"(",
"List",
"<",
"String",
">",
"params",
",",
"Object",
"o",
")",
"throws",
"FoxHttpRequestException",
"{",
"try",
"{",
"Class",
"clazz",
"=",
"o",
".",
"getClass",
"(",
")",
";",
"HashMap",
"<",
"String",
",",
... | Parse an object as query map
@param params list of attribute names which will be included
@param o object with the attributes
@throws FoxHttpRequestException can throw an exception if a field does not exist | [
"Parse",
"an",
"object",
"as",
"query",
"map"
] | train | https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/query/FoxHttpRequestQuery.java#L78-L95 |
jglobus/JGlobus | gridftp/src/main/java/org/globus/ftp/GridFTPClient.java | GridFTPClient.setChecksum | public void setChecksum(ChecksumAlgorithm algorithm,
String value)
throws IOException, ServerException {
String arguments = algorithm.toFtpCmdArgument() + " " + value;
Command cmd = new Command("SCKS", arguments);
try {
controlChannel.execute(cmd);
} catch (UnexpectedReplyCodeException urce) {
throw ServerException.embedUnexpectedReplyCodeException(urce);
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
}
} | java | public void setChecksum(ChecksumAlgorithm algorithm,
String value)
throws IOException, ServerException {
String arguments = algorithm.toFtpCmdArgument() + " " + value;
Command cmd = new Command("SCKS", arguments);
try {
controlChannel.execute(cmd);
} catch (UnexpectedReplyCodeException urce) {
throw ServerException.embedUnexpectedReplyCodeException(urce);
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
}
} | [
"public",
"void",
"setChecksum",
"(",
"ChecksumAlgorithm",
"algorithm",
",",
"String",
"value",
")",
"throws",
"IOException",
",",
"ServerException",
"{",
"String",
"arguments",
"=",
"algorithm",
".",
"toFtpCmdArgument",
"(",
")",
"+",
"\" \"",
"+",
"value",
";"... | Sets the checksum values ahead of the transfer
@param algorithm the checksume algorithm
@param value the checksum value as hexadecimal number
@exception ServerException if an error occured. | [
"Sets",
"the",
"checksum",
"values",
"ahead",
"of",
"the",
"transfer"
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/GridFTPClient.java#L968-L981 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CategoryUrl.java | CategoryUrl.addCategoryUrl | public static MozuUrl addCategoryUrl(Boolean incrementSequence, String responseFields, Boolean useProvidedId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/?incrementSequence={incrementSequence}&useProvidedId={useProvidedId}&responseFields={responseFields}");
formatter.formatUrl("incrementSequence", incrementSequence);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("useProvidedId", useProvidedId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl addCategoryUrl(Boolean incrementSequence, String responseFields, Boolean useProvidedId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/?incrementSequence={incrementSequence}&useProvidedId={useProvidedId}&responseFields={responseFields}");
formatter.formatUrl("incrementSequence", incrementSequence);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("useProvidedId", useProvidedId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"addCategoryUrl",
"(",
"Boolean",
"incrementSequence",
",",
"String",
"responseFields",
",",
"Boolean",
"useProvidedId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/categories/?increme... | Get Resource Url for AddCategory
@param incrementSequence If true, when adding a new product category, set the sequence number of the new category to an increment of one integer greater than the maximum available sequence number across all product categories. If false, set the sequence number to zero.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param useProvidedId Optional. If , uses the you specify in the request as the category's id. If , generates an for the category regardless if you specify an id in the request.If you specify an id already in use and set this parameter to , returns an error.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"AddCategory"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CategoryUrl.java#L71-L78 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/json/JsonParser.java | JsonParser.parseMap | private void parseMap(
Field fieldContext,
Map<String, Object> destinationMap,
Type valueType,
ArrayList<Type> context,
CustomizeJsonParser customizeParser)
throws IOException {
JsonToken curToken = startParsingObjectOrArray();
while (curToken == JsonToken.FIELD_NAME) {
String key = getText();
nextToken();
// stop at items for feeds
if (customizeParser != null && customizeParser.stopAt(destinationMap, key)) {
return;
}
Object value =
parseValue(fieldContext, valueType, context, destinationMap, customizeParser, true);
destinationMap.put(key, value);
curToken = nextToken();
}
} | java | private void parseMap(
Field fieldContext,
Map<String, Object> destinationMap,
Type valueType,
ArrayList<Type> context,
CustomizeJsonParser customizeParser)
throws IOException {
JsonToken curToken = startParsingObjectOrArray();
while (curToken == JsonToken.FIELD_NAME) {
String key = getText();
nextToken();
// stop at items for feeds
if (customizeParser != null && customizeParser.stopAt(destinationMap, key)) {
return;
}
Object value =
parseValue(fieldContext, valueType, context, destinationMap, customizeParser, true);
destinationMap.put(key, value);
curToken = nextToken();
}
} | [
"private",
"void",
"parseMap",
"(",
"Field",
"fieldContext",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"destinationMap",
",",
"Type",
"valueType",
",",
"ArrayList",
"<",
"Type",
">",
"context",
",",
"CustomizeJsonParser",
"customizeParser",
")",
"throws",
... | Parse a JSON Object from the given JSON parser into the given destination map, optionally using
the given parser customizer.
@param fieldContext field context or {@code null} for none
@param destinationMap destination map
@param valueType valueType of the map value type parameter
@param context destination context stack (possibly empty)
@param customizeParser optional parser customizer or {@code null} for none | [
"Parse",
"a",
"JSON",
"Object",
"from",
"the",
"given",
"JSON",
"parser",
"into",
"the",
"given",
"destination",
"map",
"optionally",
"using",
"the",
"given",
"parser",
"customizer",
"."
] | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/json/JsonParser.java#L665-L685 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkInterfaceTapConfigurationsInner.java | NetworkInterfaceTapConfigurationsInner.createOrUpdate | public NetworkInterfaceTapConfigurationInner createOrUpdate(String resourceGroupName, String networkInterfaceName, String tapConfigurationName, NetworkInterfaceTapConfigurationInner tapConfigurationParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters).toBlocking().last().body();
} | java | public NetworkInterfaceTapConfigurationInner createOrUpdate(String resourceGroupName, String networkInterfaceName, String tapConfigurationName, NetworkInterfaceTapConfigurationInner tapConfigurationParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters).toBlocking().last().body();
} | [
"public",
"NetworkInterfaceTapConfigurationInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkInterfaceName",
",",
"String",
"tapConfigurationName",
",",
"NetworkInterfaceTapConfigurationInner",
"tapConfigurationParameters",
")",
"{",
"return",
"... | Creates or updates a Tap configuration in the specified NetworkInterface.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@param tapConfigurationName The name of the tap configuration.
@param tapConfigurationParameters Parameters supplied to the create or update tap configuration operation.
@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 NetworkInterfaceTapConfigurationInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"Tap",
"configuration",
"in",
"the",
"specified",
"NetworkInterface",
"."
] | 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/NetworkInterfaceTapConfigurationsInner.java#L362-L364 |
cfg4j/cfg4j | cfg4j-core/src/main/java/org/cfg4j/source/context/propertiesprovider/PropertyBasedPropertiesProvider.java | PropertyBasedPropertiesProvider.getProperties | @Override
public Properties getProperties(InputStream inputStream) {
Properties properties = new Properties();
try {
properties.load(inputStream);
} catch (IOException | IllegalArgumentException e) {
throw new IllegalStateException("Unable to load properties from provided stream", e);
}
return properties;
} | java | @Override
public Properties getProperties(InputStream inputStream) {
Properties properties = new Properties();
try {
properties.load(inputStream);
} catch (IOException | IllegalArgumentException e) {
throw new IllegalStateException("Unable to load properties from provided stream", e);
}
return properties;
} | [
"@",
"Override",
"public",
"Properties",
"getProperties",
"(",
"InputStream",
"inputStream",
")",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"{",
"properties",
".",
"load",
"(",
"inputStream",
")",
";",
"}",
"catch",
"("... | Get {@link Properties} for a given {@code inputStream} treating it as a properties file.
@param inputStream input stream representing properties file
@return properties representing values from {@code inputStream}
@throws IllegalStateException when unable to read properties | [
"Get",
"{",
"@link",
"Properties",
"}",
"for",
"a",
"given",
"{",
"@code",
"inputStream",
"}",
"treating",
"it",
"as",
"a",
"properties",
"file",
"."
] | train | https://github.com/cfg4j/cfg4j/blob/47d4f63e5fc820c62631e557adc34a29d8ab396d/cfg4j-core/src/main/java/org/cfg4j/source/context/propertiesprovider/PropertyBasedPropertiesProvider.java#L35-L46 |
Jasig/uPortal | uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/RDBMEntityGroupStore.java | RDBMEntityGroupStore.updateMembers | @Override
public void updateMembers(IEntityGroup eg) throws GroupsException {
Connection conn = null;
EntityGroupImpl egi = (EntityGroupImpl) eg;
if (egi.isDirty())
try {
conn = RDBMServices.getConnection();
setAutoCommit(conn, false);
try {
primUpdateMembers(egi, conn);
commit(conn);
} catch (SQLException sqle) {
rollback(conn);
throw new GroupsException("Problem updating memberships for " + egi, sqle);
}
} catch (SQLException sqlex) {
throw new GroupsException(sqlex);
} finally {
if (conn != null) {
try {
setAutoCommit(conn, true);
} catch (SQLException sqle) {
throw new GroupsException(sqle);
} finally {
RDBMServices.releaseConnection(conn);
}
}
}
} | java | @Override
public void updateMembers(IEntityGroup eg) throws GroupsException {
Connection conn = null;
EntityGroupImpl egi = (EntityGroupImpl) eg;
if (egi.isDirty())
try {
conn = RDBMServices.getConnection();
setAutoCommit(conn, false);
try {
primUpdateMembers(egi, conn);
commit(conn);
} catch (SQLException sqle) {
rollback(conn);
throw new GroupsException("Problem updating memberships for " + egi, sqle);
}
} catch (SQLException sqlex) {
throw new GroupsException(sqlex);
} finally {
if (conn != null) {
try {
setAutoCommit(conn, true);
} catch (SQLException sqle) {
throw new GroupsException(sqle);
} finally {
RDBMServices.releaseConnection(conn);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"updateMembers",
"(",
"IEntityGroup",
"eg",
")",
"throws",
"GroupsException",
"{",
"Connection",
"conn",
"=",
"null",
";",
"EntityGroupImpl",
"egi",
"=",
"(",
"EntityGroupImpl",
")",
"eg",
";",
"if",
"(",
"egi",
".",
"isDir... | Insert and delete group membership rows inside a transaction.
@param eg IEntityGroup | [
"Insert",
"and",
"delete",
"group",
"membership",
"rows",
"inside",
"a",
"transaction",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/RDBMEntityGroupStore.java#L1496-L1525 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java | PackageIndexWriter.addPackagesList | protected void addPackagesList(PackageDoc[] packages, Content tbody) {
for (int i = 0; i < packages.length; i++) {
if (packages[i] != null && packages[i].name().length() > 0) {
if (configuration.nodeprecated && Util.isDeprecated(packages[i]))
continue;
Content packageLinkContent = getPackageLink(packages[i],
getPackageName(packages[i]));
Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
tdSummary.addStyle(HtmlStyle.colLast);
addSummaryComment(packages[i], tdSummary);
HtmlTree tr = HtmlTree.TR(tdPackage);
tr.addContent(tdSummary);
if (i%2 == 0)
tr.addStyle(HtmlStyle.altColor);
else
tr.addStyle(HtmlStyle.rowColor);
tbody.addContent(tr);
}
}
} | java | protected void addPackagesList(PackageDoc[] packages, Content tbody) {
for (int i = 0; i < packages.length; i++) {
if (packages[i] != null && packages[i].name().length() > 0) {
if (configuration.nodeprecated && Util.isDeprecated(packages[i]))
continue;
Content packageLinkContent = getPackageLink(packages[i],
getPackageName(packages[i]));
Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
tdSummary.addStyle(HtmlStyle.colLast);
addSummaryComment(packages[i], tdSummary);
HtmlTree tr = HtmlTree.TR(tdPackage);
tr.addContent(tdSummary);
if (i%2 == 0)
tr.addStyle(HtmlStyle.altColor);
else
tr.addStyle(HtmlStyle.rowColor);
tbody.addContent(tr);
}
}
} | [
"protected",
"void",
"addPackagesList",
"(",
"PackageDoc",
"[",
"]",
"packages",
",",
"Content",
"tbody",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"packages",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"packages",
"[",
"i... | Adds list of packages in the index table. Generate link to each package.
@param packages Packages to which link is to be generated
@param tbody the documentation tree to which the list will be added | [
"Adds",
"list",
"of",
"packages",
"in",
"the",
"index",
"table",
".",
"Generate",
"link",
"to",
"each",
"package",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java#L168-L188 |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/ExpressionBuilderImpl.java | ExpressionBuilderImpl.eInit | public void eInit(EObject context, Procedure1<? super XExpression> setter, IJvmTypeProvider typeContext) {
setTypeResolutionContext(typeContext);
this.context = context;
this.setter = setter;
this.expr = null;
} | java | public void eInit(EObject context, Procedure1<? super XExpression> setter, IJvmTypeProvider typeContext) {
setTypeResolutionContext(typeContext);
this.context = context;
this.setter = setter;
this.expr = null;
} | [
"public",
"void",
"eInit",
"(",
"EObject",
"context",
",",
"Procedure1",
"<",
"?",
"super",
"XExpression",
">",
"setter",
",",
"IJvmTypeProvider",
"typeContext",
")",
"{",
"setTypeResolutionContext",
"(",
"typeContext",
")",
";",
"this",
".",
"context",
"=",
"... | Initialize the expression.
@param context the context of the expressions.
@param setter the object that permits to assign the expression to the context. | [
"Initialize",
"the",
"expression",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/ExpressionBuilderImpl.java#L73-L78 |
florent37/DaVinci | davinci/src/main/java/com/github/florent37/davinci/DaVinci.java | DaVinci.downloadBitmap | private void downloadBitmap(final String path, final Object into, final Transformation transformation) {
//download the bitmap from bluetooth
new AsyncTask<Void, Void, Bitmap>() {
@Override
protected Bitmap doInBackground(Void... params) {
Bitmap bitmap = getBitmap(path);
Log.d(TAG, "bitmap from bluetooth " + path + " " + bitmap);
if (bitmap != null) {
Log.d(TAG, "save bitmap " + path + " into cache");
saveBitmap(getKey(path), bitmap);
if (transformation != null) {
return transformAndSaveBitmap(path, transformation);
}
}
return bitmap;
}
@Override
protected void onPostExecute(Bitmap bitmap) {
super.onPostExecute(bitmap);
if (into != null)
returnBitmapInto(bitmap, path, into);
}
}.execute();
} | java | private void downloadBitmap(final String path, final Object into, final Transformation transformation) {
//download the bitmap from bluetooth
new AsyncTask<Void, Void, Bitmap>() {
@Override
protected Bitmap doInBackground(Void... params) {
Bitmap bitmap = getBitmap(path);
Log.d(TAG, "bitmap from bluetooth " + path + " " + bitmap);
if (bitmap != null) {
Log.d(TAG, "save bitmap " + path + " into cache");
saveBitmap(getKey(path), bitmap);
if (transformation != null) {
return transformAndSaveBitmap(path, transformation);
}
}
return bitmap;
}
@Override
protected void onPostExecute(Bitmap bitmap) {
super.onPostExecute(bitmap);
if (into != null)
returnBitmapInto(bitmap, path, into);
}
}.execute();
} | [
"private",
"void",
"downloadBitmap",
"(",
"final",
"String",
"path",
",",
"final",
"Object",
"into",
",",
"final",
"Transformation",
"transformation",
")",
"{",
"//download the bitmap from bluetooth",
"new",
"AsyncTask",
"<",
"Void",
",",
"Void",
",",
"Bitmap",
">... | Download bitmap from bluetooth asset and store it into LruCache and LruDiskCache
@param path the path or url of the image
@param into the destination object | [
"Download",
"bitmap",
"from",
"bluetooth",
"asset",
"and",
"store",
"it",
"into",
"LruCache",
"and",
"LruDiskCache"
] | train | https://github.com/florent37/DaVinci/blob/9c6ce4aa2df8e2288cd6ee8b57d9091b1b770a7a/davinci/src/main/java/com/github/florent37/davinci/DaVinci.java#L485-L510 |
Waikato/moa | moa/src/main/java/moa/cluster/CFCluster.java | CFCluster.addVectors | public static void addVectors(double[] a1, double[] a2) {
assert (a1 != null);
assert (a2 != null);
assert (a1.length == a2.length) : "Adding two arrays of different "
+ "length";
for (int i = 0; i < a1.length; i++) {
a1[i] += a2[i];
}
} | java | public static void addVectors(double[] a1, double[] a2) {
assert (a1 != null);
assert (a2 != null);
assert (a1.length == a2.length) : "Adding two arrays of different "
+ "length";
for (int i = 0; i < a1.length; i++) {
a1[i] += a2[i];
}
} | [
"public",
"static",
"void",
"addVectors",
"(",
"double",
"[",
"]",
"a1",
",",
"double",
"[",
"]",
"a2",
")",
"{",
"assert",
"(",
"a1",
"!=",
"null",
")",
";",
"assert",
"(",
"a2",
"!=",
"null",
")",
";",
"assert",
"(",
"a1",
".",
"length",
"==",
... | Adds the second array to the first array element by element. The arrays
must have the same length.
@param a1 Vector to which the second vector is added.
@param a2 Vector to be added. This vector does not change. | [
"Adds",
"the",
"second",
"array",
"to",
"the",
"first",
"array",
"element",
"by",
"element",
".",
"The",
"arrays",
"must",
"have",
"the",
"same",
"length",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/cluster/CFCluster.java#L162-L171 |
cache2k/cache2k | cache2k-core/src/main/java/org/cache2k/impl/xmlConfiguration/CacheConfigurationProviderImpl.java | CacheConfigurationProviderImpl.handleSection | private boolean handleSection(
final ConfigurationContext ctx,
final Class<?> _type,
final ConfigurationWithSections cfg,
final ParsedConfiguration sc) {
String _containerName = sc.getContainer();
if (!"sections".equals(_containerName)) {
return false;
}
@SuppressWarnings("unchecked") ConfigurationSection _sectionBean = cfg.getSections().getSection((Class<ConfigurationSection>) _type);
if (!(_sectionBean instanceof SingletonConfigurationSection)) {
try {
_sectionBean = (ConfigurationSection) _type.newInstance();
} catch (Exception ex) {
throw new ConfigurationException("Cannot instantiate section class: " + ex, sc);
}
cfg.getSections().add(_sectionBean);
}
apply(ctx, sc, _sectionBean);
return true;
} | java | private boolean handleSection(
final ConfigurationContext ctx,
final Class<?> _type,
final ConfigurationWithSections cfg,
final ParsedConfiguration sc) {
String _containerName = sc.getContainer();
if (!"sections".equals(_containerName)) {
return false;
}
@SuppressWarnings("unchecked") ConfigurationSection _sectionBean = cfg.getSections().getSection((Class<ConfigurationSection>) _type);
if (!(_sectionBean instanceof SingletonConfigurationSection)) {
try {
_sectionBean = (ConfigurationSection) _type.newInstance();
} catch (Exception ex) {
throw new ConfigurationException("Cannot instantiate section class: " + ex, sc);
}
cfg.getSections().add(_sectionBean);
}
apply(ctx, sc, _sectionBean);
return true;
} | [
"private",
"boolean",
"handleSection",
"(",
"final",
"ConfigurationContext",
"ctx",
",",
"final",
"Class",
"<",
"?",
">",
"_type",
",",
"final",
"ConfigurationWithSections",
"cfg",
",",
"final",
"ParsedConfiguration",
"sc",
")",
"{",
"String",
"_containerName",
"=... | Create a new configuration section or reuse an existing section, if it is a singleton.
<p>No support for writing on existing sections, which means it is not possible to define a non singleton
in the defaults section and then override values later in the cache specific configuration.
This is not needed for version 1.0. If we want to add it later, it is best to use the name to select the
correct section.
@return true if applied, false if not a section. | [
"Create",
"a",
"new",
"configuration",
"section",
"or",
"reuse",
"an",
"existing",
"section",
"if",
"it",
"is",
"a",
"singleton",
"."
] | train | https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/impl/xmlConfiguration/CacheConfigurationProviderImpl.java#L410-L430 |
aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java | Pipes.subscribeTo | public void subscribeTo(final K key, final Subscriber<V> subscriber) {
registered.get(key)
.stream()
.subscribe(subscriber);
} | java | public void subscribeTo(final K key, final Subscriber<V> subscriber) {
registered.get(key)
.stream()
.subscribe(subscriber);
} | [
"public",
"void",
"subscribeTo",
"(",
"final",
"K",
"key",
",",
"final",
"Subscriber",
"<",
"V",
">",
"subscriber",
")",
"{",
"registered",
".",
"get",
"(",
"key",
")",
".",
"stream",
"(",
")",
".",
"subscribe",
"(",
"subscriber",
")",
";",
"}"
] | Subscribe synchronously to a pipe
@param key for registered simple-react async.Adapter
@param subscriber Reactive Streams reactiveSubscriber for data on this pipe | [
"Subscribe",
"synchronously",
"to",
"a",
"pipe"
] | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L544-L549 |
iig-uni-freiburg/SEWOL | src/de/uni/freiburg/iig/telematik/sewol/context/constraint/ConstraintContextProperties.java | ConstraintContextProperties.addRoutingConstraint | public void addRoutingConstraint(String activity, AbstractConstraint<?> constraint) throws PropertyException{
Validate.notNull(activity);
Validate.notEmpty(activity);
Validate.notNull(constraint);
//1. Add constraint itself
// This also adds the constraint to the list of constraints
String propertyNameForNewConstraint = addConstraint(constraint);
//2. Add constraint name to the list of constraints for this activity
Set<String> currentConstraintNames = getConstraintNames(activity);
currentConstraintNames.add(propertyNameForNewConstraint);
if(currentConstraintNames.size() == 1){
//Add the activity to the list of activities with routing constraints
addActivityWithConstraints(activity);
}
props.setProperty(String.format(ACTIVITY_CONSTRAINTS_FORMAT, activity), ArrayUtils.toString(currentConstraintNames.toArray()));
} | java | public void addRoutingConstraint(String activity, AbstractConstraint<?> constraint) throws PropertyException{
Validate.notNull(activity);
Validate.notEmpty(activity);
Validate.notNull(constraint);
//1. Add constraint itself
// This also adds the constraint to the list of constraints
String propertyNameForNewConstraint = addConstraint(constraint);
//2. Add constraint name to the list of constraints for this activity
Set<String> currentConstraintNames = getConstraintNames(activity);
currentConstraintNames.add(propertyNameForNewConstraint);
if(currentConstraintNames.size() == 1){
//Add the activity to the list of activities with routing constraints
addActivityWithConstraints(activity);
}
props.setProperty(String.format(ACTIVITY_CONSTRAINTS_FORMAT, activity), ArrayUtils.toString(currentConstraintNames.toArray()));
} | [
"public",
"void",
"addRoutingConstraint",
"(",
"String",
"activity",
",",
"AbstractConstraint",
"<",
"?",
">",
"constraint",
")",
"throws",
"PropertyException",
"{",
"Validate",
".",
"notNull",
"(",
"activity",
")",
";",
"Validate",
".",
"notEmpty",
"(",
"activi... | Adds a routing constraint for an activity.
@param activity The name of the activity for which the constraint is added.
@param constraint The routing constraint to add.
@throws ParameterException if the given parameters are invalid.
@throws PropertyException if the given constraint cannot be added as a property.
@see #addConstraint(AbstractConstraint)
@see #addActivityWithConstraints(String) | [
"Adds",
"a",
"routing",
"constraint",
"for",
"an",
"activity",
"."
] | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/constraint/ConstraintContextProperties.java#L43-L60 |
xvik/generics-resolver | src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java | TypeToStringUtils.toStringWithNamedGenerics | public static String toStringWithNamedGenerics(final Class<?> type) {
return toStringType(new ParameterizedTypeImpl(type, type.getTypeParameters()), new PrintableGenericsMap());
} | java | public static String toStringWithNamedGenerics(final Class<?> type) {
return toStringType(new ParameterizedTypeImpl(type, type.getTypeParameters()), new PrintableGenericsMap());
} | [
"public",
"static",
"String",
"toStringWithNamedGenerics",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"toStringType",
"(",
"new",
"ParameterizedTypeImpl",
"(",
"type",
",",
"type",
".",
"getTypeParameters",
"(",
")",
")",
",",
"new",
"... | Print class with generic variables. For example, {@code List<T>}.
@param type class to print
@return string containing class and it's declared generics | [
"Print",
"class",
"with",
"generic",
"variables",
".",
"For",
"example",
"{",
"@code",
"List<T",
">",
"}",
"."
] | train | https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java#L97-L99 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/RepositoryFileApi.java | RepositoryFileApi.getFile | public RepositoryFile getFile(Object projectIdOrPath, String filePath, String ref) throws GitLabApiException {
return (getFile(projectIdOrPath, filePath, ref, true));
} | java | public RepositoryFile getFile(Object projectIdOrPath, String filePath, String ref) throws GitLabApiException {
return (getFile(projectIdOrPath, filePath, ref, true));
} | [
"public",
"RepositoryFile",
"getFile",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"filePath",
",",
"String",
"ref",
")",
"throws",
"GitLabApiException",
"{",
"return",
"(",
"getFile",
"(",
"projectIdOrPath",
",",
"filePath",
",",
"ref",
",",
"true",
")",
... | Get file from repository. Allows you to receive information about file in repository like name, size, content.
Note that file content is Base64 encoded.
<pre><code>GitLab Endpoint: GET /projects/:id/repository/files</code></pre>
@param projectIdOrPath the id, path of the project, or a Project instance holding the project ID or path
@param filePath (required) - Full path to the file. Ex. lib/class.rb
@param ref (required) - The name of branch, tag or commit
@return a RepositoryFile instance with the file info and file content
@throws GitLabApiException if any exception occurs | [
"Get",
"file",
"from",
"repository",
".",
"Allows",
"you",
"to",
"receive",
"information",
"about",
"file",
"in",
"repository",
"like",
"name",
"size",
"content",
".",
"Note",
"that",
"file",
"content",
"is",
"Base64",
"encoded",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryFileApi.java#L114-L116 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/ClickCallback.java | ClickCallback.addConfirmPopupMessage | protected int addConfirmPopupMessage (SmartTable contents, int row)
{
if (_confirmHTML) {
contents.setHTML(row, 0, _confirmMessage, 2, "Message");
} else {
contents.setText(row, 0, _confirmMessage, 2, "Message");
}
return row + 1;
} | java | protected int addConfirmPopupMessage (SmartTable contents, int row)
{
if (_confirmHTML) {
contents.setHTML(row, 0, _confirmMessage, 2, "Message");
} else {
contents.setText(row, 0, _confirmMessage, 2, "Message");
}
return row + 1;
} | [
"protected",
"int",
"addConfirmPopupMessage",
"(",
"SmartTable",
"contents",
",",
"int",
"row",
")",
"{",
"if",
"(",
"_confirmHTML",
")",
"{",
"contents",
".",
"setHTML",
"(",
"row",
",",
"0",
",",
"_confirmMessage",
",",
"2",
",",
"\"Message\"",
")",
";",... | Adds the message area for the confirmation popup to the given row and returns the row to
insert next. | [
"Adds",
"the",
"message",
"area",
"for",
"the",
"confirmation",
"popup",
"to",
"the",
"given",
"row",
"and",
"returns",
"the",
"row",
"to",
"insert",
"next",
"."
] | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/ClickCallback.java#L222-L230 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/APIClient.java | APIClient.getLogs | public JSONObject getLogs(int offset, int length, LogType logType, RequestOptions requestOptions) throws AlgoliaException {
String type = null;
switch (logType) {
case LOG_BUILD:
type = "build";
break;
case LOG_QUERY:
type = "query";
break;
case LOG_ERROR:
type = "error";
break;
case LOG_ALL:
type = "all";
break;
}
return getRequest("/1/logs?offset=" + offset + "&length=" + length + "&type=" + type, false, requestOptions);
} | java | public JSONObject getLogs(int offset, int length, LogType logType, RequestOptions requestOptions) throws AlgoliaException {
String type = null;
switch (logType) {
case LOG_BUILD:
type = "build";
break;
case LOG_QUERY:
type = "query";
break;
case LOG_ERROR:
type = "error";
break;
case LOG_ALL:
type = "all";
break;
}
return getRequest("/1/logs?offset=" + offset + "&length=" + length + "&type=" + type, false, requestOptions);
} | [
"public",
"JSONObject",
"getLogs",
"(",
"int",
"offset",
",",
"int",
"length",
",",
"LogType",
"logType",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
"{",
"String",
"type",
"=",
"null",
";",
"switch",
"(",
"logType",
")",
"{",
... | Return last logs entries.
@param offset Specify the first entry to retrieve (0-based, 0 is the most recent log entry).
@param length Specify the maximum number of entries to retrieve starting at offset. Maximum allowed value: 1000.
@param logType Specify the type of log to retrieve
@param requestOptions Options to pass to this request | [
"Return",
"last",
"logs",
"entries",
"."
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L484-L501 |
cchantep/acolyte | jdbc-driver/src/main/java/acolyte/jdbc/PreparedStatement.java | PreparedStatement.createBytes | private byte[] createBytes(InputStream stream, long length)
throws SQLException {
ByteArrayOutputStream buff = null;
try {
buff = new ByteArrayOutputStream();
if (length > 0) IOUtils.copyLarge(stream, buff, 0, length);
else IOUtils.copy(stream, buff);
return buff.toByteArray();
} catch (IOException e) {
throw new SQLException("Fails to create BLOB", e);
} finally {
IOUtils.closeQuietly(buff);
} // end of finally
} | java | private byte[] createBytes(InputStream stream, long length)
throws SQLException {
ByteArrayOutputStream buff = null;
try {
buff = new ByteArrayOutputStream();
if (length > 0) IOUtils.copyLarge(stream, buff, 0, length);
else IOUtils.copy(stream, buff);
return buff.toByteArray();
} catch (IOException e) {
throw new SQLException("Fails to create BLOB", e);
} finally {
IOUtils.closeQuietly(buff);
} // end of finally
} | [
"private",
"byte",
"[",
"]",
"createBytes",
"(",
"InputStream",
"stream",
",",
"long",
"length",
")",
"throws",
"SQLException",
"{",
"ByteArrayOutputStream",
"buff",
"=",
"null",
";",
"try",
"{",
"buff",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"i... | Creates bytes array from input stream.
@param stream Input stream
@param length | [
"Creates",
"bytes",
"array",
"from",
"input",
"stream",
"."
] | train | https://github.com/cchantep/acolyte/blob/a383dff20fadc08ec9306f2f1f24b2a7e0047449/jdbc-driver/src/main/java/acolyte/jdbc/PreparedStatement.java#L1054-L1071 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/feature/associate/StereoConsistencyCheck.java | StereoConsistencyCheck.checkPixel | public boolean checkPixel( Point2D_F64 left , Point2D_F64 right ) {
leftImageToRect.compute(left.x,left.y,rectLeft);
rightImageToRect.compute(right.x, right.y, rectRight);
return checkRectified(rectLeft,rectRight);
} | java | public boolean checkPixel( Point2D_F64 left , Point2D_F64 right ) {
leftImageToRect.compute(left.x,left.y,rectLeft);
rightImageToRect.compute(right.x, right.y, rectRight);
return checkRectified(rectLeft,rectRight);
} | [
"public",
"boolean",
"checkPixel",
"(",
"Point2D_F64",
"left",
",",
"Point2D_F64",
"right",
")",
"{",
"leftImageToRect",
".",
"compute",
"(",
"left",
".",
"x",
",",
"left",
".",
"y",
",",
"rectLeft",
")",
";",
"rightImageToRect",
".",
"compute",
"(",
"righ... | Checks to see if the observations from the left and right camera are consistent. Observations
are assumed to be in the original image pixel coordinates.
@param left Left camera observation in original pixels
@param right Right camera observation in original pixels
@return true for consistent | [
"Checks",
"to",
"see",
"if",
"the",
"observations",
"from",
"the",
"left",
"and",
"right",
"camera",
"are",
"consistent",
".",
"Observations",
"are",
"assumed",
"to",
"be",
"in",
"the",
"original",
"image",
"pixel",
"coordinates",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/feature/associate/StereoConsistencyCheck.java#L87-L92 |
baratine/baratine | web/src/main/java/com/caucho/v5/deploy2/Strategy2StartManualRedeployManual.java | Strategy2StartManualRedeployManual.startOnInit | @Override
public void startOnInit(DeployService2Impl<I> deploy, Result<I> result)
{
deploy.startImpl(result);
} | java | @Override
public void startOnInit(DeployService2Impl<I> deploy, Result<I> result)
{
deploy.startImpl(result);
} | [
"@",
"Override",
"public",
"void",
"startOnInit",
"(",
"DeployService2Impl",
"<",
"I",
">",
"deploy",
",",
"Result",
"<",
"I",
">",
"result",
")",
"{",
"deploy",
".",
"startImpl",
"(",
"result",
")",
";",
"}"
] | Called at initialization time for automatic start.
@param deploy the owning controller | [
"Called",
"at",
"initialization",
"time",
"for",
"automatic",
"start",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/deploy2/Strategy2StartManualRedeployManual.java#L83-L87 |
HolmesNL/kafka-spout | src/main/java/nl/minvenj/nfi/storm/kafka/KafkaSpout.java | KafkaSpout.createConsumer | protected void createConsumer(final Map<String, Object> config) {
final Properties consumerConfig = createKafkaConfig(config);
LOG.info("connecting kafka client to zookeeper at {} as client group {}",
consumerConfig.getProperty("zookeeper.connect"),
consumerConfig.getProperty("group.id"));
_consumer = Consumer.createJavaConsumerConnector(new ConsumerConfig(consumerConfig));
} | java | protected void createConsumer(final Map<String, Object> config) {
final Properties consumerConfig = createKafkaConfig(config);
LOG.info("connecting kafka client to zookeeper at {} as client group {}",
consumerConfig.getProperty("zookeeper.connect"),
consumerConfig.getProperty("group.id"));
_consumer = Consumer.createJavaConsumerConnector(new ConsumerConfig(consumerConfig));
} | [
"protected",
"void",
"createConsumer",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"config",
")",
"{",
"final",
"Properties",
"consumerConfig",
"=",
"createKafkaConfig",
"(",
"config",
")",
";",
"LOG",
".",
"info",
"(",
"\"connecting kafka client to ... | Ensures an initialized kafka {@link ConsumerConnector} is present.
@param config The storm configuration passed to {@link #open(Map, TopologyContext, SpoutOutputCollector)}.
@throws IllegalArgumentException When a required configuration parameter is missing or a sanity check fails. | [
"Ensures",
"an",
"initialized",
"kafka",
"{",
"@link",
"ConsumerConnector",
"}",
"is",
"present",
"."
] | train | https://github.com/HolmesNL/kafka-spout/blob/bef626b9fab6946a7e0d3c85979ec36ae0870233/src/main/java/nl/minvenj/nfi/storm/kafka/KafkaSpout.java#L170-L177 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Spies.java | Spies.spyRes | public static <T1, T2, T3, R> TriFunction<T1, T2, T3, R> spyRes(TriFunction<T1, T2, T3, R> function, Box<R> result) {
return spy(function, result, Box.<T1>empty(), Box.<T2>empty(), Box.<T3>empty());
} | java | public static <T1, T2, T3, R> TriFunction<T1, T2, T3, R> spyRes(TriFunction<T1, T2, T3, R> function, Box<R> result) {
return spy(function, result, Box.<T1>empty(), Box.<T2>empty(), Box.<T3>empty());
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"TriFunction",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"spyRes",
"(",
"TriFunction",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"function",
",",
"Box",
"<",
"R",... | Proxies a ternary function spying for result.
@param <R> the function result type
@param <T1> the function first parameter type
@param <T2> the function second parameter type
@param <T3> the function third parameter type
@param function the function that will be spied
@param result a box that will be containing spied result
@return the proxied function | [
"Proxies",
"a",
"ternary",
"function",
"spying",
"for",
"result",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L194-L196 |
jmxtrans/jmxtrans | jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/output/Settings.java | Settings.getIntSetting | protected static int getIntSetting(Map<String, Object> settings, String key, int defaultVal) throws IllegalArgumentException {
if (settings.containsKey(key)) {
final Object objectValue = settings.get(key);
if (objectValue == null) {
throw new IllegalArgumentException("Setting '" + key + " null");
}
final String value = objectValue.toString();
try {
return Integer.parseInt(value);
} catch (Exception e) {
throw new IllegalArgumentException("Setting '" + key + "=" + value + "' is not an integer", e);
}
} else {
return defaultVal;
}
} | java | protected static int getIntSetting(Map<String, Object> settings, String key, int defaultVal) throws IllegalArgumentException {
if (settings.containsKey(key)) {
final Object objectValue = settings.get(key);
if (objectValue == null) {
throw new IllegalArgumentException("Setting '" + key + " null");
}
final String value = objectValue.toString();
try {
return Integer.parseInt(value);
} catch (Exception e) {
throw new IllegalArgumentException("Setting '" + key + "=" + value + "' is not an integer", e);
}
} else {
return defaultVal;
}
} | [
"protected",
"static",
"int",
"getIntSetting",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"settings",
",",
"String",
"key",
",",
"int",
"defaultVal",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"settings",
".",
"containsKey",
"(",
"key",
"... | Gets an int value for the setting, returning the default value if not
specified.
@param settings
@param key the key to get the int value for
@param defaultVal default value if the setting was not specified
@return the int value for the setting
@throws IllegalArgumentException if setting does not contain an int | [
"Gets",
"an",
"int",
"value",
"for",
"the",
"setting",
"returning",
"the",
"default",
"value",
"if",
"not",
"specified",
"."
] | train | https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/output/Settings.java#L133-L148 |
GoogleCloudPlatform/appengine-gcs-client | java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java | OauthRawGcsService.put | private RawGcsCreationToken put(final GcsRestCreationToken token, ByteBuffer chunk,
final boolean isFinalChunk, long timeoutMillis) throws IOException {
final int length = chunk.remaining();
HTTPRequest req = createPutRequest(token, chunk, isFinalChunk, timeoutMillis, length);
HTTPRequestInfo info = new HTTPRequestInfo(req);
HTTPResponse response;
try {
response = urlfetch.fetch(req);
} catch (IOException e) {
throw createIOException(info, e);
}
return handlePutResponse(token, isFinalChunk, length, info, response);
} | java | private RawGcsCreationToken put(final GcsRestCreationToken token, ByteBuffer chunk,
final boolean isFinalChunk, long timeoutMillis) throws IOException {
final int length = chunk.remaining();
HTTPRequest req = createPutRequest(token, chunk, isFinalChunk, timeoutMillis, length);
HTTPRequestInfo info = new HTTPRequestInfo(req);
HTTPResponse response;
try {
response = urlfetch.fetch(req);
} catch (IOException e) {
throw createIOException(info, e);
}
return handlePutResponse(token, isFinalChunk, length, info, response);
} | [
"private",
"RawGcsCreationToken",
"put",
"(",
"final",
"GcsRestCreationToken",
"token",
",",
"ByteBuffer",
"chunk",
",",
"final",
"boolean",
"isFinalChunk",
",",
"long",
"timeoutMillis",
")",
"throws",
"IOException",
"{",
"final",
"int",
"length",
"=",
"chunk",
".... | Write the provided chunk at the offset specified in the token. If finalChunk is set, the file
will be closed. | [
"Write",
"the",
"provided",
"chunk",
"at",
"the",
"offset",
"specified",
"in",
"the",
"token",
".",
"If",
"finalChunk",
"is",
"set",
"the",
"file",
"will",
"be",
"closed",
"."
] | train | https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java#L405-L417 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.serviceName_ovhConfig_GET | public ArrayList<Long> serviceName_ovhConfig_GET(String serviceName, Boolean historical, String path) throws IOException {
String qPath = "/hosting/web/{serviceName}/ovhConfig";
StringBuilder sb = path(qPath, serviceName);
query(sb, "historical", historical);
query(sb, "path", path);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | java | public ArrayList<Long> serviceName_ovhConfig_GET(String serviceName, Boolean historical, String path) throws IOException {
String qPath = "/hosting/web/{serviceName}/ovhConfig";
StringBuilder sb = path(qPath, serviceName);
query(sb, "historical", historical);
query(sb, "path", path);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_ovhConfig_GET",
"(",
"String",
"serviceName",
",",
"Boolean",
"historical",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/{serviceName}/ovhConfig\"",
";",
"String... | Configuration used on your hosting
REST: GET /hosting/web/{serviceName}/ovhConfig
@param path [required] Filter the value of path property (like)
@param historical [required] Filter the value of historical property (=)
@param serviceName [required] The internal name of your hosting | [
"Configuration",
"used",
"on",
"your",
"hosting"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L214-L221 |
Azure/azure-sdk-for-java | containerinstance/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_10_01/implementation/ContainersInner.java | ContainersInner.listLogs | public LogsInner listLogs(String resourceGroupName, String containerGroupName, String containerName, Integer tail) {
return listLogsWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, tail).toBlocking().single().body();
} | java | public LogsInner listLogs(String resourceGroupName, String containerGroupName, String containerName, Integer tail) {
return listLogsWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, tail).toBlocking().single().body();
} | [
"public",
"LogsInner",
"listLogs",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerGroupName",
",",
"String",
"containerName",
",",
"Integer",
"tail",
")",
"{",
"return",
"listLogsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"containerGroupName",... | Get the logs for a specified container instance.
Get the logs for a specified container instance in a specified resource group and container group.
@param resourceGroupName The name of the resource group.
@param containerGroupName The name of the container group.
@param containerName The name of the container instance.
@param tail The number of lines to show from the tail of the container instance log. If not provided, all available logs are shown up to 4mb.
@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 LogsInner object if successful. | [
"Get",
"the",
"logs",
"for",
"a",
"specified",
"container",
"instance",
".",
"Get",
"the",
"logs",
"for",
"a",
"specified",
"container",
"instance",
"in",
"a",
"specified",
"resource",
"group",
"and",
"container",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_10_01/implementation/ContainersInner.java#L172-L174 |
biojava/biojava | biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastService.java | NCBIQBlastService.sendAlignmentRequest | @Override
public String sendAlignmentRequest(Sequence<Compound> seq, RemotePairwiseAlignmentProperties rpa) throws Exception {
return sendAlignmentRequest(seq.getSequenceAsString(), rpa);
} | java | @Override
public String sendAlignmentRequest(Sequence<Compound> seq, RemotePairwiseAlignmentProperties rpa) throws Exception {
return sendAlignmentRequest(seq.getSequenceAsString(), rpa);
} | [
"@",
"Override",
"public",
"String",
"sendAlignmentRequest",
"(",
"Sequence",
"<",
"Compound",
">",
"seq",
",",
"RemotePairwiseAlignmentProperties",
"rpa",
")",
"throws",
"Exception",
"{",
"return",
"sendAlignmentRequest",
"(",
"seq",
".",
"getSequenceAsString",
"(",
... | Converts given sequence to String and calls
{@link #sendAlignmentRequest(String, RemotePairwiseAlignmentProperties)} | [
"Converts",
"given",
"sequence",
"to",
"String",
"and",
"calls",
"{"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastService.java#L142-L145 |
alkacon/opencms-core | src/org/opencms/publish/CmsPublishManager.java | CmsPublishManager.getPublishList | public CmsPublishList getPublishList(
CmsObject cms,
List<CmsResource> directPublishResources,
boolean directPublishSiblings,
boolean publishSubResources) throws CmsException {
return m_securityManager.fillPublishList(
cms.getRequestContext(),
new CmsPublishList(directPublishResources, directPublishSiblings, publishSubResources));
} | java | public CmsPublishList getPublishList(
CmsObject cms,
List<CmsResource> directPublishResources,
boolean directPublishSiblings,
boolean publishSubResources) throws CmsException {
return m_securityManager.fillPublishList(
cms.getRequestContext(),
new CmsPublishList(directPublishResources, directPublishSiblings, publishSubResources));
} | [
"public",
"CmsPublishList",
"getPublishList",
"(",
"CmsObject",
"cms",
",",
"List",
"<",
"CmsResource",
">",
"directPublishResources",
",",
"boolean",
"directPublishSiblings",
",",
"boolean",
"publishSubResources",
")",
"throws",
"CmsException",
"{",
"return",
"m_securi... | Returns a publish list with all new/changed/deleted resources of the current (offline)
project that actually get published for a direct publish of a List of resources.<p>
@param cms the cms request context
@param directPublishResources the {@link CmsResource} objects which will be directly published
@param directPublishSiblings <code>true</code>, if all eventual siblings of the direct
published resources should also get published.
@param publishSubResources indicates if sub-resources in folders should be published (for direct publish only)
@return a publish list
@throws CmsException if something goes wrong | [
"Returns",
"a",
"publish",
"list",
"with",
"all",
"new",
"/",
"changed",
"/",
"deleted",
"resources",
"of",
"the",
"current",
"(",
"offline",
")",
"project",
"that",
"actually",
"get",
"published",
"for",
"a",
"direct",
"publish",
"of",
"a",
"List",
"of",
... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/publish/CmsPublishManager.java#L350-L359 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.getClosedListAsync | public Observable<ClosedListEntityExtractor> getClosedListAsync(UUID appId, String versionId, UUID clEntityId) {
return getClosedListWithServiceResponseAsync(appId, versionId, clEntityId).map(new Func1<ServiceResponse<ClosedListEntityExtractor>, ClosedListEntityExtractor>() {
@Override
public ClosedListEntityExtractor call(ServiceResponse<ClosedListEntityExtractor> response) {
return response.body();
}
});
} | java | public Observable<ClosedListEntityExtractor> getClosedListAsync(UUID appId, String versionId, UUID clEntityId) {
return getClosedListWithServiceResponseAsync(appId, versionId, clEntityId).map(new Func1<ServiceResponse<ClosedListEntityExtractor>, ClosedListEntityExtractor>() {
@Override
public ClosedListEntityExtractor call(ServiceResponse<ClosedListEntityExtractor> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ClosedListEntityExtractor",
">",
"getClosedListAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"clEntityId",
")",
"{",
"return",
"getClosedListWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"clEntit... | Gets information of a closed list model.
@param appId The application ID.
@param versionId The version ID.
@param clEntityId The closed list model ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ClosedListEntityExtractor object | [
"Gets",
"information",
"of",
"a",
"closed",
"list",
"model",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L4245-L4252 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtil.java | SessionUtil.handleFederatedFlowError | private static void handleFederatedFlowError(LoginInput loginInput, Exception ex)
throws SnowflakeSQLException
{
if (ex instanceof IOException)
{
logger.error("IOException when authenticating with " +
loginInput.getAuthenticator(), ex);
throw new SnowflakeSQLException(ex, SqlState.IO_ERROR,
ErrorCode.NETWORK_ERROR.getMessageCode(),
"Exception encountered when opening connection: " +
ex.getMessage());
}
logger.error("Exception when authenticating with " +
loginInput.getAuthenticator(), ex);
throw new SnowflakeSQLException(ex,
SqlState.SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION,
ErrorCode.CONNECTION_ERROR.getMessageCode(),
ErrorCode.CONNECTION_ERROR.getMessageCode(), ex.getMessage());
} | java | private static void handleFederatedFlowError(LoginInput loginInput, Exception ex)
throws SnowflakeSQLException
{
if (ex instanceof IOException)
{
logger.error("IOException when authenticating with " +
loginInput.getAuthenticator(), ex);
throw new SnowflakeSQLException(ex, SqlState.IO_ERROR,
ErrorCode.NETWORK_ERROR.getMessageCode(),
"Exception encountered when opening connection: " +
ex.getMessage());
}
logger.error("Exception when authenticating with " +
loginInput.getAuthenticator(), ex);
throw new SnowflakeSQLException(ex,
SqlState.SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION,
ErrorCode.CONNECTION_ERROR.getMessageCode(),
ErrorCode.CONNECTION_ERROR.getMessageCode(), ex.getMessage());
} | [
"private",
"static",
"void",
"handleFederatedFlowError",
"(",
"LoginInput",
"loginInput",
",",
"Exception",
"ex",
")",
"throws",
"SnowflakeSQLException",
"{",
"if",
"(",
"ex",
"instanceof",
"IOException",
")",
"{",
"logger",
".",
"error",
"(",
"\"IOException when au... | Logs an error generated during the federated authentication flow and
re-throws it as a SnowflakeSQLException.
Note that we seperate IOExceptions since those tend to be network related.
@param loginInput
@param ex
@throws SnowflakeSQLException | [
"Logs",
"an",
"error",
"generated",
"during",
"the",
"federated",
"authentication",
"flow",
"and",
"re",
"-",
"throws",
"it",
"as",
"a",
"SnowflakeSQLException",
".",
"Note",
"that",
"we",
"seperate",
"IOExceptions",
"since",
"those",
"tend",
"to",
"be",
"netw... | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L1352-L1371 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java | DecimalFormat.getEquivalentDecimals | private UnicodeSet getEquivalentDecimals(String decimal, boolean strictParse) {
UnicodeSet equivSet = UnicodeSet.EMPTY;
if (strictParse) {
if (strictDotEquivalents.contains(decimal)) {
equivSet = strictDotEquivalents;
} else if (strictCommaEquivalents.contains(decimal)) {
equivSet = strictCommaEquivalents;
}
} else {
if (dotEquivalents.contains(decimal)) {
equivSet = dotEquivalents;
} else if (commaEquivalents.contains(decimal)) {
equivSet = commaEquivalents;
}
}
return equivSet;
} | java | private UnicodeSet getEquivalentDecimals(String decimal, boolean strictParse) {
UnicodeSet equivSet = UnicodeSet.EMPTY;
if (strictParse) {
if (strictDotEquivalents.contains(decimal)) {
equivSet = strictDotEquivalents;
} else if (strictCommaEquivalents.contains(decimal)) {
equivSet = strictCommaEquivalents;
}
} else {
if (dotEquivalents.contains(decimal)) {
equivSet = dotEquivalents;
} else if (commaEquivalents.contains(decimal)) {
equivSet = commaEquivalents;
}
}
return equivSet;
} | [
"private",
"UnicodeSet",
"getEquivalentDecimals",
"(",
"String",
"decimal",
",",
"boolean",
"strictParse",
")",
"{",
"UnicodeSet",
"equivSet",
"=",
"UnicodeSet",
".",
"EMPTY",
";",
"if",
"(",
"strictParse",
")",
"{",
"if",
"(",
"strictDotEquivalents",
".",
"cont... | Returns a set of characters equivalent to the given desimal separator used for
parsing number. This method may return an empty set. | [
"Returns",
"a",
"set",
"of",
"characters",
"equivalent",
"to",
"the",
"given",
"desimal",
"separator",
"used",
"for",
"parsing",
"number",
".",
"This",
"method",
"may",
"return",
"an",
"empty",
"set",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java#L2824-L2840 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.bucketSort | public static void bucketSort(final Object[] a, final int fromIndex, final int toIndex) {
Array.bucketSort(a, fromIndex, toIndex);
} | java | public static void bucketSort(final Object[] a, final int fromIndex, final int toIndex) {
Array.bucketSort(a, fromIndex, toIndex);
} | [
"public",
"static",
"void",
"bucketSort",
"(",
"final",
"Object",
"[",
"]",
"a",
",",
"final",
"int",
"fromIndex",
",",
"final",
"int",
"toIndex",
")",
"{",
"Array",
".",
"bucketSort",
"(",
"a",
",",
"fromIndex",
",",
"toIndex",
")",
";",
"}"
] | Note: All the objects with same value will be replaced with first element with the same value.
@param a the elements in the array must implements the <code>Comparable</code> interface.
@param fromIndex
@param toIndex | [
"Note",
":",
"All",
"the",
"objects",
"with",
"same",
"value",
"will",
"be",
"replaced",
"with",
"first",
"element",
"with",
"the",
"same",
"value",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L12008-L12010 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newServiceInvocationException | public static ServiceInvocationException newServiceInvocationException(Throwable cause,
String message, Object... args) {
return new ServiceInvocationException(format(message, args), cause);
} | java | public static ServiceInvocationException newServiceInvocationException(Throwable cause,
String message, Object... args) {
return new ServiceInvocationException(format(message, args), cause);
} | [
"public",
"static",
"ServiceInvocationException",
"newServiceInvocationException",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"ServiceInvocationException",
"(",
"format",
"(",
"message",
",",
"args",
... | Constructs and initializes a new {@link ServiceInvocationException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link ServiceInvocationException} was thrown.
@param message {@link String} describing the {@link ServiceInvocationException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link ServiceInvocationException} with the given {@link Throwable cause} and {@link String message}.
@see org.cp.elements.service.ServiceInvocationException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"ServiceInvocationException",
"}",
"with",
"the",
"given",
"{",
"@link",
"Throwable",
"cause",
"}",
"and",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L685-L689 |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java | RTMPProtocolEncoder.getHeaderType | private byte getHeaderType(final Header header, final Header lastHeader) {
//int lastFullTs = ((RTMPConnection) Red5.getConnectionLocal()).getState().getLastFullTimestampWritten(header.getChannelId());
if (lastHeader == null || header.getStreamId() != lastHeader.getStreamId() || header.getTimer() < lastHeader.getTimer()) {
// new header mark if header for another stream
return HEADER_NEW;
} else if (header.getSize() != lastHeader.getSize() || header.getDataType() != lastHeader.getDataType()) {
// same source header if last header data type or size differ
return HEADER_SAME_SOURCE;
} else if (header.getTimer() != lastHeader.getTimer()) {
// timer change marker if there's time gap between header time stamps
return HEADER_TIMER_CHANGE;
}
// continue encoding
return HEADER_CONTINUE;
} | java | private byte getHeaderType(final Header header, final Header lastHeader) {
//int lastFullTs = ((RTMPConnection) Red5.getConnectionLocal()).getState().getLastFullTimestampWritten(header.getChannelId());
if (lastHeader == null || header.getStreamId() != lastHeader.getStreamId() || header.getTimer() < lastHeader.getTimer()) {
// new header mark if header for another stream
return HEADER_NEW;
} else if (header.getSize() != lastHeader.getSize() || header.getDataType() != lastHeader.getDataType()) {
// same source header if last header data type or size differ
return HEADER_SAME_SOURCE;
} else if (header.getTimer() != lastHeader.getTimer()) {
// timer change marker if there's time gap between header time stamps
return HEADER_TIMER_CHANGE;
}
// continue encoding
return HEADER_CONTINUE;
} | [
"private",
"byte",
"getHeaderType",
"(",
"final",
"Header",
"header",
",",
"final",
"Header",
"lastHeader",
")",
"{",
"//int lastFullTs = ((RTMPConnection) Red5.getConnectionLocal()).getState().getLastFullTimestampWritten(header.getChannelId());\r",
"if",
"(",
"lastHeader",
"==",
... | Determine type of header to use.
@param header RTMP message header
@param lastHeader Previous header
@return Header type to use | [
"Determine",
"type",
"of",
"header",
"to",
"use",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java#L356-L370 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/search/bingcustomimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/customimagesearch/implementation/BingCustomInstancesImpl.java | BingCustomInstancesImpl.imageSearchAsync | public Observable<Images> imageSearchAsync(long customConfig, String query, ImageSearchOptionalParameter imageSearchOptionalParameter) {
return imageSearchWithServiceResponseAsync(customConfig, query, imageSearchOptionalParameter).map(new Func1<ServiceResponse<Images>, Images>() {
@Override
public Images call(ServiceResponse<Images> response) {
return response.body();
}
});
} | java | public Observable<Images> imageSearchAsync(long customConfig, String query, ImageSearchOptionalParameter imageSearchOptionalParameter) {
return imageSearchWithServiceResponseAsync(customConfig, query, imageSearchOptionalParameter).map(new Func1<ServiceResponse<Images>, Images>() {
@Override
public Images call(ServiceResponse<Images> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Images",
">",
"imageSearchAsync",
"(",
"long",
"customConfig",
",",
"String",
"query",
",",
"ImageSearchOptionalParameter",
"imageSearchOptionalParameter",
")",
"{",
"return",
"imageSearchWithServiceResponseAsync",
"(",
"customConfig",
",",
"... | The Custom Image Search API lets you send an image search query to Bing and get image results found in your custom view of the web.
@param customConfig The identifier for the custom search configuration
@param query The user's search query term. The term cannot be empty. The term may contain [Bing Advanced Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to limit images to a specific domain, use the [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help improve relevance of an insights query (see [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)), you should always include the user's query term. Use this parameter only with the Image Search API.Do not specify this parameter when calling the Trending Images API.
@param imageSearchOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Images object | [
"The",
"Custom",
"Image",
"Search",
"API",
"lets",
"you",
"send",
"an",
"image",
"search",
"query",
"to",
"Bing",
"and",
"get",
"image",
"results",
"found",
"in",
"your",
"custom",
"view",
"of",
"the",
"web",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingcustomimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/customimagesearch/implementation/BingCustomInstancesImpl.java#L109-L116 |
alkacon/opencms-core | src/org/opencms/site/xmlsitemap/CmsXmlSitemapGenerator.java | CmsXmlSitemapGenerator.replaceServerUri | public static String replaceServerUri(String link, String server) {
String serverUriStr = server;
if (CmsStringUtil.isEmptyOrWhitespaceOnly(serverUriStr)) {
return link;
}
try {
URI serverUri = new URI(serverUriStr);
URI linkUri = new URI(link);
URI result = new URI(
serverUri.getScheme(),
serverUri.getAuthority(),
linkUri.getPath(),
linkUri.getQuery(),
linkUri.getFragment());
return result.toString();
} catch (URISyntaxException e) {
LOG.error(e.getLocalizedMessage(), e);
return link;
}
} | java | public static String replaceServerUri(String link, String server) {
String serverUriStr = server;
if (CmsStringUtil.isEmptyOrWhitespaceOnly(serverUriStr)) {
return link;
}
try {
URI serverUri = new URI(serverUriStr);
URI linkUri = new URI(link);
URI result = new URI(
serverUri.getScheme(),
serverUri.getAuthority(),
linkUri.getPath(),
linkUri.getQuery(),
linkUri.getFragment());
return result.toString();
} catch (URISyntaxException e) {
LOG.error(e.getLocalizedMessage(), e);
return link;
}
} | [
"public",
"static",
"String",
"replaceServerUri",
"(",
"String",
"link",
",",
"String",
"server",
")",
"{",
"String",
"serverUriStr",
"=",
"server",
";",
"if",
"(",
"CmsStringUtil",
".",
"isEmptyOrWhitespaceOnly",
"(",
"serverUriStr",
")",
")",
"{",
"return",
... | Replaces the protocol/host/port of a link with the ones from the given server URI, if it's not empty.<p>
@param link the link to change
@param server the server URI string
@return the changed link | [
"Replaces",
"the",
"protocol",
"/",
"host",
"/",
"port",
"of",
"a",
"link",
"with",
"the",
"ones",
"from",
"the",
"given",
"server",
"URI",
"if",
"it",
"s",
"not",
"empty",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/xmlsitemap/CmsXmlSitemapGenerator.java#L211-L233 |
alkacon/opencms-core | src/org/opencms/workplace/tools/CmsToolGroup.java | CmsToolGroup.addAdminTool | public void addAdminTool(CmsTool adminTool, float position) {
m_container.addIdentifiableObject(adminTool.getId(), adminTool, position);
} | java | public void addAdminTool(CmsTool adminTool, float position) {
m_container.addIdentifiableObject(adminTool.getId(), adminTool, position);
} | [
"public",
"void",
"addAdminTool",
"(",
"CmsTool",
"adminTool",
",",
"float",
"position",
")",
"{",
"m_container",
".",
"addIdentifiableObject",
"(",
"adminTool",
".",
"getId",
"(",
")",
",",
"adminTool",
",",
"position",
")",
";",
"}"
] | Adds an admin tool at the given position.<p>
@param adminTool the admin tool
@param position the position
@see org.opencms.workplace.tools.CmsIdentifiableObjectContainer#addIdentifiableObject(String, Object, float) | [
"Adds",
"an",
"admin",
"tool",
"at",
"the",
"given",
"position",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/tools/CmsToolGroup.java#L87-L90 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/widget/ProfilePictureView.java | ProfilePictureView.onMeasure | @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
ViewGroup.LayoutParams params = getLayoutParams();
boolean customMeasure = false;
int newHeight = MeasureSpec.getSize(heightMeasureSpec);
int newWidth = MeasureSpec.getSize(widthMeasureSpec);
if (MeasureSpec.getMode(heightMeasureSpec) != MeasureSpec.EXACTLY &&
params.height == ViewGroup.LayoutParams.WRAP_CONTENT) {
newHeight = getPresetSizeInPixels(true); // Default to a preset size
heightMeasureSpec = MeasureSpec.makeMeasureSpec(newHeight, MeasureSpec.EXACTLY);
customMeasure = true;
}
if (MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.EXACTLY &&
params.width == ViewGroup.LayoutParams.WRAP_CONTENT) {
newWidth = getPresetSizeInPixels(true); // Default to a preset size
widthMeasureSpec = MeasureSpec.makeMeasureSpec(newWidth, MeasureSpec.EXACTLY);
customMeasure = true;
}
if (customMeasure) {
// Since we are providing custom dimensions, we need to handle the measure
// phase from here
setMeasuredDimension(newWidth, newHeight);
measureChildren(widthMeasureSpec, heightMeasureSpec);
} else {
// Rely on FrameLayout to do the right thing
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
} | java | @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
ViewGroup.LayoutParams params = getLayoutParams();
boolean customMeasure = false;
int newHeight = MeasureSpec.getSize(heightMeasureSpec);
int newWidth = MeasureSpec.getSize(widthMeasureSpec);
if (MeasureSpec.getMode(heightMeasureSpec) != MeasureSpec.EXACTLY &&
params.height == ViewGroup.LayoutParams.WRAP_CONTENT) {
newHeight = getPresetSizeInPixels(true); // Default to a preset size
heightMeasureSpec = MeasureSpec.makeMeasureSpec(newHeight, MeasureSpec.EXACTLY);
customMeasure = true;
}
if (MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.EXACTLY &&
params.width == ViewGroup.LayoutParams.WRAP_CONTENT) {
newWidth = getPresetSizeInPixels(true); // Default to a preset size
widthMeasureSpec = MeasureSpec.makeMeasureSpec(newWidth, MeasureSpec.EXACTLY);
customMeasure = true;
}
if (customMeasure) {
// Since we are providing custom dimensions, we need to handle the measure
// phase from here
setMeasuredDimension(newWidth, newHeight);
measureChildren(widthMeasureSpec, heightMeasureSpec);
} else {
// Rely on FrameLayout to do the right thing
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
} | [
"@",
"Override",
"protected",
"void",
"onMeasure",
"(",
"int",
"widthMeasureSpec",
",",
"int",
"heightMeasureSpec",
")",
"{",
"ViewGroup",
".",
"LayoutParams",
"params",
"=",
"getLayoutParams",
"(",
")",
";",
"boolean",
"customMeasure",
"=",
"false",
";",
"int",... | Overriding onMeasure to handle the case where WRAP_CONTENT might be
specified in the layout. Since we don't know the dimensions of the profile
photo, we need to handle this case specifically.
<p/>
The approach is to default to a NORMAL sized amount of space in the case that
a preset size is not specified. This logic is applied to both width and height | [
"Overriding",
"onMeasure",
"to",
"handle",
"the",
"case",
"where",
"WRAP_CONTENT",
"might",
"be",
"specified",
"in",
"the",
"layout",
".",
"Since",
"we",
"don",
"t",
"know",
"the",
"dimensions",
"of",
"the",
"profile",
"photo",
"we",
"need",
"to",
"handle",
... | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/widget/ProfilePictureView.java#L267-L296 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/gm/model/globalfac/ProjDepTreeFactor.java | ProjDepTreeFactor.getLogOddsRatios | private EdgeScores getLogOddsRatios(VarTensor[] inMsgs) {
EdgeScores es = new EdgeScores(n, Double.NEGATIVE_INFINITY);
Algebra s = inMsgs[0].getAlgebra();
// Compute the odds ratios of the messages for each edge in the tree.
for (VarTensor inMsg : inMsgs) {
LinkVar link = (LinkVar) inMsg.getVars().get(0);
double logOdds = s.toLogProb(inMsg.getValue(LinkVar.TRUE)) - s.toLogProb(inMsg.getValue(LinkVar.FALSE));
if (link.getParent() == -1) {
es.root[link.getChild()] = logOdds;
} else {
es.child[link.getParent()][link.getChild()] = logOdds;
}
}
return es;
} | java | private EdgeScores getLogOddsRatios(VarTensor[] inMsgs) {
EdgeScores es = new EdgeScores(n, Double.NEGATIVE_INFINITY);
Algebra s = inMsgs[0].getAlgebra();
// Compute the odds ratios of the messages for each edge in the tree.
for (VarTensor inMsg : inMsgs) {
LinkVar link = (LinkVar) inMsg.getVars().get(0);
double logOdds = s.toLogProb(inMsg.getValue(LinkVar.TRUE)) - s.toLogProb(inMsg.getValue(LinkVar.FALSE));
if (link.getParent() == -1) {
es.root[link.getChild()] = logOdds;
} else {
es.child[link.getParent()][link.getChild()] = logOdds;
}
}
return es;
} | [
"private",
"EdgeScores",
"getLogOddsRatios",
"(",
"VarTensor",
"[",
"]",
"inMsgs",
")",
"{",
"EdgeScores",
"es",
"=",
"new",
"EdgeScores",
"(",
"n",
",",
"Double",
".",
"NEGATIVE_INFINITY",
")",
";",
"Algebra",
"s",
"=",
"inMsgs",
"[",
"0",
"]",
".",
"ge... | Computes the log odds ratio for each edge. w_i = \mu_i(1) / \mu_i(0) | [
"Computes",
"the",
"log",
"odds",
"ratio",
"for",
"each",
"edge",
".",
"w_i",
"=",
"\\",
"mu_i",
"(",
"1",
")",
"/",
"\\",
"mu_i",
"(",
"0",
")"
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/model/globalfac/ProjDepTreeFactor.java#L365-L379 |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/filter/ContentMappings.java | ContentMappings.getMappingOrCreate | public @Nonnull ContentMapping getMappingOrCreate(@Nonnull String original, @Nonnull Function<String, ContentMapping> generator) {
boolean isNew = !mappings.containsKey(original);
ContentMapping mapping = mappings.computeIfAbsent(original, generator);
try {
if (isNew) {
save();
}
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Could not save mappings file", e);
}
return mapping;
} | java | public @Nonnull ContentMapping getMappingOrCreate(@Nonnull String original, @Nonnull Function<String, ContentMapping> generator) {
boolean isNew = !mappings.containsKey(original);
ContentMapping mapping = mappings.computeIfAbsent(original, generator);
try {
if (isNew) {
save();
}
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Could not save mappings file", e);
}
return mapping;
} | [
"public",
"@",
"Nonnull",
"ContentMapping",
"getMappingOrCreate",
"(",
"@",
"Nonnull",
"String",
"original",
",",
"@",
"Nonnull",
"Function",
"<",
"String",
",",
"ContentMapping",
">",
"generator",
")",
"{",
"boolean",
"isNew",
"=",
"!",
"mappings",
".",
"cont... | Looks up or creates a new ContentMapping for the given original string and a ContentMapping generator. | [
"Looks",
"up",
"or",
"creates",
"a",
"new",
"ContentMapping",
"for",
"the",
"given",
"original",
"string",
"and",
"a",
"ContentMapping",
"generator",
"."
] | train | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/filter/ContentMappings.java#L167-L178 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/trash/ProxiedTrash.java | ProxiedTrash.getUserTrash | protected Trash getUserTrash(final String user) throws IOException {
if (UserGroupInformation.getCurrentUser().getShortUserName().equals(user)) {
return this;
}
try {
return this.trashCache.get(user, new Callable<Trash>() {
@Override
public Trash call() throws Exception {
return createNewTrashForUser(ProxiedTrash.this.fs, ProxiedTrash.this.properties, user);
}
});
} catch (ExecutionException ee) {
throw new IOException("Failed to get trash for user " + user);
}
} | java | protected Trash getUserTrash(final String user) throws IOException {
if (UserGroupInformation.getCurrentUser().getShortUserName().equals(user)) {
return this;
}
try {
return this.trashCache.get(user, new Callable<Trash>() {
@Override
public Trash call() throws Exception {
return createNewTrashForUser(ProxiedTrash.this.fs, ProxiedTrash.this.properties, user);
}
});
} catch (ExecutionException ee) {
throw new IOException("Failed to get trash for user " + user);
}
} | [
"protected",
"Trash",
"getUserTrash",
"(",
"final",
"String",
"user",
")",
"throws",
"IOException",
"{",
"if",
"(",
"UserGroupInformation",
".",
"getCurrentUser",
"(",
")",
".",
"getShortUserName",
"(",
")",
".",
"equals",
"(",
"user",
")",
")",
"{",
"return... | Get {@link org.apache.gobblin.data.management.trash.Trash} instance for the specified user.
@param user user for whom {@link org.apache.gobblin.data.management.trash.Trash} should be generated.
@return {@link org.apache.gobblin.data.management.trash.Trash} as generated by proxied user.
@throws IOException | [
"Get",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/trash/ProxiedTrash.java#L145-L159 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/PasswordPropertiesField.java | PasswordPropertiesField.setProperty | public int setProperty(String strProperty, String strValue, boolean bDisplayOption, int iMoveMode)
{
if (m_setPropertiesDescriptions != null)
if (m_setPropertiesDescriptions.contains(strProperty))
{
byte[] rgbValue = strValue.getBytes();
rgbValue = XorEncryptedConverter.encrypt(rgbValue, key);
char[] chars = Base64.encode(rgbValue);
strValue = new String(chars);
}
return super.setProperty(strProperty, strValue, bDisplayOption, iMoveMode);
} | java | public int setProperty(String strProperty, String strValue, boolean bDisplayOption, int iMoveMode)
{
if (m_setPropertiesDescriptions != null)
if (m_setPropertiesDescriptions.contains(strProperty))
{
byte[] rgbValue = strValue.getBytes();
rgbValue = XorEncryptedConverter.encrypt(rgbValue, key);
char[] chars = Base64.encode(rgbValue);
strValue = new String(chars);
}
return super.setProperty(strProperty, strValue, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"setProperty",
"(",
"String",
"strProperty",
",",
"String",
"strValue",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"if",
"(",
"m_setPropertiesDescriptions",
"!=",
"null",
")",
"if",
"(",
"m_setPropertiesDescriptions",
"."... | Set this property in the user's property area.
@param strProperty The property key.
@param strValue The property value.
@param iDisplayOption If true, display the new field.
@param iMoveMove The move mode.
@return An error code (NORMAL_RETURN for success). | [
"Set",
"this",
"property",
"in",
"the",
"user",
"s",
"property",
"area",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/PasswordPropertiesField.java#L106-L117 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxItem.java | BoxItem.getWatermark | protected BoxWatermark getWatermark(URLTemplate itemUrl, String... fields) {
URL watermarkUrl = itemUrl.build(this.getAPI().getBaseURL(), this.getID());
QueryStringBuilder builder = new QueryStringBuilder();
if (fields.length > 0) {
builder.appendParam("fields", fields);
}
URL url = WATERMARK_URL_TEMPLATE.buildWithQuery(watermarkUrl.toString(), builder.toString());
BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
return new BoxWatermark(response.getJSON());
} | java | protected BoxWatermark getWatermark(URLTemplate itemUrl, String... fields) {
URL watermarkUrl = itemUrl.build(this.getAPI().getBaseURL(), this.getID());
QueryStringBuilder builder = new QueryStringBuilder();
if (fields.length > 0) {
builder.appendParam("fields", fields);
}
URL url = WATERMARK_URL_TEMPLATE.buildWithQuery(watermarkUrl.toString(), builder.toString());
BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
return new BoxWatermark(response.getJSON());
} | [
"protected",
"BoxWatermark",
"getWatermark",
"(",
"URLTemplate",
"itemUrl",
",",
"String",
"...",
"fields",
")",
"{",
"URL",
"watermarkUrl",
"=",
"itemUrl",
".",
"build",
"(",
"this",
".",
"getAPI",
"(",
")",
".",
"getBaseURL",
"(",
")",
",",
"this",
".",
... | Used to retrieve the watermark for the item.
If the item does not have a watermark applied to it, a 404 Not Found will be returned by API.
@param itemUrl url template for the item.
@param fields the fields to retrieve.
@return the watermark associated with the item. | [
"Used",
"to",
"retrieve",
"the",
"watermark",
"for",
"the",
"item",
".",
"If",
"the",
"item",
"does",
"not",
"have",
"a",
"watermark",
"applied",
"to",
"it",
"a",
"404",
"Not",
"Found",
"will",
"be",
"returned",
"by",
"API",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxItem.java#L87-L97 |
unbescape/unbescape | src/main/java/org/unbescape/uri/UriEscape.java | UriEscape.unescapeUriQueryParam | public static String unescapeUriQueryParam(final String text, final String encoding) {
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
return UriEscapeUtil.unescape(text, UriEscapeUtil.UriEscapeType.QUERY_PARAM, encoding);
} | java | public static String unescapeUriQueryParam(final String text, final String encoding) {
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
return UriEscapeUtil.unescape(text, UriEscapeUtil.UriEscapeType.QUERY_PARAM, encoding);
} | [
"public",
"static",
"String",
"unescapeUriQueryParam",
"(",
"final",
"String",
"text",
",",
"final",
"String",
"encoding",
")",
"{",
"if",
"(",
"encoding",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument 'encoding' cannot be null... | <p>
Perform am URI query parameter (name or value) <strong>unescape</strong> operation
on a <tt>String</tt> input.
</p>
<p>
This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input,
even for those characters that do not need to be percent-encoded in this context (unreserved characters
can be percent-encoded even if/when this is not required, though it is not generally considered a
good practice).
</p>
<p>
This method will use specified <tt>encoding</tt> in order to determine the characters specified in the
percent-encoded byte sequences.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be unescaped.
@param encoding the encoding to be used for unescaping.
@return The unescaped result <tt>String</tt>. As a memory-performance improvement, will return the exact
same object as the <tt>text</tt> input argument if no unescaping modifications were required (and
no additional <tt>String</tt> objects will be created during processing). Will
return <tt>null</tt> if input is <tt>null</tt>. | [
"<p",
">",
"Perform",
"am",
"URI",
"query",
"parameter",
"(",
"name",
"or",
"value",
")",
"<strong",
">",
"unescape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
".",
"<",
"/",
"p",
">",
"<p",
">",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L1698-L1703 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/remote/RemoteWebDriverBuilder.java | RemoteWebDriverBuilder.build | public WebDriver build() {
if (options.isEmpty() && additionalCapabilities.isEmpty()) {
throw new SessionNotCreatedException("Refusing to create session without any capabilities");
}
Plan plan = getPlan();
CommandExecutor executor;
if (plan.isUsingDriverService()) {
AtomicReference<DriverService> serviceRef = new AtomicReference<>();
executor = new SpecCompliantExecutor(
() -> {
if (serviceRef.get() != null && serviceRef.get().isRunning()) {
throw new SessionNotCreatedException(
"Attempt to start the underlying service more than once");
}
try {
DriverService service = plan.getDriverService();
serviceRef.set(service);
service.start();
return service.getUrl();
} catch (IOException e) {
throw new SessionNotCreatedException(e.getMessage(), e);
}
},
plan::writePayload,
() -> serviceRef.get().stop());
} else {
executor = new SpecCompliantExecutor(() -> remoteHost, plan::writePayload, () -> {});
}
return new RemoteWebDriver(executor, new ImmutableCapabilities());
} | java | public WebDriver build() {
if (options.isEmpty() && additionalCapabilities.isEmpty()) {
throw new SessionNotCreatedException("Refusing to create session without any capabilities");
}
Plan plan = getPlan();
CommandExecutor executor;
if (plan.isUsingDriverService()) {
AtomicReference<DriverService> serviceRef = new AtomicReference<>();
executor = new SpecCompliantExecutor(
() -> {
if (serviceRef.get() != null && serviceRef.get().isRunning()) {
throw new SessionNotCreatedException(
"Attempt to start the underlying service more than once");
}
try {
DriverService service = plan.getDriverService();
serviceRef.set(service);
service.start();
return service.getUrl();
} catch (IOException e) {
throw new SessionNotCreatedException(e.getMessage(), e);
}
},
plan::writePayload,
() -> serviceRef.get().stop());
} else {
executor = new SpecCompliantExecutor(() -> remoteHost, plan::writePayload, () -> {});
}
return new RemoteWebDriver(executor, new ImmutableCapabilities());
} | [
"public",
"WebDriver",
"build",
"(",
")",
"{",
"if",
"(",
"options",
".",
"isEmpty",
"(",
")",
"&&",
"additionalCapabilities",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"SessionNotCreatedException",
"(",
"\"Refusing to create session without any capabiliti... | Actually create a new WebDriver session. The returned webdriver is not guaranteed to be a
{@link RemoteWebDriver}. | [
"Actually",
"create",
"a",
"new",
"WebDriver",
"session",
".",
"The",
"returned",
"webdriver",
"is",
"not",
"guaranteed",
"to",
"be",
"a",
"{"
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/remote/RemoteWebDriverBuilder.java#L194-L227 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsCreator.java | StatsCreator.addStatisticsToParent | public static void addStatisticsToParent(SPIStats parentStats, SPIStatistic statistic) {
StatsImpl p = (StatsImpl) parentStats;
StatisticImpl s = (StatisticImpl) statistic;
p.add(s);
} | java | public static void addStatisticsToParent(SPIStats parentStats, SPIStatistic statistic) {
StatsImpl p = (StatsImpl) parentStats;
StatisticImpl s = (StatisticImpl) statistic;
p.add(s);
} | [
"public",
"static",
"void",
"addStatisticsToParent",
"(",
"SPIStats",
"parentStats",
",",
"SPIStatistic",
"statistic",
")",
"{",
"StatsImpl",
"p",
"=",
"(",
"StatsImpl",
")",
"parentStats",
";",
"StatisticImpl",
"s",
"=",
"(",
"StatisticImpl",
")",
"statistic",
... | This method adds one Statistic object as the child of a Stats object
@param parentStats This stats is the parent
@param statistic This statistic should be added | [
"This",
"method",
"adds",
"one",
"Statistic",
"object",
"as",
"the",
"child",
"of",
"a",
"Stats",
"object"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsCreator.java#L147-L151 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/recordcount/LateFileRecordCountProvider.java | LateFileRecordCountProvider.constructLateFilePath | public Path constructLateFilePath(String originalFilename, FileSystem fs, Path outputDir) throws IOException {
if (!fs.exists(new Path(outputDir, originalFilename))) {
return new Path(outputDir, originalFilename);
}
return constructLateFilePath(FilenameUtils.getBaseName(originalFilename) + LATE_COMPONENT
+ new Random().nextInt(Integer.MAX_VALUE) + SEPARATOR + FilenameUtils.getExtension(originalFilename), fs,
outputDir);
} | java | public Path constructLateFilePath(String originalFilename, FileSystem fs, Path outputDir) throws IOException {
if (!fs.exists(new Path(outputDir, originalFilename))) {
return new Path(outputDir, originalFilename);
}
return constructLateFilePath(FilenameUtils.getBaseName(originalFilename) + LATE_COMPONENT
+ new Random().nextInt(Integer.MAX_VALUE) + SEPARATOR + FilenameUtils.getExtension(originalFilename), fs,
outputDir);
} | [
"public",
"Path",
"constructLateFilePath",
"(",
"String",
"originalFilename",
",",
"FileSystem",
"fs",
",",
"Path",
"outputDir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"fs",
".",
"exists",
"(",
"new",
"Path",
"(",
"outputDir",
",",
"originalFilenam... | Construct filename for a late file. If the file does not exists in the output dir, retain the original name.
Otherwise, append a LATE_COMPONENT{RandomInteger} to the original file name.
For example, if file "part1.123.avro" exists in dir "/a/b/", the returned path will be "/a/b/part1.123.late12345.avro". | [
"Construct",
"filename",
"for",
"a",
"late",
"file",
".",
"If",
"the",
"file",
"does",
"not",
"exists",
"in",
"the",
"output",
"dir",
"retain",
"the",
"original",
"name",
".",
"Otherwise",
"append",
"a",
"LATE_COMPONENT",
"{",
"RandomInteger",
"}",
"to",
"... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/recordcount/LateFileRecordCountProvider.java#L45-L52 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java | StorageTreeFactory.configureConverterPlugin | private TreeBuilder<ResourceMeta> configureConverterPlugin(TreeBuilder<ResourceMeta> builder, int index,
Map<String, String> configProps) {
String pref1 = getConverterConfigPrefix() + SEP + index;
String pluginType = configProps.get(pref1 + SEP + TYPE);
String pathProp = pref1 + SEP + PATH;
String selectorProp = pref1 + SEP + RESOURCE_SELECTOR;
String path = configProps.get(pathProp);
String selector = configProps.get(selectorProp);
if (null == path && null == selector) {
throw new IllegalArgumentException("Converter plugin [" + index + "] specified by " + (pref1) + " MUST " +
"define one of: " +
pathProp + " OR " + selectorProp);
}
Map<String, String> config = subPropertyMap(pref1 + SEP + CONFIG + SEP, configProps);
config = expandConfig(config);
logger.debug("Add Converter[" + index + "]:"
+ (null != path ? path : "/")
+ "[" + (null != selector ? selector : "*") + "]"
+ " " + pluginType + ", config: " + config);
return buildConverterPlugin(builder, pluginType, path, selector, config);
} | java | private TreeBuilder<ResourceMeta> configureConverterPlugin(TreeBuilder<ResourceMeta> builder, int index,
Map<String, String> configProps) {
String pref1 = getConverterConfigPrefix() + SEP + index;
String pluginType = configProps.get(pref1 + SEP + TYPE);
String pathProp = pref1 + SEP + PATH;
String selectorProp = pref1 + SEP + RESOURCE_SELECTOR;
String path = configProps.get(pathProp);
String selector = configProps.get(selectorProp);
if (null == path && null == selector) {
throw new IllegalArgumentException("Converter plugin [" + index + "] specified by " + (pref1) + " MUST " +
"define one of: " +
pathProp + " OR " + selectorProp);
}
Map<String, String> config = subPropertyMap(pref1 + SEP + CONFIG + SEP, configProps);
config = expandConfig(config);
logger.debug("Add Converter[" + index + "]:"
+ (null != path ? path : "/")
+ "[" + (null != selector ? selector : "*") + "]"
+ " " + pluginType + ", config: " + config);
return buildConverterPlugin(builder, pluginType, path, selector, config);
} | [
"private",
"TreeBuilder",
"<",
"ResourceMeta",
">",
"configureConverterPlugin",
"(",
"TreeBuilder",
"<",
"ResourceMeta",
">",
"builder",
",",
"int",
"index",
",",
"Map",
"<",
"String",
",",
"String",
">",
"configProps",
")",
"{",
"String",
"pref1",
"=",
"getCo... | Configure converter plugins for the builder
@param builder builder
@param index given index
@param configProps configuration properties
@return builder | [
"Configure",
"converter",
"plugins",
"for",
"the",
"builder"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java#L204-L227 |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java | JarWriter.writeEntry | @Override
public void writeEntry(String entryName, InputStream inputStream) throws IOException {
JarArchiveEntry entry = new JarArchiveEntry(entryName);
writeEntry(entry, new InputStreamEntryWriter(inputStream, true));
} | java | @Override
public void writeEntry(String entryName, InputStream inputStream) throws IOException {
JarArchiveEntry entry = new JarArchiveEntry(entryName);
writeEntry(entry, new InputStreamEntryWriter(inputStream, true));
} | [
"@",
"Override",
"public",
"void",
"writeEntry",
"(",
"String",
"entryName",
",",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"JarArchiveEntry",
"entry",
"=",
"new",
"JarArchiveEntry",
"(",
"entryName",
")",
";",
"writeEntry",
"(",
"entry",
... | Writes an entry. The {@code inputStream} is closed once the entry has been written
@param entryName the name of the entry
@param inputStream the stream from which the entry's data can be read
@throws IOException if the write fails | [
"Writes",
"an",
"entry",
".",
"The",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java#L167-L171 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/UserAPI.java | UserAPI.tagsMembersGetblacklist | public static GetblacklistResult tagsMembersGetblacklist(String access_token,String begin_openid){
String json = String.format("{\"begin_openid\":\"%s\"}",begin_openid == null?"":begin_openid);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(jsonHeader)
.setUri(BASE_URI+"/cgi-bin/tags/members/getblacklist")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.setEntity(new StringEntity(json,Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,GetblacklistResult.class);
} | java | public static GetblacklistResult tagsMembersGetblacklist(String access_token,String begin_openid){
String json = String.format("{\"begin_openid\":\"%s\"}",begin_openid == null?"":begin_openid);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(jsonHeader)
.setUri(BASE_URI+"/cgi-bin/tags/members/getblacklist")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.setEntity(new StringEntity(json,Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,GetblacklistResult.class);
} | [
"public",
"static",
"GetblacklistResult",
"tagsMembersGetblacklist",
"(",
"String",
"access_token",
",",
"String",
"begin_openid",
")",
"{",
"String",
"json",
"=",
"String",
".",
"format",
"(",
"\"{\\\"begin_openid\\\":\\\"%s\\\"}\"",
",",
"begin_openid",
"==",
"null",
... | 黑名单管理 获取公众号的黑名单列表<br>
该接口每次调用最多可拉取 10000 个OpenID,当列表数较多时,可以通过多次拉取的方式来满足需求。
@since 2.8.1
@param access_token access_token
@param begin_openid 当 begin_openid 为空时,默认从开头拉取。
@return result | [
"黑名单管理",
"获取公众号的黑名单列表<br",
">",
"该接口每次调用最多可拉取",
"10000",
"个OpenID,当列表数较多时,可以通过多次拉取的方式来满足需求。"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/UserAPI.java#L431-L440 |
pravega/pravega | common/src/main/java/io/pravega/common/io/StreamHelpers.java | StreamHelpers.readAll | public static int readAll(InputStream stream, byte[] target, int startOffset, int maxLength) throws IOException {
Preconditions.checkNotNull(stream, "stream");
Preconditions.checkNotNull(stream, "target");
Preconditions.checkElementIndex(startOffset, target.length, "startOffset");
Exceptions.checkArgument(maxLength >= 0, "maxLength", "maxLength must be a non-negative number.");
int totalBytesRead = 0;
while (totalBytesRead < maxLength) {
int bytesRead = stream.read(target, startOffset + totalBytesRead, maxLength - totalBytesRead);
if (bytesRead < 0) {
// End of stream/
break;
}
totalBytesRead += bytesRead;
}
return totalBytesRead;
} | java | public static int readAll(InputStream stream, byte[] target, int startOffset, int maxLength) throws IOException {
Preconditions.checkNotNull(stream, "stream");
Preconditions.checkNotNull(stream, "target");
Preconditions.checkElementIndex(startOffset, target.length, "startOffset");
Exceptions.checkArgument(maxLength >= 0, "maxLength", "maxLength must be a non-negative number.");
int totalBytesRead = 0;
while (totalBytesRead < maxLength) {
int bytesRead = stream.read(target, startOffset + totalBytesRead, maxLength - totalBytesRead);
if (bytesRead < 0) {
// End of stream/
break;
}
totalBytesRead += bytesRead;
}
return totalBytesRead;
} | [
"public",
"static",
"int",
"readAll",
"(",
"InputStream",
"stream",
",",
"byte",
"[",
"]",
"target",
",",
"int",
"startOffset",
",",
"int",
"maxLength",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"stream",
",",
"\"stream\"",
... | Reads at most 'maxLength' bytes from the given input stream, as long as the stream still has data to serve.
@param stream The InputStream to read from.
@param target The target array to write data to.
@param startOffset The offset within the target array to start writing data to.
@param maxLength The maximum number of bytes to copy.
@return The number of bytes copied.
@throws IOException If unable to read from the given stream. | [
"Reads",
"at",
"most",
"maxLength",
"bytes",
"from",
"the",
"given",
"input",
"stream",
"as",
"long",
"as",
"the",
"stream",
"still",
"has",
"data",
"to",
"serve",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/io/StreamHelpers.java#L32-L50 |
jbehave/jbehave-core | jbehave-core/src/main/java/org/jbehave/core/steps/StepCreator.java | StepCreator.parameterNames | private ParameterName[] parameterNames(Method method) {
ParameterName[] parameterNames;
if (method != null) {
String[] annotatedNames = annotatedParameterNames(method);
String[] paranamerNames = paranamerParameterNames(method);
String[] contextNames = contextParameterNames(method);
parameterNames = new ParameterName[annotatedNames.length];
for (int i = 0; i < annotatedNames.length; i++) {
parameterNames[i] = parameterName(annotatedNames, paranamerNames, contextNames, i);
}
} else {
String[] stepMatcherParameterNames = stepMatcher.parameterNames();
parameterNames = new ParameterName[stepMatcherParameterNames.length];
for (int i = 0; i < stepMatcherParameterNames.length; i++) {
parameterNames[i] = new ParameterName(stepMatcherParameterNames[i], false, false);
}
}
return parameterNames;
} | java | private ParameterName[] parameterNames(Method method) {
ParameterName[] parameterNames;
if (method != null) {
String[] annotatedNames = annotatedParameterNames(method);
String[] paranamerNames = paranamerParameterNames(method);
String[] contextNames = contextParameterNames(method);
parameterNames = new ParameterName[annotatedNames.length];
for (int i = 0; i < annotatedNames.length; i++) {
parameterNames[i] = parameterName(annotatedNames, paranamerNames, contextNames, i);
}
} else {
String[] stepMatcherParameterNames = stepMatcher.parameterNames();
parameterNames = new ParameterName[stepMatcherParameterNames.length];
for (int i = 0; i < stepMatcherParameterNames.length; i++) {
parameterNames[i] = new ParameterName(stepMatcherParameterNames[i], false, false);
}
}
return parameterNames;
} | [
"private",
"ParameterName",
"[",
"]",
"parameterNames",
"(",
"Method",
"method",
")",
"{",
"ParameterName",
"[",
"]",
"parameterNames",
";",
"if",
"(",
"method",
"!=",
"null",
")",
"{",
"String",
"[",
"]",
"annotatedNames",
"=",
"annotatedParameterNames",
"(",... | Returns the {@link ParameterName} representations for the method,
providing an abstraction that supports both annotated and non-annotated
parameters.
@param method the Method
@return The array of {@link ParameterName}s | [
"Returns",
"the",
"{",
"@link",
"ParameterName",
"}",
"representations",
"for",
"the",
"method",
"providing",
"an",
"abstraction",
"that",
"supports",
"both",
"annotated",
"and",
"non",
"-",
"annotated",
"parameters",
"."
] | train | https://github.com/jbehave/jbehave-core/blob/bdd6a6199528df3c35087e72d4644870655b23e6/jbehave-core/src/main/java/org/jbehave/core/steps/StepCreator.java#L138-L157 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.rules_GET | public OvhRule rules_GET(String cartId, Long itemId) throws IOException {
String qPath = "/domain/rules";
StringBuilder sb = path(qPath);
query(sb, "cartId", cartId);
query(sb, "itemId", itemId);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRule.class);
} | java | public OvhRule rules_GET(String cartId, Long itemId) throws IOException {
String qPath = "/domain/rules";
StringBuilder sb = path(qPath);
query(sb, "cartId", cartId);
query(sb, "itemId", itemId);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRule.class);
} | [
"public",
"OvhRule",
"rules_GET",
"(",
"String",
"cartId",
",",
"Long",
"itemId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/rules\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"query",
"(",
"sb",
",",
"\"c... | List all the rules for a specific cartId/itemId
REST: GET /domain/rules
@param cartId [required] Cart ID concerned for the rules
@param itemId [required] Item ID concerned for the rules
API beta | [
"List",
"all",
"the",
"rules",
"for",
"a",
"specific",
"cartId",
"/",
"itemId"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L310-L317 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Searcher.java | Searcher.searchForWebElement | public WebElement searchForWebElement(final By by, int minimumNumberOfMatches){
if(minimumNumberOfMatches < 1){
minimumNumberOfMatches = 1;
}
List<WebElement> viewsFromScreen = webUtils.getWebElements(by, true);
addViewsToList (webElements, viewsFromScreen);
return getViewFromList(webElements, minimumNumberOfMatches);
} | java | public WebElement searchForWebElement(final By by, int minimumNumberOfMatches){
if(minimumNumberOfMatches < 1){
minimumNumberOfMatches = 1;
}
List<WebElement> viewsFromScreen = webUtils.getWebElements(by, true);
addViewsToList (webElements, viewsFromScreen);
return getViewFromList(webElements, minimumNumberOfMatches);
} | [
"public",
"WebElement",
"searchForWebElement",
"(",
"final",
"By",
"by",
",",
"int",
"minimumNumberOfMatches",
")",
"{",
"if",
"(",
"minimumNumberOfMatches",
"<",
"1",
")",
"{",
"minimumNumberOfMatches",
"=",
"1",
";",
"}",
"List",
"<",
"WebElement",
">",
"vie... | Searches for a web element.
@param by the By object e.g. By.id("id");
@param minimumNumberOfMatches the minimum number of matches that are expected to be shown. {@code 0} means any number of matches
@return the web element or null if not found | [
"Searches",
"for",
"a",
"web",
"element",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Searcher.java#L231-L241 |
jhipster/jhipster | jhipster-framework/src/main/java/io/github/jhipster/service/QueryService.java | QueryService.buildStringSpecification | protected Specification<ENTITY> buildStringSpecification(StringFilter filter, SingularAttribute<? super ENTITY,
String> field) {
return buildSpecification(filter, root -> root.get(field));
} | java | protected Specification<ENTITY> buildStringSpecification(StringFilter filter, SingularAttribute<? super ENTITY,
String> field) {
return buildSpecification(filter, root -> root.get(field));
} | [
"protected",
"Specification",
"<",
"ENTITY",
">",
"buildStringSpecification",
"(",
"StringFilter",
"filter",
",",
"SingularAttribute",
"<",
"?",
"super",
"ENTITY",
",",
"String",
">",
"field",
")",
"{",
"return",
"buildSpecification",
"(",
"filter",
",",
"root",
... | Helper function to return a specification for filtering on a {@link String} field, where equality, containment,
and null/non-null conditions are supported.
@param filter the individual attribute filter coming from the frontend.
@param field the JPA static metamodel representing the field.
@return a Specification | [
"Helper",
"function",
"to",
"return",
"a",
"specification",
"for",
"filtering",
"on",
"a",
"{",
"@link",
"String",
"}",
"field",
"where",
"equality",
"containment",
"and",
"null",
"/",
"non",
"-",
"null",
"conditions",
"are",
"supported",
"."
] | train | https://github.com/jhipster/jhipster/blob/5dcf4239c7cc035e188ef02447d3c628fac5c5d9/jhipster-framework/src/main/java/io/github/jhipster/service/QueryService.java#L88-L91 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/dynssl/SslCertificateUtils.java | SslCertificateUtils.pem2Keystore | public static KeyStore pem2Keystore(File pemFile) throws IOException, CertificateException,
InvalidKeySpecException, NoSuchAlgorithmException, KeyStoreException {
String certAndKey = FileUtils.readFileToString(pemFile, StandardCharsets.US_ASCII);
byte[] certBytes = extractCertificate(certAndKey);
byte[] keyBytes = extractPrivateKey(certAndKey);
return pem2KeyStore(certBytes, keyBytes);
} | java | public static KeyStore pem2Keystore(File pemFile) throws IOException, CertificateException,
InvalidKeySpecException, NoSuchAlgorithmException, KeyStoreException {
String certAndKey = FileUtils.readFileToString(pemFile, StandardCharsets.US_ASCII);
byte[] certBytes = extractCertificate(certAndKey);
byte[] keyBytes = extractPrivateKey(certAndKey);
return pem2KeyStore(certBytes, keyBytes);
} | [
"public",
"static",
"KeyStore",
"pem2Keystore",
"(",
"File",
"pemFile",
")",
"throws",
"IOException",
",",
"CertificateException",
",",
"InvalidKeySpecException",
",",
"NoSuchAlgorithmException",
",",
"KeyStoreException",
"{",
"String",
"certAndKey",
"=",
"FileUtils",
"... | Code c/o http://stackoverflow.com/questions/12501117/programmatically-obtain-keystore-from-pem
@param pemFile
@return
@throws IOException
@throws CertificateException
@throws InvalidKeySpecException
@throws NoSuchAlgorithmException
@throws KeyStoreException | [
"Code",
"c",
"/",
"o",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"12501117",
"/",
"programmatically",
"-",
"obtain",
"-",
"keystore",
"-",
"from",
"-",
"pem"
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/dynssl/SslCertificateUtils.java#L212-L219 |
mpetazzoni/ttorrent | ttorrent-client/src/main/java/com/turn/ttorrent/client/SharedTorrent.java | SharedTorrent.handlePieceAvailability | @Override
public void handlePieceAvailability(SharingPeer peer, Piece piece) {
boolean isPeerInteresting = !this.completedPieces.get(piece.getIndex()) &&
!this.requestedPieces.get(piece.getIndex());
if (isPeerInteresting) {
peer.interesting();
}
piece.seenAt(peer);
logger.trace("Peer {} contributes {} piece(s) [{}/{}/{}].",
new Object[]{
peer,
peer.getAvailablePieces().cardinality(),
this.completedPieces.cardinality(),
this.getAvailablePieces().cardinality(),
this.pieces.length
});
if (!peer.isChoked() &&
peer.isInteresting() &&
!peer.isDownloading()) {
this.handlePeerReady(peer);
}
} | java | @Override
public void handlePieceAvailability(SharingPeer peer, Piece piece) {
boolean isPeerInteresting = !this.completedPieces.get(piece.getIndex()) &&
!this.requestedPieces.get(piece.getIndex());
if (isPeerInteresting) {
peer.interesting();
}
piece.seenAt(peer);
logger.trace("Peer {} contributes {} piece(s) [{}/{}/{}].",
new Object[]{
peer,
peer.getAvailablePieces().cardinality(),
this.completedPieces.cardinality(),
this.getAvailablePieces().cardinality(),
this.pieces.length
});
if (!peer.isChoked() &&
peer.isInteresting() &&
!peer.isDownloading()) {
this.handlePeerReady(peer);
}
} | [
"@",
"Override",
"public",
"void",
"handlePieceAvailability",
"(",
"SharingPeer",
"peer",
",",
"Piece",
"piece",
")",
"{",
"boolean",
"isPeerInteresting",
"=",
"!",
"this",
".",
"completedPieces",
".",
"get",
"(",
"piece",
".",
"getIndex",
"(",
")",
")",
"&&... | Piece availability handler.
<p/>
<p>
Handle updates in piece availability from a peer's HAVE message. When
this happens, we need to mark that piece as available from the peer.
</p>
@param peer The peer we got the update from.
@param piece The piece that became available. | [
"Piece",
"availability",
"handler",
".",
"<p",
"/",
">",
"<p",
">",
"Handle",
"updates",
"in",
"piece",
"availability",
"from",
"a",
"peer",
"s",
"HAVE",
"message",
".",
"When",
"this",
"happens",
"we",
"need",
"to",
"mark",
"that",
"piece",
"as",
"avail... | train | https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/ttorrent-client/src/main/java/com/turn/ttorrent/client/SharedTorrent.java#L556-L580 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.