id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
117,500 | biezhi/anima | src/main/java/io/github/biezhi/anima/core/AnimaCache.java | AnimaCache.getTableName | public static String getTableName(String className, String prefix) {
boolean hasPrefix = prefix != null && prefix.trim().length() > 0;
return hasPrefix ? English.plural(prefix + "_" + AnimaUtils.toUnderline(className), 2) : English.plural(AnimaUtils.toUnderline(className), 2);
} | java | public static String getTableName(String className, String prefix) {
boolean hasPrefix = prefix != null && prefix.trim().length() > 0;
return hasPrefix ? English.plural(prefix + "_" + AnimaUtils.toUnderline(className), 2) : English.plural(AnimaUtils.toUnderline(className), 2);
} | [
"public",
"static",
"String",
"getTableName",
"(",
"String",
"className",
",",
"String",
"prefix",
")",
"{",
"boolean",
"hasPrefix",
"=",
"prefix",
"!=",
"null",
"&&",
"prefix",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
";",
"return",
"... | User -> users
User -> t_users
@param className
@param prefix
@return | [
"User",
"-",
">",
"users",
"User",
"-",
">",
"t_users"
] | d6655e47ac4c08d9d7f961ac0569062bead8b1ed | https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/core/AnimaCache.java#L79-L82 |
117,501 | jscep/jscep | src/main/java/org/jscep/client/inspect/AbstractCertStoreInspector.java | AbstractCertStoreInspector.selectCertificate | X509Certificate selectCertificate(final CertStore store,
final Collection<X509CertSelector> selectors) throws CertStoreException {
for (CertSelector selector : selectors) {
LOGGER.debug("Selecting certificate using {}", selector);
Collection<? extends Certificate> certs = store
.getCertificates(selector... | java | X509Certificate selectCertificate(final CertStore store,
final Collection<X509CertSelector> selectors) throws CertStoreException {
for (CertSelector selector : selectors) {
LOGGER.debug("Selecting certificate using {}", selector);
Collection<? extends Certificate> certs = store
.getCertificates(selector... | [
"X509Certificate",
"selectCertificate",
"(",
"final",
"CertStore",
"store",
",",
"final",
"Collection",
"<",
"X509CertSelector",
">",
"selectors",
")",
"throws",
"CertStoreException",
"{",
"for",
"(",
"CertSelector",
"selector",
":",
"selectors",
")",
"{",
"LOGGER",... | Finds the certificate of the SCEP message object recipient.
@param store
the certificate store to inspect.
@return the recipient's certificate.
@throws CertStoreException
if the CertStore cannot be inspected | [
"Finds",
"the",
"certificate",
"of",
"the",
"SCEP",
"message",
"object",
"recipient",
"."
] | d2c602f8b3adb774704c24eaf62f6b8654a40e35 | https://github.com/jscep/jscep/blob/d2c602f8b3adb774704c24eaf62f6b8654a40e35/src/main/java/org/jscep/client/inspect/AbstractCertStoreInspector.java#L72-L87 |
117,502 | jscep/jscep | src/main/java/org/jscep/client/Client.java | Client.validateInput | private void validateInput() {
// Check for null values first.
if (url == null) {
throw new NullPointerException("URL should not be null");
}
if (!url.getProtocol().matches("^https?$")) {
throw new IllegalArgumentException(
"URL protocol should... | java | private void validateInput() {
// Check for null values first.
if (url == null) {
throw new NullPointerException("URL should not be null");
}
if (!url.getProtocol().matches("^https?$")) {
throw new IllegalArgumentException(
"URL protocol should... | [
"private",
"void",
"validateInput",
"(",
")",
"{",
"// Check for null values first.",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"URL should not be null\"",
")",
";",
"}",
"if",
"(",
"!",
"url",
".",
"getProtocol",
... | Validates all the input to this client. | [
"Validates",
"all",
"the",
"input",
"to",
"this",
"client",
"."
] | d2c602f8b3adb774704c24eaf62f6b8654a40e35 | https://github.com/jscep/jscep/blob/d2c602f8b3adb774704c24eaf62f6b8654a40e35/src/main/java/org/jscep/client/Client.java#L175-L196 |
117,503 | jscep/jscep | src/main/java/org/jscep/client/Client.java | Client.createTransport | private Transport createTransport(final String profile) {
if (getCaCapabilities(profile).isPostSupported()) {
return transportFactory.forMethod(Method.POST, url);
} else {
return transportFactory.forMethod(Method.GET, url);
}
} | java | private Transport createTransport(final String profile) {
if (getCaCapabilities(profile).isPostSupported()) {
return transportFactory.forMethod(Method.POST, url);
} else {
return transportFactory.forMethod(Method.GET, url);
}
} | [
"private",
"Transport",
"createTransport",
"(",
"final",
"String",
"profile",
")",
"{",
"if",
"(",
"getCaCapabilities",
"(",
"profile",
")",
".",
"isPostSupported",
"(",
")",
")",
"{",
"return",
"transportFactory",
".",
"forMethod",
"(",
"Method",
".",
"POST",... | Creates a new transport based on the capabilities of the server.
@param profile
profile to use for determining if HTTP POST is supported
@return the new transport. | [
"Creates",
"a",
"new",
"transport",
"based",
"on",
"the",
"capabilities",
"of",
"the",
"server",
"."
] | d2c602f8b3adb774704c24eaf62f6b8654a40e35 | https://github.com/jscep/jscep/blob/d2c602f8b3adb774704c24eaf62f6b8654a40e35/src/main/java/org/jscep/client/Client.java#L731-L737 |
117,504 | jscep/jscep | src/main/java/org/jscep/client/verification/ConsoleCertificateVerifier.java | ConsoleCertificateVerifier.verify | @Override
public boolean verify(final X509Certificate cert) {
final List<String> algs = new ArrayList<String>(
getAlgorithms(MessageDigest.class.getSimpleName()));
Collections.sort(algs);
int max = 0;
for (final String alg : algs) {
if (alg.length() > max)... | java | @Override
public boolean verify(final X509Certificate cert) {
final List<String> algs = new ArrayList<String>(
getAlgorithms(MessageDigest.class.getSimpleName()));
Collections.sort(algs);
int max = 0;
for (final String alg : algs) {
if (alg.length() > max)... | [
"@",
"Override",
"public",
"boolean",
"verify",
"(",
"final",
"X509Certificate",
"cert",
")",
"{",
"final",
"List",
"<",
"String",
">",
"algs",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"getAlgorithms",
"(",
"MessageDigest",
".",
"class",
".",
"get... | Use the system console to prompt the user with each available hash.
@param cert
the certificate to verify
@return <tt>true</tt> if the certificate is verified, <tt>false</tt>
otherwise. | [
"Use",
"the",
"system",
"console",
"to",
"prompt",
"the",
"user",
"with",
"each",
"available",
"hash",
"."
] | d2c602f8b3adb774704c24eaf62f6b8654a40e35 | https://github.com/jscep/jscep/blob/d2c602f8b3adb774704c24eaf62f6b8654a40e35/src/main/java/org/jscep/client/verification/ConsoleCertificateVerifier.java#L35-L78 |
117,505 | jscep/jscep | src/main/java/org/jscep/message/PkcsPkiEnvelopeEncoder.java | PkcsPkiEnvelopeEncoder.encode | public CMSEnvelopedData encode(final byte[] messageData)
throws MessageEncodingException {
LOGGER.debug("Encoding pkcsPkiEnvelope");
CMSEnvelopedDataGenerator edGenerator = new CMSEnvelopedDataGenerator();
CMSTypedData envelopable = new CMSProcessableByteArray(messageData);
R... | java | public CMSEnvelopedData encode(final byte[] messageData)
throws MessageEncodingException {
LOGGER.debug("Encoding pkcsPkiEnvelope");
CMSEnvelopedDataGenerator edGenerator = new CMSEnvelopedDataGenerator();
CMSTypedData envelopable = new CMSProcessableByteArray(messageData);
R... | [
"public",
"CMSEnvelopedData",
"encode",
"(",
"final",
"byte",
"[",
"]",
"messageData",
")",
"throws",
"MessageEncodingException",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Encoding pkcsPkiEnvelope\"",
")",
";",
"CMSEnvelopedDataGenerator",
"edGenerator",
"=",
"new",
"CMSEn... | Encrypts and envelops the provided messageData.
@param messageData
the message data to encrypt and envelop.
@return the enveloped data.
@throws MessageEncodingException
if there are any problems encoding the message. | [
"Encrypts",
"and",
"envelops",
"the",
"provided",
"messageData",
"."
] | d2c602f8b3adb774704c24eaf62f6b8654a40e35 | https://github.com/jscep/jscep/blob/d2c602f8b3adb774704c24eaf62f6b8654a40e35/src/main/java/org/jscep/message/PkcsPkiEnvelopeEncoder.java#L73-L105 |
117,506 | jscep/jscep | src/main/java/org/jscep/transport/response/Capabilities.java | Capabilities.getStrongestCipher | public String getStrongestCipher() {
final String cipher;
if (cipherExists("AES") && caps.contains(Capability.AES)) {
cipher = "AES";
} else if (cipherExists("DESede")
&& caps.contains(Capability.TRIPLE_DES)) {
cipher = "DESede";
} else {
... | java | public String getStrongestCipher() {
final String cipher;
if (cipherExists("AES") && caps.contains(Capability.AES)) {
cipher = "AES";
} else if (cipherExists("DESede")
&& caps.contains(Capability.TRIPLE_DES)) {
cipher = "DESede";
} else {
... | [
"public",
"String",
"getStrongestCipher",
"(",
")",
"{",
"final",
"String",
"cipher",
";",
"if",
"(",
"cipherExists",
"(",
"\"AES\"",
")",
"&&",
"caps",
".",
"contains",
"(",
"Capability",
".",
"AES",
")",
")",
"{",
"cipher",
"=",
"\"AES\"",
";",
"}",
... | Returns the strongest cipher algorithm supported by the server and
client.
The algorithms are ordered thus:
<ol>
<li>AES</li>
<li>DESede ("Triple DES")</li>
<li>DES</li>
</ol>
@return the strongest cipher algorithm supported by the server and
client. | [
"Returns",
"the",
"strongest",
"cipher",
"algorithm",
"supported",
"by",
"the",
"server",
"and",
"client",
"."
] | d2c602f8b3adb774704c24eaf62f6b8654a40e35 | https://github.com/jscep/jscep/blob/d2c602f8b3adb774704c24eaf62f6b8654a40e35/src/main/java/org/jscep/transport/response/Capabilities.java#L107-L119 |
117,507 | jscep/jscep | src/main/java/org/jscep/transport/response/Capabilities.java | Capabilities.getStrongestMessageDigest | public MessageDigest getStrongestMessageDigest() {
if (digestExists("SHA-512") && caps.contains(Capability.SHA_512)) {
return getDigest("SHA-512");
} else if (digestExists("SHA-256") && caps.contains(Capability.SHA_256)) {
return getDigest("SHA-256");
} else if (digestExi... | java | public MessageDigest getStrongestMessageDigest() {
if (digestExists("SHA-512") && caps.contains(Capability.SHA_512)) {
return getDigest("SHA-512");
} else if (digestExists("SHA-256") && caps.contains(Capability.SHA_256)) {
return getDigest("SHA-256");
} else if (digestExi... | [
"public",
"MessageDigest",
"getStrongestMessageDigest",
"(",
")",
"{",
"if",
"(",
"digestExists",
"(",
"\"SHA-512\"",
")",
"&&",
"caps",
".",
"contains",
"(",
"Capability",
".",
"SHA_512",
")",
")",
"{",
"return",
"getDigest",
"(",
"\"SHA-512\"",
")",
";",
"... | Returns the strongest message digest algorithm supported by the server
and client.
The algorithms are ordered thus:
<ol>
<li>SHA-512</li>
<li>SHA-256</li>
<li>SHA-1</li>
<li>MD5</li>
</ol>
If none of the above algorithms are supported, this method returns null.
@return the strongest message digest algorithm supported... | [
"Returns",
"the",
"strongest",
"message",
"digest",
"algorithm",
"supported",
"by",
"the",
"server",
"and",
"client",
"."
] | d2c602f8b3adb774704c24eaf62f6b8654a40e35 | https://github.com/jscep/jscep/blob/d2c602f8b3adb774704c24eaf62f6b8654a40e35/src/main/java/org/jscep/transport/response/Capabilities.java#L155-L166 |
117,508 | jscep/jscep | src/main/java/org/jscep/util/SignedDataUtils.java | SignedDataUtils.isSignedBy | public static boolean isSignedBy(final CMSSignedData sd,
final X509Certificate signer) {
SignerInformationStore store = sd.getSignerInfos();
SignerInformation signerInfo = store.get(new JcaSignerId(signer));
if (signerInfo == null) {
return false;
}
CMSSig... | java | public static boolean isSignedBy(final CMSSignedData sd,
final X509Certificate signer) {
SignerInformationStore store = sd.getSignerInfos();
SignerInformation signerInfo = store.get(new JcaSignerId(signer));
if (signerInfo == null) {
return false;
}
CMSSig... | [
"public",
"static",
"boolean",
"isSignedBy",
"(",
"final",
"CMSSignedData",
"sd",
",",
"final",
"X509Certificate",
"signer",
")",
"{",
"SignerInformationStore",
"store",
"=",
"sd",
".",
"getSignerInfos",
"(",
")",
";",
"SignerInformation",
"signerInfo",
"=",
"stor... | Checks if the provided signedData was signed by the entity represented by
the provided certificate.
@param sd
the signedData to verify.
@param signer
the signing entity.
@return <code>true</code> if the signedData was signed by the entity,
<code>false</code> otherwise. | [
"Checks",
"if",
"the",
"provided",
"signedData",
"was",
"signed",
"by",
"the",
"entity",
"represented",
"by",
"the",
"provided",
"certificate",
"."
] | d2c602f8b3adb774704c24eaf62f6b8654a40e35 | https://github.com/jscep/jscep/blob/d2c602f8b3adb774704c24eaf62f6b8654a40e35/src/main/java/org/jscep/util/SignedDataUtils.java#L60-L90 |
117,509 | jscep/jscep | src/main/java/org/jscep/util/X500Utils.java | X500Utils.toX500Name | public static X500Name toX500Name(final X500Principal principal) {
byte[] bytes = principal.getEncoded();
return X500Name.getInstance(bytes);
} | java | public static X500Name toX500Name(final X500Principal principal) {
byte[] bytes = principal.getEncoded();
return X500Name.getInstance(bytes);
} | [
"public",
"static",
"X500Name",
"toX500Name",
"(",
"final",
"X500Principal",
"principal",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"principal",
".",
"getEncoded",
"(",
")",
";",
"return",
"X500Name",
".",
"getInstance",
"(",
"bytes",
")",
";",
"}"
] | Converts a Java SE X500Principal to a Bouncy Castle X500Name.
@param principal
the principal to convert.
@return the converted name. | [
"Converts",
"a",
"Java",
"SE",
"X500Principal",
"to",
"a",
"Bouncy",
"Castle",
"X500Name",
"."
] | d2c602f8b3adb774704c24eaf62f6b8654a40e35 | https://github.com/jscep/jscep/blob/d2c602f8b3adb774704c24eaf62f6b8654a40e35/src/main/java/org/jscep/util/X500Utils.java#L22-L25 |
117,510 | ocpsoft/prettytime | nlp/src/main/java/org/ocpsoft/prettytime/nlp/PrettyTimeParser.java | PrettyTimeParser.provideRepresentation | private String provideRepresentation(int number)
{
String key;
if (number == 0)
key = "zero";
else if (number < 20)
key = numNames[number];
else if (number < 100)
{
int unit = number % 10;
key = tensNames[number / 10] + numNames[unit];
}
... | java | private String provideRepresentation(int number)
{
String key;
if (number == 0)
key = "zero";
else if (number < 20)
key = numNames[number];
else if (number < 100)
{
int unit = number % 10;
key = tensNames[number / 10] + numNames[unit];
}
... | [
"private",
"String",
"provideRepresentation",
"(",
"int",
"number",
")",
"{",
"String",
"key",
";",
"if",
"(",
"number",
"==",
"0",
")",
"key",
"=",
"\"zero\"",
";",
"else",
"if",
"(",
"number",
"<",
"20",
")",
"key",
"=",
"numNames",
"[",
"number",
... | Provides a string representation for the number passed. This method works for limited set of numbers as parsing
will only be done at maximum for 2400, which will be used in military time format. | [
"Provides",
"a",
"string",
"representation",
"for",
"the",
"number",
"passed",
".",
"This",
"method",
"works",
"for",
"limited",
"set",
"of",
"numbers",
"as",
"parsing",
"will",
"only",
"be",
"done",
"at",
"maximum",
"for",
"2400",
"which",
"will",
"be",
"... | 8a742bd1d8eaacc2a36865d144a43ea0211e25b7 | https://github.com/ocpsoft/prettytime/blob/8a742bd1d8eaacc2a36865d144a43ea0211e25b7/nlp/src/main/java/org/ocpsoft/prettytime/nlp/PrettyTimeParser.java#L112-L140 |
117,511 | xerial/snappy-java | src/main/java/org/xerial/snappy/SnappyFramedOutputStream.java | SnappyFramedOutputStream.flushBuffer | private void flushBuffer()
throws IOException
{
if (buffer.position() > 0) {
buffer.flip();
writeCompressed(buffer);
buffer.clear();
}
} | java | private void flushBuffer()
throws IOException
{
if (buffer.position() > 0) {
buffer.flip();
writeCompressed(buffer);
buffer.clear();
}
} | [
"private",
"void",
"flushBuffer",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
".",
"position",
"(",
")",
">",
"0",
")",
"{",
"buffer",
".",
"flip",
"(",
")",
";",
"writeCompressed",
"(",
"buffer",
")",
";",
"buffer",
".",
"clear",
"(... | Compresses and writes out any buffered data. This does nothing if there
is no currently buffered data.
@throws IOException | [
"Compresses",
"and",
"writes",
"out",
"any",
"buffered",
"data",
".",
"This",
"does",
"nothing",
"if",
"there",
"is",
"no",
"currently",
"buffered",
"data",
"."
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/SnappyFramedOutputStream.java#L385-L393 |
117,512 | xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.arrayCopy | public static void arrayCopy(Object src, int offset, int byteLength, Object dest, int dest_offset)
throws IOException
{
impl.arrayCopy(src, offset, byteLength, dest, dest_offset);
} | java | public static void arrayCopy(Object src, int offset, int byteLength, Object dest, int dest_offset)
throws IOException
{
impl.arrayCopy(src, offset, byteLength, dest, dest_offset);
} | [
"public",
"static",
"void",
"arrayCopy",
"(",
"Object",
"src",
",",
"int",
"offset",
",",
"int",
"byteLength",
",",
"Object",
"dest",
",",
"int",
"dest_offset",
")",
"throws",
"IOException",
"{",
"impl",
".",
"arrayCopy",
"(",
"src",
",",
"offset",
",",
... | Copy bytes from source to destination
@param src pointer to the source array
@param offset byte offset in the source array
@param byteLength the number of bytes to copy
@param dest pointer to the destination array
@param dest_offset byte offset in the destination array
@throws IOException | [
"Copy",
"bytes",
"from",
"source",
"to",
"destination"
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L82-L86 |
117,513 | xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.compress | public static int compress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset)
throws IOException
{
return rawCompress(input, inputOffset, inputLength, output, outputOffset);
} | java | public static int compress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset)
throws IOException
{
return rawCompress(input, inputOffset, inputLength, output, outputOffset);
} | [
"public",
"static",
"int",
"compress",
"(",
"byte",
"[",
"]",
"input",
",",
"int",
"inputOffset",
",",
"int",
"inputLength",
",",
"byte",
"[",
"]",
"output",
",",
"int",
"outputOffset",
")",
"throws",
"IOException",
"{",
"return",
"rawCompress",
"(",
"inpu... | Compress the input buffer content in [inputOffset,
...inputOffset+inputLength) then output to the specified output buffer.
@param input
@param inputOffset
@param inputLength
@param output
@param outputOffset
@return byte size of the compressed data
@throws IOException when failed to access the input/output buffer | [
"Compress",
"the",
"input",
"buffer",
"content",
"in",
"[",
"inputOffset",
"...",
"inputOffset",
"+",
"inputLength",
")",
"then",
"output",
"to",
"the",
"specified",
"output",
"buffer",
"."
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L116-L120 |
117,514 | xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.getNativeLibraryVersion | public static String getNativeLibraryVersion()
{
URL versionFile = SnappyLoader.class.getResource("/org/xerial/snappy/VERSION");
String version = "unknown";
try {
if (versionFile != null) {
InputStream in = null;
try {
Properti... | java | public static String getNativeLibraryVersion()
{
URL versionFile = SnappyLoader.class.getResource("/org/xerial/snappy/VERSION");
String version = "unknown";
try {
if (versionFile != null) {
InputStream in = null;
try {
Properti... | [
"public",
"static",
"String",
"getNativeLibraryVersion",
"(",
")",
"{",
"URL",
"versionFile",
"=",
"SnappyLoader",
".",
"class",
".",
"getResource",
"(",
"\"/org/xerial/snappy/VERSION\"",
")",
";",
"String",
"version",
"=",
"\"unknown\"",
";",
"try",
"{",
"if",
... | Get the native library version of the snappy
@return native library version | [
"Get",
"the",
"native",
"library",
"version",
"of",
"the",
"snappy"
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L284-L313 |
117,515 | xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.rawCompress | public static long rawCompress(long inputAddr, long inputSize, long destAddr)
throws IOException
{
return impl.rawCompress(inputAddr, inputSize, destAddr);
} | java | public static long rawCompress(long inputAddr, long inputSize, long destAddr)
throws IOException
{
return impl.rawCompress(inputAddr, inputSize, destAddr);
} | [
"public",
"static",
"long",
"rawCompress",
"(",
"long",
"inputAddr",
",",
"long",
"inputSize",
",",
"long",
"destAddr",
")",
"throws",
"IOException",
"{",
"return",
"impl",
".",
"rawCompress",
"(",
"inputAddr",
",",
"inputSize",
",",
"destAddr",
")",
";",
"}... | Zero-copy compress using memory addresses.
@param inputAddr input memory address
@param inputSize input byte size
@param destAddr destination address of the compressed data
@return the compressed data size
@throws IOException | [
"Zero",
"-",
"copy",
"compress",
"using",
"memory",
"addresses",
"."
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L388-L392 |
117,516 | xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.rawUncompress | public static long rawUncompress(long inputAddr, long inputSize, long destAddr)
throws IOException
{
return impl.rawUncompress(inputAddr, inputSize, destAddr);
} | java | public static long rawUncompress(long inputAddr, long inputSize, long destAddr)
throws IOException
{
return impl.rawUncompress(inputAddr, inputSize, destAddr);
} | [
"public",
"static",
"long",
"rawUncompress",
"(",
"long",
"inputAddr",
",",
"long",
"inputSize",
",",
"long",
"destAddr",
")",
"throws",
"IOException",
"{",
"return",
"impl",
".",
"rawUncompress",
"(",
"inputAddr",
",",
"inputSize",
",",
"destAddr",
")",
";",
... | Zero-copy decompress using memory addresses.
@param inputAddr input memory address
@param inputSize input byte size
@param destAddr destination address of the uncompressed data
@return the uncompressed data size
@throws IOException | [
"Zero",
"-",
"copy",
"decompress",
"using",
"memory",
"addresses",
"."
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L403-L407 |
117,517 | xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.rawCompress | public static byte[] rawCompress(Object data, int byteSize)
throws IOException
{
byte[] buf = new byte[Snappy.maxCompressedLength(byteSize)];
int compressedByteSize = impl.rawCompress(data, 0, byteSize, buf, 0);
byte[] result = new byte[compressedByteSize];
System.arrayco... | java | public static byte[] rawCompress(Object data, int byteSize)
throws IOException
{
byte[] buf = new byte[Snappy.maxCompressedLength(byteSize)];
int compressedByteSize = impl.rawCompress(data, 0, byteSize, buf, 0);
byte[] result = new byte[compressedByteSize];
System.arrayco... | [
"public",
"static",
"byte",
"[",
"]",
"rawCompress",
"(",
"Object",
"data",
",",
"int",
"byteSize",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"Snappy",
".",
"maxCompressedLength",
"(",
"byteSize",
")",
"]",
";",... | Compress the input data and produce a byte array of the uncompressed data
@param data input array. The input MUST be an array type
@param byteSize the input byte size
@return compressed data | [
"Compress",
"the",
"input",
"data",
"and",
"produce",
"a",
"byte",
"array",
"of",
"the",
"uncompressed",
"data"
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L416-L424 |
117,518 | xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.rawCompress | public static int rawCompress(Object input, int inputOffset, int inputLength, byte[] output, int outputOffset)
throws IOException
{
if (input == null || output == null) {
throw new NullPointerException("input or output is null");
}
int compressedSize = impl
... | java | public static int rawCompress(Object input, int inputOffset, int inputLength, byte[] output, int outputOffset)
throws IOException
{
if (input == null || output == null) {
throw new NullPointerException("input or output is null");
}
int compressedSize = impl
... | [
"public",
"static",
"int",
"rawCompress",
"(",
"Object",
"input",
",",
"int",
"inputOffset",
",",
"int",
"inputLength",
",",
"byte",
"[",
"]",
"output",
",",
"int",
"outputOffset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"input",
"==",
"null",
"||",
... | Compress the input buffer [offset,... ,offset+length) contents, then
write the compressed data to the output buffer[offset, ...)
@param input input array. This MUST be a primitive array type
@param inputOffset byte offset at the output array
@param inputLength byte length of the input data
@param output output array. ... | [
"Compress",
"the",
"input",
"buffer",
"[",
"offset",
"...",
"offset",
"+",
"length",
")",
"contents",
"then",
"write",
"the",
"compressed",
"data",
"to",
"the",
"output",
"buffer",
"[",
"offset",
"...",
")"
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L438-L448 |
117,519 | xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.uncompress | public static byte[] uncompress(byte[] input)
throws IOException
{
byte[] result = new byte[Snappy.uncompressedLength(input)];
Snappy.uncompress(input, 0, input.length, result, 0);
return result;
} | java | public static byte[] uncompress(byte[] input)
throws IOException
{
byte[] result = new byte[Snappy.uncompressedLength(input)];
Snappy.uncompress(input, 0, input.length, result, 0);
return result;
} | [
"public",
"static",
"byte",
"[",
"]",
"uncompress",
"(",
"byte",
"[",
"]",
"input",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"Snappy",
".",
"uncompressedLength",
"(",
"input",
")",
"]",
";",
"Snappy",
".",... | High-level API for uncompressing the input byte array.
@param input
@return the uncompressed byte array
@throws IOException | [
"High",
"-",
"level",
"API",
"for",
"uncompressing",
"the",
"input",
"byte",
"array",
"."
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L484-L490 |
117,520 | xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.uncompressDoubleArray | public static double[] uncompressDoubleArray(byte[] input)
throws IOException
{
int uncompressedLength = Snappy.uncompressedLength(input, 0, input.length);
double[] result = new double[uncompressedLength / 8];
impl.rawUncompress(input, 0, input.length, result, 0);
return ... | java | public static double[] uncompressDoubleArray(byte[] input)
throws IOException
{
int uncompressedLength = Snappy.uncompressedLength(input, 0, input.length);
double[] result = new double[uncompressedLength / 8];
impl.rawUncompress(input, 0, input.length, result, 0);
return ... | [
"public",
"static",
"double",
"[",
"]",
"uncompressDoubleArray",
"(",
"byte",
"[",
"]",
"input",
")",
"throws",
"IOException",
"{",
"int",
"uncompressedLength",
"=",
"Snappy",
".",
"uncompressedLength",
"(",
"input",
",",
"0",
",",
"input",
".",
"length",
")... | Uncompress the input as a double array
@param input
@return the uncompressed data
@throws IOException | [
"Uncompress",
"the",
"input",
"as",
"a",
"double",
"array"
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L592-L599 |
117,521 | xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.uncompressFloatArray | public static float[] uncompressFloatArray(byte[] input, int offset, int length)
throws IOException
{
int uncompressedLength = Snappy.uncompressedLength(input, offset, length);
float[] result = new float[uncompressedLength / 4];
impl.rawUncompress(input, offset, length, result, 0... | java | public static float[] uncompressFloatArray(byte[] input, int offset, int length)
throws IOException
{
int uncompressedLength = Snappy.uncompressedLength(input, offset, length);
float[] result = new float[uncompressedLength / 4];
impl.rawUncompress(input, offset, length, result, 0... | [
"public",
"static",
"float",
"[",
"]",
"uncompressFloatArray",
"(",
"byte",
"[",
"]",
"input",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"int",
"uncompressedLength",
"=",
"Snappy",
".",
"uncompressedLength",
"(",
"input",
... | Uncompress the input[offset, offset+length) as a float array
@param input
@param offset
@param length
@return the uncompressed data
@throws IOException | [
"Uncompress",
"the",
"input",
"[",
"offset",
"offset",
"+",
"length",
")",
"as",
"a",
"float",
"array"
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L694-L701 |
117,522 | xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.uncompressString | public static String uncompressString(byte[] input, int offset, int length)
throws IOException
{
try {
return uncompressString(input, offset, length, "UTF-8");
}
catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 decoder is not... | java | public static String uncompressString(byte[] input, int offset, int length)
throws IOException
{
try {
return uncompressString(input, offset, length, "UTF-8");
}
catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 decoder is not... | [
"public",
"static",
"String",
"uncompressString",
"(",
"byte",
"[",
"]",
"input",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"uncompressString",
"(",
"input",
",",
"offset",
",",
"length",
",",
"\"U... | Uncompress the input[offset, offset+length) as a String
@param input
@param offset
@param length
@return the uncompressed data
@throws IOException | [
"Uncompress",
"the",
"input",
"[",
"offset",
"offset",
"+",
"length",
")",
"as",
"a",
"String"
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L823-L832 |
117,523 | xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.uncompressString | public static String uncompressString(byte[] input, int offset, int length, String encoding)
throws IOException,
UnsupportedEncodingException
{
byte[] uncompressed = new byte[uncompressedLength(input, offset, length)];
uncompress(input, offset, length, uncompressed, 0);
... | java | public static String uncompressString(byte[] input, int offset, int length, String encoding)
throws IOException,
UnsupportedEncodingException
{
byte[] uncompressed = new byte[uncompressedLength(input, offset, length)];
uncompress(input, offset, length, uncompressed, 0);
... | [
"public",
"static",
"String",
"uncompressString",
"(",
"byte",
"[",
"]",
"input",
",",
"int",
"offset",
",",
"int",
"length",
",",
"String",
"encoding",
")",
"throws",
"IOException",
",",
"UnsupportedEncodingException",
"{",
"byte",
"[",
"]",
"uncompressed",
"... | Uncompress the input[offset, offset+length) as a String of the given
encoding
@param input
@param offset
@param length
@param encoding
@return the uncompressed data
@throws IOException | [
"Uncompress",
"the",
"input",
"[",
"offset",
"offset",
"+",
"length",
")",
"as",
"a",
"String",
"of",
"the",
"given",
"encoding"
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L845-L852 |
117,524 | xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.uncompressString | public static String uncompressString(byte[] input, String encoding)
throws IOException,
UnsupportedEncodingException
{
byte[] uncompressed = uncompress(input);
return new String(uncompressed, encoding);
} | java | public static String uncompressString(byte[] input, String encoding)
throws IOException,
UnsupportedEncodingException
{
byte[] uncompressed = uncompress(input);
return new String(uncompressed, encoding);
} | [
"public",
"static",
"String",
"uncompressString",
"(",
"byte",
"[",
"]",
"input",
",",
"String",
"encoding",
")",
"throws",
"IOException",
",",
"UnsupportedEncodingException",
"{",
"byte",
"[",
"]",
"uncompressed",
"=",
"uncompress",
"(",
"input",
")",
";",
"r... | Uncompress the input as a String of the given encoding
@param input
@param encoding
@return the uncompressed data
@throws IOException
@throws UnsupportedEncodingException | [
"Uncompress",
"the",
"input",
"as",
"a",
"String",
"of",
"the",
"given",
"encoding"
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L883-L889 |
117,525 | xerial/snappy-java | src/main/java/org/xerial/snappy/SnappyInputStream.java | SnappyInputStream.rawRead | public int rawRead(Object array, int byteOffset, int byteLength)
throws IOException
{
int writtenBytes = 0;
for (; writtenBytes < byteLength; ) {
if (uncompressedCursor >= uncompressedLimit) {
if (hasNextChunk()) {
continue;
... | java | public int rawRead(Object array, int byteOffset, int byteLength)
throws IOException
{
int writtenBytes = 0;
for (; writtenBytes < byteLength; ) {
if (uncompressedCursor >= uncompressedLimit) {
if (hasNextChunk()) {
continue;
... | [
"public",
"int",
"rawRead",
"(",
"Object",
"array",
",",
"int",
"byteOffset",
",",
"int",
"byteLength",
")",
"throws",
"IOException",
"{",
"int",
"writtenBytes",
"=",
"0",
";",
"for",
"(",
";",
"writtenBytes",
"<",
"byteLength",
";",
")",
"{",
"if",
"(",... | Read uncompressed data into the specified array
@param array
@param byteOffset
@param byteLength
@return written bytes
@throws IOException | [
"Read",
"uncompressed",
"data",
"into",
"the",
"specified",
"array"
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/SnappyInputStream.java#L192-L213 |
117,526 | xerial/snappy-java | src/main/java/org/xerial/snappy/SnappyInputStream.java | SnappyInputStream.readNext | private int readNext(byte[] dest, int offset, int len)
throws IOException
{
int readBytes = 0;
while (readBytes < len) {
int ret = in.read(dest, readBytes + offset, len - readBytes);
if (ret == -1) {
finishedReading = true;
return r... | java | private int readNext(byte[] dest, int offset, int len)
throws IOException
{
int readBytes = 0;
while (readBytes < len) {
int ret = in.read(dest, readBytes + offset, len - readBytes);
if (ret == -1) {
finishedReading = true;
return r... | [
"private",
"int",
"readNext",
"(",
"byte",
"[",
"]",
"dest",
",",
"int",
"offset",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"int",
"readBytes",
"=",
"0",
";",
"while",
"(",
"readBytes",
"<",
"len",
")",
"{",
"int",
"ret",
"=",
"in",
".... | Read next len bytes
@param dest
@param offset
@param len
@return read bytes | [
"Read",
"next",
"len",
"bytes"
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/SnappyInputStream.java#L373-L386 |
117,527 | xerial/snappy-java | src/main/java/org/xerial/snappy/BitShuffle.java | BitShuffle.shuffle | public static byte[] shuffle(short[] input) throws IOException {
byte[] output = new byte[input.length * 2];
int numProcessed = impl.shuffle(input, 0, 2, input.length * 2, output, 0);
assert(numProcessed == input.length * 2);
return output;
} | java | public static byte[] shuffle(short[] input) throws IOException {
byte[] output = new byte[input.length * 2];
int numProcessed = impl.shuffle(input, 0, 2, input.length * 2, output, 0);
assert(numProcessed == input.length * 2);
return output;
} | [
"public",
"static",
"byte",
"[",
"]",
"shuffle",
"(",
"short",
"[",
"]",
"input",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"output",
"=",
"new",
"byte",
"[",
"input",
".",
"length",
"*",
"2",
"]",
";",
"int",
"numProcessed",
"=",
"impl",
... | Apply a bit-shuffling filter into the input short array.
@param input
@return bit-shuffled byte array
@throws IOException | [
"Apply",
"a",
"bit",
"-",
"shuffling",
"filter",
"into",
"the",
"input",
"short",
"array",
"."
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/BitShuffle.java#L93-L98 |
117,528 | xerial/snappy-java | src/main/java/org/xerial/snappy/BitShuffle.java | BitShuffle.unshuffle | public static int unshuffle(ByteBuffer shuffled, BitShuffleType type, ByteBuffer output) throws IOException {
if (!shuffled.isDirect()) {
throw new SnappyError(SnappyErrorCode.NOT_A_DIRECT_BUFFER, "input is not a direct buffer");
}
if (!output.isDirect()) {
throw new Snap... | java | public static int unshuffle(ByteBuffer shuffled, BitShuffleType type, ByteBuffer output) throws IOException {
if (!shuffled.isDirect()) {
throw new SnappyError(SnappyErrorCode.NOT_A_DIRECT_BUFFER, "input is not a direct buffer");
}
if (!output.isDirect()) {
throw new Snap... | [
"public",
"static",
"int",
"unshuffle",
"(",
"ByteBuffer",
"shuffled",
",",
"BitShuffleType",
"type",
",",
"ByteBuffer",
"output",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"shuffled",
".",
"isDirect",
"(",
")",
")",
"{",
"throw",
"new",
"SnappyErro... | Convert the input bit-shuffled byte array into an original array. The result is dumped
to the specified output buffer.
@param shuffled buffer[pos() ... limit()) containing the input shuffled data
@param type element type of the input data
@param output output of the the original data. It uses buffer[pos()..]
@return b... | [
"Convert",
"the",
"input",
"bit",
"-",
"shuffled",
"byte",
"array",
"into",
"an",
"original",
"array",
".",
"The",
"result",
"is",
"dumped",
"to",
"the",
"specified",
"output",
"buffer",
"."
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/BitShuffle.java#L168-L194 |
117,529 | xerial/snappy-java | src/main/java/org/xerial/snappy/BitShuffle.java | BitShuffle.unshuffleShortArray | public static short[] unshuffleShortArray(byte[] input) throws IOException {
short[] output = new short[input.length / 2];
int numProcessed = impl.unshuffle(input, 0, 2, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | java | public static short[] unshuffleShortArray(byte[] input) throws IOException {
short[] output = new short[input.length / 2];
int numProcessed = impl.unshuffle(input, 0, 2, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | [
"public",
"static",
"short",
"[",
"]",
"unshuffleShortArray",
"(",
"byte",
"[",
"]",
"input",
")",
"throws",
"IOException",
"{",
"short",
"[",
"]",
"output",
"=",
"new",
"short",
"[",
"input",
".",
"length",
"/",
"2",
"]",
";",
"int",
"numProcessed",
"... | Convert the input bit-shuffled byte array into an original short array.
@param input
@return a short array
@throws IOException | [
"Convert",
"the",
"input",
"bit",
"-",
"shuffled",
"byte",
"array",
"into",
"an",
"original",
"short",
"array",
"."
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/BitShuffle.java#L203-L208 |
117,530 | xerial/snappy-java | src/main/java/org/xerial/snappy/BitShuffle.java | BitShuffle.unshuffleIntArray | public static int[] unshuffleIntArray(byte[] input) throws IOException {
int[] output = new int[input.length / 4];
int numProcessed = impl.unshuffle(input, 0, 4, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | java | public static int[] unshuffleIntArray(byte[] input) throws IOException {
int[] output = new int[input.length / 4];
int numProcessed = impl.unshuffle(input, 0, 4, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | [
"public",
"static",
"int",
"[",
"]",
"unshuffleIntArray",
"(",
"byte",
"[",
"]",
"input",
")",
"throws",
"IOException",
"{",
"int",
"[",
"]",
"output",
"=",
"new",
"int",
"[",
"input",
".",
"length",
"/",
"4",
"]",
";",
"int",
"numProcessed",
"=",
"i... | Convert the input bit-shuffled byte array into an original int array.
@param input
@return an int array
@throws IOException | [
"Convert",
"the",
"input",
"bit",
"-",
"shuffled",
"byte",
"array",
"into",
"an",
"original",
"int",
"array",
"."
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/BitShuffle.java#L217-L222 |
117,531 | xerial/snappy-java | src/main/java/org/xerial/snappy/BitShuffle.java | BitShuffle.unshuffleLongArray | public static long[] unshuffleLongArray(byte[] input) throws IOException {
long[] output = new long[input.length / 8];
int numProcessed = impl.unshuffle(input, 0, 8, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | java | public static long[] unshuffleLongArray(byte[] input) throws IOException {
long[] output = new long[input.length / 8];
int numProcessed = impl.unshuffle(input, 0, 8, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | [
"public",
"static",
"long",
"[",
"]",
"unshuffleLongArray",
"(",
"byte",
"[",
"]",
"input",
")",
"throws",
"IOException",
"{",
"long",
"[",
"]",
"output",
"=",
"new",
"long",
"[",
"input",
".",
"length",
"/",
"8",
"]",
";",
"int",
"numProcessed",
"=",
... | Convert the input bit-shuffled byte array into an original long array.
@param input
@return a long array
@throws IOException | [
"Convert",
"the",
"input",
"bit",
"-",
"shuffled",
"byte",
"array",
"into",
"an",
"original",
"long",
"array",
"."
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/BitShuffle.java#L231-L236 |
117,532 | xerial/snappy-java | src/main/java/org/xerial/snappy/BitShuffle.java | BitShuffle.unshuffleFloatArray | public static float[] unshuffleFloatArray(byte[] input) throws IOException {
float[] output = new float[input.length / 4];
int numProcessed = impl.unshuffle(input, 0, 4, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | java | public static float[] unshuffleFloatArray(byte[] input) throws IOException {
float[] output = new float[input.length / 4];
int numProcessed = impl.unshuffle(input, 0, 4, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | [
"public",
"static",
"float",
"[",
"]",
"unshuffleFloatArray",
"(",
"byte",
"[",
"]",
"input",
")",
"throws",
"IOException",
"{",
"float",
"[",
"]",
"output",
"=",
"new",
"float",
"[",
"input",
".",
"length",
"/",
"4",
"]",
";",
"int",
"numProcessed",
"... | Convert the input bit-shuffled byte array into an original float array.
@param input
@return an float array
@throws IOException | [
"Convert",
"the",
"input",
"bit",
"-",
"shuffled",
"byte",
"array",
"into",
"an",
"original",
"float",
"array",
"."
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/BitShuffle.java#L245-L250 |
117,533 | xerial/snappy-java | src/main/java/org/xerial/snappy/BitShuffle.java | BitShuffle.unshuffleDoubleArray | public static double[] unshuffleDoubleArray(byte[] input) throws IOException {
double[] output = new double[input.length / 8];
int numProcessed = impl.unshuffle(input, 0, 8, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | java | public static double[] unshuffleDoubleArray(byte[] input) throws IOException {
double[] output = new double[input.length / 8];
int numProcessed = impl.unshuffle(input, 0, 8, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | [
"public",
"static",
"double",
"[",
"]",
"unshuffleDoubleArray",
"(",
"byte",
"[",
"]",
"input",
")",
"throws",
"IOException",
"{",
"double",
"[",
"]",
"output",
"=",
"new",
"double",
"[",
"input",
".",
"length",
"/",
"8",
"]",
";",
"int",
"numProcessed",... | Convert the input bit-shuffled byte array into an original double array.
@param input
@return a double array
@throws IOException | [
"Convert",
"the",
"input",
"bit",
"-",
"shuffled",
"byte",
"array",
"into",
"an",
"original",
"double",
"array",
"."
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/BitShuffle.java#L259-L264 |
117,534 | xerial/snappy-java | src/main/java/org/xerial/snappy/SnappyOutputStream.java | SnappyOutputStream.rawWrite | public void rawWrite(Object array, int byteOffset, int byteLength)
throws IOException
{
if (closed) {
throw new IOException("Stream is closed");
}
int cursor = 0;
while (cursor < byteLength) {
int readLen = Math.min(byteLength - cursor, blockSize -... | java | public void rawWrite(Object array, int byteOffset, int byteLength)
throws IOException
{
if (closed) {
throw new IOException("Stream is closed");
}
int cursor = 0;
while (cursor < byteLength) {
int readLen = Math.min(byteLength - cursor, blockSize -... | [
"public",
"void",
"rawWrite",
"(",
"Object",
"array",
",",
"int",
"byteOffset",
",",
"int",
"byteLength",
")",
"throws",
"IOException",
"{",
"if",
"(",
"closed",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Stream is closed\"",
")",
";",
"}",
"int",
"c... | Compress the raw byte array data.
@param array array data of any type (e.g., byte[], float[], long[], ...)
@param byteOffset
@param byteLength
@throws IOException | [
"Compress",
"the",
"raw",
"byte",
"array",
"data",
"."
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/SnappyOutputStream.java#L279-L300 |
117,535 | xerial/snappy-java | src/main/java/org/xerial/snappy/SnappyLoader.java | SnappyLoader.loadNativeLibrary | private synchronized static void loadNativeLibrary()
{
if (!isLoaded) {
try {
nativeLibFile = findNativeLibrary();
if (nativeLibFile != null) {
// Load extracted or specified snappyjava native library.
System.load(nativeLibF... | java | private synchronized static void loadNativeLibrary()
{
if (!isLoaded) {
try {
nativeLibFile = findNativeLibrary();
if (nativeLibFile != null) {
// Load extracted or specified snappyjava native library.
System.load(nativeLibF... | [
"private",
"synchronized",
"static",
"void",
"loadNativeLibrary",
"(",
")",
"{",
"if",
"(",
"!",
"isLoaded",
")",
"{",
"try",
"{",
"nativeLibFile",
"=",
"findNativeLibrary",
"(",
")",
";",
"if",
"(",
"nativeLibFile",
"!=",
"null",
")",
"{",
"// Load extracte... | Load a native library of snappy-java | [
"Load",
"a",
"native",
"library",
"of",
"snappy",
"-",
"java"
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/SnappyLoader.java#L172-L191 |
117,536 | xerial/snappy-java | src/main/java/org/xerial/snappy/SnappyLoader.java | SnappyLoader.extractLibraryFile | private static File extractLibraryFile(String libFolderForCurrentOS, String libraryFileName, String targetFolder)
{
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
// Attach UUID to the native library file to ensure multiple class loaders can read the libsnappy-java mu... | java | private static File extractLibraryFile(String libFolderForCurrentOS, String libraryFileName, String targetFolder)
{
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
// Attach UUID to the native library file to ensure multiple class loaders can read the libsnappy-java mu... | [
"private",
"static",
"File",
"extractLibraryFile",
"(",
"String",
"libFolderForCurrentOS",
",",
"String",
"libraryFileName",
",",
"String",
"targetFolder",
")",
"{",
"String",
"nativeLibraryFilePath",
"=",
"libFolderForCurrentOS",
"+",
"\"/\"",
"+",
"libraryFileName",
"... | Extract the specified library file to the target folder
@param libFolderForCurrentOS
@param libraryFileName
@param targetFolder
@return | [
"Extract",
"the",
"specified",
"library",
"file",
"to",
"the",
"target",
"folder"
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/SnappyLoader.java#L223-L298 |
117,537 | xerial/snappy-java | src/main/java/org/xerial/snappy/SnappyLoader.java | SnappyLoader.getVersion | public static String getVersion()
{
URL versionFile = SnappyLoader.class
.getResource("/META-INF/maven/org.xerial.snappy/snappy-java/pom.properties");
if (versionFile == null) {
versionFile = SnappyLoader.class.getResource("/org/xerial/snappy/VERSION");
}
... | java | public static String getVersion()
{
URL versionFile = SnappyLoader.class
.getResource("/META-INF/maven/org.xerial.snappy/snappy-java/pom.properties");
if (versionFile == null) {
versionFile = SnappyLoader.class.getResource("/org/xerial/snappy/VERSION");
}
... | [
"public",
"static",
"String",
"getVersion",
"(",
")",
"{",
"URL",
"versionFile",
"=",
"SnappyLoader",
".",
"class",
".",
"getResource",
"(",
"\"/META-INF/maven/org.xerial.snappy/snappy-java/pom.properties\"",
")",
";",
"if",
"(",
"versionFile",
"==",
"null",
")",
"{... | Get the snappy-java version by reading pom.properties embedded in jar.
This version data is used as a suffix of a dll file extracted from the
jar.
@return the version string | [
"Get",
"the",
"snappy",
"-",
"java",
"version",
"by",
"reading",
"pom",
".",
"properties",
"embedded",
"in",
"jar",
".",
"This",
"version",
"data",
"is",
"used",
"as",
"a",
"suffix",
"of",
"a",
"dll",
"file",
"extracted",
"from",
"the",
"jar",
"."
] | 9df6ed7bbce88186c82f2e7cdcb7b974421b3340 | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/SnappyLoader.java#L370-L395 |
117,538 | square/spoon | spoon-runner/src/main/java/com/squareup/spoon/SpoonRunner.java | SpoonRunner.run | public boolean run() {
otherApks.forEach(otherApk -> {
checkArgument(otherApk.exists(), "Could not find other APK: " + otherApk);
});
checkArgument(testApk.exists(), "Could not find test APK: " + testApk);
AndroidDebugBridge adb = SpoonUtils.initAdb(androidSdk, adbTimeout);
try {
final... | java | public boolean run() {
otherApks.forEach(otherApk -> {
checkArgument(otherApk.exists(), "Could not find other APK: " + otherApk);
});
checkArgument(testApk.exists(), "Could not find test APK: " + testApk);
AndroidDebugBridge adb = SpoonUtils.initAdb(androidSdk, adbTimeout);
try {
final... | [
"public",
"boolean",
"run",
"(",
")",
"{",
"otherApks",
".",
"forEach",
"(",
"otherApk",
"->",
"{",
"checkArgument",
"(",
"otherApk",
".",
"exists",
"(",
")",
",",
"\"Could not find other APK: \"",
"+",
"otherApk",
")",
";",
"}",
")",
";",
"checkArgument",
... | Install and execute the tests on all specified devices.
@return {@code true} if there were no test failures or exceptions thrown. | [
"Install",
"and",
"execute",
"the",
"tests",
"on",
"all",
"specified",
"devices",
"."
] | ebd51fbc1498f6bdcb61aa1281bbac2af99117b3 | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-runner/src/main/java/com/squareup/spoon/SpoonRunner.java#L113-L157 |
117,539 | square/spoon | spoon-runner/src/main/java/com/squareup/spoon/DeviceUtils.java | DeviceUtils.scrubModel | static String scrubModel(String manufacturer, String model) {
if (manufacturer == null || model == null) {
return model;
}
if (model.regionMatches(true, 0, manufacturer, 0, manufacturer.length())) {
model = model.substring(manufacturer.length());
}
if (model.length() > 0 && (model.charAt... | java | static String scrubModel(String manufacturer, String model) {
if (manufacturer == null || model == null) {
return model;
}
if (model.regionMatches(true, 0, manufacturer, 0, manufacturer.length())) {
model = model.substring(manufacturer.length());
}
if (model.length() > 0 && (model.charAt... | [
"static",
"String",
"scrubModel",
"(",
"String",
"manufacturer",
",",
"String",
"model",
")",
"{",
"if",
"(",
"manufacturer",
"==",
"null",
"||",
"model",
"==",
"null",
")",
"{",
"return",
"model",
";",
"}",
"if",
"(",
"model",
".",
"regionMatches",
"(",... | Scrub the model so that it does not contain redundant data. | [
"Scrub",
"the",
"model",
"so",
"that",
"it",
"does",
"not",
"contain",
"redundant",
"data",
"."
] | ebd51fbc1498f6bdcb61aa1281bbac2af99117b3 | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-runner/src/main/java/com/squareup/spoon/DeviceUtils.java#L5-L16 |
117,540 | square/spoon | spoon-runner/src/main/java/com/squareup/spoon/DeviceUtils.java | DeviceUtils.scrubLanguage | static String scrubLanguage(String language) {
if ("ldpi".equals(language)
|| "mdpi".equals(language)
|| "hdpi".equals(language)
|| "xhdpi".equals(language)) {
return null; // HTC, you suck!
}
return language;
} | java | static String scrubLanguage(String language) {
if ("ldpi".equals(language)
|| "mdpi".equals(language)
|| "hdpi".equals(language)
|| "xhdpi".equals(language)) {
return null; // HTC, you suck!
}
return language;
} | [
"static",
"String",
"scrubLanguage",
"(",
"String",
"language",
")",
"{",
"if",
"(",
"\"ldpi\"",
".",
"equals",
"(",
"language",
")",
"||",
"\"mdpi\"",
".",
"equals",
"(",
"language",
")",
"||",
"\"hdpi\"",
".",
"equals",
"(",
"language",
")",
"||",
"\"x... | Scrub the language so it does not contain bad data. | [
"Scrub",
"the",
"language",
"so",
"it",
"does",
"not",
"contain",
"bad",
"data",
"."
] | ebd51fbc1498f6bdcb61aa1281bbac2af99117b3 | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-runner/src/main/java/com/squareup/spoon/DeviceUtils.java#L19-L27 |
117,541 | square/spoon | third-party/axmlparser/src/main/java/com/squareup/spoon/internal/thirdparty/axmlparser/StringBlock.java | StringBlock.find | public int find(String string) {
if (m_strings == null) {
return -1;
}
for (int i = 0; i < m_strings.length - 1; i++) {
if (m_strings[i].equals(string)) {
return i;
}
}
return -1;
} | java | public int find(String string) {
if (m_strings == null) {
return -1;
}
for (int i = 0; i < m_strings.length - 1; i++) {
if (m_strings[i].equals(string)) {
return i;
}
}
return -1;
} | [
"public",
"int",
"find",
"(",
"String",
"string",
")",
"{",
"if",
"(",
"m_strings",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_strings",
".",
"length",
"-",
"1",
";",
"i",
"++",
"... | Finds index of the string.
Returns -1 if the string was not found. | [
"Finds",
"index",
"of",
"the",
"string",
".",
"Returns",
"-",
"1",
"if",
"the",
"string",
"was",
"not",
"found",
"."
] | ebd51fbc1498f6bdcb61aa1281bbac2af99117b3 | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/third-party/axmlparser/src/main/java/com/squareup/spoon/internal/thirdparty/axmlparser/StringBlock.java#L168-L180 |
117,542 | square/spoon | third-party/axmlparser/src/main/java/com/squareup/spoon/internal/thirdparty/axmlparser/StringBlock.java | StringBlock.stringAt | private String stringAt(int index) {
// Determine the offset from the start of the string pool.
int offset = m_stringOffsets[index];
// For convenience, wrap the string pool in ByteBuffer
// so that it will handle advancing the buffer index.
ByteBuffer buffer =
B... | java | private String stringAt(int index) {
// Determine the offset from the start of the string pool.
int offset = m_stringOffsets[index];
// For convenience, wrap the string pool in ByteBuffer
// so that it will handle advancing the buffer index.
ByteBuffer buffer =
B... | [
"private",
"String",
"stringAt",
"(",
"int",
"index",
")",
"{",
"// Determine the offset from the start of the string pool.",
"int",
"offset",
"=",
"m_stringOffsets",
"[",
"index",
"]",
";",
"// For convenience, wrap the string pool in ByteBuffer",
"// so that it will handle adva... | Extracts a string from the string pool at the given index.
@param index Position of string in the string pool.
@return A String representation of the encoded string pool entry. | [
"Extracts",
"a",
"string",
"from",
"the",
"string",
"pool",
"at",
"the",
"given",
"index",
"."
] | ebd51fbc1498f6bdcb61aa1281bbac2af99117b3 | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/third-party/axmlparser/src/main/java/com/squareup/spoon/internal/thirdparty/axmlparser/StringBlock.java#L287-L313 |
117,543 | square/spoon | spoon-runner/src/main/java/com/squareup/spoon/SpoonInstrumentationInfo.java | SpoonInstrumentationInfo.parseFromFile | static SpoonInstrumentationInfo parseFromFile(File apkTestFile) {
try (ZipFile zip = new ZipFile(apkTestFile)) {
ZipEntry entry = zip.getEntry("AndroidManifest.xml");
InputStream is = zip.getInputStream(entry);
AXMLParser parser = new AXMLParser(is);
int eventType = parser.getType();
... | java | static SpoonInstrumentationInfo parseFromFile(File apkTestFile) {
try (ZipFile zip = new ZipFile(apkTestFile)) {
ZipEntry entry = zip.getEntry("AndroidManifest.xml");
InputStream is = zip.getInputStream(entry);
AXMLParser parser = new AXMLParser(is);
int eventType = parser.getType();
... | [
"static",
"SpoonInstrumentationInfo",
"parseFromFile",
"(",
"File",
"apkTestFile",
")",
"{",
"try",
"(",
"ZipFile",
"zip",
"=",
"new",
"ZipFile",
"(",
"apkTestFile",
")",
")",
"{",
"ZipEntry",
"entry",
"=",
"zip",
".",
"getEntry",
"(",
"\"AndroidManifest.xml\"",... | Parse key information from an instrumentation APK's manifest. | [
"Parse",
"key",
"information",
"from",
"an",
"instrumentation",
"APK",
"s",
"manifest",
"."
] | ebd51fbc1498f6bdcb61aa1281bbac2af99117b3 | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-runner/src/main/java/com/squareup/spoon/SpoonInstrumentationInfo.java#L49-L99 |
117,544 | square/spoon | spoon-runner/src/main/java/com/squareup/spoon/html/HtmlUtils.java | HtmlUtils.getStatusCssClass | static String getStatusCssClass(DeviceTestResult testResult) {
String status;
switch (testResult.getStatus()) {
case PASS:
status = "pass";
break;
case IGNORED:
status = "ignored";
break;
case FAIL:
status = "fail";
break;
case ASSUMPTION_F... | java | static String getStatusCssClass(DeviceTestResult testResult) {
String status;
switch (testResult.getStatus()) {
case PASS:
status = "pass";
break;
case IGNORED:
status = "ignored";
break;
case FAIL:
status = "fail";
break;
case ASSUMPTION_F... | [
"static",
"String",
"getStatusCssClass",
"(",
"DeviceTestResult",
"testResult",
")",
"{",
"String",
"status",
";",
"switch",
"(",
"testResult",
".",
"getStatus",
"(",
")",
")",
"{",
"case",
"PASS",
":",
"status",
"=",
"\"pass\"",
";",
"break",
";",
"case",
... | Convert a test result status into an HTML CSS class. | [
"Convert",
"a",
"test",
"result",
"status",
"into",
"an",
"HTML",
"CSS",
"class",
"."
] | ebd51fbc1498f6bdcb61aa1281bbac2af99117b3 | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-runner/src/main/java/com/squareup/spoon/html/HtmlUtils.java#L77-L96 |
117,545 | square/spoon | spoon-runner/src/main/java/com/squareup/spoon/SpoonUtils.java | SpoonUtils.obtainRealDevice | static IDevice obtainRealDevice(AndroidDebugBridge adb, String serial) {
// Get an existing real device.
for (IDevice adbDevice : adb.getDevices()) {
if (adbDevice.getSerialNumber().equals(serial)) {
return adbDevice;
}
}
throw new IllegalArgumentException("Unknown device serial: " +... | java | static IDevice obtainRealDevice(AndroidDebugBridge adb, String serial) {
// Get an existing real device.
for (IDevice adbDevice : adb.getDevices()) {
if (adbDevice.getSerialNumber().equals(serial)) {
return adbDevice;
}
}
throw new IllegalArgumentException("Unknown device serial: " +... | [
"static",
"IDevice",
"obtainRealDevice",
"(",
"AndroidDebugBridge",
"adb",
",",
"String",
"serial",
")",
"{",
"// Get an existing real device.",
"for",
"(",
"IDevice",
"adbDevice",
":",
"adb",
".",
"getDevices",
"(",
")",
")",
"{",
"if",
"(",
"adbDevice",
".",
... | Fetch or create a real device that corresponds to a device model. | [
"Fetch",
"or",
"create",
"a",
"real",
"device",
"that",
"corresponds",
"to",
"a",
"device",
"model",
"."
] | ebd51fbc1498f6bdcb61aa1281bbac2af99117b3 | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-runner/src/main/java/com/squareup/spoon/SpoonUtils.java#L51-L59 |
117,546 | square/spoon | spoon-runner/src/main/java/com/squareup/spoon/SpoonUtils.java | SpoonUtils.findAllDevices | public static Set<String> findAllDevices(AndroidDebugBridge adb, Integer minApiLevel) {
Set<String> devices = new LinkedHashSet<>();
for (IDevice realDevice : adb.getDevices()) {
if (minApiLevel == null) {
devices.add(realDevice.getSerialNumber());
} else {
DeviceDetails deviceDetail... | java | public static Set<String> findAllDevices(AndroidDebugBridge adb, Integer minApiLevel) {
Set<String> devices = new LinkedHashSet<>();
for (IDevice realDevice : adb.getDevices()) {
if (minApiLevel == null) {
devices.add(realDevice.getSerialNumber());
} else {
DeviceDetails deviceDetail... | [
"public",
"static",
"Set",
"<",
"String",
">",
"findAllDevices",
"(",
"AndroidDebugBridge",
"adb",
",",
"Integer",
"minApiLevel",
")",
"{",
"Set",
"<",
"String",
">",
"devices",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"for",
"(",
"IDevice",
"real... | Find all device serials that are plugged in through ADB.
@param minApiLevel If <code>null</code>, all devices will be returned. Otherwise, only
those device serials that are greater than or equal to the provided
version will be returned. | [
"Find",
"all",
"device",
"serials",
"that",
"are",
"plugged",
"in",
"through",
"ADB",
"."
] | ebd51fbc1498f6bdcb61aa1281bbac2af99117b3 | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-runner/src/main/java/com/squareup/spoon/SpoonUtils.java#L102-L116 |
117,547 | square/spoon | third-party/axmlparser/src/main/java/com/squareup/spoon/internal/thirdparty/axmlparser/AXMLParser.java | AXMLParser.next | public final int next() throws IOException {
if (m_nextException!=null) {
throw m_nextException;
}
try {
return doNext();
}
catch (IOException e) {
m_nextException=e;
resetState();
throw e;
}
} | java | public final int next() throws IOException {
if (m_nextException!=null) {
throw m_nextException;
}
try {
return doNext();
}
catch (IOException e) {
m_nextException=e;
resetState();
throw e;
}
} | [
"public",
"final",
"int",
"next",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"m_nextException",
"!=",
"null",
")",
"{",
"throw",
"m_nextException",
";",
"}",
"try",
"{",
"return",
"doNext",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
... | Advances to the next tag.
Once method returns END_DOCUMENT, it always returns END_DOCUMENT.
Once method throws an exception, it always throws the same exception. | [
"Advances",
"to",
"the",
"next",
"tag",
".",
"Once",
"method",
"returns",
"END_DOCUMENT",
"it",
"always",
"returns",
"END_DOCUMENT",
".",
"Once",
"method",
"throws",
"an",
"exception",
"it",
"always",
"throws",
"the",
"same",
"exception",
"."
] | ebd51fbc1498f6bdcb61aa1281bbac2af99117b3 | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/third-party/axmlparser/src/main/java/com/squareup/spoon/internal/thirdparty/axmlparser/AXMLParser.java#L80-L92 |
117,548 | square/spoon | third-party/axmlparser/src/main/java/com/squareup/spoon/internal/thirdparty/axmlparser/AXMLParser.java | AXMLParser.getAttributeResourceID | public final int getAttributeResourceID(int index) {
int resourceIndex=getAttribute(index).name;
if (m_resourceIDs==null ||
resourceIndex<0 || resourceIndex>=m_resourceIDs.length)
{
return 0;
}
return m_resourceIDs[resourceIndex];
} | java | public final int getAttributeResourceID(int index) {
int resourceIndex=getAttribute(index).name;
if (m_resourceIDs==null ||
resourceIndex<0 || resourceIndex>=m_resourceIDs.length)
{
return 0;
}
return m_resourceIDs[resourceIndex];
} | [
"public",
"final",
"int",
"getAttributeResourceID",
"(",
"int",
"index",
")",
"{",
"int",
"resourceIndex",
"=",
"getAttribute",
"(",
"index",
")",
".",
"name",
";",
"if",
"(",
"m_resourceIDs",
"==",
"null",
"||",
"resourceIndex",
"<",
"0",
"||",
"resourceInd... | Returns attribute resource ID. | [
"Returns",
"attribute",
"resource",
"ID",
"."
] | ebd51fbc1498f6bdcb61aa1281bbac2af99117b3 | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/third-party/axmlparser/src/main/java/com/squareup/spoon/internal/thirdparty/axmlparser/AXMLParser.java#L145-L153 |
117,549 | square/spoon | spoon-runner/src/main/java/com/squareup/spoon/SpoonDeviceRunner.java | SpoonDeviceRunner.createConfiguredRunner | private RemoteAndroidTestRunner createConfiguredRunner(String testPackage, String testRunner,
IDevice device) throws Exception {
RemoteAndroidTestRunner runner = new SpoonAndroidTestRunner(
instrumentationInfo.getApplicationPackage(), testPackage, testRunner, device,
clearAppDataBefor... | java | private RemoteAndroidTestRunner createConfiguredRunner(String testPackage, String testRunner,
IDevice device) throws Exception {
RemoteAndroidTestRunner runner = new SpoonAndroidTestRunner(
instrumentationInfo.getApplicationPackage(), testPackage, testRunner, device,
clearAppDataBefor... | [
"private",
"RemoteAndroidTestRunner",
"createConfiguredRunner",
"(",
"String",
"testPackage",
",",
"String",
"testRunner",
",",
"IDevice",
"device",
")",
"throws",
"Exception",
"{",
"RemoteAndroidTestRunner",
"runner",
"=",
"new",
"SpoonAndroidTestRunner",
"(",
"instrumen... | Create a configured Test Runner.
This method adds sharding, class name, method name, test size and coverage, if available. | [
"Create",
"a",
"configured",
"Test",
"Runner",
".",
"This",
"method",
"adds",
"sharding",
"class",
"name",
"method",
"name",
"test",
"size",
"and",
"coverage",
"if",
"available",
"."
] | ebd51fbc1498f6bdcb61aa1281bbac2af99117b3 | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-runner/src/main/java/com/squareup/spoon/SpoonDeviceRunner.java#L316-L355 |
117,550 | square/spoon | spoon-runner/src/main/java/com/squareup/spoon/SpoonDeviceRunner.java | SpoonDeviceRunner.pullDeviceFiles | private void pullDeviceFiles(IDevice device) throws Exception {
for (String dir : DEVICE_DIRS) {
pullDirectory(device, dir);
}
} | java | private void pullDeviceFiles(IDevice device) throws Exception {
for (String dir : DEVICE_DIRS) {
pullDirectory(device, dir);
}
} | [
"private",
"void",
"pullDeviceFiles",
"(",
"IDevice",
"device",
")",
"throws",
"Exception",
"{",
"for",
"(",
"String",
"dir",
":",
"DEVICE_DIRS",
")",
"{",
"pullDirectory",
"(",
"device",
",",
"dir",
")",
";",
"}",
"}"
] | Download all files from a single device to the local machine. | [
"Download",
"all",
"files",
"from",
"a",
"single",
"device",
"to",
"the",
"local",
"machine",
"."
] | ebd51fbc1498f6bdcb61aa1281bbac2af99117b3 | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-runner/src/main/java/com/squareup/spoon/SpoonDeviceRunner.java#L482-L486 |
117,551 | galenframework/galen | galen-java-support/src/main/java/com/galenframework/junit/JUnitStepListener.java | JUnitStepListener.cleanData | private void cleanData(List<GalenTestInfo> testInfos) {
for (GalenTestInfo testInfo : testInfos) {
if (testInfo.getReport() != null) {
try {
FileTempStorage storage = testInfo.getReport().getFileStorage();
if (storage != null) {
... | java | private void cleanData(List<GalenTestInfo> testInfos) {
for (GalenTestInfo testInfo : testInfos) {
if (testInfo.getReport() != null) {
try {
FileTempStorage storage = testInfo.getReport().getFileStorage();
if (storage != null) {
... | [
"private",
"void",
"cleanData",
"(",
"List",
"<",
"GalenTestInfo",
">",
"testInfos",
")",
"{",
"for",
"(",
"GalenTestInfo",
"testInfo",
":",
"testInfos",
")",
"{",
"if",
"(",
"testInfo",
".",
"getReport",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"... | Removes temporary test data
@param testInfos | [
"Removes",
"temporary",
"test",
"data"
] | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-java-support/src/main/java/com/galenframework/junit/JUnitStepListener.java#L60-L73 |
117,552 | galenframework/galen | galen-core/src/main/java/com/galenframework/javascript/GalenJsExecutor.java | GalenJsExecutor.evalStrictToString | @Override
public String evalStrictToString(String script) {
Object returnedObject = context.evaluateString(scope, script, "<cmd>", 1, null);
String unwrappedObject = unwrapProcessedObjectToString(returnedObject);
if (unwrappedObject != null) {
return unwrappedObject;
} e... | java | @Override
public String evalStrictToString(String script) {
Object returnedObject = context.evaluateString(scope, script, "<cmd>", 1, null);
String unwrappedObject = unwrapProcessedObjectToString(returnedObject);
if (unwrappedObject != null) {
return unwrappedObject;
} e... | [
"@",
"Override",
"public",
"String",
"evalStrictToString",
"(",
"String",
"script",
")",
"{",
"Object",
"returnedObject",
"=",
"context",
".",
"evaluateString",
"(",
"scope",
",",
"script",
",",
"\"<cmd>\"",
",",
"1",
",",
"null",
")",
";",
"String",
"unwrap... | Used for processing js expressions in page spec reader. In case of failure throws an exception
@param script - JavaScript code
@return result of JavaScript code execution | [
"Used",
"for",
"processing",
"js",
"expressions",
"in",
"page",
"spec",
"reader",
".",
"In",
"case",
"of",
"failure",
"throws",
"an",
"exception"
] | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/javascript/GalenJsExecutor.java#L124-L132 |
117,553 | galenframework/galen | galen-core/src/main/java/com/galenframework/generator/SpecGenerator.java | SpecGenerator.restructurePageItems | private List<PageItemNode> restructurePageItems(List<PageItem> items) {
List<PageItemNode> pins = items.stream().map(PageItemNode::new).collect(toList());
for (PageItemNode pinA : pins) {
for (PageItemNode pinB: pins) {
if (pinA != pinB) {
if (isInside(pin... | java | private List<PageItemNode> restructurePageItems(List<PageItem> items) {
List<PageItemNode> pins = items.stream().map(PageItemNode::new).collect(toList());
for (PageItemNode pinA : pins) {
for (PageItemNode pinB: pins) {
if (pinA != pinB) {
if (isInside(pin... | [
"private",
"List",
"<",
"PageItemNode",
">",
"restructurePageItems",
"(",
"List",
"<",
"PageItem",
">",
"items",
")",
"{",
"List",
"<",
"PageItemNode",
">",
"pins",
"=",
"items",
".",
"stream",
"(",
")",
".",
"map",
"(",
"PageItemNode",
"::",
"new",
")",... | Orders page items into a tree by their area. Tries to fit one item inside another
@param items
@return A list of pins which are root elements (don't have a parent) | [
"Orders",
"page",
"items",
"into",
"a",
"tree",
"by",
"their",
"area",
".",
"Tries",
"to",
"fit",
"one",
"item",
"inside",
"another"
] | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/generator/SpecGenerator.java#L145-L161 |
117,554 | galenframework/galen | galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java | PageSpec.setObjects | public void setObjects(Map<String, Locator> objects) {
this.objects.clear();
if (objects != null) {
this.objects.putAll(objects);
}
} | java | public void setObjects(Map<String, Locator> objects) {
this.objects.clear();
if (objects != null) {
this.objects.putAll(objects);
}
} | [
"public",
"void",
"setObjects",
"(",
"Map",
"<",
"String",
",",
"Locator",
">",
"objects",
")",
"{",
"this",
".",
"objects",
".",
"clear",
"(",
")",
";",
"if",
"(",
"objects",
"!=",
"null",
")",
"{",
"this",
".",
"objects",
".",
"putAll",
"(",
"obj... | Clears current objects list and sets new object list
@param objects | [
"Clears",
"current",
"objects",
"list",
"and",
"sets",
"new",
"object",
"list"
] | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java#L52-L57 |
117,555 | galenframework/galen | galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java | PageSpec.setObjectGroups | public void setObjectGroups(Map<String, List<String>> objectGroups) {
this.objectGroups.clear();
if (objectGroups != null) {
this.objectGroups.putAll(objectGroups);
}
} | java | public void setObjectGroups(Map<String, List<String>> objectGroups) {
this.objectGroups.clear();
if (objectGroups != null) {
this.objectGroups.putAll(objectGroups);
}
} | [
"public",
"void",
"setObjectGroups",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"objectGroups",
")",
"{",
"this",
".",
"objectGroups",
".",
"clear",
"(",
")",
";",
"if",
"(",
"objectGroups",
"!=",
"null",
")",
"{",
"this",
".",
... | Clears the current object groups list and sets new group list
@param objectGroups | [
"Clears",
"the",
"current",
"object",
"groups",
"list",
"and",
"sets",
"new",
"group",
"list"
] | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java#L63-L68 |
117,556 | galenframework/galen | galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java | PageSpec.setSections | public void setSections(List<PageSection> sections) {
this.sections.clear();
if (sections != null) {
this.sections.addAll(sections);
}
} | java | public void setSections(List<PageSection> sections) {
this.sections.clear();
if (sections != null) {
this.sections.addAll(sections);
}
} | [
"public",
"void",
"setSections",
"(",
"List",
"<",
"PageSection",
">",
"sections",
")",
"{",
"this",
".",
"sections",
".",
"clear",
"(",
")",
";",
"if",
"(",
"sections",
"!=",
"null",
")",
"{",
"this",
".",
"sections",
".",
"addAll",
"(",
"sections",
... | Clears the current root sections and copies new sections from given list
@param sections | [
"Clears",
"the",
"current",
"root",
"sections",
"and",
"copies",
"new",
"sections",
"from",
"given",
"list"
] | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java#L82-L87 |
117,557 | galenframework/galen | galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java | PageSpec.findOnlyExistingMatchingObjectNames | public List<String> findOnlyExistingMatchingObjectNames(String objectExpression) {
String[] parts = objectExpression.split(",");
List<String> allSortedObjectNames = getSortedObjectNames();
List<String> resultingObjectNames = new LinkedList<>();
for (String part : parts) {
S... | java | public List<String> findOnlyExistingMatchingObjectNames(String objectExpression) {
String[] parts = objectExpression.split(",");
List<String> allSortedObjectNames = getSortedObjectNames();
List<String> resultingObjectNames = new LinkedList<>();
for (String part : parts) {
S... | [
"public",
"List",
"<",
"String",
">",
"findOnlyExistingMatchingObjectNames",
"(",
"String",
"objectExpression",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"objectExpression",
".",
"split",
"(",
"\",\"",
")",
";",
"List",
"<",
"String",
">",
"allSortedObjectName... | Find all objects that match galen object statements
@param objectExpression - Galen object statements
@return | [
"Find",
"all",
"objects",
"that",
"match",
"galen",
"object",
"statements"
] | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java#L119-L143 |
117,558 | galenframework/galen | galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java | PageSpec.getSortedObjectNames | public List<String> getSortedObjectNames() {
List<String> list = new ArrayList<>(getObjects().keySet());
Collections.sort(list, new AlphanumericComparator());
return list;
} | java | public List<String> getSortedObjectNames() {
List<String> list = new ArrayList<>(getObjects().keySet());
Collections.sort(list, new AlphanumericComparator());
return list;
} | [
"public",
"List",
"<",
"String",
">",
"getSortedObjectNames",
"(",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"getObjects",
"(",
")",
".",
"keySet",
"(",
")",
")",
";",
"Collections",
".",
"sort",
"(",
"list",
"... | Returns an alphanumericly sorted list of names of all declared objects | [
"Returns",
"an",
"alphanumericly",
"sorted",
"list",
"of",
"names",
"of",
"all",
"declared",
"objects"
] | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java#L181-L185 |
117,559 | galenframework/galen | galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java | PageSpec.findObjectsInGroup | public List<String> findObjectsInGroup(String groupName) {
if (getObjectGroups().containsKey(groupName)) {
return getObjectGroups().get(groupName);
} else {
return Collections.emptyList();
}
} | java | public List<String> findObjectsInGroup(String groupName) {
if (getObjectGroups().containsKey(groupName)) {
return getObjectGroups().get(groupName);
} else {
return Collections.emptyList();
}
} | [
"public",
"List",
"<",
"String",
">",
"findObjectsInGroup",
"(",
"String",
"groupName",
")",
"{",
"if",
"(",
"getObjectGroups",
"(",
")",
".",
"containsKey",
"(",
"groupName",
")",
")",
"{",
"return",
"getObjectGroups",
"(",
")",
".",
"get",
"(",
"groupNam... | Find all objects belonging to a specific group
@param groupName A name of a an object group | [
"Find",
"all",
"objects",
"belonging",
"to",
"a",
"specific",
"group"
] | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java#L191-L197 |
117,560 | galenframework/galen | galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java | PageSpec.merge | public void merge(PageSpec spec) {
if (spec == null) {
throw new IllegalArgumentException("Cannot merge null spec");
}
objects.putAll(spec.getObjects());
sections.addAll(spec.getSections());
objectGroups.putAll(spec.getObjectGroups());
} | java | public void merge(PageSpec spec) {
if (spec == null) {
throw new IllegalArgumentException("Cannot merge null spec");
}
objects.putAll(spec.getObjects());
sections.addAll(spec.getSections());
objectGroups.putAll(spec.getObjectGroups());
} | [
"public",
"void",
"merge",
"(",
"PageSpec",
"spec",
")",
"{",
"if",
"(",
"spec",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot merge null spec\"",
")",
";",
"}",
"objects",
".",
"putAll",
"(",
"spec",
".",
"getObjects",
... | Merges all objects, sections and objectGroups from spec | [
"Merges",
"all",
"objects",
"sections",
"and",
"objectGroups",
"from",
"spec"
] | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java#L203-L210 |
117,561 | galenframework/galen | galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java | PageSpec.addSpec | public void addSpec(String sectionName, String objectName, String specText) {
PageSection pageSection = findSection(sectionName);
if (pageSection == null) {
pageSection = new PageSection(sectionName);
sections.add(pageSection);
}
ObjectSpecs objectSpecs = new Ob... | java | public void addSpec(String sectionName, String objectName, String specText) {
PageSection pageSection = findSection(sectionName);
if (pageSection == null) {
pageSection = new PageSection(sectionName);
sections.add(pageSection);
}
ObjectSpecs objectSpecs = new Ob... | [
"public",
"void",
"addSpec",
"(",
"String",
"sectionName",
",",
"String",
"objectName",
",",
"String",
"specText",
")",
"{",
"PageSection",
"pageSection",
"=",
"findSection",
"(",
"sectionName",
")",
";",
"if",
"(",
"pageSection",
"==",
"null",
")",
"{",
"pa... | Parses the spec from specText and adds it to the page spec inside specified section. If section does not exit, it will create it
@param sectionName
@param objectName
@param specText | [
"Parses",
"the",
"spec",
"from",
"specText",
"and",
"adds",
"it",
"to",
"the",
"page",
"spec",
"inside",
"specified",
"section",
".",
"If",
"section",
"does",
"not",
"exit",
"it",
"will",
"create",
"it"
] | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java#L225-L236 |
117,562 | galenframework/galen | galen-core/src/main/java/com/galenframework/reports/model/FileTempStorage.java | FileTempStorage.cleanup | public void cleanup() {
if (this.childStorages != null) {
for (FileTempStorage storage : this.childStorages) {
storage.cleanup();
}
}
for (File file : this.files.values()) {
FileUtils.deleteQuietly(file);
}
this.files.clear();
... | java | public void cleanup() {
if (this.childStorages != null) {
for (FileTempStorage storage : this.childStorages) {
storage.cleanup();
}
}
for (File file : this.files.values()) {
FileUtils.deleteQuietly(file);
}
this.files.clear();
... | [
"public",
"void",
"cleanup",
"(",
")",
"{",
"if",
"(",
"this",
".",
"childStorages",
"!=",
"null",
")",
"{",
"for",
"(",
"FileTempStorage",
"storage",
":",
"this",
".",
"childStorages",
")",
"{",
"storage",
".",
"cleanup",
"(",
")",
";",
"}",
"}",
"f... | Removes all temporary files from disk.
IMPORTANT! Use this call only in the end
when you are sure you don't need report files anymore | [
"Removes",
"all",
"temporary",
"files",
"from",
"disk",
".",
"IMPORTANT!",
"Use",
"this",
"call",
"only",
"in",
"the",
"end",
"when",
"you",
"are",
"sure",
"you",
"don",
"t",
"need",
"report",
"files",
"anymore"
] | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/reports/model/FileTempStorage.java#L77-L88 |
117,563 | galenframework/galen | galen-core/src/main/java/com/galenframework/utils/GalenUtils.java | GalenUtils.resizeScreenshotIfNeeded | public static BufferedImage resizeScreenshotIfNeeded(WebDriver driver, BufferedImage screenshotImage) {
Double devicePixelRatio = 1.0;
try {
devicePixelRatio = ((Number) ((JavascriptExecutor) driver).executeScript(JS_RETRIEVE_DEVICE_PIXEL_RATIO)).doubleValue();
} catch (Exception ex... | java | public static BufferedImage resizeScreenshotIfNeeded(WebDriver driver, BufferedImage screenshotImage) {
Double devicePixelRatio = 1.0;
try {
devicePixelRatio = ((Number) ((JavascriptExecutor) driver).executeScript(JS_RETRIEVE_DEVICE_PIXEL_RATIO)).doubleValue();
} catch (Exception ex... | [
"public",
"static",
"BufferedImage",
"resizeScreenshotIfNeeded",
"(",
"WebDriver",
"driver",
",",
"BufferedImage",
"screenshotImage",
")",
"{",
"Double",
"devicePixelRatio",
"=",
"1.0",
";",
"try",
"{",
"devicePixelRatio",
"=",
"(",
"(",
"Number",
")",
"(",
"(",
... | Check the devicePixelRatio and adapts the size of the screenshot as if the ratio was 1.0
@param driver
@param screenshotImage
@return | [
"Check",
"the",
"devicePixelRatio",
"and",
"adapts",
"the",
"size",
"of",
"the",
"screenshot",
"as",
"if",
"the",
"ratio",
"was",
"1",
".",
"0"
] | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/utils/GalenUtils.java#L187-L222 |
117,564 | galenframework/galen | galen-core/src/main/java/com/galenframework/page/Rect.java | Rect.calculatePointOffsetDistance | public int calculatePointOffsetDistance(Point point) {
int right = left + width;
int bottom = top + height;
int pointLeft = point.getLeft();
int pointTop = point.getTop();
if (contains(point)) {
return max(top - pointTop, pointTop - bottom, left - pointLeft, pointLef... | java | public int calculatePointOffsetDistance(Point point) {
int right = left + width;
int bottom = top + height;
int pointLeft = point.getLeft();
int pointTop = point.getTop();
if (contains(point)) {
return max(top - pointTop, pointTop - bottom, left - pointLeft, pointLef... | [
"public",
"int",
"calculatePointOffsetDistance",
"(",
"Point",
"point",
")",
"{",
"int",
"right",
"=",
"left",
"+",
"width",
";",
"int",
"bottom",
"=",
"top",
"+",
"height",
";",
"int",
"pointLeft",
"=",
"point",
".",
"getLeft",
"(",
")",
";",
"int",
"... | Calculates the distance of given point to one of the rect edges.
If the point is located inside the return result will be negative.
If the point is located on edge the result will be zero
If the point is located outside of the rect - it will return positive value
@param point
@return | [
"Calculates",
"the",
"distance",
"of",
"given",
"point",
"to",
"one",
"of",
"the",
"rect",
"edges",
".",
"If",
"the",
"point",
"is",
"located",
"inside",
"the",
"return",
"result",
"will",
"be",
"negative",
".",
"If",
"the",
"point",
"is",
"located",
"on... | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/page/Rect.java#L151-L176 |
117,565 | galenframework/galen | galen-core/src/main/java/com/galenframework/javascript/GalenJsApi.java | GalenJsApi.checkPageSpecLayout | public static LayoutReport checkPageSpecLayout(WebDriver driver, PageSpec pageSpec, String[]includedTags, String[]excludedTags,
String screenshotFilePath) throws IOException {
TestSession session = TestSession.current();
if (session == null) {
throw... | java | public static LayoutReport checkPageSpecLayout(WebDriver driver, PageSpec pageSpec, String[]includedTags, String[]excludedTags,
String screenshotFilePath) throws IOException {
TestSession session = TestSession.current();
if (session == null) {
throw... | [
"public",
"static",
"LayoutReport",
"checkPageSpecLayout",
"(",
"WebDriver",
"driver",
",",
"PageSpec",
"pageSpec",
",",
"String",
"[",
"]",
"includedTags",
",",
"String",
"[",
"]",
"excludedTags",
",",
"String",
"screenshotFilePath",
")",
"throws",
"IOException",
... | Used in GalenApi.js
@param driver
@param pageSpec
@param includedTags
@param excludedTags
@param screenshotFilePath
@return
@throws IOException | [
"Used",
"in",
"GalenApi",
".",
"js"
] | 6c7dc1f11d097e6aa49c45d6a77ee688741657a4 | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/javascript/GalenJsApi.java#L125-L156 |
117,566 | facebookarchive/hadoop-20 | src/contrib/data_join/src/java/org/apache/hadoop/contrib/utils/join/JobBase.java | JobBase.getReport | protected String getReport() {
StringBuffer sb = new StringBuffer();
Iterator iter = this.longCounters.entrySet().iterator();
while (iter.hasNext()) {
Entry e = (Entry) iter.next();
sb.append(e.getKey().toString()).append("\t").append(e.getValue())
.append("\n");
}
iter = this.d... | java | protected String getReport() {
StringBuffer sb = new StringBuffer();
Iterator iter = this.longCounters.entrySet().iterator();
while (iter.hasNext()) {
Entry e = (Entry) iter.next();
sb.append(e.getKey().toString()).append("\t").append(e.getValue())
.append("\n");
}
iter = this.d... | [
"protected",
"String",
"getReport",
"(",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"Iterator",
"iter",
"=",
"this",
".",
"longCounters",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
"... | log the counters | [
"log",
"the",
"counters"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/data_join/src/java/org/apache/hadoop/contrib/utils/join/JobBase.java#L145-L161 |
117,567 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/Pentomino.java | Pentomino.stringifySolution | public static String stringifySolution(int width, int height,
List<List<ColumnName>> solution) {
String[][] picture = new String[height][width];
StringBuffer result = new StringBuffer();
// for each piece placement...
for(List<ColumnName> row: solution) {
... | java | public static String stringifySolution(int width, int height,
List<List<ColumnName>> solution) {
String[][] picture = new String[height][width];
StringBuffer result = new StringBuffer();
// for each piece placement...
for(List<ColumnName> row: solution) {
... | [
"public",
"static",
"String",
"stringifySolution",
"(",
"int",
"width",
",",
"int",
"height",
",",
"List",
"<",
"List",
"<",
"ColumnName",
">",
">",
"solution",
")",
"{",
"String",
"[",
"]",
"[",
"]",
"picture",
"=",
"new",
"String",
"[",
"height",
"]"... | Convert a solution to the puzzle returned by the model into a string
that represents the placement of the pieces onto the board.
@param width the width of the puzzle board
@param height the height of the puzzle board
@param solution the list of column names that were selected in the model
@return a string representatio... | [
"Convert",
"a",
"solution",
"to",
"the",
"puzzle",
"returned",
"by",
"the",
"model",
"into",
"a",
"string",
"that",
"represents",
"the",
"placement",
"of",
"the",
"pieces",
"onto",
"the",
"board",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/Pentomino.java#L138-L168 |
117,568 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/Pentomino.java | Pentomino.getCategory | public SolutionCategory getCategory(List<List<ColumnName>> names) {
Piece xPiece = null;
// find the "x" piece
for(Piece p: pieces) {
if ("x".equals(p.name)) {
xPiece = p;
break;
}
}
// find the row containing the "x"
for(List<ColumnName> row: names) {
if (row.c... | java | public SolutionCategory getCategory(List<List<ColumnName>> names) {
Piece xPiece = null;
// find the "x" piece
for(Piece p: pieces) {
if ("x".equals(p.name)) {
xPiece = p;
break;
}
}
// find the row containing the "x"
for(List<ColumnName> row: names) {
if (row.c... | [
"public",
"SolutionCategory",
"getCategory",
"(",
"List",
"<",
"List",
"<",
"ColumnName",
">",
">",
"names",
")",
"{",
"Piece",
"xPiece",
"=",
"null",
";",
"// find the \"x\" piece",
"for",
"(",
"Piece",
"p",
":",
"pieces",
")",
"{",
"if",
"(",
"\"x\"",
... | Find whether the solution has the x in the upper left quadrant, the
x-midline, the y-midline or in the center.
@param names the solution to check
@return the catagory of the solution | [
"Find",
"whether",
"the",
"solution",
"has",
"the",
"x",
"in",
"the",
"upper",
"left",
"quadrant",
"the",
"x",
"-",
"midline",
"the",
"y",
"-",
"midline",
"or",
"in",
"the",
"center",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/Pentomino.java#L178-L226 |
117,569 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/Pentomino.java | Pentomino.initializePieces | protected void initializePieces() {
pieces.add(new Piece("x", " x /xxx/ x ", false, oneRotation));
pieces.add(new Piece("v", "x /x /xxx", false, fourRotations));
pieces.add(new Piece("t", "xxx/ x / x ", false, fourRotations));
pieces.add(new Piece("w", " x/ xx/xx ", false, fourRotations));
pieces... | java | protected void initializePieces() {
pieces.add(new Piece("x", " x /xxx/ x ", false, oneRotation));
pieces.add(new Piece("v", "x /x /xxx", false, fourRotations));
pieces.add(new Piece("t", "xxx/ x / x ", false, fourRotations));
pieces.add(new Piece("w", " x/ xx/xx ", false, fourRotations));
pieces... | [
"protected",
"void",
"initializePieces",
"(",
")",
"{",
"pieces",
".",
"add",
"(",
"new",
"Piece",
"(",
"\"x\"",
",",
"\" x /xxx/ x \"",
",",
"false",
",",
"oneRotation",
")",
")",
";",
"pieces",
".",
"add",
"(",
"new",
"Piece",
"(",
"\"v\"",
",",
"\"x... | Fill in the pieces list. | [
"Fill",
"in",
"the",
"pieces",
"list",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/Pentomino.java#L269-L282 |
117,570 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/Pentomino.java | Pentomino.generateRows | private static void generateRows(DancingLinks dancer,
Piece piece,
int width,
int height,
boolean flip,
boolean[] row,
... | java | private static void generateRows(DancingLinks dancer,
Piece piece,
int width,
int height,
boolean flip,
boolean[] row,
... | [
"private",
"static",
"void",
"generateRows",
"(",
"DancingLinks",
"dancer",
",",
"Piece",
"piece",
",",
"int",
"width",
",",
"int",
"height",
",",
"boolean",
"flip",
",",
"boolean",
"[",
"]",
"row",
",",
"boolean",
"upperLeft",
")",
"{",
"// for each rotatio... | For a given piece, generate all of the potential placements and add them
as rows to the model.
@param dancer the problem model
@param piece the piece we are trying to place
@param width the width of the board
@param height the height of the board
@param flip is the piece flipped over?
@param row a workspace the length ... | [
"For",
"a",
"given",
"piece",
"generate",
"all",
"of",
"the",
"potential",
"placements",
"and",
"add",
"them",
"as",
"rows",
"to",
"the",
"model",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/Pentomino.java#L310-L344 |
117,571 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/Pentomino.java | Pentomino.main | public static void main(String[] args) {
int width = 6;
int height = 10;
Pentomino model = new Pentomino(width, height);
List splits = model.getSplits(2);
for(Iterator splitItr=splits.iterator(); splitItr.hasNext(); ) {
int[] choices = (int[]) splitItr.next();
System.out.print("split:");... | java | public static void main(String[] args) {
int width = 6;
int height = 10;
Pentomino model = new Pentomino(width, height);
List splits = model.getSplits(2);
for(Iterator splitItr=splits.iterator(); splitItr.hasNext(); ) {
int[] choices = (int[]) splitItr.next();
System.out.print("split:");... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"int",
"width",
"=",
"6",
";",
"int",
"height",
"=",
"10",
";",
"Pentomino",
"model",
"=",
"new",
"Pentomino",
"(",
"width",
",",
"height",
")",
";",
"List",
"splits",
"... | Solve the 6x10 pentomino puzzle. | [
"Solve",
"the",
"6x10",
"pentomino",
"puzzle",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/Pentomino.java#L433-L448 |
117,572 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/lib/db/DBOutputFormat.java | DBOutputFormat.constructQuery | protected String constructQuery(String table, String[] fieldNames) {
if(fieldNames == null) {
throw new IllegalArgumentException("Field names may not be null");
}
StringBuilder query = new StringBuilder();
query.append("INSERT INTO ").append(table);
if (fieldNames.length > 0 && fieldNames[0]... | java | protected String constructQuery(String table, String[] fieldNames) {
if(fieldNames == null) {
throw new IllegalArgumentException("Field names may not be null");
}
StringBuilder query = new StringBuilder();
query.append("INSERT INTO ").append(table);
if (fieldNames.length > 0 && fieldNames[0]... | [
"protected",
"String",
"constructQuery",
"(",
"String",
"table",
",",
"String",
"[",
"]",
"fieldNames",
")",
"{",
"if",
"(",
"fieldNames",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Field names may not be null\"",
")",
";",
"}",
... | Constructs the query used as the prepared statement to insert data.
@param table
the table to insert into
@param fieldNames
the fields to insert into. If field names are unknown, supply an
array of nulls. | [
"Constructs",
"the",
"query",
"used",
"as",
"the",
"prepared",
"statement",
"to",
"insert",
"data",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/db/DBOutputFormat.java#L109-L138 |
117,573 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/lib/db/DBOutputFormat.java | DBOutputFormat.setOutput | public static void setOutput(JobConf job, String tableName, String... fieldNames) {
job.setOutputFormat(DBOutputFormat.class);
job.setReduceSpeculativeExecution(false);
DBConfiguration dbConf = new DBConfiguration(job);
dbConf.setOutputTableName(tableName);
dbConf.setOutputFieldNames(fieldName... | java | public static void setOutput(JobConf job, String tableName, String... fieldNames) {
job.setOutputFormat(DBOutputFormat.class);
job.setReduceSpeculativeExecution(false);
DBConfiguration dbConf = new DBConfiguration(job);
dbConf.setOutputTableName(tableName);
dbConf.setOutputFieldNames(fieldName... | [
"public",
"static",
"void",
"setOutput",
"(",
"JobConf",
"job",
",",
"String",
"tableName",
",",
"String",
"...",
"fieldNames",
")",
"{",
"job",
".",
"setOutputFormat",
"(",
"DBOutputFormat",
".",
"class",
")",
";",
"job",
".",
"setReduceSpeculativeExecution",
... | Initializes the reduce-part of the job with the appropriate output settings
@param job
The job
@param tableName
The table to insert data into
@param fieldNames
The field names in the table. If unknown, supply the appropriate
number of nulls. | [
"Initializes",
"the",
"reduce",
"-",
"part",
"of",
"the",
"job",
"with",
"the",
"appropriate",
"output",
"settings"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/db/DBOutputFormat.java#L177-L185 |
117,574 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetworkTopology.java | NetworkTopology.getRacks | public List<String> getRacks() {
netlock.readLock().lock();
try {
return new ArrayList<String>(racks);
} finally {
netlock.readLock().unlock();
}
} | java | public List<String> getRacks() {
netlock.readLock().lock();
try {
return new ArrayList<String>(racks);
} finally {
netlock.readLock().unlock();
}
} | [
"public",
"List",
"<",
"String",
">",
"getRacks",
"(",
")",
"{",
"netlock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"racks",
")",
";",
"}",
"finally",
"{",
"netlock",... | Get a copy of the racks list. | [
"Get",
"a",
"copy",
"of",
"the",
"racks",
"list",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetworkTopology.java#L326-L333 |
117,575 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetworkTopology.java | NetworkTopology.add | public void add(Node node) {
if (node==null) return;
if( node instanceof InnerNode ) {
throw new IllegalArgumentException(
"Not allow to add an inner node: "+NodeBase.getPath(node));
}
netlock.writeLock().lock();
try {
Node rack = getNode(node.getNetworkLocation());
if (rac... | java | public void add(Node node) {
if (node==null) return;
if( node instanceof InnerNode ) {
throw new IllegalArgumentException(
"Not allow to add an inner node: "+NodeBase.getPath(node));
}
netlock.writeLock().lock();
try {
Node rack = getNode(node.getNetworkLocation());
if (rac... | [
"public",
"void",
"add",
"(",
"Node",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"return",
";",
"if",
"(",
"node",
"instanceof",
"InnerNode",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Not allow to add an inner node: \"",
"+",
... | Add a leaf node
Update node counter & rack counter if neccessary
@param node
node to be added
@exception IllegalArgumentException if add a node to a leave
or node to be added is not a leaf | [
"Add",
"a",
"leaf",
"node",
"Update",
"node",
"counter",
"&",
"rack",
"counter",
"if",
"neccessary"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetworkTopology.java#L342-L372 |
117,576 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetworkTopology.java | NetworkTopology.remove | public void remove(Node node) {
if (node==null) return;
if( node instanceof InnerNode ) {
throw new IllegalArgumentException(
"Not allow to remove an inner node: "+NodeBase.getPath(node));
}
LOG.info("Removing a node: "+NodeBase.getPath(node));
netlock.writeLock().lock();
try {
... | java | public void remove(Node node) {
if (node==null) return;
if( node instanceof InnerNode ) {
throw new IllegalArgumentException(
"Not allow to remove an inner node: "+NodeBase.getPath(node));
}
LOG.info("Removing a node: "+NodeBase.getPath(node));
netlock.writeLock().lock();
try {
... | [
"public",
"void",
"remove",
"(",
"Node",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"return",
";",
"if",
"(",
"node",
"instanceof",
"InnerNode",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Not allow to remove an inner node: \"",
... | Remove a node
Update node counter & rack counter if neccessary
@param node
node to be removed | [
"Remove",
"a",
"node",
"Update",
"node",
"counter",
"&",
"rack",
"counter",
"if",
"neccessary"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetworkTopology.java#L379-L404 |
117,577 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetworkTopology.java | NetworkTopology.getNode | public Node getNode(String loc) {
netlock.readLock().lock();
try {
loc = NodeBase.normalize(loc);
if (!NodeBase.ROOT.equals(loc))
loc = loc.substring(1);
return clusterMap.getLoc(loc);
} finally {
netlock.readLock().unlock();
}
} | java | public Node getNode(String loc) {
netlock.readLock().lock();
try {
loc = NodeBase.normalize(loc);
if (!NodeBase.ROOT.equals(loc))
loc = loc.substring(1);
return clusterMap.getLoc(loc);
} finally {
netlock.readLock().unlock();
}
} | [
"public",
"Node",
"getNode",
"(",
"String",
"loc",
")",
"{",
"netlock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"loc",
"=",
"NodeBase",
".",
"normalize",
"(",
"loc",
")",
";",
"if",
"(",
"!",
"NodeBase",
".",
"ROOT",
".... | Given a string representation of a node, return its reference
@param loc
a path-like string representation of a node
@return a reference to the node; null if the node is not in the tree | [
"Given",
"a",
"string",
"representation",
"of",
"a",
"node",
"return",
"its",
"reference"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetworkTopology.java#L434-L444 |
117,578 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetworkTopology.java | NetworkTopology.getDatanodesInRack | public List<Node> getDatanodesInRack(String loc) {
netlock.readLock().lock();
try {
loc = NodeBase.normalize(loc);
if (!NodeBase.ROOT.equals(loc))
loc = loc.substring(1);
InnerNode rack = (InnerNode) clusterMap.getLoc(loc);
if (rack == null) return null;
return new ArrayLis... | java | public List<Node> getDatanodesInRack(String loc) {
netlock.readLock().lock();
try {
loc = NodeBase.normalize(loc);
if (!NodeBase.ROOT.equals(loc))
loc = loc.substring(1);
InnerNode rack = (InnerNode) clusterMap.getLoc(loc);
if (rack == null) return null;
return new ArrayLis... | [
"public",
"List",
"<",
"Node",
">",
"getDatanodesInRack",
"(",
"String",
"loc",
")",
"{",
"netlock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"loc",
"=",
"NodeBase",
".",
"normalize",
"(",
"loc",
")",
";",
"if",
"(",
"!",
... | Given a string representation of a rack, return its children
@param loc a path-like string representation of a rack
@return a newly allocated list with all the node's children | [
"Given",
"a",
"string",
"representation",
"of",
"a",
"rack",
"return",
"its",
"children"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetworkTopology.java#L451-L463 |
117,579 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetworkTopology.java | NetworkTopology.getAllRacks | public Set<String> getAllRacks() {
netlock.readLock().lock();
try {
Set<String> result = new HashSet<String>(this.racks);
result.addAll(this.masterRacksSet);
return result;
} finally {
netlock.readLock().unlock();
}
} | java | public Set<String> getAllRacks() {
netlock.readLock().lock();
try {
Set<String> result = new HashSet<String>(this.racks);
result.addAll(this.masterRacksSet);
return result;
} finally {
netlock.readLock().unlock();
}
} | [
"public",
"Set",
"<",
"String",
">",
"getAllRacks",
"(",
")",
"{",
"netlock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"Set",
"<",
"String",
">",
"result",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
"this",
".",
"ra... | Returns the set of racks | [
"Returns",
"the",
"set",
"of",
"racks"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetworkTopology.java#L476-L485 |
117,580 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetworkTopology.java | NetworkTopology.getDistance | public int getDistance(Node node1, Node node2) {
if (node1 == node2) {
return 0;
}
Node n1=node1, n2=node2;
int dis = 0;
netlock.readLock().lock();
try {
int level1=node1.getLevel(), level2=node2.getLevel();
while(n1!=null && level1>level2) {
n1 = n1.getParent();
... | java | public int getDistance(Node node1, Node node2) {
if (node1 == node2) {
return 0;
}
Node n1=node1, n2=node2;
int dis = 0;
netlock.readLock().lock();
try {
int level1=node1.getLevel(), level2=node2.getLevel();
while(n1!=null && level1>level2) {
n1 = n1.getParent();
... | [
"public",
"int",
"getDistance",
"(",
"Node",
"node1",
",",
"Node",
"node2",
")",
"{",
"if",
"(",
"node1",
"==",
"node2",
")",
"{",
"return",
"0",
";",
"}",
"Node",
"n1",
"=",
"node1",
",",
"n2",
"=",
"node2",
";",
"int",
"dis",
"=",
"0",
";",
"... | Return the distance between two nodes
It is assumed that the distance from one node to its parent is 1
The distance between two nodes is calculated by summing up their distances
to their closest common ancestor.
@param node1 one node
@param node2 another node
@return the distance between node1 and node2
node1 or node2... | [
"Return",
"the",
"distance",
"between",
"two",
"nodes",
"It",
"is",
"assumed",
"that",
"the",
"distance",
"from",
"one",
"node",
"to",
"its",
"parent",
"is",
"1",
"The",
"distance",
"between",
"two",
"nodes",
"is",
"calculated",
"by",
"summing",
"up",
"the... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetworkTopology.java#L506-L542 |
117,581 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetworkTopology.java | NetworkTopology.isOnSameRack | public boolean isOnSameRack( Node node1, Node node2) {
if (node1 == null || node2 == null) {
return false;
}
netlock.readLock().lock();
try {
return node1.getParent()==node2.getParent();
} finally {
netlock.readLock().unlock();
}
} | java | public boolean isOnSameRack( Node node1, Node node2) {
if (node1 == null || node2 == null) {
return false;
}
netlock.readLock().lock();
try {
return node1.getParent()==node2.getParent();
} finally {
netlock.readLock().unlock();
}
} | [
"public",
"boolean",
"isOnSameRack",
"(",
"Node",
"node1",
",",
"Node",
"node2",
")",
"{",
"if",
"(",
"node1",
"==",
"null",
"||",
"node2",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"netlock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
... | Check if two nodes are on the same rack
@param node1 one node
@param node2 another node
@return true if node1 and node2 are pm the same rack; false otherwise
@exception IllegalArgumentException when either node1 or node2 is null, or
node1 or node2 do not belong to the cluster | [
"Check",
"if",
"two",
"nodes",
"are",
"on",
"the",
"same",
"rack"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetworkTopology.java#L551-L562 |
117,582 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetworkTopology.java | NetworkTopology.chooseRack | public String chooseRack(Set<String> excludedRacks) {
String chosenRack = null;
HashSet<Integer> chosenIndexes = new HashSet<Integer>();
netlock.readLock().lock();
try {
int totalRacks = getNumOfRacks();
if (totalRacks - excludedRacks.size() <= 0)
return null; // all racks are exclu... | java | public String chooseRack(Set<String> excludedRacks) {
String chosenRack = null;
HashSet<Integer> chosenIndexes = new HashSet<Integer>();
netlock.readLock().lock();
try {
int totalRacks = getNumOfRacks();
if (totalRacks - excludedRacks.size() <= 0)
return null; // all racks are exclu... | [
"public",
"String",
"chooseRack",
"(",
"Set",
"<",
"String",
">",
"excludedRacks",
")",
"{",
"String",
"chosenRack",
"=",
"null",
";",
"HashSet",
"<",
"Integer",
">",
"chosenIndexes",
"=",
"new",
"HashSet",
"<",
"Integer",
">",
"(",
")",
";",
"netlock",
... | Choose a rack which is not in exlcudedRacks
@param excludedRacks excluded racks
@return a rack | [
"Choose",
"a",
"rack",
"which",
"is",
"not",
"in",
"exlcudedRacks"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetworkTopology.java#L589-L621 |
117,583 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapreduce/Mapper.java | Mapper.run | public void run(Context context) throws IOException, InterruptedException {
setup(context);
while (context.nextKeyValue()) {
map(context.getCurrentKey(), context.getCurrentValue(), context);
}
cleanup(context);
} | java | public void run(Context context) throws IOException, InterruptedException {
setup(context);
while (context.nextKeyValue()) {
map(context.getCurrentKey(), context.getCurrentValue(), context);
}
cleanup(context);
} | [
"public",
"void",
"run",
"(",
"Context",
"context",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"setup",
"(",
"context",
")",
";",
"while",
"(",
"context",
".",
"nextKeyValue",
"(",
")",
")",
"{",
"map",
"(",
"context",
".",
"getCurrent... | Expert users can override this method for more complete control over the
execution of the Mapper.
@param context
@throws IOException | [
"Expert",
"users",
"can",
"override",
"this",
"method",
"for",
"more",
"complete",
"control",
"over",
"the",
"execution",
"of",
"the",
"Mapper",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/Mapper.java#L141-L147 |
117,584 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/raid/StripeReader.java | StripeReader.getBlockIdInFile | private static int getBlockIdInFile(DistributedFileSystem srcFs,
Path srcPath, long blockId) throws IOException {
FileStatus srcStat = srcFs.getFileStatus(srcPath);
LocatedBlocks lbs =
srcFs.getClient().getLocatedBlocks(srcPath.toUri().getPath(), 0,
srcStat.getLen());
int i ... | java | private static int getBlockIdInFile(DistributedFileSystem srcFs,
Path srcPath, long blockId) throws IOException {
FileStatus srcStat = srcFs.getFileStatus(srcPath);
LocatedBlocks lbs =
srcFs.getClient().getLocatedBlocks(srcPath.toUri().getPath(), 0,
srcStat.getLen());
int i ... | [
"private",
"static",
"int",
"getBlockIdInFile",
"(",
"DistributedFileSystem",
"srcFs",
",",
"Path",
"srcPath",
",",
"long",
"blockId",
")",
"throws",
"IOException",
"{",
"FileStatus",
"srcStat",
"=",
"srcFs",
".",
"getFileStatus",
"(",
"srcPath",
")",
";",
"Loca... | Get the index of a block in a file, according to the blockId.
Any better ways to do this? | [
"Get",
"the",
"index",
"of",
"a",
"block",
"in",
"a",
"file",
"according",
"to",
"the",
"blockId",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/StripeReader.java#L144-L161 |
117,585 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/raid/StripeReader.java | StripeReader.getBlockLocation | public static LocationPair getBlockLocation(Codec codec, FileSystem srcFs,
Path srcFile, int blockIdxInFile, Configuration conf,
List<FileStatus> lfs) throws IOException {
int stripeIdx = 0;
int blockIdxInStripe = 0;
int blockIdx = blockIdxInFile;
if (codec.isDirRaid) {
Path parentP... | java | public static LocationPair getBlockLocation(Codec codec, FileSystem srcFs,
Path srcFile, int blockIdxInFile, Configuration conf,
List<FileStatus> lfs) throws IOException {
int stripeIdx = 0;
int blockIdxInStripe = 0;
int blockIdx = blockIdxInFile;
if (codec.isDirRaid) {
Path parentP... | [
"public",
"static",
"LocationPair",
"getBlockLocation",
"(",
"Codec",
"codec",
",",
"FileSystem",
"srcFs",
",",
"Path",
"srcFile",
",",
"int",
"blockIdxInFile",
",",
"Configuration",
"conf",
",",
"List",
"<",
"FileStatus",
">",
"lfs",
")",
"throws",
"IOException... | Given a block in the file and specific codec, return the LocationPair
object which contains id of the stripe it belongs to and its
location in the stripe | [
"Given",
"a",
"block",
"in",
"the",
"file",
"and",
"specific",
"codec",
"return",
"the",
"LocationPair",
"object",
"which",
"contains",
"id",
"of",
"the",
"stripe",
"it",
"belongs",
"to",
"and",
"its",
"location",
"in",
"the",
"stripe"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/StripeReader.java#L328-L357 |
117,586 | facebookarchive/hadoop-20 | src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/view/servers/ServerView.java | ServerView.createPartControl | @Override
public void createPartControl(Composite parent) {
Tree main =
new Tree(parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL
| SWT.V_SCROLL);
main.setHeaderVisible(true);
main.setLinesVisible(false);
main.setLayoutData(new GridData(GridData.FILL_BOTH));
TreeColumn s... | java | @Override
public void createPartControl(Composite parent) {
Tree main =
new Tree(parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL
| SWT.V_SCROLL);
main.setHeaderVisible(true);
main.setLinesVisible(false);
main.setLayoutData(new GridData(GridData.FILL_BOTH));
TreeColumn s... | [
"@",
"Override",
"public",
"void",
"createPartControl",
"(",
"Composite",
"parent",
")",
"{",
"Tree",
"main",
"=",
"new",
"Tree",
"(",
"parent",
",",
"SWT",
".",
"SINGLE",
"|",
"SWT",
".",
"FULL_SELECTION",
"|",
"SWT",
".",
"H_SCROLL",
"|",
"SWT",
".",
... | Creates the columns for the view | [
"Creates",
"the",
"columns",
"for",
"the",
"view"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/view/servers/ServerView.java#L149-L192 |
117,587 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/join/WrappedRecordReader.java | WrappedRecordReader.skip | public void skip(K key) throws IOException {
if (hasNext()) {
while (cmp.compare(khead, key) <= 0 && next());
}
} | java | public void skip(K key) throws IOException {
if (hasNext()) {
while (cmp.compare(khead, key) <= 0 && next());
}
} | [
"public",
"void",
"skip",
"(",
"K",
"key",
")",
"throws",
"IOException",
"{",
"if",
"(",
"hasNext",
"(",
")",
")",
"{",
"while",
"(",
"cmp",
".",
"compare",
"(",
"khead",
",",
"key",
")",
"<=",
"0",
"&&",
"next",
"(",
")",
")",
";",
"}",
"}"
] | Skip key-value pairs with keys less than or equal to the key provided. | [
"Skip",
"key",
"-",
"value",
"pairs",
"with",
"keys",
"less",
"than",
"or",
"equal",
"to",
"the",
"key",
"provided",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/WrappedRecordReader.java#L101-L105 |
117,588 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/join/WrappedRecordReader.java | WrappedRecordReader.accept | @SuppressWarnings("unchecked") // no static type for the slot this sits in
public void accept(CompositeRecordReader.JoinCollector i, K key)
throws IOException {
vjoin.clear();
if (0 == cmp.compare(key, khead)) {
do {
vjoin.add(vhead);
} while (next() && 0 == cmp.compare(key, khead));... | java | @SuppressWarnings("unchecked") // no static type for the slot this sits in
public void accept(CompositeRecordReader.JoinCollector i, K key)
throws IOException {
vjoin.clear();
if (0 == cmp.compare(key, khead)) {
do {
vjoin.add(vhead);
} while (next() && 0 == cmp.compare(key, khead));... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// no static type for the slot this sits in",
"public",
"void",
"accept",
"(",
"CompositeRecordReader",
".",
"JoinCollector",
"i",
",",
"K",
"key",
")",
"throws",
"IOException",
"{",
"vjoin",
".",
"clear",
"(",
")... | JoinCollector comes from parent, which has | [
"JoinCollector",
"comes",
"from",
"parent",
"which",
"has"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/WrappedRecordReader.java#L123-L133 |
117,589 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/join/WrappedRecordReader.java | WrappedRecordReader.next | public boolean next(K key, U value) throws IOException {
if (hasNext()) {
WritableUtils.cloneInto(key, khead);
WritableUtils.cloneInto(value, vhead);
next();
return true;
}
return false;
} | java | public boolean next(K key, U value) throws IOException {
if (hasNext()) {
WritableUtils.cloneInto(key, khead);
WritableUtils.cloneInto(value, vhead);
next();
return true;
}
return false;
} | [
"public",
"boolean",
"next",
"(",
"K",
"key",
",",
"U",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"hasNext",
"(",
")",
")",
"{",
"WritableUtils",
".",
"cloneInto",
"(",
"key",
",",
"khead",
")",
";",
"WritableUtils",
".",
"cloneInto",
"(",... | Write key-value pair at the head of this stream to the objects provided;
get next key-value pair from proxied RR. | [
"Write",
"key",
"-",
"value",
"pair",
"at",
"the",
"head",
"of",
"this",
"stream",
"to",
"the",
"objects",
"provided",
";",
"get",
"next",
"key",
"-",
"value",
"pair",
"from",
"proxied",
"RR",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/WrappedRecordReader.java#L139-L147 |
117,590 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicy.java | BlockPlacementPolicy.getInstance | public static BlockPlacementPolicy getInstance(Configuration conf,
FSClusterStats stats,
NetworkTopology clusterMap,
HostsFileReader hostsReader,
... | java | public static BlockPlacementPolicy getInstance(Configuration conf,
FSClusterStats stats,
NetworkTopology clusterMap,
HostsFileReader hostsReader,
... | [
"public",
"static",
"BlockPlacementPolicy",
"getInstance",
"(",
"Configuration",
"conf",
",",
"FSClusterStats",
"stats",
",",
"NetworkTopology",
"clusterMap",
",",
"HostsFileReader",
"hostsReader",
",",
"DNSToSwitchMapping",
"dnsToSwitchMapping",
",",
"FSNamesystem",
"names... | Get an instance of the configured Block Placement Policy based on the
value of the configuration paramater dfs.block.replicator.classname.
@param conf the configuration to be used
@param stats an object thatis used to retrieve the load on the cluster
@param clusterMap the network topology of the cluster
@param namesys... | [
"Get",
"an",
"instance",
"of",
"the",
"configured",
"Block",
"Placement",
"Policy",
"based",
"on",
"the",
"value",
"of",
"the",
"configuration",
"paramater",
"dfs",
".",
"block",
".",
"replicator",
".",
"classname",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicy.java#L176-L191 |
117,591 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/SequenceFileInputFilter.java | SequenceFileInputFilter.setFilterClass | public static void setFilterClass(Configuration conf, Class filterClass) {
conf.set(FILTER_CLASS, filterClass.getName());
} | java | public static void setFilterClass(Configuration conf, Class filterClass) {
conf.set(FILTER_CLASS, filterClass.getName());
} | [
"public",
"static",
"void",
"setFilterClass",
"(",
"Configuration",
"conf",
",",
"Class",
"filterClass",
")",
"{",
"conf",
".",
"set",
"(",
"FILTER_CLASS",
",",
"filterClass",
".",
"getName",
"(",
")",
")",
";",
"}"
] | set the filter class
@param conf application configuration
@param filterClass filter class | [
"set",
"the",
"filter",
"class"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/SequenceFileInputFilter.java#L73-L75 |
117,592 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/client/IPCLoggerChannel.java | IPCLoggerChannel.createExecutor | @VisibleForTesting
protected ExecutorService createExecutor() {
return Executors.newSingleThreadExecutor(
new ThreadFactoryBuilder()
.setDaemon(true)
.setNameFormat("Logger channel to " + addr)
.setUncaughtExceptionHandler(
UncaughtExceptionHandlers.systemExit()... | java | @VisibleForTesting
protected ExecutorService createExecutor() {
return Executors.newSingleThreadExecutor(
new ThreadFactoryBuilder()
.setDaemon(true)
.setNameFormat("Logger channel to " + addr)
.setUncaughtExceptionHandler(
UncaughtExceptionHandlers.systemExit()... | [
"@",
"VisibleForTesting",
"protected",
"ExecutorService",
"createExecutor",
"(",
")",
"{",
"return",
"Executors",
".",
"newSingleThreadExecutor",
"(",
"new",
"ThreadFactoryBuilder",
"(",
")",
".",
"setDaemon",
"(",
"true",
")",
".",
"setNameFormat",
"(",
"\"Logger c... | Separated out for easy overriding in tests. | [
"Separated",
"out",
"for",
"easy",
"overriding",
"in",
"tests",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/IPCLoggerChannel.java#L236-L245 |
117,593 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/client/IPCLoggerChannel.java | IPCLoggerChannel.heartbeatIfNecessary | private void heartbeatIfNecessary() throws IOException {
if (lastHeartbeatStopwatch.elapsedMillis() > HEARTBEAT_INTERVAL_MILLIS ||
!lastHeartbeatStopwatch.isRunning()) {
try {
getProxy().heartbeat(createReqInfo());
} finally {
// Don't send heartbeats more often than the configur... | java | private void heartbeatIfNecessary() throws IOException {
if (lastHeartbeatStopwatch.elapsedMillis() > HEARTBEAT_INTERVAL_MILLIS ||
!lastHeartbeatStopwatch.isRunning()) {
try {
getProxy().heartbeat(createReqInfo());
} finally {
// Don't send heartbeats more often than the configur... | [
"private",
"void",
"heartbeatIfNecessary",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"lastHeartbeatStopwatch",
".",
"elapsedMillis",
"(",
")",
">",
"HEARTBEAT_INTERVAL_MILLIS",
"||",
"!",
"lastHeartbeatStopwatch",
".",
"isRunning",
"(",
")",
")",
"{",
"tr... | When we've entered an out-of-sync state, it's still useful to periodically
send an empty RPC to the server, such that it has the up to date
committedTxId. This acts as a sanity check during recovery, and also allows
that node's metrics to be up-to-date about its lag.
In the future, this method may also be used in orde... | [
"When",
"we",
"ve",
"entered",
"an",
"out",
"-",
"of",
"-",
"sync",
"state",
"it",
"s",
"still",
"useful",
"to",
"periodically",
"send",
"an",
"empty",
"RPC",
"to",
"the",
"server",
"such",
"that",
"it",
"has",
"the",
"up",
"to",
"date",
"committedTxId... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/IPCLoggerChannel.java#L470-L481 |
117,594 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/client/IPCLoggerChannel.java | IPCLoggerChannel.buildURLToFetchImage | @Override
public URL buildURLToFetchImage(long txid) {
Preconditions.checkArgument(txid >= -1, "Invalid segment: %s", txid);
Preconditions.checkState(httpPort != -1, "HTTP port not set yet");
try {
// for now we disable throttling for image downloads
String path = GetJournalImageServlet.build... | java | @Override
public URL buildURLToFetchImage(long txid) {
Preconditions.checkArgument(txid >= -1, "Invalid segment: %s", txid);
Preconditions.checkState(httpPort != -1, "HTTP port not set yet");
try {
// for now we disable throttling for image downloads
String path = GetJournalImageServlet.build... | [
"@",
"Override",
"public",
"URL",
"buildURLToFetchImage",
"(",
"long",
"txid",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"txid",
">=",
"-",
"1",
",",
"\"Invalid segment: %s\"",
",",
"txid",
")",
";",
"Preconditions",
".",
"checkState",
"(",
"httpPo... | Build url to fetch image from the journal node to which this logger channel
is attached. | [
"Build",
"url",
"to",
"fetch",
"image",
"from",
"the",
"journal",
"node",
"to",
"which",
"this",
"logger",
"channel",
"is",
"attached",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/IPCLoggerChannel.java#L697-L712 |
117,595 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/MRAsyncDiskService.java | MRAsyncDiskService.moveAndDeleteRelativePath | public boolean moveAndDeleteRelativePath(String volume, String pathName)
throws IOException {
volume = normalizePath(volume);
// Move the file right now, so that it can be deleted later
String newPathName =
format.format(new Date()) + "_" + uniqueId.getAndIncrement();
newPathNam... | java | public boolean moveAndDeleteRelativePath(String volume, String pathName)
throws IOException {
volume = normalizePath(volume);
// Move the file right now, so that it can be deleted later
String newPathName =
format.format(new Date()) + "_" + uniqueId.getAndIncrement();
newPathNam... | [
"public",
"boolean",
"moveAndDeleteRelativePath",
"(",
"String",
"volume",
",",
"String",
"pathName",
")",
"throws",
"IOException",
"{",
"volume",
"=",
"normalizePath",
"(",
"volume",
")",
";",
"// Move the file right now, so that it can be deleted later",
"String",
"newP... | Move the path name on one volume to a temporary location and then
delete them.
This functions returns when the moves are done, but not necessarily all
deletions are done. This is usually good enough because applications
won't see the path name under the old name anyway after the move.
@param volume The disk vol... | [
"Move",
"the",
"path",
"name",
"on",
"one",
"volume",
"to",
"a",
"temporary",
"location",
"and",
"then",
"delete",
"them",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/MRAsyncDiskService.java#L251-L290 |
117,596 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/MRAsyncDiskService.java | MRAsyncDiskService.moveAndDeleteFromEachVolume | public boolean moveAndDeleteFromEachVolume(String pathName) throws IOException {
boolean result = true;
for (int i = 0; i < volumes.length; i++) {
result = result && moveAndDeleteRelativePath(volumes[i], pathName);
}
return result;
} | java | public boolean moveAndDeleteFromEachVolume(String pathName) throws IOException {
boolean result = true;
for (int i = 0; i < volumes.length; i++) {
result = result && moveAndDeleteRelativePath(volumes[i], pathName);
}
return result;
} | [
"public",
"boolean",
"moveAndDeleteFromEachVolume",
"(",
"String",
"pathName",
")",
"throws",
"IOException",
"{",
"boolean",
"result",
"=",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"volumes",
".",
"length",
";",
"i",
"++",
")",
"{",
... | Move the path name on each volume to a temporary location and then
delete them.
This functions returns when the moves are done, but not necessarily all
deletions are done. This is usually good enough because applications
won't see the path name under the old name anyway after the move.
@param pathName The path na... | [
"Move",
"the",
"path",
"name",
"on",
"each",
"volume",
"to",
"a",
"temporary",
"location",
"and",
"then",
"delete",
"them",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/MRAsyncDiskService.java#L305-L311 |
117,597 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/MRAsyncDiskService.java | MRAsyncDiskService.getRelativePathName | private static String getRelativePathName(String absolutePathName,
String volume) {
absolutePathName = normalizePath(absolutePathName);
// Get the file names
if (!absolutePathName.startsWith(volume)) {
return null;
}
// Get rid of the volume prefix
String fileName = absolutePath... | java | private static String getRelativePathName(String absolutePathName,
String volume) {
absolutePathName = normalizePath(absolutePathName);
// Get the file names
if (!absolutePathName.startsWith(volume)) {
return null;
}
// Get rid of the volume prefix
String fileName = absolutePath... | [
"private",
"static",
"String",
"getRelativePathName",
"(",
"String",
"absolutePathName",
",",
"String",
"volume",
")",
"{",
"absolutePathName",
"=",
"normalizePath",
"(",
"absolutePathName",
")",
";",
"// Get the file names",
"if",
"(",
"!",
"absolutePathName",
".",
... | Get the relative path name with respect to the root of the volume.
@param absolutePathName The absolute path name
@param volume Root of the volume.
@return null if the absolute path name is outside of the volume. | [
"Get",
"the",
"relative",
"path",
"name",
"with",
"respect",
"to",
"the",
"root",
"of",
"the",
"volume",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/MRAsyncDiskService.java#L348-L362 |
117,598 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/MRAsyncDiskService.java | MRAsyncDiskService.moveAndDeleteAbsolutePath | public boolean moveAndDeleteAbsolutePath(String absolutePathName)
throws IOException {
for (int v = 0; v < volumes.length; v++) {
String relative = getRelativePathName(absolutePathName, volumes[v]);
if (relative != null) {
return moveAndDeleteRelativePath(volumes[v], relative);
... | java | public boolean moveAndDeleteAbsolutePath(String absolutePathName)
throws IOException {
for (int v = 0; v < volumes.length; v++) {
String relative = getRelativePathName(absolutePathName, volumes[v]);
if (relative != null) {
return moveAndDeleteRelativePath(volumes[v], relative);
... | [
"public",
"boolean",
"moveAndDeleteAbsolutePath",
"(",
"String",
"absolutePathName",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"v",
"=",
"0",
";",
"v",
"<",
"volumes",
".",
"length",
";",
"v",
"++",
")",
"{",
"String",
"relative",
"=",
"getRela... | Move the path name to a temporary location and then delete it.
Note that if there is no volume that contains this path, the path
will stay as it is, and the function will return false.
This functions returns when the moves are done, but not necessarily all
deletions are done. This is usually good enough because appli... | [
"Move",
"the",
"path",
"name",
"to",
"a",
"temporary",
"location",
"and",
"then",
"delete",
"it",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/MRAsyncDiskService.java#L378-L390 |
117,599 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/GetJournalImageServlet.java | GetJournalImageServlet.buildPath | public static String buildPath(String journalId, long txid,
NamespaceInfo nsInfo, boolean throttle) {
StringBuilder path = new StringBuilder("/getImage?getimage=1&");
try {
path.append(JOURNAL_ID_PARAM).append("=")
.append(URLEncoder.encode(journalId, "UTF-8"));
path.append("&" + TXI... | java | public static String buildPath(String journalId, long txid,
NamespaceInfo nsInfo, boolean throttle) {
StringBuilder path = new StringBuilder("/getImage?getimage=1&");
try {
path.append(JOURNAL_ID_PARAM).append("=")
.append(URLEncoder.encode(journalId, "UTF-8"));
path.append("&" + TXI... | [
"public",
"static",
"String",
"buildPath",
"(",
"String",
"journalId",
",",
"long",
"txid",
",",
"NamespaceInfo",
"nsInfo",
",",
"boolean",
"throttle",
")",
"{",
"StringBuilder",
"path",
"=",
"new",
"StringBuilder",
"(",
"\"/getImage?getimage=1&\"",
")",
";",
"t... | Build path to fetch image at given txid for the given journal.
This path does not contain address. | [
"Build",
"path",
"to",
"fetch",
"image",
"at",
"given",
"txid",
"for",
"the",
"given",
"journal",
".",
"This",
"path",
"does",
"not",
"contain",
"address",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/GetJournalImageServlet.java#L136-L153 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.