repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/SequenceMixin.java | SequenceMixin.countGC | public static int countGC(Sequence<NucleotideCompound> sequence) {
"""
Returns the count of GC in the given sequence
@param sequence The {@link NucleotideCompound} {@link Sequence} to perform
the GC analysis on
@return The number of GC compounds in the sequence
"""
CompoundSet<NucleotideCompound> cs = sequence.getCompoundSet();
NucleotideCompound G = cs.getCompoundForString("G");
NucleotideCompound C = cs.getCompoundForString("C");
NucleotideCompound g = cs.getCompoundForString("g");
NucleotideCompound c = cs.getCompoundForString("c");
return countCompounds(sequence, G, C, g, c);
} | java | public static int countGC(Sequence<NucleotideCompound> sequence) {
CompoundSet<NucleotideCompound> cs = sequence.getCompoundSet();
NucleotideCompound G = cs.getCompoundForString("G");
NucleotideCompound C = cs.getCompoundForString("C");
NucleotideCompound g = cs.getCompoundForString("g");
NucleotideCompound c = cs.getCompoundForString("c");
return countCompounds(sequence, G, C, g, c);
} | [
"public",
"static",
"int",
"countGC",
"(",
"Sequence",
"<",
"NucleotideCompound",
">",
"sequence",
")",
"{",
"CompoundSet",
"<",
"NucleotideCompound",
">",
"cs",
"=",
"sequence",
".",
"getCompoundSet",
"(",
")",
";",
"NucleotideCompound",
"G",
"=",
"cs",
".",
"getCompoundForString",
"(",
"\"G\"",
")",
";",
"NucleotideCompound",
"C",
"=",
"cs",
".",
"getCompoundForString",
"(",
"\"C\"",
")",
";",
"NucleotideCompound",
"g",
"=",
"cs",
".",
"getCompoundForString",
"(",
"\"g\"",
")",
";",
"NucleotideCompound",
"c",
"=",
"cs",
".",
"getCompoundForString",
"(",
"\"c\"",
")",
";",
"return",
"countCompounds",
"(",
"sequence",
",",
"G",
",",
"C",
",",
"g",
",",
"c",
")",
";",
"}"
] | Returns the count of GC in the given sequence
@param sequence The {@link NucleotideCompound} {@link Sequence} to perform
the GC analysis on
@return The number of GC compounds in the sequence | [
"Returns",
"the",
"count",
"of",
"GC",
"in",
"the",
"given",
"sequence"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/SequenceMixin.java#L81-L88 |
google/j2objc | jre_emul/Classes/com/google/j2objc/net/IosHttpURLConnection.java | IosHttpURLConnection.secureConnectionException | static IOException secureConnectionException(String description) {
"""
Returns an SSLException if that class is linked into the application,
otherwise IOException.
"""
try {
Class<?> sslExceptionClass = Class.forName("javax.net.ssl.SSLException");
Constructor<?> constructor = sslExceptionClass.getConstructor(String.class);
return (IOException) constructor.newInstance(description);
} catch (ClassNotFoundException e) {
return new IOException(description);
} catch (Exception e) {
throw new AssertionError("unexpected exception", e);
}
} | java | static IOException secureConnectionException(String description) {
try {
Class<?> sslExceptionClass = Class.forName("javax.net.ssl.SSLException");
Constructor<?> constructor = sslExceptionClass.getConstructor(String.class);
return (IOException) constructor.newInstance(description);
} catch (ClassNotFoundException e) {
return new IOException(description);
} catch (Exception e) {
throw new AssertionError("unexpected exception", e);
}
} | [
"static",
"IOException",
"secureConnectionException",
"(",
"String",
"description",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"sslExceptionClass",
"=",
"Class",
".",
"forName",
"(",
"\"javax.net.ssl.SSLException\"",
")",
";",
"Constructor",
"<",
"?",
">",
"constructor",
"=",
"sslExceptionClass",
".",
"getConstructor",
"(",
"String",
".",
"class",
")",
";",
"return",
"(",
"IOException",
")",
"constructor",
".",
"newInstance",
"(",
"description",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"return",
"new",
"IOException",
"(",
"description",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"\"unexpected exception\"",
",",
"e",
")",
";",
"}",
"}"
] | Returns an SSLException if that class is linked into the application,
otherwise IOException. | [
"Returns",
"an",
"SSLException",
"if",
"that",
"class",
"is",
"linked",
"into",
"the",
"application",
"otherwise",
"IOException",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/Classes/com/google/j2objc/net/IosHttpURLConnection.java#L759-L769 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/AbstractJcrExporter.java | AbstractJcrExporter.exportView | public void exportView( Node node,
OutputStream os,
boolean skipBinary,
boolean noRecurse ) throws IOException, RepositoryException {
"""
Exports <code>node</code> (or the subtree rooted at <code>node</code>) into an XML document that is written to
<code>os</code>.
@param node the node which should be exported. If <code>noRecursion</code> was set to <code>false</code> in the
constructor, the entire subtree rooted at <code>node</code> will be exported.
@param os the {@link OutputStream} to which the XML document will be written
@param skipBinary if <code>true</code>, indicates that binary properties should not be exported
@param noRecurse if<code>true</code>, indicates that only the given node should be exported, otherwise a recursive export
and not any of its child nodes.
@throws RepositoryException if an exception occurs accessing the content repository, generating the XML document, or
writing it to the output stream <code>os</code>.
@throws IOException if there is a problem writing to the supplied stream
"""
try {
exportView(node, new StreamingContentHandler(os, UNEXPORTABLE_NAMESPACES), skipBinary, noRecurse);
os.flush();
} catch (SAXException se) {
throw new RepositoryException(se);
}
} | java | public void exportView( Node node,
OutputStream os,
boolean skipBinary,
boolean noRecurse ) throws IOException, RepositoryException {
try {
exportView(node, new StreamingContentHandler(os, UNEXPORTABLE_NAMESPACES), skipBinary, noRecurse);
os.flush();
} catch (SAXException se) {
throw new RepositoryException(se);
}
} | [
"public",
"void",
"exportView",
"(",
"Node",
"node",
",",
"OutputStream",
"os",
",",
"boolean",
"skipBinary",
",",
"boolean",
"noRecurse",
")",
"throws",
"IOException",
",",
"RepositoryException",
"{",
"try",
"{",
"exportView",
"(",
"node",
",",
"new",
"StreamingContentHandler",
"(",
"os",
",",
"UNEXPORTABLE_NAMESPACES",
")",
",",
"skipBinary",
",",
"noRecurse",
")",
";",
"os",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"SAXException",
"se",
")",
"{",
"throw",
"new",
"RepositoryException",
"(",
"se",
")",
";",
"}",
"}"
] | Exports <code>node</code> (or the subtree rooted at <code>node</code>) into an XML document that is written to
<code>os</code>.
@param node the node which should be exported. If <code>noRecursion</code> was set to <code>false</code> in the
constructor, the entire subtree rooted at <code>node</code> will be exported.
@param os the {@link OutputStream} to which the XML document will be written
@param skipBinary if <code>true</code>, indicates that binary properties should not be exported
@param noRecurse if<code>true</code>, indicates that only the given node should be exported, otherwise a recursive export
and not any of its child nodes.
@throws RepositoryException if an exception occurs accessing the content repository, generating the XML document, or
writing it to the output stream <code>os</code>.
@throws IOException if there is a problem writing to the supplied stream | [
"Exports",
"<code",
">",
"node<",
"/",
"code",
">",
"(",
"or",
"the",
"subtree",
"rooted",
"at",
"<code",
">",
"node<",
"/",
"code",
">",
")",
"into",
"an",
"XML",
"document",
"that",
"is",
"written",
"to",
"<code",
">",
"os<",
"/",
"code",
">",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/AbstractJcrExporter.java#L195-L205 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIO.java | StructureIO.getBiologicalAssembly | public static Structure getBiologicalAssembly(String pdbId, int biolAssemblyNr) throws IOException, StructureException {
"""
Returns the biological assembly for the given PDB id and bioassembly identifier,
using multiModel={@value AtomCache#DEFAULT_BIOASSEMBLY_STYLE}
@param pdbId
@param biolAssemblyNr - the ith biological assembly that is available for a PDB ID (we start counting at 1, 0 represents the asym unit).
@return a Structure object or null if that assembly is not available
@throws StructureException if there is no bioassembly available for given biolAssemblyNr or some other problems encountered while loading it
@throws IOException
"""
return getBiologicalAssembly(pdbId, biolAssemblyNr, AtomCache.DEFAULT_BIOASSEMBLY_STYLE);
} | java | public static Structure getBiologicalAssembly(String pdbId, int biolAssemblyNr) throws IOException, StructureException {
return getBiologicalAssembly(pdbId, biolAssemblyNr, AtomCache.DEFAULT_BIOASSEMBLY_STYLE);
} | [
"public",
"static",
"Structure",
"getBiologicalAssembly",
"(",
"String",
"pdbId",
",",
"int",
"biolAssemblyNr",
")",
"throws",
"IOException",
",",
"StructureException",
"{",
"return",
"getBiologicalAssembly",
"(",
"pdbId",
",",
"biolAssemblyNr",
",",
"AtomCache",
".",
"DEFAULT_BIOASSEMBLY_STYLE",
")",
";",
"}"
] | Returns the biological assembly for the given PDB id and bioassembly identifier,
using multiModel={@value AtomCache#DEFAULT_BIOASSEMBLY_STYLE}
@param pdbId
@param biolAssemblyNr - the ith biological assembly that is available for a PDB ID (we start counting at 1, 0 represents the asym unit).
@return a Structure object or null if that assembly is not available
@throws StructureException if there is no bioassembly available for given biolAssemblyNr or some other problems encountered while loading it
@throws IOException | [
"Returns",
"the",
"biological",
"assembly",
"for",
"the",
"given",
"PDB",
"id",
"and",
"bioassembly",
"identifier",
"using",
"multiModel",
"=",
"{"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIO.java#L216-L218 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java | InstanceFailoverGroupsInner.deleteAsync | public Observable<Void> deleteAsync(String resourceGroupName, String locationName, String failoverGroupName) {
"""
Deletes a failover group.
@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 locationName The name of the region where the resource is located.
@param failoverGroupName The name of the failover group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> deleteAsync(String resourceGroupName, String locationName, String failoverGroupName) {
return deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"deleteAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"locationName",
",",
"String",
"failoverGroupName",
")",
"{",
"return",
"deleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"locationName",
",",
"failoverGroupName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Void",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponse",
"<",
"Void",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Deletes a failover group.
@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 locationName The name of the region where the resource is located.
@param failoverGroupName The name of the failover group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Deletes",
"a",
"failover",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java#L428-L435 |
ralscha/extdirectspring | src/main/java/ch/ralscha/extdirectspring/util/JsonHandler.java | JsonHandler.convertValue | public <T> T convertValue(Object object, JavaType toValueTypeRef) {
"""
Converts one object into another.
@param object the source
@param toValueTypeRef the type of the target
@return the converted object
"""
return this.mapper.convertValue(object, toValueTypeRef);
} | java | public <T> T convertValue(Object object, JavaType toValueTypeRef) {
return this.mapper.convertValue(object, toValueTypeRef);
} | [
"public",
"<",
"T",
">",
"T",
"convertValue",
"(",
"Object",
"object",
",",
"JavaType",
"toValueTypeRef",
")",
"{",
"return",
"this",
".",
"mapper",
".",
"convertValue",
"(",
"object",
",",
"toValueTypeRef",
")",
";",
"}"
] | Converts one object into another.
@param object the source
@param toValueTypeRef the type of the target
@return the converted object | [
"Converts",
"one",
"object",
"into",
"another",
"."
] | train | https://github.com/ralscha/extdirectspring/blob/4b018497c4e7503033f91d0491b4e74bf8291d2c/src/main/java/ch/ralscha/extdirectspring/util/JsonHandler.java#L170-L172 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/V1InstanceGetter.java | V1InstanceGetter.effortRecords | public Collection<Effort> effortRecords(EffortFilter filter) {
"""
Get effort records filtered by the criteria specified in the passed in
filter.
@param filter Limit the items returned. If null, then all items returned.
@return Collection of items as specified in the filter.
"""
return get(Effort.class, (filter != null) ? filter : new EffortFilter());
} | java | public Collection<Effort> effortRecords(EffortFilter filter) {
return get(Effort.class, (filter != null) ? filter : new EffortFilter());
} | [
"public",
"Collection",
"<",
"Effort",
">",
"effortRecords",
"(",
"EffortFilter",
"filter",
")",
"{",
"return",
"get",
"(",
"Effort",
".",
"class",
",",
"(",
"filter",
"!=",
"null",
")",
"?",
"filter",
":",
"new",
"EffortFilter",
"(",
")",
")",
";",
"}"
] | Get effort records filtered by the criteria specified in the passed in
filter.
@param filter Limit the items returned. If null, then all items returned.
@return Collection of items as specified in the filter. | [
"Get",
"effort",
"records",
"filtered",
"by",
"the",
"criteria",
"specified",
"in",
"the",
"passed",
"in",
"filter",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L88-L90 |
opentelecoms-org/zrtp-java | src/zorg/platform/blackberry/DHSuite.java | DHSuite.setAlgorithm | public void setAlgorithm(KeyAgreementType dh) {
"""
DH3K RIM implementation is currently buggy and DOES NOT WORK!!!
"""
log("DH algorithm set: " + getDHName(dhMode) + " -> " + getDHName(dh));
try {
if(dhMode != null && dh.keyType == dhMode.keyType) return;
dhMode = dh;
switch (dhMode.keyType) {
case KeyAgreementType.DH_MODE_DH3K:
byte[] dhGen = new byte[384];
Arrays.zero(dhGen);
dhGen[383] = 0x02;
dhSystem = new DHCryptoSystem(DH_PRIME, dhGen);
dhKeyPair = dhSystem.createDHKeyPair();
clearEcdh();
break;
case KeyAgreementType.DH_MODE_EC25:
ecSystem = new ECCryptoSystem(ECCryptoSystem.EC256R1);
ecKeyPair = ecSystem.createECKeyPair();
clearDh();
break;
case KeyAgreementType.DH_MODE_EC38:
default:
ecSystem = new ECCryptoSystem(ECCryptoSystem.EC384R1);
ecKeyPair = ecSystem.createECKeyPair();
clearDh();
break;
}
} catch (InvalidCryptoSystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedCryptoSystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CryptoTokenException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CryptoUnsupportedOperationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} | java | public void setAlgorithm(KeyAgreementType dh)
{
log("DH algorithm set: " + getDHName(dhMode) + " -> " + getDHName(dh));
try {
if(dhMode != null && dh.keyType == dhMode.keyType) return;
dhMode = dh;
switch (dhMode.keyType) {
case KeyAgreementType.DH_MODE_DH3K:
byte[] dhGen = new byte[384];
Arrays.zero(dhGen);
dhGen[383] = 0x02;
dhSystem = new DHCryptoSystem(DH_PRIME, dhGen);
dhKeyPair = dhSystem.createDHKeyPair();
clearEcdh();
break;
case KeyAgreementType.DH_MODE_EC25:
ecSystem = new ECCryptoSystem(ECCryptoSystem.EC256R1);
ecKeyPair = ecSystem.createECKeyPair();
clearDh();
break;
case KeyAgreementType.DH_MODE_EC38:
default:
ecSystem = new ECCryptoSystem(ECCryptoSystem.EC384R1);
ecKeyPair = ecSystem.createECKeyPair();
clearDh();
break;
}
} catch (InvalidCryptoSystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedCryptoSystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CryptoTokenException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CryptoUnsupportedOperationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} | [
"public",
"void",
"setAlgorithm",
"(",
"KeyAgreementType",
"dh",
")",
"{",
"log",
"(",
"\"DH algorithm set: \"",
"+",
"getDHName",
"(",
"dhMode",
")",
"+",
"\" -> \"",
"+",
"getDHName",
"(",
"dh",
")",
")",
";",
"try",
"{",
"if",
"(",
"dhMode",
"!=",
"null",
"&&",
"dh",
".",
"keyType",
"==",
"dhMode",
".",
"keyType",
")",
"return",
";",
"dhMode",
"=",
"dh",
";",
"switch",
"(",
"dhMode",
".",
"keyType",
")",
"{",
"case",
"KeyAgreementType",
".",
"DH_MODE_DH3K",
":",
"byte",
"[",
"]",
"dhGen",
"=",
"new",
"byte",
"[",
"384",
"]",
";",
"Arrays",
".",
"zero",
"(",
"dhGen",
")",
";",
"dhGen",
"[",
"383",
"]",
"=",
"0x02",
";",
"dhSystem",
"=",
"new",
"DHCryptoSystem",
"(",
"DH_PRIME",
",",
"dhGen",
")",
";",
"dhKeyPair",
"=",
"dhSystem",
".",
"createDHKeyPair",
"(",
")",
";",
"clearEcdh",
"(",
")",
";",
"break",
";",
"case",
"KeyAgreementType",
".",
"DH_MODE_EC25",
":",
"ecSystem",
"=",
"new",
"ECCryptoSystem",
"(",
"ECCryptoSystem",
".",
"EC256R1",
")",
";",
"ecKeyPair",
"=",
"ecSystem",
".",
"createECKeyPair",
"(",
")",
";",
"clearDh",
"(",
")",
";",
"break",
";",
"case",
"KeyAgreementType",
".",
"DH_MODE_EC38",
":",
"default",
":",
"ecSystem",
"=",
"new",
"ECCryptoSystem",
"(",
"ECCryptoSystem",
".",
"EC384R1",
")",
";",
"ecKeyPair",
"=",
"ecSystem",
".",
"createECKeyPair",
"(",
")",
";",
"clearDh",
"(",
")",
";",
"break",
";",
"}",
"}",
"catch",
"(",
"InvalidCryptoSystemException",
"e",
")",
"{",
"// TODO Auto-generated catch block\r",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"catch",
"(",
"UnsupportedCryptoSystemException",
"e",
")",
"{",
"// TODO Auto-generated catch block\r",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"catch",
"(",
"CryptoTokenException",
"e",
")",
"{",
"// TODO Auto-generated catch block\r",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"catch",
"(",
"CryptoUnsupportedOperationException",
"e",
")",
"{",
"// TODO Auto-generated catch block\r",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | DH3K RIM implementation is currently buggy and DOES NOT WORK!!! | [
"DH3K",
"RIM",
"implementation",
"is",
"currently",
"buggy",
"and",
"DOES",
"NOT",
"WORK!!!"
] | train | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/platform/blackberry/DHSuite.java#L133-L173 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/jaas/JAASServiceImpl.java | JAASServiceImpl.performLogin | @Override
public Subject performLogin(String jaasEntryName, CallbackHandler callbackHandler, Subject partialSubject) throws LoginException {
"""
Performs a JAAS login.
@param jaasEntryName
@param callbackHandler
@param partialSubject
@return the authenticated subject.
@throws javax.security.auth.login.LoginException
"""
LoginContext loginContext = null;
loginContext = doLoginContext(jaasEntryName, callbackHandler, partialSubject);
return (loginContext == null ? null : loginContext.getSubject());
} | java | @Override
public Subject performLogin(String jaasEntryName, CallbackHandler callbackHandler, Subject partialSubject) throws LoginException {
LoginContext loginContext = null;
loginContext = doLoginContext(jaasEntryName, callbackHandler, partialSubject);
return (loginContext == null ? null : loginContext.getSubject());
} | [
"@",
"Override",
"public",
"Subject",
"performLogin",
"(",
"String",
"jaasEntryName",
",",
"CallbackHandler",
"callbackHandler",
",",
"Subject",
"partialSubject",
")",
"throws",
"LoginException",
"{",
"LoginContext",
"loginContext",
"=",
"null",
";",
"loginContext",
"=",
"doLoginContext",
"(",
"jaasEntryName",
",",
"callbackHandler",
",",
"partialSubject",
")",
";",
"return",
"(",
"loginContext",
"==",
"null",
"?",
"null",
":",
"loginContext",
".",
"getSubject",
"(",
")",
")",
";",
"}"
] | Performs a JAAS login.
@param jaasEntryName
@param callbackHandler
@param partialSubject
@return the authenticated subject.
@throws javax.security.auth.login.LoginException | [
"Performs",
"a",
"JAAS",
"login",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/jaas/JAASServiceImpl.java#L326-L331 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/MethodAnnotation.java | MethodAnnotation.fromCalledMethod | public static MethodAnnotation fromCalledMethod(String className, String methodName, String methodSig, boolean isStatic) {
"""
Create a MethodAnnotation from a method that is not directly accessible.
We will use the repository to try to find its class in order to populate
the information as fully as possible.
@param className
class containing called method
@param methodName
name of called method
@param methodSig
signature of called method
@param isStatic
true if called method is static
@return the MethodAnnotation for the called method
"""
MethodAnnotation methodAnnotation = fromForeignMethod(className, methodName, methodSig, isStatic);
methodAnnotation.setDescription(METHOD_CALLED);
return methodAnnotation;
} | java | public static MethodAnnotation fromCalledMethod(String className, String methodName, String methodSig, boolean isStatic) {
MethodAnnotation methodAnnotation = fromForeignMethod(className, methodName, methodSig, isStatic);
methodAnnotation.setDescription(METHOD_CALLED);
return methodAnnotation;
} | [
"public",
"static",
"MethodAnnotation",
"fromCalledMethod",
"(",
"String",
"className",
",",
"String",
"methodName",
",",
"String",
"methodSig",
",",
"boolean",
"isStatic",
")",
"{",
"MethodAnnotation",
"methodAnnotation",
"=",
"fromForeignMethod",
"(",
"className",
",",
"methodName",
",",
"methodSig",
",",
"isStatic",
")",
";",
"methodAnnotation",
".",
"setDescription",
"(",
"METHOD_CALLED",
")",
";",
"return",
"methodAnnotation",
";",
"}"
] | Create a MethodAnnotation from a method that is not directly accessible.
We will use the repository to try to find its class in order to populate
the information as fully as possible.
@param className
class containing called method
@param methodName
name of called method
@param methodSig
signature of called method
@param isStatic
true if called method is static
@return the MethodAnnotation for the called method | [
"Create",
"a",
"MethodAnnotation",
"from",
"a",
"method",
"that",
"is",
"not",
"directly",
"accessible",
".",
"We",
"will",
"use",
"the",
"repository",
"to",
"try",
"to",
"find",
"its",
"class",
"in",
"order",
"to",
"populate",
"the",
"information",
"as",
"fully",
"as",
"possible",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/MethodAnnotation.java#L247-L253 |
haifengl/smile | plot/src/main/java/smile/swing/AlphaIcon.java | AlphaIcon.paintIcon | @Override
public void paintIcon(Component c, Graphics g, int x, int y) {
"""
Paints the wrapped icon with this
<CODE>AlphaIcon</CODE>'s transparency.
@param c The component to which the icon is painted
@param g the graphics context
@param x the X coordinate of the icon's top-left corner
@param y the Y coordinate of the icon's top-left corner
"""
Graphics2D g2 = (Graphics2D) g.create();
g2.setComposite(AlphaComposite.SrcAtop.derive(alpha));
icon.paintIcon(c, g2, x, y);
g2.dispose();
} | java | @Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g.create();
g2.setComposite(AlphaComposite.SrcAtop.derive(alpha));
icon.paintIcon(c, g2, x, y);
g2.dispose();
} | [
"@",
"Override",
"public",
"void",
"paintIcon",
"(",
"Component",
"c",
",",
"Graphics",
"g",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"Graphics2D",
"g2",
"=",
"(",
"Graphics2D",
")",
"g",
".",
"create",
"(",
")",
";",
"g2",
".",
"setComposite",
"(",
"AlphaComposite",
".",
"SrcAtop",
".",
"derive",
"(",
"alpha",
")",
")",
";",
"icon",
".",
"paintIcon",
"(",
"c",
",",
"g2",
",",
"x",
",",
"y",
")",
";",
"g2",
".",
"dispose",
"(",
")",
";",
"}"
] | Paints the wrapped icon with this
<CODE>AlphaIcon</CODE>'s transparency.
@param c The component to which the icon is painted
@param g the graphics context
@param x the X coordinate of the icon's top-left corner
@param y the Y coordinate of the icon's top-left corner | [
"Paints",
"the",
"wrapped",
"icon",
"with",
"this",
"<CODE",
">",
"AlphaIcon<",
"/",
"CODE",
">",
"s",
"transparency",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/swing/AlphaIcon.java#L78-L84 |
dita-ot/dita-ot | src/main/plugins/org.dita.pdf2/src/com/idiominc/ws/opentopic/fo/index2/IndexPreprocessor.java | IndexPreprocessor.createElement | private Element createElement(final Document theTargetDocument, final String theName) {
"""
Creates element with "prefix" in "namespace_url" with given name for the target document
@param theTargetDocument target document
@param theName name
@return new element
"""
final Element indexEntryNode = theTargetDocument.createElementNS(this.namespace_url, theName);
indexEntryNode.setPrefix(this.prefix);
return indexEntryNode;
} | java | private Element createElement(final Document theTargetDocument, final String theName) {
final Element indexEntryNode = theTargetDocument.createElementNS(this.namespace_url, theName);
indexEntryNode.setPrefix(this.prefix);
return indexEntryNode;
} | [
"private",
"Element",
"createElement",
"(",
"final",
"Document",
"theTargetDocument",
",",
"final",
"String",
"theName",
")",
"{",
"final",
"Element",
"indexEntryNode",
"=",
"theTargetDocument",
".",
"createElementNS",
"(",
"this",
".",
"namespace_url",
",",
"theName",
")",
";",
"indexEntryNode",
".",
"setPrefix",
"(",
"this",
".",
"prefix",
")",
";",
"return",
"indexEntryNode",
";",
"}"
] | Creates element with "prefix" in "namespace_url" with given name for the target document
@param theTargetDocument target document
@param theName name
@return new element | [
"Creates",
"element",
"with",
"prefix",
"in",
"namespace_url",
"with",
"given",
"name",
"for",
"the",
"target",
"document"
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/plugins/org.dita.pdf2/src/com/idiominc/ws/opentopic/fo/index2/IndexPreprocessor.java#L388-L392 |
GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryConfiguration.java | BigQueryConfiguration.getTemporaryPathRoot | public static String getTemporaryPathRoot(Configuration conf, @Nullable JobID jobId)
throws IOException {
"""
Resolves to provided {@link #TEMP_GCS_PATH_KEY} or fallbacks to a temporary path based on
{@link #GCS_BUCKET_KEY} and {@code jobId}.
@param conf the configuration to fetch the keys from.
@param jobId the ID of the job requesting a working path. Optional (could be {@code null}) if
{@link #TEMP_GCS_PATH_KEY} is provided.
@return the temporary directory path.
@throws IOException if the file system of the derived working path isn't a derivative of
GoogleHadoopFileSystemBase.
"""
// Try using the temporary gcs path.
String pathRoot = conf.get(BigQueryConfiguration.TEMP_GCS_PATH_KEY);
if (Strings.isNullOrEmpty(pathRoot)) {
checkNotNull(jobId, "jobId is required if '%s' is not set", TEMP_GCS_PATH_KEY);
logger.atInfo().log(
"Fetching key '%s' since '%s' isn't set explicitly.", GCS_BUCKET_KEY, TEMP_GCS_PATH_KEY);
String gcsBucket = conf.get(GCS_BUCKET_KEY);
if (Strings.isNullOrEmpty(gcsBucket)) {
throw new IOException("Must supply a value for configuration setting: " + GCS_BUCKET_KEY);
}
pathRoot = String.format("gs://%s/hadoop/tmp/bigquery/%s", gcsBucket, jobId);
}
logger.atInfo().log("Using working path: '%s'", pathRoot);
Path workingPath = new Path(pathRoot);
FileSystem fs = workingPath.getFileSystem(conf);
Preconditions.checkState(
fs instanceof GoogleHadoopFileSystemBase,
"Export FS must derive from GoogleHadoopFileSystemBase.");
return pathRoot;
} | java | public static String getTemporaryPathRoot(Configuration conf, @Nullable JobID jobId)
throws IOException {
// Try using the temporary gcs path.
String pathRoot = conf.get(BigQueryConfiguration.TEMP_GCS_PATH_KEY);
if (Strings.isNullOrEmpty(pathRoot)) {
checkNotNull(jobId, "jobId is required if '%s' is not set", TEMP_GCS_PATH_KEY);
logger.atInfo().log(
"Fetching key '%s' since '%s' isn't set explicitly.", GCS_BUCKET_KEY, TEMP_GCS_PATH_KEY);
String gcsBucket = conf.get(GCS_BUCKET_KEY);
if (Strings.isNullOrEmpty(gcsBucket)) {
throw new IOException("Must supply a value for configuration setting: " + GCS_BUCKET_KEY);
}
pathRoot = String.format("gs://%s/hadoop/tmp/bigquery/%s", gcsBucket, jobId);
}
logger.atInfo().log("Using working path: '%s'", pathRoot);
Path workingPath = new Path(pathRoot);
FileSystem fs = workingPath.getFileSystem(conf);
Preconditions.checkState(
fs instanceof GoogleHadoopFileSystemBase,
"Export FS must derive from GoogleHadoopFileSystemBase.");
return pathRoot;
} | [
"public",
"static",
"String",
"getTemporaryPathRoot",
"(",
"Configuration",
"conf",
",",
"@",
"Nullable",
"JobID",
"jobId",
")",
"throws",
"IOException",
"{",
"// Try using the temporary gcs path.",
"String",
"pathRoot",
"=",
"conf",
".",
"get",
"(",
"BigQueryConfiguration",
".",
"TEMP_GCS_PATH_KEY",
")",
";",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"pathRoot",
")",
")",
"{",
"checkNotNull",
"(",
"jobId",
",",
"\"jobId is required if '%s' is not set\"",
",",
"TEMP_GCS_PATH_KEY",
")",
";",
"logger",
".",
"atInfo",
"(",
")",
".",
"log",
"(",
"\"Fetching key '%s' since '%s' isn't set explicitly.\"",
",",
"GCS_BUCKET_KEY",
",",
"TEMP_GCS_PATH_KEY",
")",
";",
"String",
"gcsBucket",
"=",
"conf",
".",
"get",
"(",
"GCS_BUCKET_KEY",
")",
";",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"gcsBucket",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Must supply a value for configuration setting: \"",
"+",
"GCS_BUCKET_KEY",
")",
";",
"}",
"pathRoot",
"=",
"String",
".",
"format",
"(",
"\"gs://%s/hadoop/tmp/bigquery/%s\"",
",",
"gcsBucket",
",",
"jobId",
")",
";",
"}",
"logger",
".",
"atInfo",
"(",
")",
".",
"log",
"(",
"\"Using working path: '%s'\"",
",",
"pathRoot",
")",
";",
"Path",
"workingPath",
"=",
"new",
"Path",
"(",
"pathRoot",
")",
";",
"FileSystem",
"fs",
"=",
"workingPath",
".",
"getFileSystem",
"(",
"conf",
")",
";",
"Preconditions",
".",
"checkState",
"(",
"fs",
"instanceof",
"GoogleHadoopFileSystemBase",
",",
"\"Export FS must derive from GoogleHadoopFileSystemBase.\"",
")",
";",
"return",
"pathRoot",
";",
"}"
] | Resolves to provided {@link #TEMP_GCS_PATH_KEY} or fallbacks to a temporary path based on
{@link #GCS_BUCKET_KEY} and {@code jobId}.
@param conf the configuration to fetch the keys from.
@param jobId the ID of the job requesting a working path. Optional (could be {@code null}) if
{@link #TEMP_GCS_PATH_KEY} is provided.
@return the temporary directory path.
@throws IOException if the file system of the derived working path isn't a derivative of
GoogleHadoopFileSystemBase. | [
"Resolves",
"to",
"provided",
"{",
"@link",
"#TEMP_GCS_PATH_KEY",
"}",
"or",
"fallbacks",
"to",
"a",
"temporary",
"path",
"based",
"on",
"{",
"@link",
"#GCS_BUCKET_KEY",
"}",
"and",
"{",
"@code",
"jobId",
"}",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryConfiguration.java#L310-L336 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java | ToUnknownStream.endElement | public void endElement(String namespaceURI, String localName, String qName)
throws SAXException {
"""
Pass the call on to the underlying handler
@see org.xml.sax.ContentHandler#endElement(String, String, String)
"""
if (m_firstTagNotEmitted)
{
flush();
if (namespaceURI == null && m_firstElementURI != null)
namespaceURI = m_firstElementURI;
if (localName == null && m_firstElementLocalName != null)
localName = m_firstElementLocalName;
}
m_handler.endElement(namespaceURI, localName, qName);
} | java | public void endElement(String namespaceURI, String localName, String qName)
throws SAXException
{
if (m_firstTagNotEmitted)
{
flush();
if (namespaceURI == null && m_firstElementURI != null)
namespaceURI = m_firstElementURI;
if (localName == null && m_firstElementLocalName != null)
localName = m_firstElementLocalName;
}
m_handler.endElement(namespaceURI, localName, qName);
} | [
"public",
"void",
"endElement",
"(",
"String",
"namespaceURI",
",",
"String",
"localName",
",",
"String",
"qName",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"m_firstTagNotEmitted",
")",
"{",
"flush",
"(",
")",
";",
"if",
"(",
"namespaceURI",
"==",
"null",
"&&",
"m_firstElementURI",
"!=",
"null",
")",
"namespaceURI",
"=",
"m_firstElementURI",
";",
"if",
"(",
"localName",
"==",
"null",
"&&",
"m_firstElementLocalName",
"!=",
"null",
")",
"localName",
"=",
"m_firstElementLocalName",
";",
"}",
"m_handler",
".",
"endElement",
"(",
"namespaceURI",
",",
"localName",
",",
"qName",
")",
";",
"}"
] | Pass the call on to the underlying handler
@see org.xml.sax.ContentHandler#endElement(String, String, String) | [
"Pass",
"the",
"call",
"on",
"to",
"the",
"underlying",
"handler"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java#L809-L824 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/WikisApi.java | WikisApi.updatePage | public WikiPage updatePage(Object projectIdOrPath, String slug, String title, String content) throws GitLabApiException {
"""
Updates an existing project wiki page. The user must have permission to change an existing wiki page.
<pre><code>GitLab Endpoint: PUT /projects/:id/wikis/:slug</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param slug the slug of the project's wiki page, required
@param title the title of a snippet, optional
@param content the content of a page, optional. Either title or content must be supplied.
@return a WikiPage instance with info on the updated page
@throws GitLabApiException if any exception occurs
"""
GitLabApiForm formData = new GitLabApiForm()
.withParam("title", title)
.withParam("slug", slug, true)
.withParam("content", content);
Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "wikis", slug);
return (response.readEntity(WikiPage.class));
} | java | public WikiPage updatePage(Object projectIdOrPath, String slug, String title, String content) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("title", title)
.withParam("slug", slug, true)
.withParam("content", content);
Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "wikis", slug);
return (response.readEntity(WikiPage.class));
} | [
"public",
"WikiPage",
"updatePage",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"slug",
",",
"String",
"title",
",",
"String",
"content",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\"title\"",
",",
"title",
")",
".",
"withParam",
"(",
"\"slug\"",
",",
"slug",
",",
"true",
")",
".",
"withParam",
"(",
"\"content\"",
",",
"content",
")",
";",
"Response",
"response",
"=",
"put",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
"formData",
".",
"asMap",
"(",
")",
",",
"\"projects\"",
",",
"getProjectIdOrPath",
"(",
"projectIdOrPath",
")",
",",
"\"wikis\"",
",",
"slug",
")",
";",
"return",
"(",
"response",
".",
"readEntity",
"(",
"WikiPage",
".",
"class",
")",
")",
";",
"}"
] | Updates an existing project wiki page. The user must have permission to change an existing wiki page.
<pre><code>GitLab Endpoint: PUT /projects/:id/wikis/:slug</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param slug the slug of the project's wiki page, required
@param title the title of a snippet, optional
@param content the content of a page, optional. Either title or content must be supplied.
@return a WikiPage instance with info on the updated page
@throws GitLabApiException if any exception occurs | [
"Updates",
"an",
"existing",
"project",
"wiki",
"page",
".",
"The",
"user",
"must",
"have",
"permission",
"to",
"change",
"an",
"existing",
"wiki",
"page",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/WikisApi.java#L146-L155 |
forge/furnace | container-api/src/main/java/org/jboss/forge/furnace/util/ClassLoaders.java | ClassLoaders.executeIn | public static void executeIn(ClassLoader loader, Runnable task) throws Exception {
"""
Execute the given {@link Runnable} in the {@link ClassLoader} provided. Return the result, if any.
"""
if (task == null)
return;
if (log.isLoggable(Level.FINE))
{
log.fine("ClassLoader [" + loader + "] task began.");
}
ClassLoader original = SecurityActions.getContextClassLoader();
try
{
SecurityActions.setContextClassLoader(loader);
task.run();
}
finally
{
SecurityActions.setContextClassLoader(original);
if (log.isLoggable(Level.FINE))
{
log.fine("ClassLoader [" + loader + "] task ended.");
}
}
} | java | public static void executeIn(ClassLoader loader, Runnable task) throws Exception
{
if (task == null)
return;
if (log.isLoggable(Level.FINE))
{
log.fine("ClassLoader [" + loader + "] task began.");
}
ClassLoader original = SecurityActions.getContextClassLoader();
try
{
SecurityActions.setContextClassLoader(loader);
task.run();
}
finally
{
SecurityActions.setContextClassLoader(original);
if (log.isLoggable(Level.FINE))
{
log.fine("ClassLoader [" + loader + "] task ended.");
}
}
} | [
"public",
"static",
"void",
"executeIn",
"(",
"ClassLoader",
"loader",
",",
"Runnable",
"task",
")",
"throws",
"Exception",
"{",
"if",
"(",
"task",
"==",
"null",
")",
"return",
";",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"log",
".",
"fine",
"(",
"\"ClassLoader [\"",
"+",
"loader",
"+",
"\"] task began.\"",
")",
";",
"}",
"ClassLoader",
"original",
"=",
"SecurityActions",
".",
"getContextClassLoader",
"(",
")",
";",
"try",
"{",
"SecurityActions",
".",
"setContextClassLoader",
"(",
"loader",
")",
";",
"task",
".",
"run",
"(",
")",
";",
"}",
"finally",
"{",
"SecurityActions",
".",
"setContextClassLoader",
"(",
"original",
")",
";",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"log",
".",
"fine",
"(",
"\"ClassLoader [\"",
"+",
"loader",
"+",
"\"] task ended.\"",
")",
";",
"}",
"}",
"}"
] | Execute the given {@link Runnable} in the {@link ClassLoader} provided. Return the result, if any. | [
"Execute",
"the",
"given",
"{"
] | train | https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/container-api/src/main/java/org/jboss/forge/furnace/util/ClassLoaders.java#L57-L80 |
trellis-ldp-archive/trellis-http | src/main/java/org/trellisldp/http/impl/MementoResource.java | MementoResource.getMementoLinks | public static Stream<Link> getMementoLinks(final String identifier, final List<VersionRange> mementos) {
"""
Retrieve all of the Memento-related link headers given a stream of VersionRange objects
@param identifier the public identifier for the resource
@param mementos a stream of memento values
@return a stream of link headers
"""
return concat(getTimeMap(identifier, mementos.stream()), mementos.stream().map(mementoToLink(identifier)));
} | java | public static Stream<Link> getMementoLinks(final String identifier, final List<VersionRange> mementos) {
return concat(getTimeMap(identifier, mementos.stream()), mementos.stream().map(mementoToLink(identifier)));
} | [
"public",
"static",
"Stream",
"<",
"Link",
">",
"getMementoLinks",
"(",
"final",
"String",
"identifier",
",",
"final",
"List",
"<",
"VersionRange",
">",
"mementos",
")",
"{",
"return",
"concat",
"(",
"getTimeMap",
"(",
"identifier",
",",
"mementos",
".",
"stream",
"(",
")",
")",
",",
"mementos",
".",
"stream",
"(",
")",
".",
"map",
"(",
"mementoToLink",
"(",
"identifier",
")",
")",
")",
";",
"}"
] | Retrieve all of the Memento-related link headers given a stream of VersionRange objects
@param identifier the public identifier for the resource
@param mementos a stream of memento values
@return a stream of link headers | [
"Retrieve",
"all",
"of",
"the",
"Memento",
"-",
"related",
"link",
"headers",
"given",
"a",
"stream",
"of",
"VersionRange",
"objects"
] | train | https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/impl/MementoResource.java#L185-L187 |
kiegroup/jbpm | jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/impl/QueryCriteriaUtil.java | QueryCriteriaUtil.applyMetaCriteriaToQuery | public static void applyMetaCriteriaToQuery(Query query, QueryWhere queryWhere) {
"""
Small method to apply the meta criteria from the {@link QueryWhere} instance to the {@link Query} instance
@param query The {@link Query} instance
@param queryWhere The {@link QueryWhere} instance, with the abstract information about the query
"""
if( queryWhere.getCount() != null ) {
query.setMaxResults(queryWhere.getCount());
}
if( queryWhere.getOffset() != null ) {
query.setFirstResult(queryWhere.getOffset());
}
} | java | public static void applyMetaCriteriaToQuery(Query query, QueryWhere queryWhere) {
if( queryWhere.getCount() != null ) {
query.setMaxResults(queryWhere.getCount());
}
if( queryWhere.getOffset() != null ) {
query.setFirstResult(queryWhere.getOffset());
}
} | [
"public",
"static",
"void",
"applyMetaCriteriaToQuery",
"(",
"Query",
"query",
",",
"QueryWhere",
"queryWhere",
")",
"{",
"if",
"(",
"queryWhere",
".",
"getCount",
"(",
")",
"!=",
"null",
")",
"{",
"query",
".",
"setMaxResults",
"(",
"queryWhere",
".",
"getCount",
"(",
")",
")",
";",
"}",
"if",
"(",
"queryWhere",
".",
"getOffset",
"(",
")",
"!=",
"null",
")",
"{",
"query",
".",
"setFirstResult",
"(",
"queryWhere",
".",
"getOffset",
"(",
")",
")",
";",
"}",
"}"
] | Small method to apply the meta criteria from the {@link QueryWhere} instance to the {@link Query} instance
@param query The {@link Query} instance
@param queryWhere The {@link QueryWhere} instance, with the abstract information about the query | [
"Small",
"method",
"to",
"apply",
"the",
"meta",
"criteria",
"from",
"the",
"{"
] | train | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/impl/QueryCriteriaUtil.java#L621-L628 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/comments/CommentsInterface.java | CommentsInterface.editComment | public void editComment(String commentId, String commentText) throws FlickrException {
"""
Edit the text of a comment as the currently authenticated user.
This method requires authentication with 'write' permission.
@param commentId
The id of the comment to edit.
@param commentText
Update the comment to this text.
@throws FlickrException
"""
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_EDIT_COMMENT);
parameters.put("comment_id", commentId);
parameters.put("comment_text", commentText);
// Note: This method requires an HTTP POST request.
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// This method has no specific response - It returns an empty
// sucess response if it completes without error.
} | java | public void editComment(String commentId, String commentText) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_EDIT_COMMENT);
parameters.put("comment_id", commentId);
parameters.put("comment_text", commentText);
// Note: This method requires an HTTP POST request.
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// This method has no specific response - It returns an empty
// sucess response if it completes without error.
} | [
"public",
"void",
"editComment",
"(",
"String",
"commentId",
",",
"String",
"commentText",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put",
"(",
"\"method\"",
",",
"METHOD_EDIT_COMMENT",
")",
";",
"parameters",
".",
"put",
"(",
"\"comment_id\"",
",",
"commentId",
")",
";",
"parameters",
".",
"put",
"(",
"\"comment_text\"",
",",
"commentText",
")",
";",
"// Note: This method requires an HTTP POST request.\r",
"Response",
"response",
"=",
"transportAPI",
".",
"post",
"(",
"transportAPI",
".",
"getPath",
"(",
")",
",",
"parameters",
",",
"apiKey",
",",
"sharedSecret",
")",
";",
"if",
"(",
"response",
".",
"isError",
"(",
")",
")",
"{",
"throw",
"new",
"FlickrException",
"(",
"response",
".",
"getErrorCode",
"(",
")",
",",
"response",
".",
"getErrorMessage",
"(",
")",
")",
";",
"}",
"// This method has no specific response - It returns an empty\r",
"// sucess response if it completes without error.\r",
"}"
] | Edit the text of a comment as the currently authenticated user.
This method requires authentication with 'write' permission.
@param commentId
The id of the comment to edit.
@param commentText
Update the comment to this text.
@throws FlickrException | [
"Edit",
"the",
"text",
"of",
"a",
"comment",
"as",
"the",
"currently",
"authenticated",
"user",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/comments/CommentsInterface.java#L115-L129 |
lucee/Lucee | core/src/main/java/lucee/runtime/reflection/storage/WeakConstructorStorage.java | WeakConstructorStorage.storeArgs | private void storeArgs(Constructor constructor, Array conArgs) {
"""
seperate and store the different arguments of one constructor
@param constructor
@param conArgs
"""
Class[] pmt = constructor.getParameterTypes();
Object o = conArgs.get(pmt.length + 1, null);
Constructor[] args;
if (o == null) {
args = new Constructor[1];
conArgs.setEL(pmt.length + 1, args);
}
else {
Constructor[] cs = (Constructor[]) o;
args = new Constructor[cs.length + 1];
for (int i = 0; i < cs.length; i++) {
args[i] = cs[i];
}
conArgs.setEL(pmt.length + 1, args);
}
args[args.length - 1] = constructor;
} | java | private void storeArgs(Constructor constructor, Array conArgs) {
Class[] pmt = constructor.getParameterTypes();
Object o = conArgs.get(pmt.length + 1, null);
Constructor[] args;
if (o == null) {
args = new Constructor[1];
conArgs.setEL(pmt.length + 1, args);
}
else {
Constructor[] cs = (Constructor[]) o;
args = new Constructor[cs.length + 1];
for (int i = 0; i < cs.length; i++) {
args[i] = cs[i];
}
conArgs.setEL(pmt.length + 1, args);
}
args[args.length - 1] = constructor;
} | [
"private",
"void",
"storeArgs",
"(",
"Constructor",
"constructor",
",",
"Array",
"conArgs",
")",
"{",
"Class",
"[",
"]",
"pmt",
"=",
"constructor",
".",
"getParameterTypes",
"(",
")",
";",
"Object",
"o",
"=",
"conArgs",
".",
"get",
"(",
"pmt",
".",
"length",
"+",
"1",
",",
"null",
")",
";",
"Constructor",
"[",
"]",
"args",
";",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"args",
"=",
"new",
"Constructor",
"[",
"1",
"]",
";",
"conArgs",
".",
"setEL",
"(",
"pmt",
".",
"length",
"+",
"1",
",",
"args",
")",
";",
"}",
"else",
"{",
"Constructor",
"[",
"]",
"cs",
"=",
"(",
"Constructor",
"[",
"]",
")",
"o",
";",
"args",
"=",
"new",
"Constructor",
"[",
"cs",
".",
"length",
"+",
"1",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cs",
".",
"length",
";",
"i",
"++",
")",
"{",
"args",
"[",
"i",
"]",
"=",
"cs",
"[",
"i",
"]",
";",
"}",
"conArgs",
".",
"setEL",
"(",
"pmt",
".",
"length",
"+",
"1",
",",
"args",
")",
";",
"}",
"args",
"[",
"args",
".",
"length",
"-",
"1",
"]",
"=",
"constructor",
";",
"}"
] | seperate and store the different arguments of one constructor
@param constructor
@param conArgs | [
"seperate",
"and",
"store",
"the",
"different",
"arguments",
"of",
"one",
"constructor"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/storage/WeakConstructorStorage.java#L78-L96 |
adamfisk/littleshoot-commons-id | src/main/java/org/apache/commons/id/uuid/VersionFourGenerator.java | VersionFourGenerator.setPRNGProvider | public static void setPRNGProvider(String prngName, String packageName) {
"""
<p>Allows clients to set the pseudo-random number generator implementation used when generating a version four uuid with
the secure option. The secure option uses a <code>SecureRandom</code>. The packageName string may be null to specify
no preferred package.</p>
@param prngName the pseudo-random number generator implementation name. For example "SHA1PRNG".
@param packageName the package name for the PRNG provider. For example "SUN".
"""
VersionFourGenerator.usePRNG = prngName;
VersionFourGenerator.usePRNGPackage = packageName;
VersionFourGenerator.secureRandom = null;
} | java | public static void setPRNGProvider(String prngName, String packageName) {
VersionFourGenerator.usePRNG = prngName;
VersionFourGenerator.usePRNGPackage = packageName;
VersionFourGenerator.secureRandom = null;
} | [
"public",
"static",
"void",
"setPRNGProvider",
"(",
"String",
"prngName",
",",
"String",
"packageName",
")",
"{",
"VersionFourGenerator",
".",
"usePRNG",
"=",
"prngName",
";",
"VersionFourGenerator",
".",
"usePRNGPackage",
"=",
"packageName",
";",
"VersionFourGenerator",
".",
"secureRandom",
"=",
"null",
";",
"}"
] | <p>Allows clients to set the pseudo-random number generator implementation used when generating a version four uuid with
the secure option. The secure option uses a <code>SecureRandom</code>. The packageName string may be null to specify
no preferred package.</p>
@param prngName the pseudo-random number generator implementation name. For example "SHA1PRNG".
@param packageName the package name for the PRNG provider. For example "SUN". | [
"<p",
">",
"Allows",
"clients",
"to",
"set",
"the",
"pseudo",
"-",
"random",
"number",
"generator",
"implementation",
"used",
"when",
"generating",
"a",
"version",
"four",
"uuid",
"with",
"the",
"secure",
"option",
".",
"The",
"secure",
"option",
"uses",
"a",
"<code",
">",
"SecureRandom<",
"/",
"code",
">",
".",
"The",
"packageName",
"string",
"may",
"be",
"null",
"to",
"specify",
"no",
"preferred",
"package",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/adamfisk/littleshoot-commons-id/blob/49a8f5f2b10831c509876ca463bf1a87e1e49ae9/src/main/java/org/apache/commons/id/uuid/VersionFourGenerator.java#L156-L160 |
biojava/biojava | biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java | Location.fromBioExt | public static Location fromBioExt( int start, int length, char strand, int totalLength ) {
"""
Create a location from MAF file coordinates, which represent negative
strand locations as the distance from the end of the sequence.
@param start Origin 1 index of first symbol.
@param length Number of symbols in range.
@param strand '+' or '-' or '.' ('.' is interpreted as '+').
@param totalLength Total number of symbols in sequence.
@throws IllegalArgumentException Strand must be '+', '-', '.'
"""
int s= start;
int e= s + length;
if( !( strand == '-' || strand == '+' || strand == '.' ))
{
throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" );
}
if( strand == '-' )
{
s= s - totalLength;
e= e - totalLength;
}
return new Location( s, e );
} | java | public static Location fromBioExt( int start, int length, char strand, int totalLength )
{
int s= start;
int e= s + length;
if( !( strand == '-' || strand == '+' || strand == '.' ))
{
throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" );
}
if( strand == '-' )
{
s= s - totalLength;
e= e - totalLength;
}
return new Location( s, e );
} | [
"public",
"static",
"Location",
"fromBioExt",
"(",
"int",
"start",
",",
"int",
"length",
",",
"char",
"strand",
",",
"int",
"totalLength",
")",
"{",
"int",
"s",
"=",
"start",
";",
"int",
"e",
"=",
"s",
"+",
"length",
";",
"if",
"(",
"!",
"(",
"strand",
"==",
"'",
"'",
"||",
"strand",
"==",
"'",
"'",
"||",
"strand",
"==",
"'",
"'",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Strand must be '+', '-', or '.'\"",
")",
";",
"}",
"if",
"(",
"strand",
"==",
"'",
"'",
")",
"{",
"s",
"=",
"s",
"-",
"totalLength",
";",
"e",
"=",
"e",
"-",
"totalLength",
";",
"}",
"return",
"new",
"Location",
"(",
"s",
",",
"e",
")",
";",
"}"
] | Create a location from MAF file coordinates, which represent negative
strand locations as the distance from the end of the sequence.
@param start Origin 1 index of first symbol.
@param length Number of symbols in range.
@param strand '+' or '-' or '.' ('.' is interpreted as '+').
@param totalLength Total number of symbols in sequence.
@throws IllegalArgumentException Strand must be '+', '-', '.' | [
"Create",
"a",
"location",
"from",
"MAF",
"file",
"coordinates",
"which",
"represent",
"negative",
"strand",
"locations",
"as",
"the",
"distance",
"from",
"the",
"end",
"of",
"the",
"sequence",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java#L164-L181 |
centic9/commons-dost | src/main/java/org/dstadler/commons/date/DateParser.java | DateParser.computeTimeAgoString | public static String computeTimeAgoString(long ts, String suffix) {
"""
Takes the time in milliseconds since the epoch and
converts it into a string of "x days/hours/minutes/seconds"
compared to the current time.
@param ts The timestamp in milliseconds since the epoch
@param suffix Some text that is appended only if there is a time-difference, i.e.
it is not appended when the time is now.
@return A readable string with a short description of how long ago the ts was.
"""
long now = System.currentTimeMillis();
checkArgument(ts <= now, "Cannot handle timestamp in the future" +
", now: " + now + "/" + new Date(now) +
", ts: " + ts + "/" + new Date(ts));
long diff = now - ts;
return timeToReadable(diff, suffix);
} | java | public static String computeTimeAgoString(long ts, String suffix) {
long now = System.currentTimeMillis();
checkArgument(ts <= now, "Cannot handle timestamp in the future" +
", now: " + now + "/" + new Date(now) +
", ts: " + ts + "/" + new Date(ts));
long diff = now - ts;
return timeToReadable(diff, suffix);
} | [
"public",
"static",
"String",
"computeTimeAgoString",
"(",
"long",
"ts",
",",
"String",
"suffix",
")",
"{",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"checkArgument",
"(",
"ts",
"<=",
"now",
",",
"\"Cannot handle timestamp in the future\"",
"+",
"\", now: \"",
"+",
"now",
"+",
"\"/\"",
"+",
"new",
"Date",
"(",
"now",
")",
"+",
"\", ts: \"",
"+",
"ts",
"+",
"\"/\"",
"+",
"new",
"Date",
"(",
"ts",
")",
")",
";",
"long",
"diff",
"=",
"now",
"-",
"ts",
";",
"return",
"timeToReadable",
"(",
"diff",
",",
"suffix",
")",
";",
"}"
] | Takes the time in milliseconds since the epoch and
converts it into a string of "x days/hours/minutes/seconds"
compared to the current time.
@param ts The timestamp in milliseconds since the epoch
@param suffix Some text that is appended only if there is a time-difference, i.e.
it is not appended when the time is now.
@return A readable string with a short description of how long ago the ts was. | [
"Takes",
"the",
"time",
"in",
"milliseconds",
"since",
"the",
"epoch",
"and",
"converts",
"it",
"into",
"a",
"string",
"of",
"x",
"days",
"/",
"hours",
"/",
"minutes",
"/",
"seconds",
"compared",
"to",
"the",
"current",
"time",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/date/DateParser.java#L168-L177 |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipFactoryImpl.java | SipFactoryImpl.validateCreation | private static void validateCreation(String method, SipApplicationSession app) {
"""
Does basic check for illegal methods, wrong state, if it finds, it throws
exception
"""
if (method.equals(Request.ACK)) {
throw new IllegalArgumentException(
"Wrong method to create request with[" + Request.ACK + "]!");
}
if (method.equals(Request.PRACK)) {
throw new IllegalArgumentException(
"Wrong method to create request with[" + Request.PRACK + "]!");
}
if (method.equals(Request.CANCEL)) {
throw new IllegalArgumentException(
"Wrong method to create request with[" + Request.CANCEL
+ "]!");
}
if (!((MobicentsSipApplicationSession)app).isValidInternal()) {
throw new IllegalArgumentException(
"Cant associate request with invalidaded sip session application!");
}
} | java | private static void validateCreation(String method, SipApplicationSession app) {
if (method.equals(Request.ACK)) {
throw new IllegalArgumentException(
"Wrong method to create request with[" + Request.ACK + "]!");
}
if (method.equals(Request.PRACK)) {
throw new IllegalArgumentException(
"Wrong method to create request with[" + Request.PRACK + "]!");
}
if (method.equals(Request.CANCEL)) {
throw new IllegalArgumentException(
"Wrong method to create request with[" + Request.CANCEL
+ "]!");
}
if (!((MobicentsSipApplicationSession)app).isValidInternal()) {
throw new IllegalArgumentException(
"Cant associate request with invalidaded sip session application!");
}
} | [
"private",
"static",
"void",
"validateCreation",
"(",
"String",
"method",
",",
"SipApplicationSession",
"app",
")",
"{",
"if",
"(",
"method",
".",
"equals",
"(",
"Request",
".",
"ACK",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Wrong method to create request with[\"",
"+",
"Request",
".",
"ACK",
"+",
"\"]!\"",
")",
";",
"}",
"if",
"(",
"method",
".",
"equals",
"(",
"Request",
".",
"PRACK",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Wrong method to create request with[\"",
"+",
"Request",
".",
"PRACK",
"+",
"\"]!\"",
")",
";",
"}",
"if",
"(",
"method",
".",
"equals",
"(",
"Request",
".",
"CANCEL",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Wrong method to create request with[\"",
"+",
"Request",
".",
"CANCEL",
"+",
"\"]!\"",
")",
";",
"}",
"if",
"(",
"!",
"(",
"(",
"MobicentsSipApplicationSession",
")",
"app",
")",
".",
"isValidInternal",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cant associate request with invalidaded sip session application!\"",
")",
";",
"}",
"}"
] | Does basic check for illegal methods, wrong state, if it finds, it throws
exception | [
"Does",
"basic",
"check",
"for",
"illegal",
"methods",
"wrong",
"state",
"if",
"it",
"finds",
"it",
"throws",
"exception"
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipFactoryImpl.java#L631-L651 |
uscexp/grappa.extension | src/main/java/com/github/uscexp/grappa/extension/interpreter/ProcessStore.java | ProcessStore.setLocalVariable | public boolean setLocalVariable(Object key, Object value) {
"""
set a new local variable, on the highest block hierarchy.
@param key
name of the variable
@param value
value of the variable
@return true if at least one local block hierarchy exists else false
"""
boolean success = false;
if (working.size() > 0) {
Map<Object, Object> map = working.get(working.size() - 1);
map.put(key, value);
success = true;
}
return success;
} | java | public boolean setLocalVariable(Object key, Object value) {
boolean success = false;
if (working.size() > 0) {
Map<Object, Object> map = working.get(working.size() - 1);
map.put(key, value);
success = true;
}
return success;
} | [
"public",
"boolean",
"setLocalVariable",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"boolean",
"success",
"=",
"false",
";",
"if",
"(",
"working",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"map",
"=",
"working",
".",
"get",
"(",
"working",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"map",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"success",
"=",
"true",
";",
"}",
"return",
"success",
";",
"}"
] | set a new local variable, on the highest block hierarchy.
@param key
name of the variable
@param value
value of the variable
@return true if at least one local block hierarchy exists else false | [
"set",
"a",
"new",
"local",
"variable",
"on",
"the",
"highest",
"block",
"hierarchy",
"."
] | train | https://github.com/uscexp/grappa.extension/blob/a6001eb6eee434a09e2870e7513f883c7fdaea94/src/main/java/com/github/uscexp/grappa/extension/interpreter/ProcessStore.java#L322-L331 |
cdk/cdk | tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomPlacer3D.java | AtomPlacer3D.getPlacedHeavyAtom | public IAtom getPlacedHeavyAtom(IAtomContainer molecule, IAtom atomA, IAtom atomB) {
"""
Gets the first placed Heavy Atom around atomA which is not atomB.
@param molecule
@param atomA Description of the Parameter
@param atomB Description of the Parameter
@return The placedHeavyAtom value
"""
List<IBond> bonds = molecule.getConnectedBondsList(atomA);
for (IBond bond : bonds) {
IAtom connectedAtom = bond.getOther(atomA);
if (isPlacedHeavyAtom(connectedAtom) && !connectedAtom.equals(atomB)) {
return connectedAtom;
}
}
return null;
} | java | public IAtom getPlacedHeavyAtom(IAtomContainer molecule, IAtom atomA, IAtom atomB) {
List<IBond> bonds = molecule.getConnectedBondsList(atomA);
for (IBond bond : bonds) {
IAtom connectedAtom = bond.getOther(atomA);
if (isPlacedHeavyAtom(connectedAtom) && !connectedAtom.equals(atomB)) {
return connectedAtom;
}
}
return null;
} | [
"public",
"IAtom",
"getPlacedHeavyAtom",
"(",
"IAtomContainer",
"molecule",
",",
"IAtom",
"atomA",
",",
"IAtom",
"atomB",
")",
"{",
"List",
"<",
"IBond",
">",
"bonds",
"=",
"molecule",
".",
"getConnectedBondsList",
"(",
"atomA",
")",
";",
"for",
"(",
"IBond",
"bond",
":",
"bonds",
")",
"{",
"IAtom",
"connectedAtom",
"=",
"bond",
".",
"getOther",
"(",
"atomA",
")",
";",
"if",
"(",
"isPlacedHeavyAtom",
"(",
"connectedAtom",
")",
"&&",
"!",
"connectedAtom",
".",
"equals",
"(",
"atomB",
")",
")",
"{",
"return",
"connectedAtom",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Gets the first placed Heavy Atom around atomA which is not atomB.
@param molecule
@param atomA Description of the Parameter
@param atomB Description of the Parameter
@return The placedHeavyAtom value | [
"Gets",
"the",
"first",
"placed",
"Heavy",
"Atom",
"around",
"atomA",
"which",
"is",
"not",
"atomB",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomPlacer3D.java#L540-L549 |
alkacon/opencms-core | src/org/opencms/security/CmsPersistentLoginTokenHandler.java | CmsPersistentLoginTokenHandler.removeExpiredTokens | public void removeExpiredTokens(CmsUser user, long now) {
"""
Removes expired tokens from the user's additional infos.<p>
This method does not write the user back to the database.
@param user the user for which to remove the additional infos
@param now the current time
"""
List<String> toRemove = Lists.newArrayList();
for (Map.Entry<String, Object> entry : user.getAdditionalInfo().entrySet()) {
String key = entry.getKey();
if (key.startsWith(KEY_PREFIX)) {
try {
long expiry = Long.parseLong((String)entry.getValue());
if (expiry < now) {
toRemove.add(key);
}
} catch (NumberFormatException e) {
toRemove.add(key);
}
}
}
LOG.info("Removing " + toRemove.size() + " expired tokens for user " + user.getName());
for (String removeKey : toRemove) {
user.getAdditionalInfo().remove(removeKey);
}
} | java | public void removeExpiredTokens(CmsUser user, long now) {
List<String> toRemove = Lists.newArrayList();
for (Map.Entry<String, Object> entry : user.getAdditionalInfo().entrySet()) {
String key = entry.getKey();
if (key.startsWith(KEY_PREFIX)) {
try {
long expiry = Long.parseLong((String)entry.getValue());
if (expiry < now) {
toRemove.add(key);
}
} catch (NumberFormatException e) {
toRemove.add(key);
}
}
}
LOG.info("Removing " + toRemove.size() + " expired tokens for user " + user.getName());
for (String removeKey : toRemove) {
user.getAdditionalInfo().remove(removeKey);
}
} | [
"public",
"void",
"removeExpiredTokens",
"(",
"CmsUser",
"user",
",",
"long",
"now",
")",
"{",
"List",
"<",
"String",
">",
"toRemove",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
"entry",
":",
"user",
".",
"getAdditionalInfo",
"(",
")",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"key",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"key",
".",
"startsWith",
"(",
"KEY_PREFIX",
")",
")",
"{",
"try",
"{",
"long",
"expiry",
"=",
"Long",
".",
"parseLong",
"(",
"(",
"String",
")",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"if",
"(",
"expiry",
"<",
"now",
")",
"{",
"toRemove",
".",
"add",
"(",
"key",
")",
";",
"}",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"toRemove",
".",
"add",
"(",
"key",
")",
";",
"}",
"}",
"}",
"LOG",
".",
"info",
"(",
"\"Removing \"",
"+",
"toRemove",
".",
"size",
"(",
")",
"+",
"\" expired tokens for user \"",
"+",
"user",
".",
"getName",
"(",
")",
")",
";",
"for",
"(",
"String",
"removeKey",
":",
"toRemove",
")",
"{",
"user",
".",
"getAdditionalInfo",
"(",
")",
".",
"remove",
"(",
"removeKey",
")",
";",
"}",
"}"
] | Removes expired tokens from the user's additional infos.<p>
This method does not write the user back to the database.
@param user the user for which to remove the additional infos
@param now the current time | [
"Removes",
"expired",
"tokens",
"from",
"the",
"user",
"s",
"additional",
"infos",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsPersistentLoginTokenHandler.java#L271-L291 |
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.getPatternAnyEntityInfosAsync | public Observable<List<PatternAnyEntityExtractor>> getPatternAnyEntityInfosAsync(UUID appId, String versionId, GetPatternAnyEntityInfosOptionalParameter getPatternAnyEntityInfosOptionalParameter) {
"""
Get information about the Pattern.Any entity models.
@param appId The application ID.
@param versionId The version ID.
@param getPatternAnyEntityInfosOptionalParameter 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 List<PatternAnyEntityExtractor> object
"""
return getPatternAnyEntityInfosWithServiceResponseAsync(appId, versionId, getPatternAnyEntityInfosOptionalParameter).map(new Func1<ServiceResponse<List<PatternAnyEntityExtractor>>, List<PatternAnyEntityExtractor>>() {
@Override
public List<PatternAnyEntityExtractor> call(ServiceResponse<List<PatternAnyEntityExtractor>> response) {
return response.body();
}
});
} | java | public Observable<List<PatternAnyEntityExtractor>> getPatternAnyEntityInfosAsync(UUID appId, String versionId, GetPatternAnyEntityInfosOptionalParameter getPatternAnyEntityInfosOptionalParameter) {
return getPatternAnyEntityInfosWithServiceResponseAsync(appId, versionId, getPatternAnyEntityInfosOptionalParameter).map(new Func1<ServiceResponse<List<PatternAnyEntityExtractor>>, List<PatternAnyEntityExtractor>>() {
@Override
public List<PatternAnyEntityExtractor> call(ServiceResponse<List<PatternAnyEntityExtractor>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"PatternAnyEntityExtractor",
">",
">",
"getPatternAnyEntityInfosAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"GetPatternAnyEntityInfosOptionalParameter",
"getPatternAnyEntityInfosOptionalParameter",
")",
"{",
"return",
"getPatternAnyEntityInfosWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"getPatternAnyEntityInfosOptionalParameter",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"List",
"<",
"PatternAnyEntityExtractor",
">",
">",
",",
"List",
"<",
"PatternAnyEntityExtractor",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"List",
"<",
"PatternAnyEntityExtractor",
">",
"call",
"(",
"ServiceResponse",
"<",
"List",
"<",
"PatternAnyEntityExtractor",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Get information about the Pattern.Any entity models.
@param appId The application ID.
@param versionId The version ID.
@param getPatternAnyEntityInfosOptionalParameter 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 List<PatternAnyEntityExtractor> object | [
"Get",
"information",
"about",
"the",
"Pattern",
".",
"Any",
"entity",
"models",
"."
] | 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#L7417-L7424 |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java | TarHeader.getOctalBytes | public static int getOctalBytes(long value, byte[] buf, int offset, int length) {
"""
Parse an octal integer from a header buffer.
@param header
The header buffer from which to parse.
@param offset
The offset into the buffer from which to parse.
@param length
The number of header bytes to parse.
@return The integer value of the octal bytes.
"""
int idx = length - 1;
buf[offset + idx] = 0;
--idx;
buf[offset + idx] = (byte) ' ';
--idx;
if (value == 0) {
buf[offset + idx] = (byte) '0';
--idx;
} else {
for (long val = value; idx >= 0 && val > 0; --idx) {
buf[offset + idx] = (byte) ((byte) '0' + (byte) (val & 7));
val = val >> 3;
}
}
for (; idx >= 0; --idx) {
buf[offset + idx] = (byte) ' ';
}
return offset + length;
} | java | public static int getOctalBytes(long value, byte[] buf, int offset, int length) {
int idx = length - 1;
buf[offset + idx] = 0;
--idx;
buf[offset + idx] = (byte) ' ';
--idx;
if (value == 0) {
buf[offset + idx] = (byte) '0';
--idx;
} else {
for (long val = value; idx >= 0 && val > 0; --idx) {
buf[offset + idx] = (byte) ((byte) '0' + (byte) (val & 7));
val = val >> 3;
}
}
for (; idx >= 0; --idx) {
buf[offset + idx] = (byte) ' ';
}
return offset + length;
} | [
"public",
"static",
"int",
"getOctalBytes",
"(",
"long",
"value",
",",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"int",
"idx",
"=",
"length",
"-",
"1",
";",
"buf",
"[",
"offset",
"+",
"idx",
"]",
"=",
"0",
";",
"--",
"idx",
";",
"buf",
"[",
"offset",
"+",
"idx",
"]",
"=",
"(",
"byte",
")",
"'",
"'",
";",
"--",
"idx",
";",
"if",
"(",
"value",
"==",
"0",
")",
"{",
"buf",
"[",
"offset",
"+",
"idx",
"]",
"=",
"(",
"byte",
")",
"'",
"'",
";",
"--",
"idx",
";",
"}",
"else",
"{",
"for",
"(",
"long",
"val",
"=",
"value",
";",
"idx",
">=",
"0",
"&&",
"val",
">",
"0",
";",
"--",
"idx",
")",
"{",
"buf",
"[",
"offset",
"+",
"idx",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"byte",
")",
"'",
"'",
"+",
"(",
"byte",
")",
"(",
"val",
"&",
"7",
")",
")",
";",
"val",
"=",
"val",
">>",
"3",
";",
"}",
"}",
"for",
"(",
";",
"idx",
">=",
"0",
";",
"--",
"idx",
")",
"{",
"buf",
"[",
"offset",
"+",
"idx",
"]",
"=",
"(",
"byte",
")",
"'",
"'",
";",
"}",
"return",
"offset",
"+",
"length",
";",
"}"
] | Parse an octal integer from a header buffer.
@param header
The header buffer from which to parse.
@param offset
The offset into the buffer from which to parse.
@param length
The number of header bytes to parse.
@return The integer value of the octal bytes. | [
"Parse",
"an",
"octal",
"integer",
"from",
"a",
"header",
"buffer",
"."
] | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java#L425-L448 |
OpenTSDB/opentsdb | src/core/Tags.java | Tags.resolveAllAsync | public static Deferred<ArrayList<byte[]>> resolveAllAsync(final TSDB tsdb,
final Map<String, String> tags) {
"""
Resolves a set of tag strings to their UIDs asynchronously
@param tsdb the TSDB to use for access
@param tags The tags to resolve
@return A deferred with the list of UIDs in tagk1, tagv1, .. tagkn, tagvn
order
@throws NoSuchUniqueName if one of the elements in the map contained an
unknown tag name or tag value.
@since 2.1
"""
return resolveAllInternalAsync(tsdb, null, tags, false);
} | java | public static Deferred<ArrayList<byte[]>> resolveAllAsync(final TSDB tsdb,
final Map<String, String> tags) {
return resolveAllInternalAsync(tsdb, null, tags, false);
} | [
"public",
"static",
"Deferred",
"<",
"ArrayList",
"<",
"byte",
"[",
"]",
">",
">",
"resolveAllAsync",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"resolveAllInternalAsync",
"(",
"tsdb",
",",
"null",
",",
"tags",
",",
"false",
")",
";",
"}"
] | Resolves a set of tag strings to their UIDs asynchronously
@param tsdb the TSDB to use for access
@param tags The tags to resolve
@return A deferred with the list of UIDs in tagk1, tagv1, .. tagkn, tagvn
order
@throws NoSuchUniqueName if one of the elements in the map contained an
unknown tag name or tag value.
@since 2.1 | [
"Resolves",
"a",
"set",
"of",
"tag",
"strings",
"to",
"their",
"UIDs",
"asynchronously"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Tags.java#L598-L601 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.invertSPD | public static boolean invertSPD(DMatrixRMaj mat, DMatrixRMaj result ) {
"""
Matrix inverse for symmetric positive definite matrices. For small matrices an unrolled
cholesky is used. Otherwise a standard decomposition.
@see UnrolledCholesky_DDRM
@see LinearSolverFactory_DDRM#chol(int)
@param mat (Input) SPD matrix
@param result (Output) Inverted matrix.
@return true if it could invert the matrix false if it could not.
"""
if( mat.numRows != mat.numCols )
throw new IllegalArgumentException("Must be a square matrix");
result.reshape(mat.numRows,mat.numRows);
if( mat.numRows <= UnrolledCholesky_DDRM.MAX ) {
// L*L' = A
if( !UnrolledCholesky_DDRM.lower(mat,result) )
return false;
// L = inv(L)
TriangularSolver_DDRM.invertLower(result.data,result.numCols);
// inv(A) = inv(L')*inv(L)
SpecializedOps_DDRM.multLowerTranA(result);
} else {
LinearSolverDense<DMatrixRMaj> solver = LinearSolverFactory_DDRM.chol(mat.numCols);
if( solver.modifiesA() )
mat = mat.copy();
if( !solver.setA(mat))
return false;
solver.invert(result);
}
return true;
} | java | public static boolean invertSPD(DMatrixRMaj mat, DMatrixRMaj result ) {
if( mat.numRows != mat.numCols )
throw new IllegalArgumentException("Must be a square matrix");
result.reshape(mat.numRows,mat.numRows);
if( mat.numRows <= UnrolledCholesky_DDRM.MAX ) {
// L*L' = A
if( !UnrolledCholesky_DDRM.lower(mat,result) )
return false;
// L = inv(L)
TriangularSolver_DDRM.invertLower(result.data,result.numCols);
// inv(A) = inv(L')*inv(L)
SpecializedOps_DDRM.multLowerTranA(result);
} else {
LinearSolverDense<DMatrixRMaj> solver = LinearSolverFactory_DDRM.chol(mat.numCols);
if( solver.modifiesA() )
mat = mat.copy();
if( !solver.setA(mat))
return false;
solver.invert(result);
}
return true;
} | [
"public",
"static",
"boolean",
"invertSPD",
"(",
"DMatrixRMaj",
"mat",
",",
"DMatrixRMaj",
"result",
")",
"{",
"if",
"(",
"mat",
".",
"numRows",
"!=",
"mat",
".",
"numCols",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Must be a square matrix\"",
")",
";",
"result",
".",
"reshape",
"(",
"mat",
".",
"numRows",
",",
"mat",
".",
"numRows",
")",
";",
"if",
"(",
"mat",
".",
"numRows",
"<=",
"UnrolledCholesky_DDRM",
".",
"MAX",
")",
"{",
"// L*L' = A",
"if",
"(",
"!",
"UnrolledCholesky_DDRM",
".",
"lower",
"(",
"mat",
",",
"result",
")",
")",
"return",
"false",
";",
"// L = inv(L)",
"TriangularSolver_DDRM",
".",
"invertLower",
"(",
"result",
".",
"data",
",",
"result",
".",
"numCols",
")",
";",
"// inv(A) = inv(L')*inv(L)",
"SpecializedOps_DDRM",
".",
"multLowerTranA",
"(",
"result",
")",
";",
"}",
"else",
"{",
"LinearSolverDense",
"<",
"DMatrixRMaj",
">",
"solver",
"=",
"LinearSolverFactory_DDRM",
".",
"chol",
"(",
"mat",
".",
"numCols",
")",
";",
"if",
"(",
"solver",
".",
"modifiesA",
"(",
")",
")",
"mat",
"=",
"mat",
".",
"copy",
"(",
")",
";",
"if",
"(",
"!",
"solver",
".",
"setA",
"(",
"mat",
")",
")",
"return",
"false",
";",
"solver",
".",
"invert",
"(",
"result",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Matrix inverse for symmetric positive definite matrices. For small matrices an unrolled
cholesky is used. Otherwise a standard decomposition.
@see UnrolledCholesky_DDRM
@see LinearSolverFactory_DDRM#chol(int)
@param mat (Input) SPD matrix
@param result (Output) Inverted matrix.
@return true if it could invert the matrix false if it could not. | [
"Matrix",
"inverse",
"for",
"symmetric",
"positive",
"definite",
"matrices",
".",
"For",
"small",
"matrices",
"an",
"unrolled",
"cholesky",
"is",
"used",
".",
"Otherwise",
"a",
"standard",
"decomposition",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L818-L842 |
overview/mime-types | src/main/java/org/overviewproject/mime_types/MimeTypeDetector.java | MimeTypeDetector.detectMimeType | public String detectMimeType(String filename, final InputStream is) throws GetBytesException {
"""
Determines the MIME type of a file with a given input stream.
<p>
The InputStream must exist. It must point to the beginning of the file
contents. And {@link java.io.InputStream#markSupported()} must return
{@literal true}. (When in doubt, pass a
{@link java.io.BufferedInputStream}.)
</p>
@param filename Name of file. To skip filename globbing, pass {@literal ""}
@param is InputStream that supports mark and reset.
@return a MIME type such as {@literal "text/plain"}
@throws GetBytesException if marking, reading or resetting the InputStream fails.
@see #detectMimeType(String, Callable)
"""
Callable<byte[]> getBytes = new Callable<byte[]>() {
public byte[] call() throws IOException {
return inputStreamToFirstBytes(is);
}
};
return detectMimeType(filename, getBytes);
} | java | public String detectMimeType(String filename, final InputStream is) throws GetBytesException {
Callable<byte[]> getBytes = new Callable<byte[]>() {
public byte[] call() throws IOException {
return inputStreamToFirstBytes(is);
}
};
return detectMimeType(filename, getBytes);
} | [
"public",
"String",
"detectMimeType",
"(",
"String",
"filename",
",",
"final",
"InputStream",
"is",
")",
"throws",
"GetBytesException",
"{",
"Callable",
"<",
"byte",
"[",
"]",
">",
"getBytes",
"=",
"new",
"Callable",
"<",
"byte",
"[",
"]",
">",
"(",
")",
"{",
"public",
"byte",
"[",
"]",
"call",
"(",
")",
"throws",
"IOException",
"{",
"return",
"inputStreamToFirstBytes",
"(",
"is",
")",
";",
"}",
"}",
";",
"return",
"detectMimeType",
"(",
"filename",
",",
"getBytes",
")",
";",
"}"
] | Determines the MIME type of a file with a given input stream.
<p>
The InputStream must exist. It must point to the beginning of the file
contents. And {@link java.io.InputStream#markSupported()} must return
{@literal true}. (When in doubt, pass a
{@link java.io.BufferedInputStream}.)
</p>
@param filename Name of file. To skip filename globbing, pass {@literal ""}
@param is InputStream that supports mark and reset.
@return a MIME type such as {@literal "text/plain"}
@throws GetBytesException if marking, reading or resetting the InputStream fails.
@see #detectMimeType(String, Callable) | [
"Determines",
"the",
"MIME",
"type",
"of",
"a",
"file",
"with",
"a",
"given",
"input",
"stream",
"."
] | train | https://github.com/overview/mime-types/blob/d5c45302049c0cd5e634a50954304d8ddeb9abb4/src/main/java/org/overviewproject/mime_types/MimeTypeDetector.java#L219-L227 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/operations/ClassPath.java | ClassPath.newInstance | public static <T> T newInstance(Class<?> aClass, Class<?> parameterType,Object initarg)
throws SetupException {
"""
Use a constructor of the a class to create an instance
@param aClass the class object
@param parameterType the parameter type for the constructor
@param initarg the initial constructor argument
@param <T> the class type
@return the new created object
@throws SetupException when an setup error occurs
"""
Class<?>[] paramTypes = {parameterType};
Object[] initArgs = {initarg};
return newInstance(aClass,paramTypes,initArgs);
} | java | public static <T> T newInstance(Class<?> aClass, Class<?> parameterType,Object initarg)
throws SetupException
{
Class<?>[] paramTypes = {parameterType};
Object[] initArgs = {initarg};
return newInstance(aClass,paramTypes,initArgs);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Class",
"<",
"?",
">",
"aClass",
",",
"Class",
"<",
"?",
">",
"parameterType",
",",
"Object",
"initarg",
")",
"throws",
"SetupException",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"paramTypes",
"=",
"{",
"parameterType",
"}",
";",
"Object",
"[",
"]",
"initArgs",
"=",
"{",
"initarg",
"}",
";",
"return",
"newInstance",
"(",
"aClass",
",",
"paramTypes",
",",
"initArgs",
")",
";",
"}"
] | Use a constructor of the a class to create an instance
@param aClass the class object
@param parameterType the parameter type for the constructor
@param initarg the initial constructor argument
@param <T> the class type
@return the new created object
@throws SetupException when an setup error occurs | [
"Use",
"a",
"constructor",
"of",
"the",
"a",
"class",
"to",
"create",
"an",
"instance"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/operations/ClassPath.java#L165-L172 |
facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imageformat/DefaultImageFormatChecker.java | DefaultImageFormatChecker.isIcoHeader | private static boolean isIcoHeader(final byte[] imageHeaderBytes, final int headerSize) {
"""
Checks if first headerSize bytes of imageHeaderBytes constitute a valid header for a ico image.
Details on ICO header can be found <a href="https://en.wikipedia.org/wiki/ICO_(file_format)">
</a>
@param imageHeaderBytes
@param headerSize
@return true if imageHeaderBytes is a valid header for a ico image
"""
if (headerSize < ICO_HEADER.length) {
return false;
}
return ImageFormatCheckerUtils.startsWithPattern(imageHeaderBytes, ICO_HEADER);
} | java | private static boolean isIcoHeader(final byte[] imageHeaderBytes, final int headerSize) {
if (headerSize < ICO_HEADER.length) {
return false;
}
return ImageFormatCheckerUtils.startsWithPattern(imageHeaderBytes, ICO_HEADER);
} | [
"private",
"static",
"boolean",
"isIcoHeader",
"(",
"final",
"byte",
"[",
"]",
"imageHeaderBytes",
",",
"final",
"int",
"headerSize",
")",
"{",
"if",
"(",
"headerSize",
"<",
"ICO_HEADER",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"return",
"ImageFormatCheckerUtils",
".",
"startsWithPattern",
"(",
"imageHeaderBytes",
",",
"ICO_HEADER",
")",
";",
"}"
] | Checks if first headerSize bytes of imageHeaderBytes constitute a valid header for a ico image.
Details on ICO header can be found <a href="https://en.wikipedia.org/wiki/ICO_(file_format)">
</a>
@param imageHeaderBytes
@param headerSize
@return true if imageHeaderBytes is a valid header for a ico image | [
"Checks",
"if",
"first",
"headerSize",
"bytes",
"of",
"imageHeaderBytes",
"constitute",
"a",
"valid",
"header",
"for",
"a",
"ico",
"image",
".",
"Details",
"on",
"ICO",
"header",
"can",
"be",
"found",
"<a",
"href",
"=",
"https",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"ICO_",
"(",
"file_format",
")",
">",
"<",
"/",
"a",
">"
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageformat/DefaultImageFormatChecker.java#L234-L239 |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.fillText | public void fillText(String text, double x, double y) {
"""
Fills the given string of text at position x, y
with the current fill paint attribute.
A {@code null} text value will be ignored.
<p>This method will be affected by any of the
global common, fill, or text
attributes as specified in the
Rendering Attributes Table of {@link GraphicsContext}.
@param text the string of text or null.
@param x position on the x axis.
@param y position on the y axis.
"""
this.gc.fillText(text, doc2fxX(x), doc2fxY(y));
} | java | public void fillText(String text, double x, double y) {
this.gc.fillText(text, doc2fxX(x), doc2fxY(y));
} | [
"public",
"void",
"fillText",
"(",
"String",
"text",
",",
"double",
"x",
",",
"double",
"y",
")",
"{",
"this",
".",
"gc",
".",
"fillText",
"(",
"text",
",",
"doc2fxX",
"(",
"x",
")",
",",
"doc2fxY",
"(",
"y",
")",
")",
";",
"}"
] | Fills the given string of text at position x, y
with the current fill paint attribute.
A {@code null} text value will be ignored.
<p>This method will be affected by any of the
global common, fill, or text
attributes as specified in the
Rendering Attributes Table of {@link GraphicsContext}.
@param text the string of text or null.
@param x position on the x axis.
@param y position on the y axis. | [
"Fills",
"the",
"given",
"string",
"of",
"text",
"at",
"position",
"x",
"y",
"with",
"the",
"current",
"fill",
"paint",
"attribute",
".",
"A",
"{",
"@code",
"null",
"}",
"text",
"value",
"will",
"be",
"ignored",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L1093-L1095 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftDetector.java | SiftDetector.isEdge | boolean isEdge( int x , int y ) {
"""
Performs an edge test to remove false positives. See 4.1 in [1].
"""
if( edgeThreshold <= 0 )
return false;
double xx = derivXX.compute(x,y);
double xy = derivXY.compute(x,y);
double yy = derivYY.compute(x,y);
double Tr = xx + yy;
double det = xx*yy - xy*xy;
// Paper quite "In the unlikely event that the determinant is negative, the curvatures have different signs
// so the point is discarded as not being an extremum"
if( det <= 0)
return true;
else {
// In paper this is:
// Tr**2/Det < (r+1)**2/r
return( Tr*Tr >= edgeThreshold*det);
}
} | java | boolean isEdge( int x , int y ) {
if( edgeThreshold <= 0 )
return false;
double xx = derivXX.compute(x,y);
double xy = derivXY.compute(x,y);
double yy = derivYY.compute(x,y);
double Tr = xx + yy;
double det = xx*yy - xy*xy;
// Paper quite "In the unlikely event that the determinant is negative, the curvatures have different signs
// so the point is discarded as not being an extremum"
if( det <= 0)
return true;
else {
// In paper this is:
// Tr**2/Det < (r+1)**2/r
return( Tr*Tr >= edgeThreshold*det);
}
} | [
"boolean",
"isEdge",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"if",
"(",
"edgeThreshold",
"<=",
"0",
")",
"return",
"false",
";",
"double",
"xx",
"=",
"derivXX",
".",
"compute",
"(",
"x",
",",
"y",
")",
";",
"double",
"xy",
"=",
"derivXY",
".",
"compute",
"(",
"x",
",",
"y",
")",
";",
"double",
"yy",
"=",
"derivYY",
".",
"compute",
"(",
"x",
",",
"y",
")",
";",
"double",
"Tr",
"=",
"xx",
"+",
"yy",
";",
"double",
"det",
"=",
"xx",
"*",
"yy",
"-",
"xy",
"*",
"xy",
";",
"// Paper quite \"In the unlikely event that the determinant is negative, the curvatures have different signs",
"// so the point is discarded as not being an extremum\"",
"if",
"(",
"det",
"<=",
"0",
")",
"return",
"true",
";",
"else",
"{",
"// In paper this is:",
"// Tr**2/Det < (r+1)**2/r",
"return",
"(",
"Tr",
"*",
"Tr",
">=",
"edgeThreshold",
"*",
"det",
")",
";",
"}",
"}"
] | Performs an edge test to remove false positives. See 4.1 in [1]. | [
"Performs",
"an",
"edge",
"test",
"to",
"remove",
"false",
"positives",
".",
"See",
"4",
".",
"1",
"in",
"[",
"1",
"]",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftDetector.java#L311-L331 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MultiMEProxyHandler.java | MultiMEProxyHandler.initialiseNonPersistent | public void initialiseNonPersistent(MessageProcessor messageProcessor,
SIMPTransactionManager txManager) {
"""
Called to recover Neighbours from the MessageStore.
@param messageProcessor The message processor instance
@param txManager The transaction manager instance to create Local transactions
under.
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initialiseNonPersistent", messageProcessor);
//Release 1 has no Link Bundle IDs for this Neighbour
// Cache the reference to the message processor
_messageProcessor = messageProcessor;
// Create the ObjectPool that will be used to store the
// subscriptionMessages. Creating with an intial length of
// 2, but this could be made a settable parameter for performance
_subscriptionMessagePool = new ObjectPool("SubscriptionMessages", NUM_MESSAGES);
// Create a new object to contain all the Neighbours
_neighbours = new Neighbours(this, _messageProcessor.getMessagingEngineBus());
// Create a new LockManager instance
_lockManager = new LockManager();
// Assign the transaction manager
_transactionManager = txManager;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initialiseNonPersistent");
} | java | public void initialiseNonPersistent(MessageProcessor messageProcessor,
SIMPTransactionManager txManager)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initialiseNonPersistent", messageProcessor);
//Release 1 has no Link Bundle IDs for this Neighbour
// Cache the reference to the message processor
_messageProcessor = messageProcessor;
// Create the ObjectPool that will be used to store the
// subscriptionMessages. Creating with an intial length of
// 2, but this could be made a settable parameter for performance
_subscriptionMessagePool = new ObjectPool("SubscriptionMessages", NUM_MESSAGES);
// Create a new object to contain all the Neighbours
_neighbours = new Neighbours(this, _messageProcessor.getMessagingEngineBus());
// Create a new LockManager instance
_lockManager = new LockManager();
// Assign the transaction manager
_transactionManager = txManager;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initialiseNonPersistent");
} | [
"public",
"void",
"initialiseNonPersistent",
"(",
"MessageProcessor",
"messageProcessor",
",",
"SIMPTransactionManager",
"txManager",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"initialiseNonPersistent\"",
",",
"messageProcessor",
")",
";",
"//Release 1 has no Link Bundle IDs for this Neighbour",
"// Cache the reference to the message processor",
"_messageProcessor",
"=",
"messageProcessor",
";",
"// Create the ObjectPool that will be used to store the ",
"// subscriptionMessages. Creating with an intial length of",
"// 2, but this could be made a settable parameter for performance",
"_subscriptionMessagePool",
"=",
"new",
"ObjectPool",
"(",
"\"SubscriptionMessages\"",
",",
"NUM_MESSAGES",
")",
";",
"// Create a new object to contain all the Neighbours",
"_neighbours",
"=",
"new",
"Neighbours",
"(",
"this",
",",
"_messageProcessor",
".",
"getMessagingEngineBus",
"(",
")",
")",
";",
"// Create a new LockManager instance",
"_lockManager",
"=",
"new",
"LockManager",
"(",
")",
";",
"// Assign the transaction manager",
"_transactionManager",
"=",
"txManager",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"initialiseNonPersistent\"",
")",
";",
"}"
] | Called to recover Neighbours from the MessageStore.
@param messageProcessor The message processor instance
@param txManager The transaction manager instance to create Local transactions
under. | [
"Called",
"to",
"recover",
"Neighbours",
"from",
"the",
"MessageStore",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MultiMEProxyHandler.java#L140-L167 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/utils/NumericUtils.java | NumericUtils.checkIfZero | public static final boolean checkIfZero(String value, Class valueClazz) {
"""
Check if zero
@param value value string
@param valueClazz value class
@return
"""
boolean returnValue=false;
if(value != null && NumberUtils.isNumber(value) && numberTypes.get(valueClazz) != null)
{
switch (numberTypes.get(valueClazz))
{
case INTEGER:
returnValue = Integer.parseInt(value) == (NumberUtils.INTEGER_ZERO);
break;
case FLOAT:
returnValue = Float.parseFloat(value) == (NumberUtils.FLOAT_ZERO);
break;
case LONG:
returnValue = Long.parseLong(value) == (NumberUtils.LONG_ZERO);
break;
case BIGDECIMAL:
// Note: cannot use 'equals' here - it would require both BigDecimals to have
// the same scale.
returnValue = (new BigDecimal(value)).compareTo(BigDecimal.ZERO) == 0;
break;
case BIGINTEGER:
returnValue = (new BigInteger(value)).equals(BigInteger.ZERO);
break;
case SHORT:
returnValue = (new Short(value)).shortValue() == NumberUtils.SHORT_ZERO.shortValue();
break;
}
}
return returnValue;
} | java | public static final boolean checkIfZero(String value, Class valueClazz)
{
boolean returnValue=false;
if(value != null && NumberUtils.isNumber(value) && numberTypes.get(valueClazz) != null)
{
switch (numberTypes.get(valueClazz))
{
case INTEGER:
returnValue = Integer.parseInt(value) == (NumberUtils.INTEGER_ZERO);
break;
case FLOAT:
returnValue = Float.parseFloat(value) == (NumberUtils.FLOAT_ZERO);
break;
case LONG:
returnValue = Long.parseLong(value) == (NumberUtils.LONG_ZERO);
break;
case BIGDECIMAL:
// Note: cannot use 'equals' here - it would require both BigDecimals to have
// the same scale.
returnValue = (new BigDecimal(value)).compareTo(BigDecimal.ZERO) == 0;
break;
case BIGINTEGER:
returnValue = (new BigInteger(value)).equals(BigInteger.ZERO);
break;
case SHORT:
returnValue = (new Short(value)).shortValue() == NumberUtils.SHORT_ZERO.shortValue();
break;
}
}
return returnValue;
} | [
"public",
"static",
"final",
"boolean",
"checkIfZero",
"(",
"String",
"value",
",",
"Class",
"valueClazz",
")",
"{",
"boolean",
"returnValue",
"=",
"false",
";",
"if",
"(",
"value",
"!=",
"null",
"&&",
"NumberUtils",
".",
"isNumber",
"(",
"value",
")",
"&&",
"numberTypes",
".",
"get",
"(",
"valueClazz",
")",
"!=",
"null",
")",
"{",
"switch",
"(",
"numberTypes",
".",
"get",
"(",
"valueClazz",
")",
")",
"{",
"case",
"INTEGER",
":",
"returnValue",
"=",
"Integer",
".",
"parseInt",
"(",
"value",
")",
"==",
"(",
"NumberUtils",
".",
"INTEGER_ZERO",
")",
";",
"break",
";",
"case",
"FLOAT",
":",
"returnValue",
"=",
"Float",
".",
"parseFloat",
"(",
"value",
")",
"==",
"(",
"NumberUtils",
".",
"FLOAT_ZERO",
")",
";",
"break",
";",
"case",
"LONG",
":",
"returnValue",
"=",
"Long",
".",
"parseLong",
"(",
"value",
")",
"==",
"(",
"NumberUtils",
".",
"LONG_ZERO",
")",
";",
"break",
";",
"case",
"BIGDECIMAL",
":",
"// Note: cannot use 'equals' here - it would require both BigDecimals to have",
"// the same scale.",
"returnValue",
"=",
"(",
"new",
"BigDecimal",
"(",
"value",
")",
")",
".",
"compareTo",
"(",
"BigDecimal",
".",
"ZERO",
")",
"==",
"0",
";",
"break",
";",
"case",
"BIGINTEGER",
":",
"returnValue",
"=",
"(",
"new",
"BigInteger",
"(",
"value",
")",
")",
".",
"equals",
"(",
"BigInteger",
".",
"ZERO",
")",
";",
"break",
";",
"case",
"SHORT",
":",
"returnValue",
"=",
"(",
"new",
"Short",
"(",
"value",
")",
")",
".",
"shortValue",
"(",
")",
"==",
"NumberUtils",
".",
"SHORT_ZERO",
".",
"shortValue",
"(",
")",
";",
"break",
";",
"}",
"}",
"return",
"returnValue",
";",
"}"
] | Check if zero
@param value value string
@param valueClazz value class
@return | [
"Check",
"if",
"zero"
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/utils/NumericUtils.java#L66-L103 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2016_06_27_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2016_06_27_preview/implementation/RegistriesInner.java | RegistriesInner.getCredentials | public RegistryCredentialsInner getCredentials(String resourceGroupName, String registryName) {
"""
Gets the administrator login credentials for the specified container registry.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@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 RegistryCredentialsInner object if successful.
"""
return getCredentialsWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body();
} | java | public RegistryCredentialsInner getCredentials(String resourceGroupName, String registryName) {
return getCredentialsWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body();
} | [
"public",
"RegistryCredentialsInner",
"getCredentials",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
")",
"{",
"return",
"getCredentialsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Gets the administrator login credentials for the specified container registry.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@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 RegistryCredentialsInner object if successful. | [
"Gets",
"the",
"administrator",
"login",
"credentials",
"for",
"the",
"specified",
"container",
"registry",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2016_06_27_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2016_06_27_preview/implementation/RegistriesInner.java#L791-L793 |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readLeafTasks | private void readLeafTasks(Task parent, Integer id) {
"""
Read the leaf tasks for an individual WBS node.
@param parent parent task
@param id first task ID
"""
Integer currentID = id;
Table table = getTable("A1TAB");
while (currentID.intValue() != 0)
{
if (m_projectFile.getTaskByUniqueID(currentID) == null)
{
readTask(parent, currentID);
}
currentID = table.find(currentID).getInteger("NEXT_TASK_ID");
}
} | java | private void readLeafTasks(Task parent, Integer id)
{
Integer currentID = id;
Table table = getTable("A1TAB");
while (currentID.intValue() != 0)
{
if (m_projectFile.getTaskByUniqueID(currentID) == null)
{
readTask(parent, currentID);
}
currentID = table.find(currentID).getInteger("NEXT_TASK_ID");
}
} | [
"private",
"void",
"readLeafTasks",
"(",
"Task",
"parent",
",",
"Integer",
"id",
")",
"{",
"Integer",
"currentID",
"=",
"id",
";",
"Table",
"table",
"=",
"getTable",
"(",
"\"A1TAB\"",
")",
";",
"while",
"(",
"currentID",
".",
"intValue",
"(",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"m_projectFile",
".",
"getTaskByUniqueID",
"(",
"currentID",
")",
"==",
"null",
")",
"{",
"readTask",
"(",
"parent",
",",
"currentID",
")",
";",
"}",
"currentID",
"=",
"table",
".",
"find",
"(",
"currentID",
")",
".",
"getInteger",
"(",
"\"NEXT_TASK_ID\"",
")",
";",
"}",
"}"
] | Read the leaf tasks for an individual WBS node.
@param parent parent task
@param id first task ID | [
"Read",
"the",
"leaf",
"tasks",
"for",
"an",
"individual",
"WBS",
"node",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L349-L361 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java | ByteArrayUtil.writeShort | public static int writeShort(byte[] array, int offset, int v) {
"""
Write a short to the byte array at the given offset.
@param array Array to write to
@param offset Offset to write to
@param v data
@return number of bytes written
"""
array[offset + 0] = (byte) (v >>> 8);
array[offset + 1] = (byte) (v >>> 0);
return SIZE_SHORT;
} | java | public static int writeShort(byte[] array, int offset, int v) {
array[offset + 0] = (byte) (v >>> 8);
array[offset + 1] = (byte) (v >>> 0);
return SIZE_SHORT;
} | [
"public",
"static",
"int",
"writeShort",
"(",
"byte",
"[",
"]",
"array",
",",
"int",
"offset",
",",
"int",
"v",
")",
"{",
"array",
"[",
"offset",
"+",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"v",
">>>",
"8",
")",
";",
"array",
"[",
"offset",
"+",
"1",
"]",
"=",
"(",
"byte",
")",
"(",
"v",
">>>",
"0",
")",
";",
"return",
"SIZE_SHORT",
";",
"}"
] | Write a short to the byte array at the given offset.
@param array Array to write to
@param offset Offset to write to
@param v data
@return number of bytes written | [
"Write",
"a",
"short",
"to",
"the",
"byte",
"array",
"at",
"the",
"given",
"offset",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java#L106-L110 |
att/AAF | cadi/core/src/main/java/com/att/cadi/filter/CadiAccess.java | CadiAccess.buildLine | public final static StringBuilder buildLine(StringBuilder sb, Object[] elements) {
"""
/*
Build a line of code onto a StringBuilder based on Objects. Analyze whether
spaces need including.
@param sb
@param elements
@return
"""
sb.append(' ');
String str;
boolean notFirst = false;
for(Object o : elements) {
if(o!=null) {
str = o.toString();
if(str.length()>0) {
if(notFirst && shouldAddSpace(str,true) && shouldAddSpace(sb,false)) {
sb.append(' ');
} else {
notFirst=true;
}
sb.append(str);
}
}
}
return sb;
} | java | public final static StringBuilder buildLine(StringBuilder sb, Object[] elements) {
sb.append(' ');
String str;
boolean notFirst = false;
for(Object o : elements) {
if(o!=null) {
str = o.toString();
if(str.length()>0) {
if(notFirst && shouldAddSpace(str,true) && shouldAddSpace(sb,false)) {
sb.append(' ');
} else {
notFirst=true;
}
sb.append(str);
}
}
}
return sb;
} | [
"public",
"final",
"static",
"StringBuilder",
"buildLine",
"(",
"StringBuilder",
"sb",
",",
"Object",
"[",
"]",
"elements",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"String",
"str",
";",
"boolean",
"notFirst",
"=",
"false",
";",
"for",
"(",
"Object",
"o",
":",
"elements",
")",
"{",
"if",
"(",
"o",
"!=",
"null",
")",
"{",
"str",
"=",
"o",
".",
"toString",
"(",
")",
";",
"if",
"(",
"str",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"notFirst",
"&&",
"shouldAddSpace",
"(",
"str",
",",
"true",
")",
"&&",
"shouldAddSpace",
"(",
"sb",
",",
"false",
")",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"{",
"notFirst",
"=",
"true",
";",
"}",
"sb",
".",
"append",
"(",
"str",
")",
";",
"}",
"}",
"}",
"return",
"sb",
";",
"}"
] | /*
Build a line of code onto a StringBuilder based on Objects. Analyze whether
spaces need including.
@param sb
@param elements
@return | [
"/",
"*",
"Build",
"a",
"line",
"of",
"code",
"onto",
"a",
"StringBuilder",
"based",
"on",
"Objects",
".",
"Analyze",
"whether",
"spaces",
"need",
"including",
"."
] | train | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/filter/CadiAccess.java#L93-L112 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/SampleableConcurrentHashMap.java | SampleableConcurrentHashMap.fetchEntries | public int fetchEntries(int tableIndex, int size, List<Map.Entry<K, V>> entries) {
"""
Fetches entries from given <code>tableIndex</code> as <code>size</code>
and puts them into <code>entries</code> list.
@param tableIndex Index (checkpoint) for starting point of fetch operation
@param size Count of how many entries will be fetched
@param entries List that fetched entries will be put into
@return the next index (checkpoint) for later fetches
"""
final long now = Clock.currentTimeMillis();
final Segment<K, V> segment = segments[0];
final HashEntry<K, V>[] currentTable = segment.table;
int nextTableIndex;
if (tableIndex >= 0 && tableIndex < segment.table.length) {
nextTableIndex = tableIndex;
} else {
nextTableIndex = currentTable.length - 1;
}
int counter = 0;
while (nextTableIndex >= 0 && counter < size) {
HashEntry<K, V> nextEntry = currentTable[nextTableIndex--];
while (nextEntry != null) {
if (nextEntry.key() != null) {
final V value = nextEntry.value();
if (isValidForFetching(value, now)) {
K key = nextEntry.key();
entries.add(new AbstractMap.SimpleEntry<K, V>(key, value));
counter++;
}
}
nextEntry = nextEntry.next;
}
}
return nextTableIndex;
} | java | public int fetchEntries(int tableIndex, int size, List<Map.Entry<K, V>> entries) {
final long now = Clock.currentTimeMillis();
final Segment<K, V> segment = segments[0];
final HashEntry<K, V>[] currentTable = segment.table;
int nextTableIndex;
if (tableIndex >= 0 && tableIndex < segment.table.length) {
nextTableIndex = tableIndex;
} else {
nextTableIndex = currentTable.length - 1;
}
int counter = 0;
while (nextTableIndex >= 0 && counter < size) {
HashEntry<K, V> nextEntry = currentTable[nextTableIndex--];
while (nextEntry != null) {
if (nextEntry.key() != null) {
final V value = nextEntry.value();
if (isValidForFetching(value, now)) {
K key = nextEntry.key();
entries.add(new AbstractMap.SimpleEntry<K, V>(key, value));
counter++;
}
}
nextEntry = nextEntry.next;
}
}
return nextTableIndex;
} | [
"public",
"int",
"fetchEntries",
"(",
"int",
"tableIndex",
",",
"int",
"size",
",",
"List",
"<",
"Map",
".",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"entries",
")",
"{",
"final",
"long",
"now",
"=",
"Clock",
".",
"currentTimeMillis",
"(",
")",
";",
"final",
"Segment",
"<",
"K",
",",
"V",
">",
"segment",
"=",
"segments",
"[",
"0",
"]",
";",
"final",
"HashEntry",
"<",
"K",
",",
"V",
">",
"[",
"]",
"currentTable",
"=",
"segment",
".",
"table",
";",
"int",
"nextTableIndex",
";",
"if",
"(",
"tableIndex",
">=",
"0",
"&&",
"tableIndex",
"<",
"segment",
".",
"table",
".",
"length",
")",
"{",
"nextTableIndex",
"=",
"tableIndex",
";",
"}",
"else",
"{",
"nextTableIndex",
"=",
"currentTable",
".",
"length",
"-",
"1",
";",
"}",
"int",
"counter",
"=",
"0",
";",
"while",
"(",
"nextTableIndex",
">=",
"0",
"&&",
"counter",
"<",
"size",
")",
"{",
"HashEntry",
"<",
"K",
",",
"V",
">",
"nextEntry",
"=",
"currentTable",
"[",
"nextTableIndex",
"--",
"]",
";",
"while",
"(",
"nextEntry",
"!=",
"null",
")",
"{",
"if",
"(",
"nextEntry",
".",
"key",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"V",
"value",
"=",
"nextEntry",
".",
"value",
"(",
")",
";",
"if",
"(",
"isValidForFetching",
"(",
"value",
",",
"now",
")",
")",
"{",
"K",
"key",
"=",
"nextEntry",
".",
"key",
"(",
")",
";",
"entries",
".",
"add",
"(",
"new",
"AbstractMap",
".",
"SimpleEntry",
"<",
"K",
",",
"V",
">",
"(",
"key",
",",
"value",
")",
")",
";",
"counter",
"++",
";",
"}",
"}",
"nextEntry",
"=",
"nextEntry",
".",
"next",
";",
"}",
"}",
"return",
"nextTableIndex",
";",
"}"
] | Fetches entries from given <code>tableIndex</code> as <code>size</code>
and puts them into <code>entries</code> list.
@param tableIndex Index (checkpoint) for starting point of fetch operation
@param size Count of how many entries will be fetched
@param entries List that fetched entries will be put into
@return the next index (checkpoint) for later fetches | [
"Fetches",
"entries",
"from",
"given",
"<code",
">",
"tableIndex<",
"/",
"code",
">",
"as",
"<code",
">",
"size<",
"/",
"code",
">",
"and",
"puts",
"them",
"into",
"<code",
">",
"entries<",
"/",
"code",
">",
"list",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/SampleableConcurrentHashMap.java#L102-L128 |
before/uadetector | modules/uadetector-core/src/main/java/net/sf/uadetector/VersionParser.java | VersionParser.parseVersion | public static VersionNumber parseVersion(@Nonnull final String version) {
"""
Interprets a string with version information. The first found group will be taken and processed.
@param version
version as string
@return an object of {@code VersionNumber}, never {@code null}
"""
Check.notNull(version, "version");
VersionNumber result = new VersionNumber(new ArrayList<String>(0), version);
final Matcher matcher = VERSIONSTRING.matcher(version);
if (matcher.find()) {
final List<String> groups = Arrays.asList(matcher.group(MAJOR_INDEX).split("\\."));
final String extension = matcher.group(EXTENSION_INDEX) == null ? VersionNumber.EMPTY_EXTENSION : trimRight(matcher
.group(EXTENSION_INDEX));
result = new VersionNumber(groups, extension);
}
return result;
} | java | public static VersionNumber parseVersion(@Nonnull final String version) {
Check.notNull(version, "version");
VersionNumber result = new VersionNumber(new ArrayList<String>(0), version);
final Matcher matcher = VERSIONSTRING.matcher(version);
if (matcher.find()) {
final List<String> groups = Arrays.asList(matcher.group(MAJOR_INDEX).split("\\."));
final String extension = matcher.group(EXTENSION_INDEX) == null ? VersionNumber.EMPTY_EXTENSION : trimRight(matcher
.group(EXTENSION_INDEX));
result = new VersionNumber(groups, extension);
}
return result;
} | [
"public",
"static",
"VersionNumber",
"parseVersion",
"(",
"@",
"Nonnull",
"final",
"String",
"version",
")",
"{",
"Check",
".",
"notNull",
"(",
"version",
",",
"\"version\"",
")",
";",
"VersionNumber",
"result",
"=",
"new",
"VersionNumber",
"(",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"0",
")",
",",
"version",
")",
";",
"final",
"Matcher",
"matcher",
"=",
"VERSIONSTRING",
".",
"matcher",
"(",
"version",
")",
";",
"if",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"final",
"List",
"<",
"String",
">",
"groups",
"=",
"Arrays",
".",
"asList",
"(",
"matcher",
".",
"group",
"(",
"MAJOR_INDEX",
")",
".",
"split",
"(",
"\"\\\\.\"",
")",
")",
";",
"final",
"String",
"extension",
"=",
"matcher",
".",
"group",
"(",
"EXTENSION_INDEX",
")",
"==",
"null",
"?",
"VersionNumber",
".",
"EMPTY_EXTENSION",
":",
"trimRight",
"(",
"matcher",
".",
"group",
"(",
"EXTENSION_INDEX",
")",
")",
";",
"result",
"=",
"new",
"VersionNumber",
"(",
"groups",
",",
"extension",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Interprets a string with version information. The first found group will be taken and processed.
@param version
version as string
@return an object of {@code VersionNumber}, never {@code null} | [
"Interprets",
"a",
"string",
"with",
"version",
"information",
".",
"The",
"first",
"found",
"group",
"will",
"be",
"taken",
"and",
"processed",
"."
] | train | https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/VersionParser.java#L346-L359 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterDecoder.java | CharacterDecoder.decodeBuffer | public void decodeBuffer(InputStream aStream, OutputStream bStream) throws IOException {
"""
Decode the text from the InputStream and write the decoded
octets to the OutputStream. This method runs until the stream
is exhausted.
@exception CEFormatException An error has occured while decoding
@exception CEStreamExhausted The input stream is unexpectedly out of data
"""
int i;
int totalBytes = 0;
PushbackInputStream ps = new PushbackInputStream (aStream);
decodeBufferPrefix(ps, bStream);
while (true) {
int length;
try {
length = decodeLinePrefix(ps, bStream);
for (i = 0; (i+bytesPerAtom()) < length; i += bytesPerAtom()) {
decodeAtom(ps, bStream, bytesPerAtom());
totalBytes += bytesPerAtom();
}
if ((i + bytesPerAtom()) == length) {
decodeAtom(ps, bStream, bytesPerAtom());
totalBytes += bytesPerAtom();
} else {
decodeAtom(ps, bStream, length - i);
totalBytes += (length - i);
}
decodeLineSuffix(ps, bStream);
} catch (CEStreamExhausted e) {
break;
}
}
decodeBufferSuffix(ps, bStream);
} | java | public void decodeBuffer(InputStream aStream, OutputStream bStream) throws IOException {
int i;
int totalBytes = 0;
PushbackInputStream ps = new PushbackInputStream (aStream);
decodeBufferPrefix(ps, bStream);
while (true) {
int length;
try {
length = decodeLinePrefix(ps, bStream);
for (i = 0; (i+bytesPerAtom()) < length; i += bytesPerAtom()) {
decodeAtom(ps, bStream, bytesPerAtom());
totalBytes += bytesPerAtom();
}
if ((i + bytesPerAtom()) == length) {
decodeAtom(ps, bStream, bytesPerAtom());
totalBytes += bytesPerAtom();
} else {
decodeAtom(ps, bStream, length - i);
totalBytes += (length - i);
}
decodeLineSuffix(ps, bStream);
} catch (CEStreamExhausted e) {
break;
}
}
decodeBufferSuffix(ps, bStream);
} | [
"public",
"void",
"decodeBuffer",
"(",
"InputStream",
"aStream",
",",
"OutputStream",
"bStream",
")",
"throws",
"IOException",
"{",
"int",
"i",
";",
"int",
"totalBytes",
"=",
"0",
";",
"PushbackInputStream",
"ps",
"=",
"new",
"PushbackInputStream",
"(",
"aStream",
")",
";",
"decodeBufferPrefix",
"(",
"ps",
",",
"bStream",
")",
";",
"while",
"(",
"true",
")",
"{",
"int",
"length",
";",
"try",
"{",
"length",
"=",
"decodeLinePrefix",
"(",
"ps",
",",
"bStream",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"(",
"i",
"+",
"bytesPerAtom",
"(",
")",
")",
"<",
"length",
";",
"i",
"+=",
"bytesPerAtom",
"(",
")",
")",
"{",
"decodeAtom",
"(",
"ps",
",",
"bStream",
",",
"bytesPerAtom",
"(",
")",
")",
";",
"totalBytes",
"+=",
"bytesPerAtom",
"(",
")",
";",
"}",
"if",
"(",
"(",
"i",
"+",
"bytesPerAtom",
"(",
")",
")",
"==",
"length",
")",
"{",
"decodeAtom",
"(",
"ps",
",",
"bStream",
",",
"bytesPerAtom",
"(",
")",
")",
";",
"totalBytes",
"+=",
"bytesPerAtom",
"(",
")",
";",
"}",
"else",
"{",
"decodeAtom",
"(",
"ps",
",",
"bStream",
",",
"length",
"-",
"i",
")",
";",
"totalBytes",
"+=",
"(",
"length",
"-",
"i",
")",
";",
"}",
"decodeLineSuffix",
"(",
"ps",
",",
"bStream",
")",
";",
"}",
"catch",
"(",
"CEStreamExhausted",
"e",
")",
"{",
"break",
";",
"}",
"}",
"decodeBufferSuffix",
"(",
"ps",
",",
"bStream",
")",
";",
"}"
] | Decode the text from the InputStream and write the decoded
octets to the OutputStream. This method runs until the stream
is exhausted.
@exception CEFormatException An error has occured while decoding
@exception CEStreamExhausted The input stream is unexpectedly out of data | [
"Decode",
"the",
"text",
"from",
"the",
"InputStream",
"and",
"write",
"the",
"decoded",
"octets",
"to",
"the",
"OutputStream",
".",
"This",
"method",
"runs",
"until",
"the",
"stream",
"is",
"exhausted",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterDecoder.java#L151-L179 |
UrielCh/ovh-java-sdk | ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java | ApiOvhVps.serviceName_backupftp_access_POST | public net.minidev.ovh.api.dedicated.server.OvhTask serviceName_backupftp_access_POST(String serviceName, Boolean cifs, Boolean ftp, String ipBlock, Boolean nfs) throws IOException {
"""
Create a new Backup FTP ACL
REST: POST /vps/{serviceName}/backupftp/access
@param ipBlock [required] The IP Block specific to this ACL. It musts belong to your server.
@param cifs [required] Wether to allow the CIFS (SMB) protocol for this ACL
@param nfs [required] Wether to allow the NFS protocol for this ACL
@param ftp [required] Wether to allow the FTP protocol for this ACL
@param serviceName [required] The internal name of your VPS offer
"""
String qPath = "/vps/{serviceName}/backupftp/access";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "cifs", cifs);
addBody(o, "ftp", ftp);
addBody(o, "ipBlock", ipBlock);
addBody(o, "nfs", nfs);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, net.minidev.ovh.api.dedicated.server.OvhTask.class);
} | java | public net.minidev.ovh.api.dedicated.server.OvhTask serviceName_backupftp_access_POST(String serviceName, Boolean cifs, Boolean ftp, String ipBlock, Boolean nfs) throws IOException {
String qPath = "/vps/{serviceName}/backupftp/access";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "cifs", cifs);
addBody(o, "ftp", ftp);
addBody(o, "ipBlock", ipBlock);
addBody(o, "nfs", nfs);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, net.minidev.ovh.api.dedicated.server.OvhTask.class);
} | [
"public",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"dedicated",
".",
"server",
".",
"OvhTask",
"serviceName_backupftp_access_POST",
"(",
"String",
"serviceName",
",",
"Boolean",
"cifs",
",",
"Boolean",
"ftp",
",",
"String",
"ipBlock",
",",
"Boolean",
"nfs",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/vps/{serviceName}/backupftp/access\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"cifs\"",
",",
"cifs",
")",
";",
"addBody",
"(",
"o",
",",
"\"ftp\"",
",",
"ftp",
")",
";",
"addBody",
"(",
"o",
",",
"\"ipBlock\"",
",",
"ipBlock",
")",
";",
"addBody",
"(",
"o",
",",
"\"nfs\"",
",",
"nfs",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"dedicated",
".",
"server",
".",
"OvhTask",
".",
"class",
")",
";",
"}"
] | Create a new Backup FTP ACL
REST: POST /vps/{serviceName}/backupftp/access
@param ipBlock [required] The IP Block specific to this ACL. It musts belong to your server.
@param cifs [required] Wether to allow the CIFS (SMB) protocol for this ACL
@param nfs [required] Wether to allow the NFS protocol for this ACL
@param ftp [required] Wether to allow the FTP protocol for this ACL
@param serviceName [required] The internal name of your VPS offer | [
"Create",
"a",
"new",
"Backup",
"FTP",
"ACL"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L792-L802 |
zk1931/jzab | src/main/java/com/github/zk1931/jzab/PersistentState.java | PersistentState.setLastSeenConfig | void setLastSeenConfig(ClusterConfiguration conf) throws IOException {
"""
Updates the last seen configuration.
@param conf the updated configuration.
@throws IOException in case of IO failure.
"""
String version = conf.getVersion().toSimpleString();
File file = new File(rootDir, String.format("cluster_config.%s", version));
FileUtils.writePropertiesToFile(conf.toProperties(), file);
// Since the new config file gets created, we need to fsync the directory.
fsyncDirectory();
} | java | void setLastSeenConfig(ClusterConfiguration conf) throws IOException {
String version = conf.getVersion().toSimpleString();
File file = new File(rootDir, String.format("cluster_config.%s", version));
FileUtils.writePropertiesToFile(conf.toProperties(), file);
// Since the new config file gets created, we need to fsync the directory.
fsyncDirectory();
} | [
"void",
"setLastSeenConfig",
"(",
"ClusterConfiguration",
"conf",
")",
"throws",
"IOException",
"{",
"String",
"version",
"=",
"conf",
".",
"getVersion",
"(",
")",
".",
"toSimpleString",
"(",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"rootDir",
",",
"String",
".",
"format",
"(",
"\"cluster_config.%s\"",
",",
"version",
")",
")",
";",
"FileUtils",
".",
"writePropertiesToFile",
"(",
"conf",
".",
"toProperties",
"(",
")",
",",
"file",
")",
";",
"// Since the new config file gets created, we need to fsync the directory.",
"fsyncDirectory",
"(",
")",
";",
"}"
] | Updates the last seen configuration.
@param conf the updated configuration.
@throws IOException in case of IO failure. | [
"Updates",
"the",
"last",
"seen",
"configuration",
"."
] | train | https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/PersistentState.java#L253-L259 |
Jasig/uPortal | uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/groupadmin/GroupAdministrationHelper.java | GroupAdministrationHelper.updateGroupMembers | public void updateGroupMembers(GroupForm groupForm, IPerson updater) {
"""
Update the members of an existing group in the group store.
@param groupForm Form representing the new group configuration
@param updater Updating user
"""
if (!canEditGroup(updater, groupForm.getKey())) {
throw new RuntimeAuthorizationException(
updater, IPermission.EDIT_GROUP_ACTIVITY, groupForm.getKey());
}
if (log.isDebugEnabled()) {
log.debug("Updating group members for group form [" + groupForm.toString() + "]");
}
// find the current version of this group entity
IEntityGroup group = GroupService.findGroup(groupForm.getKey());
// clear the current group membership list
for (IGroupMember child : group.getChildren()) {
group.removeChild(child);
}
// add all the group membership information from the group form
// to the group
for (JsonEntityBean child : groupForm.getMembers()) {
EntityEnum type = EntityEnum.getEntityEnum(child.getEntityTypeAsString());
if (type.isGroup()) {
IEntityGroup member = GroupService.findGroup(child.getId());
group.addChild(member);
} else {
IGroupMember member = GroupService.getGroupMember(child.getId(), type.getClazz());
group.addChild(member);
}
}
// save the group, updating both its basic information and group
// membership
group.updateMembers();
} | java | public void updateGroupMembers(GroupForm groupForm, IPerson updater) {
if (!canEditGroup(updater, groupForm.getKey())) {
throw new RuntimeAuthorizationException(
updater, IPermission.EDIT_GROUP_ACTIVITY, groupForm.getKey());
}
if (log.isDebugEnabled()) {
log.debug("Updating group members for group form [" + groupForm.toString() + "]");
}
// find the current version of this group entity
IEntityGroup group = GroupService.findGroup(groupForm.getKey());
// clear the current group membership list
for (IGroupMember child : group.getChildren()) {
group.removeChild(child);
}
// add all the group membership information from the group form
// to the group
for (JsonEntityBean child : groupForm.getMembers()) {
EntityEnum type = EntityEnum.getEntityEnum(child.getEntityTypeAsString());
if (type.isGroup()) {
IEntityGroup member = GroupService.findGroup(child.getId());
group.addChild(member);
} else {
IGroupMember member = GroupService.getGroupMember(child.getId(), type.getClazz());
group.addChild(member);
}
}
// save the group, updating both its basic information and group
// membership
group.updateMembers();
} | [
"public",
"void",
"updateGroupMembers",
"(",
"GroupForm",
"groupForm",
",",
"IPerson",
"updater",
")",
"{",
"if",
"(",
"!",
"canEditGroup",
"(",
"updater",
",",
"groupForm",
".",
"getKey",
"(",
")",
")",
")",
"{",
"throw",
"new",
"RuntimeAuthorizationException",
"(",
"updater",
",",
"IPermission",
".",
"EDIT_GROUP_ACTIVITY",
",",
"groupForm",
".",
"getKey",
"(",
")",
")",
";",
"}",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Updating group members for group form [\"",
"+",
"groupForm",
".",
"toString",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"// find the current version of this group entity",
"IEntityGroup",
"group",
"=",
"GroupService",
".",
"findGroup",
"(",
"groupForm",
".",
"getKey",
"(",
")",
")",
";",
"// clear the current group membership list",
"for",
"(",
"IGroupMember",
"child",
":",
"group",
".",
"getChildren",
"(",
")",
")",
"{",
"group",
".",
"removeChild",
"(",
"child",
")",
";",
"}",
"// add all the group membership information from the group form",
"// to the group",
"for",
"(",
"JsonEntityBean",
"child",
":",
"groupForm",
".",
"getMembers",
"(",
")",
")",
"{",
"EntityEnum",
"type",
"=",
"EntityEnum",
".",
"getEntityEnum",
"(",
"child",
".",
"getEntityTypeAsString",
"(",
")",
")",
";",
"if",
"(",
"type",
".",
"isGroup",
"(",
")",
")",
"{",
"IEntityGroup",
"member",
"=",
"GroupService",
".",
"findGroup",
"(",
"child",
".",
"getId",
"(",
")",
")",
";",
"group",
".",
"addChild",
"(",
"member",
")",
";",
"}",
"else",
"{",
"IGroupMember",
"member",
"=",
"GroupService",
".",
"getGroupMember",
"(",
"child",
".",
"getId",
"(",
")",
",",
"type",
".",
"getClazz",
"(",
")",
")",
";",
"group",
".",
"addChild",
"(",
"member",
")",
";",
"}",
"}",
"// save the group, updating both its basic information and group",
"// membership",
"group",
".",
"updateMembers",
"(",
")",
";",
"}"
] | Update the members of an existing group in the group store.
@param groupForm Form representing the new group configuration
@param updater Updating user | [
"Update",
"the",
"members",
"of",
"an",
"existing",
"group",
"in",
"the",
"group",
"store",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/groupadmin/GroupAdministrationHelper.java#L144-L179 |
lessthanoptimal/BoofCV | integration/boofcv-android/src/main/java/boofcv/android/camera/VideoRenderProcessing.java | VideoRenderProcessing.imageToOutput | protected void imageToOutput( double x , double y , Point2D_F64 pt ) {
"""
Converts a coordinate from pixel to the output image coordinates
"""
pt.x = x/scale - tranX/scale;
pt.y = y/scale - tranY/scale;
} | java | protected void imageToOutput( double x , double y , Point2D_F64 pt ) {
pt.x = x/scale - tranX/scale;
pt.y = y/scale - tranY/scale;
} | [
"protected",
"void",
"imageToOutput",
"(",
"double",
"x",
",",
"double",
"y",
",",
"Point2D_F64",
"pt",
")",
"{",
"pt",
".",
"x",
"=",
"x",
"/",
"scale",
"-",
"tranX",
"/",
"scale",
";",
"pt",
".",
"y",
"=",
"y",
"/",
"scale",
"-",
"tranY",
"/",
"scale",
";",
"}"
] | Converts a coordinate from pixel to the output image coordinates | [
"Converts",
"a",
"coordinate",
"from",
"pixel",
"to",
"the",
"output",
"image",
"coordinates"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/camera/VideoRenderProcessing.java#L139-L142 |
jeslopalo/flash-messages | flash-messages-thymeleaf/src/main/java/es/sandbox/ui/messages/thymeleaf/FlashMessagesElementTagProcessor.java | FlashMessagesElementTagProcessor.doProcess | @Override
protected void doProcess(ITemplateContext context, IProcessableElementTag tag, IElementTagStructureHandler structureHandler) {
"""
<pre>
<div data-level="${level}" class="alert alert-${level}">
<c:choose>
<c:when test="${fn:length(messages) gt 1}">
<ul>
<c:forEach var="message" items="${messages}">
<li data-timestamp="${message.timestamp}"><c:out value="${message.text}" escapeXml="false"/></li>
</c:forEach>
</ul>
</c:when>
<c:otherwise>
<c:forEach var="message" items="${messages}">
<span data-timestamp="${message.timestamp}"><c:out value="${message.text}" escapeXml="false"/></span>
</c:forEach>
</c:otherwise>
</c:choose>
</div>
</pre>
@param context
@param tag
@param structureHandler
"""
checkPreconditions(context, tag, structureHandler);
final WebEngineContext webEngineContext = (WebEngineContext) context;
final IModelFactory modelFactory = context.getModelFactory();
final IModel model = modelFactory.createModel();
final HttpServletRequest request = webEngineContext.getRequest();
final Context flashMessagesContext = context(request);
for (Level level : flashMessagesContext.levels()) {
final Collection<Message> messages = flashMessagesContext.levelMessages(level, request);
if (!messages.isEmpty()) {
model.addModel(levelMessages(level, messages, request, modelFactory));
}
}
/*
* Instruct the engine to replace this entire element with the specified model.
*/
structureHandler.replaceWith(model, false);
} | java | @Override
protected void doProcess(ITemplateContext context, IProcessableElementTag tag, IElementTagStructureHandler structureHandler) {
checkPreconditions(context, tag, structureHandler);
final WebEngineContext webEngineContext = (WebEngineContext) context;
final IModelFactory modelFactory = context.getModelFactory();
final IModel model = modelFactory.createModel();
final HttpServletRequest request = webEngineContext.getRequest();
final Context flashMessagesContext = context(request);
for (Level level : flashMessagesContext.levels()) {
final Collection<Message> messages = flashMessagesContext.levelMessages(level, request);
if (!messages.isEmpty()) {
model.addModel(levelMessages(level, messages, request, modelFactory));
}
}
/*
* Instruct the engine to replace this entire element with the specified model.
*/
structureHandler.replaceWith(model, false);
} | [
"@",
"Override",
"protected",
"void",
"doProcess",
"(",
"ITemplateContext",
"context",
",",
"IProcessableElementTag",
"tag",
",",
"IElementTagStructureHandler",
"structureHandler",
")",
"{",
"checkPreconditions",
"(",
"context",
",",
"tag",
",",
"structureHandler",
")",
";",
"final",
"WebEngineContext",
"webEngineContext",
"=",
"(",
"WebEngineContext",
")",
"context",
";",
"final",
"IModelFactory",
"modelFactory",
"=",
"context",
".",
"getModelFactory",
"(",
")",
";",
"final",
"IModel",
"model",
"=",
"modelFactory",
".",
"createModel",
"(",
")",
";",
"final",
"HttpServletRequest",
"request",
"=",
"webEngineContext",
".",
"getRequest",
"(",
")",
";",
"final",
"Context",
"flashMessagesContext",
"=",
"context",
"(",
"request",
")",
";",
"for",
"(",
"Level",
"level",
":",
"flashMessagesContext",
".",
"levels",
"(",
")",
")",
"{",
"final",
"Collection",
"<",
"Message",
">",
"messages",
"=",
"flashMessagesContext",
".",
"levelMessages",
"(",
"level",
",",
"request",
")",
";",
"if",
"(",
"!",
"messages",
".",
"isEmpty",
"(",
")",
")",
"{",
"model",
".",
"addModel",
"(",
"levelMessages",
"(",
"level",
",",
"messages",
",",
"request",
",",
"modelFactory",
")",
")",
";",
"}",
"}",
"/*\n * Instruct the engine to replace this entire element with the specified model.\n */",
"structureHandler",
".",
"replaceWith",
"(",
"model",
",",
"false",
")",
";",
"}"
] | <pre>
<div data-level="${level}" class="alert alert-${level}">
<c:choose>
<c:when test="${fn:length(messages) gt 1}">
<ul>
<c:forEach var="message" items="${messages}">
<li data-timestamp="${message.timestamp}"><c:out value="${message.text}" escapeXml="false"/></li>
</c:forEach>
</ul>
</c:when>
<c:otherwise>
<c:forEach var="message" items="${messages}">
<span data-timestamp="${message.timestamp}"><c:out value="${message.text}" escapeXml="false"/></span>
</c:forEach>
</c:otherwise>
</c:choose>
</div>
</pre>
@param context
@param tag
@param structureHandler | [
"<pre",
">",
"<div",
"data",
"-",
"level",
"=",
"$",
"{",
"level",
"}",
"class",
"=",
"alert",
"alert",
"-",
"$",
"{",
"level",
"}",
">",
"<c",
":",
"choose",
">",
"<c",
":",
"when",
"test",
"=",
"$",
"{",
"fn",
":",
"length",
"(",
"messages",
")",
"gt",
"1",
"}",
">",
"<ul",
">",
"<c",
":",
"forEach",
"var",
"=",
"message",
"items",
"=",
"$",
"{",
"messages",
"}",
">",
"<li",
"data",
"-",
"timestamp",
"=",
"$",
"{",
"message",
".",
"timestamp",
"}",
">",
"<c",
":",
"out",
"value",
"=",
"$",
"{",
"message",
".",
"text",
"}",
"escapeXml",
"=",
"false",
"/",
">",
"<",
"/",
"li",
">",
"<",
"/",
"c",
":",
"forEach",
">",
"<",
"/",
"ul",
">",
"<",
"/",
"c",
":",
"when",
">",
"<c",
":",
"otherwise",
">",
"<c",
":",
"forEach",
"var",
"=",
"message",
"items",
"=",
"$",
"{",
"messages",
"}",
">",
"<span",
"data",
"-",
"timestamp",
"=",
"$",
"{",
"message",
".",
"timestamp",
"}",
">",
"<c",
":",
"out",
"value",
"=",
"$",
"{",
"message",
".",
"text",
"}",
"escapeXml",
"=",
"false",
"/",
">",
"<",
"/",
"span",
">",
"<",
"/",
"c",
":",
"forEach",
">",
"<",
"/",
"c",
":",
"otherwise",
">",
"<",
"/",
"c",
":",
"choose",
">",
"<",
"/",
"div",
">",
"<",
"/",
"pre",
">"
] | train | https://github.com/jeslopalo/flash-messages/blob/2faf23b09a8f72803fb295f0e0fe1d57282224cf/flash-messages-thymeleaf/src/main/java/es/sandbox/ui/messages/thymeleaf/FlashMessagesElementTagProcessor.java#L79-L100 |
hawkular/hawkular-commons | hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java | MessageProcessor.createMessageWithBinaryData | protected Message createMessageWithBinaryData(ConnectionContext context, BasicMessage basicMessage,
InputStream inputStream) throws JMSException {
"""
Same as {@link #createMessage(ConnectionContext, BasicMessage, Map)} with <code>null</code> headers.
"""
return createMessageWithBinaryData(context, basicMessage, inputStream, null);
} | java | protected Message createMessageWithBinaryData(ConnectionContext context, BasicMessage basicMessage,
InputStream inputStream) throws JMSException {
return createMessageWithBinaryData(context, basicMessage, inputStream, null);
} | [
"protected",
"Message",
"createMessageWithBinaryData",
"(",
"ConnectionContext",
"context",
",",
"BasicMessage",
"basicMessage",
",",
"InputStream",
"inputStream",
")",
"throws",
"JMSException",
"{",
"return",
"createMessageWithBinaryData",
"(",
"context",
",",
"basicMessage",
",",
"inputStream",
",",
"null",
")",
";",
"}"
] | Same as {@link #createMessage(ConnectionContext, BasicMessage, Map)} with <code>null</code> headers. | [
"Same",
"as",
"{"
] | train | https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java#L418-L421 |
NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java | SecureDfuImpl.selectObject | private ObjectInfo selectObject(final int type)
throws DeviceDisconnectedException, DfuException, UploadAbortedException,
RemoteDfuException, UnknownResponseException {
"""
Selects the current object and reads its metadata. The object info contains the max object
size, and the offset and CRC32 of the whole object until now.
@return object info.
@throws DeviceDisconnectedException
@throws DfuException
@throws UploadAbortedException
@throws RemoteDfuException thrown when the returned status code is not equal to
{@link #DFU_STATUS_SUCCESS}.
"""
if (!mConnected)
throw new DeviceDisconnectedException("Unable to read object info: device disconnected");
OP_CODE_SELECT_OBJECT[1] = (byte) type;
writeOpCode(mControlPointCharacteristic, OP_CODE_SELECT_OBJECT);
final byte[] response = readNotificationResponse();
final int status = getStatusCode(response, OP_CODE_SELECT_OBJECT_KEY);
if (status == SecureDfuError.EXTENDED_ERROR)
throw new RemoteDfuExtendedErrorException("Selecting object failed", response[3]);
if (status != DFU_STATUS_SUCCESS)
throw new RemoteDfuException("Selecting object failed", status);
final ObjectInfo info = new ObjectInfo();
info.maxSize = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3);
info.offset = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3 + 4);
info.CRC32 = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3 + 8);
return info;
} | java | private ObjectInfo selectObject(final int type)
throws DeviceDisconnectedException, DfuException, UploadAbortedException,
RemoteDfuException, UnknownResponseException {
if (!mConnected)
throw new DeviceDisconnectedException("Unable to read object info: device disconnected");
OP_CODE_SELECT_OBJECT[1] = (byte) type;
writeOpCode(mControlPointCharacteristic, OP_CODE_SELECT_OBJECT);
final byte[] response = readNotificationResponse();
final int status = getStatusCode(response, OP_CODE_SELECT_OBJECT_KEY);
if (status == SecureDfuError.EXTENDED_ERROR)
throw new RemoteDfuExtendedErrorException("Selecting object failed", response[3]);
if (status != DFU_STATUS_SUCCESS)
throw new RemoteDfuException("Selecting object failed", status);
final ObjectInfo info = new ObjectInfo();
info.maxSize = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3);
info.offset = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3 + 4);
info.CRC32 = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3 + 8);
return info;
} | [
"private",
"ObjectInfo",
"selectObject",
"(",
"final",
"int",
"type",
")",
"throws",
"DeviceDisconnectedException",
",",
"DfuException",
",",
"UploadAbortedException",
",",
"RemoteDfuException",
",",
"UnknownResponseException",
"{",
"if",
"(",
"!",
"mConnected",
")",
"throw",
"new",
"DeviceDisconnectedException",
"(",
"\"Unable to read object info: device disconnected\"",
")",
";",
"OP_CODE_SELECT_OBJECT",
"[",
"1",
"]",
"=",
"(",
"byte",
")",
"type",
";",
"writeOpCode",
"(",
"mControlPointCharacteristic",
",",
"OP_CODE_SELECT_OBJECT",
")",
";",
"final",
"byte",
"[",
"]",
"response",
"=",
"readNotificationResponse",
"(",
")",
";",
"final",
"int",
"status",
"=",
"getStatusCode",
"(",
"response",
",",
"OP_CODE_SELECT_OBJECT_KEY",
")",
";",
"if",
"(",
"status",
"==",
"SecureDfuError",
".",
"EXTENDED_ERROR",
")",
"throw",
"new",
"RemoteDfuExtendedErrorException",
"(",
"\"Selecting object failed\"",
",",
"response",
"[",
"3",
"]",
")",
";",
"if",
"(",
"status",
"!=",
"DFU_STATUS_SUCCESS",
")",
"throw",
"new",
"RemoteDfuException",
"(",
"\"Selecting object failed\"",
",",
"status",
")",
";",
"final",
"ObjectInfo",
"info",
"=",
"new",
"ObjectInfo",
"(",
")",
";",
"info",
".",
"maxSize",
"=",
"mControlPointCharacteristic",
".",
"getIntValue",
"(",
"BluetoothGattCharacteristic",
".",
"FORMAT_UINT32",
",",
"3",
")",
";",
"info",
".",
"offset",
"=",
"mControlPointCharacteristic",
".",
"getIntValue",
"(",
"BluetoothGattCharacteristic",
".",
"FORMAT_UINT32",
",",
"3",
"+",
"4",
")",
";",
"info",
".",
"CRC32",
"=",
"mControlPointCharacteristic",
".",
"getIntValue",
"(",
"BluetoothGattCharacteristic",
".",
"FORMAT_UINT32",
",",
"3",
"+",
"8",
")",
";",
"return",
"info",
";",
"}"
] | Selects the current object and reads its metadata. The object info contains the max object
size, and the offset and CRC32 of the whole object until now.
@return object info.
@throws DeviceDisconnectedException
@throws DfuException
@throws UploadAbortedException
@throws RemoteDfuException thrown when the returned status code is not equal to
{@link #DFU_STATUS_SUCCESS}. | [
"Selects",
"the",
"current",
"object",
"and",
"reads",
"its",
"metadata",
".",
"The",
"object",
"info",
"contains",
"the",
"max",
"object",
"size",
"and",
"the",
"offset",
"and",
"CRC32",
"of",
"the",
"whole",
"object",
"until",
"now",
"."
] | train | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java#L836-L857 |
liferay/com-liferay-commerce | commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java | CommerceCurrencyPersistenceImpl.removeByG_P | @Override
public void removeByG_P(long groupId, boolean primary) {
"""
Removes all the commerce currencies where groupId = ? and primary = ? from the database.
@param groupId the group ID
@param primary the primary
"""
for (CommerceCurrency commerceCurrency : findByG_P(groupId, primary,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceCurrency);
}
} | java | @Override
public void removeByG_P(long groupId, boolean primary) {
for (CommerceCurrency commerceCurrency : findByG_P(groupId, primary,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceCurrency);
}
} | [
"@",
"Override",
"public",
"void",
"removeByG_P",
"(",
"long",
"groupId",
",",
"boolean",
"primary",
")",
"{",
"for",
"(",
"CommerceCurrency",
"commerceCurrency",
":",
"findByG_P",
"(",
"groupId",
",",
"primary",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
")",
"{",
"remove",
"(",
"commerceCurrency",
")",
";",
"}",
"}"
] | Removes all the commerce currencies where groupId = ? and primary = ? from the database.
@param groupId the group ID
@param primary the primary | [
"Removes",
"all",
"the",
"commerce",
"currencies",
"where",
"groupId",
"=",
"?",
";",
"and",
"primary",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java#L2719-L2725 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsLock.java | CmsLock.performSingleResourceOperation | protected void performSingleResourceOperation(String resourceName, int dialogAction) throws CmsException {
"""
Performs the lock state operation on a single resource.<p>
@param resourceName the resource name to perform the operation on
@param dialogAction the lock action: lock, unlock or change lock
@throws CmsException if the operation fails
"""
// store original name to use for lock action
String originalResourceName = resourceName;
CmsResource res = getCms().readResource(resourceName, CmsResourceFilter.ALL);
if (res.isFolder() && !resourceName.endsWith("/")) {
resourceName += "/";
}
org.opencms.lock.CmsLock lock = getCms().getLock(res);
// perform action depending on dialog uri
switch (dialogAction) {
case TYPE_LOCKCHANGE:
case TYPE_LOCK:
if (lock.isNullLock()) {
getCms().lockResource(originalResourceName);
} else if (!lock.isDirectlyOwnedInProjectBy(getCms())) {
getCms().changeLock(resourceName);
}
break;
case TYPE_UNLOCK:
default:
if (lock.isNullLock()) {
break;
}
if (lock.isOwnedBy(getCms().getRequestContext().getCurrentUser())) {
getCms().unlockResource(resourceName);
}
}
} | java | protected void performSingleResourceOperation(String resourceName, int dialogAction) throws CmsException {
// store original name to use for lock action
String originalResourceName = resourceName;
CmsResource res = getCms().readResource(resourceName, CmsResourceFilter.ALL);
if (res.isFolder() && !resourceName.endsWith("/")) {
resourceName += "/";
}
org.opencms.lock.CmsLock lock = getCms().getLock(res);
// perform action depending on dialog uri
switch (dialogAction) {
case TYPE_LOCKCHANGE:
case TYPE_LOCK:
if (lock.isNullLock()) {
getCms().lockResource(originalResourceName);
} else if (!lock.isDirectlyOwnedInProjectBy(getCms())) {
getCms().changeLock(resourceName);
}
break;
case TYPE_UNLOCK:
default:
if (lock.isNullLock()) {
break;
}
if (lock.isOwnedBy(getCms().getRequestContext().getCurrentUser())) {
getCms().unlockResource(resourceName);
}
}
} | [
"protected",
"void",
"performSingleResourceOperation",
"(",
"String",
"resourceName",
",",
"int",
"dialogAction",
")",
"throws",
"CmsException",
"{",
"// store original name to use for lock action",
"String",
"originalResourceName",
"=",
"resourceName",
";",
"CmsResource",
"res",
"=",
"getCms",
"(",
")",
".",
"readResource",
"(",
"resourceName",
",",
"CmsResourceFilter",
".",
"ALL",
")",
";",
"if",
"(",
"res",
".",
"isFolder",
"(",
")",
"&&",
"!",
"resourceName",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"resourceName",
"+=",
"\"/\"",
";",
"}",
"org",
".",
"opencms",
".",
"lock",
".",
"CmsLock",
"lock",
"=",
"getCms",
"(",
")",
".",
"getLock",
"(",
"res",
")",
";",
"// perform action depending on dialog uri",
"switch",
"(",
"dialogAction",
")",
"{",
"case",
"TYPE_LOCKCHANGE",
":",
"case",
"TYPE_LOCK",
":",
"if",
"(",
"lock",
".",
"isNullLock",
"(",
")",
")",
"{",
"getCms",
"(",
")",
".",
"lockResource",
"(",
"originalResourceName",
")",
";",
"}",
"else",
"if",
"(",
"!",
"lock",
".",
"isDirectlyOwnedInProjectBy",
"(",
"getCms",
"(",
")",
")",
")",
"{",
"getCms",
"(",
")",
".",
"changeLock",
"(",
"resourceName",
")",
";",
"}",
"break",
";",
"case",
"TYPE_UNLOCK",
":",
"default",
":",
"if",
"(",
"lock",
".",
"isNullLock",
"(",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"lock",
".",
"isOwnedBy",
"(",
"getCms",
"(",
")",
".",
"getRequestContext",
"(",
")",
".",
"getCurrentUser",
"(",
")",
")",
")",
"{",
"getCms",
"(",
")",
".",
"unlockResource",
"(",
"resourceName",
")",
";",
"}",
"}",
"}"
] | Performs the lock state operation on a single resource.<p>
@param resourceName the resource name to perform the operation on
@param dialogAction the lock action: lock, unlock or change lock
@throws CmsException if the operation fails | [
"Performs",
"the",
"lock",
"state",
"operation",
"on",
"a",
"single",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsLock.java#L975-L1003 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/problems/constraints/validations/UnanimousValidation.java | UnanimousValidation.addValidation | public void addValidation(Object key, Validation validation) {
"""
Add a validation object. A key is required that can be used to retrieve the validation object.
@param key key used to retrieve the validation object
@param validation validation object
"""
initMapOnce();
validations.put(key, validation);
// update aggregated value
passedAll = passedAll && validation.passed();
} | java | public void addValidation(Object key, Validation validation){
initMapOnce();
validations.put(key, validation);
// update aggregated value
passedAll = passedAll && validation.passed();
} | [
"public",
"void",
"addValidation",
"(",
"Object",
"key",
",",
"Validation",
"validation",
")",
"{",
"initMapOnce",
"(",
")",
";",
"validations",
".",
"put",
"(",
"key",
",",
"validation",
")",
";",
"// update aggregated value",
"passedAll",
"=",
"passedAll",
"&&",
"validation",
".",
"passed",
"(",
")",
";",
"}"
] | Add a validation object. A key is required that can be used to retrieve the validation object.
@param key key used to retrieve the validation object
@param validation validation object | [
"Add",
"a",
"validation",
"object",
".",
"A",
"key",
"is",
"required",
"that",
"can",
"be",
"used",
"to",
"retrieve",
"the",
"validation",
"object",
"."
] | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/problems/constraints/validations/UnanimousValidation.java#L60-L65 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java | DatabaseUtils.appendEscapedSQLString | public static void appendEscapedSQLString(StringBuilder sb, String sqlString) {
"""
Appends an SQL string to the given StringBuilder, including the opening
and closing single quotes. Any single quotes internal to sqlString will
be escaped.
This method is deprecated because we want to encourage everyone
to use the "?" binding form. However, when implementing a
ContentProvider, one may want to add WHERE clauses that were
not provided by the caller. Since "?" is a positional form,
using it in this case could break the caller because the
indexes would be shifted to accomodate the ContentProvider's
internal bindings. In that case, it may be necessary to
construct a WHERE clause manually. This method is useful for
those cases.
@param sb the StringBuilder that the SQL string will be appended to
@param sqlString the raw string to be appended, which may contain single
quotes
"""
sb.append('\'');
if (sqlString.indexOf('\'') != -1) {
int length = sqlString.length();
for (int i = 0; i < length; i++) {
char c = sqlString.charAt(i);
if (c == '\'') {
sb.append('\'');
}
sb.append(c);
}
} else
sb.append(sqlString);
sb.append('\'');
} | java | public static void appendEscapedSQLString(StringBuilder sb, String sqlString) {
sb.append('\'');
if (sqlString.indexOf('\'') != -1) {
int length = sqlString.length();
for (int i = 0; i < length; i++) {
char c = sqlString.charAt(i);
if (c == '\'') {
sb.append('\'');
}
sb.append(c);
}
} else
sb.append(sqlString);
sb.append('\'');
} | [
"public",
"static",
"void",
"appendEscapedSQLString",
"(",
"StringBuilder",
"sb",
",",
"String",
"sqlString",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"if",
"(",
"sqlString",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"{",
"int",
"length",
"=",
"sqlString",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"sqlString",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"sb",
".",
"append",
"(",
"c",
")",
";",
"}",
"}",
"else",
"sb",
".",
"append",
"(",
"sqlString",
")",
";",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"}"
] | Appends an SQL string to the given StringBuilder, including the opening
and closing single quotes. Any single quotes internal to sqlString will
be escaped.
This method is deprecated because we want to encourage everyone
to use the "?" binding form. However, when implementing a
ContentProvider, one may want to add WHERE clauses that were
not provided by the caller. Since "?" is a positional form,
using it in this case could break the caller because the
indexes would be shifted to accomodate the ContentProvider's
internal bindings. In that case, it may be necessary to
construct a WHERE clause manually. This method is useful for
those cases.
@param sb the StringBuilder that the SQL string will be appended to
@param sqlString the raw string to be appended, which may contain single
quotes | [
"Appends",
"an",
"SQL",
"string",
"to",
"the",
"given",
"StringBuilder",
"including",
"the",
"opening",
"and",
"closing",
"single",
"quotes",
".",
"Any",
"single",
"quotes",
"internal",
"to",
"sqlString",
"will",
"be",
"escaped",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L343-L357 |
facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java | ImagePipeline.fetchEncodedImage | public DataSource<CloseableReference<PooledByteBuffer>> fetchEncodedImage(
ImageRequest imageRequest,
Object callerContext) {
"""
Submits a request for execution and returns a DataSource representing the pending encoded
image(s).
<p> The ResizeOptions in the imageRequest will be ignored for this fetch
<p>The returned DataSource must be closed once the client has finished with it.
@param imageRequest the request to submit
@return a DataSource representing the pending encoded image(s)
"""
return fetchEncodedImage(imageRequest, callerContext, null);
} | java | public DataSource<CloseableReference<PooledByteBuffer>> fetchEncodedImage(
ImageRequest imageRequest,
Object callerContext) {
return fetchEncodedImage(imageRequest, callerContext, null);
} | [
"public",
"DataSource",
"<",
"CloseableReference",
"<",
"PooledByteBuffer",
">",
">",
"fetchEncodedImage",
"(",
"ImageRequest",
"imageRequest",
",",
"Object",
"callerContext",
")",
"{",
"return",
"fetchEncodedImage",
"(",
"imageRequest",
",",
"callerContext",
",",
"null",
")",
";",
"}"
] | Submits a request for execution and returns a DataSource representing the pending encoded
image(s).
<p> The ResizeOptions in the imageRequest will be ignored for this fetch
<p>The returned DataSource must be closed once the client has finished with it.
@param imageRequest the request to submit
@return a DataSource representing the pending encoded image(s) | [
"Submits",
"a",
"request",
"for",
"execution",
"and",
"returns",
"a",
"DataSource",
"representing",
"the",
"pending",
"encoded",
"image",
"(",
"s",
")",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java#L296-L300 |
alkacon/opencms-core | src/org/opencms/ade/containerpage/CmsDetailOnlyContainerUtil.java | CmsDetailOnlyContainerUtil.getDetailOnlyPageName | public static String getDetailOnlyPageName(
CmsObject cms,
CmsResource pageResource,
String detailPath,
String locale) {
"""
Returns the site/root path to the detail only container page, for site/root path of the detail content.<p>
@param cms the current cms context
@param pageResource the detail page resource
@param detailPath the site or root path to the detail content (accordingly site or root path's will be returned)
@param locale the locale for which we want the detail only page
@return the site or root path to the detail only container page (dependent on providing site or root path for the detailPath).
"""
return getDetailOnlyPageNameWithoutLocaleCheck(detailPath, getDetailContainerLocale(cms, locale, pageResource));
} | java | public static String getDetailOnlyPageName(
CmsObject cms,
CmsResource pageResource,
String detailPath,
String locale) {
return getDetailOnlyPageNameWithoutLocaleCheck(detailPath, getDetailContainerLocale(cms, locale, pageResource));
} | [
"public",
"static",
"String",
"getDetailOnlyPageName",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"pageResource",
",",
"String",
"detailPath",
",",
"String",
"locale",
")",
"{",
"return",
"getDetailOnlyPageNameWithoutLocaleCheck",
"(",
"detailPath",
",",
"getDetailContainerLocale",
"(",
"cms",
",",
"locale",
",",
"pageResource",
")",
")",
";",
"}"
] | Returns the site/root path to the detail only container page, for site/root path of the detail content.<p>
@param cms the current cms context
@param pageResource the detail page resource
@param detailPath the site or root path to the detail content (accordingly site or root path's will be returned)
@param locale the locale for which we want the detail only page
@return the site or root path to the detail only container page (dependent on providing site or root path for the detailPath). | [
"Returns",
"the",
"site",
"/",
"root",
"path",
"to",
"the",
"detail",
"only",
"container",
"page",
"for",
"site",
"/",
"root",
"path",
"of",
"the",
"detail",
"content",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsDetailOnlyContainerUtil.java#L234-L241 |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.validateModality | private void validateModality(SqlNode query) {
"""
Validates that a query can deliver the modality it promises. Only called
on the top-most SELECT or set operator in the tree.
"""
final SqlModality modality = deduceModality(query);
if (query instanceof SqlSelect) {
final SqlSelect select = (SqlSelect) query;
validateModality(select, modality, true);
} else if (query.getKind() == SqlKind.VALUES) {
switch (modality) {
case STREAM:
throw newValidationError(query, Static.RESOURCE.cannotStreamValues());
}
} else {
assert query.isA(SqlKind.SET_QUERY);
final SqlCall call = (SqlCall) query;
for (SqlNode operand : call.getOperandList()) {
if (deduceModality(operand) != modality) {
throw newValidationError(operand,
Static.RESOURCE.streamSetOpInconsistentInputs());
}
validateModality(operand);
}
}
} | java | private void validateModality(SqlNode query) {
final SqlModality modality = deduceModality(query);
if (query instanceof SqlSelect) {
final SqlSelect select = (SqlSelect) query;
validateModality(select, modality, true);
} else if (query.getKind() == SqlKind.VALUES) {
switch (modality) {
case STREAM:
throw newValidationError(query, Static.RESOURCE.cannotStreamValues());
}
} else {
assert query.isA(SqlKind.SET_QUERY);
final SqlCall call = (SqlCall) query;
for (SqlNode operand : call.getOperandList()) {
if (deduceModality(operand) != modality) {
throw newValidationError(operand,
Static.RESOURCE.streamSetOpInconsistentInputs());
}
validateModality(operand);
}
}
} | [
"private",
"void",
"validateModality",
"(",
"SqlNode",
"query",
")",
"{",
"final",
"SqlModality",
"modality",
"=",
"deduceModality",
"(",
"query",
")",
";",
"if",
"(",
"query",
"instanceof",
"SqlSelect",
")",
"{",
"final",
"SqlSelect",
"select",
"=",
"(",
"SqlSelect",
")",
"query",
";",
"validateModality",
"(",
"select",
",",
"modality",
",",
"true",
")",
";",
"}",
"else",
"if",
"(",
"query",
".",
"getKind",
"(",
")",
"==",
"SqlKind",
".",
"VALUES",
")",
"{",
"switch",
"(",
"modality",
")",
"{",
"case",
"STREAM",
":",
"throw",
"newValidationError",
"(",
"query",
",",
"Static",
".",
"RESOURCE",
".",
"cannotStreamValues",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"assert",
"query",
".",
"isA",
"(",
"SqlKind",
".",
"SET_QUERY",
")",
";",
"final",
"SqlCall",
"call",
"=",
"(",
"SqlCall",
")",
"query",
";",
"for",
"(",
"SqlNode",
"operand",
":",
"call",
".",
"getOperandList",
"(",
")",
")",
"{",
"if",
"(",
"deduceModality",
"(",
"operand",
")",
"!=",
"modality",
")",
"{",
"throw",
"newValidationError",
"(",
"operand",
",",
"Static",
".",
"RESOURCE",
".",
"streamSetOpInconsistentInputs",
"(",
")",
")",
";",
"}",
"validateModality",
"(",
"operand",
")",
";",
"}",
"}",
"}"
] | Validates that a query can deliver the modality it promises. Only called
on the top-most SELECT or set operator in the tree. | [
"Validates",
"that",
"a",
"query",
"can",
"deliver",
"the",
"modality",
"it",
"promises",
".",
"Only",
"called",
"on",
"the",
"top",
"-",
"most",
"SELECT",
"or",
"set",
"operator",
"in",
"the",
"tree",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3550-L3571 |
paymill/paymill-java | src/main/java/com/paymill/services/TransactionService.java | TransactionService.createWithPaymentAndClient | public Transaction createWithPaymentAndClient( Payment payment, Client client, Integer amount, String currency ) {
"""
Executes a {@link Transaction} with {@link Payment} for the given amount in the given currency.
@param payment
A PAYMILL {@link Payment} representing credit card or direct debit.
@param client
The PAYMILL {@link Client} which have to be charged.
@param amount
Amount (in cents) which will be charged.
@param currency
ISO 4217 formatted currency code.
@return {@link Transaction} object indicating whether a the call was successful or not.
"""
return this.createWithPaymentAndClient( payment, client, amount, currency, null );
} | java | public Transaction createWithPaymentAndClient( Payment payment, Client client, Integer amount, String currency ) {
return this.createWithPaymentAndClient( payment, client, amount, currency, null );
} | [
"public",
"Transaction",
"createWithPaymentAndClient",
"(",
"Payment",
"payment",
",",
"Client",
"client",
",",
"Integer",
"amount",
",",
"String",
"currency",
")",
"{",
"return",
"this",
".",
"createWithPaymentAndClient",
"(",
"payment",
",",
"client",
",",
"amount",
",",
"currency",
",",
"null",
")",
";",
"}"
] | Executes a {@link Transaction} with {@link Payment} for the given amount in the given currency.
@param payment
A PAYMILL {@link Payment} representing credit card or direct debit.
@param client
The PAYMILL {@link Client} which have to be charged.
@param amount
Amount (in cents) which will be charged.
@param currency
ISO 4217 formatted currency code.
@return {@link Transaction} object indicating whether a the call was successful or not. | [
"Executes",
"a",
"{"
] | train | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/TransactionService.java#L258-L260 |
ops4j/org.ops4j.pax.logging | pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java | ThrowableProxy.formatWrapper | public void formatWrapper(final StringBuilder sb, final ThrowableProxy cause, final String suffix) {
"""
Formats the specified Throwable.
@param sb StringBuilder to contain the formatted Throwable.
@param cause The Throwable to format.
@param suffix
"""
this.formatWrapper(sb, cause, null, PlainTextRenderer.getInstance(), suffix);
} | java | public void formatWrapper(final StringBuilder sb, final ThrowableProxy cause, final String suffix) {
this.formatWrapper(sb, cause, null, PlainTextRenderer.getInstance(), suffix);
} | [
"public",
"void",
"formatWrapper",
"(",
"final",
"StringBuilder",
"sb",
",",
"final",
"ThrowableProxy",
"cause",
",",
"final",
"String",
"suffix",
")",
"{",
"this",
".",
"formatWrapper",
"(",
"sb",
",",
"cause",
",",
"null",
",",
"PlainTextRenderer",
".",
"getInstance",
"(",
")",
",",
"suffix",
")",
";",
"}"
] | Formats the specified Throwable.
@param sb StringBuilder to contain the formatted Throwable.
@param cause The Throwable to format.
@param suffix | [
"Formats",
"the",
"specified",
"Throwable",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java#L349-L351 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/pca/PCARunner.java | PCARunner.processIds | public PCAResult processIds(DBIDs ids, Relation<? extends NumberVector> database) {
"""
Run PCA on a collection of database IDs.
@param ids a collection of ids
@param database the database used
@return PCA result
"""
return processCovarMatrix(covarianceMatrixBuilder.processIds(ids, database));
} | java | public PCAResult processIds(DBIDs ids, Relation<? extends NumberVector> database) {
return processCovarMatrix(covarianceMatrixBuilder.processIds(ids, database));
} | [
"public",
"PCAResult",
"processIds",
"(",
"DBIDs",
"ids",
",",
"Relation",
"<",
"?",
"extends",
"NumberVector",
">",
"database",
")",
"{",
"return",
"processCovarMatrix",
"(",
"covarianceMatrixBuilder",
".",
"processIds",
"(",
"ids",
",",
"database",
")",
")",
";",
"}"
] | Run PCA on a collection of database IDs.
@param ids a collection of ids
@param database the database used
@return PCA result | [
"Run",
"PCA",
"on",
"a",
"collection",
"of",
"database",
"IDs",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/pca/PCARunner.java#L73-L75 |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/parser/ArgumentsAdapter.java | ArgumentsAdapter.isKwarg | private boolean isKwarg(Map<String, Object> arg) {
"""
Checks whether an object argument is kwarg.
Object argument is kwarg if it contains __kwarg__ property set to true.
@param arg object argument to be tested
@return true if object argument is kwarg
"""
Object kwarg = arg.get(KWARG_KEY);
return kwarg != null
&& kwarg instanceof Boolean
&& ((Boolean) kwarg);
} | java | private boolean isKwarg(Map<String, Object> arg) {
Object kwarg = arg.get(KWARG_KEY);
return kwarg != null
&& kwarg instanceof Boolean
&& ((Boolean) kwarg);
} | [
"private",
"boolean",
"isKwarg",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"arg",
")",
"{",
"Object",
"kwarg",
"=",
"arg",
".",
"get",
"(",
"KWARG_KEY",
")",
";",
"return",
"kwarg",
"!=",
"null",
"&&",
"kwarg",
"instanceof",
"Boolean",
"&&",
"(",
"(",
"Boolean",
")",
"kwarg",
")",
";",
"}"
] | Checks whether an object argument is kwarg.
Object argument is kwarg if it contains __kwarg__ property set to true.
@param arg object argument to be tested
@return true if object argument is kwarg | [
"Checks",
"whether",
"an",
"object",
"argument",
"is",
"kwarg",
".",
"Object",
"argument",
"is",
"kwarg",
"if",
"it",
"contains",
"__kwarg__",
"property",
"set",
"to",
"true",
"."
] | train | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/parser/ArgumentsAdapter.java#L77-L82 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/SoftDeleteDetailHandler.java | SoftDeleteDetailHandler.init | public void init(Record record, BaseField fldDeleteFlag, Record recDetail) {
"""
Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()).
"""
m_fldDeleteFlag = fldDeleteFlag;
m_recDetail = recDetail;
super.init(record);
} | java | public void init(Record record, BaseField fldDeleteFlag, Record recDetail)
{
m_fldDeleteFlag = fldDeleteFlag;
m_recDetail = recDetail;
super.init(record);
} | [
"public",
"void",
"init",
"(",
"Record",
"record",
",",
"BaseField",
"fldDeleteFlag",
",",
"Record",
"recDetail",
")",
"{",
"m_fldDeleteFlag",
"=",
"fldDeleteFlag",
";",
"m_recDetail",
"=",
"recDetail",
";",
"super",
".",
"init",
"(",
"record",
")",
";",
"}"
] | Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()). | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SoftDeleteDetailHandler.java#L57-L62 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseSquareMatrix.java | SparseSquareMatrix.get | public double get(int i, int j) {
"""
access a value at i,j
@param i
@param j
@return return A[i][j]
"""
if (i < 0 || i >= N) throw new IllegalArgumentException("Illegal index " + i + " should be > 0 and < " + N);
if (j < 0 || j >= N) throw new IllegalArgumentException("Illegal index " + j + " should be > 0 and < " + N);
return rows[i].get(j);
} | java | public double get(int i, int j) {
if (i < 0 || i >= N) throw new IllegalArgumentException("Illegal index " + i + " should be > 0 and < " + N);
if (j < 0 || j >= N) throw new IllegalArgumentException("Illegal index " + j + " should be > 0 and < " + N);
return rows[i].get(j);
} | [
"public",
"double",
"get",
"(",
"int",
"i",
",",
"int",
"j",
")",
"{",
"if",
"(",
"i",
"<",
"0",
"||",
"i",
">=",
"N",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illegal index \"",
"+",
"i",
"+",
"\" should be > 0 and < \"",
"+",
"N",
")",
";",
"if",
"(",
"j",
"<",
"0",
"||",
"j",
">=",
"N",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illegal index \"",
"+",
"j",
"+",
"\" should be > 0 and < \"",
"+",
"N",
")",
";",
"return",
"rows",
"[",
"i",
"]",
".",
"get",
"(",
"j",
")",
";",
"}"
] | access a value at i,j
@param i
@param j
@return return A[i][j] | [
"access",
"a",
"value",
"at",
"i",
"j"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseSquareMatrix.java#L87-L93 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/List.java | List.setItemList | public void setItemList(int i, ListItem v) {
"""
indexed setter for itemList - sets an indexed value - contains items of the level 1. The items of the level 1 could contain further items of next level and so on in order to represent an iterative structure of list items.
@generated
@param i index in the array to set
@param v value to set into the array
"""
if (List_Type.featOkTst && ((List_Type)jcasType).casFeat_itemList == null)
jcasType.jcas.throwFeatMissing("itemList", "de.julielab.jules.types.List");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((List_Type)jcasType).casFeatCode_itemList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((List_Type)jcasType).casFeatCode_itemList), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setItemList(int i, ListItem v) {
if (List_Type.featOkTst && ((List_Type)jcasType).casFeat_itemList == null)
jcasType.jcas.throwFeatMissing("itemList", "de.julielab.jules.types.List");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((List_Type)jcasType).casFeatCode_itemList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((List_Type)jcasType).casFeatCode_itemList), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setItemList",
"(",
"int",
"i",
",",
"ListItem",
"v",
")",
"{",
"if",
"(",
"List_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"List_Type",
")",
"jcasType",
")",
".",
"casFeat_itemList",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"throwFeatMissing",
"(",
"\"itemList\"",
",",
"\"de.julielab.jules.types.List\"",
")",
";",
"jcasType",
".",
"jcas",
".",
"checkArrayBounds",
"(",
"jcasType",
".",
"ll_cas",
".",
"ll_getRefValue",
"(",
"addr",
",",
"(",
"(",
"List_Type",
")",
"jcasType",
")",
".",
"casFeatCode_itemList",
")",
",",
"i",
")",
";",
"jcasType",
".",
"ll_cas",
".",
"ll_setRefArrayValue",
"(",
"jcasType",
".",
"ll_cas",
".",
"ll_getRefValue",
"(",
"addr",
",",
"(",
"(",
"List_Type",
")",
"jcasType",
")",
".",
"casFeatCode_itemList",
")",
",",
"i",
",",
"jcasType",
".",
"ll_cas",
".",
"ll_getFSRef",
"(",
"v",
")",
")",
";",
"}"
] | indexed setter for itemList - sets an indexed value - contains items of the level 1. The items of the level 1 could contain further items of next level and so on in order to represent an iterative structure of list items.
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"itemList",
"-",
"sets",
"an",
"indexed",
"value",
"-",
"contains",
"items",
"of",
"the",
"level",
"1",
".",
"The",
"items",
"of",
"the",
"level",
"1",
"could",
"contain",
"further",
"items",
"of",
"next",
"level",
"and",
"so",
"on",
"in",
"order",
"to",
"represent",
"an",
"iterative",
"structure",
"of",
"list",
"items",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/List.java#L116-L120 |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionManagerException.java | SessionManagerException.fromThrowable | public static SessionManagerException fromThrowable(String message, Throwable cause) {
"""
Converts a Throwable to a SessionManagerException with the specified detail message. If the
Throwable is a SessionManagerException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new SessionManagerException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a SessionManagerException
"""
return (cause instanceof SessionManagerException && Objects.equals(message, cause.getMessage()))
? (SessionManagerException) cause
: new SessionManagerException(message, cause);
} | java | public static SessionManagerException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionManagerException && Objects.equals(message, cause.getMessage()))
? (SessionManagerException) cause
: new SessionManagerException(message, cause);
} | [
"public",
"static",
"SessionManagerException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionManagerException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMessage",
"(",
")",
")",
")",
"?",
"(",
"SessionManagerException",
")",
"cause",
":",
"new",
"SessionManagerException",
"(",
"message",
",",
"cause",
")",
";",
"}"
] | Converts a Throwable to a SessionManagerException with the specified detail message. If the
Throwable is a SessionManagerException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new SessionManagerException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a SessionManagerException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionManagerException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionManagerException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the",
"one",
"supplied",
"the",
"Throwable",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",
"SessionManagerException",
"with",
"the",
"detail",
"message",
"."
] | train | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionManagerException.java#L62-L66 |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/jts_utils/Voronoi.java | Voronoi.generateTriangleNeighbors | public Triple[] generateTriangleNeighbors(Geometry geometry) throws TopologyException {
"""
Given the input TIN, construct a graph of triangle.
@param geometry Collection of Polygon with 3 vertex.
@return Array of triangle neighbors. Order and count is the same of the input array.
@throws TopologyException If incompatible type geometry is given
"""
inputTriangles = geometry;
CoordinateSequenceDimensionFilter sequenceDimensionFilter = new CoordinateSequenceDimensionFilter();
geometry.apply(sequenceDimensionFilter);
hasZ = sequenceDimensionFilter.getDimension() == CoordinateSequenceDimensionFilter.XYZ;
Quadtree ptQuad = new Quadtree();
// In order to compute triangle neighbors we have to set a unique id to points.
triangleVertex = new Triple[geometry.getNumGeometries()];
// Final size of tri vertex is not known at the moment. Give just an hint
triVertex = new ArrayList<EnvelopeWithIndex>(triangleVertex.length);
// First Loop make an index of triangle vertex
for(int idgeom = 0; idgeom < triangleVertex.length; idgeom++) {
Geometry geomItem = geometry.getGeometryN(idgeom);
if(geomItem instanceof Polygon) {
Coordinate[] coords = geomItem.getCoordinates();
if(coords.length != 4) {
throw new TopologyException("Voronoi method accept only triangles");
}
triangleVertex[idgeom] = new Triple(getOrAppendVertex(coords[0], ptQuad),
getOrAppendVertex(coords[1], ptQuad), getOrAppendVertex(coords[2], ptQuad));
for(int triVertexIndex : triangleVertex[idgeom].toArray()) {
triVertex.get(triVertexIndex).addSharingTriangle(idgeom);
}
} else {
throw new TopologyException("Voronoi method accept only polygons");
}
}
// Second loop make an index of triangle neighbors
ptQuad = null;
triangleNeighbors = new Triple[geometry.getNumGeometries()];
for(int triId = 0; triId< triangleVertex.length; triId++) {
Triple triangleIndex = triangleVertex[triId];
triangleNeighbors[triId] = new Triple(commonEdge(triId,triVertex.get(triangleIndex.getB()), triVertex.get(triangleIndex.getC())),
commonEdge(triId,triVertex.get(triangleIndex.getA()), triVertex.get(triangleIndex.getC())),
commonEdge(triId,triVertex.get(triangleIndex.getB()), triVertex.get(triangleIndex.getA())));
}
triVertex.clear();
return triangleNeighbors;
} | java | public Triple[] generateTriangleNeighbors(Geometry geometry) throws TopologyException {
inputTriangles = geometry;
CoordinateSequenceDimensionFilter sequenceDimensionFilter = new CoordinateSequenceDimensionFilter();
geometry.apply(sequenceDimensionFilter);
hasZ = sequenceDimensionFilter.getDimension() == CoordinateSequenceDimensionFilter.XYZ;
Quadtree ptQuad = new Quadtree();
// In order to compute triangle neighbors we have to set a unique id to points.
triangleVertex = new Triple[geometry.getNumGeometries()];
// Final size of tri vertex is not known at the moment. Give just an hint
triVertex = new ArrayList<EnvelopeWithIndex>(triangleVertex.length);
// First Loop make an index of triangle vertex
for(int idgeom = 0; idgeom < triangleVertex.length; idgeom++) {
Geometry geomItem = geometry.getGeometryN(idgeom);
if(geomItem instanceof Polygon) {
Coordinate[] coords = geomItem.getCoordinates();
if(coords.length != 4) {
throw new TopologyException("Voronoi method accept only triangles");
}
triangleVertex[idgeom] = new Triple(getOrAppendVertex(coords[0], ptQuad),
getOrAppendVertex(coords[1], ptQuad), getOrAppendVertex(coords[2], ptQuad));
for(int triVertexIndex : triangleVertex[idgeom].toArray()) {
triVertex.get(triVertexIndex).addSharingTriangle(idgeom);
}
} else {
throw new TopologyException("Voronoi method accept only polygons");
}
}
// Second loop make an index of triangle neighbors
ptQuad = null;
triangleNeighbors = new Triple[geometry.getNumGeometries()];
for(int triId = 0; triId< triangleVertex.length; triId++) {
Triple triangleIndex = triangleVertex[triId];
triangleNeighbors[triId] = new Triple(commonEdge(triId,triVertex.get(triangleIndex.getB()), triVertex.get(triangleIndex.getC())),
commonEdge(triId,triVertex.get(triangleIndex.getA()), triVertex.get(triangleIndex.getC())),
commonEdge(triId,triVertex.get(triangleIndex.getB()), triVertex.get(triangleIndex.getA())));
}
triVertex.clear();
return triangleNeighbors;
} | [
"public",
"Triple",
"[",
"]",
"generateTriangleNeighbors",
"(",
"Geometry",
"geometry",
")",
"throws",
"TopologyException",
"{",
"inputTriangles",
"=",
"geometry",
";",
"CoordinateSequenceDimensionFilter",
"sequenceDimensionFilter",
"=",
"new",
"CoordinateSequenceDimensionFilter",
"(",
")",
";",
"geometry",
".",
"apply",
"(",
"sequenceDimensionFilter",
")",
";",
"hasZ",
"=",
"sequenceDimensionFilter",
".",
"getDimension",
"(",
")",
"==",
"CoordinateSequenceDimensionFilter",
".",
"XYZ",
";",
"Quadtree",
"ptQuad",
"=",
"new",
"Quadtree",
"(",
")",
";",
"// In order to compute triangle neighbors we have to set a unique id to points.",
"triangleVertex",
"=",
"new",
"Triple",
"[",
"geometry",
".",
"getNumGeometries",
"(",
")",
"]",
";",
"// Final size of tri vertex is not known at the moment. Give just an hint",
"triVertex",
"=",
"new",
"ArrayList",
"<",
"EnvelopeWithIndex",
">",
"(",
"triangleVertex",
".",
"length",
")",
";",
"// First Loop make an index of triangle vertex",
"for",
"(",
"int",
"idgeom",
"=",
"0",
";",
"idgeom",
"<",
"triangleVertex",
".",
"length",
";",
"idgeom",
"++",
")",
"{",
"Geometry",
"geomItem",
"=",
"geometry",
".",
"getGeometryN",
"(",
"idgeom",
")",
";",
"if",
"(",
"geomItem",
"instanceof",
"Polygon",
")",
"{",
"Coordinate",
"[",
"]",
"coords",
"=",
"geomItem",
".",
"getCoordinates",
"(",
")",
";",
"if",
"(",
"coords",
".",
"length",
"!=",
"4",
")",
"{",
"throw",
"new",
"TopologyException",
"(",
"\"Voronoi method accept only triangles\"",
")",
";",
"}",
"triangleVertex",
"[",
"idgeom",
"]",
"=",
"new",
"Triple",
"(",
"getOrAppendVertex",
"(",
"coords",
"[",
"0",
"]",
",",
"ptQuad",
")",
",",
"getOrAppendVertex",
"(",
"coords",
"[",
"1",
"]",
",",
"ptQuad",
")",
",",
"getOrAppendVertex",
"(",
"coords",
"[",
"2",
"]",
",",
"ptQuad",
")",
")",
";",
"for",
"(",
"int",
"triVertexIndex",
":",
"triangleVertex",
"[",
"idgeom",
"]",
".",
"toArray",
"(",
")",
")",
"{",
"triVertex",
".",
"get",
"(",
"triVertexIndex",
")",
".",
"addSharingTriangle",
"(",
"idgeom",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"TopologyException",
"(",
"\"Voronoi method accept only polygons\"",
")",
";",
"}",
"}",
"// Second loop make an index of triangle neighbors",
"ptQuad",
"=",
"null",
";",
"triangleNeighbors",
"=",
"new",
"Triple",
"[",
"geometry",
".",
"getNumGeometries",
"(",
")",
"]",
";",
"for",
"(",
"int",
"triId",
"=",
"0",
";",
"triId",
"<",
"triangleVertex",
".",
"length",
";",
"triId",
"++",
")",
"{",
"Triple",
"triangleIndex",
"=",
"triangleVertex",
"[",
"triId",
"]",
";",
"triangleNeighbors",
"[",
"triId",
"]",
"=",
"new",
"Triple",
"(",
"commonEdge",
"(",
"triId",
",",
"triVertex",
".",
"get",
"(",
"triangleIndex",
".",
"getB",
"(",
")",
")",
",",
"triVertex",
".",
"get",
"(",
"triangleIndex",
".",
"getC",
"(",
")",
")",
")",
",",
"commonEdge",
"(",
"triId",
",",
"triVertex",
".",
"get",
"(",
"triangleIndex",
".",
"getA",
"(",
")",
")",
",",
"triVertex",
".",
"get",
"(",
"triangleIndex",
".",
"getC",
"(",
")",
")",
")",
",",
"commonEdge",
"(",
"triId",
",",
"triVertex",
".",
"get",
"(",
"triangleIndex",
".",
"getB",
"(",
")",
")",
",",
"triVertex",
".",
"get",
"(",
"triangleIndex",
".",
"getA",
"(",
")",
")",
")",
")",
";",
"}",
"triVertex",
".",
"clear",
"(",
")",
";",
"return",
"triangleNeighbors",
";",
"}"
] | Given the input TIN, construct a graph of triangle.
@param geometry Collection of Polygon with 3 vertex.
@return Array of triangle neighbors. Order and count is the same of the input array.
@throws TopologyException If incompatible type geometry is given | [
"Given",
"the",
"input",
"TIN",
"construct",
"a",
"graph",
"of",
"triangle",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/jts_utils/Voronoi.java#L115-L153 |
DDTH/ddth-queue | ddth-queue-core/src/main/java/com/github/ddth/queue/impl/DisruptorQueue.java | DisruptorQueue.requeue | @Override
public boolean requeue(IQueueMessage<ID, DATA> _msg) throws QueueException.QueueIsFull {
"""
{@inheritDoc}
@throws QueueException.QueueIsFull
if the ring buffer is full
"""
IQueueMessage<ID, DATA> msg = _msg.clone();
Date now = new Date();
msg.incNumRequeues().setQueueTimestamp(now);
putToRingBuffer(msg);
if (!isEphemeralDisabled()) {
ephemeralStorage.remove(msg.getId());
}
return true;
} | java | @Override
public boolean requeue(IQueueMessage<ID, DATA> _msg) throws QueueException.QueueIsFull {
IQueueMessage<ID, DATA> msg = _msg.clone();
Date now = new Date();
msg.incNumRequeues().setQueueTimestamp(now);
putToRingBuffer(msg);
if (!isEphemeralDisabled()) {
ephemeralStorage.remove(msg.getId());
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"requeue",
"(",
"IQueueMessage",
"<",
"ID",
",",
"DATA",
">",
"_msg",
")",
"throws",
"QueueException",
".",
"QueueIsFull",
"{",
"IQueueMessage",
"<",
"ID",
",",
"DATA",
">",
"msg",
"=",
"_msg",
".",
"clone",
"(",
")",
";",
"Date",
"now",
"=",
"new",
"Date",
"(",
")",
";",
"msg",
".",
"incNumRequeues",
"(",
")",
".",
"setQueueTimestamp",
"(",
"now",
")",
";",
"putToRingBuffer",
"(",
"msg",
")",
";",
"if",
"(",
"!",
"isEphemeralDisabled",
"(",
")",
")",
"{",
"ephemeralStorage",
".",
"remove",
"(",
"msg",
".",
"getId",
"(",
")",
")",
";",
"}",
"return",
"true",
";",
"}"
] | {@inheritDoc}
@throws QueueException.QueueIsFull
if the ring buffer is full | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/DisruptorQueue.java#L176-L186 |
Stratio/deep-spark | deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java | Cells.getInetAddress | public InetAddress getInetAddress(String nameSpace, String cellName) {
"""
Returns the {@code InetAddress} value of the {@link Cell} (associated to {@code table}) whose name iscellName, or
null if this Cells object contains no cell whose name is cellName.
@param nameSpace the name of the owning table
@param cellName the name of the Cell we want to retrieve from this Cells object.
@return the {@code InetAddress} value of the {@link Cell} (associated to {@code table}) whose name is cellName,
or null if this Cells object contains no cell whose name is cellName
"""
return getValue(nameSpace, cellName, InetAddress.class);
} | java | public InetAddress getInetAddress(String nameSpace, String cellName) {
return getValue(nameSpace, cellName, InetAddress.class);
} | [
"public",
"InetAddress",
"getInetAddress",
"(",
"String",
"nameSpace",
",",
"String",
"cellName",
")",
"{",
"return",
"getValue",
"(",
"nameSpace",
",",
"cellName",
",",
"InetAddress",
".",
"class",
")",
";",
"}"
] | Returns the {@code InetAddress} value of the {@link Cell} (associated to {@code table}) whose name iscellName, or
null if this Cells object contains no cell whose name is cellName.
@param nameSpace the name of the owning table
@param cellName the name of the Cell we want to retrieve from this Cells object.
@return the {@code InetAddress} value of the {@link Cell} (associated to {@code table}) whose name is cellName,
or null if this Cells object contains no cell whose name is cellName | [
"Returns",
"the",
"{",
"@code",
"InetAddress",
"}",
"value",
"of",
"the",
"{",
"@link",
"Cell",
"}",
"(",
"associated",
"to",
"{",
"@code",
"table",
"}",
")",
"whose",
"name",
"iscellName",
"or",
"null",
"if",
"this",
"Cells",
"object",
"contains",
"no",
"cell",
"whose",
"name",
"is",
"cellName",
"."
] | train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java#L1411-L1413 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringParser.java | StringParser.parseByteObj | @Nullable
public static Byte parseByteObj (@Nullable final Object aObject) {
"""
Parse the given {@link Object} as {@link Byte} with radix
{@value #DEFAULT_RADIX}.
@param aObject
The object to parse. May be <code>null</code>.
@return <code>null</code> if the object does not represent a valid value.
"""
return parseByteObj (aObject, DEFAULT_RADIX, null);
} | java | @Nullable
public static Byte parseByteObj (@Nullable final Object aObject)
{
return parseByteObj (aObject, DEFAULT_RADIX, null);
} | [
"@",
"Nullable",
"public",
"static",
"Byte",
"parseByteObj",
"(",
"@",
"Nullable",
"final",
"Object",
"aObject",
")",
"{",
"return",
"parseByteObj",
"(",
"aObject",
",",
"DEFAULT_RADIX",
",",
"null",
")",
";",
"}"
] | Parse the given {@link Object} as {@link Byte} with radix
{@value #DEFAULT_RADIX}.
@param aObject
The object to parse. May be <code>null</code>.
@return <code>null</code> if the object does not represent a valid value. | [
"Parse",
"the",
"given",
"{",
"@link",
"Object",
"}",
"as",
"{",
"@link",
"Byte",
"}",
"with",
"radix",
"{",
"@value",
"#DEFAULT_RADIX",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L338-L342 |
lucasr/probe | library/src/main/java/org/lucasr/probe/Interceptor.java | Interceptor.setMeasuredDimension | protected final void setMeasuredDimension(View view, int width, int height) {
"""
Calls {@link View#setMeasuredDimension(int, int)} on the given {@link View}.
This can be used to override {@link View#onMeasure(int, int)} calls on-the-fly
in interceptors.
"""
final ViewProxy proxy = (ViewProxy) view;
proxy.invokeSetMeasuredDimension(width, height);
} | java | protected final void setMeasuredDimension(View view, int width, int height) {
final ViewProxy proxy = (ViewProxy) view;
proxy.invokeSetMeasuredDimension(width, height);
} | [
"protected",
"final",
"void",
"setMeasuredDimension",
"(",
"View",
"view",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"final",
"ViewProxy",
"proxy",
"=",
"(",
"ViewProxy",
")",
"view",
";",
"proxy",
".",
"invokeSetMeasuredDimension",
"(",
"width",
",",
"height",
")",
";",
"}"
] | Calls {@link View#setMeasuredDimension(int, int)} on the given {@link View}.
This can be used to override {@link View#onMeasure(int, int)} calls on-the-fly
in interceptors. | [
"Calls",
"{"
] | train | https://github.com/lucasr/probe/blob/cd15cc04383a1bf85de2f4c345d2018415b9ddc9/library/src/main/java/org/lucasr/probe/Interceptor.java#L149-L152 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPP9CalendarFactory.java | MPP9CalendarFactory.processCalendarExceptions | @Override protected void processCalendarExceptions(byte[] data, ProjectCalendar cal) {
"""
This method extracts any exceptions associated with a calendar.
@param data calendar data block
@param cal calendar instance
"""
//
// Handle any exceptions
//
int exceptionCount = MPPUtility.getShort(data, 0);
if (exceptionCount != 0)
{
int index;
int offset;
ProjectCalendarException exception;
long duration;
int periodCount;
Date start;
for (index = 0; index < exceptionCount; index++)
{
offset = 4 + (60 * 7) + (index * 64);
Date fromDate = MPPUtility.getDate(data, offset);
Date toDate = MPPUtility.getDate(data, offset + 2);
exception = cal.addCalendarException(fromDate, toDate);
periodCount = MPPUtility.getShort(data, offset + 6);
if (periodCount != 0)
{
for (int exceptionPeriodIndex = 0; exceptionPeriodIndex < periodCount; exceptionPeriodIndex++)
{
start = MPPUtility.getTime(data, offset + 12 + (exceptionPeriodIndex * 2));
duration = MPPUtility.getDuration(data, offset + 24 + (exceptionPeriodIndex * 4));
exception.addRange(new DateRange(start, new Date(start.getTime() + duration)));
}
}
}
}
} | java | @Override protected void processCalendarExceptions(byte[] data, ProjectCalendar cal)
{
//
// Handle any exceptions
//
int exceptionCount = MPPUtility.getShort(data, 0);
if (exceptionCount != 0)
{
int index;
int offset;
ProjectCalendarException exception;
long duration;
int periodCount;
Date start;
for (index = 0; index < exceptionCount; index++)
{
offset = 4 + (60 * 7) + (index * 64);
Date fromDate = MPPUtility.getDate(data, offset);
Date toDate = MPPUtility.getDate(data, offset + 2);
exception = cal.addCalendarException(fromDate, toDate);
periodCount = MPPUtility.getShort(data, offset + 6);
if (periodCount != 0)
{
for (int exceptionPeriodIndex = 0; exceptionPeriodIndex < periodCount; exceptionPeriodIndex++)
{
start = MPPUtility.getTime(data, offset + 12 + (exceptionPeriodIndex * 2));
duration = MPPUtility.getDuration(data, offset + 24 + (exceptionPeriodIndex * 4));
exception.addRange(new DateRange(start, new Date(start.getTime() + duration)));
}
}
}
}
} | [
"@",
"Override",
"protected",
"void",
"processCalendarExceptions",
"(",
"byte",
"[",
"]",
"data",
",",
"ProjectCalendar",
"cal",
")",
"{",
"//",
"// Handle any exceptions",
"//",
"int",
"exceptionCount",
"=",
"MPPUtility",
".",
"getShort",
"(",
"data",
",",
"0",
")",
";",
"if",
"(",
"exceptionCount",
"!=",
"0",
")",
"{",
"int",
"index",
";",
"int",
"offset",
";",
"ProjectCalendarException",
"exception",
";",
"long",
"duration",
";",
"int",
"periodCount",
";",
"Date",
"start",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"exceptionCount",
";",
"index",
"++",
")",
"{",
"offset",
"=",
"4",
"+",
"(",
"60",
"*",
"7",
")",
"+",
"(",
"index",
"*",
"64",
")",
";",
"Date",
"fromDate",
"=",
"MPPUtility",
".",
"getDate",
"(",
"data",
",",
"offset",
")",
";",
"Date",
"toDate",
"=",
"MPPUtility",
".",
"getDate",
"(",
"data",
",",
"offset",
"+",
"2",
")",
";",
"exception",
"=",
"cal",
".",
"addCalendarException",
"(",
"fromDate",
",",
"toDate",
")",
";",
"periodCount",
"=",
"MPPUtility",
".",
"getShort",
"(",
"data",
",",
"offset",
"+",
"6",
")",
";",
"if",
"(",
"periodCount",
"!=",
"0",
")",
"{",
"for",
"(",
"int",
"exceptionPeriodIndex",
"=",
"0",
";",
"exceptionPeriodIndex",
"<",
"periodCount",
";",
"exceptionPeriodIndex",
"++",
")",
"{",
"start",
"=",
"MPPUtility",
".",
"getTime",
"(",
"data",
",",
"offset",
"+",
"12",
"+",
"(",
"exceptionPeriodIndex",
"*",
"2",
")",
")",
";",
"duration",
"=",
"MPPUtility",
".",
"getDuration",
"(",
"data",
",",
"offset",
"+",
"24",
"+",
"(",
"exceptionPeriodIndex",
"*",
"4",
")",
")",
";",
"exception",
".",
"addRange",
"(",
"new",
"DateRange",
"(",
"start",
",",
"new",
"Date",
"(",
"start",
".",
"getTime",
"(",
")",
"+",
"duration",
")",
")",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | This method extracts any exceptions associated with a calendar.
@param data calendar data block
@param cal calendar instance | [
"This",
"method",
"extracts",
"any",
"exceptions",
"associated",
"with",
"a",
"calendar",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP9CalendarFactory.java#L115-L151 |
matthewhorridge/mdock | src/main/java/org/coode/mdock/SplitterNode.java | SplitterNode.insertNodeAt | public void insertNodeAt(Node insert, int index, double split) {
"""
Inserts a node after (right of or bottom of) a given node by splitting the inserted
node with the given node.
@param insert The node to be inserted.
@param index The index
@param split The split
"""
addChild(insert, index, split);
notifyStateChange();
} | java | public void insertNodeAt(Node insert, int index, double split) {
addChild(insert, index, split);
notifyStateChange();
} | [
"public",
"void",
"insertNodeAt",
"(",
"Node",
"insert",
",",
"int",
"index",
",",
"double",
"split",
")",
"{",
"addChild",
"(",
"insert",
",",
"index",
",",
"split",
")",
";",
"notifyStateChange",
"(",
")",
";",
"}"
] | Inserts a node after (right of or bottom of) a given node by splitting the inserted
node with the given node.
@param insert The node to be inserted.
@param index The index
@param split The split | [
"Inserts",
"a",
"node",
"after",
"(",
"right",
"of",
"or",
"bottom",
"of",
")",
"a",
"given",
"node",
"by",
"splitting",
"the",
"inserted",
"node",
"with",
"the",
"given",
"node",
"."
] | train | https://github.com/matthewhorridge/mdock/blob/37839a56f30bdb73d56d82c4d1afe548d66b404b/src/main/java/org/coode/mdock/SplitterNode.java#L303-L306 |
rubenlagus/TelegramBots | telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java | SendAudio.setAudio | public SendAudio setAudio(File file) {
"""
Use this method to set the audio to a new file
@param file New audio file
"""
Objects.requireNonNull(file, "file cannot be null!");
this.audio = new InputFile(file, file.getName());
return this;
} | java | public SendAudio setAudio(File file) {
Objects.requireNonNull(file, "file cannot be null!");
this.audio = new InputFile(file, file.getName());
return this;
} | [
"public",
"SendAudio",
"setAudio",
"(",
"File",
"file",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"file",
",",
"\"file cannot be null!\"",
")",
";",
"this",
".",
"audio",
"=",
"new",
"InputFile",
"(",
"file",
",",
"file",
".",
"getName",
"(",
")",
")",
";",
"return",
"this",
";",
"}"
] | Use this method to set the audio to a new file
@param file New audio file | [
"Use",
"this",
"method",
"to",
"set",
"the",
"audio",
"to",
"a",
"new",
"file"
] | train | https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java#L108-L112 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.toLEInt | @Pure
public static int toLEInt(int b1, int b2, int b3, int b4) {
"""
Converting four bytes to a Little Endian integer.
@param b1 the first byte.
@param b2 the second byte.
@param b3 the third byte.
@param b4 the fourth byte.
@return the conversion result
"""
return ((b4 & 0xFF) << 24) + ((b3 & 0xFF) << 16) + ((b2 & 0xFF) << 8) + (b1 & 0xFF);
} | java | @Pure
public static int toLEInt(int b1, int b2, int b3, int b4) {
return ((b4 & 0xFF) << 24) + ((b3 & 0xFF) << 16) + ((b2 & 0xFF) << 8) + (b1 & 0xFF);
} | [
"@",
"Pure",
"public",
"static",
"int",
"toLEInt",
"(",
"int",
"b1",
",",
"int",
"b2",
",",
"int",
"b3",
",",
"int",
"b4",
")",
"{",
"return",
"(",
"(",
"b4",
"&",
"0xFF",
")",
"<<",
"24",
")",
"+",
"(",
"(",
"b3",
"&",
"0xFF",
")",
"<<",
"16",
")",
"+",
"(",
"(",
"b2",
"&",
"0xFF",
")",
"<<",
"8",
")",
"+",
"(",
"b1",
"&",
"0xFF",
")",
";",
"}"
] | Converting four bytes to a Little Endian integer.
@param b1 the first byte.
@param b2 the second byte.
@param b3 the third byte.
@param b4 the fourth byte.
@return the conversion result | [
"Converting",
"four",
"bytes",
"to",
"a",
"Little",
"Endian",
"integer",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L75-L78 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java | ComponentFactory.newImage | public static Image newImage(final String id, final IResource imageResource) {
"""
Factory method for create a new {@link Image}.
@param id
the id
@param imageResource
the IResource object
@return the new {@link Image}.
"""
final Image image = new Image(id, imageResource);
image.setOutputMarkupId(true);
return image;
} | java | public static Image newImage(final String id, final IResource imageResource)
{
final Image image = new Image(id, imageResource);
image.setOutputMarkupId(true);
return image;
} | [
"public",
"static",
"Image",
"newImage",
"(",
"final",
"String",
"id",
",",
"final",
"IResource",
"imageResource",
")",
"{",
"final",
"Image",
"image",
"=",
"new",
"Image",
"(",
"id",
",",
"imageResource",
")",
";",
"image",
".",
"setOutputMarkupId",
"(",
"true",
")",
";",
"return",
"image",
";",
"}"
] | Factory method for create a new {@link Image}.
@param id
the id
@param imageResource
the IResource object
@return the new {@link Image}. | [
"Factory",
"method",
"for",
"create",
"a",
"new",
"{",
"@link",
"Image",
"}",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java#L389-L394 |
google/error-prone | check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java | ASTHelpers.inSamePackage | public static boolean inSamePackage(Symbol targetSymbol, VisitorState state) {
"""
Return true if the given symbol is defined in the current package.
"""
JCCompilationUnit compilationUnit = (JCCompilationUnit) state.getPath().getCompilationUnit();
PackageSymbol usePackage = compilationUnit.packge;
PackageSymbol targetPackage = targetSymbol.packge();
return targetPackage != null
&& usePackage != null
&& targetPackage.getQualifiedName().equals(usePackage.getQualifiedName());
} | java | public static boolean inSamePackage(Symbol targetSymbol, VisitorState state) {
JCCompilationUnit compilationUnit = (JCCompilationUnit) state.getPath().getCompilationUnit();
PackageSymbol usePackage = compilationUnit.packge;
PackageSymbol targetPackage = targetSymbol.packge();
return targetPackage != null
&& usePackage != null
&& targetPackage.getQualifiedName().equals(usePackage.getQualifiedName());
} | [
"public",
"static",
"boolean",
"inSamePackage",
"(",
"Symbol",
"targetSymbol",
",",
"VisitorState",
"state",
")",
"{",
"JCCompilationUnit",
"compilationUnit",
"=",
"(",
"JCCompilationUnit",
")",
"state",
".",
"getPath",
"(",
")",
".",
"getCompilationUnit",
"(",
")",
";",
"PackageSymbol",
"usePackage",
"=",
"compilationUnit",
".",
"packge",
";",
"PackageSymbol",
"targetPackage",
"=",
"targetSymbol",
".",
"packge",
"(",
")",
";",
"return",
"targetPackage",
"!=",
"null",
"&&",
"usePackage",
"!=",
"null",
"&&",
"targetPackage",
".",
"getQualifiedName",
"(",
")",
".",
"equals",
"(",
"usePackage",
".",
"getQualifiedName",
"(",
")",
")",
";",
"}"
] | Return true if the given symbol is defined in the current package. | [
"Return",
"true",
"if",
"the",
"given",
"symbol",
"is",
"defined",
"in",
"the",
"current",
"package",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java#L889-L897 |
jingwei/krati | krati-main/src/main/java/krati/core/array/SimpleDataArray.java | SimpleDataArray.setAddress | protected void setAddress(int index, long value, long scn) throws Exception {
"""
Sets the address (long value) at the specified array index.
@param index - the array index.
@param value - the address value.
@param scn - the System Change Number (SCN) representing an ever-increasing update order.
@throws Exception if the address cannot be updated at the specified array index.
"""
_addressArray.set(index, value, scn);
_hwmSet = Math.max(_hwmSet, scn);
} | java | protected void setAddress(int index, long value, long scn) throws Exception {
_addressArray.set(index, value, scn);
_hwmSet = Math.max(_hwmSet, scn);
} | [
"protected",
"void",
"setAddress",
"(",
"int",
"index",
",",
"long",
"value",
",",
"long",
"scn",
")",
"throws",
"Exception",
"{",
"_addressArray",
".",
"set",
"(",
"index",
",",
"value",
",",
"scn",
")",
";",
"_hwmSet",
"=",
"Math",
".",
"max",
"(",
"_hwmSet",
",",
"scn",
")",
";",
"}"
] | Sets the address (long value) at the specified array index.
@param index - the array index.
@param value - the address value.
@param scn - the System Change Number (SCN) representing an ever-increasing update order.
@throws Exception if the address cannot be updated at the specified array index. | [
"Sets",
"the",
"address",
"(",
"long",
"value",
")",
"at",
"the",
"specified",
"array",
"index",
"."
] | train | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/SimpleDataArray.java#L348-L351 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java | FieldDescriptorConstraints.ensureJdbcType | private void ensureJdbcType(FieldDescriptorDef fieldDef, String checkLevel) throws ConstraintException {
"""
Constraint that ensures that the field has a jdbc type. If none is specified, then
the default type is used (which has been determined when the field descriptor was added)
and - if necessary - the default conversion is set.
@param fieldDef The field descriptor
@param checkLevel The current check level (this constraint is checked in all levels)
@exception ConstraintException If the constraint has been violated
"""
if (!fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE))
{
if (!fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_JDBC_TYPE))
{
throw new ConstraintException("No jdbc-type specified for the field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName());
}
fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE, fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_JDBC_TYPE));
if (!fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_CONVERSION) && fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_CONVERSION))
{
fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_CONVERSION, fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_CONVERSION));
}
}
else
{
// we could let XDoclet check the type for field declarations but not for modifications (as we could
// not specify the empty string anymore)
String jdbcType = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE);
if (!_jdbcTypes.containsKey(jdbcType))
{
throw new ConstraintException("The field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName()+" specifies the invalid jdbc type "+jdbcType);
}
}
} | java | private void ensureJdbcType(FieldDescriptorDef fieldDef, String checkLevel) throws ConstraintException
{
if (!fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE))
{
if (!fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_JDBC_TYPE))
{
throw new ConstraintException("No jdbc-type specified for the field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName());
}
fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE, fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_JDBC_TYPE));
if (!fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_CONVERSION) && fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_CONVERSION))
{
fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_CONVERSION, fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_CONVERSION));
}
}
else
{
// we could let XDoclet check the type for field declarations but not for modifications (as we could
// not specify the empty string anymore)
String jdbcType = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE);
if (!_jdbcTypes.containsKey(jdbcType))
{
throw new ConstraintException("The field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName()+" specifies the invalid jdbc type "+jdbcType);
}
}
} | [
"private",
"void",
"ensureJdbcType",
"(",
"FieldDescriptorDef",
"fieldDef",
",",
"String",
"checkLevel",
")",
"throws",
"ConstraintException",
"{",
"if",
"(",
"!",
"fieldDef",
".",
"hasProperty",
"(",
"PropertyHelper",
".",
"OJB_PROPERTY_JDBC_TYPE",
")",
")",
"{",
"if",
"(",
"!",
"fieldDef",
".",
"hasProperty",
"(",
"PropertyHelper",
".",
"OJB_PROPERTY_DEFAULT_JDBC_TYPE",
")",
")",
"{",
"throw",
"new",
"ConstraintException",
"(",
"\"No jdbc-type specified for the field \"",
"+",
"fieldDef",
".",
"getName",
"(",
")",
"+",
"\" in class \"",
"+",
"fieldDef",
".",
"getOwner",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"fieldDef",
".",
"setProperty",
"(",
"PropertyHelper",
".",
"OJB_PROPERTY_JDBC_TYPE",
",",
"fieldDef",
".",
"getProperty",
"(",
"PropertyHelper",
".",
"OJB_PROPERTY_DEFAULT_JDBC_TYPE",
")",
")",
";",
"if",
"(",
"!",
"fieldDef",
".",
"hasProperty",
"(",
"PropertyHelper",
".",
"OJB_PROPERTY_CONVERSION",
")",
"&&",
"fieldDef",
".",
"hasProperty",
"(",
"PropertyHelper",
".",
"OJB_PROPERTY_DEFAULT_CONVERSION",
")",
")",
"{",
"fieldDef",
".",
"setProperty",
"(",
"PropertyHelper",
".",
"OJB_PROPERTY_CONVERSION",
",",
"fieldDef",
".",
"getProperty",
"(",
"PropertyHelper",
".",
"OJB_PROPERTY_DEFAULT_CONVERSION",
")",
")",
";",
"}",
"}",
"else",
"{",
"// we could let XDoclet check the type for field declarations but not for modifications (as we could\r",
"// not specify the empty string anymore)\r",
"String",
"jdbcType",
"=",
"fieldDef",
".",
"getProperty",
"(",
"PropertyHelper",
".",
"OJB_PROPERTY_JDBC_TYPE",
")",
";",
"if",
"(",
"!",
"_jdbcTypes",
".",
"containsKey",
"(",
"jdbcType",
")",
")",
"{",
"throw",
"new",
"ConstraintException",
"(",
"\"The field \"",
"+",
"fieldDef",
".",
"getName",
"(",
")",
"+",
"\" in class \"",
"+",
"fieldDef",
".",
"getOwner",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\" specifies the invalid jdbc type \"",
"+",
"jdbcType",
")",
";",
"}",
"}",
"}"
] | Constraint that ensures that the field has a jdbc type. If none is specified, then
the default type is used (which has been determined when the field descriptor was added)
and - if necessary - the default conversion is set.
@param fieldDef The field descriptor
@param checkLevel The current check level (this constraint is checked in all levels)
@exception ConstraintException If the constraint has been violated | [
"Constraint",
"that",
"ensures",
"that",
"the",
"field",
"has",
"a",
"jdbc",
"type",
".",
"If",
"none",
"is",
"specified",
"then",
"the",
"default",
"type",
"is",
"used",
"(",
"which",
"has",
"been",
"determined",
"when",
"the",
"field",
"descriptor",
"was",
"added",
")",
"and",
"-",
"if",
"necessary",
"-",
"the",
"default",
"conversion",
"is",
"set",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java#L150-L176 |
xcesco/kripton | kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/SQLiteEvent.java | SQLiteEvent.createInsertWithId | public static SQLiteEvent createInsertWithId(Long result) {
"""
Creates the insert.
@param result
the result
@return the SQ lite event
"""
return new SQLiteEvent(SqlModificationType.INSERT, null, result, null);
} | java | public static SQLiteEvent createInsertWithId(Long result) {
return new SQLiteEvent(SqlModificationType.INSERT, null, result, null);
} | [
"public",
"static",
"SQLiteEvent",
"createInsertWithId",
"(",
"Long",
"result",
")",
"{",
"return",
"new",
"SQLiteEvent",
"(",
"SqlModificationType",
".",
"INSERT",
",",
"null",
",",
"result",
",",
"null",
")",
";",
"}"
] | Creates the insert.
@param result
the result
@return the SQ lite event | [
"Creates",
"the",
"insert",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/SQLiteEvent.java#L57-L59 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java | SessionDataManager.getItemByIdentifier | public ItemImpl getItemByIdentifier(String identifier, boolean pool, boolean apiRead) throws RepositoryException {
"""
For internal use, required privileges. Return item by identifier in this transient storage then in workspace container.
@param identifier
- identifier of searched item
@param pool
- indicates does the item fall in pool
@param apiRead
- if true will call postRead Action and check permissions
@return existed item data or null if not found
@throws RepositoryException
"""
long start = 0;
if (LOG.isDebugEnabled())
{
start = System.currentTimeMillis();
LOG.debug("getItemByIdentifier(" + identifier + " ) >>>>>");
}
ItemImpl item = null;
try
{
return item = readItem(getItemData(identifier), null, pool, apiRead);
}
finally
{
if (LOG.isDebugEnabled())
{
LOG.debug("getItemByIdentifier(" + identifier + ") --> " + (item != null ? item.getPath() : "null")
+ " <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec");
}
}
} | java | public ItemImpl getItemByIdentifier(String identifier, boolean pool, boolean apiRead) throws RepositoryException
{
long start = 0;
if (LOG.isDebugEnabled())
{
start = System.currentTimeMillis();
LOG.debug("getItemByIdentifier(" + identifier + " ) >>>>>");
}
ItemImpl item = null;
try
{
return item = readItem(getItemData(identifier), null, pool, apiRead);
}
finally
{
if (LOG.isDebugEnabled())
{
LOG.debug("getItemByIdentifier(" + identifier + ") --> " + (item != null ? item.getPath() : "null")
+ " <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec");
}
}
} | [
"public",
"ItemImpl",
"getItemByIdentifier",
"(",
"String",
"identifier",
",",
"boolean",
"pool",
",",
"boolean",
"apiRead",
")",
"throws",
"RepositoryException",
"{",
"long",
"start",
"=",
"0",
";",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"LOG",
".",
"debug",
"(",
"\"getItemByIdentifier(\"",
"+",
"identifier",
"+",
"\" ) >>>>>\"",
")",
";",
"}",
"ItemImpl",
"item",
"=",
"null",
";",
"try",
"{",
"return",
"item",
"=",
"readItem",
"(",
"getItemData",
"(",
"identifier",
")",
",",
"null",
",",
"pool",
",",
"apiRead",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"getItemByIdentifier(\"",
"+",
"identifier",
"+",
"\") --> \"",
"+",
"(",
"item",
"!=",
"null",
"?",
"item",
".",
"getPath",
"(",
")",
":",
"\"null\"",
")",
"+",
"\" <<<<< \"",
"+",
"(",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"start",
")",
"/",
"1000d",
")",
"+",
"\"sec\"",
")",
";",
"}",
"}",
"}"
] | For internal use, required privileges. Return item by identifier in this transient storage then in workspace container.
@param identifier
- identifier of searched item
@param pool
- indicates does the item fall in pool
@param apiRead
- if true will call postRead Action and check permissions
@return existed item data or null if not found
@throws RepositoryException | [
"For",
"internal",
"use",
"required",
"privileges",
".",
"Return",
"item",
"by",
"identifier",
"in",
"this",
"transient",
"storage",
"then",
"in",
"workspace",
"container",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L667-L689 |
pwall567/jsonutil | src/main/java/net/pwall/json/JSON.java | JSON.appendJSON | public static void appendJSON(Appendable a, JSONValue value) throws IOException {
"""
Convenience method to append the JSON string for a value to an {@link Appendable}, for
cases where the value may be {@code null}.
@param a the {@link Appendable}
@param value the {@link JSONValue}
@throws IOException if thrown by the {@link Appendable}
"""
if (value == null)
a.append("null");
else
value.appendJSON(a);
} | java | public static void appendJSON(Appendable a, JSONValue value) throws IOException {
if (value == null)
a.append("null");
else
value.appendJSON(a);
} | [
"public",
"static",
"void",
"appendJSON",
"(",
"Appendable",
"a",
",",
"JSONValue",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"a",
".",
"append",
"(",
"\"null\"",
")",
";",
"else",
"value",
".",
"appendJSON",
"(",
"a",
")",
";",
"}"
] | Convenience method to append the JSON string for a value to an {@link Appendable}, for
cases where the value may be {@code null}.
@param a the {@link Appendable}
@param value the {@link JSONValue}
@throws IOException if thrown by the {@link Appendable} | [
"Convenience",
"method",
"to",
"append",
"the",
"JSON",
"string",
"for",
"a",
"value",
"to",
"an",
"{",
"@link",
"Appendable",
"}",
"for",
"cases",
"where",
"the",
"value",
"may",
"be",
"{",
"@code",
"null",
"}",
"."
] | train | https://github.com/pwall567/jsonutil/blob/dd5960b9b0bcc9acfe6c52b884fffd9ee5f422fe/src/main/java/net/pwall/json/JSON.java#L738-L743 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java | ResourceTracker.updateTrackerAddr | public void updateTrackerAddr(String trackerName, InetAddress addr) {
"""
Updates mapping between tracker names and adresses
@param trackerName name of tracker
@param addr address of the tracker
"""
synchronized (lockObject) {
trackerAddress.put(trackerName, addr);
}
} | java | public void updateTrackerAddr(String trackerName, InetAddress addr) {
synchronized (lockObject) {
trackerAddress.put(trackerName, addr);
}
} | [
"public",
"void",
"updateTrackerAddr",
"(",
"String",
"trackerName",
",",
"InetAddress",
"addr",
")",
"{",
"synchronized",
"(",
"lockObject",
")",
"{",
"trackerAddress",
".",
"put",
"(",
"trackerName",
",",
"addr",
")",
";",
"}",
"}"
] | Updates mapping between tracker names and adresses
@param trackerName name of tracker
@param addr address of the tracker | [
"Updates",
"mapping",
"between",
"tracker",
"names",
"and",
"adresses"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java#L347-L351 |
jhipster/jhipster | jhipster-framework/src/main/java/io/github/jhipster/service/QueryService.java | QueryService.buildSpecification | protected Specification<ENTITY> buildSpecification(StringFilter filter, Function<Root<ENTITY>, Expression<String>> metaclassFunction) {
"""
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 metaclassFunction lambda, which based on a Root<ENTITY> returns Expression - basicaly picks a column
@return a Specification
"""
if (filter.getEquals() != null) {
return equalsSpecification(metaclassFunction, filter.getEquals());
} else if (filter.getIn() != null) {
return valueIn(metaclassFunction, filter.getIn());
} else if (filter.getContains() != null) {
return likeUpperSpecification(metaclassFunction, filter.getContains());
} else if (filter.getSpecified() != null) {
return byFieldSpecified(metaclassFunction, filter.getSpecified());
}
return null;
} | java | protected Specification<ENTITY> buildSpecification(StringFilter filter, Function<Root<ENTITY>, Expression<String>> metaclassFunction) {
if (filter.getEquals() != null) {
return equalsSpecification(metaclassFunction, filter.getEquals());
} else if (filter.getIn() != null) {
return valueIn(metaclassFunction, filter.getIn());
} else if (filter.getContains() != null) {
return likeUpperSpecification(metaclassFunction, filter.getContains());
} else if (filter.getSpecified() != null) {
return byFieldSpecified(metaclassFunction, filter.getSpecified());
}
return null;
} | [
"protected",
"Specification",
"<",
"ENTITY",
">",
"buildSpecification",
"(",
"StringFilter",
"filter",
",",
"Function",
"<",
"Root",
"<",
"ENTITY",
">",
",",
"Expression",
"<",
"String",
">",
">",
"metaclassFunction",
")",
"{",
"if",
"(",
"filter",
".",
"getEquals",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"equalsSpecification",
"(",
"metaclassFunction",
",",
"filter",
".",
"getEquals",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"filter",
".",
"getIn",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"valueIn",
"(",
"metaclassFunction",
",",
"filter",
".",
"getIn",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"filter",
".",
"getContains",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"likeUpperSpecification",
"(",
"metaclassFunction",
",",
"filter",
".",
"getContains",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"filter",
".",
"getSpecified",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"byFieldSpecified",
"(",
"metaclassFunction",
",",
"filter",
".",
"getSpecified",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] | 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 metaclassFunction lambda, which based on a Root<ENTITY> returns Expression - basicaly picks a column
@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#L101-L112 |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.beginTransaction | @Override
public synchronized void beginTransaction() throws DatabaseEngineRuntimeException {
"""
Starts a transaction. Doing this will set auto commit to false ({@link Connection#getAutoCommit()}).
@throws DatabaseEngineRuntimeException If something goes wrong while beginning transaction.
"""
/*
* It makes sense trying to reconnect since it's the beginning of a transaction.
*/
try {
getConnection();
if (!conn.getAutoCommit()) { //I.E. Manual control
logger.debug("There's already one transaction active");
return;
}
conn.setAutoCommit(false);
} catch (final Exception ex) {
throw new DatabaseEngineRuntimeException("Error occurred while starting transaction", ex);
}
} | java | @Override
public synchronized void beginTransaction() throws DatabaseEngineRuntimeException {
/*
* It makes sense trying to reconnect since it's the beginning of a transaction.
*/
try {
getConnection();
if (!conn.getAutoCommit()) { //I.E. Manual control
logger.debug("There's already one transaction active");
return;
}
conn.setAutoCommit(false);
} catch (final Exception ex) {
throw new DatabaseEngineRuntimeException("Error occurred while starting transaction", ex);
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"beginTransaction",
"(",
")",
"throws",
"DatabaseEngineRuntimeException",
"{",
"/*\n * It makes sense trying to reconnect since it's the beginning of a transaction.\n */",
"try",
"{",
"getConnection",
"(",
")",
";",
"if",
"(",
"!",
"conn",
".",
"getAutoCommit",
"(",
")",
")",
"{",
"//I.E. Manual control",
"logger",
".",
"debug",
"(",
"\"There's already one transaction active\"",
")",
";",
"return",
";",
"}",
"conn",
".",
"setAutoCommit",
"(",
"false",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"DatabaseEngineRuntimeException",
"(",
"\"Error occurred while starting transaction\"",
",",
"ex",
")",
";",
"}",
"}"
] | Starts a transaction. Doing this will set auto commit to false ({@link Connection#getAutoCommit()}).
@throws DatabaseEngineRuntimeException If something goes wrong while beginning transaction. | [
"Starts",
"a",
"transaction",
".",
"Doing",
"this",
"will",
"set",
"auto",
"commit",
"to",
"false",
"(",
"{",
"@link",
"Connection#getAutoCommit",
"()",
"}",
")",
"."
] | train | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L474-L490 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.identity | public static DMatrixRMaj identity(int numRows , int numCols ) {
"""
Creates a rectangular matrix which is zero except along the diagonals.
@param numRows Number of rows in the matrix.
@param numCols NUmber of columns in the matrix.
@return A matrix with diagonal elements equal to one.
"""
DMatrixRMaj ret = new DMatrixRMaj(numRows,numCols);
int small = numRows < numCols ? numRows : numCols;
for( int i = 0; i < small; i++ ) {
ret.set(i,i,1.0);
}
return ret;
} | java | public static DMatrixRMaj identity(int numRows , int numCols )
{
DMatrixRMaj ret = new DMatrixRMaj(numRows,numCols);
int small = numRows < numCols ? numRows : numCols;
for( int i = 0; i < small; i++ ) {
ret.set(i,i,1.0);
}
return ret;
} | [
"public",
"static",
"DMatrixRMaj",
"identity",
"(",
"int",
"numRows",
",",
"int",
"numCols",
")",
"{",
"DMatrixRMaj",
"ret",
"=",
"new",
"DMatrixRMaj",
"(",
"numRows",
",",
"numCols",
")",
";",
"int",
"small",
"=",
"numRows",
"<",
"numCols",
"?",
"numRows",
":",
"numCols",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"small",
";",
"i",
"++",
")",
"{",
"ret",
".",
"set",
"(",
"i",
",",
"i",
",",
"1.0",
")",
";",
"}",
"return",
"ret",
";",
"}"
] | Creates a rectangular matrix which is zero except along the diagonals.
@param numRows Number of rows in the matrix.
@param numCols NUmber of columns in the matrix.
@return A matrix with diagonal elements equal to one. | [
"Creates",
"a",
"rectangular",
"matrix",
"which",
"is",
"zero",
"except",
"along",
"the",
"diagonals",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L987-L998 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/dbinfo/DatabaseInformationMain.java | DatabaseInformationMain.SYSTEM_SCHEMAS | final Table SYSTEM_SCHEMAS() {
"""
Retrieves a <code>Table</code> object describing the accessible schemas
defined within this database. <p>
Each row is a schema description with the following
columns: <p>
<pre class="SqlCodeExample">
TABLE_SCHEM VARCHAR simple schema name
TABLE_CATALOG VARCHAR catalog in which schema is defined
IS_DEFAULT BOOLEAN is the schema the default for new sessions
</pre> <p>
@return table containing information about schemas defined
within this database
"""
Table t = sysTables[SYSTEM_SCHEMAS];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[SYSTEM_SCHEMAS]);
addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER); // not null
addColumn(t, "TABLE_CATALOG", SQL_IDENTIFIER);
addColumn(t, "IS_DEFAULT", Type.SQL_BOOLEAN);
// order: TABLE_SCHEM
// true PK, as rows never have null TABLE_SCHEM
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(
sysTableHsqlNames[SYSTEM_SCHEMAS].name, false,
SchemaObject.INDEX);
t.createPrimaryKey(name, new int[]{ 0 }, true);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
Iterator schemas;
Object[] row;
// Initialization
schemas = database.schemaManager.fullSchemaNamesIterator();
String defschema =
database.schemaManager.getDefaultSchemaHsqlName().name;
// Do it.
while (schemas.hasNext()) {
row = t.getEmptyRowData();
String schema = (String) schemas.next();
row[0] = schema;
row[1] = database.getCatalogName().name;
row[2] = schema.equals(defschema) ? Boolean.TRUE
: Boolean.FALSE;
t.insertSys(store, row);
}
return t;
} | java | final Table SYSTEM_SCHEMAS() {
Table t = sysTables[SYSTEM_SCHEMAS];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[SYSTEM_SCHEMAS]);
addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER); // not null
addColumn(t, "TABLE_CATALOG", SQL_IDENTIFIER);
addColumn(t, "IS_DEFAULT", Type.SQL_BOOLEAN);
// order: TABLE_SCHEM
// true PK, as rows never have null TABLE_SCHEM
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(
sysTableHsqlNames[SYSTEM_SCHEMAS].name, false,
SchemaObject.INDEX);
t.createPrimaryKey(name, new int[]{ 0 }, true);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
Iterator schemas;
Object[] row;
// Initialization
schemas = database.schemaManager.fullSchemaNamesIterator();
String defschema =
database.schemaManager.getDefaultSchemaHsqlName().name;
// Do it.
while (schemas.hasNext()) {
row = t.getEmptyRowData();
String schema = (String) schemas.next();
row[0] = schema;
row[1] = database.getCatalogName().name;
row[2] = schema.equals(defschema) ? Boolean.TRUE
: Boolean.FALSE;
t.insertSys(store, row);
}
return t;
} | [
"final",
"Table",
"SYSTEM_SCHEMAS",
"(",
")",
"{",
"Table",
"t",
"=",
"sysTables",
"[",
"SYSTEM_SCHEMAS",
"]",
";",
"if",
"(",
"t",
"==",
"null",
")",
"{",
"t",
"=",
"createBlankTable",
"(",
"sysTableHsqlNames",
"[",
"SYSTEM_SCHEMAS",
"]",
")",
";",
"addColumn",
"(",
"t",
",",
"\"TABLE_SCHEM\"",
",",
"SQL_IDENTIFIER",
")",
";",
"// not null",
"addColumn",
"(",
"t",
",",
"\"TABLE_CATALOG\"",
",",
"SQL_IDENTIFIER",
")",
";",
"addColumn",
"(",
"t",
",",
"\"IS_DEFAULT\"",
",",
"Type",
".",
"SQL_BOOLEAN",
")",
";",
"// order: TABLE_SCHEM",
"// true PK, as rows never have null TABLE_SCHEM",
"HsqlName",
"name",
"=",
"HsqlNameManager",
".",
"newInfoSchemaObjectName",
"(",
"sysTableHsqlNames",
"[",
"SYSTEM_SCHEMAS",
"]",
".",
"name",
",",
"false",
",",
"SchemaObject",
".",
"INDEX",
")",
";",
"t",
".",
"createPrimaryKey",
"(",
"name",
",",
"new",
"int",
"[",
"]",
"{",
"0",
"}",
",",
"true",
")",
";",
"return",
"t",
";",
"}",
"PersistentStore",
"store",
"=",
"database",
".",
"persistentStoreCollection",
".",
"getStore",
"(",
"t",
")",
";",
"Iterator",
"schemas",
";",
"Object",
"[",
"]",
"row",
";",
"// Initialization",
"schemas",
"=",
"database",
".",
"schemaManager",
".",
"fullSchemaNamesIterator",
"(",
")",
";",
"String",
"defschema",
"=",
"database",
".",
"schemaManager",
".",
"getDefaultSchemaHsqlName",
"(",
")",
".",
"name",
";",
"// Do it.",
"while",
"(",
"schemas",
".",
"hasNext",
"(",
")",
")",
"{",
"row",
"=",
"t",
".",
"getEmptyRowData",
"(",
")",
";",
"String",
"schema",
"=",
"(",
"String",
")",
"schemas",
".",
"next",
"(",
")",
";",
"row",
"[",
"0",
"]",
"=",
"schema",
";",
"row",
"[",
"1",
"]",
"=",
"database",
".",
"getCatalogName",
"(",
")",
".",
"name",
";",
"row",
"[",
"2",
"]",
"=",
"schema",
".",
"equals",
"(",
"defschema",
")",
"?",
"Boolean",
".",
"TRUE",
":",
"Boolean",
".",
"FALSE",
";",
"t",
".",
"insertSys",
"(",
"store",
",",
"row",
")",
";",
"}",
"return",
"t",
";",
"}"
] | Retrieves a <code>Table</code> object describing the accessible schemas
defined within this database. <p>
Each row is a schema description with the following
columns: <p>
<pre class="SqlCodeExample">
TABLE_SCHEM VARCHAR simple schema name
TABLE_CATALOG VARCHAR catalog in which schema is defined
IS_DEFAULT BOOLEAN is the schema the default for new sessions
</pre> <p>
@return table containing information about schemas defined
within this database | [
"Retrieves",
"a",
"<code",
">",
"Table<",
"/",
"code",
">",
"object",
"describing",
"the",
"accessible",
"schemas",
"defined",
"within",
"this",
"database",
".",
"<p",
">"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/dbinfo/DatabaseInformationMain.java#L2137-L2184 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java | ChannelFrameworkImpl.createChannelData | protected ChannelData createChannelData(String name, Class<?> factoryClass, Map<Object, Object> properties, int weight) {
"""
Create a new ChannelData Object.
@param name
@param factoryClass
@param properties
@param weight
@return ChannelData
"""
return new ChannelDataImpl(name, factoryClass, properties, weight, this);
} | java | protected ChannelData createChannelData(String name, Class<?> factoryClass, Map<Object, Object> properties, int weight) {
return new ChannelDataImpl(name, factoryClass, properties, weight, this);
} | [
"protected",
"ChannelData",
"createChannelData",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"factoryClass",
",",
"Map",
"<",
"Object",
",",
"Object",
">",
"properties",
",",
"int",
"weight",
")",
"{",
"return",
"new",
"ChannelDataImpl",
"(",
"name",
",",
"factoryClass",
",",
"properties",
",",
"weight",
",",
"this",
")",
";",
"}"
] | Create a new ChannelData Object.
@param name
@param factoryClass
@param properties
@param weight
@return ChannelData | [
"Create",
"a",
"new",
"ChannelData",
"Object",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java#L4275-L4278 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/query/Criteria.java | Criteria.addColumnEqualToField | public void addColumnEqualToField(String column, Object fieldName) {
"""
Adds and equals (=) criteria for field comparison.
The field name will be translated into the appropriate columnName by SqlStatement.
The attribute will NOT be translated into column name
@param column The column name to be used without translation
@param fieldName An object representing the value of the field
"""
// PAW
//SelectionCriteria c = FieldCriteria.buildEqualToCriteria(column, fieldName, getAlias());
SelectionCriteria c = FieldCriteria.buildEqualToCriteria(column, fieldName, getUserAlias(column));
c.setTranslateAttribute(false);
addSelectionCriteria(c);
} | java | public void addColumnEqualToField(String column, Object fieldName)
{
// PAW
//SelectionCriteria c = FieldCriteria.buildEqualToCriteria(column, fieldName, getAlias());
SelectionCriteria c = FieldCriteria.buildEqualToCriteria(column, fieldName, getUserAlias(column));
c.setTranslateAttribute(false);
addSelectionCriteria(c);
} | [
"public",
"void",
"addColumnEqualToField",
"(",
"String",
"column",
",",
"Object",
"fieldName",
")",
"{",
"// PAW\r",
"//SelectionCriteria c = FieldCriteria.buildEqualToCriteria(column, fieldName, getAlias());\r",
"SelectionCriteria",
"c",
"=",
"FieldCriteria",
".",
"buildEqualToCriteria",
"(",
"column",
",",
"fieldName",
",",
"getUserAlias",
"(",
"column",
")",
")",
";",
"c",
".",
"setTranslateAttribute",
"(",
"false",
")",
";",
"addSelectionCriteria",
"(",
"c",
")",
";",
"}"
] | Adds and equals (=) criteria for field comparison.
The field name will be translated into the appropriate columnName by SqlStatement.
The attribute will NOT be translated into column name
@param column The column name to be used without translation
@param fieldName An object representing the value of the field | [
"Adds",
"and",
"equals",
"(",
"=",
")",
"criteria",
"for",
"field",
"comparison",
".",
"The",
"field",
"name",
"will",
"be",
"translated",
"into",
"the",
"appropriate",
"columnName",
"by",
"SqlStatement",
".",
"The",
"attribute",
"will",
"NOT",
"be",
"translated",
"into",
"column",
"name"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/Criteria.java#L322-L329 |
SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/util/ClassLoaderUtils.java | ClassLoaderUtils.listFiles | public static Collection<String> listFiles(ClassLoader classLoader, String rootPath) {
"""
Finds files within a given directory and its subdirectories
@param classLoader
@param rootPath the root directory, for example org/sonar/sqale
@return a list of relative paths, for example {"org/sonar/sqale/foo/bar.txt}. Never null.
"""
return listResources(classLoader, rootPath, path -> !StringUtils.endsWith(path, "/"));
} | java | public static Collection<String> listFiles(ClassLoader classLoader, String rootPath) {
return listResources(classLoader, rootPath, path -> !StringUtils.endsWith(path, "/"));
} | [
"public",
"static",
"Collection",
"<",
"String",
">",
"listFiles",
"(",
"ClassLoader",
"classLoader",
",",
"String",
"rootPath",
")",
"{",
"return",
"listResources",
"(",
"classLoader",
",",
"rootPath",
",",
"path",
"->",
"!",
"StringUtils",
".",
"endsWith",
"(",
"path",
",",
"\"/\"",
")",
")",
";",
"}"
] | Finds files within a given directory and its subdirectories
@param classLoader
@param rootPath the root directory, for example org/sonar/sqale
@return a list of relative paths, for example {"org/sonar/sqale/foo/bar.txt}. Never null. | [
"Finds",
"files",
"within",
"a",
"given",
"directory",
"and",
"its",
"subdirectories"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/util/ClassLoaderUtils.java#L50-L52 |
lucee/Lucee | core/src/main/java/lucee/transformer/library/tag/TagLibTag.java | TagLibTag.setTTEClassDefinition | protected void setTTEClassDefinition(String tteClass, Identification id, Attributes attr) {
"""
Setzt die implementierende Klassendefinition des Evaluator. Diese Methode wird durch die Klasse
TagLibFactory verwendet.
@param tteClass Klassendefinition der Evaluator-Implementation.
"""
this.tteCD = ClassDefinitionImpl.toClassDefinition(tteClass, id, attr);
} | java | protected void setTTEClassDefinition(String tteClass, Identification id, Attributes attr) {
this.tteCD = ClassDefinitionImpl.toClassDefinition(tteClass, id, attr);
} | [
"protected",
"void",
"setTTEClassDefinition",
"(",
"String",
"tteClass",
",",
"Identification",
"id",
",",
"Attributes",
"attr",
")",
"{",
"this",
".",
"tteCD",
"=",
"ClassDefinitionImpl",
".",
"toClassDefinition",
"(",
"tteClass",
",",
"id",
",",
"attr",
")",
";",
"}"
] | Setzt die implementierende Klassendefinition des Evaluator. Diese Methode wird durch die Klasse
TagLibFactory verwendet.
@param tteClass Klassendefinition der Evaluator-Implementation. | [
"Setzt",
"die",
"implementierende",
"Klassendefinition",
"des",
"Evaluator",
".",
"Diese",
"Methode",
"wird",
"durch",
"die",
"Klasse",
"TagLibFactory",
"verwendet",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLibTag.java#L584-L586 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java | BoxApiFile.getDeleteVersionRequest | public BoxRequestsFile.DeleteFileVersion getDeleteVersionRequest(String id, String versionId) {
"""
Gets a request that deletes a version of a file
@param id id of the file to delete a version of
@param versionId id of the file version to delete
@return request to delete a file version
"""
BoxRequestsFile.DeleteFileVersion request = new BoxRequestsFile.DeleteFileVersion(versionId, getDeleteFileVersionUrl(id, versionId), mSession);
return request;
} | java | public BoxRequestsFile.DeleteFileVersion getDeleteVersionRequest(String id, String versionId) {
BoxRequestsFile.DeleteFileVersion request = new BoxRequestsFile.DeleteFileVersion(versionId, getDeleteFileVersionUrl(id, versionId), mSession);
return request;
} | [
"public",
"BoxRequestsFile",
".",
"DeleteFileVersion",
"getDeleteVersionRequest",
"(",
"String",
"id",
",",
"String",
"versionId",
")",
"{",
"BoxRequestsFile",
".",
"DeleteFileVersion",
"request",
"=",
"new",
"BoxRequestsFile",
".",
"DeleteFileVersion",
"(",
"versionId",
",",
"getDeleteFileVersionUrl",
"(",
"id",
",",
"versionId",
")",
",",
"mSession",
")",
";",
"return",
"request",
";",
"}"
] | Gets a request that deletes a version of a file
@param id id of the file to delete a version of
@param versionId id of the file version to delete
@return request to delete a file version | [
"Gets",
"a",
"request",
"that",
"deletes",
"a",
"version",
"of",
"a",
"file"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L533-L536 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/ArtFinder.java | ArtFinder.updateArt | private void updateArt(TrackMetadataUpdate update, AlbumArt art) {
"""
We have obtained album art for a device, so store it and alert any listeners.
@param update the update which caused us to retrieve this art
@param art the album art which we retrieved
"""
hotCache.put(DeckReference.getDeckReference(update.player, 0), art); // Main deck
if (update.metadata.getCueList() != null) { // Update the cache with any hot cues in this track as well
for (CueList.Entry entry : update.metadata.getCueList().entries) {
if (entry.hotCueNumber != 0) {
hotCache.put(DeckReference.getDeckReference(update.player, entry.hotCueNumber), art);
}
}
}
deliverAlbumArtUpdate(update.player, art);
} | java | private void updateArt(TrackMetadataUpdate update, AlbumArt art) {
hotCache.put(DeckReference.getDeckReference(update.player, 0), art); // Main deck
if (update.metadata.getCueList() != null) { // Update the cache with any hot cues in this track as well
for (CueList.Entry entry : update.metadata.getCueList().entries) {
if (entry.hotCueNumber != 0) {
hotCache.put(DeckReference.getDeckReference(update.player, entry.hotCueNumber), art);
}
}
}
deliverAlbumArtUpdate(update.player, art);
} | [
"private",
"void",
"updateArt",
"(",
"TrackMetadataUpdate",
"update",
",",
"AlbumArt",
"art",
")",
"{",
"hotCache",
".",
"put",
"(",
"DeckReference",
".",
"getDeckReference",
"(",
"update",
".",
"player",
",",
"0",
")",
",",
"art",
")",
";",
"// Main deck",
"if",
"(",
"update",
".",
"metadata",
".",
"getCueList",
"(",
")",
"!=",
"null",
")",
"{",
"// Update the cache with any hot cues in this track as well",
"for",
"(",
"CueList",
".",
"Entry",
"entry",
":",
"update",
".",
"metadata",
".",
"getCueList",
"(",
")",
".",
"entries",
")",
"{",
"if",
"(",
"entry",
".",
"hotCueNumber",
"!=",
"0",
")",
"{",
"hotCache",
".",
"put",
"(",
"DeckReference",
".",
"getDeckReference",
"(",
"update",
".",
"player",
",",
"entry",
".",
"hotCueNumber",
")",
",",
"art",
")",
";",
"}",
"}",
"}",
"deliverAlbumArtUpdate",
"(",
"update",
".",
"player",
",",
"art",
")",
";",
"}"
] | We have obtained album art for a device, so store it and alert any listeners.
@param update the update which caused us to retrieve this art
@param art the album art which we retrieved | [
"We",
"have",
"obtained",
"album",
"art",
"for",
"a",
"device",
"so",
"store",
"it",
"and",
"alert",
"any",
"listeners",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/ArtFinder.java#L177-L187 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmAttributes.java | XsdAsmAttributes.numericAdjustment | private static void numericAdjustment(MethodVisitor mVisitor, String javaType) {
"""
Applies a cast to numeric types, i.e. int, short, long, to double.
@param mVisitor The visitor of the attribute constructor.
@param javaType The type of the argument received in the constructor.
"""
adjustmentsMapper.getOrDefault(javaType, XsdAsmAttributes::doubleAdjustment).accept(mVisitor);
} | java | private static void numericAdjustment(MethodVisitor mVisitor, String javaType) {
adjustmentsMapper.getOrDefault(javaType, XsdAsmAttributes::doubleAdjustment).accept(mVisitor);
} | [
"private",
"static",
"void",
"numericAdjustment",
"(",
"MethodVisitor",
"mVisitor",
",",
"String",
"javaType",
")",
"{",
"adjustmentsMapper",
".",
"getOrDefault",
"(",
"javaType",
",",
"XsdAsmAttributes",
"::",
"doubleAdjustment",
")",
".",
"accept",
"(",
"mVisitor",
")",
";",
"}"
] | Applies a cast to numeric types, i.e. int, short, long, to double.
@param mVisitor The visitor of the attribute constructor.
@param javaType The type of the argument received in the constructor. | [
"Applies",
"a",
"cast",
"to",
"numeric",
"types",
"i",
".",
"e",
".",
"int",
"short",
"long",
"to",
"double",
"."
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmAttributes.java#L280-L282 |
katjahahn/PortEx | src/main/java/com/github/katjahahn/parser/PEData.java | PEData.readMSDOSLoadModule | @Beta
// TODO maybe load with PELoader
public MSDOSLoadModule readMSDOSLoadModule() throws IOException {
"""
Reads and returns the {@link MSDOSLoadModule}.
@return msdos load module
@throws IOException if load module can not be read.
"""
MSDOSLoadModule module = new MSDOSLoadModule(msdos, file);
module.read();
return module;
} | java | @Beta
// TODO maybe load with PELoader
public MSDOSLoadModule readMSDOSLoadModule() throws IOException {
MSDOSLoadModule module = new MSDOSLoadModule(msdos, file);
module.read();
return module;
} | [
"@",
"Beta",
"// TODO maybe load with PELoader",
"public",
"MSDOSLoadModule",
"readMSDOSLoadModule",
"(",
")",
"throws",
"IOException",
"{",
"MSDOSLoadModule",
"module",
"=",
"new",
"MSDOSLoadModule",
"(",
"msdos",
",",
"file",
")",
";",
"module",
".",
"read",
"(",
")",
";",
"return",
"module",
";",
"}"
] | Reads and returns the {@link MSDOSLoadModule}.
@return msdos load module
@throws IOException if load module can not be read. | [
"Reads",
"and",
"returns",
"the",
"{",
"@link",
"MSDOSLoadModule",
"}",
"."
] | train | https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/PEData.java#L124-L130 |
MKLab-ITI/multimedia-indexing | src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java | ImageIOGreyScale.createImageOutputStream | public static ImageOutputStream createImageOutputStream(Object output) throws IOException {
"""
Returns an <code>ImageOutputStream</code> that will send its output to the given <code>Object</code>.
The set of <code>ImageOutputStreamSpi</code>s registered with the <code>IIORegistry</code> class is
queried and the first one that is able to send output from the supplied object is used to create the
returned <code>ImageOutputStream</code>. If no suitable <code>ImageOutputStreamSpi</code> exists,
<code>null</code> is returned.
<p>
The current cache settings from <code>getUseCache</code>and <code>getCacheDirectory</code> will be used
to control caching.
@param output
an <code>Object</code> to be used as an output destination, such as a <code>File</code>,
writable <code>RandomAccessFile</code>, or <code>OutputStream</code>.
@return an <code>ImageOutputStream</code>, or <code>null</code>.
@exception IllegalArgumentException
if <code>output</code> is <code>null</code>.
@exception IOException
if a cache file is needed but cannot be created.
@see javax.imageio.spi.ImageOutputStreamSpi
"""
if (output == null) {
throw new IllegalArgumentException("output == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageOutputStreamSpi.class, true);
} catch (IllegalArgumentException e) {
return null;
}
boolean usecache = getUseCache() && hasCachePermission();
while (iter.hasNext()) {
ImageOutputStreamSpi spi = (ImageOutputStreamSpi) iter.next();
if (spi.getOutputClass().isInstance(output)) {
try {
return spi.createOutputStreamInstance(output, usecache, getCacheDirectory());
} catch (IOException e) {
throw new IIOException("Can't create cache file!", e);
}
}
}
return null;
} | java | public static ImageOutputStream createImageOutputStream(Object output) throws IOException {
if (output == null) {
throw new IllegalArgumentException("output == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageOutputStreamSpi.class, true);
} catch (IllegalArgumentException e) {
return null;
}
boolean usecache = getUseCache() && hasCachePermission();
while (iter.hasNext()) {
ImageOutputStreamSpi spi = (ImageOutputStreamSpi) iter.next();
if (spi.getOutputClass().isInstance(output)) {
try {
return spi.createOutputStreamInstance(output, usecache, getCacheDirectory());
} catch (IOException e) {
throw new IIOException("Can't create cache file!", e);
}
}
}
return null;
} | [
"public",
"static",
"ImageOutputStream",
"createImageOutputStream",
"(",
"Object",
"output",
")",
"throws",
"IOException",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"output == null!\"",
")",
";",
"}",
"Iterator",
"iter",
";",
"// Ensure category is present\r",
"try",
"{",
"iter",
"=",
"theRegistry",
".",
"getServiceProviders",
"(",
"ImageOutputStreamSpi",
".",
"class",
",",
"true",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"boolean",
"usecache",
"=",
"getUseCache",
"(",
")",
"&&",
"hasCachePermission",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"ImageOutputStreamSpi",
"spi",
"=",
"(",
"ImageOutputStreamSpi",
")",
"iter",
".",
"next",
"(",
")",
";",
"if",
"(",
"spi",
".",
"getOutputClass",
"(",
")",
".",
"isInstance",
"(",
"output",
")",
")",
"{",
"try",
"{",
"return",
"spi",
".",
"createOutputStreamInstance",
"(",
"output",
",",
"usecache",
",",
"getCacheDirectory",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IIOException",
"(",
"\"Can't create cache file!\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | Returns an <code>ImageOutputStream</code> that will send its output to the given <code>Object</code>.
The set of <code>ImageOutputStreamSpi</code>s registered with the <code>IIORegistry</code> class is
queried and the first one that is able to send output from the supplied object is used to create the
returned <code>ImageOutputStream</code>. If no suitable <code>ImageOutputStreamSpi</code> exists,
<code>null</code> is returned.
<p>
The current cache settings from <code>getUseCache</code>and <code>getCacheDirectory</code> will be used
to control caching.
@param output
an <code>Object</code> to be used as an output destination, such as a <code>File</code>,
writable <code>RandomAccessFile</code>, or <code>OutputStream</code>.
@return an <code>ImageOutputStream</code>, or <code>null</code>.
@exception IllegalArgumentException
if <code>output</code> is <code>null</code>.
@exception IOException
if a cache file is needed but cannot be created.
@see javax.imageio.spi.ImageOutputStreamSpi | [
"Returns",
"an",
"<code",
">",
"ImageOutputStream<",
"/",
"code",
">",
"that",
"will",
"send",
"its",
"output",
"to",
"the",
"given",
"<code",
">",
"Object<",
"/",
"code",
">",
".",
"The",
"set",
"of",
"<code",
">",
"ImageOutputStreamSpi<",
"/",
"code",
">",
"s",
"registered",
"with",
"the",
"<code",
">",
"IIORegistry<",
"/",
"code",
">",
"class",
"is",
"queried",
"and",
"the",
"first",
"one",
"that",
"is",
"able",
"to",
"send",
"output",
"from",
"the",
"supplied",
"object",
"is",
"used",
"to",
"create",
"the",
"returned",
"<code",
">",
"ImageOutputStream<",
"/",
"code",
">",
".",
"If",
"no",
"suitable",
"<code",
">",
"ImageOutputStreamSpi<",
"/",
"code",
">",
"exists",
"<code",
">",
"null<",
"/",
"code",
">",
"is",
"returned",
"."
] | train | https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java#L351-L378 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/model/EntityType_CustomFieldSerializer.java | EntityType_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, EntityType instance) throws SerializationException {
"""
Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful
"""
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, EntityType instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"EntityType",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/model/EntityType_CustomFieldSerializer.java#L132-L135 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/override/OverrideHelper.java | OverrideHelper.getResolvedFeatures | public ResolvedFeatures getResolvedFeatures(LightweightTypeReference contextType, JavaVersion targetVersion) {
"""
Returns the resolved features targeting a specific Java version in order to support new language features.
"""
return new ResolvedFeatures(contextType, overrideTester, targetVersion);
} | java | public ResolvedFeatures getResolvedFeatures(LightweightTypeReference contextType, JavaVersion targetVersion) {
return new ResolvedFeatures(contextType, overrideTester, targetVersion);
} | [
"public",
"ResolvedFeatures",
"getResolvedFeatures",
"(",
"LightweightTypeReference",
"contextType",
",",
"JavaVersion",
"targetVersion",
")",
"{",
"return",
"new",
"ResolvedFeatures",
"(",
"contextType",
",",
"overrideTester",
",",
"targetVersion",
")",
";",
"}"
] | Returns the resolved features targeting a specific Java version in order to support new language features. | [
"Returns",
"the",
"resolved",
"features",
"targeting",
"a",
"specific",
"Java",
"version",
"in",
"order",
"to",
"support",
"new",
"language",
"features",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/override/OverrideHelper.java#L236-L238 |
playn/playn | html/src/playn/html/HtmlInput.java | HtmlInput.capturePageEvent | static HandlerRegistration capturePageEvent (String name, EventHandler handler) {
"""
Capture events that occur anywhere on the page. Event values will be relative to the page
(not the rootElement) {@see #getRelativeX(NativeEvent, Element)} and
{@see #getRelativeY(NativeEvent, Element)}.
"""
return addEventListener(Document.get(), name, handler, true);
} | java | static HandlerRegistration capturePageEvent (String name, EventHandler handler) {
return addEventListener(Document.get(), name, handler, true);
} | [
"static",
"HandlerRegistration",
"capturePageEvent",
"(",
"String",
"name",
",",
"EventHandler",
"handler",
")",
"{",
"return",
"addEventListener",
"(",
"Document",
".",
"get",
"(",
")",
",",
"name",
",",
"handler",
",",
"true",
")",
";",
"}"
] | Capture events that occur anywhere on the page. Event values will be relative to the page
(not the rootElement) {@see #getRelativeX(NativeEvent, Element)} and
{@see #getRelativeY(NativeEvent, Element)}. | [
"Capture",
"events",
"that",
"occur",
"anywhere",
"on",
"the",
"page",
".",
"Event",
"values",
"will",
"be",
"relative",
"to",
"the",
"page",
"(",
"not",
"the",
"rootElement",
")",
"{"
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/html/HtmlInput.java#L296-L298 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.